Sha256: 188760d90ca3853452594adb81fd89b9e29f9a31efe87e5a294ad49442cd8662

Contents?: true

Size: 1.51 KB

Versions: 20

Compression:

Stored size: 1.51 KB

Contents

module Fog
  module DNS

    def self.[](provider)
      self.new(:provider => provider)
    end

    def self.new(attributes)
      attributes = attributes.dup # prevent delete from having side effects
      case provider = attributes.delete(:provider).to_s.downcase.to_sym
      when :aws
        require 'fog/aws/dns'
        Fog::DNS::AWS.new(attributes)
      when :bluebox
        require 'fog/bluebox/dns'
        Fog::DNS::Bluebox.new(attributes)
      when :dnsimple
        require 'fog/dnsimple/dns'
        Fog::DNS::DNSimple.new(attributes)
      when :dnsmadeeasy
        require 'fog/dnsmadeeasy/dns'
        Fog::DNS::DNSMadeEasy.new(attributes)
      when :dynect
        require 'fog/dynect/dns'
        Fog::DNS::Dynect.new(attributes)
      when :linode
        require 'fog/linode/dns'
        Fog::DNS::Linode.new(attributes)
      when :slicehost
        require 'fog/slicehost/dns'
        Fog::DNS::Slicehost.new(attributes)
      when :zerigo
        require 'fog/zerigo/dns'
        Fog::DNS::Zerigo.new(attributes)
      when :rackspace
        require 'fog/rackspace/dns'
        Fog::DNS::Rackspace.new(attributes)
      else
        raise ArgumentError.new("#{provider} is not a recognized dns provider")
      end
    end

    def self.providers
      Fog.services[:dns]
    end

    def self.zones
      zones = []
      for provider in self.providers
        begin
          zones.concat(self[provider].zones)
        rescue # ignore any missing credentials/etc
        end
      end
      zones
    end

  end
end

Version data entries

20 entries across 20 versions & 5 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
ktheory-fog-1.1.2 lib/fog/dns.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
fog-1.1.2 lib/fog/dns.rb
fog_tractical-1.1.4 lib/fog/dns.rb
fog_tractical-1.1.3 lib/fog/dns.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
fog-1.1.1 lib/fog/dns.rb
fog-1.1.0 lib/fog/dns.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
tag-fog-1.0.1 lib/fog/dns.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
fog-1.0.0 lib/fog/dns.rb