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

Class: AWS::Route53::HostedZone

Inherits:
Core::Resource
  • Object
show all
Defined in:
lib/aws/route_53/hosted_zone.rb

Overview

Delete existing hosted zone

hosted_zone = AWS::Route53::HostedZone.new(hosted_zone_id)
hosted_zone.delete

Constant Summary

S3_HOSTED_ZONE_IDS =
{
    'us-east-1' => 'Z3AQBSTGFYJSTF',
    'us-west-2' => 'Z3BJ6K6RIION7M',
    'us-west-1' => 'Z2F56UZL2M1ACD',
    'eu-west-1' => 'Z1BKCTXD74EZPE',
    'ap-southeast-1' => 'Z3O0J2DXBE1FTB',
    'ap-southeast-2' => 'Z1WCIGYICN2BYD',
    'ap-northeast-1' => 'Z2M4EHUR26P7ZW',
    'sa-east-1' => 'Z7KQH4QJS55SO',
    'us-gov-west-1' => 'Z31GFT0UA1I2HV'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#change_infoChangeInfo (readonly)

Returns Change info for the newly created HostedZone instance.

Returns:

  • (ChangeInfo)

    Change info for the newly created HostedZone instance.



55
56
57
# File 'lib/aws/route_53/hosted_zone.rb', line 55

def change_info
  @change_info
end

#delegation_setArray<String> (readonly)

Returns the current value of delegation_set

Returns:

  • (Array<String>)

    the current value of delegation_set



29
30
31
# File 'lib/aws/route_53/hosted_zone.rb', line 29

def delegation_set
  @delegation_set
end

#idString (readonly)

Returns The hosted zone ID.

Returns:

  • (String)

    The hosted zone ID.



51
52
53
# File 'lib/aws/route_53/hosted_zone.rb', line 51

def id
  @id
end

#nameString (readonly)

The hosted zone name.

Returns:

  • (String)

    the current value of name



29
30
31
# File 'lib/aws/route_53/hosted_zone.rb', line 29

def name
  @name
end

#resource_record_set_countInteger (readonly)

The resource record set count.

Returns:

  • (Integer)

    the current value of resource_record_set_count



29
30
31
# File 'lib/aws/route_53/hosted_zone.rb', line 29

def resource_record_set_count
  @resource_record_set_count
end

Instance Method Details

#associate_vpc(vpc) ⇒ ChangeInfo

Associates an additional VPC with a private hosted zone.

Returns:



127
128
129
130
131
132
133
134
# File 'lib/aws/route_53/hosted_zone.rb', line 127

def associate_vpc vpc
  resp = client.associate_vpc_with_hosted_zone(:hosted_zone_id => id, :vpc => vpc)
  if resp[:change_info][:id]
    ChangeInfo.new_from(:associate_vpc_with_hosted_zone,
                        resp[:change_info],
                        resp[:change_info][:id])
  end
end

#deleteChangeInfo

Deletes the hosted zone.

Returns:



100
101
102
103
104
105
106
107
108
# File 'lib/aws/route_53/hosted_zone.rb', line 100

def delete
  resp = client.delete_hosted_zone(:id => id)
  if resp[:change_info][:id]
    ChangeInfo.new_from(:delete_hosted_zone,
                        resp[:change_info],
                        resp[:change_info][:id],
                        :config => config)
  end
end

#disassociate_vpc(vpc) ⇒ ChangeInfo

Disassociates an VPC from an private hosted zone.

Returns:



138
139
140
141
142
143
144
145
# File 'lib/aws/route_53/hosted_zone.rb', line 138

def disassociate_vpc vpc
  resp = client.disassociate_vpc_from_hosted_zone(:hosted_zone_id => id, :vpc => vpc)
  if resp[:change_info][:id]
    ChangeInfo.new_from(:disassociate_vpc_from_hosted_zone,
                        resp[:change_info],
                        resp[:change_info][:id])
  end
end

#exists?Boolean

Returns true if this hosted zone exists.

Returns:

  • (Boolean)

    Returns true if this hosted zone exists.



111
112
113
114
115
116
# File 'lib/aws/route_53/hosted_zone.rb', line 111

def exists?
  get_resource
  true
rescue Errors::NoSuchHostedZone
  false
end

#pathString

The Hosted zone path.

Returns:

  • (String)


59
60
61
# File 'lib/aws/route_53/hosted_zone.rb', line 59

def path
  "/hostedzone/#{id}"
end

#resource_record_setsResourceRecordSetCollection Also known as: rrsets

Returns resource record sets.



120
121
122
# File 'lib/aws/route_53/hosted_zone.rb', line 120

def resource_record_sets
  ResourceRecordSetCollection.new(id, :config => config)
end