class AWS::Route53::ResourceRecordSet
# 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
@attr_reader [Hash] alias_target
@attr_reader [Integer] weight
@attr_reader [String] region
@attr_reader [Integer] ttl
@attr_reader [Array<Hash>] resource_records
Attributes
@return [ChangeInfo]
@return [String] The hosted zone ID.
@return [String]
@return [String] name
@return [String]
@return [String]
Public Class Methods
@api private
AWS::Core::Resource::new
# File lib/aws/route_53/resource_record_set.rb, line 43 def initialize name, type, options = {} @name = name @type = type @set_identifier = options[:set_identifier] @hosted_zone_id = options[:hosted_zone_id] @change_info = options[:change_info] @create_options = {} super end
Public Instance Methods
@param [Hash] new_target @return [Hash]
# File lib/aws/route_53/resource_record_set.rb, line 94 def alias_target= new_target @create_options[:alias_target] = new_target end
Delete resource record set. @param [Hash] options Options for change batch. @return [ChangeInfo]
# 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
@return [Boolean] Returns `true` if this rrset exists.
# 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
# File lib/aws/route_53/resource_record_set.rb, line 130 def failover= new_failover @create_options[:failover] = new_failover end
# 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
# 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
@param [String] new_name @return [String]
# File lib/aws/route_53/resource_record_set.rb, line 64 def name= new_name @create_options[:name] = new_name end
Return a new change batch for this hosted zone. @param [Hash] options Options for change batch. @return [ChangeBatch]
# 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
Return the create request that update
would include in its change batch. Note that update
also includes a delete request. @return [CreateRequest]
# 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
Return a delete request that would delete this resource record set. @return [DeleteRequest]
# 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
@param [String] new_region @return [String]
# File lib/aws/route_53/resource_record_set.rb, line 110 def region= new_region @create_options[:region] = new_region end
@param [Array<Hash>] new_rrs @return [Array<Hash>]
# File lib/aws/route_53/resource_record_set.rb, line 144 def resource_records= new_rrs @create_options[:resource_records] = new_rrs end
@param [String] new_identifier @return [String]
# File lib/aws/route_53/resource_record_set.rb, line 84 def set_identifier= new_identifier @create_options[:set_identifier] = new_identifier end
@param [Integer] new_ttl @return [Integer]
# File lib/aws/route_53/resource_record_set.rb, line 118 def ttl= new_ttl @create_options[:ttl] = new_ttl end
@param [String] new_type @return [String]
# File lib/aws/route_53/resource_record_set.rb, line 73 def type= new_type @create_options[:type] = new_type end
Update values of resource record set. @param [Hash] options Options for change batch. @return [ResourceRecordSet] New resource record set with current value.
# 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
@param [Integer] new_weight @return [Integer]
# File lib/aws/route_53/resource_record_set.rb, line 102 def weight= new_weight @create_options[:weight] = new_weight end
Protected Instance Methods
# File lib/aws/route_53/resource_record_set.rb, line 226 def get_resource attr_name = nil options = {} options[:start_record_name] = name options[:start_record_type] = type options[:start_record_identifier] = set_identifier if set_identifier options[:hosted_zone_id] = hosted_zone_id client.list_resource_record_sets(options) end
# File lib/aws/route_53/resource_record_set.rb, line 222 def resource_identifiers [[:name, name], [:type, type], [:set_identifier, set_identifier]] end
Private Instance Methods
Format a hash of options that can be used to initialize a change request. @return [Hash]
# File lib/aws/route_53/resource_record_set.rb, line 241 def delete_options options = {:name => name, :type => type} AWS.memoize do options[:set_identifier] = set_identifier if set_identifier options[:alias_target] = alias_target if alias_target options[:weight] = weight if weight options[:region] = region if region options[:ttl] = ttl if ttl options[:resource_records] = resource_records if resource_records && !resource_records.empty? options[:geo_location] = geo_location if geo_location options[:failover] = failover if failover options[:health_check_id] = health_check_id if health_check_id end options end