deserializers.go (43013B)
1 // Code generated by smithy-go-codegen DO NOT EDIT. 2 3 package ssooidc 4 5 import ( 6 "bytes" 7 "context" 8 "encoding/json" 9 "fmt" 10 "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" 11 "github.com/aws/aws-sdk-go-v2/service/ssooidc/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithyhttp "github.com/aws/smithy-go/transport/http" 17 "io" 18 "strings" 19 ) 20 21 type awsRestjson1_deserializeOpCreateToken struct { 22 } 23 24 func (*awsRestjson1_deserializeOpCreateToken) ID() string { 25 return "OperationDeserializer" 26 } 27 28 func (m *awsRestjson1_deserializeOpCreateToken) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 29 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 30 ) { 31 out, metadata, err = next.HandleDeserialize(ctx, in) 32 if err != nil { 33 return out, metadata, err 34 } 35 36 response, ok := out.RawResponse.(*smithyhttp.Response) 37 if !ok { 38 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 39 } 40 41 if response.StatusCode < 200 || response.StatusCode >= 300 { 42 return out, metadata, awsRestjson1_deserializeOpErrorCreateToken(response, &metadata) 43 } 44 output := &CreateTokenOutput{} 45 out.Result = output 46 47 var buff [1024]byte 48 ringBuffer := smithyio.NewRingBuffer(buff[:]) 49 50 body := io.TeeReader(response.Body, ringBuffer) 51 52 decoder := json.NewDecoder(body) 53 decoder.UseNumber() 54 var shape interface{} 55 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 56 var snapshot bytes.Buffer 57 io.Copy(&snapshot, ringBuffer) 58 err = &smithy.DeserializationError{ 59 Err: fmt.Errorf("failed to decode response body, %w", err), 60 Snapshot: snapshot.Bytes(), 61 } 62 return out, metadata, err 63 } 64 65 err = awsRestjson1_deserializeOpDocumentCreateTokenOutput(&output, shape) 66 if err != nil { 67 var snapshot bytes.Buffer 68 io.Copy(&snapshot, ringBuffer) 69 return out, metadata, &smithy.DeserializationError{ 70 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 71 Snapshot: snapshot.Bytes(), 72 } 73 } 74 75 return out, metadata, err 76 } 77 78 func awsRestjson1_deserializeOpErrorCreateToken(response *smithyhttp.Response, metadata *middleware.Metadata) error { 79 var errorBuffer bytes.Buffer 80 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 81 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 82 } 83 errorBody := bytes.NewReader(errorBuffer.Bytes()) 84 85 errorCode := "UnknownError" 86 errorMessage := errorCode 87 88 code := response.Header.Get("X-Amzn-ErrorType") 89 if len(code) != 0 { 90 errorCode = restjson.SanitizeErrorCode(code) 91 } 92 93 var buff [1024]byte 94 ringBuffer := smithyio.NewRingBuffer(buff[:]) 95 96 body := io.TeeReader(errorBody, ringBuffer) 97 decoder := json.NewDecoder(body) 98 decoder.UseNumber() 99 code, message, err := restjson.GetErrorInfo(decoder) 100 if err != nil { 101 var snapshot bytes.Buffer 102 io.Copy(&snapshot, ringBuffer) 103 err = &smithy.DeserializationError{ 104 Err: fmt.Errorf("failed to decode response body, %w", err), 105 Snapshot: snapshot.Bytes(), 106 } 107 return err 108 } 109 110 errorBody.Seek(0, io.SeekStart) 111 if len(code) != 0 { 112 errorCode = restjson.SanitizeErrorCode(code) 113 } 114 if len(message) != 0 { 115 errorMessage = message 116 } 117 118 switch { 119 case strings.EqualFold("AccessDeniedException", errorCode): 120 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 121 122 case strings.EqualFold("AuthorizationPendingException", errorCode): 123 return awsRestjson1_deserializeErrorAuthorizationPendingException(response, errorBody) 124 125 case strings.EqualFold("ExpiredTokenException", errorCode): 126 return awsRestjson1_deserializeErrorExpiredTokenException(response, errorBody) 127 128 case strings.EqualFold("InternalServerException", errorCode): 129 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 130 131 case strings.EqualFold("InvalidClientException", errorCode): 132 return awsRestjson1_deserializeErrorInvalidClientException(response, errorBody) 133 134 case strings.EqualFold("InvalidGrantException", errorCode): 135 return awsRestjson1_deserializeErrorInvalidGrantException(response, errorBody) 136 137 case strings.EqualFold("InvalidRequestException", errorCode): 138 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 139 140 case strings.EqualFold("InvalidScopeException", errorCode): 141 return awsRestjson1_deserializeErrorInvalidScopeException(response, errorBody) 142 143 case strings.EqualFold("SlowDownException", errorCode): 144 return awsRestjson1_deserializeErrorSlowDownException(response, errorBody) 145 146 case strings.EqualFold("UnauthorizedClientException", errorCode): 147 return awsRestjson1_deserializeErrorUnauthorizedClientException(response, errorBody) 148 149 case strings.EqualFold("UnsupportedGrantTypeException", errorCode): 150 return awsRestjson1_deserializeErrorUnsupportedGrantTypeException(response, errorBody) 151 152 default: 153 genericError := &smithy.GenericAPIError{ 154 Code: errorCode, 155 Message: errorMessage, 156 } 157 return genericError 158 159 } 160 } 161 162 func awsRestjson1_deserializeOpDocumentCreateTokenOutput(v **CreateTokenOutput, value interface{}) error { 163 if v == nil { 164 return fmt.Errorf("unexpected nil of type %T", v) 165 } 166 if value == nil { 167 return nil 168 } 169 170 shape, ok := value.(map[string]interface{}) 171 if !ok { 172 return fmt.Errorf("unexpected JSON type %v", value) 173 } 174 175 var sv *CreateTokenOutput 176 if *v == nil { 177 sv = &CreateTokenOutput{} 178 } else { 179 sv = *v 180 } 181 182 for key, value := range shape { 183 switch key { 184 case "accessToken": 185 if value != nil { 186 jtv, ok := value.(string) 187 if !ok { 188 return fmt.Errorf("expected AccessToken to be of type string, got %T instead", value) 189 } 190 sv.AccessToken = ptr.String(jtv) 191 } 192 193 case "expiresIn": 194 if value != nil { 195 jtv, ok := value.(json.Number) 196 if !ok { 197 return fmt.Errorf("expected ExpirationInSeconds to be json.Number, got %T instead", value) 198 } 199 i64, err := jtv.Int64() 200 if err != nil { 201 return err 202 } 203 sv.ExpiresIn = int32(i64) 204 } 205 206 case "idToken": 207 if value != nil { 208 jtv, ok := value.(string) 209 if !ok { 210 return fmt.Errorf("expected IdToken to be of type string, got %T instead", value) 211 } 212 sv.IdToken = ptr.String(jtv) 213 } 214 215 case "refreshToken": 216 if value != nil { 217 jtv, ok := value.(string) 218 if !ok { 219 return fmt.Errorf("expected RefreshToken to be of type string, got %T instead", value) 220 } 221 sv.RefreshToken = ptr.String(jtv) 222 } 223 224 case "tokenType": 225 if value != nil { 226 jtv, ok := value.(string) 227 if !ok { 228 return fmt.Errorf("expected TokenType to be of type string, got %T instead", value) 229 } 230 sv.TokenType = ptr.String(jtv) 231 } 232 233 default: 234 _, _ = key, value 235 236 } 237 } 238 *v = sv 239 return nil 240 } 241 242 type awsRestjson1_deserializeOpRegisterClient struct { 243 } 244 245 func (*awsRestjson1_deserializeOpRegisterClient) ID() string { 246 return "OperationDeserializer" 247 } 248 249 func (m *awsRestjson1_deserializeOpRegisterClient) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 250 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 251 ) { 252 out, metadata, err = next.HandleDeserialize(ctx, in) 253 if err != nil { 254 return out, metadata, err 255 } 256 257 response, ok := out.RawResponse.(*smithyhttp.Response) 258 if !ok { 259 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 260 } 261 262 if response.StatusCode < 200 || response.StatusCode >= 300 { 263 return out, metadata, awsRestjson1_deserializeOpErrorRegisterClient(response, &metadata) 264 } 265 output := &RegisterClientOutput{} 266 out.Result = output 267 268 var buff [1024]byte 269 ringBuffer := smithyio.NewRingBuffer(buff[:]) 270 271 body := io.TeeReader(response.Body, ringBuffer) 272 273 decoder := json.NewDecoder(body) 274 decoder.UseNumber() 275 var shape interface{} 276 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 277 var snapshot bytes.Buffer 278 io.Copy(&snapshot, ringBuffer) 279 err = &smithy.DeserializationError{ 280 Err: fmt.Errorf("failed to decode response body, %w", err), 281 Snapshot: snapshot.Bytes(), 282 } 283 return out, metadata, err 284 } 285 286 err = awsRestjson1_deserializeOpDocumentRegisterClientOutput(&output, shape) 287 if err != nil { 288 var snapshot bytes.Buffer 289 io.Copy(&snapshot, ringBuffer) 290 return out, metadata, &smithy.DeserializationError{ 291 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 292 Snapshot: snapshot.Bytes(), 293 } 294 } 295 296 return out, metadata, err 297 } 298 299 func awsRestjson1_deserializeOpErrorRegisterClient(response *smithyhttp.Response, metadata *middleware.Metadata) error { 300 var errorBuffer bytes.Buffer 301 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 302 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 303 } 304 errorBody := bytes.NewReader(errorBuffer.Bytes()) 305 306 errorCode := "UnknownError" 307 errorMessage := errorCode 308 309 code := response.Header.Get("X-Amzn-ErrorType") 310 if len(code) != 0 { 311 errorCode = restjson.SanitizeErrorCode(code) 312 } 313 314 var buff [1024]byte 315 ringBuffer := smithyio.NewRingBuffer(buff[:]) 316 317 body := io.TeeReader(errorBody, ringBuffer) 318 decoder := json.NewDecoder(body) 319 decoder.UseNumber() 320 code, message, err := restjson.GetErrorInfo(decoder) 321 if err != nil { 322 var snapshot bytes.Buffer 323 io.Copy(&snapshot, ringBuffer) 324 err = &smithy.DeserializationError{ 325 Err: fmt.Errorf("failed to decode response body, %w", err), 326 Snapshot: snapshot.Bytes(), 327 } 328 return err 329 } 330 331 errorBody.Seek(0, io.SeekStart) 332 if len(code) != 0 { 333 errorCode = restjson.SanitizeErrorCode(code) 334 } 335 if len(message) != 0 { 336 errorMessage = message 337 } 338 339 switch { 340 case strings.EqualFold("InternalServerException", errorCode): 341 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 342 343 case strings.EqualFold("InvalidClientMetadataException", errorCode): 344 return awsRestjson1_deserializeErrorInvalidClientMetadataException(response, errorBody) 345 346 case strings.EqualFold("InvalidRequestException", errorCode): 347 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 348 349 case strings.EqualFold("InvalidScopeException", errorCode): 350 return awsRestjson1_deserializeErrorInvalidScopeException(response, errorBody) 351 352 default: 353 genericError := &smithy.GenericAPIError{ 354 Code: errorCode, 355 Message: errorMessage, 356 } 357 return genericError 358 359 } 360 } 361 362 func awsRestjson1_deserializeOpDocumentRegisterClientOutput(v **RegisterClientOutput, value interface{}) error { 363 if v == nil { 364 return fmt.Errorf("unexpected nil of type %T", v) 365 } 366 if value == nil { 367 return nil 368 } 369 370 shape, ok := value.(map[string]interface{}) 371 if !ok { 372 return fmt.Errorf("unexpected JSON type %v", value) 373 } 374 375 var sv *RegisterClientOutput 376 if *v == nil { 377 sv = &RegisterClientOutput{} 378 } else { 379 sv = *v 380 } 381 382 for key, value := range shape { 383 switch key { 384 case "authorizationEndpoint": 385 if value != nil { 386 jtv, ok := value.(string) 387 if !ok { 388 return fmt.Errorf("expected URI to be of type string, got %T instead", value) 389 } 390 sv.AuthorizationEndpoint = ptr.String(jtv) 391 } 392 393 case "clientId": 394 if value != nil { 395 jtv, ok := value.(string) 396 if !ok { 397 return fmt.Errorf("expected ClientId to be of type string, got %T instead", value) 398 } 399 sv.ClientId = ptr.String(jtv) 400 } 401 402 case "clientIdIssuedAt": 403 if value != nil { 404 jtv, ok := value.(json.Number) 405 if !ok { 406 return fmt.Errorf("expected LongTimeStampType to be json.Number, got %T instead", value) 407 } 408 i64, err := jtv.Int64() 409 if err != nil { 410 return err 411 } 412 sv.ClientIdIssuedAt = i64 413 } 414 415 case "clientSecret": 416 if value != nil { 417 jtv, ok := value.(string) 418 if !ok { 419 return fmt.Errorf("expected ClientSecret to be of type string, got %T instead", value) 420 } 421 sv.ClientSecret = ptr.String(jtv) 422 } 423 424 case "clientSecretExpiresAt": 425 if value != nil { 426 jtv, ok := value.(json.Number) 427 if !ok { 428 return fmt.Errorf("expected LongTimeStampType to be json.Number, got %T instead", value) 429 } 430 i64, err := jtv.Int64() 431 if err != nil { 432 return err 433 } 434 sv.ClientSecretExpiresAt = i64 435 } 436 437 case "tokenEndpoint": 438 if value != nil { 439 jtv, ok := value.(string) 440 if !ok { 441 return fmt.Errorf("expected URI to be of type string, got %T instead", value) 442 } 443 sv.TokenEndpoint = ptr.String(jtv) 444 } 445 446 default: 447 _, _ = key, value 448 449 } 450 } 451 *v = sv 452 return nil 453 } 454 455 type awsRestjson1_deserializeOpStartDeviceAuthorization struct { 456 } 457 458 func (*awsRestjson1_deserializeOpStartDeviceAuthorization) ID() string { 459 return "OperationDeserializer" 460 } 461 462 func (m *awsRestjson1_deserializeOpStartDeviceAuthorization) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 463 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 464 ) { 465 out, metadata, err = next.HandleDeserialize(ctx, in) 466 if err != nil { 467 return out, metadata, err 468 } 469 470 response, ok := out.RawResponse.(*smithyhttp.Response) 471 if !ok { 472 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 473 } 474 475 if response.StatusCode < 200 || response.StatusCode >= 300 { 476 return out, metadata, awsRestjson1_deserializeOpErrorStartDeviceAuthorization(response, &metadata) 477 } 478 output := &StartDeviceAuthorizationOutput{} 479 out.Result = output 480 481 var buff [1024]byte 482 ringBuffer := smithyio.NewRingBuffer(buff[:]) 483 484 body := io.TeeReader(response.Body, ringBuffer) 485 486 decoder := json.NewDecoder(body) 487 decoder.UseNumber() 488 var shape interface{} 489 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 490 var snapshot bytes.Buffer 491 io.Copy(&snapshot, ringBuffer) 492 err = &smithy.DeserializationError{ 493 Err: fmt.Errorf("failed to decode response body, %w", err), 494 Snapshot: snapshot.Bytes(), 495 } 496 return out, metadata, err 497 } 498 499 err = awsRestjson1_deserializeOpDocumentStartDeviceAuthorizationOutput(&output, shape) 500 if err != nil { 501 var snapshot bytes.Buffer 502 io.Copy(&snapshot, ringBuffer) 503 return out, metadata, &smithy.DeserializationError{ 504 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 505 Snapshot: snapshot.Bytes(), 506 } 507 } 508 509 return out, metadata, err 510 } 511 512 func awsRestjson1_deserializeOpErrorStartDeviceAuthorization(response *smithyhttp.Response, metadata *middleware.Metadata) error { 513 var errorBuffer bytes.Buffer 514 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 515 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 516 } 517 errorBody := bytes.NewReader(errorBuffer.Bytes()) 518 519 errorCode := "UnknownError" 520 errorMessage := errorCode 521 522 code := response.Header.Get("X-Amzn-ErrorType") 523 if len(code) != 0 { 524 errorCode = restjson.SanitizeErrorCode(code) 525 } 526 527 var buff [1024]byte 528 ringBuffer := smithyio.NewRingBuffer(buff[:]) 529 530 body := io.TeeReader(errorBody, ringBuffer) 531 decoder := json.NewDecoder(body) 532 decoder.UseNumber() 533 code, message, err := restjson.GetErrorInfo(decoder) 534 if err != nil { 535 var snapshot bytes.Buffer 536 io.Copy(&snapshot, ringBuffer) 537 err = &smithy.DeserializationError{ 538 Err: fmt.Errorf("failed to decode response body, %w", err), 539 Snapshot: snapshot.Bytes(), 540 } 541 return err 542 } 543 544 errorBody.Seek(0, io.SeekStart) 545 if len(code) != 0 { 546 errorCode = restjson.SanitizeErrorCode(code) 547 } 548 if len(message) != 0 { 549 errorMessage = message 550 } 551 552 switch { 553 case strings.EqualFold("InternalServerException", errorCode): 554 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 555 556 case strings.EqualFold("InvalidClientException", errorCode): 557 return awsRestjson1_deserializeErrorInvalidClientException(response, errorBody) 558 559 case strings.EqualFold("InvalidRequestException", errorCode): 560 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 561 562 case strings.EqualFold("SlowDownException", errorCode): 563 return awsRestjson1_deserializeErrorSlowDownException(response, errorBody) 564 565 case strings.EqualFold("UnauthorizedClientException", errorCode): 566 return awsRestjson1_deserializeErrorUnauthorizedClientException(response, errorBody) 567 568 default: 569 genericError := &smithy.GenericAPIError{ 570 Code: errorCode, 571 Message: errorMessage, 572 } 573 return genericError 574 575 } 576 } 577 578 func awsRestjson1_deserializeOpDocumentStartDeviceAuthorizationOutput(v **StartDeviceAuthorizationOutput, value interface{}) error { 579 if v == nil { 580 return fmt.Errorf("unexpected nil of type %T", v) 581 } 582 if value == nil { 583 return nil 584 } 585 586 shape, ok := value.(map[string]interface{}) 587 if !ok { 588 return fmt.Errorf("unexpected JSON type %v", value) 589 } 590 591 var sv *StartDeviceAuthorizationOutput 592 if *v == nil { 593 sv = &StartDeviceAuthorizationOutput{} 594 } else { 595 sv = *v 596 } 597 598 for key, value := range shape { 599 switch key { 600 case "deviceCode": 601 if value != nil { 602 jtv, ok := value.(string) 603 if !ok { 604 return fmt.Errorf("expected DeviceCode to be of type string, got %T instead", value) 605 } 606 sv.DeviceCode = ptr.String(jtv) 607 } 608 609 case "expiresIn": 610 if value != nil { 611 jtv, ok := value.(json.Number) 612 if !ok { 613 return fmt.Errorf("expected ExpirationInSeconds to be json.Number, got %T instead", value) 614 } 615 i64, err := jtv.Int64() 616 if err != nil { 617 return err 618 } 619 sv.ExpiresIn = int32(i64) 620 } 621 622 case "interval": 623 if value != nil { 624 jtv, ok := value.(json.Number) 625 if !ok { 626 return fmt.Errorf("expected IntervalInSeconds to be json.Number, got %T instead", value) 627 } 628 i64, err := jtv.Int64() 629 if err != nil { 630 return err 631 } 632 sv.Interval = int32(i64) 633 } 634 635 case "userCode": 636 if value != nil { 637 jtv, ok := value.(string) 638 if !ok { 639 return fmt.Errorf("expected UserCode to be of type string, got %T instead", value) 640 } 641 sv.UserCode = ptr.String(jtv) 642 } 643 644 case "verificationUri": 645 if value != nil { 646 jtv, ok := value.(string) 647 if !ok { 648 return fmt.Errorf("expected URI to be of type string, got %T instead", value) 649 } 650 sv.VerificationUri = ptr.String(jtv) 651 } 652 653 case "verificationUriComplete": 654 if value != nil { 655 jtv, ok := value.(string) 656 if !ok { 657 return fmt.Errorf("expected URI to be of type string, got %T instead", value) 658 } 659 sv.VerificationUriComplete = ptr.String(jtv) 660 } 661 662 default: 663 _, _ = key, value 664 665 } 666 } 667 *v = sv 668 return nil 669 } 670 671 func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 672 output := &types.AccessDeniedException{} 673 var buff [1024]byte 674 ringBuffer := smithyio.NewRingBuffer(buff[:]) 675 676 body := io.TeeReader(errorBody, ringBuffer) 677 decoder := json.NewDecoder(body) 678 decoder.UseNumber() 679 var shape interface{} 680 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 681 var snapshot bytes.Buffer 682 io.Copy(&snapshot, ringBuffer) 683 err = &smithy.DeserializationError{ 684 Err: fmt.Errorf("failed to decode response body, %w", err), 685 Snapshot: snapshot.Bytes(), 686 } 687 return err 688 } 689 690 err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) 691 692 if err != nil { 693 var snapshot bytes.Buffer 694 io.Copy(&snapshot, ringBuffer) 695 err = &smithy.DeserializationError{ 696 Err: fmt.Errorf("failed to decode response body, %w", err), 697 Snapshot: snapshot.Bytes(), 698 } 699 return err 700 } 701 702 errorBody.Seek(0, io.SeekStart) 703 704 return output 705 } 706 707 func awsRestjson1_deserializeErrorAuthorizationPendingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 708 output := &types.AuthorizationPendingException{} 709 var buff [1024]byte 710 ringBuffer := smithyio.NewRingBuffer(buff[:]) 711 712 body := io.TeeReader(errorBody, ringBuffer) 713 decoder := json.NewDecoder(body) 714 decoder.UseNumber() 715 var shape interface{} 716 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 717 var snapshot bytes.Buffer 718 io.Copy(&snapshot, ringBuffer) 719 err = &smithy.DeserializationError{ 720 Err: fmt.Errorf("failed to decode response body, %w", err), 721 Snapshot: snapshot.Bytes(), 722 } 723 return err 724 } 725 726 err := awsRestjson1_deserializeDocumentAuthorizationPendingException(&output, shape) 727 728 if err != nil { 729 var snapshot bytes.Buffer 730 io.Copy(&snapshot, ringBuffer) 731 err = &smithy.DeserializationError{ 732 Err: fmt.Errorf("failed to decode response body, %w", err), 733 Snapshot: snapshot.Bytes(), 734 } 735 return err 736 } 737 738 errorBody.Seek(0, io.SeekStart) 739 740 return output 741 } 742 743 func awsRestjson1_deserializeErrorExpiredTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 744 output := &types.ExpiredTokenException{} 745 var buff [1024]byte 746 ringBuffer := smithyio.NewRingBuffer(buff[:]) 747 748 body := io.TeeReader(errorBody, ringBuffer) 749 decoder := json.NewDecoder(body) 750 decoder.UseNumber() 751 var shape interface{} 752 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 753 var snapshot bytes.Buffer 754 io.Copy(&snapshot, ringBuffer) 755 err = &smithy.DeserializationError{ 756 Err: fmt.Errorf("failed to decode response body, %w", err), 757 Snapshot: snapshot.Bytes(), 758 } 759 return err 760 } 761 762 err := awsRestjson1_deserializeDocumentExpiredTokenException(&output, shape) 763 764 if err != nil { 765 var snapshot bytes.Buffer 766 io.Copy(&snapshot, ringBuffer) 767 err = &smithy.DeserializationError{ 768 Err: fmt.Errorf("failed to decode response body, %w", err), 769 Snapshot: snapshot.Bytes(), 770 } 771 return err 772 } 773 774 errorBody.Seek(0, io.SeekStart) 775 776 return output 777 } 778 779 func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 780 output := &types.InternalServerException{} 781 var buff [1024]byte 782 ringBuffer := smithyio.NewRingBuffer(buff[:]) 783 784 body := io.TeeReader(errorBody, ringBuffer) 785 decoder := json.NewDecoder(body) 786 decoder.UseNumber() 787 var shape interface{} 788 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 789 var snapshot bytes.Buffer 790 io.Copy(&snapshot, ringBuffer) 791 err = &smithy.DeserializationError{ 792 Err: fmt.Errorf("failed to decode response body, %w", err), 793 Snapshot: snapshot.Bytes(), 794 } 795 return err 796 } 797 798 err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) 799 800 if err != nil { 801 var snapshot bytes.Buffer 802 io.Copy(&snapshot, ringBuffer) 803 err = &smithy.DeserializationError{ 804 Err: fmt.Errorf("failed to decode response body, %w", err), 805 Snapshot: snapshot.Bytes(), 806 } 807 return err 808 } 809 810 errorBody.Seek(0, io.SeekStart) 811 812 return output 813 } 814 815 func awsRestjson1_deserializeErrorInvalidClientException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 816 output := &types.InvalidClientException{} 817 var buff [1024]byte 818 ringBuffer := smithyio.NewRingBuffer(buff[:]) 819 820 body := io.TeeReader(errorBody, ringBuffer) 821 decoder := json.NewDecoder(body) 822 decoder.UseNumber() 823 var shape interface{} 824 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 825 var snapshot bytes.Buffer 826 io.Copy(&snapshot, ringBuffer) 827 err = &smithy.DeserializationError{ 828 Err: fmt.Errorf("failed to decode response body, %w", err), 829 Snapshot: snapshot.Bytes(), 830 } 831 return err 832 } 833 834 err := awsRestjson1_deserializeDocumentInvalidClientException(&output, shape) 835 836 if err != nil { 837 var snapshot bytes.Buffer 838 io.Copy(&snapshot, ringBuffer) 839 err = &smithy.DeserializationError{ 840 Err: fmt.Errorf("failed to decode response body, %w", err), 841 Snapshot: snapshot.Bytes(), 842 } 843 return err 844 } 845 846 errorBody.Seek(0, io.SeekStart) 847 848 return output 849 } 850 851 func awsRestjson1_deserializeErrorInvalidClientMetadataException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 852 output := &types.InvalidClientMetadataException{} 853 var buff [1024]byte 854 ringBuffer := smithyio.NewRingBuffer(buff[:]) 855 856 body := io.TeeReader(errorBody, ringBuffer) 857 decoder := json.NewDecoder(body) 858 decoder.UseNumber() 859 var shape interface{} 860 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 861 var snapshot bytes.Buffer 862 io.Copy(&snapshot, ringBuffer) 863 err = &smithy.DeserializationError{ 864 Err: fmt.Errorf("failed to decode response body, %w", err), 865 Snapshot: snapshot.Bytes(), 866 } 867 return err 868 } 869 870 err := awsRestjson1_deserializeDocumentInvalidClientMetadataException(&output, shape) 871 872 if err != nil { 873 var snapshot bytes.Buffer 874 io.Copy(&snapshot, ringBuffer) 875 err = &smithy.DeserializationError{ 876 Err: fmt.Errorf("failed to decode response body, %w", err), 877 Snapshot: snapshot.Bytes(), 878 } 879 return err 880 } 881 882 errorBody.Seek(0, io.SeekStart) 883 884 return output 885 } 886 887 func awsRestjson1_deserializeErrorInvalidGrantException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 888 output := &types.InvalidGrantException{} 889 var buff [1024]byte 890 ringBuffer := smithyio.NewRingBuffer(buff[:]) 891 892 body := io.TeeReader(errorBody, ringBuffer) 893 decoder := json.NewDecoder(body) 894 decoder.UseNumber() 895 var shape interface{} 896 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 897 var snapshot bytes.Buffer 898 io.Copy(&snapshot, ringBuffer) 899 err = &smithy.DeserializationError{ 900 Err: fmt.Errorf("failed to decode response body, %w", err), 901 Snapshot: snapshot.Bytes(), 902 } 903 return err 904 } 905 906 err := awsRestjson1_deserializeDocumentInvalidGrantException(&output, shape) 907 908 if err != nil { 909 var snapshot bytes.Buffer 910 io.Copy(&snapshot, ringBuffer) 911 err = &smithy.DeserializationError{ 912 Err: fmt.Errorf("failed to decode response body, %w", err), 913 Snapshot: snapshot.Bytes(), 914 } 915 return err 916 } 917 918 errorBody.Seek(0, io.SeekStart) 919 920 return output 921 } 922 923 func awsRestjson1_deserializeErrorInvalidRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 924 output := &types.InvalidRequestException{} 925 var buff [1024]byte 926 ringBuffer := smithyio.NewRingBuffer(buff[:]) 927 928 body := io.TeeReader(errorBody, ringBuffer) 929 decoder := json.NewDecoder(body) 930 decoder.UseNumber() 931 var shape interface{} 932 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 933 var snapshot bytes.Buffer 934 io.Copy(&snapshot, ringBuffer) 935 err = &smithy.DeserializationError{ 936 Err: fmt.Errorf("failed to decode response body, %w", err), 937 Snapshot: snapshot.Bytes(), 938 } 939 return err 940 } 941 942 err := awsRestjson1_deserializeDocumentInvalidRequestException(&output, shape) 943 944 if err != nil { 945 var snapshot bytes.Buffer 946 io.Copy(&snapshot, ringBuffer) 947 err = &smithy.DeserializationError{ 948 Err: fmt.Errorf("failed to decode response body, %w", err), 949 Snapshot: snapshot.Bytes(), 950 } 951 return err 952 } 953 954 errorBody.Seek(0, io.SeekStart) 955 956 return output 957 } 958 959 func awsRestjson1_deserializeErrorInvalidScopeException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 960 output := &types.InvalidScopeException{} 961 var buff [1024]byte 962 ringBuffer := smithyio.NewRingBuffer(buff[:]) 963 964 body := io.TeeReader(errorBody, ringBuffer) 965 decoder := json.NewDecoder(body) 966 decoder.UseNumber() 967 var shape interface{} 968 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 969 var snapshot bytes.Buffer 970 io.Copy(&snapshot, ringBuffer) 971 err = &smithy.DeserializationError{ 972 Err: fmt.Errorf("failed to decode response body, %w", err), 973 Snapshot: snapshot.Bytes(), 974 } 975 return err 976 } 977 978 err := awsRestjson1_deserializeDocumentInvalidScopeException(&output, shape) 979 980 if err != nil { 981 var snapshot bytes.Buffer 982 io.Copy(&snapshot, ringBuffer) 983 err = &smithy.DeserializationError{ 984 Err: fmt.Errorf("failed to decode response body, %w", err), 985 Snapshot: snapshot.Bytes(), 986 } 987 return err 988 } 989 990 errorBody.Seek(0, io.SeekStart) 991 992 return output 993 } 994 995 func awsRestjson1_deserializeErrorSlowDownException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 996 output := &types.SlowDownException{} 997 var buff [1024]byte 998 ringBuffer := smithyio.NewRingBuffer(buff[:]) 999 1000 body := io.TeeReader(errorBody, ringBuffer) 1001 decoder := json.NewDecoder(body) 1002 decoder.UseNumber() 1003 var shape interface{} 1004 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1005 var snapshot bytes.Buffer 1006 io.Copy(&snapshot, ringBuffer) 1007 err = &smithy.DeserializationError{ 1008 Err: fmt.Errorf("failed to decode response body, %w", err), 1009 Snapshot: snapshot.Bytes(), 1010 } 1011 return err 1012 } 1013 1014 err := awsRestjson1_deserializeDocumentSlowDownException(&output, shape) 1015 1016 if err != nil { 1017 var snapshot bytes.Buffer 1018 io.Copy(&snapshot, ringBuffer) 1019 err = &smithy.DeserializationError{ 1020 Err: fmt.Errorf("failed to decode response body, %w", err), 1021 Snapshot: snapshot.Bytes(), 1022 } 1023 return err 1024 } 1025 1026 errorBody.Seek(0, io.SeekStart) 1027 1028 return output 1029 } 1030 1031 func awsRestjson1_deserializeErrorUnauthorizedClientException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 1032 output := &types.UnauthorizedClientException{} 1033 var buff [1024]byte 1034 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1035 1036 body := io.TeeReader(errorBody, ringBuffer) 1037 decoder := json.NewDecoder(body) 1038 decoder.UseNumber() 1039 var shape interface{} 1040 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1041 var snapshot bytes.Buffer 1042 io.Copy(&snapshot, ringBuffer) 1043 err = &smithy.DeserializationError{ 1044 Err: fmt.Errorf("failed to decode response body, %w", err), 1045 Snapshot: snapshot.Bytes(), 1046 } 1047 return err 1048 } 1049 1050 err := awsRestjson1_deserializeDocumentUnauthorizedClientException(&output, shape) 1051 1052 if err != nil { 1053 var snapshot bytes.Buffer 1054 io.Copy(&snapshot, ringBuffer) 1055 err = &smithy.DeserializationError{ 1056 Err: fmt.Errorf("failed to decode response body, %w", err), 1057 Snapshot: snapshot.Bytes(), 1058 } 1059 return err 1060 } 1061 1062 errorBody.Seek(0, io.SeekStart) 1063 1064 return output 1065 } 1066 1067 func awsRestjson1_deserializeErrorUnsupportedGrantTypeException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 1068 output := &types.UnsupportedGrantTypeException{} 1069 var buff [1024]byte 1070 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1071 1072 body := io.TeeReader(errorBody, ringBuffer) 1073 decoder := json.NewDecoder(body) 1074 decoder.UseNumber() 1075 var shape interface{} 1076 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1077 var snapshot bytes.Buffer 1078 io.Copy(&snapshot, ringBuffer) 1079 err = &smithy.DeserializationError{ 1080 Err: fmt.Errorf("failed to decode response body, %w", err), 1081 Snapshot: snapshot.Bytes(), 1082 } 1083 return err 1084 } 1085 1086 err := awsRestjson1_deserializeDocumentUnsupportedGrantTypeException(&output, shape) 1087 1088 if err != nil { 1089 var snapshot bytes.Buffer 1090 io.Copy(&snapshot, ringBuffer) 1091 err = &smithy.DeserializationError{ 1092 Err: fmt.Errorf("failed to decode response body, %w", err), 1093 Snapshot: snapshot.Bytes(), 1094 } 1095 return err 1096 } 1097 1098 errorBody.Seek(0, io.SeekStart) 1099 1100 return output 1101 } 1102 1103 func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { 1104 if v == nil { 1105 return fmt.Errorf("unexpected nil of type %T", v) 1106 } 1107 if value == nil { 1108 return nil 1109 } 1110 1111 shape, ok := value.(map[string]interface{}) 1112 if !ok { 1113 return fmt.Errorf("unexpected JSON type %v", value) 1114 } 1115 1116 var sv *types.AccessDeniedException 1117 if *v == nil { 1118 sv = &types.AccessDeniedException{} 1119 } else { 1120 sv = *v 1121 } 1122 1123 for key, value := range shape { 1124 switch key { 1125 case "error": 1126 if value != nil { 1127 jtv, ok := value.(string) 1128 if !ok { 1129 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1130 } 1131 sv.Error_ = ptr.String(jtv) 1132 } 1133 1134 case "error_description": 1135 if value != nil { 1136 jtv, ok := value.(string) 1137 if !ok { 1138 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1139 } 1140 sv.Error_description = ptr.String(jtv) 1141 } 1142 1143 default: 1144 _, _ = key, value 1145 1146 } 1147 } 1148 *v = sv 1149 return nil 1150 } 1151 1152 func awsRestjson1_deserializeDocumentAuthorizationPendingException(v **types.AuthorizationPendingException, value interface{}) error { 1153 if v == nil { 1154 return fmt.Errorf("unexpected nil of type %T", v) 1155 } 1156 if value == nil { 1157 return nil 1158 } 1159 1160 shape, ok := value.(map[string]interface{}) 1161 if !ok { 1162 return fmt.Errorf("unexpected JSON type %v", value) 1163 } 1164 1165 var sv *types.AuthorizationPendingException 1166 if *v == nil { 1167 sv = &types.AuthorizationPendingException{} 1168 } else { 1169 sv = *v 1170 } 1171 1172 for key, value := range shape { 1173 switch key { 1174 case "error": 1175 if value != nil { 1176 jtv, ok := value.(string) 1177 if !ok { 1178 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1179 } 1180 sv.Error_ = ptr.String(jtv) 1181 } 1182 1183 case "error_description": 1184 if value != nil { 1185 jtv, ok := value.(string) 1186 if !ok { 1187 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1188 } 1189 sv.Error_description = ptr.String(jtv) 1190 } 1191 1192 default: 1193 _, _ = key, value 1194 1195 } 1196 } 1197 *v = sv 1198 return nil 1199 } 1200 1201 func awsRestjson1_deserializeDocumentExpiredTokenException(v **types.ExpiredTokenException, value interface{}) error { 1202 if v == nil { 1203 return fmt.Errorf("unexpected nil of type %T", v) 1204 } 1205 if value == nil { 1206 return nil 1207 } 1208 1209 shape, ok := value.(map[string]interface{}) 1210 if !ok { 1211 return fmt.Errorf("unexpected JSON type %v", value) 1212 } 1213 1214 var sv *types.ExpiredTokenException 1215 if *v == nil { 1216 sv = &types.ExpiredTokenException{} 1217 } else { 1218 sv = *v 1219 } 1220 1221 for key, value := range shape { 1222 switch key { 1223 case "error": 1224 if value != nil { 1225 jtv, ok := value.(string) 1226 if !ok { 1227 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1228 } 1229 sv.Error_ = ptr.String(jtv) 1230 } 1231 1232 case "error_description": 1233 if value != nil { 1234 jtv, ok := value.(string) 1235 if !ok { 1236 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1237 } 1238 sv.Error_description = ptr.String(jtv) 1239 } 1240 1241 default: 1242 _, _ = key, value 1243 1244 } 1245 } 1246 *v = sv 1247 return nil 1248 } 1249 1250 func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { 1251 if v == nil { 1252 return fmt.Errorf("unexpected nil of type %T", v) 1253 } 1254 if value == nil { 1255 return nil 1256 } 1257 1258 shape, ok := value.(map[string]interface{}) 1259 if !ok { 1260 return fmt.Errorf("unexpected JSON type %v", value) 1261 } 1262 1263 var sv *types.InternalServerException 1264 if *v == nil { 1265 sv = &types.InternalServerException{} 1266 } else { 1267 sv = *v 1268 } 1269 1270 for key, value := range shape { 1271 switch key { 1272 case "error": 1273 if value != nil { 1274 jtv, ok := value.(string) 1275 if !ok { 1276 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1277 } 1278 sv.Error_ = ptr.String(jtv) 1279 } 1280 1281 case "error_description": 1282 if value != nil { 1283 jtv, ok := value.(string) 1284 if !ok { 1285 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1286 } 1287 sv.Error_description = ptr.String(jtv) 1288 } 1289 1290 default: 1291 _, _ = key, value 1292 1293 } 1294 } 1295 *v = sv 1296 return nil 1297 } 1298 1299 func awsRestjson1_deserializeDocumentInvalidClientException(v **types.InvalidClientException, value interface{}) error { 1300 if v == nil { 1301 return fmt.Errorf("unexpected nil of type %T", v) 1302 } 1303 if value == nil { 1304 return nil 1305 } 1306 1307 shape, ok := value.(map[string]interface{}) 1308 if !ok { 1309 return fmt.Errorf("unexpected JSON type %v", value) 1310 } 1311 1312 var sv *types.InvalidClientException 1313 if *v == nil { 1314 sv = &types.InvalidClientException{} 1315 } else { 1316 sv = *v 1317 } 1318 1319 for key, value := range shape { 1320 switch key { 1321 case "error": 1322 if value != nil { 1323 jtv, ok := value.(string) 1324 if !ok { 1325 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1326 } 1327 sv.Error_ = ptr.String(jtv) 1328 } 1329 1330 case "error_description": 1331 if value != nil { 1332 jtv, ok := value.(string) 1333 if !ok { 1334 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1335 } 1336 sv.Error_description = ptr.String(jtv) 1337 } 1338 1339 default: 1340 _, _ = key, value 1341 1342 } 1343 } 1344 *v = sv 1345 return nil 1346 } 1347 1348 func awsRestjson1_deserializeDocumentInvalidClientMetadataException(v **types.InvalidClientMetadataException, value interface{}) error { 1349 if v == nil { 1350 return fmt.Errorf("unexpected nil of type %T", v) 1351 } 1352 if value == nil { 1353 return nil 1354 } 1355 1356 shape, ok := value.(map[string]interface{}) 1357 if !ok { 1358 return fmt.Errorf("unexpected JSON type %v", value) 1359 } 1360 1361 var sv *types.InvalidClientMetadataException 1362 if *v == nil { 1363 sv = &types.InvalidClientMetadataException{} 1364 } else { 1365 sv = *v 1366 } 1367 1368 for key, value := range shape { 1369 switch key { 1370 case "error": 1371 if value != nil { 1372 jtv, ok := value.(string) 1373 if !ok { 1374 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1375 } 1376 sv.Error_ = ptr.String(jtv) 1377 } 1378 1379 case "error_description": 1380 if value != nil { 1381 jtv, ok := value.(string) 1382 if !ok { 1383 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1384 } 1385 sv.Error_description = ptr.String(jtv) 1386 } 1387 1388 default: 1389 _, _ = key, value 1390 1391 } 1392 } 1393 *v = sv 1394 return nil 1395 } 1396 1397 func awsRestjson1_deserializeDocumentInvalidGrantException(v **types.InvalidGrantException, value interface{}) error { 1398 if v == nil { 1399 return fmt.Errorf("unexpected nil of type %T", v) 1400 } 1401 if value == nil { 1402 return nil 1403 } 1404 1405 shape, ok := value.(map[string]interface{}) 1406 if !ok { 1407 return fmt.Errorf("unexpected JSON type %v", value) 1408 } 1409 1410 var sv *types.InvalidGrantException 1411 if *v == nil { 1412 sv = &types.InvalidGrantException{} 1413 } else { 1414 sv = *v 1415 } 1416 1417 for key, value := range shape { 1418 switch key { 1419 case "error": 1420 if value != nil { 1421 jtv, ok := value.(string) 1422 if !ok { 1423 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1424 } 1425 sv.Error_ = ptr.String(jtv) 1426 } 1427 1428 case "error_description": 1429 if value != nil { 1430 jtv, ok := value.(string) 1431 if !ok { 1432 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1433 } 1434 sv.Error_description = ptr.String(jtv) 1435 } 1436 1437 default: 1438 _, _ = key, value 1439 1440 } 1441 } 1442 *v = sv 1443 return nil 1444 } 1445 1446 func awsRestjson1_deserializeDocumentInvalidRequestException(v **types.InvalidRequestException, value interface{}) error { 1447 if v == nil { 1448 return fmt.Errorf("unexpected nil of type %T", v) 1449 } 1450 if value == nil { 1451 return nil 1452 } 1453 1454 shape, ok := value.(map[string]interface{}) 1455 if !ok { 1456 return fmt.Errorf("unexpected JSON type %v", value) 1457 } 1458 1459 var sv *types.InvalidRequestException 1460 if *v == nil { 1461 sv = &types.InvalidRequestException{} 1462 } else { 1463 sv = *v 1464 } 1465 1466 for key, value := range shape { 1467 switch key { 1468 case "error": 1469 if value != nil { 1470 jtv, ok := value.(string) 1471 if !ok { 1472 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1473 } 1474 sv.Error_ = ptr.String(jtv) 1475 } 1476 1477 case "error_description": 1478 if value != nil { 1479 jtv, ok := value.(string) 1480 if !ok { 1481 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1482 } 1483 sv.Error_description = ptr.String(jtv) 1484 } 1485 1486 default: 1487 _, _ = key, value 1488 1489 } 1490 } 1491 *v = sv 1492 return nil 1493 } 1494 1495 func awsRestjson1_deserializeDocumentInvalidScopeException(v **types.InvalidScopeException, value interface{}) error { 1496 if v == nil { 1497 return fmt.Errorf("unexpected nil of type %T", v) 1498 } 1499 if value == nil { 1500 return nil 1501 } 1502 1503 shape, ok := value.(map[string]interface{}) 1504 if !ok { 1505 return fmt.Errorf("unexpected JSON type %v", value) 1506 } 1507 1508 var sv *types.InvalidScopeException 1509 if *v == nil { 1510 sv = &types.InvalidScopeException{} 1511 } else { 1512 sv = *v 1513 } 1514 1515 for key, value := range shape { 1516 switch key { 1517 case "error": 1518 if value != nil { 1519 jtv, ok := value.(string) 1520 if !ok { 1521 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1522 } 1523 sv.Error_ = ptr.String(jtv) 1524 } 1525 1526 case "error_description": 1527 if value != nil { 1528 jtv, ok := value.(string) 1529 if !ok { 1530 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1531 } 1532 sv.Error_description = ptr.String(jtv) 1533 } 1534 1535 default: 1536 _, _ = key, value 1537 1538 } 1539 } 1540 *v = sv 1541 return nil 1542 } 1543 1544 func awsRestjson1_deserializeDocumentSlowDownException(v **types.SlowDownException, value interface{}) error { 1545 if v == nil { 1546 return fmt.Errorf("unexpected nil of type %T", v) 1547 } 1548 if value == nil { 1549 return nil 1550 } 1551 1552 shape, ok := value.(map[string]interface{}) 1553 if !ok { 1554 return fmt.Errorf("unexpected JSON type %v", value) 1555 } 1556 1557 var sv *types.SlowDownException 1558 if *v == nil { 1559 sv = &types.SlowDownException{} 1560 } else { 1561 sv = *v 1562 } 1563 1564 for key, value := range shape { 1565 switch key { 1566 case "error": 1567 if value != nil { 1568 jtv, ok := value.(string) 1569 if !ok { 1570 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1571 } 1572 sv.Error_ = ptr.String(jtv) 1573 } 1574 1575 case "error_description": 1576 if value != nil { 1577 jtv, ok := value.(string) 1578 if !ok { 1579 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1580 } 1581 sv.Error_description = ptr.String(jtv) 1582 } 1583 1584 default: 1585 _, _ = key, value 1586 1587 } 1588 } 1589 *v = sv 1590 return nil 1591 } 1592 1593 func awsRestjson1_deserializeDocumentUnauthorizedClientException(v **types.UnauthorizedClientException, value interface{}) error { 1594 if v == nil { 1595 return fmt.Errorf("unexpected nil of type %T", v) 1596 } 1597 if value == nil { 1598 return nil 1599 } 1600 1601 shape, ok := value.(map[string]interface{}) 1602 if !ok { 1603 return fmt.Errorf("unexpected JSON type %v", value) 1604 } 1605 1606 var sv *types.UnauthorizedClientException 1607 if *v == nil { 1608 sv = &types.UnauthorizedClientException{} 1609 } else { 1610 sv = *v 1611 } 1612 1613 for key, value := range shape { 1614 switch key { 1615 case "error": 1616 if value != nil { 1617 jtv, ok := value.(string) 1618 if !ok { 1619 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1620 } 1621 sv.Error_ = ptr.String(jtv) 1622 } 1623 1624 case "error_description": 1625 if value != nil { 1626 jtv, ok := value.(string) 1627 if !ok { 1628 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1629 } 1630 sv.Error_description = ptr.String(jtv) 1631 } 1632 1633 default: 1634 _, _ = key, value 1635 1636 } 1637 } 1638 *v = sv 1639 return nil 1640 } 1641 1642 func awsRestjson1_deserializeDocumentUnsupportedGrantTypeException(v **types.UnsupportedGrantTypeException, value interface{}) error { 1643 if v == nil { 1644 return fmt.Errorf("unexpected nil of type %T", v) 1645 } 1646 if value == nil { 1647 return nil 1648 } 1649 1650 shape, ok := value.(map[string]interface{}) 1651 if !ok { 1652 return fmt.Errorf("unexpected JSON type %v", value) 1653 } 1654 1655 var sv *types.UnsupportedGrantTypeException 1656 if *v == nil { 1657 sv = &types.UnsupportedGrantTypeException{} 1658 } else { 1659 sv = *v 1660 } 1661 1662 for key, value := range shape { 1663 switch key { 1664 case "error": 1665 if value != nil { 1666 jtv, ok := value.(string) 1667 if !ok { 1668 return fmt.Errorf("expected Error to be of type string, got %T instead", value) 1669 } 1670 sv.Error_ = ptr.String(jtv) 1671 } 1672 1673 case "error_description": 1674 if value != nil { 1675 jtv, ok := value.(string) 1676 if !ok { 1677 return fmt.Errorf("expected ErrorDescription to be of type string, got %T instead", value) 1678 } 1679 sv.Error_description = ptr.String(jtv) 1680 } 1681 1682 default: 1683 _, _ = key, value 1684 1685 } 1686 } 1687 *v = sv 1688 return nil 1689 }