class Aws::Plugins::S3BucketDns::Handler

@api private

def call(context)

def call(context)
  move_dns_compat_bucket_to_subdomain(context)
  @handler.call(context)
end

def https?(uri)

def https?(uri)
  uri.scheme == 'https'
end

def move_bucket_to_subdomain(bucket_name, endpoint)

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

def move_dns_compat_bucket_to_subdomain(context)

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.to_s != 'get_bucket_location'
  then
    move_bucket_to_subdomain(bucket_name, endpoint)
  end
end