Class: Itamae::Resource::Route53Record
- Defined in:
- lib/itamae-spec/resource/route53_record.rb
Instance Method Summary collapse
- #action_create ⇒ Object
- #action_delete ⇒ Object
- #action_upsert ⇒ Object
-
#pre_action ⇒ Object
define_attribute :set_identifier, type: String define_attribute :weight, type: String define_attribute :failover, type: String define_attribute :health_check_id, type: String define_attribute :traffic_policy_instance_id, type: String.
- #set_current_attributes ⇒ Object
Methods inherited from File
Instance Method Details
permalink #action_create ⇒ Object
[View source]
49 50 51 52 53 54 55 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 49 def action_create return if current.exist @route53.change_resource_record_sets( change_batch: @change_batch, hosted_zone_id: attributes.hosted_zone_id ) end |
permalink #action_delete ⇒ Object
[View source]
64 65 66 67 68 69 70 71 72 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 64 def action_delete return unless current.exist @route53.change_resource_record_sets( change_batch: @change_batch, hosted_zone_id: attributes.hosted_zone_id ) rescue Aws::Route53::Errors::InvalidChangeBatch => e Itamae.logger.warn e.inspect end |
permalink #action_upsert ⇒ Object
[View source]
57 58 59 60 61 62 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 57 def action_upsert @route53.change_resource_record_sets( change_batch: @change_batch, hosted_zone_id: attributes.hosted_zone_id ) end |
permalink #pre_action ⇒ Object
define_attribute :set_identifier, type: String define_attribute :weight, type: String define_attribute :failover, type: String define_attribute :health_check_id, type: String define_attribute :traffic_policy_instance_id, type: String
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 21 def pre_action attributes.record_name = attributes.record_name + '.' unless attributes.record_name[-1] == '.' credentials = Aws::SharedCredentials.new(profile_name: attributes.profile) @route53 = Aws::Route53::Client.new(region: attributes.region, credentials: credentials) @change_batch = define_change_batch resource_record_set = @change_batch[:changes][0][:resource_record_set] attributes.content = MultiJson.dump(resource_record_set, pretty: true) @resource_record_set = compare_record_values(fetch_record) case @current_action when :create attributes.exist = true when :upsert attributes.exist = true when :delete attributes.exist = false end send_tempfile compare_file if @current_action == :upsert end |
permalink #set_current_attributes ⇒ Object
[View source]
45 46 47 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 45 def set_current_attributes current.modified = false end |