1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package rpcservice
4
5import (
6	"bytes"
7	"fmt"
8	"io"
9	"sync"
10	"time"
11
12	"github.com/aws/aws-sdk-go/aws"
13	"github.com/aws/aws-sdk-go/aws/awserr"
14	"github.com/aws/aws-sdk-go/aws/awsutil"
15	"github.com/aws/aws-sdk-go/aws/client"
16	"github.com/aws/aws-sdk-go/aws/request"
17	"github.com/aws/aws-sdk-go/private/protocol"
18	"github.com/aws/aws-sdk-go/private/protocol/eventstream"
19	"github.com/aws/aws-sdk-go/private/protocol/eventstream/eventstreamapi"
20	"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
21	"github.com/aws/aws-sdk-go/private/protocol/rest"
22)
23
24const opEmptyStream = "EmptyStream"
25
26// EmptyStreamRequest generates a "aws/request.Request" representing the
27// client's request for the EmptyStream operation. The "output" return
28// value will be populated with the request's response once the request completes
29// successfully.
30//
31// Use "Send" method on the returned Request to send the API call to the service.
32// the "output" return value is not valid until after Send returns without error.
33//
34// See EmptyStream for more information on using the EmptyStream
35// API call, and error handling.
36//
37// This method is useful when you want to inject custom logic or configuration
38// into the SDK's request lifecycle. Such as custom headers, or retry logic.
39//
40//
41//    // Example sending a request using the EmptyStreamRequest method.
42//    req, resp := client.EmptyStreamRequest(params)
43//
44//    err := req.Send()
45//    if err == nil { // resp is now filled
46//        fmt.Println(resp)
47//    }
48//
49// See also, https://docs.aws.amazon.com/goto/WebAPI/RPCService-0000-00-00/EmptyStream
50func (c *RPCService) EmptyStreamRequest(input *EmptyStreamInput) (req *request.Request, output *EmptyStreamOutput) {
51	op := &request.Operation{
52		Name:       opEmptyStream,
53		HTTPMethod: "POST",
54		HTTPPath:   "/",
55	}
56
57	if input == nil {
58		input = &EmptyStreamInput{}
59	}
60
61	output = &EmptyStreamOutput{}
62	req = c.newRequest(op, input, output)
63
64	es := NewEmptyStreamEventStream()
65	output.eventStream = es
66
67	req.Handlers.Send.Swap(client.LogHTTPResponseHandler.Name, client.LogHTTPResponseHeaderHandler)
68	req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, rest.UnmarshalHandler)
69	req.Handlers.Unmarshal.PushBack(es.runOutputStream)
70	es.output = output
71	req.Handlers.Unmarshal.PushBack(es.recvInitialEvent)
72	req.Handlers.Unmarshal.PushBack(es.runOnStreamPartClose)
73	return
74}
75
76// EmptyStream API operation for RPC Service.
77//
78// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
79// with awserr.Error's Code and Message methods to get detailed information about
80// the error.
81//
82// See the AWS API reference guide for RPC Service's
83// API operation EmptyStream for usage and error information.
84// See also, https://docs.aws.amazon.com/goto/WebAPI/RPCService-0000-00-00/EmptyStream
85func (c *RPCService) EmptyStream(input *EmptyStreamInput) (*EmptyStreamOutput, error) {
86	req, out := c.EmptyStreamRequest(input)
87	return out, req.Send()
88}
89
90// EmptyStreamWithContext is the same as EmptyStream with the addition of
91// the ability to pass a context and additional request options.
92//
93// See EmptyStream for details on how to use this API operation.
94//
95// The context must be non-nil and will be used for request cancellation. If
96// the context is nil a panic will occur. In the future the SDK may create
97// sub-contexts for http.Requests. See https://golang.org/pkg/context/
98// for more information on using Contexts.
99func (c *RPCService) EmptyStreamWithContext(ctx aws.Context, input *EmptyStreamInput, opts ...request.Option) (*EmptyStreamOutput, error) {
100	req, out := c.EmptyStreamRequest(input)
101	req.SetContext(ctx)
102	req.ApplyOptions(opts...)
103	return out, req.Send()
104}
105
106var _ awserr.Error
107
108// EmptyStreamEventStream provides the event stream handling for the EmptyStream.
109//
110// For testing and mocking the event stream this type should be initialized via
111// the NewEmptyStreamEventStream constructor function. Using the functional options
112// to pass in nested mock behavior.
113type EmptyStreamEventStream struct {
114
115	// Reader is the EventStream reader for the EmptyEventStream
116	// events. This value is automatically set by the SDK when the API call is made
117	// Use this member when unit testing your code with the SDK to mock out the
118	// EventStream Reader.
119	//
120	// Must not be nil.
121	Reader EmptyEventStreamReader
122
123	outputReader io.ReadCloser
124	output       *EmptyStreamOutput
125
126	done      chan struct{}
127	closeOnce sync.Once
128	err       *eventstreamapi.OnceError
129}
130
131// NewEmptyStreamEventStream initializes an EmptyStreamEventStream.
132// This function should only be used for testing and mocking the EmptyStreamEventStream
133// stream within your application.
134//
135// The Reader member must be set before reading events from the stream.
136//
137//   es := NewEmptyStreamEventStream(func(o *EmptyStreamEventStream{
138//       es.Reader = myMockStreamReader
139//   })
140func NewEmptyStreamEventStream(opts ...func(*EmptyStreamEventStream)) *EmptyStreamEventStream {
141	es := &EmptyStreamEventStream{
142		done: make(chan struct{}),
143		err:  eventstreamapi.NewOnceError(),
144	}
145
146	for _, fn := range opts {
147		fn(es)
148	}
149
150	return es
151}
152
153func (es *EmptyStreamEventStream) runOnStreamPartClose(r *request.Request) {
154	if es.done == nil {
155		return
156	}
157	go es.waitStreamPartClose()
158
159}
160
161func (es *EmptyStreamEventStream) waitStreamPartClose() {
162	var outputErrCh <-chan struct{}
163	if v, ok := es.Reader.(interface{ ErrorSet() <-chan struct{} }); ok {
164		outputErrCh = v.ErrorSet()
165	}
166	var outputClosedCh <-chan struct{}
167	if v, ok := es.Reader.(interface{ Closed() <-chan struct{} }); ok {
168		outputClosedCh = v.Closed()
169	}
170
171	select {
172	case <-es.done:
173	case <-outputErrCh:
174		es.err.SetError(es.Reader.Err())
175		es.Close()
176	case <-outputClosedCh:
177		if err := es.Reader.Err(); err != nil {
178			es.err.SetError(es.Reader.Err())
179		}
180		es.Close()
181	}
182}
183
184type eventTypeForEmptyStreamEventStreamOutputEvent struct {
185	unmarshalerForEvent func(string) (eventstreamapi.Unmarshaler, error)
186	output              *EmptyStreamOutput
187}
188
189func (e eventTypeForEmptyStreamEventStreamOutputEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) {
190	if eventType == "initial-response" {
191		return e.output, nil
192	}
193	return e.unmarshalerForEvent(eventType)
194}
195
196// Events returns a channel to read events from.
197//
198// These events are:
199//
200//     * EmptyEventStreamUnknownEvent
201func (es *EmptyStreamEventStream) Events() <-chan EmptyEventStreamEvent {
202	return es.Reader.Events()
203}
204
205func (es *EmptyStreamEventStream) runOutputStream(r *request.Request) {
206	var opts []func(*eventstream.Decoder)
207	if r.Config.Logger != nil && r.Config.LogLevel.Matches(aws.LogDebugWithEventStreamBody) {
208		opts = append(opts, eventstream.DecodeWithLogger(r.Config.Logger))
209	}
210
211	unmarshalerForEvent := unmarshalerForEmptyEventStreamEvent{
212		metadata: protocol.ResponseMetadata{
213			StatusCode: r.HTTPResponse.StatusCode,
214			RequestID:  r.RequestID,
215		},
216	}.UnmarshalerForEventName
217	unmarshalerForEvent = eventTypeForEmptyStreamEventStreamOutputEvent{
218		unmarshalerForEvent: unmarshalerForEvent,
219		output:              es.output,
220	}.UnmarshalerForEventName
221
222	decoder := eventstream.NewDecoder(r.HTTPResponse.Body, opts...)
223	eventReader := eventstreamapi.NewEventReader(decoder,
224		protocol.HandlerPayloadUnmarshal{
225			Unmarshalers: r.Handlers.UnmarshalStream,
226		},
227		unmarshalerForEvent,
228	)
229
230	es.outputReader = r.HTTPResponse.Body
231	es.Reader = newReadEmptyEventStream(eventReader)
232}
233func (es *EmptyStreamEventStream) recvInitialEvent(r *request.Request) {
234	// Wait for the initial response event, which must be the first
235	// event to be received from the API.
236	select {
237	case event, ok := <-es.Events():
238		if !ok {
239			return
240		}
241
242		v, ok := event.(*EmptyStreamOutput)
243		if !ok || v == nil {
244			r.Error = awserr.New(
245				request.ErrCodeSerialization,
246				fmt.Sprintf("invalid event, %T, expect %T, %v",
247					event, (*EmptyStreamOutput)(nil), v),
248				nil,
249			)
250			return
251		}
252
253		*es.output = *v
254		es.output.eventStream = es
255	}
256}
257
258// Close closes the stream. This will also cause the stream to be closed.
259// Close must be called when done using the stream API. Not calling Close
260// may result in resource leaks.
261//
262// You can use the closing of the Reader's Events channel to terminate your
263// application's read from the API's stream.
264//
265func (es *EmptyStreamEventStream) Close() (err error) {
266	es.closeOnce.Do(es.safeClose)
267	return es.Err()
268}
269
270func (es *EmptyStreamEventStream) safeClose() {
271	if es.done != nil {
272		close(es.done)
273	}
274
275	es.Reader.Close()
276	if es.outputReader != nil {
277		es.outputReader.Close()
278	}
279}
280
281// Err returns any error that occurred while reading or writing EventStream
282// Events from the service API's response. Returns nil if there were no errors.
283func (es *EmptyStreamEventStream) Err() error {
284	if err := es.err.Err(); err != nil {
285		return err
286	}
287	if err := es.Reader.Err(); err != nil {
288		return err
289	}
290
291	return nil
292}
293
294const opGetEventStream = "GetEventStream"
295
296// GetEventStreamRequest generates a "aws/request.Request" representing the
297// client's request for the GetEventStream operation. The "output" return
298// value will be populated with the request's response once the request completes
299// successfully.
300//
301// Use "Send" method on the returned Request to send the API call to the service.
302// the "output" return value is not valid until after Send returns without error.
303//
304// See GetEventStream for more information on using the GetEventStream
305// API call, and error handling.
306//
307// This method is useful when you want to inject custom logic or configuration
308// into the SDK's request lifecycle. Such as custom headers, or retry logic.
309//
310//
311//    // Example sending a request using the GetEventStreamRequest method.
312//    req, resp := client.GetEventStreamRequest(params)
313//
314//    err := req.Send()
315//    if err == nil { // resp is now filled
316//        fmt.Println(resp)
317//    }
318//
319// See also, https://docs.aws.amazon.com/goto/WebAPI/RPCService-0000-00-00/GetEventStream
320func (c *RPCService) GetEventStreamRequest(input *GetEventStreamInput) (req *request.Request, output *GetEventStreamOutput) {
321	op := &request.Operation{
322		Name:       opGetEventStream,
323		HTTPMethod: "POST",
324		HTTPPath:   "/",
325	}
326
327	if input == nil {
328		input = &GetEventStreamInput{}
329	}
330
331	output = &GetEventStreamOutput{}
332	req = c.newRequest(op, input, output)
333
334	es := NewGetEventStreamEventStream()
335	output.eventStream = es
336
337	req.Handlers.Send.Swap(client.LogHTTPResponseHandler.Name, client.LogHTTPResponseHeaderHandler)
338	req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, rest.UnmarshalHandler)
339	req.Handlers.Unmarshal.PushBack(es.runOutputStream)
340	es.output = output
341	req.Handlers.Unmarshal.PushBack(es.recvInitialEvent)
342	req.Handlers.Unmarshal.PushBack(es.runOnStreamPartClose)
343	return
344}
345
346// GetEventStream API operation for RPC Service.
347//
348// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
349// with awserr.Error's Code and Message methods to get detailed information about
350// the error.
351//
352// See the AWS API reference guide for RPC Service's
353// API operation GetEventStream for usage and error information.
354// See also, https://docs.aws.amazon.com/goto/WebAPI/RPCService-0000-00-00/GetEventStream
355func (c *RPCService) GetEventStream(input *GetEventStreamInput) (*GetEventStreamOutput, error) {
356	req, out := c.GetEventStreamRequest(input)
357	return out, req.Send()
358}
359
360// GetEventStreamWithContext is the same as GetEventStream with the addition of
361// the ability to pass a context and additional request options.
362//
363// See GetEventStream for details on how to use this API operation.
364//
365// The context must be non-nil and will be used for request cancellation. If
366// the context is nil a panic will occur. In the future the SDK may create
367// sub-contexts for http.Requests. See https://golang.org/pkg/context/
368// for more information on using Contexts.
369func (c *RPCService) GetEventStreamWithContext(ctx aws.Context, input *GetEventStreamInput, opts ...request.Option) (*GetEventStreamOutput, error) {
370	req, out := c.GetEventStreamRequest(input)
371	req.SetContext(ctx)
372	req.ApplyOptions(opts...)
373	return out, req.Send()
374}
375
376var _ awserr.Error
377
378// GetEventStreamEventStream provides the event stream handling for the GetEventStream.
379//
380// For testing and mocking the event stream this type should be initialized via
381// the NewGetEventStreamEventStream constructor function. Using the functional options
382// to pass in nested mock behavior.
383type GetEventStreamEventStream struct {
384
385	// Reader is the EventStream reader for the EventStream
386	// events. This value is automatically set by the SDK when the API call is made
387	// Use this member when unit testing your code with the SDK to mock out the
388	// EventStream Reader.
389	//
390	// Must not be nil.
391	Reader EventStreamReader
392
393	outputReader io.ReadCloser
394	output       *GetEventStreamOutput
395
396	done      chan struct{}
397	closeOnce sync.Once
398	err       *eventstreamapi.OnceError
399}
400
401// NewGetEventStreamEventStream initializes an GetEventStreamEventStream.
402// This function should only be used for testing and mocking the GetEventStreamEventStream
403// stream within your application.
404//
405// The Reader member must be set before reading events from the stream.
406//
407//   es := NewGetEventStreamEventStream(func(o *GetEventStreamEventStream{
408//       es.Reader = myMockStreamReader
409//   })
410func NewGetEventStreamEventStream(opts ...func(*GetEventStreamEventStream)) *GetEventStreamEventStream {
411	es := &GetEventStreamEventStream{
412		done: make(chan struct{}),
413		err:  eventstreamapi.NewOnceError(),
414	}
415
416	for _, fn := range opts {
417		fn(es)
418	}
419
420	return es
421}
422
423func (es *GetEventStreamEventStream) runOnStreamPartClose(r *request.Request) {
424	if es.done == nil {
425		return
426	}
427	go es.waitStreamPartClose()
428
429}
430
431func (es *GetEventStreamEventStream) waitStreamPartClose() {
432	var outputErrCh <-chan struct{}
433	if v, ok := es.Reader.(interface{ ErrorSet() <-chan struct{} }); ok {
434		outputErrCh = v.ErrorSet()
435	}
436	var outputClosedCh <-chan struct{}
437	if v, ok := es.Reader.(interface{ Closed() <-chan struct{} }); ok {
438		outputClosedCh = v.Closed()
439	}
440
441	select {
442	case <-es.done:
443	case <-outputErrCh:
444		es.err.SetError(es.Reader.Err())
445		es.Close()
446	case <-outputClosedCh:
447		if err := es.Reader.Err(); err != nil {
448			es.err.SetError(es.Reader.Err())
449		}
450		es.Close()
451	}
452}
453
454type eventTypeForGetEventStreamEventStreamOutputEvent struct {
455	unmarshalerForEvent func(string) (eventstreamapi.Unmarshaler, error)
456	output              *GetEventStreamOutput
457}
458
459func (e eventTypeForGetEventStreamEventStreamOutputEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) {
460	if eventType == "initial-response" {
461		return e.output, nil
462	}
463	return e.unmarshalerForEvent(eventType)
464}
465
466// Events returns a channel to read events from.
467//
468// These events are:
469//
470//     * EmptyEvent
471//     * ExplicitPayloadEvent
472//     * HeaderOnlyEvent
473//     * ImplicitPayloadEvent
474//     * PayloadOnlyEvent
475//     * PayloadOnlyBlobEvent
476//     * PayloadOnlyStringEvent
477//     * EventStreamUnknownEvent
478func (es *GetEventStreamEventStream) Events() <-chan EventStreamEvent {
479	return es.Reader.Events()
480}
481
482func (es *GetEventStreamEventStream) runOutputStream(r *request.Request) {
483	var opts []func(*eventstream.Decoder)
484	if r.Config.Logger != nil && r.Config.LogLevel.Matches(aws.LogDebugWithEventStreamBody) {
485		opts = append(opts, eventstream.DecodeWithLogger(r.Config.Logger))
486	}
487
488	unmarshalerForEvent := unmarshalerForEventStreamEvent{
489		metadata: protocol.ResponseMetadata{
490			StatusCode: r.HTTPResponse.StatusCode,
491			RequestID:  r.RequestID,
492		},
493	}.UnmarshalerForEventName
494	unmarshalerForEvent = eventTypeForGetEventStreamEventStreamOutputEvent{
495		unmarshalerForEvent: unmarshalerForEvent,
496		output:              es.output,
497	}.UnmarshalerForEventName
498
499	decoder := eventstream.NewDecoder(r.HTTPResponse.Body, opts...)
500	eventReader := eventstreamapi.NewEventReader(decoder,
501		protocol.HandlerPayloadUnmarshal{
502			Unmarshalers: r.Handlers.UnmarshalStream,
503		},
504		unmarshalerForEvent,
505	)
506
507	es.outputReader = r.HTTPResponse.Body
508	es.Reader = newReadEventStream(eventReader)
509}
510func (es *GetEventStreamEventStream) recvInitialEvent(r *request.Request) {
511	// Wait for the initial response event, which must be the first
512	// event to be received from the API.
513	select {
514	case event, ok := <-es.Events():
515		if !ok {
516			return
517		}
518
519		v, ok := event.(*GetEventStreamOutput)
520		if !ok || v == nil {
521			r.Error = awserr.New(
522				request.ErrCodeSerialization,
523				fmt.Sprintf("invalid event, %T, expect %T, %v",
524					event, (*GetEventStreamOutput)(nil), v),
525				nil,
526			)
527			return
528		}
529
530		*es.output = *v
531		es.output.eventStream = es
532	}
533}
534
535// Close closes the stream. This will also cause the stream to be closed.
536// Close must be called when done using the stream API. Not calling Close
537// may result in resource leaks.
538//
539// You can use the closing of the Reader's Events channel to terminate your
540// application's read from the API's stream.
541//
542func (es *GetEventStreamEventStream) Close() (err error) {
543	es.closeOnce.Do(es.safeClose)
544	return es.Err()
545}
546
547func (es *GetEventStreamEventStream) safeClose() {
548	if es.done != nil {
549		close(es.done)
550	}
551
552	es.Reader.Close()
553	if es.outputReader != nil {
554		es.outputReader.Close()
555	}
556}
557
558// Err returns any error that occurred while reading or writing EventStream
559// Events from the service API's response. Returns nil if there were no errors.
560func (es *GetEventStreamEventStream) Err() error {
561	if err := es.err.Err(); err != nil {
562		return err
563	}
564	if err := es.Reader.Err(); err != nil {
565		return err
566	}
567
568	return nil
569}
570
571const opOtherOperation = "OtherOperation"
572
573// OtherOperationRequest generates a "aws/request.Request" representing the
574// client's request for the OtherOperation operation. The "output" return
575// value will be populated with the request's response once the request completes
576// successfully.
577//
578// Use "Send" method on the returned Request to send the API call to the service.
579// the "output" return value is not valid until after Send returns without error.
580//
581// See OtherOperation for more information on using the OtherOperation
582// API call, and error handling.
583//
584// This method is useful when you want to inject custom logic or configuration
585// into the SDK's request lifecycle. Such as custom headers, or retry logic.
586//
587//
588//    // Example sending a request using the OtherOperationRequest method.
589//    req, resp := client.OtherOperationRequest(params)
590//
591//    err := req.Send()
592//    if err == nil { // resp is now filled
593//        fmt.Println(resp)
594//    }
595//
596// See also, https://docs.aws.amazon.com/goto/WebAPI/RPCService-0000-00-00/OtherOperation
597func (c *RPCService) OtherOperationRequest(input *OtherOperationInput) (req *request.Request, output *OtherOperationOutput) {
598	op := &request.Operation{
599		Name:       opOtherOperation,
600		HTTPMethod: "POST",
601		HTTPPath:   "/",
602	}
603
604	if input == nil {
605		input = &OtherOperationInput{}
606	}
607
608	output = &OtherOperationOutput{}
609	req = c.newRequest(op, input, output)
610	req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
611	return
612}
613
614// OtherOperation API operation for RPC Service.
615//
616// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
617// with awserr.Error's Code and Message methods to get detailed information about
618// the error.
619//
620// See the AWS API reference guide for RPC Service's
621// API operation OtherOperation for usage and error information.
622//
623// Returned Error Types:
624//   * ExceptionEvent2
625//
626// See also, https://docs.aws.amazon.com/goto/WebAPI/RPCService-0000-00-00/OtherOperation
627func (c *RPCService) OtherOperation(input *OtherOperationInput) (*OtherOperationOutput, error) {
628	req, out := c.OtherOperationRequest(input)
629	return out, req.Send()
630}
631
632// OtherOperationWithContext is the same as OtherOperation with the addition of
633// the ability to pass a context and additional request options.
634//
635// See OtherOperation for details on how to use this API operation.
636//
637// The context must be non-nil and will be used for request cancellation. If
638// the context is nil a panic will occur. In the future the SDK may create
639// sub-contexts for http.Requests. See https://golang.org/pkg/context/
640// for more information on using Contexts.
641func (c *RPCService) OtherOperationWithContext(ctx aws.Context, input *OtherOperationInput, opts ...request.Option) (*OtherOperationOutput, error) {
642	req, out := c.OtherOperationRequest(input)
643	req.SetContext(ctx)
644	req.ApplyOptions(opts...)
645	return out, req.Send()
646}
647
648type EmptyEvent struct {
649	_ struct{} `type:"structure"`
650}
651
652// String returns the string representation
653func (s EmptyEvent) String() string {
654	return awsutil.Prettify(s)
655}
656
657// GoString returns the string representation
658func (s EmptyEvent) GoString() string {
659	return s.String()
660}
661
662// The EmptyEvent is and event in the EventStream group of events.
663func (s *EmptyEvent) eventEventStream() {}
664
665// UnmarshalEvent unmarshals the EventStream Message into the EmptyEvent value.
666// This method is only used internally within the SDK's EventStream handling.
667func (s *EmptyEvent) UnmarshalEvent(
668	payloadUnmarshaler protocol.PayloadUnmarshaler,
669	msg eventstream.Message,
670) error {
671	return nil
672}
673
674// MarshalEvent marshals the type into an stream event value. This method
675// should only used internally within the SDK's EventStream handling.
676func (s *EmptyEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
677	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
678	return msg, err
679}
680
681// EmptyEventStreamEvent groups together all EventStream
682// events writes for EmptyEventStream.
683//
684// These events are:
685//
686type EmptyEventStreamEvent interface {
687	eventEmptyEventStream()
688	eventstreamapi.Marshaler
689	eventstreamapi.Unmarshaler
690}
691
692// EmptyEventStreamReader provides the interface for reading to the stream. The
693// default implementation for this interface will be EmptyEventStream.
694//
695// The reader's Close method must allow multiple concurrent calls.
696//
697// These events are:
698//
699//     * EmptyEventStreamUnknownEvent
700type EmptyEventStreamReader interface {
701	// Returns a channel of events as they are read from the event stream.
702	Events() <-chan EmptyEventStreamEvent
703
704	// Close will stop the reader reading events from the stream.
705	Close() error
706
707	// Returns any error that has occurred while reading from the event stream.
708	Err() error
709}
710
711type readEmptyEventStream struct {
712	eventReader *eventstreamapi.EventReader
713	stream      chan EmptyEventStreamEvent
714	err         *eventstreamapi.OnceError
715
716	done      chan struct{}
717	closeOnce sync.Once
718}
719
720func newReadEmptyEventStream(eventReader *eventstreamapi.EventReader) *readEmptyEventStream {
721	r := &readEmptyEventStream{
722		eventReader: eventReader,
723		stream:      make(chan EmptyEventStreamEvent),
724		done:        make(chan struct{}),
725		err:         eventstreamapi.NewOnceError(),
726	}
727	go r.readEventStream()
728
729	return r
730}
731
732// Close will close the underlying event stream reader.
733func (r *readEmptyEventStream) Close() error {
734	r.closeOnce.Do(r.safeClose)
735	return r.Err()
736}
737
738func (r *readEmptyEventStream) ErrorSet() <-chan struct{} {
739	return r.err.ErrorSet()
740}
741
742func (r *readEmptyEventStream) Closed() <-chan struct{} {
743	return r.done
744}
745
746func (r *readEmptyEventStream) safeClose() {
747	close(r.done)
748}
749
750func (r *readEmptyEventStream) Err() error {
751	return r.err.Err()
752}
753
754func (r *readEmptyEventStream) Events() <-chan EmptyEventStreamEvent {
755	return r.stream
756}
757
758func (r *readEmptyEventStream) readEventStream() {
759	defer r.Close()
760	defer close(r.stream)
761
762	for {
763		event, err := r.eventReader.ReadEvent()
764		if err != nil {
765			if err == io.EOF {
766				return
767			}
768			select {
769			case <-r.done:
770				// If closed already ignore the error
771				return
772			default:
773			}
774			if _, ok := err.(*eventstreamapi.UnknownMessageTypeError); ok {
775				continue
776			}
777			r.err.SetError(err)
778			return
779		}
780
781		select {
782		case r.stream <- event.(EmptyEventStreamEvent):
783		case <-r.done:
784			return
785		}
786	}
787}
788
789type unmarshalerForEmptyEventStreamEvent struct {
790	metadata protocol.ResponseMetadata
791}
792
793func (u unmarshalerForEmptyEventStreamEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) {
794	switch eventType {
795	default:
796		return &EmptyEventStreamUnknownEvent{Type: eventType}, nil
797	}
798}
799
800// EmptyEventStreamUnknownEvent provides a failsafe event for the
801// EmptyEventStream group of events when an unknown event is received.
802type EmptyEventStreamUnknownEvent struct {
803	Type    string
804	Message eventstream.Message
805}
806
807// The EmptyEventStreamUnknownEvent is and event in the EmptyEventStream
808// group of events.
809func (s *EmptyEventStreamUnknownEvent) eventEmptyEventStream() {}
810
811// MarshalEvent marshals the type into an stream event value. This method
812// should only used internally within the SDK's EventStream handling.
813func (e *EmptyEventStreamUnknownEvent) MarshalEvent(pm protocol.PayloadMarshaler) (
814	msg eventstream.Message, err error,
815) {
816	return e.Message.Clone(), nil
817}
818
819// UnmarshalEvent unmarshals the EventStream Message into the EmptyEventStream value.
820// This method is only used internally within the SDK's EventStream handling.
821func (e *EmptyEventStreamUnknownEvent) UnmarshalEvent(
822	payloadUnmarshaler protocol.PayloadUnmarshaler,
823	msg eventstream.Message,
824) error {
825	e.Message = msg.Clone()
826	return nil
827}
828
829type EmptyStreamInput struct {
830	_ struct{} `type:"structure"`
831}
832
833// String returns the string representation
834func (s EmptyStreamInput) String() string {
835	return awsutil.Prettify(s)
836}
837
838// GoString returns the string representation
839func (s EmptyStreamInput) GoString() string {
840	return s.String()
841}
842
843type EmptyStreamOutput struct {
844	_ struct{} `type:"structure"`
845
846	eventStream *EmptyStreamEventStream
847}
848
849// String returns the string representation
850func (s EmptyStreamOutput) String() string {
851	return awsutil.Prettify(s)
852}
853
854// GoString returns the string representation
855func (s EmptyStreamOutput) GoString() string {
856	return s.String()
857}
858
859// GetStream returns the type to interact with the event stream.
860func (s *EmptyStreamOutput) GetStream() *EmptyStreamEventStream {
861	return s.eventStream
862}
863
864// The EmptyStreamOutput is and event in the EmptyEventStream group of events.
865func (s *EmptyStreamOutput) eventEmptyEventStream() {}
866
867// UnmarshalEvent unmarshals the EventStream Message into the EmptyStreamOutput value.
868// This method is only used internally within the SDK's EventStream handling.
869func (s *EmptyStreamOutput) UnmarshalEvent(
870	payloadUnmarshaler protocol.PayloadUnmarshaler,
871	msg eventstream.Message,
872) error {
873	if err := payloadUnmarshaler.UnmarshalPayload(
874		bytes.NewReader(msg.Payload), s,
875	); err != nil {
876		return err
877	}
878	return nil
879}
880
881// MarshalEvent marshals the type into an stream event value. This method
882// should only used internally within the SDK's EventStream handling.
883func (s *EmptyStreamOutput) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
884	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
885	var buf bytes.Buffer
886	if err = pm.MarshalPayload(&buf, s); err != nil {
887		return eventstream.Message{}, err
888	}
889	msg.Payload = buf.Bytes()
890	return msg, err
891}
892
893// EventStreamEvent groups together all EventStream
894// events writes for EventStream.
895//
896// These events are:
897//
898//     * EmptyEvent
899//     * ExplicitPayloadEvent
900//     * HeaderOnlyEvent
901//     * ImplicitPayloadEvent
902//     * PayloadOnlyEvent
903//     * PayloadOnlyBlobEvent
904//     * PayloadOnlyStringEvent
905type EventStreamEvent interface {
906	eventEventStream()
907	eventstreamapi.Marshaler
908	eventstreamapi.Unmarshaler
909}
910
911// EventStreamReader provides the interface for reading to the stream. The
912// default implementation for this interface will be EventStream.
913//
914// The reader's Close method must allow multiple concurrent calls.
915//
916// These events are:
917//
918//     * EmptyEvent
919//     * ExplicitPayloadEvent
920//     * HeaderOnlyEvent
921//     * ImplicitPayloadEvent
922//     * PayloadOnlyEvent
923//     * PayloadOnlyBlobEvent
924//     * PayloadOnlyStringEvent
925//     * EventStreamUnknownEvent
926type EventStreamReader interface {
927	// Returns a channel of events as they are read from the event stream.
928	Events() <-chan EventStreamEvent
929
930	// Close will stop the reader reading events from the stream.
931	Close() error
932
933	// Returns any error that has occurred while reading from the event stream.
934	Err() error
935}
936
937type readEventStream struct {
938	eventReader *eventstreamapi.EventReader
939	stream      chan EventStreamEvent
940	err         *eventstreamapi.OnceError
941
942	done      chan struct{}
943	closeOnce sync.Once
944}
945
946func newReadEventStream(eventReader *eventstreamapi.EventReader) *readEventStream {
947	r := &readEventStream{
948		eventReader: eventReader,
949		stream:      make(chan EventStreamEvent),
950		done:        make(chan struct{}),
951		err:         eventstreamapi.NewOnceError(),
952	}
953	go r.readEventStream()
954
955	return r
956}
957
958// Close will close the underlying event stream reader.
959func (r *readEventStream) Close() error {
960	r.closeOnce.Do(r.safeClose)
961	return r.Err()
962}
963
964func (r *readEventStream) ErrorSet() <-chan struct{} {
965	return r.err.ErrorSet()
966}
967
968func (r *readEventStream) Closed() <-chan struct{} {
969	return r.done
970}
971
972func (r *readEventStream) safeClose() {
973	close(r.done)
974}
975
976func (r *readEventStream) Err() error {
977	return r.err.Err()
978}
979
980func (r *readEventStream) Events() <-chan EventStreamEvent {
981	return r.stream
982}
983
984func (r *readEventStream) readEventStream() {
985	defer r.Close()
986	defer close(r.stream)
987
988	for {
989		event, err := r.eventReader.ReadEvent()
990		if err != nil {
991			if err == io.EOF {
992				return
993			}
994			select {
995			case <-r.done:
996				// If closed already ignore the error
997				return
998			default:
999			}
1000			if _, ok := err.(*eventstreamapi.UnknownMessageTypeError); ok {
1001				continue
1002			}
1003			r.err.SetError(err)
1004			return
1005		}
1006
1007		select {
1008		case r.stream <- event.(EventStreamEvent):
1009		case <-r.done:
1010			return
1011		}
1012	}
1013}
1014
1015type unmarshalerForEventStreamEvent struct {
1016	metadata protocol.ResponseMetadata
1017}
1018
1019func (u unmarshalerForEventStreamEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) {
1020	switch eventType {
1021	case "Empty":
1022		return &EmptyEvent{}, nil
1023	case "ExplicitPayload":
1024		return &ExplicitPayloadEvent{}, nil
1025	case "Headers":
1026		return &HeaderOnlyEvent{}, nil
1027	case "ImplicitPayload":
1028		return &ImplicitPayloadEvent{}, nil
1029	case "PayloadOnly":
1030		return &PayloadOnlyEvent{}, nil
1031	case "PayloadOnlyBlob":
1032		return &PayloadOnlyBlobEvent{}, nil
1033	case "PayloadOnlyString":
1034		return &PayloadOnlyStringEvent{}, nil
1035	case "Exception":
1036		return newErrorExceptionEvent(u.metadata).(eventstreamapi.Unmarshaler), nil
1037	case "Exception2":
1038		return newErrorExceptionEvent2(u.metadata).(eventstreamapi.Unmarshaler), nil
1039	default:
1040		return &EventStreamUnknownEvent{Type: eventType}, nil
1041	}
1042}
1043
1044// EventStreamUnknownEvent provides a failsafe event for the
1045// EventStream group of events when an unknown event is received.
1046type EventStreamUnknownEvent struct {
1047	Type    string
1048	Message eventstream.Message
1049}
1050
1051// The EventStreamUnknownEvent is and event in the EventStream
1052// group of events.
1053func (s *EventStreamUnknownEvent) eventEventStream() {}
1054
1055// MarshalEvent marshals the type into an stream event value. This method
1056// should only used internally within the SDK's EventStream handling.
1057func (e *EventStreamUnknownEvent) MarshalEvent(pm protocol.PayloadMarshaler) (
1058	msg eventstream.Message, err error,
1059) {
1060	return e.Message.Clone(), nil
1061}
1062
1063// UnmarshalEvent unmarshals the EventStream Message into the EventStream value.
1064// This method is only used internally within the SDK's EventStream handling.
1065func (e *EventStreamUnknownEvent) UnmarshalEvent(
1066	payloadUnmarshaler protocol.PayloadUnmarshaler,
1067	msg eventstream.Message,
1068) error {
1069	e.Message = msg.Clone()
1070	return nil
1071}
1072
1073type ExceptionEvent struct {
1074	_            struct{}                  `type:"structure"`
1075	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
1076
1077	IntVal *int64 `type:"integer"`
1078
1079	Message_ *string `locationName:"message" type:"string"`
1080}
1081
1082// String returns the string representation
1083func (s ExceptionEvent) String() string {
1084	return awsutil.Prettify(s)
1085}
1086
1087// GoString returns the string representation
1088func (s ExceptionEvent) GoString() string {
1089	return s.String()
1090}
1091
1092// The ExceptionEvent is and event in the EventStream group of events.
1093func (s *ExceptionEvent) eventEventStream() {}
1094
1095// UnmarshalEvent unmarshals the EventStream Message into the ExceptionEvent value.
1096// This method is only used internally within the SDK's EventStream handling.
1097func (s *ExceptionEvent) UnmarshalEvent(
1098	payloadUnmarshaler protocol.PayloadUnmarshaler,
1099	msg eventstream.Message,
1100) error {
1101	if err := payloadUnmarshaler.UnmarshalPayload(
1102		bytes.NewReader(msg.Payload), s,
1103	); err != nil {
1104		return err
1105	}
1106	return nil
1107}
1108
1109// MarshalEvent marshals the type into an stream event value. This method
1110// should only used internally within the SDK's EventStream handling.
1111func (s *ExceptionEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1112	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType))
1113	var buf bytes.Buffer
1114	if err = pm.MarshalPayload(&buf, s); err != nil {
1115		return eventstream.Message{}, err
1116	}
1117	msg.Payload = buf.Bytes()
1118	return msg, err
1119}
1120
1121func newErrorExceptionEvent(v protocol.ResponseMetadata) error {
1122	return &ExceptionEvent{
1123		RespMetadata: v,
1124	}
1125}
1126
1127// Code returns the exception type name.
1128func (s *ExceptionEvent) Code() string {
1129	return "ExceptionEvent"
1130}
1131
1132// Message returns the exception's message.
1133func (s *ExceptionEvent) Message() string {
1134	if s.Message_ != nil {
1135		return *s.Message_
1136	}
1137	return ""
1138}
1139
1140// OrigErr always returns nil, satisfies awserr.Error interface.
1141func (s *ExceptionEvent) OrigErr() error {
1142	return nil
1143}
1144
1145func (s *ExceptionEvent) Error() string {
1146	return fmt.Sprintf("%s: %s\n%s", s.Code(), s.Message(), s.String())
1147}
1148
1149// Status code returns the HTTP status code for the request's response error.
1150func (s *ExceptionEvent) StatusCode() int {
1151	return s.RespMetadata.StatusCode
1152}
1153
1154// RequestID returns the service's response RequestID for request.
1155func (s *ExceptionEvent) RequestID() string {
1156	return s.RespMetadata.RequestID
1157}
1158
1159type ExceptionEvent2 struct {
1160	_            struct{}                  `type:"structure"`
1161	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
1162
1163	Message_ *string `locationName:"message" type:"string"`
1164}
1165
1166// String returns the string representation
1167func (s ExceptionEvent2) String() string {
1168	return awsutil.Prettify(s)
1169}
1170
1171// GoString returns the string representation
1172func (s ExceptionEvent2) GoString() string {
1173	return s.String()
1174}
1175
1176// The ExceptionEvent2 is and event in the EventStream group of events.
1177func (s *ExceptionEvent2) eventEventStream() {}
1178
1179// UnmarshalEvent unmarshals the EventStream Message into the ExceptionEvent2 value.
1180// This method is only used internally within the SDK's EventStream handling.
1181func (s *ExceptionEvent2) UnmarshalEvent(
1182	payloadUnmarshaler protocol.PayloadUnmarshaler,
1183	msg eventstream.Message,
1184) error {
1185	if err := payloadUnmarshaler.UnmarshalPayload(
1186		bytes.NewReader(msg.Payload), s,
1187	); err != nil {
1188		return err
1189	}
1190	return nil
1191}
1192
1193// MarshalEvent marshals the type into an stream event value. This method
1194// should only used internally within the SDK's EventStream handling.
1195func (s *ExceptionEvent2) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1196	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType))
1197	var buf bytes.Buffer
1198	if err = pm.MarshalPayload(&buf, s); err != nil {
1199		return eventstream.Message{}, err
1200	}
1201	msg.Payload = buf.Bytes()
1202	return msg, err
1203}
1204
1205func newErrorExceptionEvent2(v protocol.ResponseMetadata) error {
1206	return &ExceptionEvent2{
1207		RespMetadata: v,
1208	}
1209}
1210
1211// Code returns the exception type name.
1212func (s *ExceptionEvent2) Code() string {
1213	return "ExceptionEvent2"
1214}
1215
1216// Message returns the exception's message.
1217func (s *ExceptionEvent2) Message() string {
1218	if s.Message_ != nil {
1219		return *s.Message_
1220	}
1221	return ""
1222}
1223
1224// OrigErr always returns nil, satisfies awserr.Error interface.
1225func (s *ExceptionEvent2) OrigErr() error {
1226	return nil
1227}
1228
1229func (s *ExceptionEvent2) Error() string {
1230	return fmt.Sprintf("%s: %s", s.Code(), s.Message())
1231}
1232
1233// Status code returns the HTTP status code for the request's response error.
1234func (s *ExceptionEvent2) StatusCode() int {
1235	return s.RespMetadata.StatusCode
1236}
1237
1238// RequestID returns the service's response RequestID for request.
1239func (s *ExceptionEvent2) RequestID() string {
1240	return s.RespMetadata.RequestID
1241}
1242
1243type ExplicitPayloadEvent struct {
1244	_ struct{} `type:"structure" payload:"NestedVal"`
1245
1246	LongVal *int64 `location:"header" type:"long"`
1247
1248	NestedVal *NestedShape `locationName:"NestedVal" type:"structure"`
1249
1250	StringVal *string `location:"header" type:"string"`
1251}
1252
1253// String returns the string representation
1254func (s ExplicitPayloadEvent) String() string {
1255	return awsutil.Prettify(s)
1256}
1257
1258// GoString returns the string representation
1259func (s ExplicitPayloadEvent) GoString() string {
1260	return s.String()
1261}
1262
1263// SetLongVal sets the LongVal field's value.
1264func (s *ExplicitPayloadEvent) SetLongVal(v int64) *ExplicitPayloadEvent {
1265	s.LongVal = &v
1266	return s
1267}
1268
1269// SetNestedVal sets the NestedVal field's value.
1270func (s *ExplicitPayloadEvent) SetNestedVal(v *NestedShape) *ExplicitPayloadEvent {
1271	s.NestedVal = v
1272	return s
1273}
1274
1275// SetStringVal sets the StringVal field's value.
1276func (s *ExplicitPayloadEvent) SetStringVal(v string) *ExplicitPayloadEvent {
1277	s.StringVal = &v
1278	return s
1279}
1280
1281// The ExplicitPayloadEvent is and event in the EventStream group of events.
1282func (s *ExplicitPayloadEvent) eventEventStream() {}
1283
1284// UnmarshalEvent unmarshals the EventStream Message into the ExplicitPayloadEvent value.
1285// This method is only used internally within the SDK's EventStream handling.
1286func (s *ExplicitPayloadEvent) UnmarshalEvent(
1287	payloadUnmarshaler protocol.PayloadUnmarshaler,
1288	msg eventstream.Message,
1289) error {
1290	if hv := msg.Headers.Get("LongVal"); hv != nil {
1291		v := hv.Get().(int64)
1292		s.LongVal = &v
1293	}
1294	if hv := msg.Headers.Get("StringVal"); hv != nil {
1295		v := hv.Get().(string)
1296		s.StringVal = &v
1297	}
1298	if err := payloadUnmarshaler.UnmarshalPayload(
1299		bytes.NewReader(msg.Payload), s,
1300	); err != nil {
1301		return err
1302	}
1303	return nil
1304}
1305
1306// MarshalEvent marshals the type into an stream event value. This method
1307// should only used internally within the SDK's EventStream handling.
1308func (s *ExplicitPayloadEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1309	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1310	msg.Headers.Set("LongVal", eventstream.Int64Value(*s.LongVal))
1311	msg.Headers.Set("StringVal", eventstream.StringValue(*s.StringVal))
1312	var buf bytes.Buffer
1313	if err = pm.MarshalPayload(&buf, s); err != nil {
1314		return eventstream.Message{}, err
1315	}
1316	msg.Payload = buf.Bytes()
1317	return msg, err
1318}
1319
1320type GetEventStreamInput struct {
1321	_ struct{} `type:"structure"`
1322
1323	InputVal *string `type:"string"`
1324}
1325
1326// String returns the string representation
1327func (s GetEventStreamInput) String() string {
1328	return awsutil.Prettify(s)
1329}
1330
1331// GoString returns the string representation
1332func (s GetEventStreamInput) GoString() string {
1333	return s.String()
1334}
1335
1336// SetInputVal sets the InputVal field's value.
1337func (s *GetEventStreamInput) SetInputVal(v string) *GetEventStreamInput {
1338	s.InputVal = &v
1339	return s
1340}
1341
1342type GetEventStreamOutput struct {
1343	_ struct{} `type:"structure"`
1344
1345	eventStream *GetEventStreamEventStream
1346
1347	IntVal *int64 `type:"integer"`
1348
1349	StrVal *string `type:"string"`
1350}
1351
1352// String returns the string representation
1353func (s GetEventStreamOutput) String() string {
1354	return awsutil.Prettify(s)
1355}
1356
1357// GoString returns the string representation
1358func (s GetEventStreamOutput) GoString() string {
1359	return s.String()
1360}
1361
1362// SetIntVal sets the IntVal field's value.
1363func (s *GetEventStreamOutput) SetIntVal(v int64) *GetEventStreamOutput {
1364	s.IntVal = &v
1365	return s
1366}
1367
1368// SetStrVal sets the StrVal field's value.
1369func (s *GetEventStreamOutput) SetStrVal(v string) *GetEventStreamOutput {
1370	s.StrVal = &v
1371	return s
1372}
1373
1374// GetStream returns the type to interact with the event stream.
1375func (s *GetEventStreamOutput) GetStream() *GetEventStreamEventStream {
1376	return s.eventStream
1377}
1378
1379// The GetEventStreamOutput is and event in the EventStream group of events.
1380func (s *GetEventStreamOutput) eventEventStream() {}
1381
1382// UnmarshalEvent unmarshals the EventStream Message into the GetEventStreamOutput value.
1383// This method is only used internally within the SDK's EventStream handling.
1384func (s *GetEventStreamOutput) UnmarshalEvent(
1385	payloadUnmarshaler protocol.PayloadUnmarshaler,
1386	msg eventstream.Message,
1387) error {
1388	if err := payloadUnmarshaler.UnmarshalPayload(
1389		bytes.NewReader(msg.Payload), s,
1390	); err != nil {
1391		return err
1392	}
1393	return nil
1394}
1395
1396// MarshalEvent marshals the type into an stream event value. This method
1397// should only used internally within the SDK's EventStream handling.
1398func (s *GetEventStreamOutput) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1399	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1400	var buf bytes.Buffer
1401	if err = pm.MarshalPayload(&buf, s); err != nil {
1402		return eventstream.Message{}, err
1403	}
1404	msg.Payload = buf.Bytes()
1405	return msg, err
1406}
1407
1408type HeaderOnlyEvent struct {
1409	_ struct{} `type:"structure"`
1410
1411	// BlobVal is automatically base64 encoded/decoded by the SDK.
1412	BlobVal []byte `location:"header" type:"blob"`
1413
1414	BoolVal *bool `location:"header" type:"boolean"`
1415
1416	ByteVal *int64 `location:"header" type:"byte"`
1417
1418	IntegerVal *int64 `location:"header" type:"integer"`
1419
1420	LongVal *int64 `location:"header" type:"long"`
1421
1422	ShortVal *int64 `location:"header" type:"short"`
1423
1424	StringVal *string `location:"header" type:"string"`
1425
1426	TimeVal *time.Time `location:"header" type:"timestamp"`
1427}
1428
1429// String returns the string representation
1430func (s HeaderOnlyEvent) String() string {
1431	return awsutil.Prettify(s)
1432}
1433
1434// GoString returns the string representation
1435func (s HeaderOnlyEvent) GoString() string {
1436	return s.String()
1437}
1438
1439// SetBlobVal sets the BlobVal field's value.
1440func (s *HeaderOnlyEvent) SetBlobVal(v []byte) *HeaderOnlyEvent {
1441	s.BlobVal = v
1442	return s
1443}
1444
1445// SetBoolVal sets the BoolVal field's value.
1446func (s *HeaderOnlyEvent) SetBoolVal(v bool) *HeaderOnlyEvent {
1447	s.BoolVal = &v
1448	return s
1449}
1450
1451// SetByteVal sets the ByteVal field's value.
1452func (s *HeaderOnlyEvent) SetByteVal(v int64) *HeaderOnlyEvent {
1453	s.ByteVal = &v
1454	return s
1455}
1456
1457// SetIntegerVal sets the IntegerVal field's value.
1458func (s *HeaderOnlyEvent) SetIntegerVal(v int64) *HeaderOnlyEvent {
1459	s.IntegerVal = &v
1460	return s
1461}
1462
1463// SetLongVal sets the LongVal field's value.
1464func (s *HeaderOnlyEvent) SetLongVal(v int64) *HeaderOnlyEvent {
1465	s.LongVal = &v
1466	return s
1467}
1468
1469// SetShortVal sets the ShortVal field's value.
1470func (s *HeaderOnlyEvent) SetShortVal(v int64) *HeaderOnlyEvent {
1471	s.ShortVal = &v
1472	return s
1473}
1474
1475// SetStringVal sets the StringVal field's value.
1476func (s *HeaderOnlyEvent) SetStringVal(v string) *HeaderOnlyEvent {
1477	s.StringVal = &v
1478	return s
1479}
1480
1481// SetTimeVal sets the TimeVal field's value.
1482func (s *HeaderOnlyEvent) SetTimeVal(v time.Time) *HeaderOnlyEvent {
1483	s.TimeVal = &v
1484	return s
1485}
1486
1487// The HeaderOnlyEvent is and event in the EventStream group of events.
1488func (s *HeaderOnlyEvent) eventEventStream() {}
1489
1490// UnmarshalEvent unmarshals the EventStream Message into the HeaderOnlyEvent value.
1491// This method is only used internally within the SDK's EventStream handling.
1492func (s *HeaderOnlyEvent) UnmarshalEvent(
1493	payloadUnmarshaler protocol.PayloadUnmarshaler,
1494	msg eventstream.Message,
1495) error {
1496	if hv := msg.Headers.Get("BlobVal"); hv != nil {
1497		v := hv.Get().([]byte)
1498		s.BlobVal = v
1499	}
1500	if hv := msg.Headers.Get("BoolVal"); hv != nil {
1501		v := hv.Get().(bool)
1502		s.BoolVal = &v
1503	}
1504	if hv := msg.Headers.Get("ByteVal"); hv != nil {
1505		v := hv.Get().(int8)
1506		m := int64(v)
1507		s.ByteVal = &m
1508	}
1509	if hv := msg.Headers.Get("IntegerVal"); hv != nil {
1510		v := hv.Get().(int32)
1511		m := int64(v)
1512		s.IntegerVal = &m
1513	}
1514	if hv := msg.Headers.Get("LongVal"); hv != nil {
1515		v := hv.Get().(int64)
1516		s.LongVal = &v
1517	}
1518	if hv := msg.Headers.Get("ShortVal"); hv != nil {
1519		v := hv.Get().(int16)
1520		m := int64(v)
1521		s.ShortVal = &m
1522	}
1523	if hv := msg.Headers.Get("StringVal"); hv != nil {
1524		v := hv.Get().(string)
1525		s.StringVal = &v
1526	}
1527	if hv := msg.Headers.Get("TimeVal"); hv != nil {
1528		v := hv.Get().(time.Time)
1529		s.TimeVal = &v
1530	}
1531	return nil
1532}
1533
1534// MarshalEvent marshals the type into an stream event value. This method
1535// should only used internally within the SDK's EventStream handling.
1536func (s *HeaderOnlyEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1537	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1538	msg.Headers.Set("BlobVal", eventstream.BytesValue(s.BlobVal))
1539	msg.Headers.Set("BoolVal", eventstream.BoolValue(*s.BoolVal))
1540	msg.Headers.Set("ByteVal", eventstream.Int8Value(int8(*s.ByteVal)))
1541	msg.Headers.Set("IntegerVal", eventstream.Int32Value(int32(*s.IntegerVal)))
1542	msg.Headers.Set("LongVal", eventstream.Int64Value(*s.LongVal))
1543	msg.Headers.Set("ShortVal", eventstream.Int16Value(int16(*s.ShortVal)))
1544	msg.Headers.Set("StringVal", eventstream.StringValue(*s.StringVal))
1545	msg.Headers.Set("TimeVal", eventstream.TimestampValue(*s.TimeVal))
1546	return msg, err
1547}
1548
1549type ImplicitPayloadEvent struct {
1550	_ struct{} `type:"structure"`
1551
1552	ByteVal *int64 `location:"header" type:"byte"`
1553
1554	IntegerVal *int64 `type:"integer"`
1555
1556	ShortVal *int64 `type:"short"`
1557}
1558
1559// String returns the string representation
1560func (s ImplicitPayloadEvent) String() string {
1561	return awsutil.Prettify(s)
1562}
1563
1564// GoString returns the string representation
1565func (s ImplicitPayloadEvent) GoString() string {
1566	return s.String()
1567}
1568
1569// SetByteVal sets the ByteVal field's value.
1570func (s *ImplicitPayloadEvent) SetByteVal(v int64) *ImplicitPayloadEvent {
1571	s.ByteVal = &v
1572	return s
1573}
1574
1575// SetIntegerVal sets the IntegerVal field's value.
1576func (s *ImplicitPayloadEvent) SetIntegerVal(v int64) *ImplicitPayloadEvent {
1577	s.IntegerVal = &v
1578	return s
1579}
1580
1581// SetShortVal sets the ShortVal field's value.
1582func (s *ImplicitPayloadEvent) SetShortVal(v int64) *ImplicitPayloadEvent {
1583	s.ShortVal = &v
1584	return s
1585}
1586
1587// The ImplicitPayloadEvent is and event in the EventStream group of events.
1588func (s *ImplicitPayloadEvent) eventEventStream() {}
1589
1590// UnmarshalEvent unmarshals the EventStream Message into the ImplicitPayloadEvent value.
1591// This method is only used internally within the SDK's EventStream handling.
1592func (s *ImplicitPayloadEvent) UnmarshalEvent(
1593	payloadUnmarshaler protocol.PayloadUnmarshaler,
1594	msg eventstream.Message,
1595) error {
1596	if hv := msg.Headers.Get("ByteVal"); hv != nil {
1597		v := hv.Get().(int8)
1598		m := int64(v)
1599		s.ByteVal = &m
1600	}
1601	if err := payloadUnmarshaler.UnmarshalPayload(
1602		bytes.NewReader(msg.Payload), s,
1603	); err != nil {
1604		return err
1605	}
1606	return nil
1607}
1608
1609// MarshalEvent marshals the type into an stream event value. This method
1610// should only used internally within the SDK's EventStream handling.
1611func (s *ImplicitPayloadEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1612	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1613	msg.Headers.Set("ByteVal", eventstream.Int8Value(int8(*s.ByteVal)))
1614	var buf bytes.Buffer
1615	if err = pm.MarshalPayload(&buf, s); err != nil {
1616		return eventstream.Message{}, err
1617	}
1618	msg.Payload = buf.Bytes()
1619	return msg, err
1620}
1621
1622type NestedShape struct {
1623	_ struct{} `type:"structure"`
1624
1625	IntVal *int64 `type:"integer"`
1626
1627	StrVal *string `type:"string"`
1628}
1629
1630// String returns the string representation
1631func (s NestedShape) String() string {
1632	return awsutil.Prettify(s)
1633}
1634
1635// GoString returns the string representation
1636func (s NestedShape) GoString() string {
1637	return s.String()
1638}
1639
1640// SetIntVal sets the IntVal field's value.
1641func (s *NestedShape) SetIntVal(v int64) *NestedShape {
1642	s.IntVal = &v
1643	return s
1644}
1645
1646// SetStrVal sets the StrVal field's value.
1647func (s *NestedShape) SetStrVal(v string) *NestedShape {
1648	s.StrVal = &v
1649	return s
1650}
1651
1652type OtherOperationInput struct {
1653	_ struct{} `type:"structure"`
1654}
1655
1656// String returns the string representation
1657func (s OtherOperationInput) String() string {
1658	return awsutil.Prettify(s)
1659}
1660
1661// GoString returns the string representation
1662func (s OtherOperationInput) GoString() string {
1663	return s.String()
1664}
1665
1666type OtherOperationOutput struct {
1667	_ struct{} `type:"structure"`
1668}
1669
1670// String returns the string representation
1671func (s OtherOperationOutput) String() string {
1672	return awsutil.Prettify(s)
1673}
1674
1675// GoString returns the string representation
1676func (s OtherOperationOutput) GoString() string {
1677	return s.String()
1678}
1679
1680type PayloadOnlyBlobEvent struct {
1681	_ struct{} `type:"structure" payload:"BlobPayload"`
1682
1683	// BlobPayload is automatically base64 encoded/decoded by the SDK.
1684	BlobPayload []byte `type:"blob"`
1685}
1686
1687// String returns the string representation
1688func (s PayloadOnlyBlobEvent) String() string {
1689	return awsutil.Prettify(s)
1690}
1691
1692// GoString returns the string representation
1693func (s PayloadOnlyBlobEvent) GoString() string {
1694	return s.String()
1695}
1696
1697// SetBlobPayload sets the BlobPayload field's value.
1698func (s *PayloadOnlyBlobEvent) SetBlobPayload(v []byte) *PayloadOnlyBlobEvent {
1699	s.BlobPayload = v
1700	return s
1701}
1702
1703// The PayloadOnlyBlobEvent is and event in the EventStream group of events.
1704func (s *PayloadOnlyBlobEvent) eventEventStream() {}
1705
1706// UnmarshalEvent unmarshals the EventStream Message into the PayloadOnlyBlobEvent value.
1707// This method is only used internally within the SDK's EventStream handling.
1708func (s *PayloadOnlyBlobEvent) UnmarshalEvent(
1709	payloadUnmarshaler protocol.PayloadUnmarshaler,
1710	msg eventstream.Message,
1711) error {
1712	s.BlobPayload = make([]byte, len(msg.Payload))
1713	copy(s.BlobPayload, msg.Payload)
1714	return nil
1715}
1716
1717// MarshalEvent marshals the type into an stream event value. This method
1718// should only used internally within the SDK's EventStream handling.
1719func (s *PayloadOnlyBlobEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1720	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1721	msg.Headers.Set(":content-type", eventstream.StringValue("application/octet-stream"))
1722	msg.Payload = s.BlobPayload
1723	return msg, err
1724}
1725
1726type PayloadOnlyEvent struct {
1727	_ struct{} `type:"structure" payload:"NestedVal"`
1728
1729	NestedVal *NestedShape `locationName:"NestedVal" type:"structure"`
1730}
1731
1732// String returns the string representation
1733func (s PayloadOnlyEvent) String() string {
1734	return awsutil.Prettify(s)
1735}
1736
1737// GoString returns the string representation
1738func (s PayloadOnlyEvent) GoString() string {
1739	return s.String()
1740}
1741
1742// SetNestedVal sets the NestedVal field's value.
1743func (s *PayloadOnlyEvent) SetNestedVal(v *NestedShape) *PayloadOnlyEvent {
1744	s.NestedVal = v
1745	return s
1746}
1747
1748// The PayloadOnlyEvent is and event in the EventStream group of events.
1749func (s *PayloadOnlyEvent) eventEventStream() {}
1750
1751// UnmarshalEvent unmarshals the EventStream Message into the PayloadOnlyEvent value.
1752// This method is only used internally within the SDK's EventStream handling.
1753func (s *PayloadOnlyEvent) UnmarshalEvent(
1754	payloadUnmarshaler protocol.PayloadUnmarshaler,
1755	msg eventstream.Message,
1756) error {
1757	if err := payloadUnmarshaler.UnmarshalPayload(
1758		bytes.NewReader(msg.Payload), s,
1759	); err != nil {
1760		return err
1761	}
1762	return nil
1763}
1764
1765// MarshalEvent marshals the type into an stream event value. This method
1766// should only used internally within the SDK's EventStream handling.
1767func (s *PayloadOnlyEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1768	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1769	var buf bytes.Buffer
1770	if err = pm.MarshalPayload(&buf, s); err != nil {
1771		return eventstream.Message{}, err
1772	}
1773	msg.Payload = buf.Bytes()
1774	return msg, err
1775}
1776
1777type PayloadOnlyStringEvent struct {
1778	_ struct{} `type:"structure" payload:"StringPayload"`
1779
1780	StringPayload *string `locationName:"StringPayload" type:"string"`
1781}
1782
1783// String returns the string representation
1784func (s PayloadOnlyStringEvent) String() string {
1785	return awsutil.Prettify(s)
1786}
1787
1788// GoString returns the string representation
1789func (s PayloadOnlyStringEvent) GoString() string {
1790	return s.String()
1791}
1792
1793// SetStringPayload sets the StringPayload field's value.
1794func (s *PayloadOnlyStringEvent) SetStringPayload(v string) *PayloadOnlyStringEvent {
1795	s.StringPayload = &v
1796	return s
1797}
1798
1799// The PayloadOnlyStringEvent is and event in the EventStream group of events.
1800func (s *PayloadOnlyStringEvent) eventEventStream() {}
1801
1802// UnmarshalEvent unmarshals the EventStream Message into the PayloadOnlyStringEvent value.
1803// This method is only used internally within the SDK's EventStream handling.
1804func (s *PayloadOnlyStringEvent) UnmarshalEvent(
1805	payloadUnmarshaler protocol.PayloadUnmarshaler,
1806	msg eventstream.Message,
1807) error {
1808	s.StringPayload = aws.String(string(msg.Payload))
1809	return nil
1810}
1811
1812// MarshalEvent marshals the type into an stream event value. This method
1813// should only used internally within the SDK's EventStream handling.
1814func (s *PayloadOnlyStringEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1815	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1816	msg.Payload = []byte(aws.StringValue(s.StringPayload))
1817	return msg, err
1818}
1819