class Aws::S3::Plugins::BucketDns::Handler

@api private

Public Instance Methods

call(context) click to toggle source
# File lib/aws-sdk-s3/plugins/bucket_dns.rb, line 33
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-s3/plugins/bucket_dns.rb, line 57
def https?(uri)
  uri.scheme == 'https'
end
move_bucket_to_subdomain(bucket_name, endpoint) click to toggle source
# File lib/aws-sdk-s3/plugins/bucket_dns.rb, line 50
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-s3/plugins/bucket_dns.rb, line 40
def move_dns_compat_bucket_to_subdomain(context)
  bucket_name = context.params[:bucket]
  endpoint = context.http_request.endpoint
  if bucket_name &&
     BucketDns.dns_compatible?(bucket_name, https?(endpoint)) &&
     context.operation_name.to_s != 'get_bucket_location'
    move_bucket_to_subdomain(bucket_name, endpoint)
  end
end