Class: Cumulus::Route53::SingleRecordDiff

Inherits:
Common::Diff show all
Includes:
RecordChange
Defined in:
lib/route53/models/RecordDiff.rb

Overview

Public: Represents a single difference between local configuration and AWS configuration for a single record. This class allows all the changes for a record to be grouped together when printed.

Constant Summary

Constants included from RecordChange

RecordChange::ALIAS, RecordChange::CHANGED, RecordChange::DEFAULT, RecordChange::IGNORED, RecordChange::TTL, RecordChange::VALUE

Constants included from Common::DiffChange

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

Instance Attribute Summary

Attributes inherited from Common::Diff

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

Instance Method Summary collapse

Methods included from Common::DiffChange

next_change_id

Methods inherited from 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 Method Details

#diff_stringObject



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/route53/models/RecordDiff.rb', line 101

def diff_string
  case @type
  when ALIAS
    if @local.is_elb_alias?
      aws_name = ELB::get_aws_by_dns_name(@aws.alias_target.elb_dns_name).load_balancer_name
      "Alias: AWS - #{Colors.aws_changes(aws_name)}, Local - #{Colors.local_changes(@local.alias_target.name)}"
    else
      "Alias: AWS - #{Colors.aws_changes(@aws.alias_target.chomped_dns)}, Local - #{Colors.local_changes(@local.alias_target.dns_name)}"
    end
  when TTL
    "TTL: AWS - #{Colors.aws_changes(@aws.ttl)}, Local - #{Colors.local_changes(@local.ttl)}"
  when VALUE
    [
      "Value:",
      values_to_add.map { |v| Colors.added("\t\t\t#{v}") },
      values_to_remove.map { |v| Colors.removed("\t\t\t#{v}") }
    ].flatten.join("\n")
  end
end