class Aws::S3Control::Plugins::S3ControlSigner::V4Handler

Public Instance Methods

call(context) click to toggle source
# File lib/aws-sdk-s3control/plugins/s3_control_signer.rb, line 35
def call(context)
  Aws::Plugins::SignatureV4.apply_signature(
    context: context,
    signer: sigv4_signer(context)
  )
  @handler.call(context)
end

Private Instance Methods

outpost_operation?(context) click to toggle source

Some operations do not take an ARN parameter and are special cases For these operations, the presence of the outpost_id parameter must trigger special endpoint and signer redirection

# File lib/aws-sdk-s3control/plugins/s3_control_signer.rb, line 73
def outpost_operation?(context)
  SPECIAL_OUTPOST_OPERATIONS.include?(context.operation.name) &&
    context.params[:outpost_id]
end
sigv4_signer(context) click to toggle source
# File lib/aws-sdk-s3control/plugins/s3_control_signer.rb, line 45
def sigv4_signer(context)
  if (arn = context.metadata[:s3_arn]) &&
     arn[:arn].respond_to?(:outpost_id)
    S3ControlSigner.build_v4_signer(
      service: 's3-outposts',
      region: arn[:resolved_region],
      credentials: context.config.credentials
    )
  elsif outpost_operation?(context)
    # outpost operations should go to the outposts endpoint only if
    # it's not a custom endpoint. the ARN class changes this for ARNs
    if context.config.regional_endpoint
      context.http_request.endpoint.host =
        "s3-outposts.#{context.config.region}.amazonaws.com"
    end
    S3ControlSigner.build_v4_signer(
      service: 's3-outposts',
      region: context.config.region,
      credentials: context.config.credentials
    )
  else
    context.config.sigv4_signer
  end
end