Sha256: eefaf80a1e60361b03593d610ed4baa23f6e8db43fa2036ea328da32ee27b0f4

Contents?: true

Size: 1.26 KB

Versions: 62

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

module Aws
  module Binary

    # @api private
    class EncodeHandler < Seahorse::Client::Handler

      def call(context)
        if eventstream_member = eventstream_input?(context)
          input_es_handler = context[:input_event_stream_handler]
          input_es_handler.event_emitter.encoder = EventStreamEncoder.new(
            context.config.api.metadata['protocol'],
            eventstream_member,
            context.operation.input,
            signer_for(context)
          )
          context[:input_event_emitter] = input_es_handler.event_emitter
        end
        @handler.call(context)
      end

      private

      def signer_for(context)
        # New endpoint/signing logic, use the auth scheme to make a signer
        if context[:auth_scheme]
          Aws::Plugins::Sign.signer_for(context[:auth_scheme], context.config)
        else
          # Previous implementation always assumed sigv4_signer from config.
          # Relies only on sigv4 signing (and plugin) for event stream services
          context.config.sigv4_signer
        end
      end

      def eventstream_input?(ctx)
        ctx.operation.input.shape.members.each do |_, ref|
          return ref if ref.eventstream
        end
      end

    end

  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
aws-sdk-core-3.198.0 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.197.2 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.197.1 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.197.0 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.194.1 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.194.0 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.193.0 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.192.1 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.192.0 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.191.6 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.191.5 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.191.4 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.191.3 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.191.2 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.191.1 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.191.0 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.190.3 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.190.2 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.190.1 lib/aws-sdk-core/binary/encode_handler.rb
aws-sdk-core-3.190.0 lib/aws-sdk-core/binary/encode_handler.rb