class Aws::Plugins::S3RequestSigner::CachedBucketRegionHandler

This handler will update the http endpoint when the bucket region is known/cached.

Public Instance Methods

call(context) click to toggle source
# File lib/aws-sdk-core/plugins/s3_request_signer.rb, line 120
def call(context)
  if bucket = context.params[:bucket]
    use_regional_endpoint_when_known(context, bucket)
  end
  @handler.call(context)
end

Private Instance Methods

use_regional_endpoint_when_known(context, bucket) click to toggle source
# File lib/aws-sdk-core/plugins/s3_request_signer.rb, line 129
def use_regional_endpoint_when_known(context, bucket)
  cached_region = S3::BUCKET_REGIONS[bucket]
  if cached_region && cached_region != context.config.region
    context.http_request.endpoint.host = new_hostname(context, cached_region)
    context[:cached_sigv4_region] = cached_region
    context[:cached_signature_version] = :v4
  end
end