Sha256: bb864d31d3468ac57a2741ad898a3f83e15c1e4158102e22f8175fa48458ef42

Contents?: true

Size: 853 Bytes

Versions: 2

Compression:

Stored size: 853 Bytes

Contents

module Aws
  module Plugins

    # @seahorse.client.option [String] :sigv4_name
    #   Override the default service name used for signing sigv4 requests.
    # @seahorse.client.option [String] :sigv4_region
    #   Override the default region name used for signing sigv4 requests.
    class SignatureV4 < Seahorse::Client::Plugin

      option(:sigv4_name) do |config|
        config.api.metadata['endpoint_prefix']
      end

      option(:sigv4_region) do |config|
        prefix = config.api.metadata['endpoint_prefix']
        if matches = config.endpoint.match(/#{prefix}[.-](.+)\.amazonaws\.com/)
          matches[1]
        elsif config.endpoint.match(/#{prefix}\.amazonaws\.com/)
          'us-east-1'
        else
          config.region
        end
      end

      handler(Signers::Handler.new(Signers::V4), step: :sign)

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.0.rc2 lib/aws/plugins/signature_v4.rb
aws-sdk-core-2.0.0.rc1 lib/aws/plugins/signature_v4.rb