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