Sha256: 17fd288762ce54ffee28377ae943b59747faf919716eb72bc2a28525e585c2c5
Contents?: true
Size: 1.52 KB
Versions: 32
Compression:
Stored size: 1.52 KB
Contents
require 'aws-sigv4' module Aws module CloudSearchDomain 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. class ConditionalSigning < Seahorse::Client::Plugin # The Aws::CloudSearchDomain::Client is configured with a null # signer when the credentials are `nil` or simply not set. # @api private class NullSigner def initialize(*args); end def sign_request(*args) Aws::Sigv4::Signature.new(headers: {}) end end # Adding region as an option to avoid an issue when `Aws.config[:region]` # is populated and the global configuration plugin merges options onto # this client. option(:region) option(:sigv4_region, doc_type: String, docstring: <<-DOCS) do |cfg| Only needed when sending authenticated/signed requests to a Cloud Search domain and the endpoint does not contain the region name. DOCS # 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 option(:sigv4_signer) do |cfg| if cfg.credentials.nil? || !cfg.credentials.set? NullSigner.new end end end end end end
Version data entries
32 entries across 32 versions & 1 rubygems