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.
653//
654// API parameter values that are decorated as "sensitive" in the API will not
655// be included in the string output. The member name will be present, but the
656// value will be replaced with "sensitive".
657func (s EmptyEvent) String() string {
658	return awsutil.Prettify(s)
659}
660
661// GoString returns the string representation.
662//
663// API parameter values that are decorated as "sensitive" in the API will not
664// be included in the string output. The member name will be present, but the
665// value will be replaced with "sensitive".
666func (s EmptyEvent) GoString() string {
667	return s.String()
668}
669
670// The EmptyEvent is and event in the EventStream group of events.
671func (s *EmptyEvent) eventEventStream() {}
672
673// UnmarshalEvent unmarshals the EventStream Message into the EmptyEvent value.
674// This method is only used internally within the SDK's EventStream handling.
675func (s *EmptyEvent) UnmarshalEvent(
676	payloadUnmarshaler protocol.PayloadUnmarshaler,
677	msg eventstream.Message,
678) error {
679	return nil
680}
681
682// MarshalEvent marshals the type into an stream event value. This method
683// should only used internally within the SDK's EventStream handling.
684func (s *EmptyEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
685	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
686	return msg, err
687}
688
689// EmptyEventStreamEvent groups together all EventStream
690// events writes for EmptyEventStream.
691//
692// These events are:
693//
694type EmptyEventStreamEvent interface {
695	eventEmptyEventStream()
696	eventstreamapi.Marshaler
697	eventstreamapi.Unmarshaler
698}
699
700// EmptyEventStreamReader provides the interface for reading to the stream. The
701// default implementation for this interface will be EmptyEventStream.
702//
703// The reader's Close method must allow multiple concurrent calls.
704//
705// These events are:
706//
707//     * EmptyEventStreamUnknownEvent
708type EmptyEventStreamReader interface {
709	// Returns a channel of events as they are read from the event stream.
710	Events() <-chan EmptyEventStreamEvent
711
712	// Close will stop the reader reading events from the stream.
713	Close() error
714
715	// Returns any error that has occurred while reading from the event stream.
716	Err() error
717}
718
719type readEmptyEventStream struct {
720	eventReader *eventstreamapi.EventReader
721	stream      chan EmptyEventStreamEvent
722	err         *eventstreamapi.OnceError
723
724	done      chan struct{}
725	closeOnce sync.Once
726}
727
728func newReadEmptyEventStream(eventReader *eventstreamapi.EventReader) *readEmptyEventStream {
729	r := &readEmptyEventStream{
730		eventReader: eventReader,
731		stream:      make(chan EmptyEventStreamEvent),
732		done:        make(chan struct{}),
733		err:         eventstreamapi.NewOnceError(),
734	}
735	go r.readEventStream()
736
737	return r
738}
739
740// Close will close the underlying event stream reader.
741func (r *readEmptyEventStream) Close() error {
742	r.closeOnce.Do(r.safeClose)
743	return r.Err()
744}
745
746func (r *readEmptyEventStream) ErrorSet() <-chan struct{} {
747	return r.err.ErrorSet()
748}
749
750func (r *readEmptyEventStream) Closed() <-chan struct{} {
751	return r.done
752}
753
754func (r *readEmptyEventStream) safeClose() {
755	close(r.done)
756}
757
758func (r *readEmptyEventStream) Err() error {
759	return r.err.Err()
760}
761
762func (r *readEmptyEventStream) Events() <-chan EmptyEventStreamEvent {
763	return r.stream
764}
765
766func (r *readEmptyEventStream) readEventStream() {
767	defer r.Close()
768	defer close(r.stream)
769
770	for {
771		event, err := r.eventReader.ReadEvent()
772		if err != nil {
773			if err == io.EOF {
774				return
775			}
776			select {
777			case <-r.done:
778				// If closed already ignore the error
779				return
780			default:
781			}
782			if _, ok := err.(*eventstreamapi.UnknownMessageTypeError); ok {
783				continue
784			}
785			r.err.SetError(err)
786			return
787		}
788
789		select {
790		case r.stream <- event.(EmptyEventStreamEvent):
791		case <-r.done:
792			return
793		}
794	}
795}
796
797type unmarshalerForEmptyEventStreamEvent struct {
798	metadata protocol.ResponseMetadata
799}
800
801func (u unmarshalerForEmptyEventStreamEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) {
802	switch eventType {
803	default:
804		return &EmptyEventStreamUnknownEvent{Type: eventType}, nil
805	}
806}
807
808// EmptyEventStreamUnknownEvent provides a failsafe event for the
809// EmptyEventStream group of events when an unknown event is received.
810type EmptyEventStreamUnknownEvent struct {
811	Type    string
812	Message eventstream.Message
813}
814
815// The EmptyEventStreamUnknownEvent is and event in the EmptyEventStream
816// group of events.
817func (s *EmptyEventStreamUnknownEvent) eventEmptyEventStream() {}
818
819// MarshalEvent marshals the type into an stream event value. This method
820// should only used internally within the SDK's EventStream handling.
821func (e *EmptyEventStreamUnknownEvent) MarshalEvent(pm protocol.PayloadMarshaler) (
822	msg eventstream.Message, err error,
823) {
824	return e.Message.Clone(), nil
825}
826
827// UnmarshalEvent unmarshals the EventStream Message into the EmptyEventStream value.
828// This method is only used internally within the SDK's EventStream handling.
829func (e *EmptyEventStreamUnknownEvent) UnmarshalEvent(
830	payloadUnmarshaler protocol.PayloadUnmarshaler,
831	msg eventstream.Message,
832) error {
833	e.Message = msg.Clone()
834	return nil
835}
836
837type EmptyStreamInput struct {
838	_ struct{} `type:"structure"`
839}
840
841// String returns the string representation.
842//
843// API parameter values that are decorated as "sensitive" in the API will not
844// be included in the string output. The member name will be present, but the
845// value will be replaced with "sensitive".
846func (s EmptyStreamInput) String() string {
847	return awsutil.Prettify(s)
848}
849
850// GoString returns the string representation.
851//
852// API parameter values that are decorated as "sensitive" in the API will not
853// be included in the string output. The member name will be present, but the
854// value will be replaced with "sensitive".
855func (s EmptyStreamInput) GoString() string {
856	return s.String()
857}
858
859type EmptyStreamOutput struct {
860	_ struct{} `type:"structure"`
861
862	eventStream *EmptyStreamEventStream
863}
864
865// String returns the string representation.
866//
867// API parameter values that are decorated as "sensitive" in the API will not
868// be included in the string output. The member name will be present, but the
869// value will be replaced with "sensitive".
870func (s EmptyStreamOutput) String() string {
871	return awsutil.Prettify(s)
872}
873
874// GoString returns the string representation.
875//
876// API parameter values that are decorated as "sensitive" in the API will not
877// be included in the string output. The member name will be present, but the
878// value will be replaced with "sensitive".
879func (s EmptyStreamOutput) GoString() string {
880	return s.String()
881}
882
883// GetStream returns the type to interact with the event stream.
884func (s *EmptyStreamOutput) GetStream() *EmptyStreamEventStream {
885	return s.eventStream
886}
887
888// The EmptyStreamOutput is and event in the EmptyEventStream group of events.
889func (s *EmptyStreamOutput) eventEmptyEventStream() {}
890
891// UnmarshalEvent unmarshals the EventStream Message into the EmptyStreamOutput value.
892// This method is only used internally within the SDK's EventStream handling.
893func (s *EmptyStreamOutput) UnmarshalEvent(
894	payloadUnmarshaler protocol.PayloadUnmarshaler,
895	msg eventstream.Message,
896) error {
897	if err := payloadUnmarshaler.UnmarshalPayload(
898		bytes.NewReader(msg.Payload), s,
899	); err != nil {
900		return err
901	}
902	return nil
903}
904
905// MarshalEvent marshals the type into an stream event value. This method
906// should only used internally within the SDK's EventStream handling.
907func (s *EmptyStreamOutput) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
908	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
909	var buf bytes.Buffer
910	if err = pm.MarshalPayload(&buf, s); err != nil {
911		return eventstream.Message{}, err
912	}
913	msg.Payload = buf.Bytes()
914	return msg, err
915}
916
917// EventStreamEvent groups together all EventStream
918// events writes for EventStream.
919//
920// These events are:
921//
922//     * EmptyEvent
923//     * ExplicitPayloadEvent
924//     * HeaderOnlyEvent
925//     * ImplicitPayloadEvent
926//     * PayloadOnlyEvent
927//     * PayloadOnlyBlobEvent
928//     * PayloadOnlyStringEvent
929type EventStreamEvent interface {
930	eventEventStream()
931	eventstreamapi.Marshaler
932	eventstreamapi.Unmarshaler
933}
934
935// EventStreamReader provides the interface for reading to the stream. The
936// default implementation for this interface will be EventStream.
937//
938// The reader's Close method must allow multiple concurrent calls.
939//
940// These events are:
941//
942//     * EmptyEvent
943//     * ExplicitPayloadEvent
944//     * HeaderOnlyEvent
945//     * ImplicitPayloadEvent
946//     * PayloadOnlyEvent
947//     * PayloadOnlyBlobEvent
948//     * PayloadOnlyStringEvent
949//     * EventStreamUnknownEvent
950type EventStreamReader interface {
951	// Returns a channel of events as they are read from the event stream.
952	Events() <-chan EventStreamEvent
953
954	// Close will stop the reader reading events from the stream.
955	Close() error
956
957	// Returns any error that has occurred while reading from the event stream.
958	Err() error
959}
960
961type readEventStream struct {
962	eventReader *eventstreamapi.EventReader
963	stream      chan EventStreamEvent
964	err         *eventstreamapi.OnceError
965
966	done      chan struct{}
967	closeOnce sync.Once
968}
969
970func newReadEventStream(eventReader *eventstreamapi.EventReader) *readEventStream {
971	r := &readEventStream{
972		eventReader: eventReader,
973		stream:      make(chan EventStreamEvent),
974		done:        make(chan struct{}),
975		err:         eventstreamapi.NewOnceError(),
976	}
977	go r.readEventStream()
978
979	return r
980}
981
982// Close will close the underlying event stream reader.
983func (r *readEventStream) Close() error {
984	r.closeOnce.Do(r.safeClose)
985	return r.Err()
986}
987
988func (r *readEventStream) ErrorSet() <-chan struct{} {
989	return r.err.ErrorSet()
990}
991
992func (r *readEventStream) Closed() <-chan struct{} {
993	return r.done
994}
995
996func (r *readEventStream) safeClose() {
997	close(r.done)
998}
999
1000func (r *readEventStream) Err() error {
1001	return r.err.Err()
1002}
1003
1004func (r *readEventStream) Events() <-chan EventStreamEvent {
1005	return r.stream
1006}
1007
1008func (r *readEventStream) readEventStream() {
1009	defer r.Close()
1010	defer close(r.stream)
1011
1012	for {
1013		event, err := r.eventReader.ReadEvent()
1014		if err != nil {
1015			if err == io.EOF {
1016				return
1017			}
1018			select {
1019			case <-r.done:
1020				// If closed already ignore the error
1021				return
1022			default:
1023			}
1024			if _, ok := err.(*eventstreamapi.UnknownMessageTypeError); ok {
1025				continue
1026			}
1027			r.err.SetError(err)
1028			return
1029		}
1030
1031		select {
1032		case r.stream <- event.(EventStreamEvent):
1033		case <-r.done:
1034			return
1035		}
1036	}
1037}
1038
1039type unmarshalerForEventStreamEvent struct {
1040	metadata protocol.ResponseMetadata
1041}
1042
1043func (u unmarshalerForEventStreamEvent) UnmarshalerForEventName(eventType string) (eventstreamapi.Unmarshaler, error) {
1044	switch eventType {
1045	case "Empty":
1046		return &EmptyEvent{}, nil
1047	case "ExplicitPayload":
1048		return &ExplicitPayloadEvent{}, nil
1049	case "Headers":
1050		return &HeaderOnlyEvent{}, nil
1051	case "ImplicitPayload":
1052		return &ImplicitPayloadEvent{}, nil
1053	case "PayloadOnly":
1054		return &PayloadOnlyEvent{}, nil
1055	case "PayloadOnlyBlob":
1056		return &PayloadOnlyBlobEvent{}, nil
1057	case "PayloadOnlyString":
1058		return &PayloadOnlyStringEvent{}, nil
1059	case "Exception":
1060		return newErrorExceptionEvent(u.metadata).(eventstreamapi.Unmarshaler), nil
1061	case "Exception2":
1062		return newErrorExceptionEvent2(u.metadata).(eventstreamapi.Unmarshaler), nil
1063	default:
1064		return &EventStreamUnknownEvent{Type: eventType}, nil
1065	}
1066}
1067
1068// EventStreamUnknownEvent provides a failsafe event for the
1069// EventStream group of events when an unknown event is received.
1070type EventStreamUnknownEvent struct {
1071	Type    string
1072	Message eventstream.Message
1073}
1074
1075// The EventStreamUnknownEvent is and event in the EventStream
1076// group of events.
1077func (s *EventStreamUnknownEvent) eventEventStream() {}
1078
1079// MarshalEvent marshals the type into an stream event value. This method
1080// should only used internally within the SDK's EventStream handling.
1081func (e *EventStreamUnknownEvent) MarshalEvent(pm protocol.PayloadMarshaler) (
1082	msg eventstream.Message, err error,
1083) {
1084	return e.Message.Clone(), nil
1085}
1086
1087// UnmarshalEvent unmarshals the EventStream Message into the EventStream value.
1088// This method is only used internally within the SDK's EventStream handling.
1089func (e *EventStreamUnknownEvent) UnmarshalEvent(
1090	payloadUnmarshaler protocol.PayloadUnmarshaler,
1091	msg eventstream.Message,
1092) error {
1093	e.Message = msg.Clone()
1094	return nil
1095}
1096
1097type ExceptionEvent struct {
1098	_            struct{}                  `type:"structure"`
1099	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
1100
1101	IntVal *int64 `type:"integer"`
1102
1103	Message_ *string `locationName:"message" type:"string"`
1104}
1105
1106// String returns the string representation.
1107//
1108// API parameter values that are decorated as "sensitive" in the API will not
1109// be included in the string output. The member name will be present, but the
1110// value will be replaced with "sensitive".
1111func (s ExceptionEvent) String() string {
1112	return awsutil.Prettify(s)
1113}
1114
1115// GoString returns the string representation.
1116//
1117// API parameter values that are decorated as "sensitive" in the API will not
1118// be included in the string output. The member name will be present, but the
1119// value will be replaced with "sensitive".
1120func (s ExceptionEvent) GoString() string {
1121	return s.String()
1122}
1123
1124// The ExceptionEvent is and event in the EventStream group of events.
1125func (s *ExceptionEvent) eventEventStream() {}
1126
1127// UnmarshalEvent unmarshals the EventStream Message into the ExceptionEvent value.
1128// This method is only used internally within the SDK's EventStream handling.
1129func (s *ExceptionEvent) UnmarshalEvent(
1130	payloadUnmarshaler protocol.PayloadUnmarshaler,
1131	msg eventstream.Message,
1132) error {
1133	if err := payloadUnmarshaler.UnmarshalPayload(
1134		bytes.NewReader(msg.Payload), s,
1135	); err != nil {
1136		return err
1137	}
1138	return nil
1139}
1140
1141// MarshalEvent marshals the type into an stream event value. This method
1142// should only used internally within the SDK's EventStream handling.
1143func (s *ExceptionEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1144	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType))
1145	var buf bytes.Buffer
1146	if err = pm.MarshalPayload(&buf, s); err != nil {
1147		return eventstream.Message{}, err
1148	}
1149	msg.Payload = buf.Bytes()
1150	return msg, err
1151}
1152
1153func newErrorExceptionEvent(v protocol.ResponseMetadata) error {
1154	return &ExceptionEvent{
1155		RespMetadata: v,
1156	}
1157}
1158
1159// Code returns the exception type name.
1160func (s *ExceptionEvent) Code() string {
1161	return "ExceptionEvent"
1162}
1163
1164// Message returns the exception's message.
1165func (s *ExceptionEvent) Message() string {
1166	if s.Message_ != nil {
1167		return *s.Message_
1168	}
1169	return ""
1170}
1171
1172// OrigErr always returns nil, satisfies awserr.Error interface.
1173func (s *ExceptionEvent) OrigErr() error {
1174	return nil
1175}
1176
1177func (s *ExceptionEvent) Error() string {
1178	return fmt.Sprintf("%s: %s\n%s", s.Code(), s.Message(), s.String())
1179}
1180
1181// Status code returns the HTTP status code for the request's response error.
1182func (s *ExceptionEvent) StatusCode() int {
1183	return s.RespMetadata.StatusCode
1184}
1185
1186// RequestID returns the service's response RequestID for request.
1187func (s *ExceptionEvent) RequestID() string {
1188	return s.RespMetadata.RequestID
1189}
1190
1191type ExceptionEvent2 struct {
1192	_            struct{}                  `type:"structure"`
1193	RespMetadata protocol.ResponseMetadata `json:"-" xml:"-"`
1194
1195	Message_ *string `locationName:"message" type:"string"`
1196}
1197
1198// String returns the string representation.
1199//
1200// API parameter values that are decorated as "sensitive" in the API will not
1201// be included in the string output. The member name will be present, but the
1202// value will be replaced with "sensitive".
1203func (s ExceptionEvent2) String() string {
1204	return awsutil.Prettify(s)
1205}
1206
1207// GoString returns the string representation.
1208//
1209// API parameter values that are decorated as "sensitive" in the API will not
1210// be included in the string output. The member name will be present, but the
1211// value will be replaced with "sensitive".
1212func (s ExceptionEvent2) GoString() string {
1213	return s.String()
1214}
1215
1216// The ExceptionEvent2 is and event in the EventStream group of events.
1217func (s *ExceptionEvent2) eventEventStream() {}
1218
1219// UnmarshalEvent unmarshals the EventStream Message into the ExceptionEvent2 value.
1220// This method is only used internally within the SDK's EventStream handling.
1221func (s *ExceptionEvent2) UnmarshalEvent(
1222	payloadUnmarshaler protocol.PayloadUnmarshaler,
1223	msg eventstream.Message,
1224) error {
1225	if err := payloadUnmarshaler.UnmarshalPayload(
1226		bytes.NewReader(msg.Payload), s,
1227	); err != nil {
1228		return err
1229	}
1230	return nil
1231}
1232
1233// MarshalEvent marshals the type into an stream event value. This method
1234// should only used internally within the SDK's EventStream handling.
1235func (s *ExceptionEvent2) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1236	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.ExceptionMessageType))
1237	var buf bytes.Buffer
1238	if err = pm.MarshalPayload(&buf, s); err != nil {
1239		return eventstream.Message{}, err
1240	}
1241	msg.Payload = buf.Bytes()
1242	return msg, err
1243}
1244
1245func newErrorExceptionEvent2(v protocol.ResponseMetadata) error {
1246	return &ExceptionEvent2{
1247		RespMetadata: v,
1248	}
1249}
1250
1251// Code returns the exception type name.
1252func (s *ExceptionEvent2) Code() string {
1253	return "ExceptionEvent2"
1254}
1255
1256// Message returns the exception's message.
1257func (s *ExceptionEvent2) Message() string {
1258	if s.Message_ != nil {
1259		return *s.Message_
1260	}
1261	return ""
1262}
1263
1264// OrigErr always returns nil, satisfies awserr.Error interface.
1265func (s *ExceptionEvent2) OrigErr() error {
1266	return nil
1267}
1268
1269func (s *ExceptionEvent2) Error() string {
1270	return fmt.Sprintf("%s: %s", s.Code(), s.Message())
1271}
1272
1273// Status code returns the HTTP status code for the request's response error.
1274func (s *ExceptionEvent2) StatusCode() int {
1275	return s.RespMetadata.StatusCode
1276}
1277
1278// RequestID returns the service's response RequestID for request.
1279func (s *ExceptionEvent2) RequestID() string {
1280	return s.RespMetadata.RequestID
1281}
1282
1283type ExplicitPayloadEvent struct {
1284	_ struct{} `type:"structure" payload:"NestedVal"`
1285
1286	LongVal *int64 `location:"header" type:"long"`
1287
1288	NestedVal *NestedShape `locationName:"NestedVal" type:"structure"`
1289
1290	StringVal *string `location:"header" type:"string"`
1291}
1292
1293// String returns the string representation.
1294//
1295// API parameter values that are decorated as "sensitive" in the API will not
1296// be included in the string output. The member name will be present, but the
1297// value will be replaced with "sensitive".
1298func (s ExplicitPayloadEvent) String() string {
1299	return awsutil.Prettify(s)
1300}
1301
1302// GoString returns the string representation.
1303//
1304// API parameter values that are decorated as "sensitive" in the API will not
1305// be included in the string output. The member name will be present, but the
1306// value will be replaced with "sensitive".
1307func (s ExplicitPayloadEvent) GoString() string {
1308	return s.String()
1309}
1310
1311// SetLongVal sets the LongVal field's value.
1312func (s *ExplicitPayloadEvent) SetLongVal(v int64) *ExplicitPayloadEvent {
1313	s.LongVal = &v
1314	return s
1315}
1316
1317// SetNestedVal sets the NestedVal field's value.
1318func (s *ExplicitPayloadEvent) SetNestedVal(v *NestedShape) *ExplicitPayloadEvent {
1319	s.NestedVal = v
1320	return s
1321}
1322
1323// SetStringVal sets the StringVal field's value.
1324func (s *ExplicitPayloadEvent) SetStringVal(v string) *ExplicitPayloadEvent {
1325	s.StringVal = &v
1326	return s
1327}
1328
1329// The ExplicitPayloadEvent is and event in the EventStream group of events.
1330func (s *ExplicitPayloadEvent) eventEventStream() {}
1331
1332// UnmarshalEvent unmarshals the EventStream Message into the ExplicitPayloadEvent value.
1333// This method is only used internally within the SDK's EventStream handling.
1334func (s *ExplicitPayloadEvent) UnmarshalEvent(
1335	payloadUnmarshaler protocol.PayloadUnmarshaler,
1336	msg eventstream.Message,
1337) error {
1338	if hv := msg.Headers.Get("LongVal"); hv != nil {
1339		v := hv.Get().(int64)
1340		s.LongVal = &v
1341	}
1342	if hv := msg.Headers.Get("StringVal"); hv != nil {
1343		v := hv.Get().(string)
1344		s.StringVal = &v
1345	}
1346	if err := payloadUnmarshaler.UnmarshalPayload(
1347		bytes.NewReader(msg.Payload), s,
1348	); err != nil {
1349		return err
1350	}
1351	return nil
1352}
1353
1354// MarshalEvent marshals the type into an stream event value. This method
1355// should only used internally within the SDK's EventStream handling.
1356func (s *ExplicitPayloadEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1357	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1358	msg.Headers.Set("LongVal", eventstream.Int64Value(*s.LongVal))
1359	msg.Headers.Set("StringVal", eventstream.StringValue(*s.StringVal))
1360	var buf bytes.Buffer
1361	if err = pm.MarshalPayload(&buf, s); err != nil {
1362		return eventstream.Message{}, err
1363	}
1364	msg.Payload = buf.Bytes()
1365	return msg, err
1366}
1367
1368type GetEventStreamInput struct {
1369	_ struct{} `type:"structure"`
1370
1371	InputVal *string `type:"string"`
1372}
1373
1374// String returns the string representation.
1375//
1376// API parameter values that are decorated as "sensitive" in the API will not
1377// be included in the string output. The member name will be present, but the
1378// value will be replaced with "sensitive".
1379func (s GetEventStreamInput) String() string {
1380	return awsutil.Prettify(s)
1381}
1382
1383// GoString returns the string representation.
1384//
1385// API parameter values that are decorated as "sensitive" in the API will not
1386// be included in the string output. The member name will be present, but the
1387// value will be replaced with "sensitive".
1388func (s GetEventStreamInput) GoString() string {
1389	return s.String()
1390}
1391
1392// SetInputVal sets the InputVal field's value.
1393func (s *GetEventStreamInput) SetInputVal(v string) *GetEventStreamInput {
1394	s.InputVal = &v
1395	return s
1396}
1397
1398type GetEventStreamOutput struct {
1399	_ struct{} `type:"structure"`
1400
1401	eventStream *GetEventStreamEventStream
1402
1403	IntVal *int64 `type:"integer"`
1404
1405	StrVal *string `type:"string"`
1406}
1407
1408// String returns the string representation.
1409//
1410// API parameter values that are decorated as "sensitive" in the API will not
1411// be included in the string output. The member name will be present, but the
1412// value will be replaced with "sensitive".
1413func (s GetEventStreamOutput) String() string {
1414	return awsutil.Prettify(s)
1415}
1416
1417// GoString returns the string representation.
1418//
1419// API parameter values that are decorated as "sensitive" in the API will not
1420// be included in the string output. The member name will be present, but the
1421// value will be replaced with "sensitive".
1422func (s GetEventStreamOutput) GoString() string {
1423	return s.String()
1424}
1425
1426// SetIntVal sets the IntVal field's value.
1427func (s *GetEventStreamOutput) SetIntVal(v int64) *GetEventStreamOutput {
1428	s.IntVal = &v
1429	return s
1430}
1431
1432// SetStrVal sets the StrVal field's value.
1433func (s *GetEventStreamOutput) SetStrVal(v string) *GetEventStreamOutput {
1434	s.StrVal = &v
1435	return s
1436}
1437
1438// GetStream returns the type to interact with the event stream.
1439func (s *GetEventStreamOutput) GetStream() *GetEventStreamEventStream {
1440	return s.eventStream
1441}
1442
1443// The GetEventStreamOutput is and event in the EventStream group of events.
1444func (s *GetEventStreamOutput) eventEventStream() {}
1445
1446// UnmarshalEvent unmarshals the EventStream Message into the GetEventStreamOutput value.
1447// This method is only used internally within the SDK's EventStream handling.
1448func (s *GetEventStreamOutput) UnmarshalEvent(
1449	payloadUnmarshaler protocol.PayloadUnmarshaler,
1450	msg eventstream.Message,
1451) error {
1452	if err := payloadUnmarshaler.UnmarshalPayload(
1453		bytes.NewReader(msg.Payload), s,
1454	); err != nil {
1455		return err
1456	}
1457	return nil
1458}
1459
1460// MarshalEvent marshals the type into an stream event value. This method
1461// should only used internally within the SDK's EventStream handling.
1462func (s *GetEventStreamOutput) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1463	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1464	var buf bytes.Buffer
1465	if err = pm.MarshalPayload(&buf, s); err != nil {
1466		return eventstream.Message{}, err
1467	}
1468	msg.Payload = buf.Bytes()
1469	return msg, err
1470}
1471
1472type HeaderOnlyEvent struct {
1473	_ struct{} `type:"structure"`
1474
1475	// BlobVal is automatically base64 encoded/decoded by the SDK.
1476	BlobVal []byte `location:"header" type:"blob"`
1477
1478	BoolVal *bool `location:"header" type:"boolean"`
1479
1480	ByteVal *int64 `location:"header" type:"byte"`
1481
1482	IntegerVal *int64 `location:"header" type:"integer"`
1483
1484	LongVal *int64 `location:"header" type:"long"`
1485
1486	ShortVal *int64 `location:"header" type:"short"`
1487
1488	StringVal *string `location:"header" type:"string"`
1489
1490	TimeVal *time.Time `location:"header" type:"timestamp"`
1491}
1492
1493// String returns the string representation.
1494//
1495// API parameter values that are decorated as "sensitive" in the API will not
1496// be included in the string output. The member name will be present, but the
1497// value will be replaced with "sensitive".
1498func (s HeaderOnlyEvent) String() string {
1499	return awsutil.Prettify(s)
1500}
1501
1502// GoString returns the string representation.
1503//
1504// API parameter values that are decorated as "sensitive" in the API will not
1505// be included in the string output. The member name will be present, but the
1506// value will be replaced with "sensitive".
1507func (s HeaderOnlyEvent) GoString() string {
1508	return s.String()
1509}
1510
1511// SetBlobVal sets the BlobVal field's value.
1512func (s *HeaderOnlyEvent) SetBlobVal(v []byte) *HeaderOnlyEvent {
1513	s.BlobVal = v
1514	return s
1515}
1516
1517// SetBoolVal sets the BoolVal field's value.
1518func (s *HeaderOnlyEvent) SetBoolVal(v bool) *HeaderOnlyEvent {
1519	s.BoolVal = &v
1520	return s
1521}
1522
1523// SetByteVal sets the ByteVal field's value.
1524func (s *HeaderOnlyEvent) SetByteVal(v int64) *HeaderOnlyEvent {
1525	s.ByteVal = &v
1526	return s
1527}
1528
1529// SetIntegerVal sets the IntegerVal field's value.
1530func (s *HeaderOnlyEvent) SetIntegerVal(v int64) *HeaderOnlyEvent {
1531	s.IntegerVal = &v
1532	return s
1533}
1534
1535// SetLongVal sets the LongVal field's value.
1536func (s *HeaderOnlyEvent) SetLongVal(v int64) *HeaderOnlyEvent {
1537	s.LongVal = &v
1538	return s
1539}
1540
1541// SetShortVal sets the ShortVal field's value.
1542func (s *HeaderOnlyEvent) SetShortVal(v int64) *HeaderOnlyEvent {
1543	s.ShortVal = &v
1544	return s
1545}
1546
1547// SetStringVal sets the StringVal field's value.
1548func (s *HeaderOnlyEvent) SetStringVal(v string) *HeaderOnlyEvent {
1549	s.StringVal = &v
1550	return s
1551}
1552
1553// SetTimeVal sets the TimeVal field's value.
1554func (s *HeaderOnlyEvent) SetTimeVal(v time.Time) *HeaderOnlyEvent {
1555	s.TimeVal = &v
1556	return s
1557}
1558
1559// The HeaderOnlyEvent is and event in the EventStream group of events.
1560func (s *HeaderOnlyEvent) eventEventStream() {}
1561
1562// UnmarshalEvent unmarshals the EventStream Message into the HeaderOnlyEvent value.
1563// This method is only used internally within the SDK's EventStream handling.
1564func (s *HeaderOnlyEvent) UnmarshalEvent(
1565	payloadUnmarshaler protocol.PayloadUnmarshaler,
1566	msg eventstream.Message,
1567) error {
1568	if hv := msg.Headers.Get("BlobVal"); hv != nil {
1569		v := hv.Get().([]byte)
1570		s.BlobVal = v
1571	}
1572	if hv := msg.Headers.Get("BoolVal"); hv != nil {
1573		v := hv.Get().(bool)
1574		s.BoolVal = &v
1575	}
1576	if hv := msg.Headers.Get("ByteVal"); hv != nil {
1577		v := hv.Get().(int8)
1578		m := int64(v)
1579		s.ByteVal = &m
1580	}
1581	if hv := msg.Headers.Get("IntegerVal"); hv != nil {
1582		v := hv.Get().(int32)
1583		m := int64(v)
1584		s.IntegerVal = &m
1585	}
1586	if hv := msg.Headers.Get("LongVal"); hv != nil {
1587		v := hv.Get().(int64)
1588		s.LongVal = &v
1589	}
1590	if hv := msg.Headers.Get("ShortVal"); hv != nil {
1591		v := hv.Get().(int16)
1592		m := int64(v)
1593		s.ShortVal = &m
1594	}
1595	if hv := msg.Headers.Get("StringVal"); hv != nil {
1596		v := hv.Get().(string)
1597		s.StringVal = &v
1598	}
1599	if hv := msg.Headers.Get("TimeVal"); hv != nil {
1600		v := hv.Get().(time.Time)
1601		s.TimeVal = &v
1602	}
1603	return nil
1604}
1605
1606// MarshalEvent marshals the type into an stream event value. This method
1607// should only used internally within the SDK's EventStream handling.
1608func (s *HeaderOnlyEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1609	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1610	msg.Headers.Set("BlobVal", eventstream.BytesValue(s.BlobVal))
1611	msg.Headers.Set("BoolVal", eventstream.BoolValue(*s.BoolVal))
1612	msg.Headers.Set("ByteVal", eventstream.Int8Value(int8(*s.ByteVal)))
1613	msg.Headers.Set("IntegerVal", eventstream.Int32Value(int32(*s.IntegerVal)))
1614	msg.Headers.Set("LongVal", eventstream.Int64Value(*s.LongVal))
1615	msg.Headers.Set("ShortVal", eventstream.Int16Value(int16(*s.ShortVal)))
1616	msg.Headers.Set("StringVal", eventstream.StringValue(*s.StringVal))
1617	msg.Headers.Set("TimeVal", eventstream.TimestampValue(*s.TimeVal))
1618	return msg, err
1619}
1620
1621type ImplicitPayloadEvent struct {
1622	_ struct{} `type:"structure"`
1623
1624	ByteVal *int64 `location:"header" type:"byte"`
1625
1626	IntegerVal *int64 `type:"integer"`
1627
1628	ShortVal *int64 `type:"short"`
1629}
1630
1631// String returns the string representation.
1632//
1633// API parameter values that are decorated as "sensitive" in the API will not
1634// be included in the string output. The member name will be present, but the
1635// value will be replaced with "sensitive".
1636func (s ImplicitPayloadEvent) String() string {
1637	return awsutil.Prettify(s)
1638}
1639
1640// GoString returns the string representation.
1641//
1642// API parameter values that are decorated as "sensitive" in the API will not
1643// be included in the string output. The member name will be present, but the
1644// value will be replaced with "sensitive".
1645func (s ImplicitPayloadEvent) GoString() string {
1646	return s.String()
1647}
1648
1649// SetByteVal sets the ByteVal field's value.
1650func (s *ImplicitPayloadEvent) SetByteVal(v int64) *ImplicitPayloadEvent {
1651	s.ByteVal = &v
1652	return s
1653}
1654
1655// SetIntegerVal sets the IntegerVal field's value.
1656func (s *ImplicitPayloadEvent) SetIntegerVal(v int64) *ImplicitPayloadEvent {
1657	s.IntegerVal = &v
1658	return s
1659}
1660
1661// SetShortVal sets the ShortVal field's value.
1662func (s *ImplicitPayloadEvent) SetShortVal(v int64) *ImplicitPayloadEvent {
1663	s.ShortVal = &v
1664	return s
1665}
1666
1667// The ImplicitPayloadEvent is and event in the EventStream group of events.
1668func (s *ImplicitPayloadEvent) eventEventStream() {}
1669
1670// UnmarshalEvent unmarshals the EventStream Message into the ImplicitPayloadEvent value.
1671// This method is only used internally within the SDK's EventStream handling.
1672func (s *ImplicitPayloadEvent) UnmarshalEvent(
1673	payloadUnmarshaler protocol.PayloadUnmarshaler,
1674	msg eventstream.Message,
1675) error {
1676	if hv := msg.Headers.Get("ByteVal"); hv != nil {
1677		v := hv.Get().(int8)
1678		m := int64(v)
1679		s.ByteVal = &m
1680	}
1681	if err := payloadUnmarshaler.UnmarshalPayload(
1682		bytes.NewReader(msg.Payload), s,
1683	); err != nil {
1684		return err
1685	}
1686	return nil
1687}
1688
1689// MarshalEvent marshals the type into an stream event value. This method
1690// should only used internally within the SDK's EventStream handling.
1691func (s *ImplicitPayloadEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1692	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1693	msg.Headers.Set("ByteVal", eventstream.Int8Value(int8(*s.ByteVal)))
1694	var buf bytes.Buffer
1695	if err = pm.MarshalPayload(&buf, s); err != nil {
1696		return eventstream.Message{}, err
1697	}
1698	msg.Payload = buf.Bytes()
1699	return msg, err
1700}
1701
1702type NestedShape struct {
1703	_ struct{} `type:"structure"`
1704
1705	IntVal *int64 `type:"integer"`
1706
1707	StrVal *string `type:"string"`
1708}
1709
1710// String returns the string representation.
1711//
1712// API parameter values that are decorated as "sensitive" in the API will not
1713// be included in the string output. The member name will be present, but the
1714// value will be replaced with "sensitive".
1715func (s NestedShape) String() string {
1716	return awsutil.Prettify(s)
1717}
1718
1719// GoString returns the string representation.
1720//
1721// API parameter values that are decorated as "sensitive" in the API will not
1722// be included in the string output. The member name will be present, but the
1723// value will be replaced with "sensitive".
1724func (s NestedShape) GoString() string {
1725	return s.String()
1726}
1727
1728// SetIntVal sets the IntVal field's value.
1729func (s *NestedShape) SetIntVal(v int64) *NestedShape {
1730	s.IntVal = &v
1731	return s
1732}
1733
1734// SetStrVal sets the StrVal field's value.
1735func (s *NestedShape) SetStrVal(v string) *NestedShape {
1736	s.StrVal = &v
1737	return s
1738}
1739
1740type OtherOperationInput struct {
1741	_ struct{} `type:"structure"`
1742}
1743
1744// String returns the string representation.
1745//
1746// API parameter values that are decorated as "sensitive" in the API will not
1747// be included in the string output. The member name will be present, but the
1748// value will be replaced with "sensitive".
1749func (s OtherOperationInput) String() string {
1750	return awsutil.Prettify(s)
1751}
1752
1753// GoString returns the string representation.
1754//
1755// API parameter values that are decorated as "sensitive" in the API will not
1756// be included in the string output. The member name will be present, but the
1757// value will be replaced with "sensitive".
1758func (s OtherOperationInput) GoString() string {
1759	return s.String()
1760}
1761
1762type OtherOperationOutput struct {
1763	_ struct{} `type:"structure"`
1764}
1765
1766// String returns the string representation.
1767//
1768// API parameter values that are decorated as "sensitive" in the API will not
1769// be included in the string output. The member name will be present, but the
1770// value will be replaced with "sensitive".
1771func (s OtherOperationOutput) String() string {
1772	return awsutil.Prettify(s)
1773}
1774
1775// GoString returns the string representation.
1776//
1777// API parameter values that are decorated as "sensitive" in the API will not
1778// be included in the string output. The member name will be present, but the
1779// value will be replaced with "sensitive".
1780func (s OtherOperationOutput) GoString() string {
1781	return s.String()
1782}
1783
1784type PayloadOnlyBlobEvent struct {
1785	_ struct{} `type:"structure" payload:"BlobPayload"`
1786
1787	// BlobPayload is automatically base64 encoded/decoded by the SDK.
1788	BlobPayload []byte `type:"blob"`
1789}
1790
1791// String returns the string representation.
1792//
1793// API parameter values that are decorated as "sensitive" in the API will not
1794// be included in the string output. The member name will be present, but the
1795// value will be replaced with "sensitive".
1796func (s PayloadOnlyBlobEvent) String() string {
1797	return awsutil.Prettify(s)
1798}
1799
1800// GoString returns the string representation.
1801//
1802// API parameter values that are decorated as "sensitive" in the API will not
1803// be included in the string output. The member name will be present, but the
1804// value will be replaced with "sensitive".
1805func (s PayloadOnlyBlobEvent) GoString() string {
1806	return s.String()
1807}
1808
1809// SetBlobPayload sets the BlobPayload field's value.
1810func (s *PayloadOnlyBlobEvent) SetBlobPayload(v []byte) *PayloadOnlyBlobEvent {
1811	s.BlobPayload = v
1812	return s
1813}
1814
1815// The PayloadOnlyBlobEvent is and event in the EventStream group of events.
1816func (s *PayloadOnlyBlobEvent) eventEventStream() {}
1817
1818// UnmarshalEvent unmarshals the EventStream Message into the PayloadOnlyBlobEvent value.
1819// This method is only used internally within the SDK's EventStream handling.
1820func (s *PayloadOnlyBlobEvent) UnmarshalEvent(
1821	payloadUnmarshaler protocol.PayloadUnmarshaler,
1822	msg eventstream.Message,
1823) error {
1824	s.BlobPayload = make([]byte, len(msg.Payload))
1825	copy(s.BlobPayload, msg.Payload)
1826	return nil
1827}
1828
1829// MarshalEvent marshals the type into an stream event value. This method
1830// should only used internally within the SDK's EventStream handling.
1831func (s *PayloadOnlyBlobEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1832	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1833	msg.Headers.Set(":content-type", eventstream.StringValue("application/octet-stream"))
1834	msg.Payload = s.BlobPayload
1835	return msg, err
1836}
1837
1838type PayloadOnlyEvent struct {
1839	_ struct{} `type:"structure" payload:"NestedVal"`
1840
1841	NestedVal *NestedShape `locationName:"NestedVal" type:"structure"`
1842}
1843
1844// String returns the string representation.
1845//
1846// API parameter values that are decorated as "sensitive" in the API will not
1847// be included in the string output. The member name will be present, but the
1848// value will be replaced with "sensitive".
1849func (s PayloadOnlyEvent) String() string {
1850	return awsutil.Prettify(s)
1851}
1852
1853// GoString returns the string representation.
1854//
1855// API parameter values that are decorated as "sensitive" in the API will not
1856// be included in the string output. The member name will be present, but the
1857// value will be replaced with "sensitive".
1858func (s PayloadOnlyEvent) GoString() string {
1859	return s.String()
1860}
1861
1862// SetNestedVal sets the NestedVal field's value.
1863func (s *PayloadOnlyEvent) SetNestedVal(v *NestedShape) *PayloadOnlyEvent {
1864	s.NestedVal = v
1865	return s
1866}
1867
1868// The PayloadOnlyEvent is and event in the EventStream group of events.
1869func (s *PayloadOnlyEvent) eventEventStream() {}
1870
1871// UnmarshalEvent unmarshals the EventStream Message into the PayloadOnlyEvent value.
1872// This method is only used internally within the SDK's EventStream handling.
1873func (s *PayloadOnlyEvent) UnmarshalEvent(
1874	payloadUnmarshaler protocol.PayloadUnmarshaler,
1875	msg eventstream.Message,
1876) error {
1877	if err := payloadUnmarshaler.UnmarshalPayload(
1878		bytes.NewReader(msg.Payload), s,
1879	); err != nil {
1880		return err
1881	}
1882	return nil
1883}
1884
1885// MarshalEvent marshals the type into an stream event value. This method
1886// should only used internally within the SDK's EventStream handling.
1887func (s *PayloadOnlyEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1888	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1889	var buf bytes.Buffer
1890	if err = pm.MarshalPayload(&buf, s); err != nil {
1891		return eventstream.Message{}, err
1892	}
1893	msg.Payload = buf.Bytes()
1894	return msg, err
1895}
1896
1897type PayloadOnlyStringEvent struct {
1898	_ struct{} `type:"structure" payload:"StringPayload"`
1899
1900	StringPayload *string `locationName:"StringPayload" type:"string"`
1901}
1902
1903// String returns the string representation.
1904//
1905// API parameter values that are decorated as "sensitive" in the API will not
1906// be included in the string output. The member name will be present, but the
1907// value will be replaced with "sensitive".
1908func (s PayloadOnlyStringEvent) String() string {
1909	return awsutil.Prettify(s)
1910}
1911
1912// GoString returns the string representation.
1913//
1914// API parameter values that are decorated as "sensitive" in the API will not
1915// be included in the string output. The member name will be present, but the
1916// value will be replaced with "sensitive".
1917func (s PayloadOnlyStringEvent) GoString() string {
1918	return s.String()
1919}
1920
1921// SetStringPayload sets the StringPayload field's value.
1922func (s *PayloadOnlyStringEvent) SetStringPayload(v string) *PayloadOnlyStringEvent {
1923	s.StringPayload = &v
1924	return s
1925}
1926
1927// The PayloadOnlyStringEvent is and event in the EventStream group of events.
1928func (s *PayloadOnlyStringEvent) eventEventStream() {}
1929
1930// UnmarshalEvent unmarshals the EventStream Message into the PayloadOnlyStringEvent value.
1931// This method is only used internally within the SDK's EventStream handling.
1932func (s *PayloadOnlyStringEvent) UnmarshalEvent(
1933	payloadUnmarshaler protocol.PayloadUnmarshaler,
1934	msg eventstream.Message,
1935) error {
1936	s.StringPayload = aws.String(string(msg.Payload))
1937	return nil
1938}
1939
1940// MarshalEvent marshals the type into an stream event value. This method
1941// should only used internally within the SDK's EventStream handling.
1942func (s *PayloadOnlyStringEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstream.Message, err error) {
1943	msg.Headers.Set(eventstreamapi.MessageTypeHeader, eventstream.StringValue(eventstreamapi.EventMessageType))
1944	msg.Payload = []byte(aws.StringValue(s.StringPayload))
1945	return msg, err
1946}
1947