Class: AWS::Route53::ResourceRecordSet

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

Overview

Modify resource record set

rrsets = AWS::Route53::HostedZone.new(hosted_zone_id).rrsets
rrset = rrsets['foo.example.com.', 'A']
rrset.ttl = 3600
rrset.update

Delete existing resource record set

rrsets = AWS::Route53::HostedZone.new(hosted_zone_id).rrsets
rrset = rrsets['foo.example.com.', 'A']
rrset.delete

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#alias_targetHash

Returns the current value of alias_target.

Returns:

  • (Hash)

    the current value of alias_target



40
41
42
# File 'lib/aws/route_53/resource_record_set.rb', line 40

def alias_target
  @alias_target
end

#change_infoChangeInfo (readonly)

Returns:



57
58
59
# File 'lib/aws/route_53/resource_record_set.rb', line 57

def change_info
  @change_info
end

#hosted_zone_idString (readonly)

Returns The hosted zone ID.

Returns:

  • (String)

    The hosted zone ID.



54
55
56
# File 'lib/aws/route_53/resource_record_set.rb', line 54

def hosted_zone_id
  @hosted_zone_id
end

#nameString

Returns name.

Returns:

  • (String)

    name



60
61
62
# File 'lib/aws/route_53/resource_record_set.rb', line 60

def name
  @name
end

#regionString

Returns the current value of region.

Returns:

  • (String)

    the current value of region



40
41
42
# File 'lib/aws/route_53/resource_record_set.rb', line 40

def region
  @region
end

#resource_recordsArray<Hash>

Returns the current value of resource_records.

Returns:

  • (Array<Hash>)

    the current value of resource_records



40
41
42
# File 'lib/aws/route_53/resource_record_set.rb', line 40

def resource_records
  @resource_records
end

#set_identifierString Also known as: identifier

Returns:

  • (String)


78
79
80
# File 'lib/aws/route_53/resource_record_set.rb', line 78

def set_identifier
  @set_identifier
end

#ttlInteger

Returns the current value of ttl.

Returns:

  • (Integer)

    the current value of ttl



40
41
42
# File 'lib/aws/route_53/resource_record_set.rb', line 40

def ttl
  @ttl
end

#typeString

Returns:

  • (String)


69
70
71
# File 'lib/aws/route_53/resource_record_set.rb', line 69

def type
  @type
end

#weightInteger

Returns the current value of weight.

Returns:

  • (Integer)

    the current value of weight



40
41
42
# File 'lib/aws/route_53/resource_record_set.rb', line 40

def weight
  @weight
end

Instance Method Details

#delete(options = {}) ⇒ ChangeInfo

Delete resource record set.

Parameters:

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

    Options for change batch.

Returns:



172
173
174
175
176
177
# File 'lib/aws/route_53/resource_record_set.rb', line 172

def delete options = {}
  batch = new_change_batch(options)
  batch << new_delete_request

  change_info = batch.call()
end

#exists?Boolean

Returns true if this rrset exists.

Returns:

  • (Boolean)

    Returns true if this rrset exists.



141
142
143
144
145
146
147
148
149
# File 'lib/aws/route_53/resource_record_set.rb', line 141

def exists?
  !get_resource.data[:resource_record_sets].find { |details|
    if set_identifier
      details[:name] == name and details[:type] == type and details[:set_identifier] == set_identifier
    else
      details[:name] == name and details[:type] == type
    end
  }.nil?
end

#new_change_batch(options = {}) ⇒ ChangeBatch

Return a new change batch for this hosted zone.

Parameters:

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

    Options for change batch.

Returns:



182
183
184
# File 'lib/aws/route_53/resource_record_set.rb', line 182

def new_change_batch options = {}
  ChangeBatch.new(hosted_zone_id, options.merge(:config => config))
end

#new_create_requestCreateRequest

Return the create request that #update would include in its change batch. Note that #update also includes a delete request.

Returns:



189
190
191
192
193
# File 'lib/aws/route_53/resource_record_set.rb', line 189

def new_create_request
  create_options = delete_options.merge(@create_options)
  CreateRequest.new(create_options[:name], create_options[:type],
                    create_options)
end

#new_delete_requestDeleteRequest

Return a delete request that would delete this resource record set.

Returns:



197
198
199
200
# File 'lib/aws/route_53/resource_record_set.rb', line 197

def new_delete_request
  options = delete_options
  DeleteRequest.new(options[:name], options[:type], options)
end

#update(options = {}) ⇒ ResourceRecordSet

Update values of resource record set.

Parameters:

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

    Options for change batch.

Returns:



154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/aws/route_53/resource_record_set.rb', line 154

def update options = {}
  batch = new_change_batch(options)
  AWS.memoize do
    batch << new_delete_request
    batch << new_create_request
  end

  @change_info = batch.call()
  @name = @create_options[:name]
  @type = @create_options[:type]
  @set_identifier = @create_options[:set_identifier]
  @create_options = {}
  self
end