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::POLICY, 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.



22
23
24
# File 'lib/cloudfront/models/CustomOriginDiff.rb', line 22

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



31
32
33
34
35
# File 'lib/cloudfront/models/CustomOriginDiff.rb', line 31

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



67
68
69
# File 'lib/cloudfront/models/CustomOriginDiff.rb', line 67

def aws_name
  @aws.id
end

#diff_stringObject



37
38
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
# File 'lib/cloudfront/models/CustomOriginDiff.rb', line 37

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")
  end
end