class AWS::Route53::HostedZoneCollection

# Create new hosted zone

r53 = AWS::Route53.new
hosted_zone = r53.hosted_zones.create('example.com.')

# Find existing hosted zone

r53 = AWS::Route53.new
# to lookup a route53 hosted zone, you need to use the zone id (i.e hosted_zone.id)
hosted_zone = r53.hosted_zones['Zabcdefghijklm']

Public Class Methods

new(options = {}) click to toggle source

@api private

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

Public Instance Methods

[](hosted_zone_id) click to toggle source

Find hosted zone by id. @param [String] hosted_zone_id @return [HostedZone]

# File lib/aws/route_53/hosted_zone_collection.rb, line 43
def [] hosted_zone_id
  HostedZone.new(hosted_zone_id, :config => config)
end
create(name, options = {}) click to toggle source

@param [String] name @option options [String] :comment @option options [String] :caller_reference @return [HostedZone]

# File lib/aws/route_53/hosted_zone_collection.rb, line 51
def create name, options = {}
  options[:name] = name
  unless options[:caller_reference]
    options[:caller_reference] = "CreateHostedZone, #{name}, #{Time.now.httpdate}"
  end
  if options[:comment]
    options[:hosted_zone_config] ||= {}
    options[:hosted_zone_config][:comment] = options.delete(:comment)
  end

  resp = client.create_hosted_zone(options)

  change_info = ChangeInfo.new_from(:create_hosted_zone, resp,
    resp[:change_info][:id],
    :config => config)

  HostedZone.new_from(:create_hosted_zone, resp,
    resp[:hosted_zone][:id],
    :change_info => change_info,
    :config => config)

end

Protected Instance Methods

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

  options = @filters.merge(options)

  options[:marker] = next_token if next_token
  options[:maxitems] = limit if limit

  resp = client.list_hosted_zones(options)
  resp.data[:hosted_zones].each do |details|
    hosted_zone = HostedZone.new_from(
      :list_hosted_zones,
      details,
      details[:id],
      :config => config)

    yield(hosted_zone)

  end

  resp.data[:next_marker]

end