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-08-24 21:02:00 -04:00
|
|
|
require 'fog/aws/dns'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::AWS.new(attributes)
|
|
|
|
when :bluebox
|
2011-08-24 21:02:00 -04:00
|
|
|
require 'fog/bluebox/dns'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::Bluebox.new(attributes)
|
|
|
|
when :dnsimple
|
2011-08-24 21:02:00 -04:00
|
|
|
require 'fog/dnsimple/dns'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::DNSimple.new(attributes)
|
|
|
|
when :dnsmadeeasy
|
2011-08-24 21:02:00 -04:00
|
|
|
require 'fog/dnsmadeeasy/dns'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::DNSMadeEasy.new(attributes)
|
2012-03-10 17:02:28 -05:00
|
|
|
when :dreamhost
|
|
|
|
require 'fog/dreamhost/dns'
|
|
|
|
Fog::DNS::Dreamhost.new(attributes)
|
2011-07-14 20:22:43 -04:00
|
|
|
when :dynect
|
2011-08-24 21:02:00 -04:00
|
|
|
require 'fog/dynect/dns'
|
2011-07-14 20:22:43 -04:00
|
|
|
Fog::DNS::Dynect.new(attributes)
|
2011-06-15 20:25:01 -04:00
|
|
|
when :linode
|
2011-08-24 21:02:00 -04:00
|
|
|
require 'fog/linode/dns'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::Linode.new(attributes)
|
|
|
|
when :zerigo
|
2011-08-24 15:40:47 -04:00
|
|
|
require 'fog/zerigo/dns'
|
2011-06-15 20:25:01 -04:00
|
|
|
Fog::DNS::Zerigo.new(attributes)
|
2011-08-15 22:22:35 -04:00
|
|
|
when :rackspace
|
2011-08-29 11:37:01 -04:00
|
|
|
require 'fog/rackspace/dns'
|
2011-08-15 22:22:35 -04:00
|
|
|
Fog::DNS::Rackspace.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
|