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
hosted_zone = r53.hosted_zones['example.com.']

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:



42
43
44
# File 'lib/aws/route_53/hosted_zone_collection.rb', line 42

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:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/aws/route_53/hosted_zone_collection.rb', line 50

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[: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