class Aws::Plugins::S3BucketDns::Handler

@api private

Public Instance Methods

call(context) click to toggle source
# File lib/aws-sdk-core/plugins/s3_bucket_dns.rb, line 29
def call(context)
  move_dns_compat_bucket_to_subdomain(context)
  @handler.call(context)
end

Private Instance Methods

https?(uri) click to toggle source
# File lib/aws-sdk-core/plugins/s3_bucket_dns.rb, line 55
def https?(uri)
  uri.scheme == 'https'
end
move_bucket_to_subdomain(bucket_name, endpoint) click to toggle source
# File lib/aws-sdk-core/plugins/s3_bucket_dns.rb, line 48
def move_bucket_to_subdomain(bucket_name, endpoint)
  endpoint.host = "#{bucket_name}.#{endpoint.host}"
  path = endpoint.path.sub("/#{bucket_name}", '')
  path = "/#{path}" unless path.match(/^\//)
  endpoint.path = path
end
move_dns_compat_bucket_to_subdomain(context) click to toggle source
# File lib/aws-sdk-core/plugins/s3_bucket_dns.rb, line 36
def move_dns_compat_bucket_to_subdomain(context)
  bucket_name = context.params[:bucket]
  endpoint = context.http_request.endpoint
  if
    bucket_name &&
    S3BucketDns.dns_compatible?(bucket_name, https?(endpoint)) &&
    context.operation_name != 'get_bucket_location'
  then
    move_bucket_to_subdomain(bucket_name, endpoint)
  end
end