mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|dns] Added #all! method to Records.
#all! auto-iterates to load all DNS records into the collection.
This commit is contained in:
parent
457e2fd509
commit
4997114b49
1 changed files with 24 additions and 0 deletions
|
@ -37,6 +37,30 @@ module Fog
|
|||
load(data)
|
||||
end
|
||||
|
||||
#
|
||||
# Load all zone records into the collection.
|
||||
#
|
||||
def all!
|
||||
data = []
|
||||
|
||||
begin
|
||||
options = {
|
||||
:name => next_record_name,
|
||||
:type => next_record_type,
|
||||
:identifier => next_record_identifier
|
||||
}
|
||||
batch = connection.list_resource_record_sets(zone.id, options).body
|
||||
# NextRecordIdentifier is completely absent instead of nil, so set to nil, or iteration breaks.
|
||||
batch['NextRecordIdentifier'] = nil unless batch.has_key?('NextRecordIdentifier')
|
||||
|
||||
merge_attributes(batch.reject {|key, value| !['IsTruncated', 'MaxItems', 'NextRecordName', 'NextRecordType', 'NextRecordIdentifier'].include?(key)})
|
||||
|
||||
data.concat(batch['ResourceRecordSets'])
|
||||
end while is_truncated
|
||||
|
||||
load(data)
|
||||
end
|
||||
|
||||
#
|
||||
# AWS Route 53 records are uniquely identified by a compound key of name, type, and identifier.
|
||||
# #get allows one to retrieve a record using one or more of those key components.
|
||||
|
|
Loading…
Add table
Reference in a new issue