Class: AWS::Route53::ResourceRecordSetCollection

Inherits:
Object
  • Object
show all
Includes:
Core::Collection::WithLimitAndNextToken
Defined in:
lib/aws/route_53/resource_record_set_collection.rb

Overview

Create new resource record set

rrsets = AWS::Route53::HostedZone.new(hosted_zone_id).rrsets
rrset = rrsets.create('foo.example.com.', 'A', :ttl => 300, :resource_records => [{:value => '127.0.0.1'}])

Find existing resource record set

rrsets = AWS::Route53::HostedZone.new(hosted_zone_id).rrsets
rrset = rrsets['foo.example.com.', 'A']

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Instance Attribute Details

#hosted_zone_idString (readonly)

Returns:

  • (String)


41
42
43
# File 'lib/aws/route_53/resource_record_set_collection.rb', line 41

def hosted_zone_id
  @hosted_zone_id
end

Instance Method Details

#[](name, type, set_identifier = nil) ⇒ ResourceRecordSet

Find resource record set by its name, type and identifier.

Parameters:

  • name (String)
  • type (String)
  • set_identifier (String) (defaults to: nil)

Returns:



48
49
50
# File 'lib/aws/route_53/resource_record_set_collection.rb', line 48

def [] name, type, set_identifier = nil
  ResourceRecordSet.new(name, type, :set_identifier => set_identifier, :hosted_zone_id => hosted_zone_id, :config => config)
end

#create(name, type, options = {}) ⇒ ResourceRecordSet

Create new resource record set.

Parameters:

  • name (String)
  • type (String)
  • options (Hash) (defaults to: {})

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/aws/route_53/resource_record_set_collection.rb', line 57

def create name, type, options = {}
  batch = ChangeBatch.new(hosted_zone_id, :comment => options[:comment], :config => config)
  batch << CreateRequest.new(name, type, options)

  change_info = batch.call()
  if change_info
    ResourceRecordSet.new(name,
                          type,
                          :set_identifier => options[:set_identifier],
                          :change_info => change_info,
                          :hosted_zone_id => hosted_zone_id,
                          :config => config)
  end
end