Sha256: 71feee6361feecc16e77022fc3fd7283b597d9377ba2fabf90028ac1dfff5e1e

Contents?: true

Size: 1.39 KB

Versions: 12

Compression:

Stored size: 1.39 KB

Contents

require 'fog/core/collection'
require 'fog/aws/models/dns/record'

module Fog
  module DNS
    class AWS

      class Records < Fog::Collection

        attribute :is_truncated,      :aliases => ['IsTruncated']
        attribute :max_items,         :aliases => ['MaxItems']
        attribute :name
        attribute :next_record_name,  :aliases => ['NextRecordName']
        attribute :next_record_type,  :aliases => ['NextRecordType']
        attribute :type

        attribute :zone

        model Fog::DNS::AWS::Record

        def all(options = {})
          requires :zone
          options['maxitems'] ||= max_items
          options['name']     ||= name
          options['type']     ||= type
          data = connection.list_resource_record_sets(zone.id, options).body
          merge_attributes(data.reject {|key, value| !['IsTruncated', 'MaxItems', 'NextRecordName', 'NextRecordType'].include?(key)})
          # leave out the default, read only records
          data = data['ResourceRecordSets'].reject {|record| ['NS', 'SOA'].include?(record['Type'])}
          load(data)
        end

        def get(record_id)
          data = connection.get_change(record_id).body
          new(data)
        rescue Excon::Errors::Forbidden
          nil
        end

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

      end

    end
  end
end

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/dns/records.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/models/dns/records.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/dns/records.rb
fog-1.3.1 lib/fog/aws/models/dns/records.rb
fog-1.3.0 lib/fog/aws/models/dns/records.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/dns/records.rb
fog-1.2.0 lib/fog/aws/models/dns/records.rb
ktheory-fog-1.1.2 lib/fog/aws/models/dns/records.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/dns/records.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/dns/records.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/lib/fog/aws/models/dns/records.rb
fog-1.1.2 lib/fog/aws/models/dns/records.rb