Class: Cumulus::CloudFront::CustomOriginDiff

Inherits:
Cumulus::Common::Diff show all
Includes:
CustomOriginChange
Defined in:
lib/cloudfront/models/CustomOriginDiff.rb

Overview

Public: Represents a single difference between local configuration and AWS configuration of zones.

Constant Summary

Constants included from CustomOriginChange

Cumulus::CloudFront::CustomOriginChange::HTTP, Cumulus::CloudFront::CustomOriginChange::HTTPS, Cumulus::CloudFront::CustomOriginChange::KEEPALIVE_TIMEOUT, Cumulus::CloudFront::CustomOriginChange::POLICY, Cumulus::CloudFront::CustomOriginChange::READ_TIMEOUT, Cumulus::CloudFront::CustomOriginChange::SSL_PROTOCOLS

Constants included from Cumulus::Common::DiffChange

Cumulus::Common::DiffChange::ADD, Cumulus::Common::DiffChange::MODIFIED, Cumulus::Common::DiffChange::UNMANAGED

Instance Attribute Summary collapse

Attributes inherited from Cumulus::Common::Diff

#aws, #changes, #info_only, #local, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Cumulus::Common::DiffChange

next_change_id

Methods inherited from Cumulus::Common::Diff

#add_string, added, #initialize, #local_name, modified, #to_s, unmanaged, #unmanaged_string

Constructor Details

This class inherits a constructor from Cumulus::Common::Diff

Instance Attribute Details

#ssl_protocol_changesObject

Returns the value of attribute ssl_protocol_changes.



24
25
26
# File 'lib/cloudfront/models/CustomOriginDiff.rb', line 24

def ssl_protocol_changes
  @ssl_protocol_changes
end

Class Method Details

.ssl_protocols(changes, aws, local) ⇒ Object

Public: Static method that produces a diff representing changes in ssl protocols

changes - the OriginSslProtocolsDiffs aws - the aws configuration for the custom origin local - the local configuration for the custom origin

Returns the diff containing those changes



33
34
35
36
37
# File 'lib/cloudfront/models/CustomOriginDiff.rb', line 33

def self.ssl_protocols(changes, aws, local)
  diff = CustomOriginDiff.new(SSL_PROTOCOLS, aws, local)
  diff.ssl_protocol_changes = changes
  diff
end

Instance Method Details

#aws_nameObject



81
82
83
# File 'lib/cloudfront/models/CustomOriginDiff.rb', line 81

def aws_name
  @aws.id
end

#diff_stringObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/cloudfront/models/CustomOriginDiff.rb', line 39

def diff_string
  case @type
  when HTTP
    [
      "http port:",
      Colors.aws_changes("\tAWS - #{@aws}"),
      Colors.local_changes("\tLocal - #{@local}"),
    ].join("\n")
  when HTTPS
    [
      "https port:",
      Colors.aws_changes("\tAWS - #{@aws}"),
      Colors.local_changes("\tLocal - #{@local}"),
    ].join("\n")
  when POLICY
    [
      "protocol policy:",
      Colors.aws_changes("\tAWS - #{@aws}"),
      Colors.local_changes("\tLocal - #{@local}"),
    ].join("\n")
  when SSL_PROTOCOLS
    [
      "origin ssl protocols:",
      (@ssl_protocol_changes.flat_map do |c|
        c.to_s.lines.map { |l| "\t#{l.chomp}" }
      end).join("\n"),
    ].join("\n")
  when READ_TIMEOUT
    [
      "origin read timeout:",
      Colors.aws_changes("\tAWS -#{@aws}"),
      Colors.local_changes("\tLocal - #{@local}"),
    ].join("\n")
   when KEEPALIVE_TIMEOUT
    [
      "origin keepalive timeout:",
      Colors.aws_changes("\tAWS -#{@aws}"),
      Colors.local_changes("\tLocal - #{@local}"),
    ].join("\n")
  end
end