mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Removed Zerigo::Models::DNS::Records#find method, moved functionality to all(options)
Removed Rackspace::Models::DNS::Zones#find, moved functionality to all(options)
This commit is contained in:
parent
6988718ab7
commit
d954a16354
2 changed files with 20 additions and 21 deletions
|
@ -8,21 +8,17 @@ module Fog
|
|||
|
||||
model Fog::DNS::Rackspace::Zone
|
||||
|
||||
# List all domains. Return by default a maximum of 100 items
|
||||
# @param [Hash] options Options to pass to the underlying API call
|
||||
# @option options [String] :name search for domains containing the given substring
|
||||
# @option options [Integer] :limit number of records to return
|
||||
# @option options [Integer] :offset starting offset of records to return
|
||||
def all(options={})
|
||||
clear
|
||||
data = service.list_domains(options).body['domains']
|
||||
load(data)
|
||||
end
|
||||
|
||||
# Returns all domains containing the given substring. Still limited
|
||||
# by the 100-domain pagination limit. Returns an empty array if
|
||||
# no matches.
|
||||
def find(substring)
|
||||
clear
|
||||
data = service.list_domains(:name => substring).body['domains']
|
||||
load(data)
|
||||
end
|
||||
|
||||
alias :each_zone_this_page :each
|
||||
def each
|
||||
if !block_given?
|
||||
|
|
|
@ -10,15 +10,23 @@ module Fog
|
|||
attribute :zone
|
||||
|
||||
model Fog::DNS::Zerigo::Record
|
||||
|
||||
def all
|
||||
|
||||
# List all domains
|
||||
# @param [Hash] options Options to pass to the underlying API call
|
||||
# @option options [String] :fqdn search for the given fqdn
|
||||
def all(options = {})
|
||||
requires :zone
|
||||
parent = zone.collection.get(zone.identity)
|
||||
if parent
|
||||
merge_attributes(parent.records.attributes)
|
||||
load(parent.records.map {|record| record.attributes})
|
||||
if options[:fqdn]
|
||||
hosts = service.find_hosts(options[:fqdn], zone.id).body['hosts']
|
||||
load(hosts)
|
||||
else
|
||||
nil
|
||||
parent = zone.collection.get(zone.identity)
|
||||
if parent
|
||||
merge_attributes(parent.records.attributes)
|
||||
load(parent.records.map {|record| record.attributes})
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -34,11 +42,6 @@ module Fog
|
|||
super({ :zone => zone }.merge!(attributes))
|
||||
end
|
||||
|
||||
def find(fqdn)
|
||||
hosts = service.find_hosts(fqdn, zone.id).body['hosts']
|
||||
hosts.collect { |host| new(host) }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue