class AWS::Route53::ChangeBatch
Modify resource record sets with ChangeBatch
¶ ↑
batch = AWS::Route53::ChangeBatch.new(hosted_zone_id) batch << AWS::Route53::CreateRequest.new('foo.example.com.', 'A', :resource_records => [{:value => '192.168.0.1'}]) batch << AWS::Route53::DeleteRequest.new('bar.example.com.', 'CNAME') batch << AWS::Route53::DeleteRequest.new('baz.example.com.', 'AAAA') batch << AWS::Route53::CreateRequest.new('baz.example.com.', 'AAAA', :resource_records => [{:value => '192.168.0.3'}]) batch.call
Attributes
changes[R]
@return [Array<ChangeRequest>]
comment[R]
@return [String]
hosted_zone_id[R]
@return [String]
Public Class Methods
new(hosted_zone_id, options = {})
click to toggle source
@private
Calls superclass method
AWS::Core::Model::new
# File lib/aws/route_53/change_batch.rb, line 33 def initialize hosted_zone_id, options = {} super(options) @hosted_zone_id = hosted_zone_id @comment = options[:comment] @changes = [] end
Public Instance Methods
call(options={})
click to toggle source
Calls change batch request. @option (see Client#change_resource_record_sets) @return [ChangeInfo]
# File lib/aws/route_53/change_batch.rb, line 60 def call options={} resp = client.change_resource_record_sets(options.merge(self.to_hash)) if resp[:change_info][:id] ChangeInfo.new_from(:change_resource_record_sets, resp[:change_info], resp[:change_info][:id], :config => config) end end
each(&block)
click to toggle source
Enumerates over changes.
# File lib/aws/route_53/change_batch.rb, line 71 def each(&block) @changes.each(&block) end
length()
click to toggle source
Returns length of changes. @return [Integer]
# File lib/aws/route_53/change_batch.rb, line 77 def length @changes.length end
Also aliased as: size
push(change)
click to toggle source
@param [ChangeRequest] change @return [Array]
# File lib/aws/route_53/change_batch.rb, line 51 def push change @changes.push(change) end
Also aliased as: <<
to_hash()
click to toggle source
Build query from change batch. @return [Hash]
# File lib/aws/route_53/change_batch.rb, line 85 def to_hash q = {} q[:hosted_zone_id] = hosted_zone_id q[:change_batch] = {} q[:change_batch][:comment] = comment if comment q[:change_batch][:changes] = [] self.each { |change| q[:change_batch][:changes] << change.to_hash } q end