Sha256: 6472229836946476bbcaf344d01da8df5f565c481c88a87234fadd49b2752212

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

module Fog
  module DNS
    def self.[](provider)
      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 :stormondemand
        require "fog/storm_on_demand/dns"
        Fog::DNS::StormOnDemand.new(attributes)
      else
        if providers.include?(provider)
          require "fog/#{provider}/dns"
          begin
            Fog::DNS.const_get(Fog.providers[provider])
          rescue
            Fog.const_get(Fog.providers[provider])::DNS
          end.new(attributes)
        else
          raise ArgumentError, "#{provider} is not a recognized dns provider"
        end
      end
    end

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

    def self.zones
      zones = []
      providers.each do |provider|
        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 & 1 rubygems

Version Path
fog-core-1.27.1 lib/fog/dns.rb
fog-core-1.27.0 lib/fog/dns.rb
fog-core-1.25.0 lib/fog/dns.rb