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
|
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?
|
||||||
|
|
|
@ -10,15 +10,23 @@ module Fog
|
||||||
attribute :zone
|
attribute :zone
|
||||||
|
|
||||||
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
|
||||||
parent = zone.collection.get(zone.identity)
|
if options[:fqdn]
|
||||||
if parent
|
hosts = service.find_hosts(options[:fqdn], zone.id).body['hosts']
|
||||||
merge_attributes(parent.records.attributes)
|
load(hosts)
|
||||||
load(parent.records.map {|record| record.attributes})
|
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue