Sha256: a854a2b25622db7d264a5b57f1f0679a4fe36fc03022b73429e971d732349a51

Contents?: true

Size: 1.39 KB

Versions: 14

Compression:

Stored size: 1.39 KB

Contents

module Fog
  module DNS
    class Google
      class Records < Fog::Collection
        model Fog::DNS::Google::Record

        attribute :zone

        ##
        # Enumerates Resource Record Sets that have been created but not yet deleted
        #
        # @return [Array<Fog::DNS::Google::Record>] List of Resource Record Sets resources
        def all
          requires :zone

          data = service.list_resource_record_sets(zone.identity).body["rrsets"] || []
          load(data)
        rescue Fog::Errors::NotFound
          []
        end

        ##
        # Fetches the representation of an existing Resource Record Set
        #
        # @param [String] name Resource Record Set name
        # @param [String] type Resource Record Set type
        # @return [Fog::DNS::Google::Record] Resource Record Set resource
        def get(name, type)
          requires :zone

          records = service.list_resource_record_sets(zone.identity, :name => name, :type => type).body["rrsets"] || []
          records.any? ? new(records.first) : nil
        rescue Fog::Errors::NotFound
          nil
        end

        ##
        # Creates a new instance of a Resource Record Set
        #
        # @return [Fog::DNS::Google::Record] Resource Record Set resource
        def new(attributes = {})
          requires :zone

          super({ :zone => zone }.merge!(attributes))
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-google-0.6.0 lib/fog/dns/google/models/records.rb
fog-google-0.5.5 lib/fog/dns/google/models/records.rb
fog-google-0.5.4 lib/fog/dns/google/models/records.rb
fog-google-0.5.3 lib/fog/dns/google/models/records.rb
fog-google-0.5.2 lib/fog/dns/google/models/records.rb
fog-google-0.5.1 lib/fog/dns/google/models/records.rb
fog-google-0.5.0 lib/fog/dns/google/models/records.rb
fog-google-0.4.2 lib/fog/dns/google/models/records.rb
fog-google-0.4.1 lib/fog/dns/google/models/records.rb
fog-google-0.4.0 lib/fog/dns/google/models/records.rb
fog-google-0.3.2 lib/fog/dns/google/models/records.rb
fog-google-0.3.1 lib/fog/dns/google/models/records.rb
fog-google-0.3.0 lib/fog/dns/google/models/records.rb
fog-google-0.2.0 lib/fog/dns/google/models/records.rb