Class: Roadworker::Route53Wrapper::ResourceRecordSetWrapper
- Inherits:
-
Object
- Object
- Roadworker::Route53Wrapper::ResourceRecordSetWrapper
show all
- Includes:
- Log
- Defined in:
- lib/roadworker/route53-wrapper.rb
Overview
ResourceRecordSetCollectionWrapper
Instance Method Summary
collapse
Methods included from Log
#log
Constructor Details
#initialize(resource_record_set, hosted_zone, options) ⇒ ResourceRecordSetWrapper
Returns a new instance of ResourceRecordSetWrapper.
177
178
179
180
181
|
# File 'lib/roadworker/route53-wrapper.rb', line 177
def initialize(resource_record_set, hosted_zone, options)
@resource_record_set = resource_record_set
@hosted_zone = hosted_zone
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
251
252
253
|
# File 'lib/roadworker/route53-wrapper.rb', line 251
def method_missing(method_name, *args)
@resource_record_set.send(method_name, *args)
end
|
Instance Method Details
#dns_name ⇒ Object
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/roadworker/route53-wrapper.rb', line 231
def dns_name
alias_target = @resource_record_set.alias_target || {}
dns_name = alias_target[:dns_name]
if dns_name
[
dns_name,
Aws::Route53.normalize_dns_name_options(alias_target),
]
else
nil
end
end
|
#eql?(expected_record) ⇒ Boolean
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
# File 'lib/roadworker/route53-wrapper.rb', line 183
def eql?(expected_record)
Route53Wrapper::RRSET_ATTRS_WITH_TYPE.all? do |attribute|
expected = expected_record.public_send(attribute)
expected = Aws::Route53.sort_rrset_values(attribute, expected) if expected.kind_of?(Array)
expected = nil if expected.kind_of?(Array) && expected.empty?
actual = self.public_send(attribute)
actual = Aws::Route53.sort_rrset_values(attribute, actual) if actual.kind_of?(Array)
actual = nil if actual.kind_of?(Array) && actual.empty?
if attribute == :geo_location and actual
actual = Hash[actual.each_pair.select {|k, v| not v.nil? }]
end
if !expected and !actual
true
elsif expected and actual
case attribute
when :health_check
if actual[:alarm_identifier]
actual[:alarm_identifier] = actual[:alarm_identifier].to_h
end
when :dns_name
expected[0] = expected[0].downcase.sub(/\.\z/, '')
actual[0] = actual[0].downcase.sub(/\.\z/, '')
if expected[0] !~ /\Adualstack\./i and actual[0] =~ /\Adualstack\./i
log(:warn, "`dualstack` prefix is used in the actual DNS name", :yellow) do
log_id = [self.name, self.type].join(' ')
rrset_setid = self.set_identifier
rrset_setid ? (log_id + " (#{rrset_setid})") : log_id
end
actual[0].sub!(/\Adualstack\./i, '')
end
end
(expected == actual)
else
false
end
end
end
|
#health_check ⇒ Object
245
246
247
|
# File 'lib/roadworker/route53-wrapper.rb', line 245
def health_check
@options.health_checks[@resource_record_set.health_check_id]
end
|
#name ⇒ Object
226
227
228
229
|
# File 'lib/roadworker/route53-wrapper.rb', line 226
def name
value = @resource_record_set.name
value ? value.gsub("\\052", '*') : value
end
|