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
#action_create ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 50 def action_create return if current.exist @route53.change_resource_record_sets( change_batch: @change_batch, hosted_zone_id: attributes.hosted_zone_id ) end |
#action_delete ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 65 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 |
#action_upsert ⇒ Object
58 59 60 61 62 63 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 58 def action_upsert @route53.change_resource_record_sets( change_batch: @change_batch, hosted_zone_id: attributes.hosted_zone_id ) end |
#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
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 22 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 |
#set_current_attributes ⇒ Object
46 47 48 |
# File 'lib/itamae-spec/resource/route53_record.rb', line 46 def set_current_attributes current.modified = false end |