2011-01-04 16:49:35 -08:00
|
|
|
module Fog
|
2011-06-15 17:25:01 -07:00
|
|
|
module DNS
|
|
|
|
|
|
|
|
def self.[](provider)
|
|
|
|
self.new(:provider => provider)
|
|
|
|
end
|
2011-01-04 16:49:35 -08:00
|
|
|
|
|
|
|
def self.new(attributes)
|
|
|
|
attributes = attributes.dup # prevent delete from having side effects
|
2011-06-16 16:39:51 -07:00
|
|
|
case provider = attributes.delete(:provider).to_s.downcase.to_sym
|
2011-06-15 17:25:01 -07:00
|
|
|
when :aws
|
2011-01-07 18:12:05 -08:00
|
|
|
require 'fog/dns/aws'
|
2011-06-15 17:25:01 -07:00
|
|
|
Fog::DNS::AWS.new(attributes)
|
|
|
|
when :bluebox
|
2011-01-24 17:30:57 -08:00
|
|
|
require 'fog/dns/bluebox'
|
2011-06-15 17:25:01 -07:00
|
|
|
Fog::DNS::Bluebox.new(attributes)
|
|
|
|
when :dnsimple
|
2011-03-09 17:03:15 -08:00
|
|
|
require 'fog/dns/dnsimple'
|
2011-06-15 17:25:01 -07:00
|
|
|
Fog::DNS::DNSimple.new(attributes)
|
|
|
|
when :dnsmadeeasy
|
2011-05-30 00:41:27 +01:00
|
|
|
require 'fog/dns/dnsmadeeasy'
|
2011-06-15 17:25:01 -07:00
|
|
|
Fog::DNS::DNSMadeEasy.new(attributes)
|
|
|
|
when :linode
|
2011-01-07 18:12:05 -08:00
|
|
|
require 'fog/dns/linode'
|
2011-06-15 17:25:01 -07:00
|
|
|
Fog::DNS::Linode.new(attributes)
|
|
|
|
when :slicehost
|
2011-01-07 18:12:05 -08:00
|
|
|
require 'fog/dns/slicehost'
|
2011-06-15 17:25:01 -07:00
|
|
|
Fog::DNS::Slicehost.new(attributes)
|
|
|
|
when :zerigo
|
2011-01-07 18:12:05 -08:00
|
|
|
require 'fog/dns/zerigo'
|
2011-06-15 17:25:01 -07:00
|
|
|
Fog::DNS::Zerigo.new(attributes)
|
2011-01-04 16:49:35 -08:00
|
|
|
else
|
2011-01-27 17:29:52 +08:00
|
|
|
raise ArgumentError.new("#{provider} is not a recognized dns provider")
|
2011-01-04 16:49:35 -08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-06-15 17:25:01 -07:00
|
|
|
def self.zones
|
|
|
|
zones = []
|
|
|
|
for provider in [:aws, :bluebox, :dnsimple, :dnsmadeeasy, :linode, :slicehost, :zerigo]
|
|
|
|
begin
|
|
|
|
zones.concat(self[provider].zones)
|
|
|
|
rescue # ignore any missing credentials/etc
|
|
|
|
end
|
|
|
|
end
|
|
|
|
zones
|
|
|
|
end
|
|
|
|
|
2011-01-04 16:49:35 -08:00
|
|
|
end
|
|
|
|
end
|