You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: AWS::Route53::HostedZoneCollection

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

Overview

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

Instance Method Summary collapse

Methods included from Core::Collection

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

Instance Method Details

#[](hosted_zone_id) ⇒ HostedZone

Find hosted zone by id.

Parameters:

  • hosted_zone_id (String)

Returns:



43
44
45
# 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 = {}) ⇒ HostedZone

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :comment (String)
  • :caller_reference (String)

Returns:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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