Sha256: 374c2be0d2c8b23a26c06cc6bd64edb59be836815b18399429f158794a844dbd

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 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/dns/aws'
        Fog::DNS::AWS.new(attributes)
      when :bluebox
        require 'fog/dns/bluebox'
        Fog::DNS::Bluebox.new(attributes)
      when :dnsimple
        require 'fog/dns/dnsimple'
        Fog::DNS::DNSimple.new(attributes)
      when :dnsmadeeasy
        require 'fog/dns/dnsmadeeasy'
        Fog::DNS::DNSMadeEasy.new(attributes)
      when :dynect
        require 'fog/dns/dynect'
        Fog::DNS::Dynect.new(attributes)
      when :linode
        require 'fog/dns/linode'
        Fog::DNS::Linode.new(attributes)
      when :slicehost
        require 'fog/dns/slicehost'
        Fog::DNS::Slicehost.new(attributes)
      when :zerigo
        require 'fog/dns/zerigo'
        Fog::DNS::Zerigo.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

3 entries across 3 versions & 2 rubygems

Version Path
brightbox-cli-0.13.1 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
brightbox-cli-0.13.0 lib/brightbox-cli/vendor/fog/lib/fog/dns.rb
fog-0.11.0 lib/fog/dns.rb