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