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
|
2011-06-16 19:39:51 -04:00
|
|
|
case provider = attributes.delete(:provider).to_s.downcase.to_sym
|
2011-06-15 20:25:01 -04:00
|
|
|
when :aws
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/dns/aws'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::AWS.new(attributes)
|
|
|
|
when :bluebox
|
2011-01-24 20:30:57 -05:00
|
|
|
require 'fog/dns/bluebox'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::Bluebox.new(attributes)
|
|
|
|
when :dnsimple
|
2011-03-09 20:03:15 -05:00
|
|
|
require 'fog/dns/dnsimple'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::DNSimple.new(attributes)
|
|
|
|
when :dnsmadeeasy
|
2011-05-29 19:41:27 -04:00
|
|
|
require 'fog/dns/dnsmadeeasy'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::DNSMadeEasy.new(attributes)
|
2011-07-14 20:22:43 -04:00
|
|
|
when :dynect
|
|
|
|
require 'fog/dns/dynect'
|
|
|
|
Fog::DNS::Dynect.new(attributes)
|
2011-06-15 20:25:01 -04:00
|
|
|
when :linode
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/dns/linode'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::Linode.new(attributes)
|
|
|
|
when :slicehost
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/dns/slicehost'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::Slicehost.new(attributes)
|
|
|
|
when :zerigo
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/dns/zerigo'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::Zerigo.new(attributes)
|
2011-01-04 19:49:35 -05:00
|
|
|
else
|
2011-01-27 04:29:52 -05:00
|
|
|
raise ArgumentError.new("#{provider} is not a recognized dns provider")
|
2011-01-04 19:49:35 -05:00
|
|
|
end
|
|
|
|
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
|