lib/aws/core/configuration.rb in aws-sdk-1.15.0 vs lib/aws/core/configuration.rb in aws-sdk-1.16.0
- old
+ new
@@ -180,10 +180,14 @@
#
# @attr_reader [Boolean] simple_db_consistent_reads (false) Determines
# if all SimpleDB read requests should be done consistently.
# Consistent reads are slower, but reflect all changes to SDB.
#
+ # @attr_reader [Boolean] sqs_verify_checksums (true)
+ # When `true` all SQS operations will check body content against
+ # MD5 checksums, raising an exception if there is a mismatch.
+ #
# @attr_reader [CredentialProvider::Provider] credential_provider
# Returns the object that is responsible for loading credentials.
#
# @attr_reader [String] ssl_ca_file The path to a CA cert bundle in
# PEM format.
@@ -315,10 +319,17 @@
# @api private
def inspect
"<#{self.class.name}>"
end
+ # @api private
+ def endpoint_region(svc)
+ (supplied[svc.method_name] || {})[:region] or
+ supplied[:"#{svc.old_name}_region"] or
+ region
+ end
+
protected
def supplied
@supplied ||= {}
end
@@ -393,13 +404,13 @@
if value
value
elsif endpoint = config.send(svc_opt)[:endpoint]
endpoint
elsif endpoint_pattern
- endpoint_pattern % config.region
+ endpoint_pattern % config.endpoint_region(svc)
else
- endpoint_builder.call(config.region)
+ endpoint_builder.call(config.endpoint_region(svc))
end
end
add_option(:"#{ruby_name}_port") do |config,value|
if value
@@ -424,19 +435,20 @@
if matches = endpoint.match(/(us-gov-west-\d+)/)
matches[1]
else
'us-gov-west-1' # e.g. iam.us-gov.amazonaws.com
end
- elsif matches = endpoint.match(/^.+\.(.+)\.amazonaws.com$/)
+ elsif matches = endpoint.match(/^.+?[.-](.+)\.amazonaws.com$/)
matches[1]
else
AWS.const_get(name).global_endpoint? ? 'us-east-1' : config.region
end
end
end
needs = [
+ :"#{svc_opt}",
:"#{ruby_name}_endpoint",
:"#{ruby_name}_port",
:"#{ruby_name}_region",
:credential_provider,
:http_handler,
@@ -455,10 +467,11 @@
:use_ssl?,
:user_agent_prefix,
]
create_block = lambda do |config,client_options|
- AWS.const_get(name)::Client.new(:config => config)
+ options = client_options[:"#{svc_opt}"]
+ AWS.const_get(name)::Client.new(options.merge(:config => config))
end
add_option_with_needs :"#{ruby_name}_client", needs, &create_block
end