class AWS::Route53::ResourceRecordSetCollection

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']

Attributes

hosted_zone_id[R]

@return [String]

Public Class Methods

new(hosted_zone_id, options = {}) click to toggle source

@private

Calls superclass method
# File lib/aws/route_53/resource_record_set_collection.rb, line 34
def initialize hosted_zone_id, options = {}
  @hosted_zone_id = hosted_zone_id
  @filters = options[:filters] || {}
  super
end

Public Instance Methods

[](name, type, set_identifier = nil) click to toggle source

Find resource record set by its name, type and identifier. @param [String] name @param [String] type @param [String] set_identifier @return [ResourceRecordSet]

# 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 = {}) click to toggle source

Create new resource record set. @param [String] name @param [String] type @param [Hash] options @return [ResourceRecordSet]

# 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

Private Instance Methods

_each_item(next_token, limit, options = {}) { |rrset| ... } click to toggle source
# File lib/aws/route_53/resource_record_set_collection.rb, line 74
def _each_item next_token, limit, options = {}, &block

  options = @filters.merge(options)

  options[:start_record_name] = next_token[:next_record_name] if next_token and next_token[:next_record_name]
  options[:start_record_type] = next_token[:next_record_type] if next_token and next_token[:next_record_type]
  options[:start_record_identifier] = next_token[:next_record_identifier] if next_token and next_token[:next_record_identifier]
  options[:maxitems] = limit if limit

  options[:hosted_zone_id] = hosted_zone_id

  resp = client.list_resource_record_sets(options)
  resp.data[:resource_record_sets].each do |details|
    rrset = ResourceRecordSet.new_from(
      :list_resource_record_sets,
      details,
      details[:name],
      details[:type],
      :set_identifier => details[:set_identifier],
      :hosted_zone_id => hosted_zone_id, :config => config)

    yield(rrset)

  end

  if resp.data[:is_truncated]
    {
      :next_record_name => resp.data[:next_record_name],
      :next_record_type => resp.data[:next_record_type],
      :next_record_identifier => resp.data[:next_record_identifier],
    }
  end
end