Class: AWS::Route53::ChangeBatch
- Inherits:
-
Object
- Object
- AWS::Route53::ChangeBatch
- Includes:
- Enumerable
- Defined in:
- lib/aws/route_53/change_batch.rb
Overview
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
Instance Attribute Summary collapse
- #changes ⇒ Array<ChangeRequest> readonly
- #comment ⇒ String readonly
- #hosted_zone_id ⇒ String readonly
Instance Method Summary collapse
-
#call(options = {}) ⇒ ChangeInfo
Calls change batch request.
-
#each(&block) ⇒ Object
Enumerates over changes.
-
#length ⇒ Integer
(also: #size)
Returns length of changes.
- #push(change) ⇒ Array (also: #<<)
-
#to_hash ⇒ Hash
Build query from change batch.
Instance Attribute Details
#changes ⇒ Array<ChangeRequest> (readonly)
44 45 46 |
# File 'lib/aws/route_53/change_batch.rb', line 44 def changes @changes end |
#comment ⇒ String (readonly)
47 48 49 |
# File 'lib/aws/route_53/change_batch.rb', line 47 def comment @comment end |
#hosted_zone_id ⇒ String (readonly)
41 42 43 |
# File 'lib/aws/route_53/change_batch.rb', line 41 def hosted_zone_id @hosted_zone_id end |
Instance Method Details
#call(options = {}) ⇒ ChangeInfo
Calls change batch request.
60 61 62 63 64 65 66 67 68 |
# File 'lib/aws/route_53/change_batch.rb', line 60 def call ={} resp = client.change_resource_record_sets(.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) ⇒ Object
Enumerates over changes.
71 72 73 |
# File 'lib/aws/route_53/change_batch.rb', line 71 def each(&block) @changes.each(&block) end |
#length ⇒ Integer Also known as: size
Returns length of changes.
77 78 79 |
# File 'lib/aws/route_53/change_batch.rb', line 77 def length @changes.length end |
#push(change) ⇒ Array Also known as: <<
51 52 53 |
# File 'lib/aws/route_53/change_batch.rb', line 51 def push change @changes.push(change) end |
#to_hash ⇒ Hash
Build query from change batch.
85 86 87 88 89 90 91 92 93 94 95 |
# 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 |