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

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:



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

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.



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

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

#failover=(new_failover) ⇒ Object



130
131
132
# File 'lib/aws/route_53/resource_record_set.rb', line 130

def failover= new_failover
  @create_options[:failover] = new_failover
end

#geo_location=(new_geo_location) ⇒ Object



124
125
126
# File 'lib/aws/route_53/resource_record_set.rb', line 124

def geo_location= new_geo_location
  @create_options[:geo_location] = new_geo_location
end

#health_check_id=(new_health_check_id) ⇒ Object



136
137
138
# File 'lib/aws/route_53/resource_record_set.rb', line 136

def health_check_id= new_health_check_id
  @create_options[:health_check_id] = new_health_check_id
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:



200
201
202
# File 'lib/aws/route_53/resource_record_set.rb', line 200

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:



207
208
209
210
211
# File 'lib/aws/route_53/resource_record_set.rb', line 207

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:



215
216
217
218
# File 'lib/aws/route_53/resource_record_set.rb', line 215

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:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/aws/route_53/resource_record_set.rb', line 172

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] || @name
  @type = @create_options[:type] || @type
  @set_identifier = @create_options[:set_identifier] || @set_identifier
  @create_options = {}
  self
end