Class: Roadworker::Route53Wrapper::ResourceRecordSetCollectionWrapper
- Inherits:
-
Object
- Object
- Roadworker::Route53Wrapper::ResourceRecordSetCollectionWrapper
- Includes:
- Log
- Defined in:
- lib/roadworker/route53-wrapper.rb
Overview
HostedZoneWrapper
Instance Method Summary collapse
- #create(name, type, expected_record) ⇒ Object
- #each ⇒ Object
-
#initialize(resource_record_sets, hosted_zone, options) ⇒ ResourceRecordSetCollectionWrapper
constructor
A new instance of ResourceRecordSetCollectionWrapper.
Methods included from Log
Constructor Details
#initialize(resource_record_sets, hosted_zone, options) ⇒ ResourceRecordSetCollectionWrapper
Returns a new instance of ResourceRecordSetCollectionWrapper.
105 106 107 108 109 |
# File 'lib/roadworker/route53-wrapper.rb', line 105 def initialize(resource_record_sets, hosted_zone, ) @resource_record_sets = resource_record_sets @hosted_zone = hosted_zone = end |
Instance Method Details
#create(name, type, expected_record) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/roadworker/route53-wrapper.rb', line 117 def create(name, type, expected_record) log(:info, 'Create ResourceRecordSet', :cyan) do log_id = [name, type].join(' ') rrset_setid = expected_record.set_identifier rrset_setid ? (log_id + " (#{rrset_setid})") : log_id end if .dry_run record = expected_record else opts = {} Route53Wrapper::RRSET_ATTRS.each do |attribute| value = expected_record.send(attribute) next unless value case attribute when :dns_name attribute = :alias_target dns_name, dns_name_opts = value value = AWS::Route53.dns_name_to_alias_target(dns_name, dns_name_opts, @hosted_zone.id, @hosted_zone.name || .hosted_zone_name) when :health_check attribute = :health_check_id value = .health_checks.find_or_create(value) end opts[attribute] = value end record = @resource_record_sets.create(name, type, opts) .updated = true end ResourceRecordSetWrapper.new(record, @hosted_zone, ) end |
#each ⇒ Object
111 112 113 114 115 |
# File 'lib/roadworker/route53-wrapper.rb', line 111 def each Collection.batch(@resource_record_sets) do |record| yield(ResourceRecordSetWrapper.new(record, @hosted_zone, )) end end |