class Cumulus::CloudFront::DistributionDiff
Public: Represents a single difference between local configuration and AWS configuration of zones.
Attributes
added_aliases[RW]
cache[RW]
changed_origins[RW]
default_cache[RW]
removed_aliases[RW]
Public Class Methods
aliases(added, removed, local)
click to toggle source
# File lib/cloudfront/models/DistributionDiff.rb, line 43 def self.aliases(added, removed, local) diff = DistributionDiff.new(ALIASES, nil, local) diff.added_aliases = added diff.removed_aliases = removed diff end
caches(removed, added, diffs, local)
click to toggle source
# File lib/cloudfront/models/DistributionDiff.rb, line 56 def self.caches(removed, added, diffs, local) diff = DistributionDiff.new(CACHES, nil, local) diff.cache = Common::ListChange.new(removed, added, diffs) diff end
default_cache(diffs, local)
click to toggle source
# File lib/cloudfront/models/DistributionDiff.rb, line 50 def self.default_cache(diffs, local) diff = DistributionDiff.new(CACHE_DEFAULT, nil, local) diff.default_cache = diffs diff end
origins(changes, local)
click to toggle source
Public: Static method that produces a diff representing changes in origins
changes - the OriginDiffs local - the local configuration for the distribution
Returns the diff
# File lib/cloudfront/models/DistributionDiff.rb, line 37 def self.origins(changes, local) diff = DistributionDiff.new(ORIGINS, nil, local) diff.changed_origins = changes diff end
Public Instance Methods
asset_type()
click to toggle source
# File lib/cloudfront/models/DistributionDiff.rb, line 120 def asset_type "Cloudfront Distribution" end
aws_name()
click to toggle source
# File lib/cloudfront/models/DistributionDiff.rb, line 124 def aws_name @aws.id end
diff_string()
click to toggle source
# File lib/cloudfront/models/DistributionDiff.rb, line 62 def diff_string case @type when ALIASES [ "aliases:", @removed_aliases.map { |removed| Colors.removed("\t#{removed}") }, @added_aliases.map { |added| Colors.added("\t#{added}") }, ].flatten.join("\n") when ORIGINS [ "origins:", @changed_origins.map do |o| if o.type == ADD or o.type == UNMANAGED o.to_s.lines.map { |l| "\t#{l}".chomp("\n")} else [ "\t#{o.local_name}", o.to_s.lines.map { |l| "\t\t#{l}".chomp("\n")} ].join("\n") end end ].flatten.join("\n") when CACHE_DEFAULT [ "default cache behavior:", (@default_cache.map do |c| c.to_s.lines.map { |l| "\t#{l}".chomp("\n")} end).join("\n"), ].join("\n") when CACHES [ "cache behaviors:", @cache.removed.map { |removed| Colors.removed("\t#{removed}") }, @cache.added.map { |added| Colors.added("\t#{added}") }, @cache.modified.map do |cache_name, cdiffs| [ "\t#{cache_name}", cdiffs.map do |cdiff| cdiff.to_s.lines.map { |l| "\t\t#{l.chomp}"} end ] end ].flatten.join("\n") when COMMENT [ "comment:", Colors.aws_changes("\tAWS - #{@aws.comment}"), Colors.local_changes("\tLocal - #{@local.comment}"), ].join("\n") when ENABLED [ "enabled:", Colors.aws_changes("\tAWS - #{@aws.enabled}"), Colors.local_changes("\tLocal - #{@local.enabled}"), ].join("\n") end end