class Aws::S3::Plugins::S3Signer::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-s3/plugins/s3_signer.rb, line 105
def call(context)
  bucket = context.params[:bucket]
  check_for_cached_region(context, bucket) if bucket
  @handler.call(context)
end

Private Instance Methods

check_for_cached_region(context, bucket) click to toggle source
# File lib/aws-sdk-s3/plugins/s3_signer.rb, line 113
def check_for_cached_region(context, bucket)
  cached_region = S3::BUCKET_REGIONS[bucket]
  if cached_region && cached_region != context.config.region
    context.http_request.endpoint.host = S3Signer.new_hostname(
      context, cached_region
    )
    context[:cached_sigv4_region] = cached_region
  end
end