1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package amplifybackend 4 5import ( 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/amplifybackend/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 21type awsRestjson1_deserializeOpCloneBackend struct { 22} 23 24func (*awsRestjson1_deserializeOpCloneBackend) ID() string { 25 return "OperationDeserializer" 26} 27 28func (m *awsRestjson1_deserializeOpCloneBackend) 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_deserializeOpErrorCloneBackend(response, &metadata) 43 } 44 output := &CloneBackendOutput{} 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_deserializeOpDocumentCloneBackendOutput(&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 78func awsRestjson1_deserializeOpErrorCloneBackend(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("BadRequestException", errorCode): 120 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 121 122 case strings.EqualFold("GatewayTimeoutException", errorCode): 123 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 124 125 case strings.EqualFold("NotFoundException", errorCode): 126 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 127 128 case strings.EqualFold("TooManyRequestsException", errorCode): 129 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 130 131 default: 132 genericError := &smithy.GenericAPIError{ 133 Code: errorCode, 134 Message: errorMessage, 135 } 136 return genericError 137 138 } 139} 140 141func awsRestjson1_deserializeOpDocumentCloneBackendOutput(v **CloneBackendOutput, value interface{}) error { 142 if v == nil { 143 return fmt.Errorf("unexpected nil of type %T", v) 144 } 145 if value == nil { 146 return nil 147 } 148 149 shape, ok := value.(map[string]interface{}) 150 if !ok { 151 return fmt.Errorf("unexpected JSON type %v", value) 152 } 153 154 var sv *CloneBackendOutput 155 if *v == nil { 156 sv = &CloneBackendOutput{} 157 } else { 158 sv = *v 159 } 160 161 for key, value := range shape { 162 switch key { 163 case "appId": 164 if value != nil { 165 jtv, ok := value.(string) 166 if !ok { 167 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 168 } 169 sv.AppId = ptr.String(jtv) 170 } 171 172 case "backendEnvironmentName": 173 if value != nil { 174 jtv, ok := value.(string) 175 if !ok { 176 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 177 } 178 sv.BackendEnvironmentName = ptr.String(jtv) 179 } 180 181 case "error": 182 if value != nil { 183 jtv, ok := value.(string) 184 if !ok { 185 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 186 } 187 sv.Error = ptr.String(jtv) 188 } 189 190 case "jobId": 191 if value != nil { 192 jtv, ok := value.(string) 193 if !ok { 194 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 195 } 196 sv.JobId = ptr.String(jtv) 197 } 198 199 case "operation": 200 if value != nil { 201 jtv, ok := value.(string) 202 if !ok { 203 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 204 } 205 sv.Operation = ptr.String(jtv) 206 } 207 208 case "status": 209 if value != nil { 210 jtv, ok := value.(string) 211 if !ok { 212 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 213 } 214 sv.Status = ptr.String(jtv) 215 } 216 217 default: 218 _, _ = key, value 219 220 } 221 } 222 *v = sv 223 return nil 224} 225 226type awsRestjson1_deserializeOpCreateBackend struct { 227} 228 229func (*awsRestjson1_deserializeOpCreateBackend) ID() string { 230 return "OperationDeserializer" 231} 232 233func (m *awsRestjson1_deserializeOpCreateBackend) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 234 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 235) { 236 out, metadata, err = next.HandleDeserialize(ctx, in) 237 if err != nil { 238 return out, metadata, err 239 } 240 241 response, ok := out.RawResponse.(*smithyhttp.Response) 242 if !ok { 243 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 244 } 245 246 if response.StatusCode < 200 || response.StatusCode >= 300 { 247 return out, metadata, awsRestjson1_deserializeOpErrorCreateBackend(response, &metadata) 248 } 249 output := &CreateBackendOutput{} 250 out.Result = output 251 252 var buff [1024]byte 253 ringBuffer := smithyio.NewRingBuffer(buff[:]) 254 255 body := io.TeeReader(response.Body, ringBuffer) 256 257 decoder := json.NewDecoder(body) 258 decoder.UseNumber() 259 var shape interface{} 260 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 261 var snapshot bytes.Buffer 262 io.Copy(&snapshot, ringBuffer) 263 err = &smithy.DeserializationError{ 264 Err: fmt.Errorf("failed to decode response body, %w", err), 265 Snapshot: snapshot.Bytes(), 266 } 267 return out, metadata, err 268 } 269 270 err = awsRestjson1_deserializeOpDocumentCreateBackendOutput(&output, shape) 271 if err != nil { 272 var snapshot bytes.Buffer 273 io.Copy(&snapshot, ringBuffer) 274 return out, metadata, &smithy.DeserializationError{ 275 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 276 Snapshot: snapshot.Bytes(), 277 } 278 } 279 280 return out, metadata, err 281} 282 283func awsRestjson1_deserializeOpErrorCreateBackend(response *smithyhttp.Response, metadata *middleware.Metadata) error { 284 var errorBuffer bytes.Buffer 285 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 286 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 287 } 288 errorBody := bytes.NewReader(errorBuffer.Bytes()) 289 290 errorCode := "UnknownError" 291 errorMessage := errorCode 292 293 code := response.Header.Get("X-Amzn-ErrorType") 294 if len(code) != 0 { 295 errorCode = restjson.SanitizeErrorCode(code) 296 } 297 298 var buff [1024]byte 299 ringBuffer := smithyio.NewRingBuffer(buff[:]) 300 301 body := io.TeeReader(errorBody, ringBuffer) 302 decoder := json.NewDecoder(body) 303 decoder.UseNumber() 304 code, message, err := restjson.GetErrorInfo(decoder) 305 if err != nil { 306 var snapshot bytes.Buffer 307 io.Copy(&snapshot, ringBuffer) 308 err = &smithy.DeserializationError{ 309 Err: fmt.Errorf("failed to decode response body, %w", err), 310 Snapshot: snapshot.Bytes(), 311 } 312 return err 313 } 314 315 errorBody.Seek(0, io.SeekStart) 316 if len(code) != 0 { 317 errorCode = restjson.SanitizeErrorCode(code) 318 } 319 if len(message) != 0 { 320 errorMessage = message 321 } 322 323 switch { 324 case strings.EqualFold("BadRequestException", errorCode): 325 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 326 327 case strings.EqualFold("GatewayTimeoutException", errorCode): 328 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 329 330 case strings.EqualFold("NotFoundException", errorCode): 331 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 332 333 case strings.EqualFold("TooManyRequestsException", errorCode): 334 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 335 336 default: 337 genericError := &smithy.GenericAPIError{ 338 Code: errorCode, 339 Message: errorMessage, 340 } 341 return genericError 342 343 } 344} 345 346func awsRestjson1_deserializeOpDocumentCreateBackendOutput(v **CreateBackendOutput, value interface{}) error { 347 if v == nil { 348 return fmt.Errorf("unexpected nil of type %T", v) 349 } 350 if value == nil { 351 return nil 352 } 353 354 shape, ok := value.(map[string]interface{}) 355 if !ok { 356 return fmt.Errorf("unexpected JSON type %v", value) 357 } 358 359 var sv *CreateBackendOutput 360 if *v == nil { 361 sv = &CreateBackendOutput{} 362 } else { 363 sv = *v 364 } 365 366 for key, value := range shape { 367 switch key { 368 case "appId": 369 if value != nil { 370 jtv, ok := value.(string) 371 if !ok { 372 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 373 } 374 sv.AppId = ptr.String(jtv) 375 } 376 377 case "backendEnvironmentName": 378 if value != nil { 379 jtv, ok := value.(string) 380 if !ok { 381 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 382 } 383 sv.BackendEnvironmentName = ptr.String(jtv) 384 } 385 386 case "error": 387 if value != nil { 388 jtv, ok := value.(string) 389 if !ok { 390 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 391 } 392 sv.Error = ptr.String(jtv) 393 } 394 395 case "jobId": 396 if value != nil { 397 jtv, ok := value.(string) 398 if !ok { 399 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 400 } 401 sv.JobId = ptr.String(jtv) 402 } 403 404 case "operation": 405 if value != nil { 406 jtv, ok := value.(string) 407 if !ok { 408 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 409 } 410 sv.Operation = ptr.String(jtv) 411 } 412 413 case "status": 414 if value != nil { 415 jtv, ok := value.(string) 416 if !ok { 417 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 418 } 419 sv.Status = ptr.String(jtv) 420 } 421 422 default: 423 _, _ = key, value 424 425 } 426 } 427 *v = sv 428 return nil 429} 430 431type awsRestjson1_deserializeOpCreateBackendAPI struct { 432} 433 434func (*awsRestjson1_deserializeOpCreateBackendAPI) ID() string { 435 return "OperationDeserializer" 436} 437 438func (m *awsRestjson1_deserializeOpCreateBackendAPI) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 439 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 440) { 441 out, metadata, err = next.HandleDeserialize(ctx, in) 442 if err != nil { 443 return out, metadata, err 444 } 445 446 response, ok := out.RawResponse.(*smithyhttp.Response) 447 if !ok { 448 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 449 } 450 451 if response.StatusCode < 200 || response.StatusCode >= 300 { 452 return out, metadata, awsRestjson1_deserializeOpErrorCreateBackendAPI(response, &metadata) 453 } 454 output := &CreateBackendAPIOutput{} 455 out.Result = output 456 457 var buff [1024]byte 458 ringBuffer := smithyio.NewRingBuffer(buff[:]) 459 460 body := io.TeeReader(response.Body, ringBuffer) 461 462 decoder := json.NewDecoder(body) 463 decoder.UseNumber() 464 var shape interface{} 465 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 466 var snapshot bytes.Buffer 467 io.Copy(&snapshot, ringBuffer) 468 err = &smithy.DeserializationError{ 469 Err: fmt.Errorf("failed to decode response body, %w", err), 470 Snapshot: snapshot.Bytes(), 471 } 472 return out, metadata, err 473 } 474 475 err = awsRestjson1_deserializeOpDocumentCreateBackendAPIOutput(&output, shape) 476 if err != nil { 477 var snapshot bytes.Buffer 478 io.Copy(&snapshot, ringBuffer) 479 return out, metadata, &smithy.DeserializationError{ 480 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 481 Snapshot: snapshot.Bytes(), 482 } 483 } 484 485 return out, metadata, err 486} 487 488func awsRestjson1_deserializeOpErrorCreateBackendAPI(response *smithyhttp.Response, metadata *middleware.Metadata) error { 489 var errorBuffer bytes.Buffer 490 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 491 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 492 } 493 errorBody := bytes.NewReader(errorBuffer.Bytes()) 494 495 errorCode := "UnknownError" 496 errorMessage := errorCode 497 498 code := response.Header.Get("X-Amzn-ErrorType") 499 if len(code) != 0 { 500 errorCode = restjson.SanitizeErrorCode(code) 501 } 502 503 var buff [1024]byte 504 ringBuffer := smithyio.NewRingBuffer(buff[:]) 505 506 body := io.TeeReader(errorBody, ringBuffer) 507 decoder := json.NewDecoder(body) 508 decoder.UseNumber() 509 code, message, err := restjson.GetErrorInfo(decoder) 510 if err != nil { 511 var snapshot bytes.Buffer 512 io.Copy(&snapshot, ringBuffer) 513 err = &smithy.DeserializationError{ 514 Err: fmt.Errorf("failed to decode response body, %w", err), 515 Snapshot: snapshot.Bytes(), 516 } 517 return err 518 } 519 520 errorBody.Seek(0, io.SeekStart) 521 if len(code) != 0 { 522 errorCode = restjson.SanitizeErrorCode(code) 523 } 524 if len(message) != 0 { 525 errorMessage = message 526 } 527 528 switch { 529 case strings.EqualFold("BadRequestException", errorCode): 530 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 531 532 case strings.EqualFold("GatewayTimeoutException", errorCode): 533 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 534 535 case strings.EqualFold("NotFoundException", errorCode): 536 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 537 538 case strings.EqualFold("TooManyRequestsException", errorCode): 539 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 540 541 default: 542 genericError := &smithy.GenericAPIError{ 543 Code: errorCode, 544 Message: errorMessage, 545 } 546 return genericError 547 548 } 549} 550 551func awsRestjson1_deserializeOpDocumentCreateBackendAPIOutput(v **CreateBackendAPIOutput, value interface{}) error { 552 if v == nil { 553 return fmt.Errorf("unexpected nil of type %T", v) 554 } 555 if value == nil { 556 return nil 557 } 558 559 shape, ok := value.(map[string]interface{}) 560 if !ok { 561 return fmt.Errorf("unexpected JSON type %v", value) 562 } 563 564 var sv *CreateBackendAPIOutput 565 if *v == nil { 566 sv = &CreateBackendAPIOutput{} 567 } else { 568 sv = *v 569 } 570 571 for key, value := range shape { 572 switch key { 573 case "appId": 574 if value != nil { 575 jtv, ok := value.(string) 576 if !ok { 577 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 578 } 579 sv.AppId = ptr.String(jtv) 580 } 581 582 case "backendEnvironmentName": 583 if value != nil { 584 jtv, ok := value.(string) 585 if !ok { 586 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 587 } 588 sv.BackendEnvironmentName = ptr.String(jtv) 589 } 590 591 case "error": 592 if value != nil { 593 jtv, ok := value.(string) 594 if !ok { 595 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 596 } 597 sv.Error = ptr.String(jtv) 598 } 599 600 case "jobId": 601 if value != nil { 602 jtv, ok := value.(string) 603 if !ok { 604 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 605 } 606 sv.JobId = ptr.String(jtv) 607 } 608 609 case "operation": 610 if value != nil { 611 jtv, ok := value.(string) 612 if !ok { 613 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 614 } 615 sv.Operation = ptr.String(jtv) 616 } 617 618 case "status": 619 if value != nil { 620 jtv, ok := value.(string) 621 if !ok { 622 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 623 } 624 sv.Status = ptr.String(jtv) 625 } 626 627 default: 628 _, _ = key, value 629 630 } 631 } 632 *v = sv 633 return nil 634} 635 636type awsRestjson1_deserializeOpCreateBackendAuth struct { 637} 638 639func (*awsRestjson1_deserializeOpCreateBackendAuth) ID() string { 640 return "OperationDeserializer" 641} 642 643func (m *awsRestjson1_deserializeOpCreateBackendAuth) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 644 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 645) { 646 out, metadata, err = next.HandleDeserialize(ctx, in) 647 if err != nil { 648 return out, metadata, err 649 } 650 651 response, ok := out.RawResponse.(*smithyhttp.Response) 652 if !ok { 653 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 654 } 655 656 if response.StatusCode < 200 || response.StatusCode >= 300 { 657 return out, metadata, awsRestjson1_deserializeOpErrorCreateBackendAuth(response, &metadata) 658 } 659 output := &CreateBackendAuthOutput{} 660 out.Result = output 661 662 var buff [1024]byte 663 ringBuffer := smithyio.NewRingBuffer(buff[:]) 664 665 body := io.TeeReader(response.Body, ringBuffer) 666 667 decoder := json.NewDecoder(body) 668 decoder.UseNumber() 669 var shape interface{} 670 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 671 var snapshot bytes.Buffer 672 io.Copy(&snapshot, ringBuffer) 673 err = &smithy.DeserializationError{ 674 Err: fmt.Errorf("failed to decode response body, %w", err), 675 Snapshot: snapshot.Bytes(), 676 } 677 return out, metadata, err 678 } 679 680 err = awsRestjson1_deserializeOpDocumentCreateBackendAuthOutput(&output, shape) 681 if err != nil { 682 var snapshot bytes.Buffer 683 io.Copy(&snapshot, ringBuffer) 684 return out, metadata, &smithy.DeserializationError{ 685 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 686 Snapshot: snapshot.Bytes(), 687 } 688 } 689 690 return out, metadata, err 691} 692 693func awsRestjson1_deserializeOpErrorCreateBackendAuth(response *smithyhttp.Response, metadata *middleware.Metadata) error { 694 var errorBuffer bytes.Buffer 695 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 696 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 697 } 698 errorBody := bytes.NewReader(errorBuffer.Bytes()) 699 700 errorCode := "UnknownError" 701 errorMessage := errorCode 702 703 code := response.Header.Get("X-Amzn-ErrorType") 704 if len(code) != 0 { 705 errorCode = restjson.SanitizeErrorCode(code) 706 } 707 708 var buff [1024]byte 709 ringBuffer := smithyio.NewRingBuffer(buff[:]) 710 711 body := io.TeeReader(errorBody, ringBuffer) 712 decoder := json.NewDecoder(body) 713 decoder.UseNumber() 714 code, message, err := restjson.GetErrorInfo(decoder) 715 if err != nil { 716 var snapshot bytes.Buffer 717 io.Copy(&snapshot, ringBuffer) 718 err = &smithy.DeserializationError{ 719 Err: fmt.Errorf("failed to decode response body, %w", err), 720 Snapshot: snapshot.Bytes(), 721 } 722 return err 723 } 724 725 errorBody.Seek(0, io.SeekStart) 726 if len(code) != 0 { 727 errorCode = restjson.SanitizeErrorCode(code) 728 } 729 if len(message) != 0 { 730 errorMessage = message 731 } 732 733 switch { 734 case strings.EqualFold("BadRequestException", errorCode): 735 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 736 737 case strings.EqualFold("GatewayTimeoutException", errorCode): 738 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 739 740 case strings.EqualFold("NotFoundException", errorCode): 741 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 742 743 case strings.EqualFold("TooManyRequestsException", errorCode): 744 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 745 746 default: 747 genericError := &smithy.GenericAPIError{ 748 Code: errorCode, 749 Message: errorMessage, 750 } 751 return genericError 752 753 } 754} 755 756func awsRestjson1_deserializeOpDocumentCreateBackendAuthOutput(v **CreateBackendAuthOutput, value interface{}) error { 757 if v == nil { 758 return fmt.Errorf("unexpected nil of type %T", v) 759 } 760 if value == nil { 761 return nil 762 } 763 764 shape, ok := value.(map[string]interface{}) 765 if !ok { 766 return fmt.Errorf("unexpected JSON type %v", value) 767 } 768 769 var sv *CreateBackendAuthOutput 770 if *v == nil { 771 sv = &CreateBackendAuthOutput{} 772 } else { 773 sv = *v 774 } 775 776 for key, value := range shape { 777 switch key { 778 case "appId": 779 if value != nil { 780 jtv, ok := value.(string) 781 if !ok { 782 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 783 } 784 sv.AppId = ptr.String(jtv) 785 } 786 787 case "backendEnvironmentName": 788 if value != nil { 789 jtv, ok := value.(string) 790 if !ok { 791 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 792 } 793 sv.BackendEnvironmentName = ptr.String(jtv) 794 } 795 796 case "error": 797 if value != nil { 798 jtv, ok := value.(string) 799 if !ok { 800 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 801 } 802 sv.Error = ptr.String(jtv) 803 } 804 805 case "jobId": 806 if value != nil { 807 jtv, ok := value.(string) 808 if !ok { 809 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 810 } 811 sv.JobId = ptr.String(jtv) 812 } 813 814 case "operation": 815 if value != nil { 816 jtv, ok := value.(string) 817 if !ok { 818 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 819 } 820 sv.Operation = ptr.String(jtv) 821 } 822 823 case "status": 824 if value != nil { 825 jtv, ok := value.(string) 826 if !ok { 827 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 828 } 829 sv.Status = ptr.String(jtv) 830 } 831 832 default: 833 _, _ = key, value 834 835 } 836 } 837 *v = sv 838 return nil 839} 840 841type awsRestjson1_deserializeOpCreateBackendConfig struct { 842} 843 844func (*awsRestjson1_deserializeOpCreateBackendConfig) ID() string { 845 return "OperationDeserializer" 846} 847 848func (m *awsRestjson1_deserializeOpCreateBackendConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 849 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 850) { 851 out, metadata, err = next.HandleDeserialize(ctx, in) 852 if err != nil { 853 return out, metadata, err 854 } 855 856 response, ok := out.RawResponse.(*smithyhttp.Response) 857 if !ok { 858 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 859 } 860 861 if response.StatusCode < 200 || response.StatusCode >= 300 { 862 return out, metadata, awsRestjson1_deserializeOpErrorCreateBackendConfig(response, &metadata) 863 } 864 output := &CreateBackendConfigOutput{} 865 out.Result = output 866 867 var buff [1024]byte 868 ringBuffer := smithyio.NewRingBuffer(buff[:]) 869 870 body := io.TeeReader(response.Body, ringBuffer) 871 872 decoder := json.NewDecoder(body) 873 decoder.UseNumber() 874 var shape interface{} 875 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 876 var snapshot bytes.Buffer 877 io.Copy(&snapshot, ringBuffer) 878 err = &smithy.DeserializationError{ 879 Err: fmt.Errorf("failed to decode response body, %w", err), 880 Snapshot: snapshot.Bytes(), 881 } 882 return out, metadata, err 883 } 884 885 err = awsRestjson1_deserializeOpDocumentCreateBackendConfigOutput(&output, shape) 886 if err != nil { 887 var snapshot bytes.Buffer 888 io.Copy(&snapshot, ringBuffer) 889 return out, metadata, &smithy.DeserializationError{ 890 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 891 Snapshot: snapshot.Bytes(), 892 } 893 } 894 895 return out, metadata, err 896} 897 898func awsRestjson1_deserializeOpErrorCreateBackendConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 899 var errorBuffer bytes.Buffer 900 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 901 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 902 } 903 errorBody := bytes.NewReader(errorBuffer.Bytes()) 904 905 errorCode := "UnknownError" 906 errorMessage := errorCode 907 908 code := response.Header.Get("X-Amzn-ErrorType") 909 if len(code) != 0 { 910 errorCode = restjson.SanitizeErrorCode(code) 911 } 912 913 var buff [1024]byte 914 ringBuffer := smithyio.NewRingBuffer(buff[:]) 915 916 body := io.TeeReader(errorBody, ringBuffer) 917 decoder := json.NewDecoder(body) 918 decoder.UseNumber() 919 code, message, err := restjson.GetErrorInfo(decoder) 920 if err != nil { 921 var snapshot bytes.Buffer 922 io.Copy(&snapshot, ringBuffer) 923 err = &smithy.DeserializationError{ 924 Err: fmt.Errorf("failed to decode response body, %w", err), 925 Snapshot: snapshot.Bytes(), 926 } 927 return err 928 } 929 930 errorBody.Seek(0, io.SeekStart) 931 if len(code) != 0 { 932 errorCode = restjson.SanitizeErrorCode(code) 933 } 934 if len(message) != 0 { 935 errorMessage = message 936 } 937 938 switch { 939 case strings.EqualFold("BadRequestException", errorCode): 940 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 941 942 case strings.EqualFold("GatewayTimeoutException", errorCode): 943 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 944 945 case strings.EqualFold("NotFoundException", errorCode): 946 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 947 948 case strings.EqualFold("TooManyRequestsException", errorCode): 949 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 950 951 default: 952 genericError := &smithy.GenericAPIError{ 953 Code: errorCode, 954 Message: errorMessage, 955 } 956 return genericError 957 958 } 959} 960 961func awsRestjson1_deserializeOpDocumentCreateBackendConfigOutput(v **CreateBackendConfigOutput, value interface{}) error { 962 if v == nil { 963 return fmt.Errorf("unexpected nil of type %T", v) 964 } 965 if value == nil { 966 return nil 967 } 968 969 shape, ok := value.(map[string]interface{}) 970 if !ok { 971 return fmt.Errorf("unexpected JSON type %v", value) 972 } 973 974 var sv *CreateBackendConfigOutput 975 if *v == nil { 976 sv = &CreateBackendConfigOutput{} 977 } else { 978 sv = *v 979 } 980 981 for key, value := range shape { 982 switch key { 983 case "appId": 984 if value != nil { 985 jtv, ok := value.(string) 986 if !ok { 987 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 988 } 989 sv.AppId = ptr.String(jtv) 990 } 991 992 case "backendEnvironmentName": 993 if value != nil { 994 jtv, ok := value.(string) 995 if !ok { 996 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 997 } 998 sv.BackendEnvironmentName = ptr.String(jtv) 999 } 1000 1001 case "jobId": 1002 if value != nil { 1003 jtv, ok := value.(string) 1004 if !ok { 1005 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1006 } 1007 sv.JobId = ptr.String(jtv) 1008 } 1009 1010 case "status": 1011 if value != nil { 1012 jtv, ok := value.(string) 1013 if !ok { 1014 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1015 } 1016 sv.Status = ptr.String(jtv) 1017 } 1018 1019 default: 1020 _, _ = key, value 1021 1022 } 1023 } 1024 *v = sv 1025 return nil 1026} 1027 1028type awsRestjson1_deserializeOpCreateToken struct { 1029} 1030 1031func (*awsRestjson1_deserializeOpCreateToken) ID() string { 1032 return "OperationDeserializer" 1033} 1034 1035func (m *awsRestjson1_deserializeOpCreateToken) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1036 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1037) { 1038 out, metadata, err = next.HandleDeserialize(ctx, in) 1039 if err != nil { 1040 return out, metadata, err 1041 } 1042 1043 response, ok := out.RawResponse.(*smithyhttp.Response) 1044 if !ok { 1045 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1046 } 1047 1048 if response.StatusCode < 200 || response.StatusCode >= 300 { 1049 return out, metadata, awsRestjson1_deserializeOpErrorCreateToken(response, &metadata) 1050 } 1051 output := &CreateTokenOutput{} 1052 out.Result = output 1053 1054 var buff [1024]byte 1055 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1056 1057 body := io.TeeReader(response.Body, ringBuffer) 1058 1059 decoder := json.NewDecoder(body) 1060 decoder.UseNumber() 1061 var shape interface{} 1062 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1063 var snapshot bytes.Buffer 1064 io.Copy(&snapshot, ringBuffer) 1065 err = &smithy.DeserializationError{ 1066 Err: fmt.Errorf("failed to decode response body, %w", err), 1067 Snapshot: snapshot.Bytes(), 1068 } 1069 return out, metadata, err 1070 } 1071 1072 err = awsRestjson1_deserializeOpDocumentCreateTokenOutput(&output, shape) 1073 if err != nil { 1074 var snapshot bytes.Buffer 1075 io.Copy(&snapshot, ringBuffer) 1076 return out, metadata, &smithy.DeserializationError{ 1077 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1078 Snapshot: snapshot.Bytes(), 1079 } 1080 } 1081 1082 return out, metadata, err 1083} 1084 1085func awsRestjson1_deserializeOpErrorCreateToken(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1086 var errorBuffer bytes.Buffer 1087 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1088 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1089 } 1090 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1091 1092 errorCode := "UnknownError" 1093 errorMessage := errorCode 1094 1095 code := response.Header.Get("X-Amzn-ErrorType") 1096 if len(code) != 0 { 1097 errorCode = restjson.SanitizeErrorCode(code) 1098 } 1099 1100 var buff [1024]byte 1101 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1102 1103 body := io.TeeReader(errorBody, ringBuffer) 1104 decoder := json.NewDecoder(body) 1105 decoder.UseNumber() 1106 code, message, err := restjson.GetErrorInfo(decoder) 1107 if err != nil { 1108 var snapshot bytes.Buffer 1109 io.Copy(&snapshot, ringBuffer) 1110 err = &smithy.DeserializationError{ 1111 Err: fmt.Errorf("failed to decode response body, %w", err), 1112 Snapshot: snapshot.Bytes(), 1113 } 1114 return err 1115 } 1116 1117 errorBody.Seek(0, io.SeekStart) 1118 if len(code) != 0 { 1119 errorCode = restjson.SanitizeErrorCode(code) 1120 } 1121 if len(message) != 0 { 1122 errorMessage = message 1123 } 1124 1125 switch { 1126 case strings.EqualFold("BadRequestException", errorCode): 1127 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1128 1129 case strings.EqualFold("GatewayTimeoutException", errorCode): 1130 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 1131 1132 case strings.EqualFold("NotFoundException", errorCode): 1133 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1134 1135 case strings.EqualFold("TooManyRequestsException", errorCode): 1136 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1137 1138 default: 1139 genericError := &smithy.GenericAPIError{ 1140 Code: errorCode, 1141 Message: errorMessage, 1142 } 1143 return genericError 1144 1145 } 1146} 1147 1148func awsRestjson1_deserializeOpDocumentCreateTokenOutput(v **CreateTokenOutput, value interface{}) error { 1149 if v == nil { 1150 return fmt.Errorf("unexpected nil of type %T", v) 1151 } 1152 if value == nil { 1153 return nil 1154 } 1155 1156 shape, ok := value.(map[string]interface{}) 1157 if !ok { 1158 return fmt.Errorf("unexpected JSON type %v", value) 1159 } 1160 1161 var sv *CreateTokenOutput 1162 if *v == nil { 1163 sv = &CreateTokenOutput{} 1164 } else { 1165 sv = *v 1166 } 1167 1168 for key, value := range shape { 1169 switch key { 1170 case "appId": 1171 if value != nil { 1172 jtv, ok := value.(string) 1173 if !ok { 1174 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1175 } 1176 sv.AppId = ptr.String(jtv) 1177 } 1178 1179 case "challengeCode": 1180 if value != nil { 1181 jtv, ok := value.(string) 1182 if !ok { 1183 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1184 } 1185 sv.ChallengeCode = ptr.String(jtv) 1186 } 1187 1188 case "sessionId": 1189 if value != nil { 1190 jtv, ok := value.(string) 1191 if !ok { 1192 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1193 } 1194 sv.SessionId = ptr.String(jtv) 1195 } 1196 1197 case "ttl": 1198 if value != nil { 1199 jtv, ok := value.(string) 1200 if !ok { 1201 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1202 } 1203 sv.Ttl = ptr.String(jtv) 1204 } 1205 1206 default: 1207 _, _ = key, value 1208 1209 } 1210 } 1211 *v = sv 1212 return nil 1213} 1214 1215type awsRestjson1_deserializeOpDeleteBackend struct { 1216} 1217 1218func (*awsRestjson1_deserializeOpDeleteBackend) ID() string { 1219 return "OperationDeserializer" 1220} 1221 1222func (m *awsRestjson1_deserializeOpDeleteBackend) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1223 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1224) { 1225 out, metadata, err = next.HandleDeserialize(ctx, in) 1226 if err != nil { 1227 return out, metadata, err 1228 } 1229 1230 response, ok := out.RawResponse.(*smithyhttp.Response) 1231 if !ok { 1232 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1233 } 1234 1235 if response.StatusCode < 200 || response.StatusCode >= 300 { 1236 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBackend(response, &metadata) 1237 } 1238 output := &DeleteBackendOutput{} 1239 out.Result = output 1240 1241 var buff [1024]byte 1242 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1243 1244 body := io.TeeReader(response.Body, ringBuffer) 1245 1246 decoder := json.NewDecoder(body) 1247 decoder.UseNumber() 1248 var shape interface{} 1249 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1250 var snapshot bytes.Buffer 1251 io.Copy(&snapshot, ringBuffer) 1252 err = &smithy.DeserializationError{ 1253 Err: fmt.Errorf("failed to decode response body, %w", err), 1254 Snapshot: snapshot.Bytes(), 1255 } 1256 return out, metadata, err 1257 } 1258 1259 err = awsRestjson1_deserializeOpDocumentDeleteBackendOutput(&output, shape) 1260 if err != nil { 1261 var snapshot bytes.Buffer 1262 io.Copy(&snapshot, ringBuffer) 1263 return out, metadata, &smithy.DeserializationError{ 1264 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1265 Snapshot: snapshot.Bytes(), 1266 } 1267 } 1268 1269 return out, metadata, err 1270} 1271 1272func awsRestjson1_deserializeOpErrorDeleteBackend(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1273 var errorBuffer bytes.Buffer 1274 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1275 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1276 } 1277 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1278 1279 errorCode := "UnknownError" 1280 errorMessage := errorCode 1281 1282 code := response.Header.Get("X-Amzn-ErrorType") 1283 if len(code) != 0 { 1284 errorCode = restjson.SanitizeErrorCode(code) 1285 } 1286 1287 var buff [1024]byte 1288 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1289 1290 body := io.TeeReader(errorBody, ringBuffer) 1291 decoder := json.NewDecoder(body) 1292 decoder.UseNumber() 1293 code, message, err := restjson.GetErrorInfo(decoder) 1294 if err != nil { 1295 var snapshot bytes.Buffer 1296 io.Copy(&snapshot, ringBuffer) 1297 err = &smithy.DeserializationError{ 1298 Err: fmt.Errorf("failed to decode response body, %w", err), 1299 Snapshot: snapshot.Bytes(), 1300 } 1301 return err 1302 } 1303 1304 errorBody.Seek(0, io.SeekStart) 1305 if len(code) != 0 { 1306 errorCode = restjson.SanitizeErrorCode(code) 1307 } 1308 if len(message) != 0 { 1309 errorMessage = message 1310 } 1311 1312 switch { 1313 case strings.EqualFold("BadRequestException", errorCode): 1314 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1315 1316 case strings.EqualFold("GatewayTimeoutException", errorCode): 1317 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 1318 1319 case strings.EqualFold("NotFoundException", errorCode): 1320 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1321 1322 case strings.EqualFold("TooManyRequestsException", errorCode): 1323 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1324 1325 default: 1326 genericError := &smithy.GenericAPIError{ 1327 Code: errorCode, 1328 Message: errorMessage, 1329 } 1330 return genericError 1331 1332 } 1333} 1334 1335func awsRestjson1_deserializeOpDocumentDeleteBackendOutput(v **DeleteBackendOutput, value interface{}) error { 1336 if v == nil { 1337 return fmt.Errorf("unexpected nil of type %T", v) 1338 } 1339 if value == nil { 1340 return nil 1341 } 1342 1343 shape, ok := value.(map[string]interface{}) 1344 if !ok { 1345 return fmt.Errorf("unexpected JSON type %v", value) 1346 } 1347 1348 var sv *DeleteBackendOutput 1349 if *v == nil { 1350 sv = &DeleteBackendOutput{} 1351 } else { 1352 sv = *v 1353 } 1354 1355 for key, value := range shape { 1356 switch key { 1357 case "appId": 1358 if value != nil { 1359 jtv, ok := value.(string) 1360 if !ok { 1361 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1362 } 1363 sv.AppId = ptr.String(jtv) 1364 } 1365 1366 case "backendEnvironmentName": 1367 if value != nil { 1368 jtv, ok := value.(string) 1369 if !ok { 1370 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1371 } 1372 sv.BackendEnvironmentName = ptr.String(jtv) 1373 } 1374 1375 case "error": 1376 if value != nil { 1377 jtv, ok := value.(string) 1378 if !ok { 1379 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1380 } 1381 sv.Error = ptr.String(jtv) 1382 } 1383 1384 case "jobId": 1385 if value != nil { 1386 jtv, ok := value.(string) 1387 if !ok { 1388 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1389 } 1390 sv.JobId = ptr.String(jtv) 1391 } 1392 1393 case "operation": 1394 if value != nil { 1395 jtv, ok := value.(string) 1396 if !ok { 1397 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1398 } 1399 sv.Operation = ptr.String(jtv) 1400 } 1401 1402 case "status": 1403 if value != nil { 1404 jtv, ok := value.(string) 1405 if !ok { 1406 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1407 } 1408 sv.Status = ptr.String(jtv) 1409 } 1410 1411 default: 1412 _, _ = key, value 1413 1414 } 1415 } 1416 *v = sv 1417 return nil 1418} 1419 1420type awsRestjson1_deserializeOpDeleteBackendAPI struct { 1421} 1422 1423func (*awsRestjson1_deserializeOpDeleteBackendAPI) ID() string { 1424 return "OperationDeserializer" 1425} 1426 1427func (m *awsRestjson1_deserializeOpDeleteBackendAPI) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1428 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1429) { 1430 out, metadata, err = next.HandleDeserialize(ctx, in) 1431 if err != nil { 1432 return out, metadata, err 1433 } 1434 1435 response, ok := out.RawResponse.(*smithyhttp.Response) 1436 if !ok { 1437 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1438 } 1439 1440 if response.StatusCode < 200 || response.StatusCode >= 300 { 1441 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBackendAPI(response, &metadata) 1442 } 1443 output := &DeleteBackendAPIOutput{} 1444 out.Result = output 1445 1446 var buff [1024]byte 1447 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1448 1449 body := io.TeeReader(response.Body, ringBuffer) 1450 1451 decoder := json.NewDecoder(body) 1452 decoder.UseNumber() 1453 var shape interface{} 1454 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1455 var snapshot bytes.Buffer 1456 io.Copy(&snapshot, ringBuffer) 1457 err = &smithy.DeserializationError{ 1458 Err: fmt.Errorf("failed to decode response body, %w", err), 1459 Snapshot: snapshot.Bytes(), 1460 } 1461 return out, metadata, err 1462 } 1463 1464 err = awsRestjson1_deserializeOpDocumentDeleteBackendAPIOutput(&output, shape) 1465 if err != nil { 1466 var snapshot bytes.Buffer 1467 io.Copy(&snapshot, ringBuffer) 1468 return out, metadata, &smithy.DeserializationError{ 1469 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1470 Snapshot: snapshot.Bytes(), 1471 } 1472 } 1473 1474 return out, metadata, err 1475} 1476 1477func awsRestjson1_deserializeOpErrorDeleteBackendAPI(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1478 var errorBuffer bytes.Buffer 1479 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1480 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1481 } 1482 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1483 1484 errorCode := "UnknownError" 1485 errorMessage := errorCode 1486 1487 code := response.Header.Get("X-Amzn-ErrorType") 1488 if len(code) != 0 { 1489 errorCode = restjson.SanitizeErrorCode(code) 1490 } 1491 1492 var buff [1024]byte 1493 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1494 1495 body := io.TeeReader(errorBody, ringBuffer) 1496 decoder := json.NewDecoder(body) 1497 decoder.UseNumber() 1498 code, message, err := restjson.GetErrorInfo(decoder) 1499 if err != nil { 1500 var snapshot bytes.Buffer 1501 io.Copy(&snapshot, ringBuffer) 1502 err = &smithy.DeserializationError{ 1503 Err: fmt.Errorf("failed to decode response body, %w", err), 1504 Snapshot: snapshot.Bytes(), 1505 } 1506 return err 1507 } 1508 1509 errorBody.Seek(0, io.SeekStart) 1510 if len(code) != 0 { 1511 errorCode = restjson.SanitizeErrorCode(code) 1512 } 1513 if len(message) != 0 { 1514 errorMessage = message 1515 } 1516 1517 switch { 1518 case strings.EqualFold("BadRequestException", errorCode): 1519 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1520 1521 case strings.EqualFold("GatewayTimeoutException", errorCode): 1522 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 1523 1524 case strings.EqualFold("NotFoundException", errorCode): 1525 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1526 1527 case strings.EqualFold("TooManyRequestsException", errorCode): 1528 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1529 1530 default: 1531 genericError := &smithy.GenericAPIError{ 1532 Code: errorCode, 1533 Message: errorMessage, 1534 } 1535 return genericError 1536 1537 } 1538} 1539 1540func awsRestjson1_deserializeOpDocumentDeleteBackendAPIOutput(v **DeleteBackendAPIOutput, value interface{}) error { 1541 if v == nil { 1542 return fmt.Errorf("unexpected nil of type %T", v) 1543 } 1544 if value == nil { 1545 return nil 1546 } 1547 1548 shape, ok := value.(map[string]interface{}) 1549 if !ok { 1550 return fmt.Errorf("unexpected JSON type %v", value) 1551 } 1552 1553 var sv *DeleteBackendAPIOutput 1554 if *v == nil { 1555 sv = &DeleteBackendAPIOutput{} 1556 } else { 1557 sv = *v 1558 } 1559 1560 for key, value := range shape { 1561 switch key { 1562 case "appId": 1563 if value != nil { 1564 jtv, ok := value.(string) 1565 if !ok { 1566 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1567 } 1568 sv.AppId = ptr.String(jtv) 1569 } 1570 1571 case "backendEnvironmentName": 1572 if value != nil { 1573 jtv, ok := value.(string) 1574 if !ok { 1575 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1576 } 1577 sv.BackendEnvironmentName = ptr.String(jtv) 1578 } 1579 1580 case "error": 1581 if value != nil { 1582 jtv, ok := value.(string) 1583 if !ok { 1584 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1585 } 1586 sv.Error = ptr.String(jtv) 1587 } 1588 1589 case "jobId": 1590 if value != nil { 1591 jtv, ok := value.(string) 1592 if !ok { 1593 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1594 } 1595 sv.JobId = ptr.String(jtv) 1596 } 1597 1598 case "operation": 1599 if value != nil { 1600 jtv, ok := value.(string) 1601 if !ok { 1602 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1603 } 1604 sv.Operation = ptr.String(jtv) 1605 } 1606 1607 case "status": 1608 if value != nil { 1609 jtv, ok := value.(string) 1610 if !ok { 1611 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1612 } 1613 sv.Status = ptr.String(jtv) 1614 } 1615 1616 default: 1617 _, _ = key, value 1618 1619 } 1620 } 1621 *v = sv 1622 return nil 1623} 1624 1625type awsRestjson1_deserializeOpDeleteBackendAuth struct { 1626} 1627 1628func (*awsRestjson1_deserializeOpDeleteBackendAuth) ID() string { 1629 return "OperationDeserializer" 1630} 1631 1632func (m *awsRestjson1_deserializeOpDeleteBackendAuth) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1633 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1634) { 1635 out, metadata, err = next.HandleDeserialize(ctx, in) 1636 if err != nil { 1637 return out, metadata, err 1638 } 1639 1640 response, ok := out.RawResponse.(*smithyhttp.Response) 1641 if !ok { 1642 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1643 } 1644 1645 if response.StatusCode < 200 || response.StatusCode >= 300 { 1646 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBackendAuth(response, &metadata) 1647 } 1648 output := &DeleteBackendAuthOutput{} 1649 out.Result = output 1650 1651 var buff [1024]byte 1652 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1653 1654 body := io.TeeReader(response.Body, ringBuffer) 1655 1656 decoder := json.NewDecoder(body) 1657 decoder.UseNumber() 1658 var shape interface{} 1659 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1660 var snapshot bytes.Buffer 1661 io.Copy(&snapshot, ringBuffer) 1662 err = &smithy.DeserializationError{ 1663 Err: fmt.Errorf("failed to decode response body, %w", err), 1664 Snapshot: snapshot.Bytes(), 1665 } 1666 return out, metadata, err 1667 } 1668 1669 err = awsRestjson1_deserializeOpDocumentDeleteBackendAuthOutput(&output, shape) 1670 if err != nil { 1671 var snapshot bytes.Buffer 1672 io.Copy(&snapshot, ringBuffer) 1673 return out, metadata, &smithy.DeserializationError{ 1674 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1675 Snapshot: snapshot.Bytes(), 1676 } 1677 } 1678 1679 return out, metadata, err 1680} 1681 1682func awsRestjson1_deserializeOpErrorDeleteBackendAuth(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1683 var errorBuffer bytes.Buffer 1684 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1685 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1686 } 1687 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1688 1689 errorCode := "UnknownError" 1690 errorMessage := errorCode 1691 1692 code := response.Header.Get("X-Amzn-ErrorType") 1693 if len(code) != 0 { 1694 errorCode = restjson.SanitizeErrorCode(code) 1695 } 1696 1697 var buff [1024]byte 1698 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1699 1700 body := io.TeeReader(errorBody, ringBuffer) 1701 decoder := json.NewDecoder(body) 1702 decoder.UseNumber() 1703 code, message, err := restjson.GetErrorInfo(decoder) 1704 if err != nil { 1705 var snapshot bytes.Buffer 1706 io.Copy(&snapshot, ringBuffer) 1707 err = &smithy.DeserializationError{ 1708 Err: fmt.Errorf("failed to decode response body, %w", err), 1709 Snapshot: snapshot.Bytes(), 1710 } 1711 return err 1712 } 1713 1714 errorBody.Seek(0, io.SeekStart) 1715 if len(code) != 0 { 1716 errorCode = restjson.SanitizeErrorCode(code) 1717 } 1718 if len(message) != 0 { 1719 errorMessage = message 1720 } 1721 1722 switch { 1723 case strings.EqualFold("BadRequestException", errorCode): 1724 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1725 1726 case strings.EqualFold("GatewayTimeoutException", errorCode): 1727 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 1728 1729 case strings.EqualFold("NotFoundException", errorCode): 1730 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1731 1732 case strings.EqualFold("TooManyRequestsException", errorCode): 1733 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1734 1735 default: 1736 genericError := &smithy.GenericAPIError{ 1737 Code: errorCode, 1738 Message: errorMessage, 1739 } 1740 return genericError 1741 1742 } 1743} 1744 1745func awsRestjson1_deserializeOpDocumentDeleteBackendAuthOutput(v **DeleteBackendAuthOutput, value interface{}) error { 1746 if v == nil { 1747 return fmt.Errorf("unexpected nil of type %T", v) 1748 } 1749 if value == nil { 1750 return nil 1751 } 1752 1753 shape, ok := value.(map[string]interface{}) 1754 if !ok { 1755 return fmt.Errorf("unexpected JSON type %v", value) 1756 } 1757 1758 var sv *DeleteBackendAuthOutput 1759 if *v == nil { 1760 sv = &DeleteBackendAuthOutput{} 1761 } else { 1762 sv = *v 1763 } 1764 1765 for key, value := range shape { 1766 switch key { 1767 case "appId": 1768 if value != nil { 1769 jtv, ok := value.(string) 1770 if !ok { 1771 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1772 } 1773 sv.AppId = ptr.String(jtv) 1774 } 1775 1776 case "backendEnvironmentName": 1777 if value != nil { 1778 jtv, ok := value.(string) 1779 if !ok { 1780 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1781 } 1782 sv.BackendEnvironmentName = ptr.String(jtv) 1783 } 1784 1785 case "error": 1786 if value != nil { 1787 jtv, ok := value.(string) 1788 if !ok { 1789 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1790 } 1791 sv.Error = ptr.String(jtv) 1792 } 1793 1794 case "jobId": 1795 if value != nil { 1796 jtv, ok := value.(string) 1797 if !ok { 1798 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1799 } 1800 sv.JobId = ptr.String(jtv) 1801 } 1802 1803 case "operation": 1804 if value != nil { 1805 jtv, ok := value.(string) 1806 if !ok { 1807 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1808 } 1809 sv.Operation = ptr.String(jtv) 1810 } 1811 1812 case "status": 1813 if value != nil { 1814 jtv, ok := value.(string) 1815 if !ok { 1816 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1817 } 1818 sv.Status = ptr.String(jtv) 1819 } 1820 1821 default: 1822 _, _ = key, value 1823 1824 } 1825 } 1826 *v = sv 1827 return nil 1828} 1829 1830type awsRestjson1_deserializeOpDeleteToken struct { 1831} 1832 1833func (*awsRestjson1_deserializeOpDeleteToken) ID() string { 1834 return "OperationDeserializer" 1835} 1836 1837func (m *awsRestjson1_deserializeOpDeleteToken) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1838 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1839) { 1840 out, metadata, err = next.HandleDeserialize(ctx, in) 1841 if err != nil { 1842 return out, metadata, err 1843 } 1844 1845 response, ok := out.RawResponse.(*smithyhttp.Response) 1846 if !ok { 1847 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1848 } 1849 1850 if response.StatusCode < 200 || response.StatusCode >= 300 { 1851 return out, metadata, awsRestjson1_deserializeOpErrorDeleteToken(response, &metadata) 1852 } 1853 output := &DeleteTokenOutput{} 1854 out.Result = output 1855 1856 var buff [1024]byte 1857 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1858 1859 body := io.TeeReader(response.Body, ringBuffer) 1860 1861 decoder := json.NewDecoder(body) 1862 decoder.UseNumber() 1863 var shape interface{} 1864 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1865 var snapshot bytes.Buffer 1866 io.Copy(&snapshot, ringBuffer) 1867 err = &smithy.DeserializationError{ 1868 Err: fmt.Errorf("failed to decode response body, %w", err), 1869 Snapshot: snapshot.Bytes(), 1870 } 1871 return out, metadata, err 1872 } 1873 1874 err = awsRestjson1_deserializeOpDocumentDeleteTokenOutput(&output, shape) 1875 if err != nil { 1876 var snapshot bytes.Buffer 1877 io.Copy(&snapshot, ringBuffer) 1878 return out, metadata, &smithy.DeserializationError{ 1879 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1880 Snapshot: snapshot.Bytes(), 1881 } 1882 } 1883 1884 return out, metadata, err 1885} 1886 1887func awsRestjson1_deserializeOpErrorDeleteToken(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1888 var errorBuffer bytes.Buffer 1889 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1890 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1891 } 1892 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1893 1894 errorCode := "UnknownError" 1895 errorMessage := errorCode 1896 1897 code := response.Header.Get("X-Amzn-ErrorType") 1898 if len(code) != 0 { 1899 errorCode = restjson.SanitizeErrorCode(code) 1900 } 1901 1902 var buff [1024]byte 1903 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1904 1905 body := io.TeeReader(errorBody, ringBuffer) 1906 decoder := json.NewDecoder(body) 1907 decoder.UseNumber() 1908 code, message, err := restjson.GetErrorInfo(decoder) 1909 if err != nil { 1910 var snapshot bytes.Buffer 1911 io.Copy(&snapshot, ringBuffer) 1912 err = &smithy.DeserializationError{ 1913 Err: fmt.Errorf("failed to decode response body, %w", err), 1914 Snapshot: snapshot.Bytes(), 1915 } 1916 return err 1917 } 1918 1919 errorBody.Seek(0, io.SeekStart) 1920 if len(code) != 0 { 1921 errorCode = restjson.SanitizeErrorCode(code) 1922 } 1923 if len(message) != 0 { 1924 errorMessage = message 1925 } 1926 1927 switch { 1928 case strings.EqualFold("BadRequestException", errorCode): 1929 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1930 1931 case strings.EqualFold("GatewayTimeoutException", errorCode): 1932 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 1933 1934 case strings.EqualFold("NotFoundException", errorCode): 1935 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1936 1937 case strings.EqualFold("TooManyRequestsException", errorCode): 1938 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1939 1940 default: 1941 genericError := &smithy.GenericAPIError{ 1942 Code: errorCode, 1943 Message: errorMessage, 1944 } 1945 return genericError 1946 1947 } 1948} 1949 1950func awsRestjson1_deserializeOpDocumentDeleteTokenOutput(v **DeleteTokenOutput, value interface{}) error { 1951 if v == nil { 1952 return fmt.Errorf("unexpected nil of type %T", v) 1953 } 1954 if value == nil { 1955 return nil 1956 } 1957 1958 shape, ok := value.(map[string]interface{}) 1959 if !ok { 1960 return fmt.Errorf("unexpected JSON type %v", value) 1961 } 1962 1963 var sv *DeleteTokenOutput 1964 if *v == nil { 1965 sv = &DeleteTokenOutput{} 1966 } else { 1967 sv = *v 1968 } 1969 1970 for key, value := range shape { 1971 switch key { 1972 case "isSuccess": 1973 if value != nil { 1974 jtv, ok := value.(bool) 1975 if !ok { 1976 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 1977 } 1978 sv.IsSuccess = jtv 1979 } 1980 1981 default: 1982 _, _ = key, value 1983 1984 } 1985 } 1986 *v = sv 1987 return nil 1988} 1989 1990type awsRestjson1_deserializeOpGenerateBackendAPIModels struct { 1991} 1992 1993func (*awsRestjson1_deserializeOpGenerateBackendAPIModels) ID() string { 1994 return "OperationDeserializer" 1995} 1996 1997func (m *awsRestjson1_deserializeOpGenerateBackendAPIModels) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1998 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1999) { 2000 out, metadata, err = next.HandleDeserialize(ctx, in) 2001 if err != nil { 2002 return out, metadata, err 2003 } 2004 2005 response, ok := out.RawResponse.(*smithyhttp.Response) 2006 if !ok { 2007 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2008 } 2009 2010 if response.StatusCode < 200 || response.StatusCode >= 300 { 2011 return out, metadata, awsRestjson1_deserializeOpErrorGenerateBackendAPIModels(response, &metadata) 2012 } 2013 output := &GenerateBackendAPIModelsOutput{} 2014 out.Result = output 2015 2016 var buff [1024]byte 2017 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2018 2019 body := io.TeeReader(response.Body, ringBuffer) 2020 2021 decoder := json.NewDecoder(body) 2022 decoder.UseNumber() 2023 var shape interface{} 2024 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2025 var snapshot bytes.Buffer 2026 io.Copy(&snapshot, ringBuffer) 2027 err = &smithy.DeserializationError{ 2028 Err: fmt.Errorf("failed to decode response body, %w", err), 2029 Snapshot: snapshot.Bytes(), 2030 } 2031 return out, metadata, err 2032 } 2033 2034 err = awsRestjson1_deserializeOpDocumentGenerateBackendAPIModelsOutput(&output, shape) 2035 if err != nil { 2036 var snapshot bytes.Buffer 2037 io.Copy(&snapshot, ringBuffer) 2038 return out, metadata, &smithy.DeserializationError{ 2039 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2040 Snapshot: snapshot.Bytes(), 2041 } 2042 } 2043 2044 return out, metadata, err 2045} 2046 2047func awsRestjson1_deserializeOpErrorGenerateBackendAPIModels(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2048 var errorBuffer bytes.Buffer 2049 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2050 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2051 } 2052 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2053 2054 errorCode := "UnknownError" 2055 errorMessage := errorCode 2056 2057 code := response.Header.Get("X-Amzn-ErrorType") 2058 if len(code) != 0 { 2059 errorCode = restjson.SanitizeErrorCode(code) 2060 } 2061 2062 var buff [1024]byte 2063 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2064 2065 body := io.TeeReader(errorBody, ringBuffer) 2066 decoder := json.NewDecoder(body) 2067 decoder.UseNumber() 2068 code, message, err := restjson.GetErrorInfo(decoder) 2069 if err != nil { 2070 var snapshot bytes.Buffer 2071 io.Copy(&snapshot, ringBuffer) 2072 err = &smithy.DeserializationError{ 2073 Err: fmt.Errorf("failed to decode response body, %w", err), 2074 Snapshot: snapshot.Bytes(), 2075 } 2076 return err 2077 } 2078 2079 errorBody.Seek(0, io.SeekStart) 2080 if len(code) != 0 { 2081 errorCode = restjson.SanitizeErrorCode(code) 2082 } 2083 if len(message) != 0 { 2084 errorMessage = message 2085 } 2086 2087 switch { 2088 case strings.EqualFold("BadRequestException", errorCode): 2089 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2090 2091 case strings.EqualFold("GatewayTimeoutException", errorCode): 2092 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 2093 2094 case strings.EqualFold("NotFoundException", errorCode): 2095 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2096 2097 case strings.EqualFold("TooManyRequestsException", errorCode): 2098 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2099 2100 default: 2101 genericError := &smithy.GenericAPIError{ 2102 Code: errorCode, 2103 Message: errorMessage, 2104 } 2105 return genericError 2106 2107 } 2108} 2109 2110func awsRestjson1_deserializeOpDocumentGenerateBackendAPIModelsOutput(v **GenerateBackendAPIModelsOutput, value interface{}) error { 2111 if v == nil { 2112 return fmt.Errorf("unexpected nil of type %T", v) 2113 } 2114 if value == nil { 2115 return nil 2116 } 2117 2118 shape, ok := value.(map[string]interface{}) 2119 if !ok { 2120 return fmt.Errorf("unexpected JSON type %v", value) 2121 } 2122 2123 var sv *GenerateBackendAPIModelsOutput 2124 if *v == nil { 2125 sv = &GenerateBackendAPIModelsOutput{} 2126 } else { 2127 sv = *v 2128 } 2129 2130 for key, value := range shape { 2131 switch key { 2132 case "appId": 2133 if value != nil { 2134 jtv, ok := value.(string) 2135 if !ok { 2136 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2137 } 2138 sv.AppId = ptr.String(jtv) 2139 } 2140 2141 case "backendEnvironmentName": 2142 if value != nil { 2143 jtv, ok := value.(string) 2144 if !ok { 2145 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2146 } 2147 sv.BackendEnvironmentName = ptr.String(jtv) 2148 } 2149 2150 case "error": 2151 if value != nil { 2152 jtv, ok := value.(string) 2153 if !ok { 2154 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2155 } 2156 sv.Error = ptr.String(jtv) 2157 } 2158 2159 case "jobId": 2160 if value != nil { 2161 jtv, ok := value.(string) 2162 if !ok { 2163 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2164 } 2165 sv.JobId = ptr.String(jtv) 2166 } 2167 2168 case "operation": 2169 if value != nil { 2170 jtv, ok := value.(string) 2171 if !ok { 2172 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2173 } 2174 sv.Operation = ptr.String(jtv) 2175 } 2176 2177 case "status": 2178 if value != nil { 2179 jtv, ok := value.(string) 2180 if !ok { 2181 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2182 } 2183 sv.Status = ptr.String(jtv) 2184 } 2185 2186 default: 2187 _, _ = key, value 2188 2189 } 2190 } 2191 *v = sv 2192 return nil 2193} 2194 2195type awsRestjson1_deserializeOpGetBackend struct { 2196} 2197 2198func (*awsRestjson1_deserializeOpGetBackend) ID() string { 2199 return "OperationDeserializer" 2200} 2201 2202func (m *awsRestjson1_deserializeOpGetBackend) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2203 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2204) { 2205 out, metadata, err = next.HandleDeserialize(ctx, in) 2206 if err != nil { 2207 return out, metadata, err 2208 } 2209 2210 response, ok := out.RawResponse.(*smithyhttp.Response) 2211 if !ok { 2212 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2213 } 2214 2215 if response.StatusCode < 200 || response.StatusCode >= 300 { 2216 return out, metadata, awsRestjson1_deserializeOpErrorGetBackend(response, &metadata) 2217 } 2218 output := &GetBackendOutput{} 2219 out.Result = output 2220 2221 var buff [1024]byte 2222 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2223 2224 body := io.TeeReader(response.Body, ringBuffer) 2225 2226 decoder := json.NewDecoder(body) 2227 decoder.UseNumber() 2228 var shape interface{} 2229 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2230 var snapshot bytes.Buffer 2231 io.Copy(&snapshot, ringBuffer) 2232 err = &smithy.DeserializationError{ 2233 Err: fmt.Errorf("failed to decode response body, %w", err), 2234 Snapshot: snapshot.Bytes(), 2235 } 2236 return out, metadata, err 2237 } 2238 2239 err = awsRestjson1_deserializeOpDocumentGetBackendOutput(&output, shape) 2240 if err != nil { 2241 var snapshot bytes.Buffer 2242 io.Copy(&snapshot, ringBuffer) 2243 return out, metadata, &smithy.DeserializationError{ 2244 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2245 Snapshot: snapshot.Bytes(), 2246 } 2247 } 2248 2249 return out, metadata, err 2250} 2251 2252func awsRestjson1_deserializeOpErrorGetBackend(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2253 var errorBuffer bytes.Buffer 2254 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2255 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2256 } 2257 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2258 2259 errorCode := "UnknownError" 2260 errorMessage := errorCode 2261 2262 code := response.Header.Get("X-Amzn-ErrorType") 2263 if len(code) != 0 { 2264 errorCode = restjson.SanitizeErrorCode(code) 2265 } 2266 2267 var buff [1024]byte 2268 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2269 2270 body := io.TeeReader(errorBody, ringBuffer) 2271 decoder := json.NewDecoder(body) 2272 decoder.UseNumber() 2273 code, message, err := restjson.GetErrorInfo(decoder) 2274 if err != nil { 2275 var snapshot bytes.Buffer 2276 io.Copy(&snapshot, ringBuffer) 2277 err = &smithy.DeserializationError{ 2278 Err: fmt.Errorf("failed to decode response body, %w", err), 2279 Snapshot: snapshot.Bytes(), 2280 } 2281 return err 2282 } 2283 2284 errorBody.Seek(0, io.SeekStart) 2285 if len(code) != 0 { 2286 errorCode = restjson.SanitizeErrorCode(code) 2287 } 2288 if len(message) != 0 { 2289 errorMessage = message 2290 } 2291 2292 switch { 2293 case strings.EqualFold("BadRequestException", errorCode): 2294 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2295 2296 case strings.EqualFold("GatewayTimeoutException", errorCode): 2297 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 2298 2299 case strings.EqualFold("NotFoundException", errorCode): 2300 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2301 2302 case strings.EqualFold("TooManyRequestsException", errorCode): 2303 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2304 2305 default: 2306 genericError := &smithy.GenericAPIError{ 2307 Code: errorCode, 2308 Message: errorMessage, 2309 } 2310 return genericError 2311 2312 } 2313} 2314 2315func awsRestjson1_deserializeOpDocumentGetBackendOutput(v **GetBackendOutput, value interface{}) error { 2316 if v == nil { 2317 return fmt.Errorf("unexpected nil of type %T", v) 2318 } 2319 if value == nil { 2320 return nil 2321 } 2322 2323 shape, ok := value.(map[string]interface{}) 2324 if !ok { 2325 return fmt.Errorf("unexpected JSON type %v", value) 2326 } 2327 2328 var sv *GetBackendOutput 2329 if *v == nil { 2330 sv = &GetBackendOutput{} 2331 } else { 2332 sv = *v 2333 } 2334 2335 for key, value := range shape { 2336 switch key { 2337 case "amplifyMetaConfig": 2338 if value != nil { 2339 jtv, ok := value.(string) 2340 if !ok { 2341 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2342 } 2343 sv.AmplifyMetaConfig = ptr.String(jtv) 2344 } 2345 2346 case "appId": 2347 if value != nil { 2348 jtv, ok := value.(string) 2349 if !ok { 2350 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2351 } 2352 sv.AppId = ptr.String(jtv) 2353 } 2354 2355 case "appName": 2356 if value != nil { 2357 jtv, ok := value.(string) 2358 if !ok { 2359 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2360 } 2361 sv.AppName = ptr.String(jtv) 2362 } 2363 2364 case "backendEnvironmentList": 2365 if err := awsRestjson1_deserializeDocumentListOf__string(&sv.BackendEnvironmentList, value); err != nil { 2366 return err 2367 } 2368 2369 case "backendEnvironmentName": 2370 if value != nil { 2371 jtv, ok := value.(string) 2372 if !ok { 2373 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2374 } 2375 sv.BackendEnvironmentName = ptr.String(jtv) 2376 } 2377 2378 case "error": 2379 if value != nil { 2380 jtv, ok := value.(string) 2381 if !ok { 2382 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2383 } 2384 sv.Error = ptr.String(jtv) 2385 } 2386 2387 default: 2388 _, _ = key, value 2389 2390 } 2391 } 2392 *v = sv 2393 return nil 2394} 2395 2396type awsRestjson1_deserializeOpGetBackendAPI struct { 2397} 2398 2399func (*awsRestjson1_deserializeOpGetBackendAPI) ID() string { 2400 return "OperationDeserializer" 2401} 2402 2403func (m *awsRestjson1_deserializeOpGetBackendAPI) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2404 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2405) { 2406 out, metadata, err = next.HandleDeserialize(ctx, in) 2407 if err != nil { 2408 return out, metadata, err 2409 } 2410 2411 response, ok := out.RawResponse.(*smithyhttp.Response) 2412 if !ok { 2413 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2414 } 2415 2416 if response.StatusCode < 200 || response.StatusCode >= 300 { 2417 return out, metadata, awsRestjson1_deserializeOpErrorGetBackendAPI(response, &metadata) 2418 } 2419 output := &GetBackendAPIOutput{} 2420 out.Result = output 2421 2422 var buff [1024]byte 2423 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2424 2425 body := io.TeeReader(response.Body, ringBuffer) 2426 2427 decoder := json.NewDecoder(body) 2428 decoder.UseNumber() 2429 var shape interface{} 2430 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2431 var snapshot bytes.Buffer 2432 io.Copy(&snapshot, ringBuffer) 2433 err = &smithy.DeserializationError{ 2434 Err: fmt.Errorf("failed to decode response body, %w", err), 2435 Snapshot: snapshot.Bytes(), 2436 } 2437 return out, metadata, err 2438 } 2439 2440 err = awsRestjson1_deserializeOpDocumentGetBackendAPIOutput(&output, shape) 2441 if err != nil { 2442 var snapshot bytes.Buffer 2443 io.Copy(&snapshot, ringBuffer) 2444 return out, metadata, &smithy.DeserializationError{ 2445 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2446 Snapshot: snapshot.Bytes(), 2447 } 2448 } 2449 2450 return out, metadata, err 2451} 2452 2453func awsRestjson1_deserializeOpErrorGetBackendAPI(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2454 var errorBuffer bytes.Buffer 2455 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2456 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2457 } 2458 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2459 2460 errorCode := "UnknownError" 2461 errorMessage := errorCode 2462 2463 code := response.Header.Get("X-Amzn-ErrorType") 2464 if len(code) != 0 { 2465 errorCode = restjson.SanitizeErrorCode(code) 2466 } 2467 2468 var buff [1024]byte 2469 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2470 2471 body := io.TeeReader(errorBody, ringBuffer) 2472 decoder := json.NewDecoder(body) 2473 decoder.UseNumber() 2474 code, message, err := restjson.GetErrorInfo(decoder) 2475 if err != nil { 2476 var snapshot bytes.Buffer 2477 io.Copy(&snapshot, ringBuffer) 2478 err = &smithy.DeserializationError{ 2479 Err: fmt.Errorf("failed to decode response body, %w", err), 2480 Snapshot: snapshot.Bytes(), 2481 } 2482 return err 2483 } 2484 2485 errorBody.Seek(0, io.SeekStart) 2486 if len(code) != 0 { 2487 errorCode = restjson.SanitizeErrorCode(code) 2488 } 2489 if len(message) != 0 { 2490 errorMessage = message 2491 } 2492 2493 switch { 2494 case strings.EqualFold("BadRequestException", errorCode): 2495 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2496 2497 case strings.EqualFold("GatewayTimeoutException", errorCode): 2498 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 2499 2500 case strings.EqualFold("NotFoundException", errorCode): 2501 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2502 2503 case strings.EqualFold("TooManyRequestsException", errorCode): 2504 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2505 2506 default: 2507 genericError := &smithy.GenericAPIError{ 2508 Code: errorCode, 2509 Message: errorMessage, 2510 } 2511 return genericError 2512 2513 } 2514} 2515 2516func awsRestjson1_deserializeOpDocumentGetBackendAPIOutput(v **GetBackendAPIOutput, value interface{}) error { 2517 if v == nil { 2518 return fmt.Errorf("unexpected nil of type %T", v) 2519 } 2520 if value == nil { 2521 return nil 2522 } 2523 2524 shape, ok := value.(map[string]interface{}) 2525 if !ok { 2526 return fmt.Errorf("unexpected JSON type %v", value) 2527 } 2528 2529 var sv *GetBackendAPIOutput 2530 if *v == nil { 2531 sv = &GetBackendAPIOutput{} 2532 } else { 2533 sv = *v 2534 } 2535 2536 for key, value := range shape { 2537 switch key { 2538 case "appId": 2539 if value != nil { 2540 jtv, ok := value.(string) 2541 if !ok { 2542 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2543 } 2544 sv.AppId = ptr.String(jtv) 2545 } 2546 2547 case "backendEnvironmentName": 2548 if value != nil { 2549 jtv, ok := value.(string) 2550 if !ok { 2551 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2552 } 2553 sv.BackendEnvironmentName = ptr.String(jtv) 2554 } 2555 2556 case "error": 2557 if value != nil { 2558 jtv, ok := value.(string) 2559 if !ok { 2560 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2561 } 2562 sv.Error = ptr.String(jtv) 2563 } 2564 2565 case "resourceConfig": 2566 if err := awsRestjson1_deserializeDocumentBackendAPIResourceConfig(&sv.ResourceConfig, value); err != nil { 2567 return err 2568 } 2569 2570 case "resourceName": 2571 if value != nil { 2572 jtv, ok := value.(string) 2573 if !ok { 2574 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2575 } 2576 sv.ResourceName = ptr.String(jtv) 2577 } 2578 2579 default: 2580 _, _ = key, value 2581 2582 } 2583 } 2584 *v = sv 2585 return nil 2586} 2587 2588type awsRestjson1_deserializeOpGetBackendAPIModels struct { 2589} 2590 2591func (*awsRestjson1_deserializeOpGetBackendAPIModels) ID() string { 2592 return "OperationDeserializer" 2593} 2594 2595func (m *awsRestjson1_deserializeOpGetBackendAPIModels) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2596 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2597) { 2598 out, metadata, err = next.HandleDeserialize(ctx, in) 2599 if err != nil { 2600 return out, metadata, err 2601 } 2602 2603 response, ok := out.RawResponse.(*smithyhttp.Response) 2604 if !ok { 2605 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2606 } 2607 2608 if response.StatusCode < 200 || response.StatusCode >= 300 { 2609 return out, metadata, awsRestjson1_deserializeOpErrorGetBackendAPIModels(response, &metadata) 2610 } 2611 output := &GetBackendAPIModelsOutput{} 2612 out.Result = output 2613 2614 var buff [1024]byte 2615 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2616 2617 body := io.TeeReader(response.Body, ringBuffer) 2618 2619 decoder := json.NewDecoder(body) 2620 decoder.UseNumber() 2621 var shape interface{} 2622 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2623 var snapshot bytes.Buffer 2624 io.Copy(&snapshot, ringBuffer) 2625 err = &smithy.DeserializationError{ 2626 Err: fmt.Errorf("failed to decode response body, %w", err), 2627 Snapshot: snapshot.Bytes(), 2628 } 2629 return out, metadata, err 2630 } 2631 2632 err = awsRestjson1_deserializeOpDocumentGetBackendAPIModelsOutput(&output, shape) 2633 if err != nil { 2634 var snapshot bytes.Buffer 2635 io.Copy(&snapshot, ringBuffer) 2636 return out, metadata, &smithy.DeserializationError{ 2637 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2638 Snapshot: snapshot.Bytes(), 2639 } 2640 } 2641 2642 return out, metadata, err 2643} 2644 2645func awsRestjson1_deserializeOpErrorGetBackendAPIModels(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2646 var errorBuffer bytes.Buffer 2647 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2648 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2649 } 2650 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2651 2652 errorCode := "UnknownError" 2653 errorMessage := errorCode 2654 2655 code := response.Header.Get("X-Amzn-ErrorType") 2656 if len(code) != 0 { 2657 errorCode = restjson.SanitizeErrorCode(code) 2658 } 2659 2660 var buff [1024]byte 2661 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2662 2663 body := io.TeeReader(errorBody, ringBuffer) 2664 decoder := json.NewDecoder(body) 2665 decoder.UseNumber() 2666 code, message, err := restjson.GetErrorInfo(decoder) 2667 if err != nil { 2668 var snapshot bytes.Buffer 2669 io.Copy(&snapshot, ringBuffer) 2670 err = &smithy.DeserializationError{ 2671 Err: fmt.Errorf("failed to decode response body, %w", err), 2672 Snapshot: snapshot.Bytes(), 2673 } 2674 return err 2675 } 2676 2677 errorBody.Seek(0, io.SeekStart) 2678 if len(code) != 0 { 2679 errorCode = restjson.SanitizeErrorCode(code) 2680 } 2681 if len(message) != 0 { 2682 errorMessage = message 2683 } 2684 2685 switch { 2686 case strings.EqualFold("BadRequestException", errorCode): 2687 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2688 2689 case strings.EqualFold("GatewayTimeoutException", errorCode): 2690 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 2691 2692 case strings.EqualFold("NotFoundException", errorCode): 2693 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2694 2695 case strings.EqualFold("TooManyRequestsException", errorCode): 2696 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2697 2698 default: 2699 genericError := &smithy.GenericAPIError{ 2700 Code: errorCode, 2701 Message: errorMessage, 2702 } 2703 return genericError 2704 2705 } 2706} 2707 2708func awsRestjson1_deserializeOpDocumentGetBackendAPIModelsOutput(v **GetBackendAPIModelsOutput, value interface{}) error { 2709 if v == nil { 2710 return fmt.Errorf("unexpected nil of type %T", v) 2711 } 2712 if value == nil { 2713 return nil 2714 } 2715 2716 shape, ok := value.(map[string]interface{}) 2717 if !ok { 2718 return fmt.Errorf("unexpected JSON type %v", value) 2719 } 2720 2721 var sv *GetBackendAPIModelsOutput 2722 if *v == nil { 2723 sv = &GetBackendAPIModelsOutput{} 2724 } else { 2725 sv = *v 2726 } 2727 2728 for key, value := range shape { 2729 switch key { 2730 case "models": 2731 if value != nil { 2732 jtv, ok := value.(string) 2733 if !ok { 2734 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2735 } 2736 sv.Models = ptr.String(jtv) 2737 } 2738 2739 case "status": 2740 if value != nil { 2741 jtv, ok := value.(string) 2742 if !ok { 2743 return fmt.Errorf("expected Status to be of type string, got %T instead", value) 2744 } 2745 sv.Status = types.Status(jtv) 2746 } 2747 2748 default: 2749 _, _ = key, value 2750 2751 } 2752 } 2753 *v = sv 2754 return nil 2755} 2756 2757type awsRestjson1_deserializeOpGetBackendAuth struct { 2758} 2759 2760func (*awsRestjson1_deserializeOpGetBackendAuth) ID() string { 2761 return "OperationDeserializer" 2762} 2763 2764func (m *awsRestjson1_deserializeOpGetBackendAuth) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2765 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2766) { 2767 out, metadata, err = next.HandleDeserialize(ctx, in) 2768 if err != nil { 2769 return out, metadata, err 2770 } 2771 2772 response, ok := out.RawResponse.(*smithyhttp.Response) 2773 if !ok { 2774 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2775 } 2776 2777 if response.StatusCode < 200 || response.StatusCode >= 300 { 2778 return out, metadata, awsRestjson1_deserializeOpErrorGetBackendAuth(response, &metadata) 2779 } 2780 output := &GetBackendAuthOutput{} 2781 out.Result = output 2782 2783 var buff [1024]byte 2784 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2785 2786 body := io.TeeReader(response.Body, ringBuffer) 2787 2788 decoder := json.NewDecoder(body) 2789 decoder.UseNumber() 2790 var shape interface{} 2791 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2792 var snapshot bytes.Buffer 2793 io.Copy(&snapshot, ringBuffer) 2794 err = &smithy.DeserializationError{ 2795 Err: fmt.Errorf("failed to decode response body, %w", err), 2796 Snapshot: snapshot.Bytes(), 2797 } 2798 return out, metadata, err 2799 } 2800 2801 err = awsRestjson1_deserializeOpDocumentGetBackendAuthOutput(&output, shape) 2802 if err != nil { 2803 var snapshot bytes.Buffer 2804 io.Copy(&snapshot, ringBuffer) 2805 return out, metadata, &smithy.DeserializationError{ 2806 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2807 Snapshot: snapshot.Bytes(), 2808 } 2809 } 2810 2811 return out, metadata, err 2812} 2813 2814func awsRestjson1_deserializeOpErrorGetBackendAuth(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2815 var errorBuffer bytes.Buffer 2816 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2817 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2818 } 2819 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2820 2821 errorCode := "UnknownError" 2822 errorMessage := errorCode 2823 2824 code := response.Header.Get("X-Amzn-ErrorType") 2825 if len(code) != 0 { 2826 errorCode = restjson.SanitizeErrorCode(code) 2827 } 2828 2829 var buff [1024]byte 2830 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2831 2832 body := io.TeeReader(errorBody, ringBuffer) 2833 decoder := json.NewDecoder(body) 2834 decoder.UseNumber() 2835 code, message, err := restjson.GetErrorInfo(decoder) 2836 if err != nil { 2837 var snapshot bytes.Buffer 2838 io.Copy(&snapshot, ringBuffer) 2839 err = &smithy.DeserializationError{ 2840 Err: fmt.Errorf("failed to decode response body, %w", err), 2841 Snapshot: snapshot.Bytes(), 2842 } 2843 return err 2844 } 2845 2846 errorBody.Seek(0, io.SeekStart) 2847 if len(code) != 0 { 2848 errorCode = restjson.SanitizeErrorCode(code) 2849 } 2850 if len(message) != 0 { 2851 errorMessage = message 2852 } 2853 2854 switch { 2855 case strings.EqualFold("BadRequestException", errorCode): 2856 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2857 2858 case strings.EqualFold("GatewayTimeoutException", errorCode): 2859 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 2860 2861 case strings.EqualFold("NotFoundException", errorCode): 2862 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2863 2864 case strings.EqualFold("TooManyRequestsException", errorCode): 2865 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2866 2867 default: 2868 genericError := &smithy.GenericAPIError{ 2869 Code: errorCode, 2870 Message: errorMessage, 2871 } 2872 return genericError 2873 2874 } 2875} 2876 2877func awsRestjson1_deserializeOpDocumentGetBackendAuthOutput(v **GetBackendAuthOutput, value interface{}) error { 2878 if v == nil { 2879 return fmt.Errorf("unexpected nil of type %T", v) 2880 } 2881 if value == nil { 2882 return nil 2883 } 2884 2885 shape, ok := value.(map[string]interface{}) 2886 if !ok { 2887 return fmt.Errorf("unexpected JSON type %v", value) 2888 } 2889 2890 var sv *GetBackendAuthOutput 2891 if *v == nil { 2892 sv = &GetBackendAuthOutput{} 2893 } else { 2894 sv = *v 2895 } 2896 2897 for key, value := range shape { 2898 switch key { 2899 case "appId": 2900 if value != nil { 2901 jtv, ok := value.(string) 2902 if !ok { 2903 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2904 } 2905 sv.AppId = ptr.String(jtv) 2906 } 2907 2908 case "backendEnvironmentName": 2909 if value != nil { 2910 jtv, ok := value.(string) 2911 if !ok { 2912 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2913 } 2914 sv.BackendEnvironmentName = ptr.String(jtv) 2915 } 2916 2917 case "error": 2918 if value != nil { 2919 jtv, ok := value.(string) 2920 if !ok { 2921 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2922 } 2923 sv.Error = ptr.String(jtv) 2924 } 2925 2926 case "resourceConfig": 2927 if err := awsRestjson1_deserializeDocumentCreateBackendAuthResourceConfig(&sv.ResourceConfig, value); err != nil { 2928 return err 2929 } 2930 2931 case "resourceName": 2932 if value != nil { 2933 jtv, ok := value.(string) 2934 if !ok { 2935 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2936 } 2937 sv.ResourceName = ptr.String(jtv) 2938 } 2939 2940 default: 2941 _, _ = key, value 2942 2943 } 2944 } 2945 *v = sv 2946 return nil 2947} 2948 2949type awsRestjson1_deserializeOpGetBackendJob struct { 2950} 2951 2952func (*awsRestjson1_deserializeOpGetBackendJob) ID() string { 2953 return "OperationDeserializer" 2954} 2955 2956func (m *awsRestjson1_deserializeOpGetBackendJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2957 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2958) { 2959 out, metadata, err = next.HandleDeserialize(ctx, in) 2960 if err != nil { 2961 return out, metadata, err 2962 } 2963 2964 response, ok := out.RawResponse.(*smithyhttp.Response) 2965 if !ok { 2966 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2967 } 2968 2969 if response.StatusCode < 200 || response.StatusCode >= 300 { 2970 return out, metadata, awsRestjson1_deserializeOpErrorGetBackendJob(response, &metadata) 2971 } 2972 output := &GetBackendJobOutput{} 2973 out.Result = output 2974 2975 var buff [1024]byte 2976 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2977 2978 body := io.TeeReader(response.Body, ringBuffer) 2979 2980 decoder := json.NewDecoder(body) 2981 decoder.UseNumber() 2982 var shape interface{} 2983 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2984 var snapshot bytes.Buffer 2985 io.Copy(&snapshot, ringBuffer) 2986 err = &smithy.DeserializationError{ 2987 Err: fmt.Errorf("failed to decode response body, %w", err), 2988 Snapshot: snapshot.Bytes(), 2989 } 2990 return out, metadata, err 2991 } 2992 2993 err = awsRestjson1_deserializeOpDocumentGetBackendJobOutput(&output, shape) 2994 if err != nil { 2995 var snapshot bytes.Buffer 2996 io.Copy(&snapshot, ringBuffer) 2997 return out, metadata, &smithy.DeserializationError{ 2998 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2999 Snapshot: snapshot.Bytes(), 3000 } 3001 } 3002 3003 return out, metadata, err 3004} 3005 3006func awsRestjson1_deserializeOpErrorGetBackendJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3007 var errorBuffer bytes.Buffer 3008 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3009 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3010 } 3011 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3012 3013 errorCode := "UnknownError" 3014 errorMessage := errorCode 3015 3016 code := response.Header.Get("X-Amzn-ErrorType") 3017 if len(code) != 0 { 3018 errorCode = restjson.SanitizeErrorCode(code) 3019 } 3020 3021 var buff [1024]byte 3022 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3023 3024 body := io.TeeReader(errorBody, ringBuffer) 3025 decoder := json.NewDecoder(body) 3026 decoder.UseNumber() 3027 code, message, err := restjson.GetErrorInfo(decoder) 3028 if err != nil { 3029 var snapshot bytes.Buffer 3030 io.Copy(&snapshot, ringBuffer) 3031 err = &smithy.DeserializationError{ 3032 Err: fmt.Errorf("failed to decode response body, %w", err), 3033 Snapshot: snapshot.Bytes(), 3034 } 3035 return err 3036 } 3037 3038 errorBody.Seek(0, io.SeekStart) 3039 if len(code) != 0 { 3040 errorCode = restjson.SanitizeErrorCode(code) 3041 } 3042 if len(message) != 0 { 3043 errorMessage = message 3044 } 3045 3046 switch { 3047 case strings.EqualFold("BadRequestException", errorCode): 3048 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3049 3050 case strings.EqualFold("GatewayTimeoutException", errorCode): 3051 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 3052 3053 case strings.EqualFold("NotFoundException", errorCode): 3054 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3055 3056 case strings.EqualFold("TooManyRequestsException", errorCode): 3057 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3058 3059 default: 3060 genericError := &smithy.GenericAPIError{ 3061 Code: errorCode, 3062 Message: errorMessage, 3063 } 3064 return genericError 3065 3066 } 3067} 3068 3069func awsRestjson1_deserializeOpDocumentGetBackendJobOutput(v **GetBackendJobOutput, value interface{}) error { 3070 if v == nil { 3071 return fmt.Errorf("unexpected nil of type %T", v) 3072 } 3073 if value == nil { 3074 return nil 3075 } 3076 3077 shape, ok := value.(map[string]interface{}) 3078 if !ok { 3079 return fmt.Errorf("unexpected JSON type %v", value) 3080 } 3081 3082 var sv *GetBackendJobOutput 3083 if *v == nil { 3084 sv = &GetBackendJobOutput{} 3085 } else { 3086 sv = *v 3087 } 3088 3089 for key, value := range shape { 3090 switch key { 3091 case "appId": 3092 if value != nil { 3093 jtv, ok := value.(string) 3094 if !ok { 3095 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3096 } 3097 sv.AppId = ptr.String(jtv) 3098 } 3099 3100 case "backendEnvironmentName": 3101 if value != nil { 3102 jtv, ok := value.(string) 3103 if !ok { 3104 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3105 } 3106 sv.BackendEnvironmentName = ptr.String(jtv) 3107 } 3108 3109 case "createTime": 3110 if value != nil { 3111 jtv, ok := value.(string) 3112 if !ok { 3113 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3114 } 3115 sv.CreateTime = ptr.String(jtv) 3116 } 3117 3118 case "error": 3119 if value != nil { 3120 jtv, ok := value.(string) 3121 if !ok { 3122 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3123 } 3124 sv.Error = ptr.String(jtv) 3125 } 3126 3127 case "jobId": 3128 if value != nil { 3129 jtv, ok := value.(string) 3130 if !ok { 3131 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3132 } 3133 sv.JobId = ptr.String(jtv) 3134 } 3135 3136 case "operation": 3137 if value != nil { 3138 jtv, ok := value.(string) 3139 if !ok { 3140 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3141 } 3142 sv.Operation = ptr.String(jtv) 3143 } 3144 3145 case "status": 3146 if value != nil { 3147 jtv, ok := value.(string) 3148 if !ok { 3149 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3150 } 3151 sv.Status = ptr.String(jtv) 3152 } 3153 3154 case "updateTime": 3155 if value != nil { 3156 jtv, ok := value.(string) 3157 if !ok { 3158 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3159 } 3160 sv.UpdateTime = ptr.String(jtv) 3161 } 3162 3163 default: 3164 _, _ = key, value 3165 3166 } 3167 } 3168 *v = sv 3169 return nil 3170} 3171 3172type awsRestjson1_deserializeOpGetToken struct { 3173} 3174 3175func (*awsRestjson1_deserializeOpGetToken) ID() string { 3176 return "OperationDeserializer" 3177} 3178 3179func (m *awsRestjson1_deserializeOpGetToken) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3180 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3181) { 3182 out, metadata, err = next.HandleDeserialize(ctx, in) 3183 if err != nil { 3184 return out, metadata, err 3185 } 3186 3187 response, ok := out.RawResponse.(*smithyhttp.Response) 3188 if !ok { 3189 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3190 } 3191 3192 if response.StatusCode < 200 || response.StatusCode >= 300 { 3193 return out, metadata, awsRestjson1_deserializeOpErrorGetToken(response, &metadata) 3194 } 3195 output := &GetTokenOutput{} 3196 out.Result = output 3197 3198 var buff [1024]byte 3199 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3200 3201 body := io.TeeReader(response.Body, ringBuffer) 3202 3203 decoder := json.NewDecoder(body) 3204 decoder.UseNumber() 3205 var shape interface{} 3206 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3207 var snapshot bytes.Buffer 3208 io.Copy(&snapshot, ringBuffer) 3209 err = &smithy.DeserializationError{ 3210 Err: fmt.Errorf("failed to decode response body, %w", err), 3211 Snapshot: snapshot.Bytes(), 3212 } 3213 return out, metadata, err 3214 } 3215 3216 err = awsRestjson1_deserializeOpDocumentGetTokenOutput(&output, shape) 3217 if err != nil { 3218 var snapshot bytes.Buffer 3219 io.Copy(&snapshot, ringBuffer) 3220 return out, metadata, &smithy.DeserializationError{ 3221 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3222 Snapshot: snapshot.Bytes(), 3223 } 3224 } 3225 3226 return out, metadata, err 3227} 3228 3229func awsRestjson1_deserializeOpErrorGetToken(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3230 var errorBuffer bytes.Buffer 3231 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3232 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3233 } 3234 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3235 3236 errorCode := "UnknownError" 3237 errorMessage := errorCode 3238 3239 code := response.Header.Get("X-Amzn-ErrorType") 3240 if len(code) != 0 { 3241 errorCode = restjson.SanitizeErrorCode(code) 3242 } 3243 3244 var buff [1024]byte 3245 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3246 3247 body := io.TeeReader(errorBody, ringBuffer) 3248 decoder := json.NewDecoder(body) 3249 decoder.UseNumber() 3250 code, message, err := restjson.GetErrorInfo(decoder) 3251 if err != nil { 3252 var snapshot bytes.Buffer 3253 io.Copy(&snapshot, ringBuffer) 3254 err = &smithy.DeserializationError{ 3255 Err: fmt.Errorf("failed to decode response body, %w", err), 3256 Snapshot: snapshot.Bytes(), 3257 } 3258 return err 3259 } 3260 3261 errorBody.Seek(0, io.SeekStart) 3262 if len(code) != 0 { 3263 errorCode = restjson.SanitizeErrorCode(code) 3264 } 3265 if len(message) != 0 { 3266 errorMessage = message 3267 } 3268 3269 switch { 3270 case strings.EqualFold("BadRequestException", errorCode): 3271 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3272 3273 case strings.EqualFold("GatewayTimeoutException", errorCode): 3274 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 3275 3276 case strings.EqualFold("NotFoundException", errorCode): 3277 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3278 3279 case strings.EqualFold("TooManyRequestsException", errorCode): 3280 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3281 3282 default: 3283 genericError := &smithy.GenericAPIError{ 3284 Code: errorCode, 3285 Message: errorMessage, 3286 } 3287 return genericError 3288 3289 } 3290} 3291 3292func awsRestjson1_deserializeOpDocumentGetTokenOutput(v **GetTokenOutput, value interface{}) error { 3293 if v == nil { 3294 return fmt.Errorf("unexpected nil of type %T", v) 3295 } 3296 if value == nil { 3297 return nil 3298 } 3299 3300 shape, ok := value.(map[string]interface{}) 3301 if !ok { 3302 return fmt.Errorf("unexpected JSON type %v", value) 3303 } 3304 3305 var sv *GetTokenOutput 3306 if *v == nil { 3307 sv = &GetTokenOutput{} 3308 } else { 3309 sv = *v 3310 } 3311 3312 for key, value := range shape { 3313 switch key { 3314 case "appId": 3315 if value != nil { 3316 jtv, ok := value.(string) 3317 if !ok { 3318 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3319 } 3320 sv.AppId = ptr.String(jtv) 3321 } 3322 3323 case "challengeCode": 3324 if value != nil { 3325 jtv, ok := value.(string) 3326 if !ok { 3327 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3328 } 3329 sv.ChallengeCode = ptr.String(jtv) 3330 } 3331 3332 case "sessionId": 3333 if value != nil { 3334 jtv, ok := value.(string) 3335 if !ok { 3336 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3337 } 3338 sv.SessionId = ptr.String(jtv) 3339 } 3340 3341 case "ttl": 3342 if value != nil { 3343 jtv, ok := value.(string) 3344 if !ok { 3345 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3346 } 3347 sv.Ttl = ptr.String(jtv) 3348 } 3349 3350 default: 3351 _, _ = key, value 3352 3353 } 3354 } 3355 *v = sv 3356 return nil 3357} 3358 3359type awsRestjson1_deserializeOpListBackendJobs struct { 3360} 3361 3362func (*awsRestjson1_deserializeOpListBackendJobs) ID() string { 3363 return "OperationDeserializer" 3364} 3365 3366func (m *awsRestjson1_deserializeOpListBackendJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3367 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3368) { 3369 out, metadata, err = next.HandleDeserialize(ctx, in) 3370 if err != nil { 3371 return out, metadata, err 3372 } 3373 3374 response, ok := out.RawResponse.(*smithyhttp.Response) 3375 if !ok { 3376 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3377 } 3378 3379 if response.StatusCode < 200 || response.StatusCode >= 300 { 3380 return out, metadata, awsRestjson1_deserializeOpErrorListBackendJobs(response, &metadata) 3381 } 3382 output := &ListBackendJobsOutput{} 3383 out.Result = output 3384 3385 var buff [1024]byte 3386 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3387 3388 body := io.TeeReader(response.Body, ringBuffer) 3389 3390 decoder := json.NewDecoder(body) 3391 decoder.UseNumber() 3392 var shape interface{} 3393 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3394 var snapshot bytes.Buffer 3395 io.Copy(&snapshot, ringBuffer) 3396 err = &smithy.DeserializationError{ 3397 Err: fmt.Errorf("failed to decode response body, %w", err), 3398 Snapshot: snapshot.Bytes(), 3399 } 3400 return out, metadata, err 3401 } 3402 3403 err = awsRestjson1_deserializeOpDocumentListBackendJobsOutput(&output, shape) 3404 if err != nil { 3405 var snapshot bytes.Buffer 3406 io.Copy(&snapshot, ringBuffer) 3407 return out, metadata, &smithy.DeserializationError{ 3408 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3409 Snapshot: snapshot.Bytes(), 3410 } 3411 } 3412 3413 return out, metadata, err 3414} 3415 3416func awsRestjson1_deserializeOpErrorListBackendJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3417 var errorBuffer bytes.Buffer 3418 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3419 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3420 } 3421 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3422 3423 errorCode := "UnknownError" 3424 errorMessage := errorCode 3425 3426 code := response.Header.Get("X-Amzn-ErrorType") 3427 if len(code) != 0 { 3428 errorCode = restjson.SanitizeErrorCode(code) 3429 } 3430 3431 var buff [1024]byte 3432 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3433 3434 body := io.TeeReader(errorBody, ringBuffer) 3435 decoder := json.NewDecoder(body) 3436 decoder.UseNumber() 3437 code, message, err := restjson.GetErrorInfo(decoder) 3438 if err != nil { 3439 var snapshot bytes.Buffer 3440 io.Copy(&snapshot, ringBuffer) 3441 err = &smithy.DeserializationError{ 3442 Err: fmt.Errorf("failed to decode response body, %w", err), 3443 Snapshot: snapshot.Bytes(), 3444 } 3445 return err 3446 } 3447 3448 errorBody.Seek(0, io.SeekStart) 3449 if len(code) != 0 { 3450 errorCode = restjson.SanitizeErrorCode(code) 3451 } 3452 if len(message) != 0 { 3453 errorMessage = message 3454 } 3455 3456 switch { 3457 case strings.EqualFold("BadRequestException", errorCode): 3458 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3459 3460 case strings.EqualFold("GatewayTimeoutException", errorCode): 3461 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 3462 3463 case strings.EqualFold("NotFoundException", errorCode): 3464 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3465 3466 case strings.EqualFold("TooManyRequestsException", errorCode): 3467 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3468 3469 default: 3470 genericError := &smithy.GenericAPIError{ 3471 Code: errorCode, 3472 Message: errorMessage, 3473 } 3474 return genericError 3475 3476 } 3477} 3478 3479func awsRestjson1_deserializeOpDocumentListBackendJobsOutput(v **ListBackendJobsOutput, value interface{}) error { 3480 if v == nil { 3481 return fmt.Errorf("unexpected nil of type %T", v) 3482 } 3483 if value == nil { 3484 return nil 3485 } 3486 3487 shape, ok := value.(map[string]interface{}) 3488 if !ok { 3489 return fmt.Errorf("unexpected JSON type %v", value) 3490 } 3491 3492 var sv *ListBackendJobsOutput 3493 if *v == nil { 3494 sv = &ListBackendJobsOutput{} 3495 } else { 3496 sv = *v 3497 } 3498 3499 for key, value := range shape { 3500 switch key { 3501 case "jobs": 3502 if err := awsRestjson1_deserializeDocumentListOfBackendJobRespObj(&sv.Jobs, value); err != nil { 3503 return err 3504 } 3505 3506 case "nextToken": 3507 if value != nil { 3508 jtv, ok := value.(string) 3509 if !ok { 3510 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3511 } 3512 sv.NextToken = ptr.String(jtv) 3513 } 3514 3515 default: 3516 _, _ = key, value 3517 3518 } 3519 } 3520 *v = sv 3521 return nil 3522} 3523 3524type awsRestjson1_deserializeOpRemoveAllBackends struct { 3525} 3526 3527func (*awsRestjson1_deserializeOpRemoveAllBackends) ID() string { 3528 return "OperationDeserializer" 3529} 3530 3531func (m *awsRestjson1_deserializeOpRemoveAllBackends) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3532 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3533) { 3534 out, metadata, err = next.HandleDeserialize(ctx, in) 3535 if err != nil { 3536 return out, metadata, err 3537 } 3538 3539 response, ok := out.RawResponse.(*smithyhttp.Response) 3540 if !ok { 3541 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3542 } 3543 3544 if response.StatusCode < 200 || response.StatusCode >= 300 { 3545 return out, metadata, awsRestjson1_deserializeOpErrorRemoveAllBackends(response, &metadata) 3546 } 3547 output := &RemoveAllBackendsOutput{} 3548 out.Result = output 3549 3550 var buff [1024]byte 3551 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3552 3553 body := io.TeeReader(response.Body, ringBuffer) 3554 3555 decoder := json.NewDecoder(body) 3556 decoder.UseNumber() 3557 var shape interface{} 3558 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3559 var snapshot bytes.Buffer 3560 io.Copy(&snapshot, ringBuffer) 3561 err = &smithy.DeserializationError{ 3562 Err: fmt.Errorf("failed to decode response body, %w", err), 3563 Snapshot: snapshot.Bytes(), 3564 } 3565 return out, metadata, err 3566 } 3567 3568 err = awsRestjson1_deserializeOpDocumentRemoveAllBackendsOutput(&output, shape) 3569 if err != nil { 3570 var snapshot bytes.Buffer 3571 io.Copy(&snapshot, ringBuffer) 3572 return out, metadata, &smithy.DeserializationError{ 3573 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3574 Snapshot: snapshot.Bytes(), 3575 } 3576 } 3577 3578 return out, metadata, err 3579} 3580 3581func awsRestjson1_deserializeOpErrorRemoveAllBackends(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3582 var errorBuffer bytes.Buffer 3583 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3584 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3585 } 3586 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3587 3588 errorCode := "UnknownError" 3589 errorMessage := errorCode 3590 3591 code := response.Header.Get("X-Amzn-ErrorType") 3592 if len(code) != 0 { 3593 errorCode = restjson.SanitizeErrorCode(code) 3594 } 3595 3596 var buff [1024]byte 3597 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3598 3599 body := io.TeeReader(errorBody, ringBuffer) 3600 decoder := json.NewDecoder(body) 3601 decoder.UseNumber() 3602 code, message, err := restjson.GetErrorInfo(decoder) 3603 if err != nil { 3604 var snapshot bytes.Buffer 3605 io.Copy(&snapshot, ringBuffer) 3606 err = &smithy.DeserializationError{ 3607 Err: fmt.Errorf("failed to decode response body, %w", err), 3608 Snapshot: snapshot.Bytes(), 3609 } 3610 return err 3611 } 3612 3613 errorBody.Seek(0, io.SeekStart) 3614 if len(code) != 0 { 3615 errorCode = restjson.SanitizeErrorCode(code) 3616 } 3617 if len(message) != 0 { 3618 errorMessage = message 3619 } 3620 3621 switch { 3622 case strings.EqualFold("BadRequestException", errorCode): 3623 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3624 3625 case strings.EqualFold("GatewayTimeoutException", errorCode): 3626 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 3627 3628 case strings.EqualFold("NotFoundException", errorCode): 3629 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3630 3631 case strings.EqualFold("TooManyRequestsException", errorCode): 3632 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3633 3634 default: 3635 genericError := &smithy.GenericAPIError{ 3636 Code: errorCode, 3637 Message: errorMessage, 3638 } 3639 return genericError 3640 3641 } 3642} 3643 3644func awsRestjson1_deserializeOpDocumentRemoveAllBackendsOutput(v **RemoveAllBackendsOutput, value interface{}) error { 3645 if v == nil { 3646 return fmt.Errorf("unexpected nil of type %T", v) 3647 } 3648 if value == nil { 3649 return nil 3650 } 3651 3652 shape, ok := value.(map[string]interface{}) 3653 if !ok { 3654 return fmt.Errorf("unexpected JSON type %v", value) 3655 } 3656 3657 var sv *RemoveAllBackendsOutput 3658 if *v == nil { 3659 sv = &RemoveAllBackendsOutput{} 3660 } else { 3661 sv = *v 3662 } 3663 3664 for key, value := range shape { 3665 switch key { 3666 case "appId": 3667 if value != nil { 3668 jtv, ok := value.(string) 3669 if !ok { 3670 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3671 } 3672 sv.AppId = ptr.String(jtv) 3673 } 3674 3675 case "error": 3676 if value != nil { 3677 jtv, ok := value.(string) 3678 if !ok { 3679 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3680 } 3681 sv.Error = ptr.String(jtv) 3682 } 3683 3684 case "jobId": 3685 if value != nil { 3686 jtv, ok := value.(string) 3687 if !ok { 3688 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3689 } 3690 sv.JobId = ptr.String(jtv) 3691 } 3692 3693 case "operation": 3694 if value != nil { 3695 jtv, ok := value.(string) 3696 if !ok { 3697 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3698 } 3699 sv.Operation = ptr.String(jtv) 3700 } 3701 3702 case "status": 3703 if value != nil { 3704 jtv, ok := value.(string) 3705 if !ok { 3706 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3707 } 3708 sv.Status = ptr.String(jtv) 3709 } 3710 3711 default: 3712 _, _ = key, value 3713 3714 } 3715 } 3716 *v = sv 3717 return nil 3718} 3719 3720type awsRestjson1_deserializeOpRemoveBackendConfig struct { 3721} 3722 3723func (*awsRestjson1_deserializeOpRemoveBackendConfig) ID() string { 3724 return "OperationDeserializer" 3725} 3726 3727func (m *awsRestjson1_deserializeOpRemoveBackendConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3728 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3729) { 3730 out, metadata, err = next.HandleDeserialize(ctx, in) 3731 if err != nil { 3732 return out, metadata, err 3733 } 3734 3735 response, ok := out.RawResponse.(*smithyhttp.Response) 3736 if !ok { 3737 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3738 } 3739 3740 if response.StatusCode < 200 || response.StatusCode >= 300 { 3741 return out, metadata, awsRestjson1_deserializeOpErrorRemoveBackendConfig(response, &metadata) 3742 } 3743 output := &RemoveBackendConfigOutput{} 3744 out.Result = output 3745 3746 var buff [1024]byte 3747 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3748 3749 body := io.TeeReader(response.Body, ringBuffer) 3750 3751 decoder := json.NewDecoder(body) 3752 decoder.UseNumber() 3753 var shape interface{} 3754 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3755 var snapshot bytes.Buffer 3756 io.Copy(&snapshot, ringBuffer) 3757 err = &smithy.DeserializationError{ 3758 Err: fmt.Errorf("failed to decode response body, %w", err), 3759 Snapshot: snapshot.Bytes(), 3760 } 3761 return out, metadata, err 3762 } 3763 3764 err = awsRestjson1_deserializeOpDocumentRemoveBackendConfigOutput(&output, shape) 3765 if err != nil { 3766 var snapshot bytes.Buffer 3767 io.Copy(&snapshot, ringBuffer) 3768 return out, metadata, &smithy.DeserializationError{ 3769 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3770 Snapshot: snapshot.Bytes(), 3771 } 3772 } 3773 3774 return out, metadata, err 3775} 3776 3777func awsRestjson1_deserializeOpErrorRemoveBackendConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3778 var errorBuffer bytes.Buffer 3779 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3780 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3781 } 3782 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3783 3784 errorCode := "UnknownError" 3785 errorMessage := errorCode 3786 3787 code := response.Header.Get("X-Amzn-ErrorType") 3788 if len(code) != 0 { 3789 errorCode = restjson.SanitizeErrorCode(code) 3790 } 3791 3792 var buff [1024]byte 3793 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3794 3795 body := io.TeeReader(errorBody, ringBuffer) 3796 decoder := json.NewDecoder(body) 3797 decoder.UseNumber() 3798 code, message, err := restjson.GetErrorInfo(decoder) 3799 if err != nil { 3800 var snapshot bytes.Buffer 3801 io.Copy(&snapshot, ringBuffer) 3802 err = &smithy.DeserializationError{ 3803 Err: fmt.Errorf("failed to decode response body, %w", err), 3804 Snapshot: snapshot.Bytes(), 3805 } 3806 return err 3807 } 3808 3809 errorBody.Seek(0, io.SeekStart) 3810 if len(code) != 0 { 3811 errorCode = restjson.SanitizeErrorCode(code) 3812 } 3813 if len(message) != 0 { 3814 errorMessage = message 3815 } 3816 3817 switch { 3818 case strings.EqualFold("BadRequestException", errorCode): 3819 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3820 3821 case strings.EqualFold("GatewayTimeoutException", errorCode): 3822 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 3823 3824 case strings.EqualFold("NotFoundException", errorCode): 3825 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3826 3827 case strings.EqualFold("TooManyRequestsException", errorCode): 3828 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3829 3830 default: 3831 genericError := &smithy.GenericAPIError{ 3832 Code: errorCode, 3833 Message: errorMessage, 3834 } 3835 return genericError 3836 3837 } 3838} 3839 3840func awsRestjson1_deserializeOpDocumentRemoveBackendConfigOutput(v **RemoveBackendConfigOutput, value interface{}) error { 3841 if v == nil { 3842 return fmt.Errorf("unexpected nil of type %T", v) 3843 } 3844 if value == nil { 3845 return nil 3846 } 3847 3848 shape, ok := value.(map[string]interface{}) 3849 if !ok { 3850 return fmt.Errorf("unexpected JSON type %v", value) 3851 } 3852 3853 var sv *RemoveBackendConfigOutput 3854 if *v == nil { 3855 sv = &RemoveBackendConfigOutput{} 3856 } else { 3857 sv = *v 3858 } 3859 3860 for key, value := range shape { 3861 switch key { 3862 case "error": 3863 if value != nil { 3864 jtv, ok := value.(string) 3865 if !ok { 3866 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3867 } 3868 sv.Error = ptr.String(jtv) 3869 } 3870 3871 default: 3872 _, _ = key, value 3873 3874 } 3875 } 3876 *v = sv 3877 return nil 3878} 3879 3880type awsRestjson1_deserializeOpUpdateBackendAPI struct { 3881} 3882 3883func (*awsRestjson1_deserializeOpUpdateBackendAPI) ID() string { 3884 return "OperationDeserializer" 3885} 3886 3887func (m *awsRestjson1_deserializeOpUpdateBackendAPI) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3888 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3889) { 3890 out, metadata, err = next.HandleDeserialize(ctx, in) 3891 if err != nil { 3892 return out, metadata, err 3893 } 3894 3895 response, ok := out.RawResponse.(*smithyhttp.Response) 3896 if !ok { 3897 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3898 } 3899 3900 if response.StatusCode < 200 || response.StatusCode >= 300 { 3901 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBackendAPI(response, &metadata) 3902 } 3903 output := &UpdateBackendAPIOutput{} 3904 out.Result = output 3905 3906 var buff [1024]byte 3907 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3908 3909 body := io.TeeReader(response.Body, ringBuffer) 3910 3911 decoder := json.NewDecoder(body) 3912 decoder.UseNumber() 3913 var shape interface{} 3914 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3915 var snapshot bytes.Buffer 3916 io.Copy(&snapshot, ringBuffer) 3917 err = &smithy.DeserializationError{ 3918 Err: fmt.Errorf("failed to decode response body, %w", err), 3919 Snapshot: snapshot.Bytes(), 3920 } 3921 return out, metadata, err 3922 } 3923 3924 err = awsRestjson1_deserializeOpDocumentUpdateBackendAPIOutput(&output, shape) 3925 if err != nil { 3926 var snapshot bytes.Buffer 3927 io.Copy(&snapshot, ringBuffer) 3928 return out, metadata, &smithy.DeserializationError{ 3929 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3930 Snapshot: snapshot.Bytes(), 3931 } 3932 } 3933 3934 return out, metadata, err 3935} 3936 3937func awsRestjson1_deserializeOpErrorUpdateBackendAPI(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3938 var errorBuffer bytes.Buffer 3939 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3940 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3941 } 3942 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3943 3944 errorCode := "UnknownError" 3945 errorMessage := errorCode 3946 3947 code := response.Header.Get("X-Amzn-ErrorType") 3948 if len(code) != 0 { 3949 errorCode = restjson.SanitizeErrorCode(code) 3950 } 3951 3952 var buff [1024]byte 3953 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3954 3955 body := io.TeeReader(errorBody, ringBuffer) 3956 decoder := json.NewDecoder(body) 3957 decoder.UseNumber() 3958 code, message, err := restjson.GetErrorInfo(decoder) 3959 if err != nil { 3960 var snapshot bytes.Buffer 3961 io.Copy(&snapshot, ringBuffer) 3962 err = &smithy.DeserializationError{ 3963 Err: fmt.Errorf("failed to decode response body, %w", err), 3964 Snapshot: snapshot.Bytes(), 3965 } 3966 return err 3967 } 3968 3969 errorBody.Seek(0, io.SeekStart) 3970 if len(code) != 0 { 3971 errorCode = restjson.SanitizeErrorCode(code) 3972 } 3973 if len(message) != 0 { 3974 errorMessage = message 3975 } 3976 3977 switch { 3978 case strings.EqualFold("BadRequestException", errorCode): 3979 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3980 3981 case strings.EqualFold("GatewayTimeoutException", errorCode): 3982 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 3983 3984 case strings.EqualFold("NotFoundException", errorCode): 3985 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3986 3987 case strings.EqualFold("TooManyRequestsException", errorCode): 3988 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3989 3990 default: 3991 genericError := &smithy.GenericAPIError{ 3992 Code: errorCode, 3993 Message: errorMessage, 3994 } 3995 return genericError 3996 3997 } 3998} 3999 4000func awsRestjson1_deserializeOpDocumentUpdateBackendAPIOutput(v **UpdateBackendAPIOutput, value interface{}) error { 4001 if v == nil { 4002 return fmt.Errorf("unexpected nil of type %T", v) 4003 } 4004 if value == nil { 4005 return nil 4006 } 4007 4008 shape, ok := value.(map[string]interface{}) 4009 if !ok { 4010 return fmt.Errorf("unexpected JSON type %v", value) 4011 } 4012 4013 var sv *UpdateBackendAPIOutput 4014 if *v == nil { 4015 sv = &UpdateBackendAPIOutput{} 4016 } else { 4017 sv = *v 4018 } 4019 4020 for key, value := range shape { 4021 switch key { 4022 case "appId": 4023 if value != nil { 4024 jtv, ok := value.(string) 4025 if !ok { 4026 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4027 } 4028 sv.AppId = ptr.String(jtv) 4029 } 4030 4031 case "backendEnvironmentName": 4032 if value != nil { 4033 jtv, ok := value.(string) 4034 if !ok { 4035 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4036 } 4037 sv.BackendEnvironmentName = ptr.String(jtv) 4038 } 4039 4040 case "error": 4041 if value != nil { 4042 jtv, ok := value.(string) 4043 if !ok { 4044 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4045 } 4046 sv.Error = ptr.String(jtv) 4047 } 4048 4049 case "jobId": 4050 if value != nil { 4051 jtv, ok := value.(string) 4052 if !ok { 4053 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4054 } 4055 sv.JobId = ptr.String(jtv) 4056 } 4057 4058 case "operation": 4059 if value != nil { 4060 jtv, ok := value.(string) 4061 if !ok { 4062 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4063 } 4064 sv.Operation = ptr.String(jtv) 4065 } 4066 4067 case "status": 4068 if value != nil { 4069 jtv, ok := value.(string) 4070 if !ok { 4071 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4072 } 4073 sv.Status = ptr.String(jtv) 4074 } 4075 4076 default: 4077 _, _ = key, value 4078 4079 } 4080 } 4081 *v = sv 4082 return nil 4083} 4084 4085type awsRestjson1_deserializeOpUpdateBackendAuth struct { 4086} 4087 4088func (*awsRestjson1_deserializeOpUpdateBackendAuth) ID() string { 4089 return "OperationDeserializer" 4090} 4091 4092func (m *awsRestjson1_deserializeOpUpdateBackendAuth) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4093 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4094) { 4095 out, metadata, err = next.HandleDeserialize(ctx, in) 4096 if err != nil { 4097 return out, metadata, err 4098 } 4099 4100 response, ok := out.RawResponse.(*smithyhttp.Response) 4101 if !ok { 4102 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4103 } 4104 4105 if response.StatusCode < 200 || response.StatusCode >= 300 { 4106 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBackendAuth(response, &metadata) 4107 } 4108 output := &UpdateBackendAuthOutput{} 4109 out.Result = output 4110 4111 var buff [1024]byte 4112 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4113 4114 body := io.TeeReader(response.Body, ringBuffer) 4115 4116 decoder := json.NewDecoder(body) 4117 decoder.UseNumber() 4118 var shape interface{} 4119 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4120 var snapshot bytes.Buffer 4121 io.Copy(&snapshot, ringBuffer) 4122 err = &smithy.DeserializationError{ 4123 Err: fmt.Errorf("failed to decode response body, %w", err), 4124 Snapshot: snapshot.Bytes(), 4125 } 4126 return out, metadata, err 4127 } 4128 4129 err = awsRestjson1_deserializeOpDocumentUpdateBackendAuthOutput(&output, shape) 4130 if err != nil { 4131 var snapshot bytes.Buffer 4132 io.Copy(&snapshot, ringBuffer) 4133 return out, metadata, &smithy.DeserializationError{ 4134 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4135 Snapshot: snapshot.Bytes(), 4136 } 4137 } 4138 4139 return out, metadata, err 4140} 4141 4142func awsRestjson1_deserializeOpErrorUpdateBackendAuth(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4143 var errorBuffer bytes.Buffer 4144 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4145 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4146 } 4147 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4148 4149 errorCode := "UnknownError" 4150 errorMessage := errorCode 4151 4152 code := response.Header.Get("X-Amzn-ErrorType") 4153 if len(code) != 0 { 4154 errorCode = restjson.SanitizeErrorCode(code) 4155 } 4156 4157 var buff [1024]byte 4158 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4159 4160 body := io.TeeReader(errorBody, ringBuffer) 4161 decoder := json.NewDecoder(body) 4162 decoder.UseNumber() 4163 code, message, err := restjson.GetErrorInfo(decoder) 4164 if err != nil { 4165 var snapshot bytes.Buffer 4166 io.Copy(&snapshot, ringBuffer) 4167 err = &smithy.DeserializationError{ 4168 Err: fmt.Errorf("failed to decode response body, %w", err), 4169 Snapshot: snapshot.Bytes(), 4170 } 4171 return err 4172 } 4173 4174 errorBody.Seek(0, io.SeekStart) 4175 if len(code) != 0 { 4176 errorCode = restjson.SanitizeErrorCode(code) 4177 } 4178 if len(message) != 0 { 4179 errorMessage = message 4180 } 4181 4182 switch { 4183 case strings.EqualFold("BadRequestException", errorCode): 4184 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4185 4186 case strings.EqualFold("GatewayTimeoutException", errorCode): 4187 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 4188 4189 case strings.EqualFold("NotFoundException", errorCode): 4190 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4191 4192 case strings.EqualFold("TooManyRequestsException", errorCode): 4193 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4194 4195 default: 4196 genericError := &smithy.GenericAPIError{ 4197 Code: errorCode, 4198 Message: errorMessage, 4199 } 4200 return genericError 4201 4202 } 4203} 4204 4205func awsRestjson1_deserializeOpDocumentUpdateBackendAuthOutput(v **UpdateBackendAuthOutput, value interface{}) error { 4206 if v == nil { 4207 return fmt.Errorf("unexpected nil of type %T", v) 4208 } 4209 if value == nil { 4210 return nil 4211 } 4212 4213 shape, ok := value.(map[string]interface{}) 4214 if !ok { 4215 return fmt.Errorf("unexpected JSON type %v", value) 4216 } 4217 4218 var sv *UpdateBackendAuthOutput 4219 if *v == nil { 4220 sv = &UpdateBackendAuthOutput{} 4221 } else { 4222 sv = *v 4223 } 4224 4225 for key, value := range shape { 4226 switch key { 4227 case "appId": 4228 if value != nil { 4229 jtv, ok := value.(string) 4230 if !ok { 4231 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4232 } 4233 sv.AppId = ptr.String(jtv) 4234 } 4235 4236 case "backendEnvironmentName": 4237 if value != nil { 4238 jtv, ok := value.(string) 4239 if !ok { 4240 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4241 } 4242 sv.BackendEnvironmentName = ptr.String(jtv) 4243 } 4244 4245 case "error": 4246 if value != nil { 4247 jtv, ok := value.(string) 4248 if !ok { 4249 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4250 } 4251 sv.Error = ptr.String(jtv) 4252 } 4253 4254 case "jobId": 4255 if value != nil { 4256 jtv, ok := value.(string) 4257 if !ok { 4258 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4259 } 4260 sv.JobId = ptr.String(jtv) 4261 } 4262 4263 case "operation": 4264 if value != nil { 4265 jtv, ok := value.(string) 4266 if !ok { 4267 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4268 } 4269 sv.Operation = ptr.String(jtv) 4270 } 4271 4272 case "status": 4273 if value != nil { 4274 jtv, ok := value.(string) 4275 if !ok { 4276 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4277 } 4278 sv.Status = ptr.String(jtv) 4279 } 4280 4281 default: 4282 _, _ = key, value 4283 4284 } 4285 } 4286 *v = sv 4287 return nil 4288} 4289 4290type awsRestjson1_deserializeOpUpdateBackendConfig struct { 4291} 4292 4293func (*awsRestjson1_deserializeOpUpdateBackendConfig) ID() string { 4294 return "OperationDeserializer" 4295} 4296 4297func (m *awsRestjson1_deserializeOpUpdateBackendConfig) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4298 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4299) { 4300 out, metadata, err = next.HandleDeserialize(ctx, in) 4301 if err != nil { 4302 return out, metadata, err 4303 } 4304 4305 response, ok := out.RawResponse.(*smithyhttp.Response) 4306 if !ok { 4307 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4308 } 4309 4310 if response.StatusCode < 200 || response.StatusCode >= 300 { 4311 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBackendConfig(response, &metadata) 4312 } 4313 output := &UpdateBackendConfigOutput{} 4314 out.Result = output 4315 4316 var buff [1024]byte 4317 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4318 4319 body := io.TeeReader(response.Body, ringBuffer) 4320 4321 decoder := json.NewDecoder(body) 4322 decoder.UseNumber() 4323 var shape interface{} 4324 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4325 var snapshot bytes.Buffer 4326 io.Copy(&snapshot, ringBuffer) 4327 err = &smithy.DeserializationError{ 4328 Err: fmt.Errorf("failed to decode response body, %w", err), 4329 Snapshot: snapshot.Bytes(), 4330 } 4331 return out, metadata, err 4332 } 4333 4334 err = awsRestjson1_deserializeOpDocumentUpdateBackendConfigOutput(&output, shape) 4335 if err != nil { 4336 var snapshot bytes.Buffer 4337 io.Copy(&snapshot, ringBuffer) 4338 return out, metadata, &smithy.DeserializationError{ 4339 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4340 Snapshot: snapshot.Bytes(), 4341 } 4342 } 4343 4344 return out, metadata, err 4345} 4346 4347func awsRestjson1_deserializeOpErrorUpdateBackendConfig(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4348 var errorBuffer bytes.Buffer 4349 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4350 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4351 } 4352 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4353 4354 errorCode := "UnknownError" 4355 errorMessage := errorCode 4356 4357 code := response.Header.Get("X-Amzn-ErrorType") 4358 if len(code) != 0 { 4359 errorCode = restjson.SanitizeErrorCode(code) 4360 } 4361 4362 var buff [1024]byte 4363 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4364 4365 body := io.TeeReader(errorBody, ringBuffer) 4366 decoder := json.NewDecoder(body) 4367 decoder.UseNumber() 4368 code, message, err := restjson.GetErrorInfo(decoder) 4369 if err != nil { 4370 var snapshot bytes.Buffer 4371 io.Copy(&snapshot, ringBuffer) 4372 err = &smithy.DeserializationError{ 4373 Err: fmt.Errorf("failed to decode response body, %w", err), 4374 Snapshot: snapshot.Bytes(), 4375 } 4376 return err 4377 } 4378 4379 errorBody.Seek(0, io.SeekStart) 4380 if len(code) != 0 { 4381 errorCode = restjson.SanitizeErrorCode(code) 4382 } 4383 if len(message) != 0 { 4384 errorMessage = message 4385 } 4386 4387 switch { 4388 case strings.EqualFold("BadRequestException", errorCode): 4389 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4390 4391 case strings.EqualFold("GatewayTimeoutException", errorCode): 4392 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 4393 4394 case strings.EqualFold("NotFoundException", errorCode): 4395 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4396 4397 case strings.EqualFold("TooManyRequestsException", errorCode): 4398 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4399 4400 default: 4401 genericError := &smithy.GenericAPIError{ 4402 Code: errorCode, 4403 Message: errorMessage, 4404 } 4405 return genericError 4406 4407 } 4408} 4409 4410func awsRestjson1_deserializeOpDocumentUpdateBackendConfigOutput(v **UpdateBackendConfigOutput, value interface{}) error { 4411 if v == nil { 4412 return fmt.Errorf("unexpected nil of type %T", v) 4413 } 4414 if value == nil { 4415 return nil 4416 } 4417 4418 shape, ok := value.(map[string]interface{}) 4419 if !ok { 4420 return fmt.Errorf("unexpected JSON type %v", value) 4421 } 4422 4423 var sv *UpdateBackendConfigOutput 4424 if *v == nil { 4425 sv = &UpdateBackendConfigOutput{} 4426 } else { 4427 sv = *v 4428 } 4429 4430 for key, value := range shape { 4431 switch key { 4432 case "appId": 4433 if value != nil { 4434 jtv, ok := value.(string) 4435 if !ok { 4436 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4437 } 4438 sv.AppId = ptr.String(jtv) 4439 } 4440 4441 case "backendManagerAppId": 4442 if value != nil { 4443 jtv, ok := value.(string) 4444 if !ok { 4445 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4446 } 4447 sv.BackendManagerAppId = ptr.String(jtv) 4448 } 4449 4450 case "error": 4451 if value != nil { 4452 jtv, ok := value.(string) 4453 if !ok { 4454 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4455 } 4456 sv.Error = ptr.String(jtv) 4457 } 4458 4459 case "loginAuthConfig": 4460 if err := awsRestjson1_deserializeDocumentLoginAuthConfigReqObj(&sv.LoginAuthConfig, value); err != nil { 4461 return err 4462 } 4463 4464 default: 4465 _, _ = key, value 4466 4467 } 4468 } 4469 *v = sv 4470 return nil 4471} 4472 4473type awsRestjson1_deserializeOpUpdateBackendJob struct { 4474} 4475 4476func (*awsRestjson1_deserializeOpUpdateBackendJob) ID() string { 4477 return "OperationDeserializer" 4478} 4479 4480func (m *awsRestjson1_deserializeOpUpdateBackendJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4481 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4482) { 4483 out, metadata, err = next.HandleDeserialize(ctx, in) 4484 if err != nil { 4485 return out, metadata, err 4486 } 4487 4488 response, ok := out.RawResponse.(*smithyhttp.Response) 4489 if !ok { 4490 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4491 } 4492 4493 if response.StatusCode < 200 || response.StatusCode >= 300 { 4494 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBackendJob(response, &metadata) 4495 } 4496 output := &UpdateBackendJobOutput{} 4497 out.Result = output 4498 4499 var buff [1024]byte 4500 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4501 4502 body := io.TeeReader(response.Body, ringBuffer) 4503 4504 decoder := json.NewDecoder(body) 4505 decoder.UseNumber() 4506 var shape interface{} 4507 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4508 var snapshot bytes.Buffer 4509 io.Copy(&snapshot, ringBuffer) 4510 err = &smithy.DeserializationError{ 4511 Err: fmt.Errorf("failed to decode response body, %w", err), 4512 Snapshot: snapshot.Bytes(), 4513 } 4514 return out, metadata, err 4515 } 4516 4517 err = awsRestjson1_deserializeOpDocumentUpdateBackendJobOutput(&output, shape) 4518 if err != nil { 4519 var snapshot bytes.Buffer 4520 io.Copy(&snapshot, ringBuffer) 4521 return out, metadata, &smithy.DeserializationError{ 4522 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4523 Snapshot: snapshot.Bytes(), 4524 } 4525 } 4526 4527 return out, metadata, err 4528} 4529 4530func awsRestjson1_deserializeOpErrorUpdateBackendJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4531 var errorBuffer bytes.Buffer 4532 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4533 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4534 } 4535 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4536 4537 errorCode := "UnknownError" 4538 errorMessage := errorCode 4539 4540 code := response.Header.Get("X-Amzn-ErrorType") 4541 if len(code) != 0 { 4542 errorCode = restjson.SanitizeErrorCode(code) 4543 } 4544 4545 var buff [1024]byte 4546 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4547 4548 body := io.TeeReader(errorBody, ringBuffer) 4549 decoder := json.NewDecoder(body) 4550 decoder.UseNumber() 4551 code, message, err := restjson.GetErrorInfo(decoder) 4552 if err != nil { 4553 var snapshot bytes.Buffer 4554 io.Copy(&snapshot, ringBuffer) 4555 err = &smithy.DeserializationError{ 4556 Err: fmt.Errorf("failed to decode response body, %w", err), 4557 Snapshot: snapshot.Bytes(), 4558 } 4559 return err 4560 } 4561 4562 errorBody.Seek(0, io.SeekStart) 4563 if len(code) != 0 { 4564 errorCode = restjson.SanitizeErrorCode(code) 4565 } 4566 if len(message) != 0 { 4567 errorMessage = message 4568 } 4569 4570 switch { 4571 case strings.EqualFold("BadRequestException", errorCode): 4572 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4573 4574 case strings.EqualFold("GatewayTimeoutException", errorCode): 4575 return awsRestjson1_deserializeErrorGatewayTimeoutException(response, errorBody) 4576 4577 case strings.EqualFold("NotFoundException", errorCode): 4578 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4579 4580 case strings.EqualFold("TooManyRequestsException", errorCode): 4581 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4582 4583 default: 4584 genericError := &smithy.GenericAPIError{ 4585 Code: errorCode, 4586 Message: errorMessage, 4587 } 4588 return genericError 4589 4590 } 4591} 4592 4593func awsRestjson1_deserializeOpDocumentUpdateBackendJobOutput(v **UpdateBackendJobOutput, value interface{}) error { 4594 if v == nil { 4595 return fmt.Errorf("unexpected nil of type %T", v) 4596 } 4597 if value == nil { 4598 return nil 4599 } 4600 4601 shape, ok := value.(map[string]interface{}) 4602 if !ok { 4603 return fmt.Errorf("unexpected JSON type %v", value) 4604 } 4605 4606 var sv *UpdateBackendJobOutput 4607 if *v == nil { 4608 sv = &UpdateBackendJobOutput{} 4609 } else { 4610 sv = *v 4611 } 4612 4613 for key, value := range shape { 4614 switch key { 4615 case "appId": 4616 if value != nil { 4617 jtv, ok := value.(string) 4618 if !ok { 4619 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4620 } 4621 sv.AppId = ptr.String(jtv) 4622 } 4623 4624 case "backendEnvironmentName": 4625 if value != nil { 4626 jtv, ok := value.(string) 4627 if !ok { 4628 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4629 } 4630 sv.BackendEnvironmentName = ptr.String(jtv) 4631 } 4632 4633 case "createTime": 4634 if value != nil { 4635 jtv, ok := value.(string) 4636 if !ok { 4637 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4638 } 4639 sv.CreateTime = ptr.String(jtv) 4640 } 4641 4642 case "error": 4643 if value != nil { 4644 jtv, ok := value.(string) 4645 if !ok { 4646 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4647 } 4648 sv.Error = ptr.String(jtv) 4649 } 4650 4651 case "jobId": 4652 if value != nil { 4653 jtv, ok := value.(string) 4654 if !ok { 4655 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4656 } 4657 sv.JobId = ptr.String(jtv) 4658 } 4659 4660 case "operation": 4661 if value != nil { 4662 jtv, ok := value.(string) 4663 if !ok { 4664 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4665 } 4666 sv.Operation = ptr.String(jtv) 4667 } 4668 4669 case "status": 4670 if value != nil { 4671 jtv, ok := value.(string) 4672 if !ok { 4673 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4674 } 4675 sv.Status = ptr.String(jtv) 4676 } 4677 4678 case "updateTime": 4679 if value != nil { 4680 jtv, ok := value.(string) 4681 if !ok { 4682 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4683 } 4684 sv.UpdateTime = ptr.String(jtv) 4685 } 4686 4687 default: 4688 _, _ = key, value 4689 4690 } 4691 } 4692 *v = sv 4693 return nil 4694} 4695 4696func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4697 output := &types.BadRequestException{} 4698 var buff [1024]byte 4699 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4700 4701 body := io.TeeReader(errorBody, ringBuffer) 4702 decoder := json.NewDecoder(body) 4703 decoder.UseNumber() 4704 var shape interface{} 4705 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4706 var snapshot bytes.Buffer 4707 io.Copy(&snapshot, ringBuffer) 4708 err = &smithy.DeserializationError{ 4709 Err: fmt.Errorf("failed to decode response body, %w", err), 4710 Snapshot: snapshot.Bytes(), 4711 } 4712 return err 4713 } 4714 4715 err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape) 4716 4717 if err != nil { 4718 var snapshot bytes.Buffer 4719 io.Copy(&snapshot, ringBuffer) 4720 err = &smithy.DeserializationError{ 4721 Err: fmt.Errorf("failed to decode response body, %w", err), 4722 Snapshot: snapshot.Bytes(), 4723 } 4724 return err 4725 } 4726 4727 errorBody.Seek(0, io.SeekStart) 4728 4729 return output 4730} 4731 4732func awsRestjson1_deserializeErrorGatewayTimeoutException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4733 output := &types.GatewayTimeoutException{} 4734 var buff [1024]byte 4735 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4736 4737 body := io.TeeReader(errorBody, ringBuffer) 4738 decoder := json.NewDecoder(body) 4739 decoder.UseNumber() 4740 var shape interface{} 4741 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4742 var snapshot bytes.Buffer 4743 io.Copy(&snapshot, ringBuffer) 4744 err = &smithy.DeserializationError{ 4745 Err: fmt.Errorf("failed to decode response body, %w", err), 4746 Snapshot: snapshot.Bytes(), 4747 } 4748 return err 4749 } 4750 4751 err := awsRestjson1_deserializeDocumentGatewayTimeoutException(&output, shape) 4752 4753 if err != nil { 4754 var snapshot bytes.Buffer 4755 io.Copy(&snapshot, ringBuffer) 4756 err = &smithy.DeserializationError{ 4757 Err: fmt.Errorf("failed to decode response body, %w", err), 4758 Snapshot: snapshot.Bytes(), 4759 } 4760 return err 4761 } 4762 4763 errorBody.Seek(0, io.SeekStart) 4764 4765 return output 4766} 4767 4768func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4769 output := &types.NotFoundException{} 4770 var buff [1024]byte 4771 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4772 4773 body := io.TeeReader(errorBody, ringBuffer) 4774 decoder := json.NewDecoder(body) 4775 decoder.UseNumber() 4776 var shape interface{} 4777 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4778 var snapshot bytes.Buffer 4779 io.Copy(&snapshot, ringBuffer) 4780 err = &smithy.DeserializationError{ 4781 Err: fmt.Errorf("failed to decode response body, %w", err), 4782 Snapshot: snapshot.Bytes(), 4783 } 4784 return err 4785 } 4786 4787 err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape) 4788 4789 if err != nil { 4790 var snapshot bytes.Buffer 4791 io.Copy(&snapshot, ringBuffer) 4792 err = &smithy.DeserializationError{ 4793 Err: fmt.Errorf("failed to decode response body, %w", err), 4794 Snapshot: snapshot.Bytes(), 4795 } 4796 return err 4797 } 4798 4799 errorBody.Seek(0, io.SeekStart) 4800 4801 return output 4802} 4803 4804func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4805 output := &types.TooManyRequestsException{} 4806 var buff [1024]byte 4807 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4808 4809 body := io.TeeReader(errorBody, ringBuffer) 4810 decoder := json.NewDecoder(body) 4811 decoder.UseNumber() 4812 var shape interface{} 4813 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4814 var snapshot bytes.Buffer 4815 io.Copy(&snapshot, ringBuffer) 4816 err = &smithy.DeserializationError{ 4817 Err: fmt.Errorf("failed to decode response body, %w", err), 4818 Snapshot: snapshot.Bytes(), 4819 } 4820 return err 4821 } 4822 4823 err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape) 4824 4825 if err != nil { 4826 var snapshot bytes.Buffer 4827 io.Copy(&snapshot, ringBuffer) 4828 err = &smithy.DeserializationError{ 4829 Err: fmt.Errorf("failed to decode response body, %w", err), 4830 Snapshot: snapshot.Bytes(), 4831 } 4832 return err 4833 } 4834 4835 errorBody.Seek(0, io.SeekStart) 4836 4837 return output 4838} 4839 4840func awsRestjson1_deserializeDocumentBackendAPIAppSyncAuthSettings(v **types.BackendAPIAppSyncAuthSettings, value interface{}) error { 4841 if v == nil { 4842 return fmt.Errorf("unexpected nil of type %T", v) 4843 } 4844 if value == nil { 4845 return nil 4846 } 4847 4848 shape, ok := value.(map[string]interface{}) 4849 if !ok { 4850 return fmt.Errorf("unexpected JSON type %v", value) 4851 } 4852 4853 var sv *types.BackendAPIAppSyncAuthSettings 4854 if *v == nil { 4855 sv = &types.BackendAPIAppSyncAuthSettings{} 4856 } else { 4857 sv = *v 4858 } 4859 4860 for key, value := range shape { 4861 switch key { 4862 case "cognitoUserPoolId": 4863 if value != nil { 4864 jtv, ok := value.(string) 4865 if !ok { 4866 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4867 } 4868 sv.CognitoUserPoolId = ptr.String(jtv) 4869 } 4870 4871 case "description": 4872 if value != nil { 4873 jtv, ok := value.(string) 4874 if !ok { 4875 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4876 } 4877 sv.Description = ptr.String(jtv) 4878 } 4879 4880 case "expirationTime": 4881 if value != nil { 4882 jtv, ok := value.(json.Number) 4883 if !ok { 4884 return fmt.Errorf("expected __double to be json.Number, got %T instead", value) 4885 } 4886 f64, err := jtv.Float64() 4887 if err != nil { 4888 return err 4889 } 4890 sv.ExpirationTime = f64 4891 } 4892 4893 case "openIDAuthTTL": 4894 if value != nil { 4895 jtv, ok := value.(string) 4896 if !ok { 4897 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4898 } 4899 sv.OpenIDAuthTTL = ptr.String(jtv) 4900 } 4901 4902 case "openIDClientId": 4903 if value != nil { 4904 jtv, ok := value.(string) 4905 if !ok { 4906 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4907 } 4908 sv.OpenIDClientId = ptr.String(jtv) 4909 } 4910 4911 case "openIDIatTTL": 4912 if value != nil { 4913 jtv, ok := value.(string) 4914 if !ok { 4915 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4916 } 4917 sv.OpenIDIatTTL = ptr.String(jtv) 4918 } 4919 4920 case "openIDIssueURL": 4921 if value != nil { 4922 jtv, ok := value.(string) 4923 if !ok { 4924 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4925 } 4926 sv.OpenIDIssueURL = ptr.String(jtv) 4927 } 4928 4929 case "openIDProviderName": 4930 if value != nil { 4931 jtv, ok := value.(string) 4932 if !ok { 4933 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4934 } 4935 sv.OpenIDProviderName = ptr.String(jtv) 4936 } 4937 4938 default: 4939 _, _ = key, value 4940 4941 } 4942 } 4943 *v = sv 4944 return nil 4945} 4946 4947func awsRestjson1_deserializeDocumentBackendAPIAuthType(v **types.BackendAPIAuthType, value interface{}) error { 4948 if v == nil { 4949 return fmt.Errorf("unexpected nil of type %T", v) 4950 } 4951 if value == nil { 4952 return nil 4953 } 4954 4955 shape, ok := value.(map[string]interface{}) 4956 if !ok { 4957 return fmt.Errorf("unexpected JSON type %v", value) 4958 } 4959 4960 var sv *types.BackendAPIAuthType 4961 if *v == nil { 4962 sv = &types.BackendAPIAuthType{} 4963 } else { 4964 sv = *v 4965 } 4966 4967 for key, value := range shape { 4968 switch key { 4969 case "mode": 4970 if value != nil { 4971 jtv, ok := value.(string) 4972 if !ok { 4973 return fmt.Errorf("expected Mode to be of type string, got %T instead", value) 4974 } 4975 sv.Mode = types.Mode(jtv) 4976 } 4977 4978 case "settings": 4979 if err := awsRestjson1_deserializeDocumentBackendAPIAppSyncAuthSettings(&sv.Settings, value); err != nil { 4980 return err 4981 } 4982 4983 default: 4984 _, _ = key, value 4985 4986 } 4987 } 4988 *v = sv 4989 return nil 4990} 4991 4992func awsRestjson1_deserializeDocumentBackendAPIConflictResolution(v **types.BackendAPIConflictResolution, value interface{}) error { 4993 if v == nil { 4994 return fmt.Errorf("unexpected nil of type %T", v) 4995 } 4996 if value == nil { 4997 return nil 4998 } 4999 5000 shape, ok := value.(map[string]interface{}) 5001 if !ok { 5002 return fmt.Errorf("unexpected JSON type %v", value) 5003 } 5004 5005 var sv *types.BackendAPIConflictResolution 5006 if *v == nil { 5007 sv = &types.BackendAPIConflictResolution{} 5008 } else { 5009 sv = *v 5010 } 5011 5012 for key, value := range shape { 5013 switch key { 5014 case "resolutionStrategy": 5015 if value != nil { 5016 jtv, ok := value.(string) 5017 if !ok { 5018 return fmt.Errorf("expected ResolutionStrategy to be of type string, got %T instead", value) 5019 } 5020 sv.ResolutionStrategy = types.ResolutionStrategy(jtv) 5021 } 5022 5023 default: 5024 _, _ = key, value 5025 5026 } 5027 } 5028 *v = sv 5029 return nil 5030} 5031 5032func awsRestjson1_deserializeDocumentBackendAPIResourceConfig(v **types.BackendAPIResourceConfig, value interface{}) error { 5033 if v == nil { 5034 return fmt.Errorf("unexpected nil of type %T", v) 5035 } 5036 if value == nil { 5037 return nil 5038 } 5039 5040 shape, ok := value.(map[string]interface{}) 5041 if !ok { 5042 return fmt.Errorf("unexpected JSON type %v", value) 5043 } 5044 5045 var sv *types.BackendAPIResourceConfig 5046 if *v == nil { 5047 sv = &types.BackendAPIResourceConfig{} 5048 } else { 5049 sv = *v 5050 } 5051 5052 for key, value := range shape { 5053 switch key { 5054 case "additionalAuthTypes": 5055 if err := awsRestjson1_deserializeDocumentListOfBackendAPIAuthType(&sv.AdditionalAuthTypes, value); err != nil { 5056 return err 5057 } 5058 5059 case "apiName": 5060 if value != nil { 5061 jtv, ok := value.(string) 5062 if !ok { 5063 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5064 } 5065 sv.ApiName = ptr.String(jtv) 5066 } 5067 5068 case "conflictResolution": 5069 if err := awsRestjson1_deserializeDocumentBackendAPIConflictResolution(&sv.ConflictResolution, value); err != nil { 5070 return err 5071 } 5072 5073 case "defaultAuthType": 5074 if err := awsRestjson1_deserializeDocumentBackendAPIAuthType(&sv.DefaultAuthType, value); err != nil { 5075 return err 5076 } 5077 5078 case "service": 5079 if value != nil { 5080 jtv, ok := value.(string) 5081 if !ok { 5082 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5083 } 5084 sv.Service = ptr.String(jtv) 5085 } 5086 5087 case "transformSchema": 5088 if value != nil { 5089 jtv, ok := value.(string) 5090 if !ok { 5091 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5092 } 5093 sv.TransformSchema = ptr.String(jtv) 5094 } 5095 5096 default: 5097 _, _ = key, value 5098 5099 } 5100 } 5101 *v = sv 5102 return nil 5103} 5104 5105func awsRestjson1_deserializeDocumentBackendAuthSocialProviderConfig(v **types.BackendAuthSocialProviderConfig, value interface{}) error { 5106 if v == nil { 5107 return fmt.Errorf("unexpected nil of type %T", v) 5108 } 5109 if value == nil { 5110 return nil 5111 } 5112 5113 shape, ok := value.(map[string]interface{}) 5114 if !ok { 5115 return fmt.Errorf("unexpected JSON type %v", value) 5116 } 5117 5118 var sv *types.BackendAuthSocialProviderConfig 5119 if *v == nil { 5120 sv = &types.BackendAuthSocialProviderConfig{} 5121 } else { 5122 sv = *v 5123 } 5124 5125 for key, value := range shape { 5126 switch key { 5127 case "client_id": 5128 if value != nil { 5129 jtv, ok := value.(string) 5130 if !ok { 5131 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5132 } 5133 sv.ClientId = ptr.String(jtv) 5134 } 5135 5136 case "client_secret": 5137 if value != nil { 5138 jtv, ok := value.(string) 5139 if !ok { 5140 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5141 } 5142 sv.ClientSecret = ptr.String(jtv) 5143 } 5144 5145 default: 5146 _, _ = key, value 5147 5148 } 5149 } 5150 *v = sv 5151 return nil 5152} 5153 5154func awsRestjson1_deserializeDocumentBackendJobRespObj(v **types.BackendJobRespObj, value interface{}) error { 5155 if v == nil { 5156 return fmt.Errorf("unexpected nil of type %T", v) 5157 } 5158 if value == nil { 5159 return nil 5160 } 5161 5162 shape, ok := value.(map[string]interface{}) 5163 if !ok { 5164 return fmt.Errorf("unexpected JSON type %v", value) 5165 } 5166 5167 var sv *types.BackendJobRespObj 5168 if *v == nil { 5169 sv = &types.BackendJobRespObj{} 5170 } else { 5171 sv = *v 5172 } 5173 5174 for key, value := range shape { 5175 switch key { 5176 case "appId": 5177 if value != nil { 5178 jtv, ok := value.(string) 5179 if !ok { 5180 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5181 } 5182 sv.AppId = ptr.String(jtv) 5183 } 5184 5185 case "backendEnvironmentName": 5186 if value != nil { 5187 jtv, ok := value.(string) 5188 if !ok { 5189 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5190 } 5191 sv.BackendEnvironmentName = ptr.String(jtv) 5192 } 5193 5194 case "createTime": 5195 if value != nil { 5196 jtv, ok := value.(string) 5197 if !ok { 5198 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5199 } 5200 sv.CreateTime = ptr.String(jtv) 5201 } 5202 5203 case "error": 5204 if value != nil { 5205 jtv, ok := value.(string) 5206 if !ok { 5207 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5208 } 5209 sv.Error = ptr.String(jtv) 5210 } 5211 5212 case "jobId": 5213 if value != nil { 5214 jtv, ok := value.(string) 5215 if !ok { 5216 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5217 } 5218 sv.JobId = ptr.String(jtv) 5219 } 5220 5221 case "operation": 5222 if value != nil { 5223 jtv, ok := value.(string) 5224 if !ok { 5225 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5226 } 5227 sv.Operation = ptr.String(jtv) 5228 } 5229 5230 case "status": 5231 if value != nil { 5232 jtv, ok := value.(string) 5233 if !ok { 5234 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5235 } 5236 sv.Status = ptr.String(jtv) 5237 } 5238 5239 case "updateTime": 5240 if value != nil { 5241 jtv, ok := value.(string) 5242 if !ok { 5243 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5244 } 5245 sv.UpdateTime = ptr.String(jtv) 5246 } 5247 5248 default: 5249 _, _ = key, value 5250 5251 } 5252 } 5253 *v = sv 5254 return nil 5255} 5256 5257func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 5258 if v == nil { 5259 return fmt.Errorf("unexpected nil of type %T", v) 5260 } 5261 if value == nil { 5262 return nil 5263 } 5264 5265 shape, ok := value.(map[string]interface{}) 5266 if !ok { 5267 return fmt.Errorf("unexpected JSON type %v", value) 5268 } 5269 5270 var sv *types.BadRequestException 5271 if *v == nil { 5272 sv = &types.BadRequestException{} 5273 } else { 5274 sv = *v 5275 } 5276 5277 for key, value := range shape { 5278 switch key { 5279 case "message": 5280 if value != nil { 5281 jtv, ok := value.(string) 5282 if !ok { 5283 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5284 } 5285 sv.Message = ptr.String(jtv) 5286 } 5287 5288 default: 5289 _, _ = key, value 5290 5291 } 5292 } 5293 *v = sv 5294 return nil 5295} 5296 5297func awsRestjson1_deserializeDocumentCreateBackendAuthForgotPasswordConfig(v **types.CreateBackendAuthForgotPasswordConfig, value interface{}) error { 5298 if v == nil { 5299 return fmt.Errorf("unexpected nil of type %T", v) 5300 } 5301 if value == nil { 5302 return nil 5303 } 5304 5305 shape, ok := value.(map[string]interface{}) 5306 if !ok { 5307 return fmt.Errorf("unexpected JSON type %v", value) 5308 } 5309 5310 var sv *types.CreateBackendAuthForgotPasswordConfig 5311 if *v == nil { 5312 sv = &types.CreateBackendAuthForgotPasswordConfig{} 5313 } else { 5314 sv = *v 5315 } 5316 5317 for key, value := range shape { 5318 switch key { 5319 case "deliveryMethod": 5320 if value != nil { 5321 jtv, ok := value.(string) 5322 if !ok { 5323 return fmt.Errorf("expected DeliveryMethod to be of type string, got %T instead", value) 5324 } 5325 sv.DeliveryMethod = types.DeliveryMethod(jtv) 5326 } 5327 5328 case "emailSettings": 5329 if err := awsRestjson1_deserializeDocumentEmailSettings(&sv.EmailSettings, value); err != nil { 5330 return err 5331 } 5332 5333 case "smsSettings": 5334 if err := awsRestjson1_deserializeDocumentSmsSettings(&sv.SmsSettings, value); err != nil { 5335 return err 5336 } 5337 5338 default: 5339 _, _ = key, value 5340 5341 } 5342 } 5343 *v = sv 5344 return nil 5345} 5346 5347func awsRestjson1_deserializeDocumentCreateBackendAuthIdentityPoolConfig(v **types.CreateBackendAuthIdentityPoolConfig, value interface{}) error { 5348 if v == nil { 5349 return fmt.Errorf("unexpected nil of type %T", v) 5350 } 5351 if value == nil { 5352 return nil 5353 } 5354 5355 shape, ok := value.(map[string]interface{}) 5356 if !ok { 5357 return fmt.Errorf("unexpected JSON type %v", value) 5358 } 5359 5360 var sv *types.CreateBackendAuthIdentityPoolConfig 5361 if *v == nil { 5362 sv = &types.CreateBackendAuthIdentityPoolConfig{} 5363 } else { 5364 sv = *v 5365 } 5366 5367 for key, value := range shape { 5368 switch key { 5369 case "identityPoolName": 5370 if value != nil { 5371 jtv, ok := value.(string) 5372 if !ok { 5373 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5374 } 5375 sv.IdentityPoolName = ptr.String(jtv) 5376 } 5377 5378 case "unauthenticatedLogin": 5379 if value != nil { 5380 jtv, ok := value.(bool) 5381 if !ok { 5382 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 5383 } 5384 sv.UnauthenticatedLogin = jtv 5385 } 5386 5387 default: 5388 _, _ = key, value 5389 5390 } 5391 } 5392 *v = sv 5393 return nil 5394} 5395 5396func awsRestjson1_deserializeDocumentCreateBackendAuthMFAConfig(v **types.CreateBackendAuthMFAConfig, value interface{}) error { 5397 if v == nil { 5398 return fmt.Errorf("unexpected nil of type %T", v) 5399 } 5400 if value == nil { 5401 return nil 5402 } 5403 5404 shape, ok := value.(map[string]interface{}) 5405 if !ok { 5406 return fmt.Errorf("unexpected JSON type %v", value) 5407 } 5408 5409 var sv *types.CreateBackendAuthMFAConfig 5410 if *v == nil { 5411 sv = &types.CreateBackendAuthMFAConfig{} 5412 } else { 5413 sv = *v 5414 } 5415 5416 for key, value := range shape { 5417 switch key { 5418 case "MFAMode": 5419 if value != nil { 5420 jtv, ok := value.(string) 5421 if !ok { 5422 return fmt.Errorf("expected MFAMode to be of type string, got %T instead", value) 5423 } 5424 sv.MFAMode = types.MFAMode(jtv) 5425 } 5426 5427 case "settings": 5428 if err := awsRestjson1_deserializeDocumentSettings(&sv.Settings, value); err != nil { 5429 return err 5430 } 5431 5432 default: 5433 _, _ = key, value 5434 5435 } 5436 } 5437 *v = sv 5438 return nil 5439} 5440 5441func awsRestjson1_deserializeDocumentCreateBackendAuthOAuthConfig(v **types.CreateBackendAuthOAuthConfig, value interface{}) error { 5442 if v == nil { 5443 return fmt.Errorf("unexpected nil of type %T", v) 5444 } 5445 if value == nil { 5446 return nil 5447 } 5448 5449 shape, ok := value.(map[string]interface{}) 5450 if !ok { 5451 return fmt.Errorf("unexpected JSON type %v", value) 5452 } 5453 5454 var sv *types.CreateBackendAuthOAuthConfig 5455 if *v == nil { 5456 sv = &types.CreateBackendAuthOAuthConfig{} 5457 } else { 5458 sv = *v 5459 } 5460 5461 for key, value := range shape { 5462 switch key { 5463 case "domainPrefix": 5464 if value != nil { 5465 jtv, ok := value.(string) 5466 if !ok { 5467 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5468 } 5469 sv.DomainPrefix = ptr.String(jtv) 5470 } 5471 5472 case "oAuthGrantType": 5473 if value != nil { 5474 jtv, ok := value.(string) 5475 if !ok { 5476 return fmt.Errorf("expected OAuthGrantType to be of type string, got %T instead", value) 5477 } 5478 sv.OAuthGrantType = types.OAuthGrantType(jtv) 5479 } 5480 5481 case "oAuthScopes": 5482 if err := awsRestjson1_deserializeDocumentListOfOAuthScopesElement(&sv.OAuthScopes, value); err != nil { 5483 return err 5484 } 5485 5486 case "redirectSignInURIs": 5487 if err := awsRestjson1_deserializeDocumentListOf__string(&sv.RedirectSignInURIs, value); err != nil { 5488 return err 5489 } 5490 5491 case "redirectSignOutURIs": 5492 if err := awsRestjson1_deserializeDocumentListOf__string(&sv.RedirectSignOutURIs, value); err != nil { 5493 return err 5494 } 5495 5496 case "socialProviderSettings": 5497 if err := awsRestjson1_deserializeDocumentSocialProviderSettings(&sv.SocialProviderSettings, value); err != nil { 5498 return err 5499 } 5500 5501 default: 5502 _, _ = key, value 5503 5504 } 5505 } 5506 *v = sv 5507 return nil 5508} 5509 5510func awsRestjson1_deserializeDocumentCreateBackendAuthPasswordPolicyConfig(v **types.CreateBackendAuthPasswordPolicyConfig, value interface{}) error { 5511 if v == nil { 5512 return fmt.Errorf("unexpected nil of type %T", v) 5513 } 5514 if value == nil { 5515 return nil 5516 } 5517 5518 shape, ok := value.(map[string]interface{}) 5519 if !ok { 5520 return fmt.Errorf("unexpected JSON type %v", value) 5521 } 5522 5523 var sv *types.CreateBackendAuthPasswordPolicyConfig 5524 if *v == nil { 5525 sv = &types.CreateBackendAuthPasswordPolicyConfig{} 5526 } else { 5527 sv = *v 5528 } 5529 5530 for key, value := range shape { 5531 switch key { 5532 case "additionalConstraints": 5533 if err := awsRestjson1_deserializeDocumentListOfAdditionalConstraintsElement(&sv.AdditionalConstraints, value); err != nil { 5534 return err 5535 } 5536 5537 case "minimumLength": 5538 if value != nil { 5539 jtv, ok := value.(json.Number) 5540 if !ok { 5541 return fmt.Errorf("expected __double to be json.Number, got %T instead", value) 5542 } 5543 f64, err := jtv.Float64() 5544 if err != nil { 5545 return err 5546 } 5547 sv.MinimumLength = f64 5548 } 5549 5550 default: 5551 _, _ = key, value 5552 5553 } 5554 } 5555 *v = sv 5556 return nil 5557} 5558 5559func awsRestjson1_deserializeDocumentCreateBackendAuthResourceConfig(v **types.CreateBackendAuthResourceConfig, value interface{}) error { 5560 if v == nil { 5561 return fmt.Errorf("unexpected nil of type %T", v) 5562 } 5563 if value == nil { 5564 return nil 5565 } 5566 5567 shape, ok := value.(map[string]interface{}) 5568 if !ok { 5569 return fmt.Errorf("unexpected JSON type %v", value) 5570 } 5571 5572 var sv *types.CreateBackendAuthResourceConfig 5573 if *v == nil { 5574 sv = &types.CreateBackendAuthResourceConfig{} 5575 } else { 5576 sv = *v 5577 } 5578 5579 for key, value := range shape { 5580 switch key { 5581 case "authResources": 5582 if value != nil { 5583 jtv, ok := value.(string) 5584 if !ok { 5585 return fmt.Errorf("expected AuthResources to be of type string, got %T instead", value) 5586 } 5587 sv.AuthResources = types.AuthResources(jtv) 5588 } 5589 5590 case "identityPoolConfigs": 5591 if err := awsRestjson1_deserializeDocumentCreateBackendAuthIdentityPoolConfig(&sv.IdentityPoolConfigs, value); err != nil { 5592 return err 5593 } 5594 5595 case "service": 5596 if value != nil { 5597 jtv, ok := value.(string) 5598 if !ok { 5599 return fmt.Errorf("expected Service to be of type string, got %T instead", value) 5600 } 5601 sv.Service = types.Service(jtv) 5602 } 5603 5604 case "userPoolConfigs": 5605 if err := awsRestjson1_deserializeDocumentCreateBackendAuthUserPoolConfig(&sv.UserPoolConfigs, value); err != nil { 5606 return err 5607 } 5608 5609 default: 5610 _, _ = key, value 5611 5612 } 5613 } 5614 *v = sv 5615 return nil 5616} 5617 5618func awsRestjson1_deserializeDocumentCreateBackendAuthUserPoolConfig(v **types.CreateBackendAuthUserPoolConfig, value interface{}) error { 5619 if v == nil { 5620 return fmt.Errorf("unexpected nil of type %T", v) 5621 } 5622 if value == nil { 5623 return nil 5624 } 5625 5626 shape, ok := value.(map[string]interface{}) 5627 if !ok { 5628 return fmt.Errorf("unexpected JSON type %v", value) 5629 } 5630 5631 var sv *types.CreateBackendAuthUserPoolConfig 5632 if *v == nil { 5633 sv = &types.CreateBackendAuthUserPoolConfig{} 5634 } else { 5635 sv = *v 5636 } 5637 5638 for key, value := range shape { 5639 switch key { 5640 case "forgotPassword": 5641 if err := awsRestjson1_deserializeDocumentCreateBackendAuthForgotPasswordConfig(&sv.ForgotPassword, value); err != nil { 5642 return err 5643 } 5644 5645 case "mfa": 5646 if err := awsRestjson1_deserializeDocumentCreateBackendAuthMFAConfig(&sv.Mfa, value); err != nil { 5647 return err 5648 } 5649 5650 case "oAuth": 5651 if err := awsRestjson1_deserializeDocumentCreateBackendAuthOAuthConfig(&sv.OAuth, value); err != nil { 5652 return err 5653 } 5654 5655 case "passwordPolicy": 5656 if err := awsRestjson1_deserializeDocumentCreateBackendAuthPasswordPolicyConfig(&sv.PasswordPolicy, value); err != nil { 5657 return err 5658 } 5659 5660 case "requiredSignUpAttributes": 5661 if err := awsRestjson1_deserializeDocumentListOfRequiredSignUpAttributesElement(&sv.RequiredSignUpAttributes, value); err != nil { 5662 return err 5663 } 5664 5665 case "signInMethod": 5666 if value != nil { 5667 jtv, ok := value.(string) 5668 if !ok { 5669 return fmt.Errorf("expected SignInMethod to be of type string, got %T instead", value) 5670 } 5671 sv.SignInMethod = types.SignInMethod(jtv) 5672 } 5673 5674 case "userPoolName": 5675 if value != nil { 5676 jtv, ok := value.(string) 5677 if !ok { 5678 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5679 } 5680 sv.UserPoolName = ptr.String(jtv) 5681 } 5682 5683 default: 5684 _, _ = key, value 5685 5686 } 5687 } 5688 *v = sv 5689 return nil 5690} 5691 5692func awsRestjson1_deserializeDocumentEmailSettings(v **types.EmailSettings, value interface{}) error { 5693 if v == nil { 5694 return fmt.Errorf("unexpected nil of type %T", v) 5695 } 5696 if value == nil { 5697 return nil 5698 } 5699 5700 shape, ok := value.(map[string]interface{}) 5701 if !ok { 5702 return fmt.Errorf("unexpected JSON type %v", value) 5703 } 5704 5705 var sv *types.EmailSettings 5706 if *v == nil { 5707 sv = &types.EmailSettings{} 5708 } else { 5709 sv = *v 5710 } 5711 5712 for key, value := range shape { 5713 switch key { 5714 case "emailMessage": 5715 if value != nil { 5716 jtv, ok := value.(string) 5717 if !ok { 5718 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5719 } 5720 sv.EmailMessage = ptr.String(jtv) 5721 } 5722 5723 case "emailSubject": 5724 if value != nil { 5725 jtv, ok := value.(string) 5726 if !ok { 5727 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5728 } 5729 sv.EmailSubject = ptr.String(jtv) 5730 } 5731 5732 default: 5733 _, _ = key, value 5734 5735 } 5736 } 5737 *v = sv 5738 return nil 5739} 5740 5741func awsRestjson1_deserializeDocumentGatewayTimeoutException(v **types.GatewayTimeoutException, value interface{}) error { 5742 if v == nil { 5743 return fmt.Errorf("unexpected nil of type %T", v) 5744 } 5745 if value == nil { 5746 return nil 5747 } 5748 5749 shape, ok := value.(map[string]interface{}) 5750 if !ok { 5751 return fmt.Errorf("unexpected JSON type %v", value) 5752 } 5753 5754 var sv *types.GatewayTimeoutException 5755 if *v == nil { 5756 sv = &types.GatewayTimeoutException{} 5757 } else { 5758 sv = *v 5759 } 5760 5761 for key, value := range shape { 5762 switch key { 5763 case "message": 5764 if value != nil { 5765 jtv, ok := value.(string) 5766 if !ok { 5767 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5768 } 5769 sv.Message = ptr.String(jtv) 5770 } 5771 5772 default: 5773 _, _ = key, value 5774 5775 } 5776 } 5777 *v = sv 5778 return nil 5779} 5780 5781func awsRestjson1_deserializeDocumentListOf__string(v *[]string, value interface{}) error { 5782 if v == nil { 5783 return fmt.Errorf("unexpected nil of type %T", v) 5784 } 5785 if value == nil { 5786 return nil 5787 } 5788 5789 shape, ok := value.([]interface{}) 5790 if !ok { 5791 return fmt.Errorf("unexpected JSON type %v", value) 5792 } 5793 5794 var cv []string 5795 if *v == nil { 5796 cv = []string{} 5797 } else { 5798 cv = *v 5799 } 5800 5801 for _, value := range shape { 5802 var col string 5803 if value != nil { 5804 jtv, ok := value.(string) 5805 if !ok { 5806 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5807 } 5808 col = jtv 5809 } 5810 cv = append(cv, col) 5811 5812 } 5813 *v = cv 5814 return nil 5815} 5816 5817func awsRestjson1_deserializeDocumentListOfAdditionalConstraintsElement(v *[]types.AdditionalConstraintsElement, value interface{}) error { 5818 if v == nil { 5819 return fmt.Errorf("unexpected nil of type %T", v) 5820 } 5821 if value == nil { 5822 return nil 5823 } 5824 5825 shape, ok := value.([]interface{}) 5826 if !ok { 5827 return fmt.Errorf("unexpected JSON type %v", value) 5828 } 5829 5830 var cv []types.AdditionalConstraintsElement 5831 if *v == nil { 5832 cv = []types.AdditionalConstraintsElement{} 5833 } else { 5834 cv = *v 5835 } 5836 5837 for _, value := range shape { 5838 var col types.AdditionalConstraintsElement 5839 if value != nil { 5840 jtv, ok := value.(string) 5841 if !ok { 5842 return fmt.Errorf("expected AdditionalConstraintsElement to be of type string, got %T instead", value) 5843 } 5844 col = types.AdditionalConstraintsElement(jtv) 5845 } 5846 cv = append(cv, col) 5847 5848 } 5849 *v = cv 5850 return nil 5851} 5852 5853func awsRestjson1_deserializeDocumentListOfBackendAPIAuthType(v *[]types.BackendAPIAuthType, value interface{}) error { 5854 if v == nil { 5855 return fmt.Errorf("unexpected nil of type %T", v) 5856 } 5857 if value == nil { 5858 return nil 5859 } 5860 5861 shape, ok := value.([]interface{}) 5862 if !ok { 5863 return fmt.Errorf("unexpected JSON type %v", value) 5864 } 5865 5866 var cv []types.BackendAPIAuthType 5867 if *v == nil { 5868 cv = []types.BackendAPIAuthType{} 5869 } else { 5870 cv = *v 5871 } 5872 5873 for _, value := range shape { 5874 var col types.BackendAPIAuthType 5875 destAddr := &col 5876 if err := awsRestjson1_deserializeDocumentBackendAPIAuthType(&destAddr, value); err != nil { 5877 return err 5878 } 5879 col = *destAddr 5880 cv = append(cv, col) 5881 5882 } 5883 *v = cv 5884 return nil 5885} 5886 5887func awsRestjson1_deserializeDocumentListOfBackendJobRespObj(v *[]types.BackendJobRespObj, value interface{}) error { 5888 if v == nil { 5889 return fmt.Errorf("unexpected nil of type %T", v) 5890 } 5891 if value == nil { 5892 return nil 5893 } 5894 5895 shape, ok := value.([]interface{}) 5896 if !ok { 5897 return fmt.Errorf("unexpected JSON type %v", value) 5898 } 5899 5900 var cv []types.BackendJobRespObj 5901 if *v == nil { 5902 cv = []types.BackendJobRespObj{} 5903 } else { 5904 cv = *v 5905 } 5906 5907 for _, value := range shape { 5908 var col types.BackendJobRespObj 5909 destAddr := &col 5910 if err := awsRestjson1_deserializeDocumentBackendJobRespObj(&destAddr, value); err != nil { 5911 return err 5912 } 5913 col = *destAddr 5914 cv = append(cv, col) 5915 5916 } 5917 *v = cv 5918 return nil 5919} 5920 5921func awsRestjson1_deserializeDocumentListOfMfaTypesElement(v *[]types.MfaTypesElement, value interface{}) error { 5922 if v == nil { 5923 return fmt.Errorf("unexpected nil of type %T", v) 5924 } 5925 if value == nil { 5926 return nil 5927 } 5928 5929 shape, ok := value.([]interface{}) 5930 if !ok { 5931 return fmt.Errorf("unexpected JSON type %v", value) 5932 } 5933 5934 var cv []types.MfaTypesElement 5935 if *v == nil { 5936 cv = []types.MfaTypesElement{} 5937 } else { 5938 cv = *v 5939 } 5940 5941 for _, value := range shape { 5942 var col types.MfaTypesElement 5943 if value != nil { 5944 jtv, ok := value.(string) 5945 if !ok { 5946 return fmt.Errorf("expected MfaTypesElement to be of type string, got %T instead", value) 5947 } 5948 col = types.MfaTypesElement(jtv) 5949 } 5950 cv = append(cv, col) 5951 5952 } 5953 *v = cv 5954 return nil 5955} 5956 5957func awsRestjson1_deserializeDocumentListOfOAuthScopesElement(v *[]types.OAuthScopesElement, value interface{}) error { 5958 if v == nil { 5959 return fmt.Errorf("unexpected nil of type %T", v) 5960 } 5961 if value == nil { 5962 return nil 5963 } 5964 5965 shape, ok := value.([]interface{}) 5966 if !ok { 5967 return fmt.Errorf("unexpected JSON type %v", value) 5968 } 5969 5970 var cv []types.OAuthScopesElement 5971 if *v == nil { 5972 cv = []types.OAuthScopesElement{} 5973 } else { 5974 cv = *v 5975 } 5976 5977 for _, value := range shape { 5978 var col types.OAuthScopesElement 5979 if value != nil { 5980 jtv, ok := value.(string) 5981 if !ok { 5982 return fmt.Errorf("expected OAuthScopesElement to be of type string, got %T instead", value) 5983 } 5984 col = types.OAuthScopesElement(jtv) 5985 } 5986 cv = append(cv, col) 5987 5988 } 5989 *v = cv 5990 return nil 5991} 5992 5993func awsRestjson1_deserializeDocumentListOfRequiredSignUpAttributesElement(v *[]types.RequiredSignUpAttributesElement, value interface{}) error { 5994 if v == nil { 5995 return fmt.Errorf("unexpected nil of type %T", v) 5996 } 5997 if value == nil { 5998 return nil 5999 } 6000 6001 shape, ok := value.([]interface{}) 6002 if !ok { 6003 return fmt.Errorf("unexpected JSON type %v", value) 6004 } 6005 6006 var cv []types.RequiredSignUpAttributesElement 6007 if *v == nil { 6008 cv = []types.RequiredSignUpAttributesElement{} 6009 } else { 6010 cv = *v 6011 } 6012 6013 for _, value := range shape { 6014 var col types.RequiredSignUpAttributesElement 6015 if value != nil { 6016 jtv, ok := value.(string) 6017 if !ok { 6018 return fmt.Errorf("expected RequiredSignUpAttributesElement to be of type string, got %T instead", value) 6019 } 6020 col = types.RequiredSignUpAttributesElement(jtv) 6021 } 6022 cv = append(cv, col) 6023 6024 } 6025 *v = cv 6026 return nil 6027} 6028 6029func awsRestjson1_deserializeDocumentLoginAuthConfigReqObj(v **types.LoginAuthConfigReqObj, value interface{}) error { 6030 if v == nil { 6031 return fmt.Errorf("unexpected nil of type %T", v) 6032 } 6033 if value == nil { 6034 return nil 6035 } 6036 6037 shape, ok := value.(map[string]interface{}) 6038 if !ok { 6039 return fmt.Errorf("unexpected JSON type %v", value) 6040 } 6041 6042 var sv *types.LoginAuthConfigReqObj 6043 if *v == nil { 6044 sv = &types.LoginAuthConfigReqObj{} 6045 } else { 6046 sv = *v 6047 } 6048 6049 for key, value := range shape { 6050 switch key { 6051 case "aws_cognito_identity_pool_id": 6052 if value != nil { 6053 jtv, ok := value.(string) 6054 if !ok { 6055 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6056 } 6057 sv.AwsCognitoIdentityPoolId = ptr.String(jtv) 6058 } 6059 6060 case "aws_cognito_region": 6061 if value != nil { 6062 jtv, ok := value.(string) 6063 if !ok { 6064 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6065 } 6066 sv.AwsCognitoRegion = ptr.String(jtv) 6067 } 6068 6069 case "aws_user_pools_id": 6070 if value != nil { 6071 jtv, ok := value.(string) 6072 if !ok { 6073 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6074 } 6075 sv.AwsUserPoolsId = ptr.String(jtv) 6076 } 6077 6078 case "aws_user_pools_web_client_id": 6079 if value != nil { 6080 jtv, ok := value.(string) 6081 if !ok { 6082 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6083 } 6084 sv.AwsUserPoolsWebClientId = ptr.String(jtv) 6085 } 6086 6087 default: 6088 _, _ = key, value 6089 6090 } 6091 } 6092 *v = sv 6093 return nil 6094} 6095 6096func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 6097 if v == nil { 6098 return fmt.Errorf("unexpected nil of type %T", v) 6099 } 6100 if value == nil { 6101 return nil 6102 } 6103 6104 shape, ok := value.(map[string]interface{}) 6105 if !ok { 6106 return fmt.Errorf("unexpected JSON type %v", value) 6107 } 6108 6109 var sv *types.NotFoundException 6110 if *v == nil { 6111 sv = &types.NotFoundException{} 6112 } else { 6113 sv = *v 6114 } 6115 6116 for key, value := range shape { 6117 switch key { 6118 case "message": 6119 if value != nil { 6120 jtv, ok := value.(string) 6121 if !ok { 6122 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6123 } 6124 sv.Message = ptr.String(jtv) 6125 } 6126 6127 case "resourceType": 6128 if value != nil { 6129 jtv, ok := value.(string) 6130 if !ok { 6131 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6132 } 6133 sv.ResourceType = ptr.String(jtv) 6134 } 6135 6136 default: 6137 _, _ = key, value 6138 6139 } 6140 } 6141 *v = sv 6142 return nil 6143} 6144 6145func awsRestjson1_deserializeDocumentSettings(v **types.Settings, value interface{}) error { 6146 if v == nil { 6147 return fmt.Errorf("unexpected nil of type %T", v) 6148 } 6149 if value == nil { 6150 return nil 6151 } 6152 6153 shape, ok := value.(map[string]interface{}) 6154 if !ok { 6155 return fmt.Errorf("unexpected JSON type %v", value) 6156 } 6157 6158 var sv *types.Settings 6159 if *v == nil { 6160 sv = &types.Settings{} 6161 } else { 6162 sv = *v 6163 } 6164 6165 for key, value := range shape { 6166 switch key { 6167 case "mfaTypes": 6168 if err := awsRestjson1_deserializeDocumentListOfMfaTypesElement(&sv.MfaTypes, value); err != nil { 6169 return err 6170 } 6171 6172 case "smsMessage": 6173 if value != nil { 6174 jtv, ok := value.(string) 6175 if !ok { 6176 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6177 } 6178 sv.SmsMessage = ptr.String(jtv) 6179 } 6180 6181 default: 6182 _, _ = key, value 6183 6184 } 6185 } 6186 *v = sv 6187 return nil 6188} 6189 6190func awsRestjson1_deserializeDocumentSmsSettings(v **types.SmsSettings, value interface{}) error { 6191 if v == nil { 6192 return fmt.Errorf("unexpected nil of type %T", v) 6193 } 6194 if value == nil { 6195 return nil 6196 } 6197 6198 shape, ok := value.(map[string]interface{}) 6199 if !ok { 6200 return fmt.Errorf("unexpected JSON type %v", value) 6201 } 6202 6203 var sv *types.SmsSettings 6204 if *v == nil { 6205 sv = &types.SmsSettings{} 6206 } else { 6207 sv = *v 6208 } 6209 6210 for key, value := range shape { 6211 switch key { 6212 case "smsMessage": 6213 if value != nil { 6214 jtv, ok := value.(string) 6215 if !ok { 6216 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6217 } 6218 sv.SmsMessage = ptr.String(jtv) 6219 } 6220 6221 default: 6222 _, _ = key, value 6223 6224 } 6225 } 6226 *v = sv 6227 return nil 6228} 6229 6230func awsRestjson1_deserializeDocumentSocialProviderSettings(v **types.SocialProviderSettings, value interface{}) error { 6231 if v == nil { 6232 return fmt.Errorf("unexpected nil of type %T", v) 6233 } 6234 if value == nil { 6235 return nil 6236 } 6237 6238 shape, ok := value.(map[string]interface{}) 6239 if !ok { 6240 return fmt.Errorf("unexpected JSON type %v", value) 6241 } 6242 6243 var sv *types.SocialProviderSettings 6244 if *v == nil { 6245 sv = &types.SocialProviderSettings{} 6246 } else { 6247 sv = *v 6248 } 6249 6250 for key, value := range shape { 6251 switch key { 6252 case "Facebook": 6253 if err := awsRestjson1_deserializeDocumentBackendAuthSocialProviderConfig(&sv.Facebook, value); err != nil { 6254 return err 6255 } 6256 6257 case "Google": 6258 if err := awsRestjson1_deserializeDocumentBackendAuthSocialProviderConfig(&sv.Google, value); err != nil { 6259 return err 6260 } 6261 6262 case "LoginWithAmazon": 6263 if err := awsRestjson1_deserializeDocumentBackendAuthSocialProviderConfig(&sv.LoginWithAmazon, value); err != nil { 6264 return err 6265 } 6266 6267 default: 6268 _, _ = key, value 6269 6270 } 6271 } 6272 *v = sv 6273 return nil 6274} 6275 6276func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { 6277 if v == nil { 6278 return fmt.Errorf("unexpected nil of type %T", v) 6279 } 6280 if value == nil { 6281 return nil 6282 } 6283 6284 shape, ok := value.(map[string]interface{}) 6285 if !ok { 6286 return fmt.Errorf("unexpected JSON type %v", value) 6287 } 6288 6289 var sv *types.TooManyRequestsException 6290 if *v == nil { 6291 sv = &types.TooManyRequestsException{} 6292 } else { 6293 sv = *v 6294 } 6295 6296 for key, value := range shape { 6297 switch key { 6298 case "limitType": 6299 if value != nil { 6300 jtv, ok := value.(string) 6301 if !ok { 6302 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6303 } 6304 sv.LimitType = ptr.String(jtv) 6305 } 6306 6307 case "message": 6308 if value != nil { 6309 jtv, ok := value.(string) 6310 if !ok { 6311 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6312 } 6313 sv.Message = ptr.String(jtv) 6314 } 6315 6316 default: 6317 _, _ = key, value 6318 6319 } 6320 } 6321 *v = sv 6322 return nil 6323} 6324