1
0
Fork 0
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:
Andreas Gerauer 2013-03-13 09:35:12 +01:00
parent 6988718ab7
commit d954a16354
2 changed files with 20 additions and 21 deletions

View file

@ -8,21 +8,17 @@ module Fog
model Fog::DNS::Rackspace::Zone 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={}) def all(options={})
clear clear
data = service.list_domains(options).body['domains'] data = service.list_domains(options).body['domains']
load(data) load(data)
end 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 alias :each_zone_this_page :each
def each def each
if !block_given? if !block_given?

View file

@ -11,8 +11,15 @@ module Fog
model Fog::DNS::Zerigo::Record 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 requires :zone
if options[:fqdn]
hosts = service.find_hosts(options[:fqdn], zone.id).body['hosts']
load(hosts)
else
parent = zone.collection.get(zone.identity) parent = zone.collection.get(zone.identity)
if parent if parent
merge_attributes(parent.records.attributes) merge_attributes(parent.records.attributes)
@ -21,6 +28,7 @@ module Fog
nil nil
end end
end end
end
def get(record_id) def get(record_id)
data = service.get_host(record_id).body data = service.get_host(record_id).body
@ -34,11 +42,6 @@ module Fog
super({ :zone => zone }.merge!(attributes)) super({ :zone => zone }.merge!(attributes))
end end
def find(fqdn)
hosts = service.find_hosts(fqdn, zone.id).body['hosts']
hosts.collect { |host| new(host) }
end
end end
end end