class Cumulus::Route53::ZoneDiff
Public: Represents a single difference between local configuration and AWS configuration of zones.
Attributes
changed_records[RW]
Public Class Methods
records(changed_records, local)
click to toggle source
Public: Static method that produces a diff representing changes in records
changed_records
- the RecordDiffs local - the local configuration for the zone
Returns the diff
# File lib/route53/models/ZoneDiff.rb, line 32 def self.records(changed_records, local) diff = ZoneDiff.new(RECORD, nil, local) diff.changed_records = changed_records diff end
Public Instance Methods
add_string()
click to toggle source
# File lib/route53/models/ZoneDiff.rb, line 47 def add_string "has been added locally, but must be created in AWS manually." end
added_vpc_ids()
click to toggle source
Public: Get the VPCs that have been added locally.
Returns an array of vpc ids
# File lib/route53/models/ZoneDiff.rb, line 94 def added_vpc_ids @local.vpc - @aws.vpc end
asset_type()
click to toggle source
# File lib/route53/models/ZoneDiff.rb, line 38 def asset_type "Zone" end
aws_name()
click to toggle source
# File lib/route53/models/ZoneDiff.rb, line 42 def aws_name access = if @aws.config.private_zone then "private" else "public" end "#{@aws.name} (#{access})" end
diff_string()
click to toggle source
# File lib/route53/models/ZoneDiff.rb, line 51 def diff_string case @type when COMMENT [ "Comment:", Colors.aws_changes("\tAWS - #{@aws.config.comment}"), Colors.local_changes("\tLocal - #{@local.comment}") ].join("\n") when DOMAIN [ "Domain: AWS - #{Colors.aws_changes(@aws.name)}, Local - #{Colors.local_changes(@local.domain)}", "\tAWS doesn't allow you to change the domain for a zone." ].join("\n") when PRIVATE [ "Private: AWS - #{Colors.aws_changes(@aws.config.private_zone)}, Local - #{Colors.local_changes(@local.private)}", "\tAWS doesn't allow you to change whether a zone is private." ].join("\n") when RECORD if Configuration.instance.route53.print_all_ignored [ "Records:", @changed_records.map { |r| "\t#{r}" } ].flatten.join("\n") else [ "Records:", @changed_records.reject { |r| r.type == RecordChange::IGNORED }.map { |r| "\t#{r}" }, "\tYour blacklist ignored #{@changed_records.select { |r| r.type == RecordChange::IGNORED }.size} records." ].flatten.join("\n") end when VPC [ "VPCs:", added_vpc_ids.map { |vpc| Colors.added("\t#{vpc["id"]} | #{vpc["region"]}") }, removed_vpc_ids.map { |vpc| Colors.removed("\t#{vpc["id"]} | #{vpc["region"]}") } ].flatten.join("\n") end end
info_only()
click to toggle source
Public: Override the info_only
attribute such that if this diff is a record diff and it contains only ignored record diffs, we return true.
Returns whether or not this is an info only diff
# File lib/route53/models/ZoneDiff.rb, line 109 def info_only if @type == RECORD @changed_records.all? { |r| r.type == RecordChange::IGNORED } else false end end
removed_vpc_ids()
click to toggle source
Public: Get the VPCs that have been removed locally.
Returns an array of vpc ids
# File lib/route53/models/ZoneDiff.rb, line 101 def removed_vpc_ids @aws.vpc - @local.vpc end