rrsets = AWS::Route53::HostedZone.new(hosted_zone_id).rrsets rrset = rrsets['foo.example.com.', 'A'] rrset.ttl = 3600 rrset.update
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
@return [ChangeInfo]
@return [String] The hosted zone ID.
@return [String]
@return [String] name
@return [String]
@return [String]
@private
# 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
@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 172 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 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
@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 182 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 189 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 197 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 126 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 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
@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
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 223 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? end options end
# File lib/aws/route_53/resource_record_set.rb, line 210 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 206 def resource_identifiers [[:name, name], [:type, type], [:set_identifier, set_identifier]] end