lib/aws-sdk-core/binary/event_stream_encoder.rb
# frozen_string_literal: true require 'aws-eventstream' module Aws module Binary # @api private class EventStreamEncoder # @param [String] protocol # @param [ShapeRef] rules ShapeRef of the eventstream member # @param [ShapeRef] input_ref ShapeRef of the input shape # @param [Aws::Sigv4::Signer] signer def initialize(protocol, rules, input_ref, signer) @encoder = Aws::EventStream::Encoder.new @event_builder = EventBuilder.new(serializer_class(protocol), rules) @input_ref = input_ref @rules = rules @signer = signer @prior_signature = nil end attr_reader :rules attr_accessor :prior_signature def encode(event_type, params) if event_type == :end_stream payload = '' else payload = @encoder.encode(@event_builder.apply(event_type, params)) end headers, signature = @signer.sign_event(@prior_signature, payload, @encoder) @prior_signature = signature message = Aws::EventStream::Message.new( headers: headers, payload: StringIO.new(payload) ) @encoder.encode(message) end private def serializer_class(protocol) case protocol when 'rest-xml' then Xml::Builder when 'rest-json' then Json::Builder when 'json' then Json::Builder else raise "unsupported protocol #{protocol} for event stream" end end end end end
Source Files
- lib/aws-defaults.rb
- lib/aws-defaults/default_configuration.rb
- lib/aws-defaults/defaults_mode_config_resolver.rb
- lib/aws-sdk-core.rb
- lib/aws-sdk-core/arn.rb
- lib/aws-sdk-core/arn_parser.rb
- lib/aws-sdk-core/assume_role_credentials.rb
- lib/aws-sdk-core/assume_role_web_identity_credentials.rb
- lib/aws-sdk-core/async_client_stubs.rb
- lib/aws-sdk-core/binary.rb
- lib/aws-sdk-core/binary/decode_handler.rb
- lib/aws-sdk-core/binary/encode_handler.rb
- lib/aws-sdk-core/binary/event_builder.rb
- lib/aws-sdk-core/binary/event_parser.rb
- lib/aws-sdk-core/binary/event_stream_decoder.rb
- lib/aws-sdk-core/binary/event_stream_encoder.rb
- lib/aws-sdk-core/client_side_monitoring/publisher.rb
- lib/aws-sdk-core/client_side_monitoring/request_metrics.rb
- lib/aws-sdk-core/client_stubs.rb
- lib/aws-sdk-core/credential_provider.rb
- lib/aws-sdk-core/credential_provider_chain.rb
- lib/aws-sdk-core/credentials.rb
- lib/aws-sdk-core/deprecations.rb
- lib/aws-sdk-core/eager_loader.rb
- lib/aws-sdk-core/ec2_metadata.rb
- lib/aws-sdk-core/ecs_credentials.rb
- lib/aws-sdk-core/endpoint_cache.rb
- lib/aws-sdk-core/endpoints.rb
- lib/aws-sdk-core/endpoints/condition.rb
- lib/aws-sdk-core/endpoints/endpoint.rb
- lib/aws-sdk-core/endpoints/endpoint_rule.rb
- lib/aws-sdk-core/endpoints/error_rule.rb
- lib/aws-sdk-core/endpoints/function.rb
- lib/aws-sdk-core/endpoints/matchers.rb
- lib/aws-sdk-core/endpoints/reference.rb
- lib/aws-sdk-core/endpoints/rule.rb
- lib/aws-sdk-core/endpoints/rule_set.rb
- lib/aws-sdk-core/endpoints/rules_provider.rb
- lib/aws-sdk-core/endpoints/templater.rb
- lib/aws-sdk-core/endpoints/tree_rule.rb
- lib/aws-sdk-core/endpoints/url.rb
- lib/aws-sdk-core/errors.rb
- lib/aws-sdk-core/event_emitter.rb
- lib/aws-sdk-core/ini_parser.rb
- lib/aws-sdk-core/instance_profile_credentials.rb
- lib/aws-sdk-core/json.rb
- lib/aws-sdk-core/json/builder.rb
- lib/aws-sdk-core/json/error_handler.rb
- lib/aws-sdk-core/json/handler.rb
- lib/aws-sdk-core/json/json_engine.rb
- lib/aws-sdk-core/json/oj_engine.rb
- lib/aws-sdk-core/json/parser.rb
- lib/aws-sdk-core/log/formatter.rb
- lib/aws-sdk-core/log/handler.rb
- lib/aws-sdk-core/log/param_filter.rb
- lib/aws-sdk-core/log/param_formatter.rb
- lib/aws-sdk-core/pageable_response.rb
- lib/aws-sdk-core/pager.rb
- lib/aws-sdk-core/param_converter.rb
- lib/aws-sdk-core/param_validator.rb
- lib/aws-sdk-core/plugins/api_key.rb
- lib/aws-sdk-core/plugins/apig_authorizer_token.rb
- lib/aws-sdk-core/plugins/apig_credentials_configuration.rb
- lib/aws-sdk-core/plugins/apig_user_agent.rb
- lib/aws-sdk-core/plugins/bearer_authorization.rb
- lib/aws-sdk-core/plugins/checksum_algorithm.rb
- lib/aws-sdk-core/plugins/client_metrics_plugin.rb
- lib/aws-sdk-core/plugins/client_metrics_send_plugin.rb
- lib/aws-sdk-core/plugins/credentials_configuration.rb
- lib/aws-sdk-core/plugins/defaults_mode.rb
- lib/aws-sdk-core/plugins/endpoint_discovery.rb
- lib/aws-sdk-core/plugins/endpoint_pattern.rb
- lib/aws-sdk-core/plugins/event_stream_configuration.rb
- lib/aws-sdk-core/plugins/global_configuration.rb
- lib/aws-sdk-core/plugins/helpful_socket_errors.rb
- lib/aws-sdk-core/plugins/http_checksum.rb
- lib/aws-sdk-core/plugins/idempotency_token.rb
- lib/aws-sdk-core/plugins/invocation_id.rb
- lib/aws-sdk-core/plugins/jsonvalue_converter.rb
- lib/aws-sdk-core/plugins/logging.rb
- lib/aws-sdk-core/plugins/param_converter.rb
- lib/aws-sdk-core/plugins/param_validator.rb
- lib/aws-sdk-core/plugins/protocols/api_gateway.rb
- lib/aws-sdk-core/plugins/protocols/ec2.rb
- lib/aws-sdk-core/plugins/protocols/json_rpc.rb
- lib/aws-sdk-core/plugins/protocols/query.rb
- lib/aws-sdk-core/plugins/protocols/rest_json.rb
- lib/aws-sdk-core/plugins/protocols/rest_xml.rb
- lib/aws-sdk-core/plugins/recursion_detection.rb
- lib/aws-sdk-core/plugins/regional_endpoint.rb
- lib/aws-sdk-core/plugins/request_compression.rb
- lib/aws-sdk-core/plugins/response_paging.rb
- lib/aws-sdk-core/plugins/retries/client_rate_limiter.rb
- lib/aws-sdk-core/plugins/retries/clock_skew.rb
- lib/aws-sdk-core/plugins/retries/error_inspector.rb
- lib/aws-sdk-core/plugins/retries/retry_quota.rb
- lib/aws-sdk-core/plugins/retry_errors.rb
- lib/aws-sdk-core/plugins/sign.rb
- lib/aws-sdk-core/plugins/signature_v2.rb
- lib/aws-sdk-core/plugins/signature_v4.rb
- lib/aws-sdk-core/plugins/stub_responses.rb
- lib/aws-sdk-core/plugins/transfer_encoding.rb
- lib/aws-sdk-core/plugins/user_agent.rb
- lib/aws-sdk-core/process_credentials.rb
- lib/aws-sdk-core/query.rb
- lib/aws-sdk-core/query/ec2_param_builder.rb
- lib/aws-sdk-core/query/handler.rb
- lib/aws-sdk-core/query/param.rb
- lib/aws-sdk-core/query/param_builder.rb
- lib/aws-sdk-core/query/param_list.rb
- lib/aws-sdk-core/refreshing_credentials.rb
- lib/aws-sdk-core/refreshing_token.rb
- lib/aws-sdk-core/resources/collection.rb
- lib/aws-sdk-core/rest.rb
- lib/aws-sdk-core/rest/handler.rb
- lib/aws-sdk-core/rest/request/body.rb
- lib/aws-sdk-core/rest/request/builder.rb
- lib/aws-sdk-core/rest/request/endpoint.rb
- lib/aws-sdk-core/rest/request/headers.rb
- lib/aws-sdk-core/rest/request/querystring_builder.rb
- lib/aws-sdk-core/rest/response/body.rb
- lib/aws-sdk-core/rest/response/headers.rb
- lib/aws-sdk-core/rest/response/parser.rb
- lib/aws-sdk-core/rest/response/status_code.rb
- lib/aws-sdk-core/shared_config.rb
- lib/aws-sdk-core/shared_credentials.rb
- lib/aws-sdk-core/sso_credentials.rb
- lib/aws-sdk-core/sso_token_provider.rb
- lib/aws-sdk-core/static_token_provider.rb
- lib/aws-sdk-core/structure.rb
- lib/aws-sdk-core/stubbing/data_applicator.rb
- lib/aws-sdk-core/stubbing/empty_stub.rb
- lib/aws-sdk-core/stubbing/protocols/api_gateway.rb
- lib/aws-sdk-core/stubbing/protocols/ec2.rb
- lib/aws-sdk-core/stubbing/protocols/json.rb
- lib/aws-sdk-core/stubbing/protocols/query.rb
- lib/aws-sdk-core/stubbing/protocols/rest.rb
- lib/aws-sdk-core/stubbing/protocols/rest_json.rb
- lib/aws-sdk-core/stubbing/protocols/rest_xml.rb
- lib/aws-sdk-core/stubbing/stub_data.rb
- lib/aws-sdk-core/stubbing/xml_error.rb
- lib/aws-sdk-core/token.rb
- lib/aws-sdk-core/token_provider.rb
- lib/aws-sdk-core/token_provider_chain.rb
- lib/aws-sdk-core/type_builder.rb
- lib/aws-sdk-core/util.rb
- lib/aws-sdk-core/waiters.rb
- lib/aws-sdk-core/waiters/errors.rb
- lib/aws-sdk-core/waiters/poller.rb
- lib/aws-sdk-core/waiters/waiter.rb
- lib/aws-sdk-core/xml.rb
- lib/aws-sdk-core/xml/builder.rb
- lib/aws-sdk-core/xml/default_list.rb
- lib/aws-sdk-core/xml/default_map.rb
- lib/aws-sdk-core/xml/doc_builder.rb
- lib/aws-sdk-core/xml/error_handler.rb
- lib/aws-sdk-core/xml/parser.rb
- lib/aws-sdk-core/xml/parser/engines/libxml.rb
- lib/aws-sdk-core/xml/parser/engines/nokogiri.rb
- lib/aws-sdk-core/xml/parser/engines/oga.rb
- lib/aws-sdk-core/xml/parser/engines/ox.rb
- lib/aws-sdk-core/xml/parser/engines/rexml.rb
- lib/aws-sdk-core/xml/parser/frame.rb
- lib/aws-sdk-core/xml/parser/parsing_error.rb
- lib/aws-sdk-core/xml/parser/stack.rb
- lib/aws-sdk-sso.rb
- lib/aws-sdk-sso/client.rb
- lib/aws-sdk-sso/client_api.rb
- lib/aws-sdk-sso/customizations.rb
- lib/aws-sdk-sso/endpoint_parameters.rb
- lib/aws-sdk-sso/endpoint_provider.rb
- lib/aws-sdk-sso/endpoints.rb
- lib/aws-sdk-sso/errors.rb
- lib/aws-sdk-sso/plugins/endpoints.rb
- lib/aws-sdk-sso/resource.rb
- lib/aws-sdk-sso/types.rb
- lib/aws-sdk-ssooidc.rb
- lib/aws-sdk-ssooidc/client.rb
- lib/aws-sdk-ssooidc/client_api.rb
- lib/aws-sdk-ssooidc/customizations.rb
- lib/aws-sdk-ssooidc/endpoint_parameters.rb
- lib/aws-sdk-ssooidc/endpoint_provider.rb
- lib/aws-sdk-ssooidc/endpoints.rb
- lib/aws-sdk-ssooidc/errors.rb
- lib/aws-sdk-ssooidc/plugins/endpoints.rb
- lib/aws-sdk-ssooidc/resource.rb
- lib/aws-sdk-ssooidc/types.rb
- lib/aws-sdk-sts.rb
- lib/aws-sdk-sts/client.rb
- lib/aws-sdk-sts/client_api.rb
- lib/aws-sdk-sts/customizations.rb
- lib/aws-sdk-sts/endpoint_parameters.rb
- lib/aws-sdk-sts/endpoint_provider.rb
- lib/aws-sdk-sts/endpoints.rb
- lib/aws-sdk-sts/errors.rb
- lib/aws-sdk-sts/plugins/endpoints.rb
- lib/aws-sdk-sts/plugins/sts_regional_endpoints.rb
- lib/aws-sdk-sts/presigner.rb
- lib/aws-sdk-sts/resource.rb
- lib/aws-sdk-sts/types.rb
- lib/seahorse.rb
- lib/seahorse/client/async_base.rb
- lib/seahorse/client/async_response.rb
- lib/seahorse/client/base.rb
- lib/seahorse/client/block_io.rb
- lib/seahorse/client/configuration.rb
- lib/seahorse/client/events.rb
- lib/seahorse/client/h2/connection.rb
- lib/seahorse/client/h2/handler.rb
- lib/seahorse/client/handler.rb
- lib/seahorse/client/handler_builder.rb
- lib/seahorse/client/handler_list.rb
- lib/seahorse/client/handler_list_entry.rb
- lib/seahorse/client/http/async_response.rb
- lib/seahorse/client/http/headers.rb
- lib/seahorse/client/http/request.rb
- lib/seahorse/client/http/response.rb
- lib/seahorse/client/logging/formatter.rb
- lib/seahorse/client/logging/handler.rb
- lib/seahorse/client/managed_file.rb
- lib/seahorse/client/net_http/connection_pool.rb
- lib/seahorse/client/net_http/handler.rb
- lib/seahorse/client/net_http/patches.rb
- lib/seahorse/client/networking_error.rb
- lib/seahorse/client/plugin.rb
- lib/seahorse/client/plugin_list.rb
- lib/seahorse/client/plugins/content_length.rb
- lib/seahorse/client/plugins/endpoint.rb
- lib/seahorse/client/plugins/h2.rb
- lib/seahorse/client/plugins/logging.rb
- lib/seahorse/client/plugins/net_http.rb
- lib/seahorse/client/plugins/operation_methods.rb
- lib/seahorse/client/plugins/raise_response_errors.rb
- lib/seahorse/client/plugins/request_callback.rb
- lib/seahorse/client/plugins/response_target.rb
- lib/seahorse/client/request.rb
- lib/seahorse/client/request_context.rb
- lib/seahorse/client/response.rb
- lib/seahorse/model/api.rb
- lib/seahorse/model/authorizer.rb
- lib/seahorse/model/operation.rb
- lib/seahorse/model/shapes.rb
- lib/seahorse/util.rb
- lib/seahorse/version.rb