2011-01-04 19:49:35 -05:00
|
|
|
module Fog
|
2011-06-15 20:25:01 -04:00
|
|
|
module DNS
|
|
|
|
|
|
|
|
def self.[](provider)
|
|
|
|
self.new(:provider => provider)
|
|
|
|
end
|
2011-01-04 19:49:35 -05:00
|
|
|
|
|
|
|
def self.new(attributes)
|
|
|
|
attributes = attributes.dup # prevent delete from having side effects
|
2013-02-16 06:28:38 -05:00
|
|
|
provider = attributes.delete(:provider).to_s.downcase.to_sym
|
|
|
|
|
|
|
|
if self.providers.include?(provider)
|
|
|
|
require "fog/#{provider}/dns"
|
|
|
|
return Fog::DNS.const_get(Fog.providers[provider]).new(attributes)
|
2011-01-04 19:49:35 -05:00
|
|
|
end
|
2013-02-16 06:28:38 -05:00
|
|
|
|
|
|
|
raise ArgumentError.new("#{provider} is not a recognized dns provider")
|
2011-01-04 19:49:35 -05:00
|
|
|
end
|
|
|
|
|
2011-07-27 10:30:49 -04:00
|
|
|
def self.providers
|
|
|
|
Fog.services[:dns]
|
|
|
|
end
|
|
|
|
|
2011-06-15 20:25:01 -04:00
|
|
|
def self.zones
|
|
|
|
zones = []
|
2011-07-27 10:30:49 -04:00
|
|
|
for provider in self.providers
|
2011-06-15 20:25:01 -04:00
|
|
|
begin
|
|
|
|
zones.concat(self[provider].zones)
|
|
|
|
rescue # ignore any missing credentials/etc
|
|
|
|
end
|
|
|
|
end
|
|
|
|
zones
|
|
|
|
end
|
|
|
|
|
2011-01-04 19:49:35 -05:00
|
|
|
end
|
|
|
|
end
|