class Aws::Plugins::Sign::Handler

def call(context)

def call(context)
  # Skip signing if using sigv2 signing from s3_signer in S3
  unless v2_signing?(context.config)
    signer = Sign.signer_for(
      context[:auth_scheme],
      context.config,
      context[:sigv4_region],
      context[:sigv4_credentials]
    )
    signer.sign(context)
  end
  with_metrics(signer) { @handler.call(context) }
end

def v2_signing?(config)

def v2_signing?(config)
  # 's3' is legacy signing, 'v4' is default
  config.respond_to?(:signature_version) &&
    config.signature_version == 's3'
end

def with_metrics(signer, &block)

def with_metrics(signer, &block)
  case signer
  when SignatureV4
    Aws::Plugins::UserAgent.metric(*signer.credentials.metrics, &block)
  when Bearer
    Aws::Plugins::UserAgent.metric(*signer.token_provider.metrics, &block)
  else
    block.call
  end
end