class Aws::Binary::EventStreamEncoder

@api private

def encode(event_type, params)

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

def initialize(protocol, rules, input_ref, signer)

Parameters:
  • signer (Aws::Sigv4::Signer) --
  • input_ref (ShapeRef) -- ShapeRef of the input shape
  • rules (ShapeRef) -- ShapeRef of the eventstream member
  • protocol (String) --
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

def serializer_class(protocol)

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