Sha256: b1a26d7cee2cf14f07e433dc57d9b4794d0186822eef8fd97b605c03c46bcb28

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module Aws
  module Plugins

    # Makes it possible to conditional sign {Aws::CloudSearchDomain::Client}
    # requests. When credentials are configured, requests are signed.
    # When they are omitted, the request is sent anonymously.
    #
    # @seahorse.client.option [String] :sigv4_region Only needed when sending
    #   authenticated/signed requests to a Cloud Search domain and the
    #   endpoint does not contain the region name.
    #
    class CSDConditionalSigning < Seahorse::Client::Plugin

      option(:sigv4_region) do |cfg|
        # extract the region name from the cloud search domain endpoint
        if cfg.endpoint
          cfg.endpoint.to_s.split('.')[1]
        else
          raise ArgumentError, 'missing required option :endpoint'
        end
      end

      def after_initialize(client)
        # disable request singing when credentials are not set
        if client.config.credentials.nil? or !client.config.credentials.set?
          client.config.signature_version = nil
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.0.rc15 lib/aws/plugins/csd_conditional_signing.rb