Class: Fog::AWS::DNS::Records

Inherits:
Collection show all
Defined in:
lib/fog/aws/models/dns/records.rb

Instance Attribute Summary

Attributes inherited from Collection

#connection

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #initialize, #inspect, #load, model, #model, #reload, #table, #to_json

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#all(options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/fog/aws/models/dns/records.rb', line 21

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)})
  load(data['ResourceRecordSets'])
end

#get(record_id) ⇒ Object



31
32
33
34
35
36
# File 'lib/fog/aws/models/dns/records.rb', line 31

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

#new(attributes = {}) ⇒ Object



38
39
40
41
# File 'lib/fog/aws/models/dns/records.rb', line 38

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