1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package apigatewayv2 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/apigatewayv2/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 smithytime "github.com/aws/smithy-go/time" 17 smithyhttp "github.com/aws/smithy-go/transport/http" 18 "io" 19 "io/ioutil" 20 "strings" 21) 22 23type awsRestjson1_deserializeOpCreateApi struct { 24} 25 26func (*awsRestjson1_deserializeOpCreateApi) ID() string { 27 return "OperationDeserializer" 28} 29 30func (m *awsRestjson1_deserializeOpCreateApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 31 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 32) { 33 out, metadata, err = next.HandleDeserialize(ctx, in) 34 if err != nil { 35 return out, metadata, err 36 } 37 38 response, ok := out.RawResponse.(*smithyhttp.Response) 39 if !ok { 40 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 41 } 42 43 if response.StatusCode < 200 || response.StatusCode >= 300 { 44 return out, metadata, awsRestjson1_deserializeOpErrorCreateApi(response, &metadata) 45 } 46 output := &CreateApiOutput{} 47 out.Result = output 48 49 var buff [1024]byte 50 ringBuffer := smithyio.NewRingBuffer(buff[:]) 51 52 body := io.TeeReader(response.Body, ringBuffer) 53 54 decoder := json.NewDecoder(body) 55 decoder.UseNumber() 56 var shape interface{} 57 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 58 var snapshot bytes.Buffer 59 io.Copy(&snapshot, ringBuffer) 60 err = &smithy.DeserializationError{ 61 Err: fmt.Errorf("failed to decode response body, %w", err), 62 Snapshot: snapshot.Bytes(), 63 } 64 return out, metadata, err 65 } 66 67 err = awsRestjson1_deserializeOpDocumentCreateApiOutput(&output, shape) 68 if err != nil { 69 var snapshot bytes.Buffer 70 io.Copy(&snapshot, ringBuffer) 71 return out, metadata, &smithy.DeserializationError{ 72 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 73 Snapshot: snapshot.Bytes(), 74 } 75 } 76 77 return out, metadata, err 78} 79 80func awsRestjson1_deserializeOpErrorCreateApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 81 var errorBuffer bytes.Buffer 82 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 83 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 84 } 85 errorBody := bytes.NewReader(errorBuffer.Bytes()) 86 87 errorCode := "UnknownError" 88 errorMessage := errorCode 89 90 code := response.Header.Get("X-Amzn-ErrorType") 91 if len(code) != 0 { 92 errorCode = restjson.SanitizeErrorCode(code) 93 } 94 95 var buff [1024]byte 96 ringBuffer := smithyio.NewRingBuffer(buff[:]) 97 98 body := io.TeeReader(errorBody, ringBuffer) 99 decoder := json.NewDecoder(body) 100 decoder.UseNumber() 101 code, message, err := restjson.GetErrorInfo(decoder) 102 if err != nil { 103 var snapshot bytes.Buffer 104 io.Copy(&snapshot, ringBuffer) 105 err = &smithy.DeserializationError{ 106 Err: fmt.Errorf("failed to decode response body, %w", err), 107 Snapshot: snapshot.Bytes(), 108 } 109 return err 110 } 111 112 errorBody.Seek(0, io.SeekStart) 113 if len(code) != 0 { 114 errorCode = restjson.SanitizeErrorCode(code) 115 } 116 if len(message) != 0 { 117 errorMessage = message 118 } 119 120 switch { 121 case strings.EqualFold("BadRequestException", errorCode): 122 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 123 124 case strings.EqualFold("ConflictException", errorCode): 125 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 126 127 case strings.EqualFold("NotFoundException", errorCode): 128 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 129 130 case strings.EqualFold("TooManyRequestsException", errorCode): 131 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 132 133 default: 134 genericError := &smithy.GenericAPIError{ 135 Code: errorCode, 136 Message: errorMessage, 137 } 138 return genericError 139 140 } 141} 142 143func awsRestjson1_deserializeOpDocumentCreateApiOutput(v **CreateApiOutput, value interface{}) error { 144 if v == nil { 145 return fmt.Errorf("unexpected nil of type %T", v) 146 } 147 if value == nil { 148 return nil 149 } 150 151 shape, ok := value.(map[string]interface{}) 152 if !ok { 153 return fmt.Errorf("unexpected JSON type %v", value) 154 } 155 156 var sv *CreateApiOutput 157 if *v == nil { 158 sv = &CreateApiOutput{} 159 } else { 160 sv = *v 161 } 162 163 for key, value := range shape { 164 switch key { 165 case "apiEndpoint": 166 if value != nil { 167 jtv, ok := value.(string) 168 if !ok { 169 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 170 } 171 sv.ApiEndpoint = ptr.String(jtv) 172 } 173 174 case "apiGatewayManaged": 175 if value != nil { 176 jtv, ok := value.(bool) 177 if !ok { 178 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 179 } 180 sv.ApiGatewayManaged = jtv 181 } 182 183 case "apiId": 184 if value != nil { 185 jtv, ok := value.(string) 186 if !ok { 187 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 188 } 189 sv.ApiId = ptr.String(jtv) 190 } 191 192 case "apiKeySelectionExpression": 193 if value != nil { 194 jtv, ok := value.(string) 195 if !ok { 196 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 197 } 198 sv.ApiKeySelectionExpression = ptr.String(jtv) 199 } 200 201 case "corsConfiguration": 202 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 203 return err 204 } 205 206 case "createdDate": 207 if value != nil { 208 jtv, ok := value.(string) 209 if !ok { 210 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 211 } 212 t, err := smithytime.ParseDateTime(jtv) 213 if err != nil { 214 return err 215 } 216 sv.CreatedDate = ptr.Time(t) 217 } 218 219 case "description": 220 if value != nil { 221 jtv, ok := value.(string) 222 if !ok { 223 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 224 } 225 sv.Description = ptr.String(jtv) 226 } 227 228 case "disableExecuteApiEndpoint": 229 if value != nil { 230 jtv, ok := value.(bool) 231 if !ok { 232 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 233 } 234 sv.DisableExecuteApiEndpoint = jtv 235 } 236 237 case "disableSchemaValidation": 238 if value != nil { 239 jtv, ok := value.(bool) 240 if !ok { 241 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 242 } 243 sv.DisableSchemaValidation = jtv 244 } 245 246 case "importInfo": 247 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 248 return err 249 } 250 251 case "name": 252 if value != nil { 253 jtv, ok := value.(string) 254 if !ok { 255 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 256 } 257 sv.Name = ptr.String(jtv) 258 } 259 260 case "protocolType": 261 if value != nil { 262 jtv, ok := value.(string) 263 if !ok { 264 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 265 } 266 sv.ProtocolType = types.ProtocolType(jtv) 267 } 268 269 case "routeSelectionExpression": 270 if value != nil { 271 jtv, ok := value.(string) 272 if !ok { 273 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 274 } 275 sv.RouteSelectionExpression = ptr.String(jtv) 276 } 277 278 case "tags": 279 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 280 return err 281 } 282 283 case "version": 284 if value != nil { 285 jtv, ok := value.(string) 286 if !ok { 287 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 288 } 289 sv.Version = ptr.String(jtv) 290 } 291 292 case "warnings": 293 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 294 return err 295 } 296 297 default: 298 _, _ = key, value 299 300 } 301 } 302 *v = sv 303 return nil 304} 305 306type awsRestjson1_deserializeOpCreateApiMapping struct { 307} 308 309func (*awsRestjson1_deserializeOpCreateApiMapping) ID() string { 310 return "OperationDeserializer" 311} 312 313func (m *awsRestjson1_deserializeOpCreateApiMapping) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 314 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 315) { 316 out, metadata, err = next.HandleDeserialize(ctx, in) 317 if err != nil { 318 return out, metadata, err 319 } 320 321 response, ok := out.RawResponse.(*smithyhttp.Response) 322 if !ok { 323 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 324 } 325 326 if response.StatusCode < 200 || response.StatusCode >= 300 { 327 return out, metadata, awsRestjson1_deserializeOpErrorCreateApiMapping(response, &metadata) 328 } 329 output := &CreateApiMappingOutput{} 330 out.Result = output 331 332 var buff [1024]byte 333 ringBuffer := smithyio.NewRingBuffer(buff[:]) 334 335 body := io.TeeReader(response.Body, ringBuffer) 336 337 decoder := json.NewDecoder(body) 338 decoder.UseNumber() 339 var shape interface{} 340 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 341 var snapshot bytes.Buffer 342 io.Copy(&snapshot, ringBuffer) 343 err = &smithy.DeserializationError{ 344 Err: fmt.Errorf("failed to decode response body, %w", err), 345 Snapshot: snapshot.Bytes(), 346 } 347 return out, metadata, err 348 } 349 350 err = awsRestjson1_deserializeOpDocumentCreateApiMappingOutput(&output, shape) 351 if err != nil { 352 var snapshot bytes.Buffer 353 io.Copy(&snapshot, ringBuffer) 354 return out, metadata, &smithy.DeserializationError{ 355 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 356 Snapshot: snapshot.Bytes(), 357 } 358 } 359 360 return out, metadata, err 361} 362 363func awsRestjson1_deserializeOpErrorCreateApiMapping(response *smithyhttp.Response, metadata *middleware.Metadata) error { 364 var errorBuffer bytes.Buffer 365 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 366 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 367 } 368 errorBody := bytes.NewReader(errorBuffer.Bytes()) 369 370 errorCode := "UnknownError" 371 errorMessage := errorCode 372 373 code := response.Header.Get("X-Amzn-ErrorType") 374 if len(code) != 0 { 375 errorCode = restjson.SanitizeErrorCode(code) 376 } 377 378 var buff [1024]byte 379 ringBuffer := smithyio.NewRingBuffer(buff[:]) 380 381 body := io.TeeReader(errorBody, ringBuffer) 382 decoder := json.NewDecoder(body) 383 decoder.UseNumber() 384 code, message, err := restjson.GetErrorInfo(decoder) 385 if err != nil { 386 var snapshot bytes.Buffer 387 io.Copy(&snapshot, ringBuffer) 388 err = &smithy.DeserializationError{ 389 Err: fmt.Errorf("failed to decode response body, %w", err), 390 Snapshot: snapshot.Bytes(), 391 } 392 return err 393 } 394 395 errorBody.Seek(0, io.SeekStart) 396 if len(code) != 0 { 397 errorCode = restjson.SanitizeErrorCode(code) 398 } 399 if len(message) != 0 { 400 errorMessage = message 401 } 402 403 switch { 404 case strings.EqualFold("BadRequestException", errorCode): 405 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 406 407 case strings.EqualFold("ConflictException", errorCode): 408 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 409 410 case strings.EqualFold("NotFoundException", errorCode): 411 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 412 413 case strings.EqualFold("TooManyRequestsException", errorCode): 414 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 415 416 default: 417 genericError := &smithy.GenericAPIError{ 418 Code: errorCode, 419 Message: errorMessage, 420 } 421 return genericError 422 423 } 424} 425 426func awsRestjson1_deserializeOpDocumentCreateApiMappingOutput(v **CreateApiMappingOutput, value interface{}) error { 427 if v == nil { 428 return fmt.Errorf("unexpected nil of type %T", v) 429 } 430 if value == nil { 431 return nil 432 } 433 434 shape, ok := value.(map[string]interface{}) 435 if !ok { 436 return fmt.Errorf("unexpected JSON type %v", value) 437 } 438 439 var sv *CreateApiMappingOutput 440 if *v == nil { 441 sv = &CreateApiMappingOutput{} 442 } else { 443 sv = *v 444 } 445 446 for key, value := range shape { 447 switch key { 448 case "apiId": 449 if value != nil { 450 jtv, ok := value.(string) 451 if !ok { 452 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 453 } 454 sv.ApiId = ptr.String(jtv) 455 } 456 457 case "apiMappingId": 458 if value != nil { 459 jtv, ok := value.(string) 460 if !ok { 461 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 462 } 463 sv.ApiMappingId = ptr.String(jtv) 464 } 465 466 case "apiMappingKey": 467 if value != nil { 468 jtv, ok := value.(string) 469 if !ok { 470 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 471 } 472 sv.ApiMappingKey = ptr.String(jtv) 473 } 474 475 case "stage": 476 if value != nil { 477 jtv, ok := value.(string) 478 if !ok { 479 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 480 } 481 sv.Stage = ptr.String(jtv) 482 } 483 484 default: 485 _, _ = key, value 486 487 } 488 } 489 *v = sv 490 return nil 491} 492 493type awsRestjson1_deserializeOpCreateAuthorizer struct { 494} 495 496func (*awsRestjson1_deserializeOpCreateAuthorizer) ID() string { 497 return "OperationDeserializer" 498} 499 500func (m *awsRestjson1_deserializeOpCreateAuthorizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 501 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 502) { 503 out, metadata, err = next.HandleDeserialize(ctx, in) 504 if err != nil { 505 return out, metadata, err 506 } 507 508 response, ok := out.RawResponse.(*smithyhttp.Response) 509 if !ok { 510 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 511 } 512 513 if response.StatusCode < 200 || response.StatusCode >= 300 { 514 return out, metadata, awsRestjson1_deserializeOpErrorCreateAuthorizer(response, &metadata) 515 } 516 output := &CreateAuthorizerOutput{} 517 out.Result = output 518 519 var buff [1024]byte 520 ringBuffer := smithyio.NewRingBuffer(buff[:]) 521 522 body := io.TeeReader(response.Body, ringBuffer) 523 524 decoder := json.NewDecoder(body) 525 decoder.UseNumber() 526 var shape interface{} 527 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 528 var snapshot bytes.Buffer 529 io.Copy(&snapshot, ringBuffer) 530 err = &smithy.DeserializationError{ 531 Err: fmt.Errorf("failed to decode response body, %w", err), 532 Snapshot: snapshot.Bytes(), 533 } 534 return out, metadata, err 535 } 536 537 err = awsRestjson1_deserializeOpDocumentCreateAuthorizerOutput(&output, shape) 538 if err != nil { 539 var snapshot bytes.Buffer 540 io.Copy(&snapshot, ringBuffer) 541 return out, metadata, &smithy.DeserializationError{ 542 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 543 Snapshot: snapshot.Bytes(), 544 } 545 } 546 547 return out, metadata, err 548} 549 550func awsRestjson1_deserializeOpErrorCreateAuthorizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 551 var errorBuffer bytes.Buffer 552 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 553 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 554 } 555 errorBody := bytes.NewReader(errorBuffer.Bytes()) 556 557 errorCode := "UnknownError" 558 errorMessage := errorCode 559 560 code := response.Header.Get("X-Amzn-ErrorType") 561 if len(code) != 0 { 562 errorCode = restjson.SanitizeErrorCode(code) 563 } 564 565 var buff [1024]byte 566 ringBuffer := smithyio.NewRingBuffer(buff[:]) 567 568 body := io.TeeReader(errorBody, ringBuffer) 569 decoder := json.NewDecoder(body) 570 decoder.UseNumber() 571 code, message, err := restjson.GetErrorInfo(decoder) 572 if err != nil { 573 var snapshot bytes.Buffer 574 io.Copy(&snapshot, ringBuffer) 575 err = &smithy.DeserializationError{ 576 Err: fmt.Errorf("failed to decode response body, %w", err), 577 Snapshot: snapshot.Bytes(), 578 } 579 return err 580 } 581 582 errorBody.Seek(0, io.SeekStart) 583 if len(code) != 0 { 584 errorCode = restjson.SanitizeErrorCode(code) 585 } 586 if len(message) != 0 { 587 errorMessage = message 588 } 589 590 switch { 591 case strings.EqualFold("BadRequestException", errorCode): 592 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 593 594 case strings.EqualFold("ConflictException", errorCode): 595 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 596 597 case strings.EqualFold("NotFoundException", errorCode): 598 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 599 600 case strings.EqualFold("TooManyRequestsException", errorCode): 601 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 602 603 default: 604 genericError := &smithy.GenericAPIError{ 605 Code: errorCode, 606 Message: errorMessage, 607 } 608 return genericError 609 610 } 611} 612 613func awsRestjson1_deserializeOpDocumentCreateAuthorizerOutput(v **CreateAuthorizerOutput, value interface{}) error { 614 if v == nil { 615 return fmt.Errorf("unexpected nil of type %T", v) 616 } 617 if value == nil { 618 return nil 619 } 620 621 shape, ok := value.(map[string]interface{}) 622 if !ok { 623 return fmt.Errorf("unexpected JSON type %v", value) 624 } 625 626 var sv *CreateAuthorizerOutput 627 if *v == nil { 628 sv = &CreateAuthorizerOutput{} 629 } else { 630 sv = *v 631 } 632 633 for key, value := range shape { 634 switch key { 635 case "authorizerCredentialsArn": 636 if value != nil { 637 jtv, ok := value.(string) 638 if !ok { 639 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 640 } 641 sv.AuthorizerCredentialsArn = ptr.String(jtv) 642 } 643 644 case "authorizerId": 645 if value != nil { 646 jtv, ok := value.(string) 647 if !ok { 648 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 649 } 650 sv.AuthorizerId = ptr.String(jtv) 651 } 652 653 case "authorizerPayloadFormatVersion": 654 if value != nil { 655 jtv, ok := value.(string) 656 if !ok { 657 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 658 } 659 sv.AuthorizerPayloadFormatVersion = ptr.String(jtv) 660 } 661 662 case "authorizerResultTtlInSeconds": 663 if value != nil { 664 jtv, ok := value.(json.Number) 665 if !ok { 666 return fmt.Errorf("expected IntegerWithLengthBetween0And3600 to be json.Number, got %T instead", value) 667 } 668 i64, err := jtv.Int64() 669 if err != nil { 670 return err 671 } 672 sv.AuthorizerResultTtlInSeconds = int32(i64) 673 } 674 675 case "authorizerType": 676 if value != nil { 677 jtv, ok := value.(string) 678 if !ok { 679 return fmt.Errorf("expected AuthorizerType to be of type string, got %T instead", value) 680 } 681 sv.AuthorizerType = types.AuthorizerType(jtv) 682 } 683 684 case "authorizerUri": 685 if value != nil { 686 jtv, ok := value.(string) 687 if !ok { 688 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 689 } 690 sv.AuthorizerUri = ptr.String(jtv) 691 } 692 693 case "enableSimpleResponses": 694 if value != nil { 695 jtv, ok := value.(bool) 696 if !ok { 697 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 698 } 699 sv.EnableSimpleResponses = jtv 700 } 701 702 case "identitySource": 703 if err := awsRestjson1_deserializeDocumentIdentitySourceList(&sv.IdentitySource, value); err != nil { 704 return err 705 } 706 707 case "identityValidationExpression": 708 if value != nil { 709 jtv, ok := value.(string) 710 if !ok { 711 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 712 } 713 sv.IdentityValidationExpression = ptr.String(jtv) 714 } 715 716 case "jwtConfiguration": 717 if err := awsRestjson1_deserializeDocumentJWTConfiguration(&sv.JwtConfiguration, value); err != nil { 718 return err 719 } 720 721 case "name": 722 if value != nil { 723 jtv, ok := value.(string) 724 if !ok { 725 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 726 } 727 sv.Name = ptr.String(jtv) 728 } 729 730 default: 731 _, _ = key, value 732 733 } 734 } 735 *v = sv 736 return nil 737} 738 739type awsRestjson1_deserializeOpCreateDeployment struct { 740} 741 742func (*awsRestjson1_deserializeOpCreateDeployment) ID() string { 743 return "OperationDeserializer" 744} 745 746func (m *awsRestjson1_deserializeOpCreateDeployment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 747 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 748) { 749 out, metadata, err = next.HandleDeserialize(ctx, in) 750 if err != nil { 751 return out, metadata, err 752 } 753 754 response, ok := out.RawResponse.(*smithyhttp.Response) 755 if !ok { 756 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 757 } 758 759 if response.StatusCode < 200 || response.StatusCode >= 300 { 760 return out, metadata, awsRestjson1_deserializeOpErrorCreateDeployment(response, &metadata) 761 } 762 output := &CreateDeploymentOutput{} 763 out.Result = output 764 765 var buff [1024]byte 766 ringBuffer := smithyio.NewRingBuffer(buff[:]) 767 768 body := io.TeeReader(response.Body, ringBuffer) 769 770 decoder := json.NewDecoder(body) 771 decoder.UseNumber() 772 var shape interface{} 773 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 774 var snapshot bytes.Buffer 775 io.Copy(&snapshot, ringBuffer) 776 err = &smithy.DeserializationError{ 777 Err: fmt.Errorf("failed to decode response body, %w", err), 778 Snapshot: snapshot.Bytes(), 779 } 780 return out, metadata, err 781 } 782 783 err = awsRestjson1_deserializeOpDocumentCreateDeploymentOutput(&output, shape) 784 if err != nil { 785 var snapshot bytes.Buffer 786 io.Copy(&snapshot, ringBuffer) 787 return out, metadata, &smithy.DeserializationError{ 788 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 789 Snapshot: snapshot.Bytes(), 790 } 791 } 792 793 return out, metadata, err 794} 795 796func awsRestjson1_deserializeOpErrorCreateDeployment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 797 var errorBuffer bytes.Buffer 798 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 799 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 800 } 801 errorBody := bytes.NewReader(errorBuffer.Bytes()) 802 803 errorCode := "UnknownError" 804 errorMessage := errorCode 805 806 code := response.Header.Get("X-Amzn-ErrorType") 807 if len(code) != 0 { 808 errorCode = restjson.SanitizeErrorCode(code) 809 } 810 811 var buff [1024]byte 812 ringBuffer := smithyio.NewRingBuffer(buff[:]) 813 814 body := io.TeeReader(errorBody, ringBuffer) 815 decoder := json.NewDecoder(body) 816 decoder.UseNumber() 817 code, message, err := restjson.GetErrorInfo(decoder) 818 if err != nil { 819 var snapshot bytes.Buffer 820 io.Copy(&snapshot, ringBuffer) 821 err = &smithy.DeserializationError{ 822 Err: fmt.Errorf("failed to decode response body, %w", err), 823 Snapshot: snapshot.Bytes(), 824 } 825 return err 826 } 827 828 errorBody.Seek(0, io.SeekStart) 829 if len(code) != 0 { 830 errorCode = restjson.SanitizeErrorCode(code) 831 } 832 if len(message) != 0 { 833 errorMessage = message 834 } 835 836 switch { 837 case strings.EqualFold("BadRequestException", errorCode): 838 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 839 840 case strings.EqualFold("ConflictException", errorCode): 841 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 842 843 case strings.EqualFold("NotFoundException", errorCode): 844 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 845 846 case strings.EqualFold("TooManyRequestsException", errorCode): 847 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 848 849 default: 850 genericError := &smithy.GenericAPIError{ 851 Code: errorCode, 852 Message: errorMessage, 853 } 854 return genericError 855 856 } 857} 858 859func awsRestjson1_deserializeOpDocumentCreateDeploymentOutput(v **CreateDeploymentOutput, value interface{}) error { 860 if v == nil { 861 return fmt.Errorf("unexpected nil of type %T", v) 862 } 863 if value == nil { 864 return nil 865 } 866 867 shape, ok := value.(map[string]interface{}) 868 if !ok { 869 return fmt.Errorf("unexpected JSON type %v", value) 870 } 871 872 var sv *CreateDeploymentOutput 873 if *v == nil { 874 sv = &CreateDeploymentOutput{} 875 } else { 876 sv = *v 877 } 878 879 for key, value := range shape { 880 switch key { 881 case "autoDeployed": 882 if value != nil { 883 jtv, ok := value.(bool) 884 if !ok { 885 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 886 } 887 sv.AutoDeployed = jtv 888 } 889 890 case "createdDate": 891 if value != nil { 892 jtv, ok := value.(string) 893 if !ok { 894 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 895 } 896 t, err := smithytime.ParseDateTime(jtv) 897 if err != nil { 898 return err 899 } 900 sv.CreatedDate = ptr.Time(t) 901 } 902 903 case "deploymentId": 904 if value != nil { 905 jtv, ok := value.(string) 906 if !ok { 907 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 908 } 909 sv.DeploymentId = ptr.String(jtv) 910 } 911 912 case "deploymentStatus": 913 if value != nil { 914 jtv, ok := value.(string) 915 if !ok { 916 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 917 } 918 sv.DeploymentStatus = types.DeploymentStatus(jtv) 919 } 920 921 case "deploymentStatusMessage": 922 if value != nil { 923 jtv, ok := value.(string) 924 if !ok { 925 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 926 } 927 sv.DeploymentStatusMessage = ptr.String(jtv) 928 } 929 930 case "description": 931 if value != nil { 932 jtv, ok := value.(string) 933 if !ok { 934 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 935 } 936 sv.Description = ptr.String(jtv) 937 } 938 939 default: 940 _, _ = key, value 941 942 } 943 } 944 *v = sv 945 return nil 946} 947 948type awsRestjson1_deserializeOpCreateDomainName struct { 949} 950 951func (*awsRestjson1_deserializeOpCreateDomainName) ID() string { 952 return "OperationDeserializer" 953} 954 955func (m *awsRestjson1_deserializeOpCreateDomainName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 956 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 957) { 958 out, metadata, err = next.HandleDeserialize(ctx, in) 959 if err != nil { 960 return out, metadata, err 961 } 962 963 response, ok := out.RawResponse.(*smithyhttp.Response) 964 if !ok { 965 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 966 } 967 968 if response.StatusCode < 200 || response.StatusCode >= 300 { 969 return out, metadata, awsRestjson1_deserializeOpErrorCreateDomainName(response, &metadata) 970 } 971 output := &CreateDomainNameOutput{} 972 out.Result = output 973 974 var buff [1024]byte 975 ringBuffer := smithyio.NewRingBuffer(buff[:]) 976 977 body := io.TeeReader(response.Body, ringBuffer) 978 979 decoder := json.NewDecoder(body) 980 decoder.UseNumber() 981 var shape interface{} 982 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 983 var snapshot bytes.Buffer 984 io.Copy(&snapshot, ringBuffer) 985 err = &smithy.DeserializationError{ 986 Err: fmt.Errorf("failed to decode response body, %w", err), 987 Snapshot: snapshot.Bytes(), 988 } 989 return out, metadata, err 990 } 991 992 err = awsRestjson1_deserializeOpDocumentCreateDomainNameOutput(&output, shape) 993 if err != nil { 994 var snapshot bytes.Buffer 995 io.Copy(&snapshot, ringBuffer) 996 return out, metadata, &smithy.DeserializationError{ 997 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 998 Snapshot: snapshot.Bytes(), 999 } 1000 } 1001 1002 return out, metadata, err 1003} 1004 1005func awsRestjson1_deserializeOpErrorCreateDomainName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1006 var errorBuffer bytes.Buffer 1007 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1008 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1009 } 1010 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1011 1012 errorCode := "UnknownError" 1013 errorMessage := errorCode 1014 1015 code := response.Header.Get("X-Amzn-ErrorType") 1016 if len(code) != 0 { 1017 errorCode = restjson.SanitizeErrorCode(code) 1018 } 1019 1020 var buff [1024]byte 1021 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1022 1023 body := io.TeeReader(errorBody, ringBuffer) 1024 decoder := json.NewDecoder(body) 1025 decoder.UseNumber() 1026 code, message, err := restjson.GetErrorInfo(decoder) 1027 if err != nil { 1028 var snapshot bytes.Buffer 1029 io.Copy(&snapshot, ringBuffer) 1030 err = &smithy.DeserializationError{ 1031 Err: fmt.Errorf("failed to decode response body, %w", err), 1032 Snapshot: snapshot.Bytes(), 1033 } 1034 return err 1035 } 1036 1037 errorBody.Seek(0, io.SeekStart) 1038 if len(code) != 0 { 1039 errorCode = restjson.SanitizeErrorCode(code) 1040 } 1041 if len(message) != 0 { 1042 errorMessage = message 1043 } 1044 1045 switch { 1046 case strings.EqualFold("AccessDeniedException", errorCode): 1047 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1048 1049 case strings.EqualFold("BadRequestException", errorCode): 1050 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1051 1052 case strings.EqualFold("ConflictException", errorCode): 1053 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1054 1055 case strings.EqualFold("NotFoundException", errorCode): 1056 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1057 1058 case strings.EqualFold("TooManyRequestsException", errorCode): 1059 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1060 1061 default: 1062 genericError := &smithy.GenericAPIError{ 1063 Code: errorCode, 1064 Message: errorMessage, 1065 } 1066 return genericError 1067 1068 } 1069} 1070 1071func awsRestjson1_deserializeOpDocumentCreateDomainNameOutput(v **CreateDomainNameOutput, value interface{}) error { 1072 if v == nil { 1073 return fmt.Errorf("unexpected nil of type %T", v) 1074 } 1075 if value == nil { 1076 return nil 1077 } 1078 1079 shape, ok := value.(map[string]interface{}) 1080 if !ok { 1081 return fmt.Errorf("unexpected JSON type %v", value) 1082 } 1083 1084 var sv *CreateDomainNameOutput 1085 if *v == nil { 1086 sv = &CreateDomainNameOutput{} 1087 } else { 1088 sv = *v 1089 } 1090 1091 for key, value := range shape { 1092 switch key { 1093 case "apiMappingSelectionExpression": 1094 if value != nil { 1095 jtv, ok := value.(string) 1096 if !ok { 1097 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 1098 } 1099 sv.ApiMappingSelectionExpression = ptr.String(jtv) 1100 } 1101 1102 case "domainName": 1103 if value != nil { 1104 jtv, ok := value.(string) 1105 if !ok { 1106 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 1107 } 1108 sv.DomainName = ptr.String(jtv) 1109 } 1110 1111 case "domainNameConfigurations": 1112 if err := awsRestjson1_deserializeDocumentDomainNameConfigurations(&sv.DomainNameConfigurations, value); err != nil { 1113 return err 1114 } 1115 1116 case "mutualTlsAuthentication": 1117 if err := awsRestjson1_deserializeDocumentMutualTlsAuthentication(&sv.MutualTlsAuthentication, value); err != nil { 1118 return err 1119 } 1120 1121 case "tags": 1122 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 1123 return err 1124 } 1125 1126 default: 1127 _, _ = key, value 1128 1129 } 1130 } 1131 *v = sv 1132 return nil 1133} 1134 1135type awsRestjson1_deserializeOpCreateIntegration struct { 1136} 1137 1138func (*awsRestjson1_deserializeOpCreateIntegration) ID() string { 1139 return "OperationDeserializer" 1140} 1141 1142func (m *awsRestjson1_deserializeOpCreateIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1143 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1144) { 1145 out, metadata, err = next.HandleDeserialize(ctx, in) 1146 if err != nil { 1147 return out, metadata, err 1148 } 1149 1150 response, ok := out.RawResponse.(*smithyhttp.Response) 1151 if !ok { 1152 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1153 } 1154 1155 if response.StatusCode < 200 || response.StatusCode >= 300 { 1156 return out, metadata, awsRestjson1_deserializeOpErrorCreateIntegration(response, &metadata) 1157 } 1158 output := &CreateIntegrationOutput{} 1159 out.Result = output 1160 1161 var buff [1024]byte 1162 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1163 1164 body := io.TeeReader(response.Body, ringBuffer) 1165 1166 decoder := json.NewDecoder(body) 1167 decoder.UseNumber() 1168 var shape interface{} 1169 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1170 var snapshot bytes.Buffer 1171 io.Copy(&snapshot, ringBuffer) 1172 err = &smithy.DeserializationError{ 1173 Err: fmt.Errorf("failed to decode response body, %w", err), 1174 Snapshot: snapshot.Bytes(), 1175 } 1176 return out, metadata, err 1177 } 1178 1179 err = awsRestjson1_deserializeOpDocumentCreateIntegrationOutput(&output, shape) 1180 if err != nil { 1181 var snapshot bytes.Buffer 1182 io.Copy(&snapshot, ringBuffer) 1183 return out, metadata, &smithy.DeserializationError{ 1184 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1185 Snapshot: snapshot.Bytes(), 1186 } 1187 } 1188 1189 return out, metadata, err 1190} 1191 1192func awsRestjson1_deserializeOpErrorCreateIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1193 var errorBuffer bytes.Buffer 1194 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1195 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1196 } 1197 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1198 1199 errorCode := "UnknownError" 1200 errorMessage := errorCode 1201 1202 code := response.Header.Get("X-Amzn-ErrorType") 1203 if len(code) != 0 { 1204 errorCode = restjson.SanitizeErrorCode(code) 1205 } 1206 1207 var buff [1024]byte 1208 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1209 1210 body := io.TeeReader(errorBody, ringBuffer) 1211 decoder := json.NewDecoder(body) 1212 decoder.UseNumber() 1213 code, message, err := restjson.GetErrorInfo(decoder) 1214 if err != nil { 1215 var snapshot bytes.Buffer 1216 io.Copy(&snapshot, ringBuffer) 1217 err = &smithy.DeserializationError{ 1218 Err: fmt.Errorf("failed to decode response body, %w", err), 1219 Snapshot: snapshot.Bytes(), 1220 } 1221 return err 1222 } 1223 1224 errorBody.Seek(0, io.SeekStart) 1225 if len(code) != 0 { 1226 errorCode = restjson.SanitizeErrorCode(code) 1227 } 1228 if len(message) != 0 { 1229 errorMessage = message 1230 } 1231 1232 switch { 1233 case strings.EqualFold("BadRequestException", errorCode): 1234 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1235 1236 case strings.EqualFold("ConflictException", errorCode): 1237 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1238 1239 case strings.EqualFold("NotFoundException", errorCode): 1240 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1241 1242 case strings.EqualFold("TooManyRequestsException", errorCode): 1243 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1244 1245 default: 1246 genericError := &smithy.GenericAPIError{ 1247 Code: errorCode, 1248 Message: errorMessage, 1249 } 1250 return genericError 1251 1252 } 1253} 1254 1255func awsRestjson1_deserializeOpDocumentCreateIntegrationOutput(v **CreateIntegrationOutput, value interface{}) error { 1256 if v == nil { 1257 return fmt.Errorf("unexpected nil of type %T", v) 1258 } 1259 if value == nil { 1260 return nil 1261 } 1262 1263 shape, ok := value.(map[string]interface{}) 1264 if !ok { 1265 return fmt.Errorf("unexpected JSON type %v", value) 1266 } 1267 1268 var sv *CreateIntegrationOutput 1269 if *v == nil { 1270 sv = &CreateIntegrationOutput{} 1271 } else { 1272 sv = *v 1273 } 1274 1275 for key, value := range shape { 1276 switch key { 1277 case "apiGatewayManaged": 1278 if value != nil { 1279 jtv, ok := value.(bool) 1280 if !ok { 1281 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 1282 } 1283 sv.ApiGatewayManaged = jtv 1284 } 1285 1286 case "connectionId": 1287 if value != nil { 1288 jtv, ok := value.(string) 1289 if !ok { 1290 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 1291 } 1292 sv.ConnectionId = ptr.String(jtv) 1293 } 1294 1295 case "connectionType": 1296 if value != nil { 1297 jtv, ok := value.(string) 1298 if !ok { 1299 return fmt.Errorf("expected ConnectionType to be of type string, got %T instead", value) 1300 } 1301 sv.ConnectionType = types.ConnectionType(jtv) 1302 } 1303 1304 case "contentHandlingStrategy": 1305 if value != nil { 1306 jtv, ok := value.(string) 1307 if !ok { 1308 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 1309 } 1310 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 1311 } 1312 1313 case "credentialsArn": 1314 if value != nil { 1315 jtv, ok := value.(string) 1316 if !ok { 1317 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1318 } 1319 sv.CredentialsArn = ptr.String(jtv) 1320 } 1321 1322 case "description": 1323 if value != nil { 1324 jtv, ok := value.(string) 1325 if !ok { 1326 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 1327 } 1328 sv.Description = ptr.String(jtv) 1329 } 1330 1331 case "integrationId": 1332 if value != nil { 1333 jtv, ok := value.(string) 1334 if !ok { 1335 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1336 } 1337 sv.IntegrationId = ptr.String(jtv) 1338 } 1339 1340 case "integrationMethod": 1341 if value != nil { 1342 jtv, ok := value.(string) 1343 if !ok { 1344 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 1345 } 1346 sv.IntegrationMethod = ptr.String(jtv) 1347 } 1348 1349 case "integrationResponseSelectionExpression": 1350 if value != nil { 1351 jtv, ok := value.(string) 1352 if !ok { 1353 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 1354 } 1355 sv.IntegrationResponseSelectionExpression = ptr.String(jtv) 1356 } 1357 1358 case "integrationSubtype": 1359 if value != nil { 1360 jtv, ok := value.(string) 1361 if !ok { 1362 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 1363 } 1364 sv.IntegrationSubtype = ptr.String(jtv) 1365 } 1366 1367 case "integrationType": 1368 if value != nil { 1369 jtv, ok := value.(string) 1370 if !ok { 1371 return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) 1372 } 1373 sv.IntegrationType = types.IntegrationType(jtv) 1374 } 1375 1376 case "integrationUri": 1377 if value != nil { 1378 jtv, ok := value.(string) 1379 if !ok { 1380 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 1381 } 1382 sv.IntegrationUri = ptr.String(jtv) 1383 } 1384 1385 case "passthroughBehavior": 1386 if value != nil { 1387 jtv, ok := value.(string) 1388 if !ok { 1389 return fmt.Errorf("expected PassthroughBehavior to be of type string, got %T instead", value) 1390 } 1391 sv.PassthroughBehavior = types.PassthroughBehavior(jtv) 1392 } 1393 1394 case "payloadFormatVersion": 1395 if value != nil { 1396 jtv, ok := value.(string) 1397 if !ok { 1398 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 1399 } 1400 sv.PayloadFormatVersion = ptr.String(jtv) 1401 } 1402 1403 case "requestParameters": 1404 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.RequestParameters, value); err != nil { 1405 return err 1406 } 1407 1408 case "requestTemplates": 1409 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.RequestTemplates, value); err != nil { 1410 return err 1411 } 1412 1413 case "responseParameters": 1414 if err := awsRestjson1_deserializeDocumentResponseParameters(&sv.ResponseParameters, value); err != nil { 1415 return err 1416 } 1417 1418 case "templateSelectionExpression": 1419 if value != nil { 1420 jtv, ok := value.(string) 1421 if !ok { 1422 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 1423 } 1424 sv.TemplateSelectionExpression = ptr.String(jtv) 1425 } 1426 1427 case "timeoutInMillis": 1428 if value != nil { 1429 jtv, ok := value.(json.Number) 1430 if !ok { 1431 return fmt.Errorf("expected IntegerWithLengthBetween50And30000 to be json.Number, got %T instead", value) 1432 } 1433 i64, err := jtv.Int64() 1434 if err != nil { 1435 return err 1436 } 1437 sv.TimeoutInMillis = int32(i64) 1438 } 1439 1440 case "tlsConfig": 1441 if err := awsRestjson1_deserializeDocumentTlsConfig(&sv.TlsConfig, value); err != nil { 1442 return err 1443 } 1444 1445 default: 1446 _, _ = key, value 1447 1448 } 1449 } 1450 *v = sv 1451 return nil 1452} 1453 1454type awsRestjson1_deserializeOpCreateIntegrationResponse struct { 1455} 1456 1457func (*awsRestjson1_deserializeOpCreateIntegrationResponse) ID() string { 1458 return "OperationDeserializer" 1459} 1460 1461func (m *awsRestjson1_deserializeOpCreateIntegrationResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1462 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1463) { 1464 out, metadata, err = next.HandleDeserialize(ctx, in) 1465 if err != nil { 1466 return out, metadata, err 1467 } 1468 1469 response, ok := out.RawResponse.(*smithyhttp.Response) 1470 if !ok { 1471 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1472 } 1473 1474 if response.StatusCode < 200 || response.StatusCode >= 300 { 1475 return out, metadata, awsRestjson1_deserializeOpErrorCreateIntegrationResponse(response, &metadata) 1476 } 1477 output := &CreateIntegrationResponseOutput{} 1478 out.Result = output 1479 1480 var buff [1024]byte 1481 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1482 1483 body := io.TeeReader(response.Body, ringBuffer) 1484 1485 decoder := json.NewDecoder(body) 1486 decoder.UseNumber() 1487 var shape interface{} 1488 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1489 var snapshot bytes.Buffer 1490 io.Copy(&snapshot, ringBuffer) 1491 err = &smithy.DeserializationError{ 1492 Err: fmt.Errorf("failed to decode response body, %w", err), 1493 Snapshot: snapshot.Bytes(), 1494 } 1495 return out, metadata, err 1496 } 1497 1498 err = awsRestjson1_deserializeOpDocumentCreateIntegrationResponseOutput(&output, shape) 1499 if err != nil { 1500 var snapshot bytes.Buffer 1501 io.Copy(&snapshot, ringBuffer) 1502 return out, metadata, &smithy.DeserializationError{ 1503 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1504 Snapshot: snapshot.Bytes(), 1505 } 1506 } 1507 1508 return out, metadata, err 1509} 1510 1511func awsRestjson1_deserializeOpErrorCreateIntegrationResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1512 var errorBuffer bytes.Buffer 1513 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1514 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1515 } 1516 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1517 1518 errorCode := "UnknownError" 1519 errorMessage := errorCode 1520 1521 code := response.Header.Get("X-Amzn-ErrorType") 1522 if len(code) != 0 { 1523 errorCode = restjson.SanitizeErrorCode(code) 1524 } 1525 1526 var buff [1024]byte 1527 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1528 1529 body := io.TeeReader(errorBody, ringBuffer) 1530 decoder := json.NewDecoder(body) 1531 decoder.UseNumber() 1532 code, message, err := restjson.GetErrorInfo(decoder) 1533 if err != nil { 1534 var snapshot bytes.Buffer 1535 io.Copy(&snapshot, ringBuffer) 1536 err = &smithy.DeserializationError{ 1537 Err: fmt.Errorf("failed to decode response body, %w", err), 1538 Snapshot: snapshot.Bytes(), 1539 } 1540 return err 1541 } 1542 1543 errorBody.Seek(0, io.SeekStart) 1544 if len(code) != 0 { 1545 errorCode = restjson.SanitizeErrorCode(code) 1546 } 1547 if len(message) != 0 { 1548 errorMessage = message 1549 } 1550 1551 switch { 1552 case strings.EqualFold("BadRequestException", errorCode): 1553 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1554 1555 case strings.EqualFold("ConflictException", errorCode): 1556 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1557 1558 case strings.EqualFold("NotFoundException", errorCode): 1559 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1560 1561 case strings.EqualFold("TooManyRequestsException", errorCode): 1562 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1563 1564 default: 1565 genericError := &smithy.GenericAPIError{ 1566 Code: errorCode, 1567 Message: errorMessage, 1568 } 1569 return genericError 1570 1571 } 1572} 1573 1574func awsRestjson1_deserializeOpDocumentCreateIntegrationResponseOutput(v **CreateIntegrationResponseOutput, value interface{}) error { 1575 if v == nil { 1576 return fmt.Errorf("unexpected nil of type %T", v) 1577 } 1578 if value == nil { 1579 return nil 1580 } 1581 1582 shape, ok := value.(map[string]interface{}) 1583 if !ok { 1584 return fmt.Errorf("unexpected JSON type %v", value) 1585 } 1586 1587 var sv *CreateIntegrationResponseOutput 1588 if *v == nil { 1589 sv = &CreateIntegrationResponseOutput{} 1590 } else { 1591 sv = *v 1592 } 1593 1594 for key, value := range shape { 1595 switch key { 1596 case "contentHandlingStrategy": 1597 if value != nil { 1598 jtv, ok := value.(string) 1599 if !ok { 1600 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 1601 } 1602 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 1603 } 1604 1605 case "integrationResponseId": 1606 if value != nil { 1607 jtv, ok := value.(string) 1608 if !ok { 1609 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1610 } 1611 sv.IntegrationResponseId = ptr.String(jtv) 1612 } 1613 1614 case "integrationResponseKey": 1615 if value != nil { 1616 jtv, ok := value.(string) 1617 if !ok { 1618 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 1619 } 1620 sv.IntegrationResponseKey = ptr.String(jtv) 1621 } 1622 1623 case "responseParameters": 1624 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.ResponseParameters, value); err != nil { 1625 return err 1626 } 1627 1628 case "responseTemplates": 1629 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.ResponseTemplates, value); err != nil { 1630 return err 1631 } 1632 1633 case "templateSelectionExpression": 1634 if value != nil { 1635 jtv, ok := value.(string) 1636 if !ok { 1637 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 1638 } 1639 sv.TemplateSelectionExpression = ptr.String(jtv) 1640 } 1641 1642 default: 1643 _, _ = key, value 1644 1645 } 1646 } 1647 *v = sv 1648 return nil 1649} 1650 1651type awsRestjson1_deserializeOpCreateModel struct { 1652} 1653 1654func (*awsRestjson1_deserializeOpCreateModel) ID() string { 1655 return "OperationDeserializer" 1656} 1657 1658func (m *awsRestjson1_deserializeOpCreateModel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1659 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1660) { 1661 out, metadata, err = next.HandleDeserialize(ctx, in) 1662 if err != nil { 1663 return out, metadata, err 1664 } 1665 1666 response, ok := out.RawResponse.(*smithyhttp.Response) 1667 if !ok { 1668 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1669 } 1670 1671 if response.StatusCode < 200 || response.StatusCode >= 300 { 1672 return out, metadata, awsRestjson1_deserializeOpErrorCreateModel(response, &metadata) 1673 } 1674 output := &CreateModelOutput{} 1675 out.Result = output 1676 1677 var buff [1024]byte 1678 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1679 1680 body := io.TeeReader(response.Body, ringBuffer) 1681 1682 decoder := json.NewDecoder(body) 1683 decoder.UseNumber() 1684 var shape interface{} 1685 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1686 var snapshot bytes.Buffer 1687 io.Copy(&snapshot, ringBuffer) 1688 err = &smithy.DeserializationError{ 1689 Err: fmt.Errorf("failed to decode response body, %w", err), 1690 Snapshot: snapshot.Bytes(), 1691 } 1692 return out, metadata, err 1693 } 1694 1695 err = awsRestjson1_deserializeOpDocumentCreateModelOutput(&output, shape) 1696 if err != nil { 1697 var snapshot bytes.Buffer 1698 io.Copy(&snapshot, ringBuffer) 1699 return out, metadata, &smithy.DeserializationError{ 1700 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1701 Snapshot: snapshot.Bytes(), 1702 } 1703 } 1704 1705 return out, metadata, err 1706} 1707 1708func awsRestjson1_deserializeOpErrorCreateModel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1709 var errorBuffer bytes.Buffer 1710 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1711 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1712 } 1713 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1714 1715 errorCode := "UnknownError" 1716 errorMessage := errorCode 1717 1718 code := response.Header.Get("X-Amzn-ErrorType") 1719 if len(code) != 0 { 1720 errorCode = restjson.SanitizeErrorCode(code) 1721 } 1722 1723 var buff [1024]byte 1724 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1725 1726 body := io.TeeReader(errorBody, ringBuffer) 1727 decoder := json.NewDecoder(body) 1728 decoder.UseNumber() 1729 code, message, err := restjson.GetErrorInfo(decoder) 1730 if err != nil { 1731 var snapshot bytes.Buffer 1732 io.Copy(&snapshot, ringBuffer) 1733 err = &smithy.DeserializationError{ 1734 Err: fmt.Errorf("failed to decode response body, %w", err), 1735 Snapshot: snapshot.Bytes(), 1736 } 1737 return err 1738 } 1739 1740 errorBody.Seek(0, io.SeekStart) 1741 if len(code) != 0 { 1742 errorCode = restjson.SanitizeErrorCode(code) 1743 } 1744 if len(message) != 0 { 1745 errorMessage = message 1746 } 1747 1748 switch { 1749 case strings.EqualFold("BadRequestException", errorCode): 1750 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1751 1752 case strings.EqualFold("ConflictException", errorCode): 1753 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1754 1755 case strings.EqualFold("NotFoundException", errorCode): 1756 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1757 1758 case strings.EqualFold("TooManyRequestsException", errorCode): 1759 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1760 1761 default: 1762 genericError := &smithy.GenericAPIError{ 1763 Code: errorCode, 1764 Message: errorMessage, 1765 } 1766 return genericError 1767 1768 } 1769} 1770 1771func awsRestjson1_deserializeOpDocumentCreateModelOutput(v **CreateModelOutput, value interface{}) error { 1772 if v == nil { 1773 return fmt.Errorf("unexpected nil of type %T", v) 1774 } 1775 if value == nil { 1776 return nil 1777 } 1778 1779 shape, ok := value.(map[string]interface{}) 1780 if !ok { 1781 return fmt.Errorf("unexpected JSON type %v", value) 1782 } 1783 1784 var sv *CreateModelOutput 1785 if *v == nil { 1786 sv = &CreateModelOutput{} 1787 } else { 1788 sv = *v 1789 } 1790 1791 for key, value := range shape { 1792 switch key { 1793 case "contentType": 1794 if value != nil { 1795 jtv, ok := value.(string) 1796 if !ok { 1797 return fmt.Errorf("expected StringWithLengthBetween1And256 to be of type string, got %T instead", value) 1798 } 1799 sv.ContentType = ptr.String(jtv) 1800 } 1801 1802 case "description": 1803 if value != nil { 1804 jtv, ok := value.(string) 1805 if !ok { 1806 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 1807 } 1808 sv.Description = ptr.String(jtv) 1809 } 1810 1811 case "modelId": 1812 if value != nil { 1813 jtv, ok := value.(string) 1814 if !ok { 1815 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1816 } 1817 sv.ModelId = ptr.String(jtv) 1818 } 1819 1820 case "name": 1821 if value != nil { 1822 jtv, ok := value.(string) 1823 if !ok { 1824 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 1825 } 1826 sv.Name = ptr.String(jtv) 1827 } 1828 1829 case "schema": 1830 if value != nil { 1831 jtv, ok := value.(string) 1832 if !ok { 1833 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 1834 } 1835 sv.Schema = ptr.String(jtv) 1836 } 1837 1838 default: 1839 _, _ = key, value 1840 1841 } 1842 } 1843 *v = sv 1844 return nil 1845} 1846 1847type awsRestjson1_deserializeOpCreateRoute struct { 1848} 1849 1850func (*awsRestjson1_deserializeOpCreateRoute) ID() string { 1851 return "OperationDeserializer" 1852} 1853 1854func (m *awsRestjson1_deserializeOpCreateRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1855 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1856) { 1857 out, metadata, err = next.HandleDeserialize(ctx, in) 1858 if err != nil { 1859 return out, metadata, err 1860 } 1861 1862 response, ok := out.RawResponse.(*smithyhttp.Response) 1863 if !ok { 1864 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1865 } 1866 1867 if response.StatusCode < 200 || response.StatusCode >= 300 { 1868 return out, metadata, awsRestjson1_deserializeOpErrorCreateRoute(response, &metadata) 1869 } 1870 output := &CreateRouteOutput{} 1871 out.Result = output 1872 1873 var buff [1024]byte 1874 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1875 1876 body := io.TeeReader(response.Body, ringBuffer) 1877 1878 decoder := json.NewDecoder(body) 1879 decoder.UseNumber() 1880 var shape interface{} 1881 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1882 var snapshot bytes.Buffer 1883 io.Copy(&snapshot, ringBuffer) 1884 err = &smithy.DeserializationError{ 1885 Err: fmt.Errorf("failed to decode response body, %w", err), 1886 Snapshot: snapshot.Bytes(), 1887 } 1888 return out, metadata, err 1889 } 1890 1891 err = awsRestjson1_deserializeOpDocumentCreateRouteOutput(&output, shape) 1892 if err != nil { 1893 var snapshot bytes.Buffer 1894 io.Copy(&snapshot, ringBuffer) 1895 return out, metadata, &smithy.DeserializationError{ 1896 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1897 Snapshot: snapshot.Bytes(), 1898 } 1899 } 1900 1901 return out, metadata, err 1902} 1903 1904func awsRestjson1_deserializeOpErrorCreateRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1905 var errorBuffer bytes.Buffer 1906 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1907 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1908 } 1909 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1910 1911 errorCode := "UnknownError" 1912 errorMessage := errorCode 1913 1914 code := response.Header.Get("X-Amzn-ErrorType") 1915 if len(code) != 0 { 1916 errorCode = restjson.SanitizeErrorCode(code) 1917 } 1918 1919 var buff [1024]byte 1920 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1921 1922 body := io.TeeReader(errorBody, ringBuffer) 1923 decoder := json.NewDecoder(body) 1924 decoder.UseNumber() 1925 code, message, err := restjson.GetErrorInfo(decoder) 1926 if err != nil { 1927 var snapshot bytes.Buffer 1928 io.Copy(&snapshot, ringBuffer) 1929 err = &smithy.DeserializationError{ 1930 Err: fmt.Errorf("failed to decode response body, %w", err), 1931 Snapshot: snapshot.Bytes(), 1932 } 1933 return err 1934 } 1935 1936 errorBody.Seek(0, io.SeekStart) 1937 if len(code) != 0 { 1938 errorCode = restjson.SanitizeErrorCode(code) 1939 } 1940 if len(message) != 0 { 1941 errorMessage = message 1942 } 1943 1944 switch { 1945 case strings.EqualFold("BadRequestException", errorCode): 1946 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1947 1948 case strings.EqualFold("ConflictException", errorCode): 1949 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1950 1951 case strings.EqualFold("NotFoundException", errorCode): 1952 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1953 1954 case strings.EqualFold("TooManyRequestsException", errorCode): 1955 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1956 1957 default: 1958 genericError := &smithy.GenericAPIError{ 1959 Code: errorCode, 1960 Message: errorMessage, 1961 } 1962 return genericError 1963 1964 } 1965} 1966 1967func awsRestjson1_deserializeOpDocumentCreateRouteOutput(v **CreateRouteOutput, value interface{}) error { 1968 if v == nil { 1969 return fmt.Errorf("unexpected nil of type %T", v) 1970 } 1971 if value == nil { 1972 return nil 1973 } 1974 1975 shape, ok := value.(map[string]interface{}) 1976 if !ok { 1977 return fmt.Errorf("unexpected JSON type %v", value) 1978 } 1979 1980 var sv *CreateRouteOutput 1981 if *v == nil { 1982 sv = &CreateRouteOutput{} 1983 } else { 1984 sv = *v 1985 } 1986 1987 for key, value := range shape { 1988 switch key { 1989 case "apiGatewayManaged": 1990 if value != nil { 1991 jtv, ok := value.(bool) 1992 if !ok { 1993 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 1994 } 1995 sv.ApiGatewayManaged = jtv 1996 } 1997 1998 case "apiKeyRequired": 1999 if value != nil { 2000 jtv, ok := value.(bool) 2001 if !ok { 2002 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 2003 } 2004 sv.ApiKeyRequired = jtv 2005 } 2006 2007 case "authorizationScopes": 2008 if err := awsRestjson1_deserializeDocumentAuthorizationScopes(&sv.AuthorizationScopes, value); err != nil { 2009 return err 2010 } 2011 2012 case "authorizationType": 2013 if value != nil { 2014 jtv, ok := value.(string) 2015 if !ok { 2016 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 2017 } 2018 sv.AuthorizationType = types.AuthorizationType(jtv) 2019 } 2020 2021 case "authorizerId": 2022 if value != nil { 2023 jtv, ok := value.(string) 2024 if !ok { 2025 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2026 } 2027 sv.AuthorizerId = ptr.String(jtv) 2028 } 2029 2030 case "modelSelectionExpression": 2031 if value != nil { 2032 jtv, ok := value.(string) 2033 if !ok { 2034 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 2035 } 2036 sv.ModelSelectionExpression = ptr.String(jtv) 2037 } 2038 2039 case "operationName": 2040 if value != nil { 2041 jtv, ok := value.(string) 2042 if !ok { 2043 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 2044 } 2045 sv.OperationName = ptr.String(jtv) 2046 } 2047 2048 case "requestModels": 2049 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.RequestModels, value); err != nil { 2050 return err 2051 } 2052 2053 case "requestParameters": 2054 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.RequestParameters, value); err != nil { 2055 return err 2056 } 2057 2058 case "routeId": 2059 if value != nil { 2060 jtv, ok := value.(string) 2061 if !ok { 2062 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2063 } 2064 sv.RouteId = ptr.String(jtv) 2065 } 2066 2067 case "routeKey": 2068 if value != nil { 2069 jtv, ok := value.(string) 2070 if !ok { 2071 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 2072 } 2073 sv.RouteKey = ptr.String(jtv) 2074 } 2075 2076 case "routeResponseSelectionExpression": 2077 if value != nil { 2078 jtv, ok := value.(string) 2079 if !ok { 2080 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 2081 } 2082 sv.RouteResponseSelectionExpression = ptr.String(jtv) 2083 } 2084 2085 case "target": 2086 if value != nil { 2087 jtv, ok := value.(string) 2088 if !ok { 2089 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 2090 } 2091 sv.Target = ptr.String(jtv) 2092 } 2093 2094 default: 2095 _, _ = key, value 2096 2097 } 2098 } 2099 *v = sv 2100 return nil 2101} 2102 2103type awsRestjson1_deserializeOpCreateRouteResponse struct { 2104} 2105 2106func (*awsRestjson1_deserializeOpCreateRouteResponse) ID() string { 2107 return "OperationDeserializer" 2108} 2109 2110func (m *awsRestjson1_deserializeOpCreateRouteResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2111 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2112) { 2113 out, metadata, err = next.HandleDeserialize(ctx, in) 2114 if err != nil { 2115 return out, metadata, err 2116 } 2117 2118 response, ok := out.RawResponse.(*smithyhttp.Response) 2119 if !ok { 2120 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2121 } 2122 2123 if response.StatusCode < 200 || response.StatusCode >= 300 { 2124 return out, metadata, awsRestjson1_deserializeOpErrorCreateRouteResponse(response, &metadata) 2125 } 2126 output := &CreateRouteResponseOutput{} 2127 out.Result = output 2128 2129 var buff [1024]byte 2130 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2131 2132 body := io.TeeReader(response.Body, ringBuffer) 2133 2134 decoder := json.NewDecoder(body) 2135 decoder.UseNumber() 2136 var shape interface{} 2137 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2138 var snapshot bytes.Buffer 2139 io.Copy(&snapshot, ringBuffer) 2140 err = &smithy.DeserializationError{ 2141 Err: fmt.Errorf("failed to decode response body, %w", err), 2142 Snapshot: snapshot.Bytes(), 2143 } 2144 return out, metadata, err 2145 } 2146 2147 err = awsRestjson1_deserializeOpDocumentCreateRouteResponseOutput(&output, shape) 2148 if err != nil { 2149 var snapshot bytes.Buffer 2150 io.Copy(&snapshot, ringBuffer) 2151 return out, metadata, &smithy.DeserializationError{ 2152 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2153 Snapshot: snapshot.Bytes(), 2154 } 2155 } 2156 2157 return out, metadata, err 2158} 2159 2160func awsRestjson1_deserializeOpErrorCreateRouteResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2161 var errorBuffer bytes.Buffer 2162 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2163 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2164 } 2165 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2166 2167 errorCode := "UnknownError" 2168 errorMessage := errorCode 2169 2170 code := response.Header.Get("X-Amzn-ErrorType") 2171 if len(code) != 0 { 2172 errorCode = restjson.SanitizeErrorCode(code) 2173 } 2174 2175 var buff [1024]byte 2176 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2177 2178 body := io.TeeReader(errorBody, ringBuffer) 2179 decoder := json.NewDecoder(body) 2180 decoder.UseNumber() 2181 code, message, err := restjson.GetErrorInfo(decoder) 2182 if err != nil { 2183 var snapshot bytes.Buffer 2184 io.Copy(&snapshot, ringBuffer) 2185 err = &smithy.DeserializationError{ 2186 Err: fmt.Errorf("failed to decode response body, %w", err), 2187 Snapshot: snapshot.Bytes(), 2188 } 2189 return err 2190 } 2191 2192 errorBody.Seek(0, io.SeekStart) 2193 if len(code) != 0 { 2194 errorCode = restjson.SanitizeErrorCode(code) 2195 } 2196 if len(message) != 0 { 2197 errorMessage = message 2198 } 2199 2200 switch { 2201 case strings.EqualFold("BadRequestException", errorCode): 2202 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2203 2204 case strings.EqualFold("ConflictException", errorCode): 2205 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2206 2207 case strings.EqualFold("NotFoundException", errorCode): 2208 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2209 2210 case strings.EqualFold("TooManyRequestsException", errorCode): 2211 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2212 2213 default: 2214 genericError := &smithy.GenericAPIError{ 2215 Code: errorCode, 2216 Message: errorMessage, 2217 } 2218 return genericError 2219 2220 } 2221} 2222 2223func awsRestjson1_deserializeOpDocumentCreateRouteResponseOutput(v **CreateRouteResponseOutput, value interface{}) error { 2224 if v == nil { 2225 return fmt.Errorf("unexpected nil of type %T", v) 2226 } 2227 if value == nil { 2228 return nil 2229 } 2230 2231 shape, ok := value.(map[string]interface{}) 2232 if !ok { 2233 return fmt.Errorf("unexpected JSON type %v", value) 2234 } 2235 2236 var sv *CreateRouteResponseOutput 2237 if *v == nil { 2238 sv = &CreateRouteResponseOutput{} 2239 } else { 2240 sv = *v 2241 } 2242 2243 for key, value := range shape { 2244 switch key { 2245 case "modelSelectionExpression": 2246 if value != nil { 2247 jtv, ok := value.(string) 2248 if !ok { 2249 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 2250 } 2251 sv.ModelSelectionExpression = ptr.String(jtv) 2252 } 2253 2254 case "responseModels": 2255 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.ResponseModels, value); err != nil { 2256 return err 2257 } 2258 2259 case "responseParameters": 2260 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.ResponseParameters, value); err != nil { 2261 return err 2262 } 2263 2264 case "routeResponseId": 2265 if value != nil { 2266 jtv, ok := value.(string) 2267 if !ok { 2268 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2269 } 2270 sv.RouteResponseId = ptr.String(jtv) 2271 } 2272 2273 case "routeResponseKey": 2274 if value != nil { 2275 jtv, ok := value.(string) 2276 if !ok { 2277 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 2278 } 2279 sv.RouteResponseKey = ptr.String(jtv) 2280 } 2281 2282 default: 2283 _, _ = key, value 2284 2285 } 2286 } 2287 *v = sv 2288 return nil 2289} 2290 2291type awsRestjson1_deserializeOpCreateStage struct { 2292} 2293 2294func (*awsRestjson1_deserializeOpCreateStage) ID() string { 2295 return "OperationDeserializer" 2296} 2297 2298func (m *awsRestjson1_deserializeOpCreateStage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2299 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2300) { 2301 out, metadata, err = next.HandleDeserialize(ctx, in) 2302 if err != nil { 2303 return out, metadata, err 2304 } 2305 2306 response, ok := out.RawResponse.(*smithyhttp.Response) 2307 if !ok { 2308 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2309 } 2310 2311 if response.StatusCode < 200 || response.StatusCode >= 300 { 2312 return out, metadata, awsRestjson1_deserializeOpErrorCreateStage(response, &metadata) 2313 } 2314 output := &CreateStageOutput{} 2315 out.Result = output 2316 2317 var buff [1024]byte 2318 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2319 2320 body := io.TeeReader(response.Body, ringBuffer) 2321 2322 decoder := json.NewDecoder(body) 2323 decoder.UseNumber() 2324 var shape interface{} 2325 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2326 var snapshot bytes.Buffer 2327 io.Copy(&snapshot, ringBuffer) 2328 err = &smithy.DeserializationError{ 2329 Err: fmt.Errorf("failed to decode response body, %w", err), 2330 Snapshot: snapshot.Bytes(), 2331 } 2332 return out, metadata, err 2333 } 2334 2335 err = awsRestjson1_deserializeOpDocumentCreateStageOutput(&output, shape) 2336 if err != nil { 2337 var snapshot bytes.Buffer 2338 io.Copy(&snapshot, ringBuffer) 2339 return out, metadata, &smithy.DeserializationError{ 2340 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2341 Snapshot: snapshot.Bytes(), 2342 } 2343 } 2344 2345 return out, metadata, err 2346} 2347 2348func awsRestjson1_deserializeOpErrorCreateStage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2349 var errorBuffer bytes.Buffer 2350 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2351 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2352 } 2353 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2354 2355 errorCode := "UnknownError" 2356 errorMessage := errorCode 2357 2358 code := response.Header.Get("X-Amzn-ErrorType") 2359 if len(code) != 0 { 2360 errorCode = restjson.SanitizeErrorCode(code) 2361 } 2362 2363 var buff [1024]byte 2364 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2365 2366 body := io.TeeReader(errorBody, ringBuffer) 2367 decoder := json.NewDecoder(body) 2368 decoder.UseNumber() 2369 code, message, err := restjson.GetErrorInfo(decoder) 2370 if err != nil { 2371 var snapshot bytes.Buffer 2372 io.Copy(&snapshot, ringBuffer) 2373 err = &smithy.DeserializationError{ 2374 Err: fmt.Errorf("failed to decode response body, %w", err), 2375 Snapshot: snapshot.Bytes(), 2376 } 2377 return err 2378 } 2379 2380 errorBody.Seek(0, io.SeekStart) 2381 if len(code) != 0 { 2382 errorCode = restjson.SanitizeErrorCode(code) 2383 } 2384 if len(message) != 0 { 2385 errorMessage = message 2386 } 2387 2388 switch { 2389 case strings.EqualFold("BadRequestException", errorCode): 2390 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2391 2392 case strings.EqualFold("ConflictException", errorCode): 2393 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2394 2395 case strings.EqualFold("NotFoundException", errorCode): 2396 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2397 2398 case strings.EqualFold("TooManyRequestsException", errorCode): 2399 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2400 2401 default: 2402 genericError := &smithy.GenericAPIError{ 2403 Code: errorCode, 2404 Message: errorMessage, 2405 } 2406 return genericError 2407 2408 } 2409} 2410 2411func awsRestjson1_deserializeOpDocumentCreateStageOutput(v **CreateStageOutput, value interface{}) error { 2412 if v == nil { 2413 return fmt.Errorf("unexpected nil of type %T", v) 2414 } 2415 if value == nil { 2416 return nil 2417 } 2418 2419 shape, ok := value.(map[string]interface{}) 2420 if !ok { 2421 return fmt.Errorf("unexpected JSON type %v", value) 2422 } 2423 2424 var sv *CreateStageOutput 2425 if *v == nil { 2426 sv = &CreateStageOutput{} 2427 } else { 2428 sv = *v 2429 } 2430 2431 for key, value := range shape { 2432 switch key { 2433 case "accessLogSettings": 2434 if err := awsRestjson1_deserializeDocumentAccessLogSettings(&sv.AccessLogSettings, value); err != nil { 2435 return err 2436 } 2437 2438 case "apiGatewayManaged": 2439 if value != nil { 2440 jtv, ok := value.(bool) 2441 if !ok { 2442 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 2443 } 2444 sv.ApiGatewayManaged = jtv 2445 } 2446 2447 case "autoDeploy": 2448 if value != nil { 2449 jtv, ok := value.(bool) 2450 if !ok { 2451 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 2452 } 2453 sv.AutoDeploy = jtv 2454 } 2455 2456 case "clientCertificateId": 2457 if value != nil { 2458 jtv, ok := value.(string) 2459 if !ok { 2460 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2461 } 2462 sv.ClientCertificateId = ptr.String(jtv) 2463 } 2464 2465 case "createdDate": 2466 if value != nil { 2467 jtv, ok := value.(string) 2468 if !ok { 2469 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 2470 } 2471 t, err := smithytime.ParseDateTime(jtv) 2472 if err != nil { 2473 return err 2474 } 2475 sv.CreatedDate = ptr.Time(t) 2476 } 2477 2478 case "defaultRouteSettings": 2479 if err := awsRestjson1_deserializeDocumentRouteSettings(&sv.DefaultRouteSettings, value); err != nil { 2480 return err 2481 } 2482 2483 case "deploymentId": 2484 if value != nil { 2485 jtv, ok := value.(string) 2486 if !ok { 2487 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2488 } 2489 sv.DeploymentId = ptr.String(jtv) 2490 } 2491 2492 case "description": 2493 if value != nil { 2494 jtv, ok := value.(string) 2495 if !ok { 2496 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 2497 } 2498 sv.Description = ptr.String(jtv) 2499 } 2500 2501 case "lastDeploymentStatusMessage": 2502 if value != nil { 2503 jtv, ok := value.(string) 2504 if !ok { 2505 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2506 } 2507 sv.LastDeploymentStatusMessage = ptr.String(jtv) 2508 } 2509 2510 case "lastUpdatedDate": 2511 if value != nil { 2512 jtv, ok := value.(string) 2513 if !ok { 2514 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 2515 } 2516 t, err := smithytime.ParseDateTime(jtv) 2517 if err != nil { 2518 return err 2519 } 2520 sv.LastUpdatedDate = ptr.Time(t) 2521 } 2522 2523 case "routeSettings": 2524 if err := awsRestjson1_deserializeDocumentRouteSettingsMap(&sv.RouteSettings, value); err != nil { 2525 return err 2526 } 2527 2528 case "stageName": 2529 if value != nil { 2530 jtv, ok := value.(string) 2531 if !ok { 2532 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 2533 } 2534 sv.StageName = ptr.String(jtv) 2535 } 2536 2537 case "stageVariables": 2538 if err := awsRestjson1_deserializeDocumentStageVariablesMap(&sv.StageVariables, value); err != nil { 2539 return err 2540 } 2541 2542 case "tags": 2543 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 2544 return err 2545 } 2546 2547 default: 2548 _, _ = key, value 2549 2550 } 2551 } 2552 *v = sv 2553 return nil 2554} 2555 2556type awsRestjson1_deserializeOpCreateVpcLink struct { 2557} 2558 2559func (*awsRestjson1_deserializeOpCreateVpcLink) ID() string { 2560 return "OperationDeserializer" 2561} 2562 2563func (m *awsRestjson1_deserializeOpCreateVpcLink) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2564 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2565) { 2566 out, metadata, err = next.HandleDeserialize(ctx, in) 2567 if err != nil { 2568 return out, metadata, err 2569 } 2570 2571 response, ok := out.RawResponse.(*smithyhttp.Response) 2572 if !ok { 2573 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2574 } 2575 2576 if response.StatusCode < 200 || response.StatusCode >= 300 { 2577 return out, metadata, awsRestjson1_deserializeOpErrorCreateVpcLink(response, &metadata) 2578 } 2579 output := &CreateVpcLinkOutput{} 2580 out.Result = output 2581 2582 var buff [1024]byte 2583 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2584 2585 body := io.TeeReader(response.Body, ringBuffer) 2586 2587 decoder := json.NewDecoder(body) 2588 decoder.UseNumber() 2589 var shape interface{} 2590 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2591 var snapshot bytes.Buffer 2592 io.Copy(&snapshot, ringBuffer) 2593 err = &smithy.DeserializationError{ 2594 Err: fmt.Errorf("failed to decode response body, %w", err), 2595 Snapshot: snapshot.Bytes(), 2596 } 2597 return out, metadata, err 2598 } 2599 2600 err = awsRestjson1_deserializeOpDocumentCreateVpcLinkOutput(&output, shape) 2601 if err != nil { 2602 var snapshot bytes.Buffer 2603 io.Copy(&snapshot, ringBuffer) 2604 return out, metadata, &smithy.DeserializationError{ 2605 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2606 Snapshot: snapshot.Bytes(), 2607 } 2608 } 2609 2610 return out, metadata, err 2611} 2612 2613func awsRestjson1_deserializeOpErrorCreateVpcLink(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2614 var errorBuffer bytes.Buffer 2615 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2616 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2617 } 2618 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2619 2620 errorCode := "UnknownError" 2621 errorMessage := errorCode 2622 2623 code := response.Header.Get("X-Amzn-ErrorType") 2624 if len(code) != 0 { 2625 errorCode = restjson.SanitizeErrorCode(code) 2626 } 2627 2628 var buff [1024]byte 2629 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2630 2631 body := io.TeeReader(errorBody, ringBuffer) 2632 decoder := json.NewDecoder(body) 2633 decoder.UseNumber() 2634 code, message, err := restjson.GetErrorInfo(decoder) 2635 if err != nil { 2636 var snapshot bytes.Buffer 2637 io.Copy(&snapshot, ringBuffer) 2638 err = &smithy.DeserializationError{ 2639 Err: fmt.Errorf("failed to decode response body, %w", err), 2640 Snapshot: snapshot.Bytes(), 2641 } 2642 return err 2643 } 2644 2645 errorBody.Seek(0, io.SeekStart) 2646 if len(code) != 0 { 2647 errorCode = restjson.SanitizeErrorCode(code) 2648 } 2649 if len(message) != 0 { 2650 errorMessage = message 2651 } 2652 2653 switch { 2654 case strings.EqualFold("BadRequestException", errorCode): 2655 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2656 2657 case strings.EqualFold("TooManyRequestsException", errorCode): 2658 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2659 2660 default: 2661 genericError := &smithy.GenericAPIError{ 2662 Code: errorCode, 2663 Message: errorMessage, 2664 } 2665 return genericError 2666 2667 } 2668} 2669 2670func awsRestjson1_deserializeOpDocumentCreateVpcLinkOutput(v **CreateVpcLinkOutput, value interface{}) error { 2671 if v == nil { 2672 return fmt.Errorf("unexpected nil of type %T", v) 2673 } 2674 if value == nil { 2675 return nil 2676 } 2677 2678 shape, ok := value.(map[string]interface{}) 2679 if !ok { 2680 return fmt.Errorf("unexpected JSON type %v", value) 2681 } 2682 2683 var sv *CreateVpcLinkOutput 2684 if *v == nil { 2685 sv = &CreateVpcLinkOutput{} 2686 } else { 2687 sv = *v 2688 } 2689 2690 for key, value := range shape { 2691 switch key { 2692 case "createdDate": 2693 if value != nil { 2694 jtv, ok := value.(string) 2695 if !ok { 2696 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 2697 } 2698 t, err := smithytime.ParseDateTime(jtv) 2699 if err != nil { 2700 return err 2701 } 2702 sv.CreatedDate = ptr.Time(t) 2703 } 2704 2705 case "name": 2706 if value != nil { 2707 jtv, ok := value.(string) 2708 if !ok { 2709 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 2710 } 2711 sv.Name = ptr.String(jtv) 2712 } 2713 2714 case "securityGroupIds": 2715 if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { 2716 return err 2717 } 2718 2719 case "subnetIds": 2720 if err := awsRestjson1_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil { 2721 return err 2722 } 2723 2724 case "tags": 2725 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 2726 return err 2727 } 2728 2729 case "vpcLinkId": 2730 if value != nil { 2731 jtv, ok := value.(string) 2732 if !ok { 2733 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2734 } 2735 sv.VpcLinkId = ptr.String(jtv) 2736 } 2737 2738 case "vpcLinkStatus": 2739 if value != nil { 2740 jtv, ok := value.(string) 2741 if !ok { 2742 return fmt.Errorf("expected VpcLinkStatus to be of type string, got %T instead", value) 2743 } 2744 sv.VpcLinkStatus = types.VpcLinkStatus(jtv) 2745 } 2746 2747 case "vpcLinkStatusMessage": 2748 if value != nil { 2749 jtv, ok := value.(string) 2750 if !ok { 2751 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 2752 } 2753 sv.VpcLinkStatusMessage = ptr.String(jtv) 2754 } 2755 2756 case "vpcLinkVersion": 2757 if value != nil { 2758 jtv, ok := value.(string) 2759 if !ok { 2760 return fmt.Errorf("expected VpcLinkVersion to be of type string, got %T instead", value) 2761 } 2762 sv.VpcLinkVersion = types.VpcLinkVersion(jtv) 2763 } 2764 2765 default: 2766 _, _ = key, value 2767 2768 } 2769 } 2770 *v = sv 2771 return nil 2772} 2773 2774type awsRestjson1_deserializeOpDeleteAccessLogSettings struct { 2775} 2776 2777func (*awsRestjson1_deserializeOpDeleteAccessLogSettings) ID() string { 2778 return "OperationDeserializer" 2779} 2780 2781func (m *awsRestjson1_deserializeOpDeleteAccessLogSettings) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2782 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2783) { 2784 out, metadata, err = next.HandleDeserialize(ctx, in) 2785 if err != nil { 2786 return out, metadata, err 2787 } 2788 2789 response, ok := out.RawResponse.(*smithyhttp.Response) 2790 if !ok { 2791 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2792 } 2793 2794 if response.StatusCode < 200 || response.StatusCode >= 300 { 2795 return out, metadata, awsRestjson1_deserializeOpErrorDeleteAccessLogSettings(response, &metadata) 2796 } 2797 output := &DeleteAccessLogSettingsOutput{} 2798 out.Result = output 2799 2800 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2801 return out, metadata, &smithy.DeserializationError{ 2802 Err: fmt.Errorf("failed to discard response body, %w", err), 2803 } 2804 } 2805 2806 return out, metadata, err 2807} 2808 2809func awsRestjson1_deserializeOpErrorDeleteAccessLogSettings(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2810 var errorBuffer bytes.Buffer 2811 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2812 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2813 } 2814 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2815 2816 errorCode := "UnknownError" 2817 errorMessage := errorCode 2818 2819 code := response.Header.Get("X-Amzn-ErrorType") 2820 if len(code) != 0 { 2821 errorCode = restjson.SanitizeErrorCode(code) 2822 } 2823 2824 var buff [1024]byte 2825 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2826 2827 body := io.TeeReader(errorBody, ringBuffer) 2828 decoder := json.NewDecoder(body) 2829 decoder.UseNumber() 2830 code, message, err := restjson.GetErrorInfo(decoder) 2831 if err != nil { 2832 var snapshot bytes.Buffer 2833 io.Copy(&snapshot, ringBuffer) 2834 err = &smithy.DeserializationError{ 2835 Err: fmt.Errorf("failed to decode response body, %w", err), 2836 Snapshot: snapshot.Bytes(), 2837 } 2838 return err 2839 } 2840 2841 errorBody.Seek(0, io.SeekStart) 2842 if len(code) != 0 { 2843 errorCode = restjson.SanitizeErrorCode(code) 2844 } 2845 if len(message) != 0 { 2846 errorMessage = message 2847 } 2848 2849 switch { 2850 case strings.EqualFold("NotFoundException", errorCode): 2851 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2852 2853 case strings.EqualFold("TooManyRequestsException", errorCode): 2854 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2855 2856 default: 2857 genericError := &smithy.GenericAPIError{ 2858 Code: errorCode, 2859 Message: errorMessage, 2860 } 2861 return genericError 2862 2863 } 2864} 2865 2866type awsRestjson1_deserializeOpDeleteApi struct { 2867} 2868 2869func (*awsRestjson1_deserializeOpDeleteApi) ID() string { 2870 return "OperationDeserializer" 2871} 2872 2873func (m *awsRestjson1_deserializeOpDeleteApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2874 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2875) { 2876 out, metadata, err = next.HandleDeserialize(ctx, in) 2877 if err != nil { 2878 return out, metadata, err 2879 } 2880 2881 response, ok := out.RawResponse.(*smithyhttp.Response) 2882 if !ok { 2883 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2884 } 2885 2886 if response.StatusCode < 200 || response.StatusCode >= 300 { 2887 return out, metadata, awsRestjson1_deserializeOpErrorDeleteApi(response, &metadata) 2888 } 2889 output := &DeleteApiOutput{} 2890 out.Result = output 2891 2892 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2893 return out, metadata, &smithy.DeserializationError{ 2894 Err: fmt.Errorf("failed to discard response body, %w", err), 2895 } 2896 } 2897 2898 return out, metadata, err 2899} 2900 2901func awsRestjson1_deserializeOpErrorDeleteApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2902 var errorBuffer bytes.Buffer 2903 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2904 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2905 } 2906 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2907 2908 errorCode := "UnknownError" 2909 errorMessage := errorCode 2910 2911 code := response.Header.Get("X-Amzn-ErrorType") 2912 if len(code) != 0 { 2913 errorCode = restjson.SanitizeErrorCode(code) 2914 } 2915 2916 var buff [1024]byte 2917 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2918 2919 body := io.TeeReader(errorBody, ringBuffer) 2920 decoder := json.NewDecoder(body) 2921 decoder.UseNumber() 2922 code, message, err := restjson.GetErrorInfo(decoder) 2923 if err != nil { 2924 var snapshot bytes.Buffer 2925 io.Copy(&snapshot, ringBuffer) 2926 err = &smithy.DeserializationError{ 2927 Err: fmt.Errorf("failed to decode response body, %w", err), 2928 Snapshot: snapshot.Bytes(), 2929 } 2930 return err 2931 } 2932 2933 errorBody.Seek(0, io.SeekStart) 2934 if len(code) != 0 { 2935 errorCode = restjson.SanitizeErrorCode(code) 2936 } 2937 if len(message) != 0 { 2938 errorMessage = message 2939 } 2940 2941 switch { 2942 case strings.EqualFold("NotFoundException", errorCode): 2943 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2944 2945 case strings.EqualFold("TooManyRequestsException", errorCode): 2946 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2947 2948 default: 2949 genericError := &smithy.GenericAPIError{ 2950 Code: errorCode, 2951 Message: errorMessage, 2952 } 2953 return genericError 2954 2955 } 2956} 2957 2958type awsRestjson1_deserializeOpDeleteApiMapping struct { 2959} 2960 2961func (*awsRestjson1_deserializeOpDeleteApiMapping) ID() string { 2962 return "OperationDeserializer" 2963} 2964 2965func (m *awsRestjson1_deserializeOpDeleteApiMapping) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2966 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2967) { 2968 out, metadata, err = next.HandleDeserialize(ctx, in) 2969 if err != nil { 2970 return out, metadata, err 2971 } 2972 2973 response, ok := out.RawResponse.(*smithyhttp.Response) 2974 if !ok { 2975 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2976 } 2977 2978 if response.StatusCode < 200 || response.StatusCode >= 300 { 2979 return out, metadata, awsRestjson1_deserializeOpErrorDeleteApiMapping(response, &metadata) 2980 } 2981 output := &DeleteApiMappingOutput{} 2982 out.Result = output 2983 2984 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2985 return out, metadata, &smithy.DeserializationError{ 2986 Err: fmt.Errorf("failed to discard response body, %w", err), 2987 } 2988 } 2989 2990 return out, metadata, err 2991} 2992 2993func awsRestjson1_deserializeOpErrorDeleteApiMapping(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2994 var errorBuffer bytes.Buffer 2995 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2996 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2997 } 2998 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2999 3000 errorCode := "UnknownError" 3001 errorMessage := errorCode 3002 3003 code := response.Header.Get("X-Amzn-ErrorType") 3004 if len(code) != 0 { 3005 errorCode = restjson.SanitizeErrorCode(code) 3006 } 3007 3008 var buff [1024]byte 3009 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3010 3011 body := io.TeeReader(errorBody, ringBuffer) 3012 decoder := json.NewDecoder(body) 3013 decoder.UseNumber() 3014 code, message, err := restjson.GetErrorInfo(decoder) 3015 if err != nil { 3016 var snapshot bytes.Buffer 3017 io.Copy(&snapshot, ringBuffer) 3018 err = &smithy.DeserializationError{ 3019 Err: fmt.Errorf("failed to decode response body, %w", err), 3020 Snapshot: snapshot.Bytes(), 3021 } 3022 return err 3023 } 3024 3025 errorBody.Seek(0, io.SeekStart) 3026 if len(code) != 0 { 3027 errorCode = restjson.SanitizeErrorCode(code) 3028 } 3029 if len(message) != 0 { 3030 errorMessage = message 3031 } 3032 3033 switch { 3034 case strings.EqualFold("BadRequestException", errorCode): 3035 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3036 3037 case strings.EqualFold("NotFoundException", errorCode): 3038 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3039 3040 case strings.EqualFold("TooManyRequestsException", errorCode): 3041 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3042 3043 default: 3044 genericError := &smithy.GenericAPIError{ 3045 Code: errorCode, 3046 Message: errorMessage, 3047 } 3048 return genericError 3049 3050 } 3051} 3052 3053type awsRestjson1_deserializeOpDeleteAuthorizer struct { 3054} 3055 3056func (*awsRestjson1_deserializeOpDeleteAuthorizer) ID() string { 3057 return "OperationDeserializer" 3058} 3059 3060func (m *awsRestjson1_deserializeOpDeleteAuthorizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3061 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3062) { 3063 out, metadata, err = next.HandleDeserialize(ctx, in) 3064 if err != nil { 3065 return out, metadata, err 3066 } 3067 3068 response, ok := out.RawResponse.(*smithyhttp.Response) 3069 if !ok { 3070 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3071 } 3072 3073 if response.StatusCode < 200 || response.StatusCode >= 300 { 3074 return out, metadata, awsRestjson1_deserializeOpErrorDeleteAuthorizer(response, &metadata) 3075 } 3076 output := &DeleteAuthorizerOutput{} 3077 out.Result = output 3078 3079 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3080 return out, metadata, &smithy.DeserializationError{ 3081 Err: fmt.Errorf("failed to discard response body, %w", err), 3082 } 3083 } 3084 3085 return out, metadata, err 3086} 3087 3088func awsRestjson1_deserializeOpErrorDeleteAuthorizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3089 var errorBuffer bytes.Buffer 3090 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3091 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3092 } 3093 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3094 3095 errorCode := "UnknownError" 3096 errorMessage := errorCode 3097 3098 code := response.Header.Get("X-Amzn-ErrorType") 3099 if len(code) != 0 { 3100 errorCode = restjson.SanitizeErrorCode(code) 3101 } 3102 3103 var buff [1024]byte 3104 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3105 3106 body := io.TeeReader(errorBody, ringBuffer) 3107 decoder := json.NewDecoder(body) 3108 decoder.UseNumber() 3109 code, message, err := restjson.GetErrorInfo(decoder) 3110 if err != nil { 3111 var snapshot bytes.Buffer 3112 io.Copy(&snapshot, ringBuffer) 3113 err = &smithy.DeserializationError{ 3114 Err: fmt.Errorf("failed to decode response body, %w", err), 3115 Snapshot: snapshot.Bytes(), 3116 } 3117 return err 3118 } 3119 3120 errorBody.Seek(0, io.SeekStart) 3121 if len(code) != 0 { 3122 errorCode = restjson.SanitizeErrorCode(code) 3123 } 3124 if len(message) != 0 { 3125 errorMessage = message 3126 } 3127 3128 switch { 3129 case strings.EqualFold("NotFoundException", errorCode): 3130 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3131 3132 case strings.EqualFold("TooManyRequestsException", errorCode): 3133 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3134 3135 default: 3136 genericError := &smithy.GenericAPIError{ 3137 Code: errorCode, 3138 Message: errorMessage, 3139 } 3140 return genericError 3141 3142 } 3143} 3144 3145type awsRestjson1_deserializeOpDeleteCorsConfiguration struct { 3146} 3147 3148func (*awsRestjson1_deserializeOpDeleteCorsConfiguration) ID() string { 3149 return "OperationDeserializer" 3150} 3151 3152func (m *awsRestjson1_deserializeOpDeleteCorsConfiguration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3153 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3154) { 3155 out, metadata, err = next.HandleDeserialize(ctx, in) 3156 if err != nil { 3157 return out, metadata, err 3158 } 3159 3160 response, ok := out.RawResponse.(*smithyhttp.Response) 3161 if !ok { 3162 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3163 } 3164 3165 if response.StatusCode < 200 || response.StatusCode >= 300 { 3166 return out, metadata, awsRestjson1_deserializeOpErrorDeleteCorsConfiguration(response, &metadata) 3167 } 3168 output := &DeleteCorsConfigurationOutput{} 3169 out.Result = output 3170 3171 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3172 return out, metadata, &smithy.DeserializationError{ 3173 Err: fmt.Errorf("failed to discard response body, %w", err), 3174 } 3175 } 3176 3177 return out, metadata, err 3178} 3179 3180func awsRestjson1_deserializeOpErrorDeleteCorsConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3181 var errorBuffer bytes.Buffer 3182 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3183 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3184 } 3185 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3186 3187 errorCode := "UnknownError" 3188 errorMessage := errorCode 3189 3190 code := response.Header.Get("X-Amzn-ErrorType") 3191 if len(code) != 0 { 3192 errorCode = restjson.SanitizeErrorCode(code) 3193 } 3194 3195 var buff [1024]byte 3196 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3197 3198 body := io.TeeReader(errorBody, ringBuffer) 3199 decoder := json.NewDecoder(body) 3200 decoder.UseNumber() 3201 code, message, err := restjson.GetErrorInfo(decoder) 3202 if err != nil { 3203 var snapshot bytes.Buffer 3204 io.Copy(&snapshot, ringBuffer) 3205 err = &smithy.DeserializationError{ 3206 Err: fmt.Errorf("failed to decode response body, %w", err), 3207 Snapshot: snapshot.Bytes(), 3208 } 3209 return err 3210 } 3211 3212 errorBody.Seek(0, io.SeekStart) 3213 if len(code) != 0 { 3214 errorCode = restjson.SanitizeErrorCode(code) 3215 } 3216 if len(message) != 0 { 3217 errorMessage = message 3218 } 3219 3220 switch { 3221 case strings.EqualFold("NotFoundException", errorCode): 3222 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3223 3224 case strings.EqualFold("TooManyRequestsException", errorCode): 3225 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3226 3227 default: 3228 genericError := &smithy.GenericAPIError{ 3229 Code: errorCode, 3230 Message: errorMessage, 3231 } 3232 return genericError 3233 3234 } 3235} 3236 3237type awsRestjson1_deserializeOpDeleteDeployment struct { 3238} 3239 3240func (*awsRestjson1_deserializeOpDeleteDeployment) ID() string { 3241 return "OperationDeserializer" 3242} 3243 3244func (m *awsRestjson1_deserializeOpDeleteDeployment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3245 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3246) { 3247 out, metadata, err = next.HandleDeserialize(ctx, in) 3248 if err != nil { 3249 return out, metadata, err 3250 } 3251 3252 response, ok := out.RawResponse.(*smithyhttp.Response) 3253 if !ok { 3254 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3255 } 3256 3257 if response.StatusCode < 200 || response.StatusCode >= 300 { 3258 return out, metadata, awsRestjson1_deserializeOpErrorDeleteDeployment(response, &metadata) 3259 } 3260 output := &DeleteDeploymentOutput{} 3261 out.Result = output 3262 3263 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3264 return out, metadata, &smithy.DeserializationError{ 3265 Err: fmt.Errorf("failed to discard response body, %w", err), 3266 } 3267 } 3268 3269 return out, metadata, err 3270} 3271 3272func awsRestjson1_deserializeOpErrorDeleteDeployment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3273 var errorBuffer bytes.Buffer 3274 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3275 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3276 } 3277 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3278 3279 errorCode := "UnknownError" 3280 errorMessage := errorCode 3281 3282 code := response.Header.Get("X-Amzn-ErrorType") 3283 if len(code) != 0 { 3284 errorCode = restjson.SanitizeErrorCode(code) 3285 } 3286 3287 var buff [1024]byte 3288 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3289 3290 body := io.TeeReader(errorBody, ringBuffer) 3291 decoder := json.NewDecoder(body) 3292 decoder.UseNumber() 3293 code, message, err := restjson.GetErrorInfo(decoder) 3294 if err != nil { 3295 var snapshot bytes.Buffer 3296 io.Copy(&snapshot, ringBuffer) 3297 err = &smithy.DeserializationError{ 3298 Err: fmt.Errorf("failed to decode response body, %w", err), 3299 Snapshot: snapshot.Bytes(), 3300 } 3301 return err 3302 } 3303 3304 errorBody.Seek(0, io.SeekStart) 3305 if len(code) != 0 { 3306 errorCode = restjson.SanitizeErrorCode(code) 3307 } 3308 if len(message) != 0 { 3309 errorMessage = message 3310 } 3311 3312 switch { 3313 case strings.EqualFold("NotFoundException", errorCode): 3314 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3315 3316 case strings.EqualFold("TooManyRequestsException", errorCode): 3317 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3318 3319 default: 3320 genericError := &smithy.GenericAPIError{ 3321 Code: errorCode, 3322 Message: errorMessage, 3323 } 3324 return genericError 3325 3326 } 3327} 3328 3329type awsRestjson1_deserializeOpDeleteDomainName struct { 3330} 3331 3332func (*awsRestjson1_deserializeOpDeleteDomainName) ID() string { 3333 return "OperationDeserializer" 3334} 3335 3336func (m *awsRestjson1_deserializeOpDeleteDomainName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3337 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3338) { 3339 out, metadata, err = next.HandleDeserialize(ctx, in) 3340 if err != nil { 3341 return out, metadata, err 3342 } 3343 3344 response, ok := out.RawResponse.(*smithyhttp.Response) 3345 if !ok { 3346 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3347 } 3348 3349 if response.StatusCode < 200 || response.StatusCode >= 300 { 3350 return out, metadata, awsRestjson1_deserializeOpErrorDeleteDomainName(response, &metadata) 3351 } 3352 output := &DeleteDomainNameOutput{} 3353 out.Result = output 3354 3355 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3356 return out, metadata, &smithy.DeserializationError{ 3357 Err: fmt.Errorf("failed to discard response body, %w", err), 3358 } 3359 } 3360 3361 return out, metadata, err 3362} 3363 3364func awsRestjson1_deserializeOpErrorDeleteDomainName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3365 var errorBuffer bytes.Buffer 3366 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3367 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3368 } 3369 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3370 3371 errorCode := "UnknownError" 3372 errorMessage := errorCode 3373 3374 code := response.Header.Get("X-Amzn-ErrorType") 3375 if len(code) != 0 { 3376 errorCode = restjson.SanitizeErrorCode(code) 3377 } 3378 3379 var buff [1024]byte 3380 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3381 3382 body := io.TeeReader(errorBody, ringBuffer) 3383 decoder := json.NewDecoder(body) 3384 decoder.UseNumber() 3385 code, message, err := restjson.GetErrorInfo(decoder) 3386 if err != nil { 3387 var snapshot bytes.Buffer 3388 io.Copy(&snapshot, ringBuffer) 3389 err = &smithy.DeserializationError{ 3390 Err: fmt.Errorf("failed to decode response body, %w", err), 3391 Snapshot: snapshot.Bytes(), 3392 } 3393 return err 3394 } 3395 3396 errorBody.Seek(0, io.SeekStart) 3397 if len(code) != 0 { 3398 errorCode = restjson.SanitizeErrorCode(code) 3399 } 3400 if len(message) != 0 { 3401 errorMessage = message 3402 } 3403 3404 switch { 3405 case strings.EqualFold("NotFoundException", errorCode): 3406 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3407 3408 case strings.EqualFold("TooManyRequestsException", errorCode): 3409 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3410 3411 default: 3412 genericError := &smithy.GenericAPIError{ 3413 Code: errorCode, 3414 Message: errorMessage, 3415 } 3416 return genericError 3417 3418 } 3419} 3420 3421type awsRestjson1_deserializeOpDeleteIntegration struct { 3422} 3423 3424func (*awsRestjson1_deserializeOpDeleteIntegration) ID() string { 3425 return "OperationDeserializer" 3426} 3427 3428func (m *awsRestjson1_deserializeOpDeleteIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3429 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3430) { 3431 out, metadata, err = next.HandleDeserialize(ctx, in) 3432 if err != nil { 3433 return out, metadata, err 3434 } 3435 3436 response, ok := out.RawResponse.(*smithyhttp.Response) 3437 if !ok { 3438 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3439 } 3440 3441 if response.StatusCode < 200 || response.StatusCode >= 300 { 3442 return out, metadata, awsRestjson1_deserializeOpErrorDeleteIntegration(response, &metadata) 3443 } 3444 output := &DeleteIntegrationOutput{} 3445 out.Result = output 3446 3447 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3448 return out, metadata, &smithy.DeserializationError{ 3449 Err: fmt.Errorf("failed to discard response body, %w", err), 3450 } 3451 } 3452 3453 return out, metadata, err 3454} 3455 3456func awsRestjson1_deserializeOpErrorDeleteIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3457 var errorBuffer bytes.Buffer 3458 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3459 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3460 } 3461 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3462 3463 errorCode := "UnknownError" 3464 errorMessage := errorCode 3465 3466 code := response.Header.Get("X-Amzn-ErrorType") 3467 if len(code) != 0 { 3468 errorCode = restjson.SanitizeErrorCode(code) 3469 } 3470 3471 var buff [1024]byte 3472 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3473 3474 body := io.TeeReader(errorBody, ringBuffer) 3475 decoder := json.NewDecoder(body) 3476 decoder.UseNumber() 3477 code, message, err := restjson.GetErrorInfo(decoder) 3478 if err != nil { 3479 var snapshot bytes.Buffer 3480 io.Copy(&snapshot, ringBuffer) 3481 err = &smithy.DeserializationError{ 3482 Err: fmt.Errorf("failed to decode response body, %w", err), 3483 Snapshot: snapshot.Bytes(), 3484 } 3485 return err 3486 } 3487 3488 errorBody.Seek(0, io.SeekStart) 3489 if len(code) != 0 { 3490 errorCode = restjson.SanitizeErrorCode(code) 3491 } 3492 if len(message) != 0 { 3493 errorMessage = message 3494 } 3495 3496 switch { 3497 case strings.EqualFold("NotFoundException", errorCode): 3498 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3499 3500 case strings.EqualFold("TooManyRequestsException", errorCode): 3501 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3502 3503 default: 3504 genericError := &smithy.GenericAPIError{ 3505 Code: errorCode, 3506 Message: errorMessage, 3507 } 3508 return genericError 3509 3510 } 3511} 3512 3513type awsRestjson1_deserializeOpDeleteIntegrationResponse struct { 3514} 3515 3516func (*awsRestjson1_deserializeOpDeleteIntegrationResponse) ID() string { 3517 return "OperationDeserializer" 3518} 3519 3520func (m *awsRestjson1_deserializeOpDeleteIntegrationResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3521 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3522) { 3523 out, metadata, err = next.HandleDeserialize(ctx, in) 3524 if err != nil { 3525 return out, metadata, err 3526 } 3527 3528 response, ok := out.RawResponse.(*smithyhttp.Response) 3529 if !ok { 3530 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3531 } 3532 3533 if response.StatusCode < 200 || response.StatusCode >= 300 { 3534 return out, metadata, awsRestjson1_deserializeOpErrorDeleteIntegrationResponse(response, &metadata) 3535 } 3536 output := &DeleteIntegrationResponseOutput{} 3537 out.Result = output 3538 3539 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3540 return out, metadata, &smithy.DeserializationError{ 3541 Err: fmt.Errorf("failed to discard response body, %w", err), 3542 } 3543 } 3544 3545 return out, metadata, err 3546} 3547 3548func awsRestjson1_deserializeOpErrorDeleteIntegrationResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3549 var errorBuffer bytes.Buffer 3550 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3551 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3552 } 3553 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3554 3555 errorCode := "UnknownError" 3556 errorMessage := errorCode 3557 3558 code := response.Header.Get("X-Amzn-ErrorType") 3559 if len(code) != 0 { 3560 errorCode = restjson.SanitizeErrorCode(code) 3561 } 3562 3563 var buff [1024]byte 3564 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3565 3566 body := io.TeeReader(errorBody, ringBuffer) 3567 decoder := json.NewDecoder(body) 3568 decoder.UseNumber() 3569 code, message, err := restjson.GetErrorInfo(decoder) 3570 if err != nil { 3571 var snapshot bytes.Buffer 3572 io.Copy(&snapshot, ringBuffer) 3573 err = &smithy.DeserializationError{ 3574 Err: fmt.Errorf("failed to decode response body, %w", err), 3575 Snapshot: snapshot.Bytes(), 3576 } 3577 return err 3578 } 3579 3580 errorBody.Seek(0, io.SeekStart) 3581 if len(code) != 0 { 3582 errorCode = restjson.SanitizeErrorCode(code) 3583 } 3584 if len(message) != 0 { 3585 errorMessage = message 3586 } 3587 3588 switch { 3589 case strings.EqualFold("NotFoundException", errorCode): 3590 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3591 3592 case strings.EqualFold("TooManyRequestsException", errorCode): 3593 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3594 3595 default: 3596 genericError := &smithy.GenericAPIError{ 3597 Code: errorCode, 3598 Message: errorMessage, 3599 } 3600 return genericError 3601 3602 } 3603} 3604 3605type awsRestjson1_deserializeOpDeleteModel struct { 3606} 3607 3608func (*awsRestjson1_deserializeOpDeleteModel) ID() string { 3609 return "OperationDeserializer" 3610} 3611 3612func (m *awsRestjson1_deserializeOpDeleteModel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3613 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3614) { 3615 out, metadata, err = next.HandleDeserialize(ctx, in) 3616 if err != nil { 3617 return out, metadata, err 3618 } 3619 3620 response, ok := out.RawResponse.(*smithyhttp.Response) 3621 if !ok { 3622 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3623 } 3624 3625 if response.StatusCode < 200 || response.StatusCode >= 300 { 3626 return out, metadata, awsRestjson1_deserializeOpErrorDeleteModel(response, &metadata) 3627 } 3628 output := &DeleteModelOutput{} 3629 out.Result = output 3630 3631 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3632 return out, metadata, &smithy.DeserializationError{ 3633 Err: fmt.Errorf("failed to discard response body, %w", err), 3634 } 3635 } 3636 3637 return out, metadata, err 3638} 3639 3640func awsRestjson1_deserializeOpErrorDeleteModel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3641 var errorBuffer bytes.Buffer 3642 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3643 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3644 } 3645 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3646 3647 errorCode := "UnknownError" 3648 errorMessage := errorCode 3649 3650 code := response.Header.Get("X-Amzn-ErrorType") 3651 if len(code) != 0 { 3652 errorCode = restjson.SanitizeErrorCode(code) 3653 } 3654 3655 var buff [1024]byte 3656 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3657 3658 body := io.TeeReader(errorBody, ringBuffer) 3659 decoder := json.NewDecoder(body) 3660 decoder.UseNumber() 3661 code, message, err := restjson.GetErrorInfo(decoder) 3662 if err != nil { 3663 var snapshot bytes.Buffer 3664 io.Copy(&snapshot, ringBuffer) 3665 err = &smithy.DeserializationError{ 3666 Err: fmt.Errorf("failed to decode response body, %w", err), 3667 Snapshot: snapshot.Bytes(), 3668 } 3669 return err 3670 } 3671 3672 errorBody.Seek(0, io.SeekStart) 3673 if len(code) != 0 { 3674 errorCode = restjson.SanitizeErrorCode(code) 3675 } 3676 if len(message) != 0 { 3677 errorMessage = message 3678 } 3679 3680 switch { 3681 case strings.EqualFold("NotFoundException", errorCode): 3682 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3683 3684 case strings.EqualFold("TooManyRequestsException", errorCode): 3685 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3686 3687 default: 3688 genericError := &smithy.GenericAPIError{ 3689 Code: errorCode, 3690 Message: errorMessage, 3691 } 3692 return genericError 3693 3694 } 3695} 3696 3697type awsRestjson1_deserializeOpDeleteRoute struct { 3698} 3699 3700func (*awsRestjson1_deserializeOpDeleteRoute) ID() string { 3701 return "OperationDeserializer" 3702} 3703 3704func (m *awsRestjson1_deserializeOpDeleteRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3705 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3706) { 3707 out, metadata, err = next.HandleDeserialize(ctx, in) 3708 if err != nil { 3709 return out, metadata, err 3710 } 3711 3712 response, ok := out.RawResponse.(*smithyhttp.Response) 3713 if !ok { 3714 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3715 } 3716 3717 if response.StatusCode < 200 || response.StatusCode >= 300 { 3718 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRoute(response, &metadata) 3719 } 3720 output := &DeleteRouteOutput{} 3721 out.Result = output 3722 3723 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3724 return out, metadata, &smithy.DeserializationError{ 3725 Err: fmt.Errorf("failed to discard response body, %w", err), 3726 } 3727 } 3728 3729 return out, metadata, err 3730} 3731 3732func awsRestjson1_deserializeOpErrorDeleteRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3733 var errorBuffer bytes.Buffer 3734 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3735 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3736 } 3737 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3738 3739 errorCode := "UnknownError" 3740 errorMessage := errorCode 3741 3742 code := response.Header.Get("X-Amzn-ErrorType") 3743 if len(code) != 0 { 3744 errorCode = restjson.SanitizeErrorCode(code) 3745 } 3746 3747 var buff [1024]byte 3748 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3749 3750 body := io.TeeReader(errorBody, ringBuffer) 3751 decoder := json.NewDecoder(body) 3752 decoder.UseNumber() 3753 code, message, err := restjson.GetErrorInfo(decoder) 3754 if err != nil { 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 err 3762 } 3763 3764 errorBody.Seek(0, io.SeekStart) 3765 if len(code) != 0 { 3766 errorCode = restjson.SanitizeErrorCode(code) 3767 } 3768 if len(message) != 0 { 3769 errorMessage = message 3770 } 3771 3772 switch { 3773 case strings.EqualFold("NotFoundException", errorCode): 3774 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3775 3776 case strings.EqualFold("TooManyRequestsException", errorCode): 3777 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3778 3779 default: 3780 genericError := &smithy.GenericAPIError{ 3781 Code: errorCode, 3782 Message: errorMessage, 3783 } 3784 return genericError 3785 3786 } 3787} 3788 3789type awsRestjson1_deserializeOpDeleteRouteRequestParameter struct { 3790} 3791 3792func (*awsRestjson1_deserializeOpDeleteRouteRequestParameter) ID() string { 3793 return "OperationDeserializer" 3794} 3795 3796func (m *awsRestjson1_deserializeOpDeleteRouteRequestParameter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3797 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3798) { 3799 out, metadata, err = next.HandleDeserialize(ctx, in) 3800 if err != nil { 3801 return out, metadata, err 3802 } 3803 3804 response, ok := out.RawResponse.(*smithyhttp.Response) 3805 if !ok { 3806 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3807 } 3808 3809 if response.StatusCode < 200 || response.StatusCode >= 300 { 3810 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRouteRequestParameter(response, &metadata) 3811 } 3812 output := &DeleteRouteRequestParameterOutput{} 3813 out.Result = output 3814 3815 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3816 return out, metadata, &smithy.DeserializationError{ 3817 Err: fmt.Errorf("failed to discard response body, %w", err), 3818 } 3819 } 3820 3821 return out, metadata, err 3822} 3823 3824func awsRestjson1_deserializeOpErrorDeleteRouteRequestParameter(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3825 var errorBuffer bytes.Buffer 3826 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3827 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3828 } 3829 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3830 3831 errorCode := "UnknownError" 3832 errorMessage := errorCode 3833 3834 code := response.Header.Get("X-Amzn-ErrorType") 3835 if len(code) != 0 { 3836 errorCode = restjson.SanitizeErrorCode(code) 3837 } 3838 3839 var buff [1024]byte 3840 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3841 3842 body := io.TeeReader(errorBody, ringBuffer) 3843 decoder := json.NewDecoder(body) 3844 decoder.UseNumber() 3845 code, message, err := restjson.GetErrorInfo(decoder) 3846 if err != nil { 3847 var snapshot bytes.Buffer 3848 io.Copy(&snapshot, ringBuffer) 3849 err = &smithy.DeserializationError{ 3850 Err: fmt.Errorf("failed to decode response body, %w", err), 3851 Snapshot: snapshot.Bytes(), 3852 } 3853 return err 3854 } 3855 3856 errorBody.Seek(0, io.SeekStart) 3857 if len(code) != 0 { 3858 errorCode = restjson.SanitizeErrorCode(code) 3859 } 3860 if len(message) != 0 { 3861 errorMessage = message 3862 } 3863 3864 switch { 3865 case strings.EqualFold("NotFoundException", errorCode): 3866 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3867 3868 case strings.EqualFold("TooManyRequestsException", errorCode): 3869 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3870 3871 default: 3872 genericError := &smithy.GenericAPIError{ 3873 Code: errorCode, 3874 Message: errorMessage, 3875 } 3876 return genericError 3877 3878 } 3879} 3880 3881type awsRestjson1_deserializeOpDeleteRouteResponse struct { 3882} 3883 3884func (*awsRestjson1_deserializeOpDeleteRouteResponse) ID() string { 3885 return "OperationDeserializer" 3886} 3887 3888func (m *awsRestjson1_deserializeOpDeleteRouteResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3889 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3890) { 3891 out, metadata, err = next.HandleDeserialize(ctx, in) 3892 if err != nil { 3893 return out, metadata, err 3894 } 3895 3896 response, ok := out.RawResponse.(*smithyhttp.Response) 3897 if !ok { 3898 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3899 } 3900 3901 if response.StatusCode < 200 || response.StatusCode >= 300 { 3902 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRouteResponse(response, &metadata) 3903 } 3904 output := &DeleteRouteResponseOutput{} 3905 out.Result = output 3906 3907 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3908 return out, metadata, &smithy.DeserializationError{ 3909 Err: fmt.Errorf("failed to discard response body, %w", err), 3910 } 3911 } 3912 3913 return out, metadata, err 3914} 3915 3916func awsRestjson1_deserializeOpErrorDeleteRouteResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3917 var errorBuffer bytes.Buffer 3918 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3919 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3920 } 3921 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3922 3923 errorCode := "UnknownError" 3924 errorMessage := errorCode 3925 3926 code := response.Header.Get("X-Amzn-ErrorType") 3927 if len(code) != 0 { 3928 errorCode = restjson.SanitizeErrorCode(code) 3929 } 3930 3931 var buff [1024]byte 3932 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3933 3934 body := io.TeeReader(errorBody, ringBuffer) 3935 decoder := json.NewDecoder(body) 3936 decoder.UseNumber() 3937 code, message, err := restjson.GetErrorInfo(decoder) 3938 if err != nil { 3939 var snapshot bytes.Buffer 3940 io.Copy(&snapshot, ringBuffer) 3941 err = &smithy.DeserializationError{ 3942 Err: fmt.Errorf("failed to decode response body, %w", err), 3943 Snapshot: snapshot.Bytes(), 3944 } 3945 return err 3946 } 3947 3948 errorBody.Seek(0, io.SeekStart) 3949 if len(code) != 0 { 3950 errorCode = restjson.SanitizeErrorCode(code) 3951 } 3952 if len(message) != 0 { 3953 errorMessage = message 3954 } 3955 3956 switch { 3957 case strings.EqualFold("NotFoundException", errorCode): 3958 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3959 3960 case strings.EqualFold("TooManyRequestsException", errorCode): 3961 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3962 3963 default: 3964 genericError := &smithy.GenericAPIError{ 3965 Code: errorCode, 3966 Message: errorMessage, 3967 } 3968 return genericError 3969 3970 } 3971} 3972 3973type awsRestjson1_deserializeOpDeleteRouteSettings struct { 3974} 3975 3976func (*awsRestjson1_deserializeOpDeleteRouteSettings) ID() string { 3977 return "OperationDeserializer" 3978} 3979 3980func (m *awsRestjson1_deserializeOpDeleteRouteSettings) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3981 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3982) { 3983 out, metadata, err = next.HandleDeserialize(ctx, in) 3984 if err != nil { 3985 return out, metadata, err 3986 } 3987 3988 response, ok := out.RawResponse.(*smithyhttp.Response) 3989 if !ok { 3990 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3991 } 3992 3993 if response.StatusCode < 200 || response.StatusCode >= 300 { 3994 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRouteSettings(response, &metadata) 3995 } 3996 output := &DeleteRouteSettingsOutput{} 3997 out.Result = output 3998 3999 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4000 return out, metadata, &smithy.DeserializationError{ 4001 Err: fmt.Errorf("failed to discard response body, %w", err), 4002 } 4003 } 4004 4005 return out, metadata, err 4006} 4007 4008func awsRestjson1_deserializeOpErrorDeleteRouteSettings(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4009 var errorBuffer bytes.Buffer 4010 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4011 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4012 } 4013 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4014 4015 errorCode := "UnknownError" 4016 errorMessage := errorCode 4017 4018 code := response.Header.Get("X-Amzn-ErrorType") 4019 if len(code) != 0 { 4020 errorCode = restjson.SanitizeErrorCode(code) 4021 } 4022 4023 var buff [1024]byte 4024 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4025 4026 body := io.TeeReader(errorBody, ringBuffer) 4027 decoder := json.NewDecoder(body) 4028 decoder.UseNumber() 4029 code, message, err := restjson.GetErrorInfo(decoder) 4030 if err != nil { 4031 var snapshot bytes.Buffer 4032 io.Copy(&snapshot, ringBuffer) 4033 err = &smithy.DeserializationError{ 4034 Err: fmt.Errorf("failed to decode response body, %w", err), 4035 Snapshot: snapshot.Bytes(), 4036 } 4037 return err 4038 } 4039 4040 errorBody.Seek(0, io.SeekStart) 4041 if len(code) != 0 { 4042 errorCode = restjson.SanitizeErrorCode(code) 4043 } 4044 if len(message) != 0 { 4045 errorMessage = message 4046 } 4047 4048 switch { 4049 case strings.EqualFold("NotFoundException", errorCode): 4050 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4051 4052 case strings.EqualFold("TooManyRequestsException", errorCode): 4053 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4054 4055 default: 4056 genericError := &smithy.GenericAPIError{ 4057 Code: errorCode, 4058 Message: errorMessage, 4059 } 4060 return genericError 4061 4062 } 4063} 4064 4065type awsRestjson1_deserializeOpDeleteStage struct { 4066} 4067 4068func (*awsRestjson1_deserializeOpDeleteStage) ID() string { 4069 return "OperationDeserializer" 4070} 4071 4072func (m *awsRestjson1_deserializeOpDeleteStage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4073 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4074) { 4075 out, metadata, err = next.HandleDeserialize(ctx, in) 4076 if err != nil { 4077 return out, metadata, err 4078 } 4079 4080 response, ok := out.RawResponse.(*smithyhttp.Response) 4081 if !ok { 4082 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4083 } 4084 4085 if response.StatusCode < 200 || response.StatusCode >= 300 { 4086 return out, metadata, awsRestjson1_deserializeOpErrorDeleteStage(response, &metadata) 4087 } 4088 output := &DeleteStageOutput{} 4089 out.Result = output 4090 4091 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4092 return out, metadata, &smithy.DeserializationError{ 4093 Err: fmt.Errorf("failed to discard response body, %w", err), 4094 } 4095 } 4096 4097 return out, metadata, err 4098} 4099 4100func awsRestjson1_deserializeOpErrorDeleteStage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4101 var errorBuffer bytes.Buffer 4102 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4103 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4104 } 4105 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4106 4107 errorCode := "UnknownError" 4108 errorMessage := errorCode 4109 4110 code := response.Header.Get("X-Amzn-ErrorType") 4111 if len(code) != 0 { 4112 errorCode = restjson.SanitizeErrorCode(code) 4113 } 4114 4115 var buff [1024]byte 4116 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4117 4118 body := io.TeeReader(errorBody, ringBuffer) 4119 decoder := json.NewDecoder(body) 4120 decoder.UseNumber() 4121 code, message, err := restjson.GetErrorInfo(decoder) 4122 if err != nil { 4123 var snapshot bytes.Buffer 4124 io.Copy(&snapshot, ringBuffer) 4125 err = &smithy.DeserializationError{ 4126 Err: fmt.Errorf("failed to decode response body, %w", err), 4127 Snapshot: snapshot.Bytes(), 4128 } 4129 return err 4130 } 4131 4132 errorBody.Seek(0, io.SeekStart) 4133 if len(code) != 0 { 4134 errorCode = restjson.SanitizeErrorCode(code) 4135 } 4136 if len(message) != 0 { 4137 errorMessage = message 4138 } 4139 4140 switch { 4141 case strings.EqualFold("NotFoundException", errorCode): 4142 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4143 4144 case strings.EqualFold("TooManyRequestsException", errorCode): 4145 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4146 4147 default: 4148 genericError := &smithy.GenericAPIError{ 4149 Code: errorCode, 4150 Message: errorMessage, 4151 } 4152 return genericError 4153 4154 } 4155} 4156 4157type awsRestjson1_deserializeOpDeleteVpcLink struct { 4158} 4159 4160func (*awsRestjson1_deserializeOpDeleteVpcLink) ID() string { 4161 return "OperationDeserializer" 4162} 4163 4164func (m *awsRestjson1_deserializeOpDeleteVpcLink) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4165 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4166) { 4167 out, metadata, err = next.HandleDeserialize(ctx, in) 4168 if err != nil { 4169 return out, metadata, err 4170 } 4171 4172 response, ok := out.RawResponse.(*smithyhttp.Response) 4173 if !ok { 4174 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4175 } 4176 4177 if response.StatusCode < 200 || response.StatusCode >= 300 { 4178 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVpcLink(response, &metadata) 4179 } 4180 output := &DeleteVpcLinkOutput{} 4181 out.Result = output 4182 4183 return out, metadata, err 4184} 4185 4186func awsRestjson1_deserializeOpErrorDeleteVpcLink(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4187 var errorBuffer bytes.Buffer 4188 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4189 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4190 } 4191 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4192 4193 errorCode := "UnknownError" 4194 errorMessage := errorCode 4195 4196 code := response.Header.Get("X-Amzn-ErrorType") 4197 if len(code) != 0 { 4198 errorCode = restjson.SanitizeErrorCode(code) 4199 } 4200 4201 var buff [1024]byte 4202 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4203 4204 body := io.TeeReader(errorBody, ringBuffer) 4205 decoder := json.NewDecoder(body) 4206 decoder.UseNumber() 4207 code, message, err := restjson.GetErrorInfo(decoder) 4208 if err != nil { 4209 var snapshot bytes.Buffer 4210 io.Copy(&snapshot, ringBuffer) 4211 err = &smithy.DeserializationError{ 4212 Err: fmt.Errorf("failed to decode response body, %w", err), 4213 Snapshot: snapshot.Bytes(), 4214 } 4215 return err 4216 } 4217 4218 errorBody.Seek(0, io.SeekStart) 4219 if len(code) != 0 { 4220 errorCode = restjson.SanitizeErrorCode(code) 4221 } 4222 if len(message) != 0 { 4223 errorMessage = message 4224 } 4225 4226 switch { 4227 case strings.EqualFold("NotFoundException", errorCode): 4228 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4229 4230 case strings.EqualFold("TooManyRequestsException", errorCode): 4231 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4232 4233 default: 4234 genericError := &smithy.GenericAPIError{ 4235 Code: errorCode, 4236 Message: errorMessage, 4237 } 4238 return genericError 4239 4240 } 4241} 4242 4243type awsRestjson1_deserializeOpExportApi struct { 4244} 4245 4246func (*awsRestjson1_deserializeOpExportApi) ID() string { 4247 return "OperationDeserializer" 4248} 4249 4250func (m *awsRestjson1_deserializeOpExportApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4251 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4252) { 4253 out, metadata, err = next.HandleDeserialize(ctx, in) 4254 if err != nil { 4255 return out, metadata, err 4256 } 4257 4258 response, ok := out.RawResponse.(*smithyhttp.Response) 4259 if !ok { 4260 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4261 } 4262 4263 if response.StatusCode < 200 || response.StatusCode >= 300 { 4264 return out, metadata, awsRestjson1_deserializeOpErrorExportApi(response, &metadata) 4265 } 4266 output := &ExportApiOutput{} 4267 out.Result = output 4268 4269 err = awsRestjson1_deserializeOpDocumentExportApiOutput(output, response.Body) 4270 if err != nil { 4271 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} 4272 } 4273 4274 return out, metadata, err 4275} 4276 4277func awsRestjson1_deserializeOpErrorExportApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4278 var errorBuffer bytes.Buffer 4279 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4280 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4281 } 4282 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4283 4284 errorCode := "UnknownError" 4285 errorMessage := errorCode 4286 4287 code := response.Header.Get("X-Amzn-ErrorType") 4288 if len(code) != 0 { 4289 errorCode = restjson.SanitizeErrorCode(code) 4290 } 4291 4292 var buff [1024]byte 4293 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4294 4295 body := io.TeeReader(errorBody, ringBuffer) 4296 decoder := json.NewDecoder(body) 4297 decoder.UseNumber() 4298 code, message, err := restjson.GetErrorInfo(decoder) 4299 if err != nil { 4300 var snapshot bytes.Buffer 4301 io.Copy(&snapshot, ringBuffer) 4302 err = &smithy.DeserializationError{ 4303 Err: fmt.Errorf("failed to decode response body, %w", err), 4304 Snapshot: snapshot.Bytes(), 4305 } 4306 return err 4307 } 4308 4309 errorBody.Seek(0, io.SeekStart) 4310 if len(code) != 0 { 4311 errorCode = restjson.SanitizeErrorCode(code) 4312 } 4313 if len(message) != 0 { 4314 errorMessage = message 4315 } 4316 4317 switch { 4318 case strings.EqualFold("BadRequestException", errorCode): 4319 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4320 4321 case strings.EqualFold("NotFoundException", errorCode): 4322 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4323 4324 case strings.EqualFold("TooManyRequestsException", errorCode): 4325 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4326 4327 default: 4328 genericError := &smithy.GenericAPIError{ 4329 Code: errorCode, 4330 Message: errorMessage, 4331 } 4332 return genericError 4333 4334 } 4335} 4336 4337func awsRestjson1_deserializeOpDocumentExportApiOutput(v *ExportApiOutput, body io.ReadCloser) error { 4338 if v == nil { 4339 return fmt.Errorf("unsupported deserialization of nil %T", v) 4340 } 4341 4342 bs, err := ioutil.ReadAll(body) 4343 if err != nil { 4344 return err 4345 } 4346 if len(bs) > 0 { 4347 v.Body = bs 4348 } 4349 return nil 4350} 4351 4352type awsRestjson1_deserializeOpGetApi struct { 4353} 4354 4355func (*awsRestjson1_deserializeOpGetApi) ID() string { 4356 return "OperationDeserializer" 4357} 4358 4359func (m *awsRestjson1_deserializeOpGetApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4360 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4361) { 4362 out, metadata, err = next.HandleDeserialize(ctx, in) 4363 if err != nil { 4364 return out, metadata, err 4365 } 4366 4367 response, ok := out.RawResponse.(*smithyhttp.Response) 4368 if !ok { 4369 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4370 } 4371 4372 if response.StatusCode < 200 || response.StatusCode >= 300 { 4373 return out, metadata, awsRestjson1_deserializeOpErrorGetApi(response, &metadata) 4374 } 4375 output := &GetApiOutput{} 4376 out.Result = output 4377 4378 var buff [1024]byte 4379 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4380 4381 body := io.TeeReader(response.Body, ringBuffer) 4382 4383 decoder := json.NewDecoder(body) 4384 decoder.UseNumber() 4385 var shape interface{} 4386 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4387 var snapshot bytes.Buffer 4388 io.Copy(&snapshot, ringBuffer) 4389 err = &smithy.DeserializationError{ 4390 Err: fmt.Errorf("failed to decode response body, %w", err), 4391 Snapshot: snapshot.Bytes(), 4392 } 4393 return out, metadata, err 4394 } 4395 4396 err = awsRestjson1_deserializeOpDocumentGetApiOutput(&output, shape) 4397 if err != nil { 4398 var snapshot bytes.Buffer 4399 io.Copy(&snapshot, ringBuffer) 4400 return out, metadata, &smithy.DeserializationError{ 4401 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4402 Snapshot: snapshot.Bytes(), 4403 } 4404 } 4405 4406 return out, metadata, err 4407} 4408 4409func awsRestjson1_deserializeOpErrorGetApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4410 var errorBuffer bytes.Buffer 4411 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4412 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4413 } 4414 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4415 4416 errorCode := "UnknownError" 4417 errorMessage := errorCode 4418 4419 code := response.Header.Get("X-Amzn-ErrorType") 4420 if len(code) != 0 { 4421 errorCode = restjson.SanitizeErrorCode(code) 4422 } 4423 4424 var buff [1024]byte 4425 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4426 4427 body := io.TeeReader(errorBody, ringBuffer) 4428 decoder := json.NewDecoder(body) 4429 decoder.UseNumber() 4430 code, message, err := restjson.GetErrorInfo(decoder) 4431 if err != nil { 4432 var snapshot bytes.Buffer 4433 io.Copy(&snapshot, ringBuffer) 4434 err = &smithy.DeserializationError{ 4435 Err: fmt.Errorf("failed to decode response body, %w", err), 4436 Snapshot: snapshot.Bytes(), 4437 } 4438 return err 4439 } 4440 4441 errorBody.Seek(0, io.SeekStart) 4442 if len(code) != 0 { 4443 errorCode = restjson.SanitizeErrorCode(code) 4444 } 4445 if len(message) != 0 { 4446 errorMessage = message 4447 } 4448 4449 switch { 4450 case strings.EqualFold("NotFoundException", errorCode): 4451 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4452 4453 case strings.EqualFold("TooManyRequestsException", errorCode): 4454 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4455 4456 default: 4457 genericError := &smithy.GenericAPIError{ 4458 Code: errorCode, 4459 Message: errorMessage, 4460 } 4461 return genericError 4462 4463 } 4464} 4465 4466func awsRestjson1_deserializeOpDocumentGetApiOutput(v **GetApiOutput, value interface{}) error { 4467 if v == nil { 4468 return fmt.Errorf("unexpected nil of type %T", v) 4469 } 4470 if value == nil { 4471 return nil 4472 } 4473 4474 shape, ok := value.(map[string]interface{}) 4475 if !ok { 4476 return fmt.Errorf("unexpected JSON type %v", value) 4477 } 4478 4479 var sv *GetApiOutput 4480 if *v == nil { 4481 sv = &GetApiOutput{} 4482 } else { 4483 sv = *v 4484 } 4485 4486 for key, value := range shape { 4487 switch key { 4488 case "apiEndpoint": 4489 if value != nil { 4490 jtv, ok := value.(string) 4491 if !ok { 4492 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4493 } 4494 sv.ApiEndpoint = ptr.String(jtv) 4495 } 4496 4497 case "apiGatewayManaged": 4498 if value != nil { 4499 jtv, ok := value.(bool) 4500 if !ok { 4501 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 4502 } 4503 sv.ApiGatewayManaged = jtv 4504 } 4505 4506 case "apiId": 4507 if value != nil { 4508 jtv, ok := value.(string) 4509 if !ok { 4510 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4511 } 4512 sv.ApiId = ptr.String(jtv) 4513 } 4514 4515 case "apiKeySelectionExpression": 4516 if value != nil { 4517 jtv, ok := value.(string) 4518 if !ok { 4519 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 4520 } 4521 sv.ApiKeySelectionExpression = ptr.String(jtv) 4522 } 4523 4524 case "corsConfiguration": 4525 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 4526 return err 4527 } 4528 4529 case "createdDate": 4530 if value != nil { 4531 jtv, ok := value.(string) 4532 if !ok { 4533 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 4534 } 4535 t, err := smithytime.ParseDateTime(jtv) 4536 if err != nil { 4537 return err 4538 } 4539 sv.CreatedDate = ptr.Time(t) 4540 } 4541 4542 case "description": 4543 if value != nil { 4544 jtv, ok := value.(string) 4545 if !ok { 4546 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 4547 } 4548 sv.Description = ptr.String(jtv) 4549 } 4550 4551 case "disableExecuteApiEndpoint": 4552 if value != nil { 4553 jtv, ok := value.(bool) 4554 if !ok { 4555 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 4556 } 4557 sv.DisableExecuteApiEndpoint = jtv 4558 } 4559 4560 case "disableSchemaValidation": 4561 if value != nil { 4562 jtv, ok := value.(bool) 4563 if !ok { 4564 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 4565 } 4566 sv.DisableSchemaValidation = jtv 4567 } 4568 4569 case "importInfo": 4570 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 4571 return err 4572 } 4573 4574 case "name": 4575 if value != nil { 4576 jtv, ok := value.(string) 4577 if !ok { 4578 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 4579 } 4580 sv.Name = ptr.String(jtv) 4581 } 4582 4583 case "protocolType": 4584 if value != nil { 4585 jtv, ok := value.(string) 4586 if !ok { 4587 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 4588 } 4589 sv.ProtocolType = types.ProtocolType(jtv) 4590 } 4591 4592 case "routeSelectionExpression": 4593 if value != nil { 4594 jtv, ok := value.(string) 4595 if !ok { 4596 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 4597 } 4598 sv.RouteSelectionExpression = ptr.String(jtv) 4599 } 4600 4601 case "tags": 4602 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 4603 return err 4604 } 4605 4606 case "version": 4607 if value != nil { 4608 jtv, ok := value.(string) 4609 if !ok { 4610 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 4611 } 4612 sv.Version = ptr.String(jtv) 4613 } 4614 4615 case "warnings": 4616 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 4617 return err 4618 } 4619 4620 default: 4621 _, _ = key, value 4622 4623 } 4624 } 4625 *v = sv 4626 return nil 4627} 4628 4629type awsRestjson1_deserializeOpGetApiMapping struct { 4630} 4631 4632func (*awsRestjson1_deserializeOpGetApiMapping) ID() string { 4633 return "OperationDeserializer" 4634} 4635 4636func (m *awsRestjson1_deserializeOpGetApiMapping) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4637 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4638) { 4639 out, metadata, err = next.HandleDeserialize(ctx, in) 4640 if err != nil { 4641 return out, metadata, err 4642 } 4643 4644 response, ok := out.RawResponse.(*smithyhttp.Response) 4645 if !ok { 4646 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4647 } 4648 4649 if response.StatusCode < 200 || response.StatusCode >= 300 { 4650 return out, metadata, awsRestjson1_deserializeOpErrorGetApiMapping(response, &metadata) 4651 } 4652 output := &GetApiMappingOutput{} 4653 out.Result = output 4654 4655 var buff [1024]byte 4656 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4657 4658 body := io.TeeReader(response.Body, ringBuffer) 4659 4660 decoder := json.NewDecoder(body) 4661 decoder.UseNumber() 4662 var shape interface{} 4663 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4664 var snapshot bytes.Buffer 4665 io.Copy(&snapshot, ringBuffer) 4666 err = &smithy.DeserializationError{ 4667 Err: fmt.Errorf("failed to decode response body, %w", err), 4668 Snapshot: snapshot.Bytes(), 4669 } 4670 return out, metadata, err 4671 } 4672 4673 err = awsRestjson1_deserializeOpDocumentGetApiMappingOutput(&output, shape) 4674 if err != nil { 4675 var snapshot bytes.Buffer 4676 io.Copy(&snapshot, ringBuffer) 4677 return out, metadata, &smithy.DeserializationError{ 4678 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4679 Snapshot: snapshot.Bytes(), 4680 } 4681 } 4682 4683 return out, metadata, err 4684} 4685 4686func awsRestjson1_deserializeOpErrorGetApiMapping(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4687 var errorBuffer bytes.Buffer 4688 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4689 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4690 } 4691 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4692 4693 errorCode := "UnknownError" 4694 errorMessage := errorCode 4695 4696 code := response.Header.Get("X-Amzn-ErrorType") 4697 if len(code) != 0 { 4698 errorCode = restjson.SanitizeErrorCode(code) 4699 } 4700 4701 var buff [1024]byte 4702 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4703 4704 body := io.TeeReader(errorBody, ringBuffer) 4705 decoder := json.NewDecoder(body) 4706 decoder.UseNumber() 4707 code, message, err := restjson.GetErrorInfo(decoder) 4708 if err != nil { 4709 var snapshot bytes.Buffer 4710 io.Copy(&snapshot, ringBuffer) 4711 err = &smithy.DeserializationError{ 4712 Err: fmt.Errorf("failed to decode response body, %w", err), 4713 Snapshot: snapshot.Bytes(), 4714 } 4715 return err 4716 } 4717 4718 errorBody.Seek(0, io.SeekStart) 4719 if len(code) != 0 { 4720 errorCode = restjson.SanitizeErrorCode(code) 4721 } 4722 if len(message) != 0 { 4723 errorMessage = message 4724 } 4725 4726 switch { 4727 case strings.EqualFold("BadRequestException", errorCode): 4728 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4729 4730 case strings.EqualFold("NotFoundException", errorCode): 4731 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4732 4733 case strings.EqualFold("TooManyRequestsException", errorCode): 4734 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4735 4736 default: 4737 genericError := &smithy.GenericAPIError{ 4738 Code: errorCode, 4739 Message: errorMessage, 4740 } 4741 return genericError 4742 4743 } 4744} 4745 4746func awsRestjson1_deserializeOpDocumentGetApiMappingOutput(v **GetApiMappingOutput, value interface{}) error { 4747 if v == nil { 4748 return fmt.Errorf("unexpected nil of type %T", v) 4749 } 4750 if value == nil { 4751 return nil 4752 } 4753 4754 shape, ok := value.(map[string]interface{}) 4755 if !ok { 4756 return fmt.Errorf("unexpected JSON type %v", value) 4757 } 4758 4759 var sv *GetApiMappingOutput 4760 if *v == nil { 4761 sv = &GetApiMappingOutput{} 4762 } else { 4763 sv = *v 4764 } 4765 4766 for key, value := range shape { 4767 switch key { 4768 case "apiId": 4769 if value != nil { 4770 jtv, ok := value.(string) 4771 if !ok { 4772 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4773 } 4774 sv.ApiId = ptr.String(jtv) 4775 } 4776 4777 case "apiMappingId": 4778 if value != nil { 4779 jtv, ok := value.(string) 4780 if !ok { 4781 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4782 } 4783 sv.ApiMappingId = ptr.String(jtv) 4784 } 4785 4786 case "apiMappingKey": 4787 if value != nil { 4788 jtv, ok := value.(string) 4789 if !ok { 4790 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 4791 } 4792 sv.ApiMappingKey = ptr.String(jtv) 4793 } 4794 4795 case "stage": 4796 if value != nil { 4797 jtv, ok := value.(string) 4798 if !ok { 4799 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 4800 } 4801 sv.Stage = ptr.String(jtv) 4802 } 4803 4804 default: 4805 _, _ = key, value 4806 4807 } 4808 } 4809 *v = sv 4810 return nil 4811} 4812 4813type awsRestjson1_deserializeOpGetApiMappings struct { 4814} 4815 4816func (*awsRestjson1_deserializeOpGetApiMappings) ID() string { 4817 return "OperationDeserializer" 4818} 4819 4820func (m *awsRestjson1_deserializeOpGetApiMappings) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4821 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4822) { 4823 out, metadata, err = next.HandleDeserialize(ctx, in) 4824 if err != nil { 4825 return out, metadata, err 4826 } 4827 4828 response, ok := out.RawResponse.(*smithyhttp.Response) 4829 if !ok { 4830 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4831 } 4832 4833 if response.StatusCode < 200 || response.StatusCode >= 300 { 4834 return out, metadata, awsRestjson1_deserializeOpErrorGetApiMappings(response, &metadata) 4835 } 4836 output := &GetApiMappingsOutput{} 4837 out.Result = output 4838 4839 var buff [1024]byte 4840 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4841 4842 body := io.TeeReader(response.Body, ringBuffer) 4843 4844 decoder := json.NewDecoder(body) 4845 decoder.UseNumber() 4846 var shape interface{} 4847 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4848 var snapshot bytes.Buffer 4849 io.Copy(&snapshot, ringBuffer) 4850 err = &smithy.DeserializationError{ 4851 Err: fmt.Errorf("failed to decode response body, %w", err), 4852 Snapshot: snapshot.Bytes(), 4853 } 4854 return out, metadata, err 4855 } 4856 4857 err = awsRestjson1_deserializeOpDocumentGetApiMappingsOutput(&output, shape) 4858 if err != nil { 4859 var snapshot bytes.Buffer 4860 io.Copy(&snapshot, ringBuffer) 4861 return out, metadata, &smithy.DeserializationError{ 4862 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4863 Snapshot: snapshot.Bytes(), 4864 } 4865 } 4866 4867 return out, metadata, err 4868} 4869 4870func awsRestjson1_deserializeOpErrorGetApiMappings(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4871 var errorBuffer bytes.Buffer 4872 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4873 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4874 } 4875 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4876 4877 errorCode := "UnknownError" 4878 errorMessage := errorCode 4879 4880 code := response.Header.Get("X-Amzn-ErrorType") 4881 if len(code) != 0 { 4882 errorCode = restjson.SanitizeErrorCode(code) 4883 } 4884 4885 var buff [1024]byte 4886 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4887 4888 body := io.TeeReader(errorBody, ringBuffer) 4889 decoder := json.NewDecoder(body) 4890 decoder.UseNumber() 4891 code, message, err := restjson.GetErrorInfo(decoder) 4892 if err != nil { 4893 var snapshot bytes.Buffer 4894 io.Copy(&snapshot, ringBuffer) 4895 err = &smithy.DeserializationError{ 4896 Err: fmt.Errorf("failed to decode response body, %w", err), 4897 Snapshot: snapshot.Bytes(), 4898 } 4899 return err 4900 } 4901 4902 errorBody.Seek(0, io.SeekStart) 4903 if len(code) != 0 { 4904 errorCode = restjson.SanitizeErrorCode(code) 4905 } 4906 if len(message) != 0 { 4907 errorMessage = message 4908 } 4909 4910 switch { 4911 case strings.EqualFold("BadRequestException", errorCode): 4912 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4913 4914 case strings.EqualFold("NotFoundException", errorCode): 4915 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4916 4917 case strings.EqualFold("TooManyRequestsException", errorCode): 4918 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4919 4920 default: 4921 genericError := &smithy.GenericAPIError{ 4922 Code: errorCode, 4923 Message: errorMessage, 4924 } 4925 return genericError 4926 4927 } 4928} 4929 4930func awsRestjson1_deserializeOpDocumentGetApiMappingsOutput(v **GetApiMappingsOutput, value interface{}) error { 4931 if v == nil { 4932 return fmt.Errorf("unexpected nil of type %T", v) 4933 } 4934 if value == nil { 4935 return nil 4936 } 4937 4938 shape, ok := value.(map[string]interface{}) 4939 if !ok { 4940 return fmt.Errorf("unexpected JSON type %v", value) 4941 } 4942 4943 var sv *GetApiMappingsOutput 4944 if *v == nil { 4945 sv = &GetApiMappingsOutput{} 4946 } else { 4947 sv = *v 4948 } 4949 4950 for key, value := range shape { 4951 switch key { 4952 case "items": 4953 if err := awsRestjson1_deserializeDocument__listOfApiMapping(&sv.Items, value); err != nil { 4954 return err 4955 } 4956 4957 case "nextToken": 4958 if value != nil { 4959 jtv, ok := value.(string) 4960 if !ok { 4961 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 4962 } 4963 sv.NextToken = ptr.String(jtv) 4964 } 4965 4966 default: 4967 _, _ = key, value 4968 4969 } 4970 } 4971 *v = sv 4972 return nil 4973} 4974 4975type awsRestjson1_deserializeOpGetApis struct { 4976} 4977 4978func (*awsRestjson1_deserializeOpGetApis) ID() string { 4979 return "OperationDeserializer" 4980} 4981 4982func (m *awsRestjson1_deserializeOpGetApis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4983 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4984) { 4985 out, metadata, err = next.HandleDeserialize(ctx, in) 4986 if err != nil { 4987 return out, metadata, err 4988 } 4989 4990 response, ok := out.RawResponse.(*smithyhttp.Response) 4991 if !ok { 4992 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4993 } 4994 4995 if response.StatusCode < 200 || response.StatusCode >= 300 { 4996 return out, metadata, awsRestjson1_deserializeOpErrorGetApis(response, &metadata) 4997 } 4998 output := &GetApisOutput{} 4999 out.Result = output 5000 5001 var buff [1024]byte 5002 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5003 5004 body := io.TeeReader(response.Body, ringBuffer) 5005 5006 decoder := json.NewDecoder(body) 5007 decoder.UseNumber() 5008 var shape interface{} 5009 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5010 var snapshot bytes.Buffer 5011 io.Copy(&snapshot, ringBuffer) 5012 err = &smithy.DeserializationError{ 5013 Err: fmt.Errorf("failed to decode response body, %w", err), 5014 Snapshot: snapshot.Bytes(), 5015 } 5016 return out, metadata, err 5017 } 5018 5019 err = awsRestjson1_deserializeOpDocumentGetApisOutput(&output, shape) 5020 if err != nil { 5021 var snapshot bytes.Buffer 5022 io.Copy(&snapshot, ringBuffer) 5023 return out, metadata, &smithy.DeserializationError{ 5024 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5025 Snapshot: snapshot.Bytes(), 5026 } 5027 } 5028 5029 return out, metadata, err 5030} 5031 5032func awsRestjson1_deserializeOpErrorGetApis(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5033 var errorBuffer bytes.Buffer 5034 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5035 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5036 } 5037 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5038 5039 errorCode := "UnknownError" 5040 errorMessage := errorCode 5041 5042 code := response.Header.Get("X-Amzn-ErrorType") 5043 if len(code) != 0 { 5044 errorCode = restjson.SanitizeErrorCode(code) 5045 } 5046 5047 var buff [1024]byte 5048 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5049 5050 body := io.TeeReader(errorBody, ringBuffer) 5051 decoder := json.NewDecoder(body) 5052 decoder.UseNumber() 5053 code, message, err := restjson.GetErrorInfo(decoder) 5054 if err != nil { 5055 var snapshot bytes.Buffer 5056 io.Copy(&snapshot, ringBuffer) 5057 err = &smithy.DeserializationError{ 5058 Err: fmt.Errorf("failed to decode response body, %w", err), 5059 Snapshot: snapshot.Bytes(), 5060 } 5061 return err 5062 } 5063 5064 errorBody.Seek(0, io.SeekStart) 5065 if len(code) != 0 { 5066 errorCode = restjson.SanitizeErrorCode(code) 5067 } 5068 if len(message) != 0 { 5069 errorMessage = message 5070 } 5071 5072 switch { 5073 case strings.EqualFold("BadRequestException", errorCode): 5074 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5075 5076 case strings.EqualFold("NotFoundException", errorCode): 5077 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5078 5079 case strings.EqualFold("TooManyRequestsException", errorCode): 5080 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5081 5082 default: 5083 genericError := &smithy.GenericAPIError{ 5084 Code: errorCode, 5085 Message: errorMessage, 5086 } 5087 return genericError 5088 5089 } 5090} 5091 5092func awsRestjson1_deserializeOpDocumentGetApisOutput(v **GetApisOutput, value interface{}) error { 5093 if v == nil { 5094 return fmt.Errorf("unexpected nil of type %T", v) 5095 } 5096 if value == nil { 5097 return nil 5098 } 5099 5100 shape, ok := value.(map[string]interface{}) 5101 if !ok { 5102 return fmt.Errorf("unexpected JSON type %v", value) 5103 } 5104 5105 var sv *GetApisOutput 5106 if *v == nil { 5107 sv = &GetApisOutput{} 5108 } else { 5109 sv = *v 5110 } 5111 5112 for key, value := range shape { 5113 switch key { 5114 case "items": 5115 if err := awsRestjson1_deserializeDocument__listOfApi(&sv.Items, value); err != nil { 5116 return err 5117 } 5118 5119 case "nextToken": 5120 if value != nil { 5121 jtv, ok := value.(string) 5122 if !ok { 5123 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5124 } 5125 sv.NextToken = ptr.String(jtv) 5126 } 5127 5128 default: 5129 _, _ = key, value 5130 5131 } 5132 } 5133 *v = sv 5134 return nil 5135} 5136 5137type awsRestjson1_deserializeOpGetAuthorizer struct { 5138} 5139 5140func (*awsRestjson1_deserializeOpGetAuthorizer) ID() string { 5141 return "OperationDeserializer" 5142} 5143 5144func (m *awsRestjson1_deserializeOpGetAuthorizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5145 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5146) { 5147 out, metadata, err = next.HandleDeserialize(ctx, in) 5148 if err != nil { 5149 return out, metadata, err 5150 } 5151 5152 response, ok := out.RawResponse.(*smithyhttp.Response) 5153 if !ok { 5154 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5155 } 5156 5157 if response.StatusCode < 200 || response.StatusCode >= 300 { 5158 return out, metadata, awsRestjson1_deserializeOpErrorGetAuthorizer(response, &metadata) 5159 } 5160 output := &GetAuthorizerOutput{} 5161 out.Result = output 5162 5163 var buff [1024]byte 5164 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5165 5166 body := io.TeeReader(response.Body, ringBuffer) 5167 5168 decoder := json.NewDecoder(body) 5169 decoder.UseNumber() 5170 var shape interface{} 5171 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5172 var snapshot bytes.Buffer 5173 io.Copy(&snapshot, ringBuffer) 5174 err = &smithy.DeserializationError{ 5175 Err: fmt.Errorf("failed to decode response body, %w", err), 5176 Snapshot: snapshot.Bytes(), 5177 } 5178 return out, metadata, err 5179 } 5180 5181 err = awsRestjson1_deserializeOpDocumentGetAuthorizerOutput(&output, shape) 5182 if err != nil { 5183 var snapshot bytes.Buffer 5184 io.Copy(&snapshot, ringBuffer) 5185 return out, metadata, &smithy.DeserializationError{ 5186 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5187 Snapshot: snapshot.Bytes(), 5188 } 5189 } 5190 5191 return out, metadata, err 5192} 5193 5194func awsRestjson1_deserializeOpErrorGetAuthorizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5195 var errorBuffer bytes.Buffer 5196 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5197 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5198 } 5199 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5200 5201 errorCode := "UnknownError" 5202 errorMessage := errorCode 5203 5204 code := response.Header.Get("X-Amzn-ErrorType") 5205 if len(code) != 0 { 5206 errorCode = restjson.SanitizeErrorCode(code) 5207 } 5208 5209 var buff [1024]byte 5210 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5211 5212 body := io.TeeReader(errorBody, ringBuffer) 5213 decoder := json.NewDecoder(body) 5214 decoder.UseNumber() 5215 code, message, err := restjson.GetErrorInfo(decoder) 5216 if err != nil { 5217 var snapshot bytes.Buffer 5218 io.Copy(&snapshot, ringBuffer) 5219 err = &smithy.DeserializationError{ 5220 Err: fmt.Errorf("failed to decode response body, %w", err), 5221 Snapshot: snapshot.Bytes(), 5222 } 5223 return err 5224 } 5225 5226 errorBody.Seek(0, io.SeekStart) 5227 if len(code) != 0 { 5228 errorCode = restjson.SanitizeErrorCode(code) 5229 } 5230 if len(message) != 0 { 5231 errorMessage = message 5232 } 5233 5234 switch { 5235 case strings.EqualFold("NotFoundException", errorCode): 5236 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5237 5238 case strings.EqualFold("TooManyRequestsException", errorCode): 5239 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5240 5241 default: 5242 genericError := &smithy.GenericAPIError{ 5243 Code: errorCode, 5244 Message: errorMessage, 5245 } 5246 return genericError 5247 5248 } 5249} 5250 5251func awsRestjson1_deserializeOpDocumentGetAuthorizerOutput(v **GetAuthorizerOutput, value interface{}) error { 5252 if v == nil { 5253 return fmt.Errorf("unexpected nil of type %T", v) 5254 } 5255 if value == nil { 5256 return nil 5257 } 5258 5259 shape, ok := value.(map[string]interface{}) 5260 if !ok { 5261 return fmt.Errorf("unexpected JSON type %v", value) 5262 } 5263 5264 var sv *GetAuthorizerOutput 5265 if *v == nil { 5266 sv = &GetAuthorizerOutput{} 5267 } else { 5268 sv = *v 5269 } 5270 5271 for key, value := range shape { 5272 switch key { 5273 case "authorizerCredentialsArn": 5274 if value != nil { 5275 jtv, ok := value.(string) 5276 if !ok { 5277 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5278 } 5279 sv.AuthorizerCredentialsArn = ptr.String(jtv) 5280 } 5281 5282 case "authorizerId": 5283 if value != nil { 5284 jtv, ok := value.(string) 5285 if !ok { 5286 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5287 } 5288 sv.AuthorizerId = ptr.String(jtv) 5289 } 5290 5291 case "authorizerPayloadFormatVersion": 5292 if value != nil { 5293 jtv, ok := value.(string) 5294 if !ok { 5295 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 5296 } 5297 sv.AuthorizerPayloadFormatVersion = ptr.String(jtv) 5298 } 5299 5300 case "authorizerResultTtlInSeconds": 5301 if value != nil { 5302 jtv, ok := value.(json.Number) 5303 if !ok { 5304 return fmt.Errorf("expected IntegerWithLengthBetween0And3600 to be json.Number, got %T instead", value) 5305 } 5306 i64, err := jtv.Int64() 5307 if err != nil { 5308 return err 5309 } 5310 sv.AuthorizerResultTtlInSeconds = int32(i64) 5311 } 5312 5313 case "authorizerType": 5314 if value != nil { 5315 jtv, ok := value.(string) 5316 if !ok { 5317 return fmt.Errorf("expected AuthorizerType to be of type string, got %T instead", value) 5318 } 5319 sv.AuthorizerType = types.AuthorizerType(jtv) 5320 } 5321 5322 case "authorizerUri": 5323 if value != nil { 5324 jtv, ok := value.(string) 5325 if !ok { 5326 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 5327 } 5328 sv.AuthorizerUri = ptr.String(jtv) 5329 } 5330 5331 case "enableSimpleResponses": 5332 if value != nil { 5333 jtv, ok := value.(bool) 5334 if !ok { 5335 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 5336 } 5337 sv.EnableSimpleResponses = jtv 5338 } 5339 5340 case "identitySource": 5341 if err := awsRestjson1_deserializeDocumentIdentitySourceList(&sv.IdentitySource, value); err != nil { 5342 return err 5343 } 5344 5345 case "identityValidationExpression": 5346 if value != nil { 5347 jtv, ok := value.(string) 5348 if !ok { 5349 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 5350 } 5351 sv.IdentityValidationExpression = ptr.String(jtv) 5352 } 5353 5354 case "jwtConfiguration": 5355 if err := awsRestjson1_deserializeDocumentJWTConfiguration(&sv.JwtConfiguration, value); err != nil { 5356 return err 5357 } 5358 5359 case "name": 5360 if value != nil { 5361 jtv, ok := value.(string) 5362 if !ok { 5363 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 5364 } 5365 sv.Name = ptr.String(jtv) 5366 } 5367 5368 default: 5369 _, _ = key, value 5370 5371 } 5372 } 5373 *v = sv 5374 return nil 5375} 5376 5377type awsRestjson1_deserializeOpGetAuthorizers struct { 5378} 5379 5380func (*awsRestjson1_deserializeOpGetAuthorizers) ID() string { 5381 return "OperationDeserializer" 5382} 5383 5384func (m *awsRestjson1_deserializeOpGetAuthorizers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5385 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5386) { 5387 out, metadata, err = next.HandleDeserialize(ctx, in) 5388 if err != nil { 5389 return out, metadata, err 5390 } 5391 5392 response, ok := out.RawResponse.(*smithyhttp.Response) 5393 if !ok { 5394 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5395 } 5396 5397 if response.StatusCode < 200 || response.StatusCode >= 300 { 5398 return out, metadata, awsRestjson1_deserializeOpErrorGetAuthorizers(response, &metadata) 5399 } 5400 output := &GetAuthorizersOutput{} 5401 out.Result = output 5402 5403 var buff [1024]byte 5404 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5405 5406 body := io.TeeReader(response.Body, ringBuffer) 5407 5408 decoder := json.NewDecoder(body) 5409 decoder.UseNumber() 5410 var shape interface{} 5411 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5412 var snapshot bytes.Buffer 5413 io.Copy(&snapshot, ringBuffer) 5414 err = &smithy.DeserializationError{ 5415 Err: fmt.Errorf("failed to decode response body, %w", err), 5416 Snapshot: snapshot.Bytes(), 5417 } 5418 return out, metadata, err 5419 } 5420 5421 err = awsRestjson1_deserializeOpDocumentGetAuthorizersOutput(&output, shape) 5422 if err != nil { 5423 var snapshot bytes.Buffer 5424 io.Copy(&snapshot, ringBuffer) 5425 return out, metadata, &smithy.DeserializationError{ 5426 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5427 Snapshot: snapshot.Bytes(), 5428 } 5429 } 5430 5431 return out, metadata, err 5432} 5433 5434func awsRestjson1_deserializeOpErrorGetAuthorizers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5435 var errorBuffer bytes.Buffer 5436 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5437 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5438 } 5439 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5440 5441 errorCode := "UnknownError" 5442 errorMessage := errorCode 5443 5444 code := response.Header.Get("X-Amzn-ErrorType") 5445 if len(code) != 0 { 5446 errorCode = restjson.SanitizeErrorCode(code) 5447 } 5448 5449 var buff [1024]byte 5450 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5451 5452 body := io.TeeReader(errorBody, ringBuffer) 5453 decoder := json.NewDecoder(body) 5454 decoder.UseNumber() 5455 code, message, err := restjson.GetErrorInfo(decoder) 5456 if err != nil { 5457 var snapshot bytes.Buffer 5458 io.Copy(&snapshot, ringBuffer) 5459 err = &smithy.DeserializationError{ 5460 Err: fmt.Errorf("failed to decode response body, %w", err), 5461 Snapshot: snapshot.Bytes(), 5462 } 5463 return err 5464 } 5465 5466 errorBody.Seek(0, io.SeekStart) 5467 if len(code) != 0 { 5468 errorCode = restjson.SanitizeErrorCode(code) 5469 } 5470 if len(message) != 0 { 5471 errorMessage = message 5472 } 5473 5474 switch { 5475 case strings.EqualFold("BadRequestException", errorCode): 5476 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5477 5478 case strings.EqualFold("NotFoundException", errorCode): 5479 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5480 5481 case strings.EqualFold("TooManyRequestsException", errorCode): 5482 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5483 5484 default: 5485 genericError := &smithy.GenericAPIError{ 5486 Code: errorCode, 5487 Message: errorMessage, 5488 } 5489 return genericError 5490 5491 } 5492} 5493 5494func awsRestjson1_deserializeOpDocumentGetAuthorizersOutput(v **GetAuthorizersOutput, value interface{}) error { 5495 if v == nil { 5496 return fmt.Errorf("unexpected nil of type %T", v) 5497 } 5498 if value == nil { 5499 return nil 5500 } 5501 5502 shape, ok := value.(map[string]interface{}) 5503 if !ok { 5504 return fmt.Errorf("unexpected JSON type %v", value) 5505 } 5506 5507 var sv *GetAuthorizersOutput 5508 if *v == nil { 5509 sv = &GetAuthorizersOutput{} 5510 } else { 5511 sv = *v 5512 } 5513 5514 for key, value := range shape { 5515 switch key { 5516 case "items": 5517 if err := awsRestjson1_deserializeDocument__listOfAuthorizer(&sv.Items, value); err != nil { 5518 return err 5519 } 5520 5521 case "nextToken": 5522 if value != nil { 5523 jtv, ok := value.(string) 5524 if !ok { 5525 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5526 } 5527 sv.NextToken = ptr.String(jtv) 5528 } 5529 5530 default: 5531 _, _ = key, value 5532 5533 } 5534 } 5535 *v = sv 5536 return nil 5537} 5538 5539type awsRestjson1_deserializeOpGetDeployment struct { 5540} 5541 5542func (*awsRestjson1_deserializeOpGetDeployment) ID() string { 5543 return "OperationDeserializer" 5544} 5545 5546func (m *awsRestjson1_deserializeOpGetDeployment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5547 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5548) { 5549 out, metadata, err = next.HandleDeserialize(ctx, in) 5550 if err != nil { 5551 return out, metadata, err 5552 } 5553 5554 response, ok := out.RawResponse.(*smithyhttp.Response) 5555 if !ok { 5556 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5557 } 5558 5559 if response.StatusCode < 200 || response.StatusCode >= 300 { 5560 return out, metadata, awsRestjson1_deserializeOpErrorGetDeployment(response, &metadata) 5561 } 5562 output := &GetDeploymentOutput{} 5563 out.Result = output 5564 5565 var buff [1024]byte 5566 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5567 5568 body := io.TeeReader(response.Body, ringBuffer) 5569 5570 decoder := json.NewDecoder(body) 5571 decoder.UseNumber() 5572 var shape interface{} 5573 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5574 var snapshot bytes.Buffer 5575 io.Copy(&snapshot, ringBuffer) 5576 err = &smithy.DeserializationError{ 5577 Err: fmt.Errorf("failed to decode response body, %w", err), 5578 Snapshot: snapshot.Bytes(), 5579 } 5580 return out, metadata, err 5581 } 5582 5583 err = awsRestjson1_deserializeOpDocumentGetDeploymentOutput(&output, shape) 5584 if err != nil { 5585 var snapshot bytes.Buffer 5586 io.Copy(&snapshot, ringBuffer) 5587 return out, metadata, &smithy.DeserializationError{ 5588 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5589 Snapshot: snapshot.Bytes(), 5590 } 5591 } 5592 5593 return out, metadata, err 5594} 5595 5596func awsRestjson1_deserializeOpErrorGetDeployment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5597 var errorBuffer bytes.Buffer 5598 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5599 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5600 } 5601 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5602 5603 errorCode := "UnknownError" 5604 errorMessage := errorCode 5605 5606 code := response.Header.Get("X-Amzn-ErrorType") 5607 if len(code) != 0 { 5608 errorCode = restjson.SanitizeErrorCode(code) 5609 } 5610 5611 var buff [1024]byte 5612 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5613 5614 body := io.TeeReader(errorBody, ringBuffer) 5615 decoder := json.NewDecoder(body) 5616 decoder.UseNumber() 5617 code, message, err := restjson.GetErrorInfo(decoder) 5618 if err != nil { 5619 var snapshot bytes.Buffer 5620 io.Copy(&snapshot, ringBuffer) 5621 err = &smithy.DeserializationError{ 5622 Err: fmt.Errorf("failed to decode response body, %w", err), 5623 Snapshot: snapshot.Bytes(), 5624 } 5625 return err 5626 } 5627 5628 errorBody.Seek(0, io.SeekStart) 5629 if len(code) != 0 { 5630 errorCode = restjson.SanitizeErrorCode(code) 5631 } 5632 if len(message) != 0 { 5633 errorMessage = message 5634 } 5635 5636 switch { 5637 case strings.EqualFold("NotFoundException", errorCode): 5638 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5639 5640 case strings.EqualFold("TooManyRequestsException", errorCode): 5641 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5642 5643 default: 5644 genericError := &smithy.GenericAPIError{ 5645 Code: errorCode, 5646 Message: errorMessage, 5647 } 5648 return genericError 5649 5650 } 5651} 5652 5653func awsRestjson1_deserializeOpDocumentGetDeploymentOutput(v **GetDeploymentOutput, value interface{}) error { 5654 if v == nil { 5655 return fmt.Errorf("unexpected nil of type %T", v) 5656 } 5657 if value == nil { 5658 return nil 5659 } 5660 5661 shape, ok := value.(map[string]interface{}) 5662 if !ok { 5663 return fmt.Errorf("unexpected JSON type %v", value) 5664 } 5665 5666 var sv *GetDeploymentOutput 5667 if *v == nil { 5668 sv = &GetDeploymentOutput{} 5669 } else { 5670 sv = *v 5671 } 5672 5673 for key, value := range shape { 5674 switch key { 5675 case "autoDeployed": 5676 if value != nil { 5677 jtv, ok := value.(bool) 5678 if !ok { 5679 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 5680 } 5681 sv.AutoDeployed = jtv 5682 } 5683 5684 case "createdDate": 5685 if value != nil { 5686 jtv, ok := value.(string) 5687 if !ok { 5688 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 5689 } 5690 t, err := smithytime.ParseDateTime(jtv) 5691 if err != nil { 5692 return err 5693 } 5694 sv.CreatedDate = ptr.Time(t) 5695 } 5696 5697 case "deploymentId": 5698 if value != nil { 5699 jtv, ok := value.(string) 5700 if !ok { 5701 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5702 } 5703 sv.DeploymentId = ptr.String(jtv) 5704 } 5705 5706 case "deploymentStatus": 5707 if value != nil { 5708 jtv, ok := value.(string) 5709 if !ok { 5710 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 5711 } 5712 sv.DeploymentStatus = types.DeploymentStatus(jtv) 5713 } 5714 5715 case "deploymentStatusMessage": 5716 if value != nil { 5717 jtv, ok := value.(string) 5718 if !ok { 5719 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5720 } 5721 sv.DeploymentStatusMessage = ptr.String(jtv) 5722 } 5723 5724 case "description": 5725 if value != nil { 5726 jtv, ok := value.(string) 5727 if !ok { 5728 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 5729 } 5730 sv.Description = ptr.String(jtv) 5731 } 5732 5733 default: 5734 _, _ = key, value 5735 5736 } 5737 } 5738 *v = sv 5739 return nil 5740} 5741 5742type awsRestjson1_deserializeOpGetDeployments struct { 5743} 5744 5745func (*awsRestjson1_deserializeOpGetDeployments) ID() string { 5746 return "OperationDeserializer" 5747} 5748 5749func (m *awsRestjson1_deserializeOpGetDeployments) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5750 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5751) { 5752 out, metadata, err = next.HandleDeserialize(ctx, in) 5753 if err != nil { 5754 return out, metadata, err 5755 } 5756 5757 response, ok := out.RawResponse.(*smithyhttp.Response) 5758 if !ok { 5759 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5760 } 5761 5762 if response.StatusCode < 200 || response.StatusCode >= 300 { 5763 return out, metadata, awsRestjson1_deserializeOpErrorGetDeployments(response, &metadata) 5764 } 5765 output := &GetDeploymentsOutput{} 5766 out.Result = output 5767 5768 var buff [1024]byte 5769 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5770 5771 body := io.TeeReader(response.Body, ringBuffer) 5772 5773 decoder := json.NewDecoder(body) 5774 decoder.UseNumber() 5775 var shape interface{} 5776 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5777 var snapshot bytes.Buffer 5778 io.Copy(&snapshot, ringBuffer) 5779 err = &smithy.DeserializationError{ 5780 Err: fmt.Errorf("failed to decode response body, %w", err), 5781 Snapshot: snapshot.Bytes(), 5782 } 5783 return out, metadata, err 5784 } 5785 5786 err = awsRestjson1_deserializeOpDocumentGetDeploymentsOutput(&output, shape) 5787 if err != nil { 5788 var snapshot bytes.Buffer 5789 io.Copy(&snapshot, ringBuffer) 5790 return out, metadata, &smithy.DeserializationError{ 5791 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5792 Snapshot: snapshot.Bytes(), 5793 } 5794 } 5795 5796 return out, metadata, err 5797} 5798 5799func awsRestjson1_deserializeOpErrorGetDeployments(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5800 var errorBuffer bytes.Buffer 5801 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5802 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5803 } 5804 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5805 5806 errorCode := "UnknownError" 5807 errorMessage := errorCode 5808 5809 code := response.Header.Get("X-Amzn-ErrorType") 5810 if len(code) != 0 { 5811 errorCode = restjson.SanitizeErrorCode(code) 5812 } 5813 5814 var buff [1024]byte 5815 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5816 5817 body := io.TeeReader(errorBody, ringBuffer) 5818 decoder := json.NewDecoder(body) 5819 decoder.UseNumber() 5820 code, message, err := restjson.GetErrorInfo(decoder) 5821 if err != nil { 5822 var snapshot bytes.Buffer 5823 io.Copy(&snapshot, ringBuffer) 5824 err = &smithy.DeserializationError{ 5825 Err: fmt.Errorf("failed to decode response body, %w", err), 5826 Snapshot: snapshot.Bytes(), 5827 } 5828 return err 5829 } 5830 5831 errorBody.Seek(0, io.SeekStart) 5832 if len(code) != 0 { 5833 errorCode = restjson.SanitizeErrorCode(code) 5834 } 5835 if len(message) != 0 { 5836 errorMessage = message 5837 } 5838 5839 switch { 5840 case strings.EqualFold("BadRequestException", errorCode): 5841 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5842 5843 case strings.EqualFold("NotFoundException", errorCode): 5844 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5845 5846 case strings.EqualFold("TooManyRequestsException", errorCode): 5847 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5848 5849 default: 5850 genericError := &smithy.GenericAPIError{ 5851 Code: errorCode, 5852 Message: errorMessage, 5853 } 5854 return genericError 5855 5856 } 5857} 5858 5859func awsRestjson1_deserializeOpDocumentGetDeploymentsOutput(v **GetDeploymentsOutput, value interface{}) error { 5860 if v == nil { 5861 return fmt.Errorf("unexpected nil of type %T", v) 5862 } 5863 if value == nil { 5864 return nil 5865 } 5866 5867 shape, ok := value.(map[string]interface{}) 5868 if !ok { 5869 return fmt.Errorf("unexpected JSON type %v", value) 5870 } 5871 5872 var sv *GetDeploymentsOutput 5873 if *v == nil { 5874 sv = &GetDeploymentsOutput{} 5875 } else { 5876 sv = *v 5877 } 5878 5879 for key, value := range shape { 5880 switch key { 5881 case "items": 5882 if err := awsRestjson1_deserializeDocument__listOfDeployment(&sv.Items, value); err != nil { 5883 return err 5884 } 5885 5886 case "nextToken": 5887 if value != nil { 5888 jtv, ok := value.(string) 5889 if !ok { 5890 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5891 } 5892 sv.NextToken = ptr.String(jtv) 5893 } 5894 5895 default: 5896 _, _ = key, value 5897 5898 } 5899 } 5900 *v = sv 5901 return nil 5902} 5903 5904type awsRestjson1_deserializeOpGetDomainName struct { 5905} 5906 5907func (*awsRestjson1_deserializeOpGetDomainName) ID() string { 5908 return "OperationDeserializer" 5909} 5910 5911func (m *awsRestjson1_deserializeOpGetDomainName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5912 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5913) { 5914 out, metadata, err = next.HandleDeserialize(ctx, in) 5915 if err != nil { 5916 return out, metadata, err 5917 } 5918 5919 response, ok := out.RawResponse.(*smithyhttp.Response) 5920 if !ok { 5921 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5922 } 5923 5924 if response.StatusCode < 200 || response.StatusCode >= 300 { 5925 return out, metadata, awsRestjson1_deserializeOpErrorGetDomainName(response, &metadata) 5926 } 5927 output := &GetDomainNameOutput{} 5928 out.Result = output 5929 5930 var buff [1024]byte 5931 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5932 5933 body := io.TeeReader(response.Body, ringBuffer) 5934 5935 decoder := json.NewDecoder(body) 5936 decoder.UseNumber() 5937 var shape interface{} 5938 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5939 var snapshot bytes.Buffer 5940 io.Copy(&snapshot, ringBuffer) 5941 err = &smithy.DeserializationError{ 5942 Err: fmt.Errorf("failed to decode response body, %w", err), 5943 Snapshot: snapshot.Bytes(), 5944 } 5945 return out, metadata, err 5946 } 5947 5948 err = awsRestjson1_deserializeOpDocumentGetDomainNameOutput(&output, shape) 5949 if err != nil { 5950 var snapshot bytes.Buffer 5951 io.Copy(&snapshot, ringBuffer) 5952 return out, metadata, &smithy.DeserializationError{ 5953 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5954 Snapshot: snapshot.Bytes(), 5955 } 5956 } 5957 5958 return out, metadata, err 5959} 5960 5961func awsRestjson1_deserializeOpErrorGetDomainName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5962 var errorBuffer bytes.Buffer 5963 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5964 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5965 } 5966 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5967 5968 errorCode := "UnknownError" 5969 errorMessage := errorCode 5970 5971 code := response.Header.Get("X-Amzn-ErrorType") 5972 if len(code) != 0 { 5973 errorCode = restjson.SanitizeErrorCode(code) 5974 } 5975 5976 var buff [1024]byte 5977 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5978 5979 body := io.TeeReader(errorBody, ringBuffer) 5980 decoder := json.NewDecoder(body) 5981 decoder.UseNumber() 5982 code, message, err := restjson.GetErrorInfo(decoder) 5983 if err != nil { 5984 var snapshot bytes.Buffer 5985 io.Copy(&snapshot, ringBuffer) 5986 err = &smithy.DeserializationError{ 5987 Err: fmt.Errorf("failed to decode response body, %w", err), 5988 Snapshot: snapshot.Bytes(), 5989 } 5990 return err 5991 } 5992 5993 errorBody.Seek(0, io.SeekStart) 5994 if len(code) != 0 { 5995 errorCode = restjson.SanitizeErrorCode(code) 5996 } 5997 if len(message) != 0 { 5998 errorMessage = message 5999 } 6000 6001 switch { 6002 case strings.EqualFold("NotFoundException", errorCode): 6003 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6004 6005 case strings.EqualFold("TooManyRequestsException", errorCode): 6006 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6007 6008 default: 6009 genericError := &smithy.GenericAPIError{ 6010 Code: errorCode, 6011 Message: errorMessage, 6012 } 6013 return genericError 6014 6015 } 6016} 6017 6018func awsRestjson1_deserializeOpDocumentGetDomainNameOutput(v **GetDomainNameOutput, value interface{}) error { 6019 if v == nil { 6020 return fmt.Errorf("unexpected nil of type %T", v) 6021 } 6022 if value == nil { 6023 return nil 6024 } 6025 6026 shape, ok := value.(map[string]interface{}) 6027 if !ok { 6028 return fmt.Errorf("unexpected JSON type %v", value) 6029 } 6030 6031 var sv *GetDomainNameOutput 6032 if *v == nil { 6033 sv = &GetDomainNameOutput{} 6034 } else { 6035 sv = *v 6036 } 6037 6038 for key, value := range shape { 6039 switch key { 6040 case "apiMappingSelectionExpression": 6041 if value != nil { 6042 jtv, ok := value.(string) 6043 if !ok { 6044 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 6045 } 6046 sv.ApiMappingSelectionExpression = ptr.String(jtv) 6047 } 6048 6049 case "domainName": 6050 if value != nil { 6051 jtv, ok := value.(string) 6052 if !ok { 6053 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 6054 } 6055 sv.DomainName = ptr.String(jtv) 6056 } 6057 6058 case "domainNameConfigurations": 6059 if err := awsRestjson1_deserializeDocumentDomainNameConfigurations(&sv.DomainNameConfigurations, value); err != nil { 6060 return err 6061 } 6062 6063 case "mutualTlsAuthentication": 6064 if err := awsRestjson1_deserializeDocumentMutualTlsAuthentication(&sv.MutualTlsAuthentication, value); err != nil { 6065 return err 6066 } 6067 6068 case "tags": 6069 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 6070 return err 6071 } 6072 6073 default: 6074 _, _ = key, value 6075 6076 } 6077 } 6078 *v = sv 6079 return nil 6080} 6081 6082type awsRestjson1_deserializeOpGetDomainNames struct { 6083} 6084 6085func (*awsRestjson1_deserializeOpGetDomainNames) ID() string { 6086 return "OperationDeserializer" 6087} 6088 6089func (m *awsRestjson1_deserializeOpGetDomainNames) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6090 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6091) { 6092 out, metadata, err = next.HandleDeserialize(ctx, in) 6093 if err != nil { 6094 return out, metadata, err 6095 } 6096 6097 response, ok := out.RawResponse.(*smithyhttp.Response) 6098 if !ok { 6099 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6100 } 6101 6102 if response.StatusCode < 200 || response.StatusCode >= 300 { 6103 return out, metadata, awsRestjson1_deserializeOpErrorGetDomainNames(response, &metadata) 6104 } 6105 output := &GetDomainNamesOutput{} 6106 out.Result = output 6107 6108 var buff [1024]byte 6109 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6110 6111 body := io.TeeReader(response.Body, ringBuffer) 6112 6113 decoder := json.NewDecoder(body) 6114 decoder.UseNumber() 6115 var shape interface{} 6116 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6117 var snapshot bytes.Buffer 6118 io.Copy(&snapshot, ringBuffer) 6119 err = &smithy.DeserializationError{ 6120 Err: fmt.Errorf("failed to decode response body, %w", err), 6121 Snapshot: snapshot.Bytes(), 6122 } 6123 return out, metadata, err 6124 } 6125 6126 err = awsRestjson1_deserializeOpDocumentGetDomainNamesOutput(&output, shape) 6127 if err != nil { 6128 var snapshot bytes.Buffer 6129 io.Copy(&snapshot, ringBuffer) 6130 return out, metadata, &smithy.DeserializationError{ 6131 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6132 Snapshot: snapshot.Bytes(), 6133 } 6134 } 6135 6136 return out, metadata, err 6137} 6138 6139func awsRestjson1_deserializeOpErrorGetDomainNames(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6140 var errorBuffer bytes.Buffer 6141 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6142 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6143 } 6144 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6145 6146 errorCode := "UnknownError" 6147 errorMessage := errorCode 6148 6149 code := response.Header.Get("X-Amzn-ErrorType") 6150 if len(code) != 0 { 6151 errorCode = restjson.SanitizeErrorCode(code) 6152 } 6153 6154 var buff [1024]byte 6155 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6156 6157 body := io.TeeReader(errorBody, ringBuffer) 6158 decoder := json.NewDecoder(body) 6159 decoder.UseNumber() 6160 code, message, err := restjson.GetErrorInfo(decoder) 6161 if err != nil { 6162 var snapshot bytes.Buffer 6163 io.Copy(&snapshot, ringBuffer) 6164 err = &smithy.DeserializationError{ 6165 Err: fmt.Errorf("failed to decode response body, %w", err), 6166 Snapshot: snapshot.Bytes(), 6167 } 6168 return err 6169 } 6170 6171 errorBody.Seek(0, io.SeekStart) 6172 if len(code) != 0 { 6173 errorCode = restjson.SanitizeErrorCode(code) 6174 } 6175 if len(message) != 0 { 6176 errorMessage = message 6177 } 6178 6179 switch { 6180 case strings.EqualFold("BadRequestException", errorCode): 6181 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 6182 6183 case strings.EqualFold("NotFoundException", errorCode): 6184 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6185 6186 case strings.EqualFold("TooManyRequestsException", errorCode): 6187 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6188 6189 default: 6190 genericError := &smithy.GenericAPIError{ 6191 Code: errorCode, 6192 Message: errorMessage, 6193 } 6194 return genericError 6195 6196 } 6197} 6198 6199func awsRestjson1_deserializeOpDocumentGetDomainNamesOutput(v **GetDomainNamesOutput, value interface{}) error { 6200 if v == nil { 6201 return fmt.Errorf("unexpected nil of type %T", v) 6202 } 6203 if value == nil { 6204 return nil 6205 } 6206 6207 shape, ok := value.(map[string]interface{}) 6208 if !ok { 6209 return fmt.Errorf("unexpected JSON type %v", value) 6210 } 6211 6212 var sv *GetDomainNamesOutput 6213 if *v == nil { 6214 sv = &GetDomainNamesOutput{} 6215 } else { 6216 sv = *v 6217 } 6218 6219 for key, value := range shape { 6220 switch key { 6221 case "items": 6222 if err := awsRestjson1_deserializeDocument__listOfDomainName(&sv.Items, value); err != nil { 6223 return err 6224 } 6225 6226 case "nextToken": 6227 if value != nil { 6228 jtv, ok := value.(string) 6229 if !ok { 6230 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6231 } 6232 sv.NextToken = ptr.String(jtv) 6233 } 6234 6235 default: 6236 _, _ = key, value 6237 6238 } 6239 } 6240 *v = sv 6241 return nil 6242} 6243 6244type awsRestjson1_deserializeOpGetIntegration struct { 6245} 6246 6247func (*awsRestjson1_deserializeOpGetIntegration) ID() string { 6248 return "OperationDeserializer" 6249} 6250 6251func (m *awsRestjson1_deserializeOpGetIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6252 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6253) { 6254 out, metadata, err = next.HandleDeserialize(ctx, in) 6255 if err != nil { 6256 return out, metadata, err 6257 } 6258 6259 response, ok := out.RawResponse.(*smithyhttp.Response) 6260 if !ok { 6261 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6262 } 6263 6264 if response.StatusCode < 200 || response.StatusCode >= 300 { 6265 return out, metadata, awsRestjson1_deserializeOpErrorGetIntegration(response, &metadata) 6266 } 6267 output := &GetIntegrationOutput{} 6268 out.Result = output 6269 6270 var buff [1024]byte 6271 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6272 6273 body := io.TeeReader(response.Body, ringBuffer) 6274 6275 decoder := json.NewDecoder(body) 6276 decoder.UseNumber() 6277 var shape interface{} 6278 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6279 var snapshot bytes.Buffer 6280 io.Copy(&snapshot, ringBuffer) 6281 err = &smithy.DeserializationError{ 6282 Err: fmt.Errorf("failed to decode response body, %w", err), 6283 Snapshot: snapshot.Bytes(), 6284 } 6285 return out, metadata, err 6286 } 6287 6288 err = awsRestjson1_deserializeOpDocumentGetIntegrationOutput(&output, shape) 6289 if err != nil { 6290 var snapshot bytes.Buffer 6291 io.Copy(&snapshot, ringBuffer) 6292 return out, metadata, &smithy.DeserializationError{ 6293 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6294 Snapshot: snapshot.Bytes(), 6295 } 6296 } 6297 6298 return out, metadata, err 6299} 6300 6301func awsRestjson1_deserializeOpErrorGetIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6302 var errorBuffer bytes.Buffer 6303 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6304 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6305 } 6306 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6307 6308 errorCode := "UnknownError" 6309 errorMessage := errorCode 6310 6311 code := response.Header.Get("X-Amzn-ErrorType") 6312 if len(code) != 0 { 6313 errorCode = restjson.SanitizeErrorCode(code) 6314 } 6315 6316 var buff [1024]byte 6317 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6318 6319 body := io.TeeReader(errorBody, ringBuffer) 6320 decoder := json.NewDecoder(body) 6321 decoder.UseNumber() 6322 code, message, err := restjson.GetErrorInfo(decoder) 6323 if err != nil { 6324 var snapshot bytes.Buffer 6325 io.Copy(&snapshot, ringBuffer) 6326 err = &smithy.DeserializationError{ 6327 Err: fmt.Errorf("failed to decode response body, %w", err), 6328 Snapshot: snapshot.Bytes(), 6329 } 6330 return err 6331 } 6332 6333 errorBody.Seek(0, io.SeekStart) 6334 if len(code) != 0 { 6335 errorCode = restjson.SanitizeErrorCode(code) 6336 } 6337 if len(message) != 0 { 6338 errorMessage = message 6339 } 6340 6341 switch { 6342 case strings.EqualFold("NotFoundException", errorCode): 6343 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6344 6345 case strings.EqualFold("TooManyRequestsException", errorCode): 6346 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6347 6348 default: 6349 genericError := &smithy.GenericAPIError{ 6350 Code: errorCode, 6351 Message: errorMessage, 6352 } 6353 return genericError 6354 6355 } 6356} 6357 6358func awsRestjson1_deserializeOpDocumentGetIntegrationOutput(v **GetIntegrationOutput, value interface{}) error { 6359 if v == nil { 6360 return fmt.Errorf("unexpected nil of type %T", v) 6361 } 6362 if value == nil { 6363 return nil 6364 } 6365 6366 shape, ok := value.(map[string]interface{}) 6367 if !ok { 6368 return fmt.Errorf("unexpected JSON type %v", value) 6369 } 6370 6371 var sv *GetIntegrationOutput 6372 if *v == nil { 6373 sv = &GetIntegrationOutput{} 6374 } else { 6375 sv = *v 6376 } 6377 6378 for key, value := range shape { 6379 switch key { 6380 case "apiGatewayManaged": 6381 if value != nil { 6382 jtv, ok := value.(bool) 6383 if !ok { 6384 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 6385 } 6386 sv.ApiGatewayManaged = jtv 6387 } 6388 6389 case "connectionId": 6390 if value != nil { 6391 jtv, ok := value.(string) 6392 if !ok { 6393 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 6394 } 6395 sv.ConnectionId = ptr.String(jtv) 6396 } 6397 6398 case "connectionType": 6399 if value != nil { 6400 jtv, ok := value.(string) 6401 if !ok { 6402 return fmt.Errorf("expected ConnectionType to be of type string, got %T instead", value) 6403 } 6404 sv.ConnectionType = types.ConnectionType(jtv) 6405 } 6406 6407 case "contentHandlingStrategy": 6408 if value != nil { 6409 jtv, ok := value.(string) 6410 if !ok { 6411 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 6412 } 6413 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 6414 } 6415 6416 case "credentialsArn": 6417 if value != nil { 6418 jtv, ok := value.(string) 6419 if !ok { 6420 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 6421 } 6422 sv.CredentialsArn = ptr.String(jtv) 6423 } 6424 6425 case "description": 6426 if value != nil { 6427 jtv, ok := value.(string) 6428 if !ok { 6429 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 6430 } 6431 sv.Description = ptr.String(jtv) 6432 } 6433 6434 case "integrationId": 6435 if value != nil { 6436 jtv, ok := value.(string) 6437 if !ok { 6438 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6439 } 6440 sv.IntegrationId = ptr.String(jtv) 6441 } 6442 6443 case "integrationMethod": 6444 if value != nil { 6445 jtv, ok := value.(string) 6446 if !ok { 6447 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 6448 } 6449 sv.IntegrationMethod = ptr.String(jtv) 6450 } 6451 6452 case "integrationResponseSelectionExpression": 6453 if value != nil { 6454 jtv, ok := value.(string) 6455 if !ok { 6456 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 6457 } 6458 sv.IntegrationResponseSelectionExpression = ptr.String(jtv) 6459 } 6460 6461 case "integrationSubtype": 6462 if value != nil { 6463 jtv, ok := value.(string) 6464 if !ok { 6465 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 6466 } 6467 sv.IntegrationSubtype = ptr.String(jtv) 6468 } 6469 6470 case "integrationType": 6471 if value != nil { 6472 jtv, ok := value.(string) 6473 if !ok { 6474 return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) 6475 } 6476 sv.IntegrationType = types.IntegrationType(jtv) 6477 } 6478 6479 case "integrationUri": 6480 if value != nil { 6481 jtv, ok := value.(string) 6482 if !ok { 6483 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 6484 } 6485 sv.IntegrationUri = ptr.String(jtv) 6486 } 6487 6488 case "passthroughBehavior": 6489 if value != nil { 6490 jtv, ok := value.(string) 6491 if !ok { 6492 return fmt.Errorf("expected PassthroughBehavior to be of type string, got %T instead", value) 6493 } 6494 sv.PassthroughBehavior = types.PassthroughBehavior(jtv) 6495 } 6496 6497 case "payloadFormatVersion": 6498 if value != nil { 6499 jtv, ok := value.(string) 6500 if !ok { 6501 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 6502 } 6503 sv.PayloadFormatVersion = ptr.String(jtv) 6504 } 6505 6506 case "requestParameters": 6507 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.RequestParameters, value); err != nil { 6508 return err 6509 } 6510 6511 case "requestTemplates": 6512 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.RequestTemplates, value); err != nil { 6513 return err 6514 } 6515 6516 case "responseParameters": 6517 if err := awsRestjson1_deserializeDocumentResponseParameters(&sv.ResponseParameters, value); err != nil { 6518 return err 6519 } 6520 6521 case "templateSelectionExpression": 6522 if value != nil { 6523 jtv, ok := value.(string) 6524 if !ok { 6525 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 6526 } 6527 sv.TemplateSelectionExpression = ptr.String(jtv) 6528 } 6529 6530 case "timeoutInMillis": 6531 if value != nil { 6532 jtv, ok := value.(json.Number) 6533 if !ok { 6534 return fmt.Errorf("expected IntegerWithLengthBetween50And30000 to be json.Number, got %T instead", value) 6535 } 6536 i64, err := jtv.Int64() 6537 if err != nil { 6538 return err 6539 } 6540 sv.TimeoutInMillis = int32(i64) 6541 } 6542 6543 case "tlsConfig": 6544 if err := awsRestjson1_deserializeDocumentTlsConfig(&sv.TlsConfig, value); err != nil { 6545 return err 6546 } 6547 6548 default: 6549 _, _ = key, value 6550 6551 } 6552 } 6553 *v = sv 6554 return nil 6555} 6556 6557type awsRestjson1_deserializeOpGetIntegrationResponse struct { 6558} 6559 6560func (*awsRestjson1_deserializeOpGetIntegrationResponse) ID() string { 6561 return "OperationDeserializer" 6562} 6563 6564func (m *awsRestjson1_deserializeOpGetIntegrationResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6565 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6566) { 6567 out, metadata, err = next.HandleDeserialize(ctx, in) 6568 if err != nil { 6569 return out, metadata, err 6570 } 6571 6572 response, ok := out.RawResponse.(*smithyhttp.Response) 6573 if !ok { 6574 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6575 } 6576 6577 if response.StatusCode < 200 || response.StatusCode >= 300 { 6578 return out, metadata, awsRestjson1_deserializeOpErrorGetIntegrationResponse(response, &metadata) 6579 } 6580 output := &GetIntegrationResponseOutput{} 6581 out.Result = output 6582 6583 var buff [1024]byte 6584 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6585 6586 body := io.TeeReader(response.Body, ringBuffer) 6587 6588 decoder := json.NewDecoder(body) 6589 decoder.UseNumber() 6590 var shape interface{} 6591 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6592 var snapshot bytes.Buffer 6593 io.Copy(&snapshot, ringBuffer) 6594 err = &smithy.DeserializationError{ 6595 Err: fmt.Errorf("failed to decode response body, %w", err), 6596 Snapshot: snapshot.Bytes(), 6597 } 6598 return out, metadata, err 6599 } 6600 6601 err = awsRestjson1_deserializeOpDocumentGetIntegrationResponseOutput(&output, shape) 6602 if err != nil { 6603 var snapshot bytes.Buffer 6604 io.Copy(&snapshot, ringBuffer) 6605 return out, metadata, &smithy.DeserializationError{ 6606 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6607 Snapshot: snapshot.Bytes(), 6608 } 6609 } 6610 6611 return out, metadata, err 6612} 6613 6614func awsRestjson1_deserializeOpErrorGetIntegrationResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6615 var errorBuffer bytes.Buffer 6616 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6617 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6618 } 6619 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6620 6621 errorCode := "UnknownError" 6622 errorMessage := errorCode 6623 6624 code := response.Header.Get("X-Amzn-ErrorType") 6625 if len(code) != 0 { 6626 errorCode = restjson.SanitizeErrorCode(code) 6627 } 6628 6629 var buff [1024]byte 6630 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6631 6632 body := io.TeeReader(errorBody, ringBuffer) 6633 decoder := json.NewDecoder(body) 6634 decoder.UseNumber() 6635 code, message, err := restjson.GetErrorInfo(decoder) 6636 if err != nil { 6637 var snapshot bytes.Buffer 6638 io.Copy(&snapshot, ringBuffer) 6639 err = &smithy.DeserializationError{ 6640 Err: fmt.Errorf("failed to decode response body, %w", err), 6641 Snapshot: snapshot.Bytes(), 6642 } 6643 return err 6644 } 6645 6646 errorBody.Seek(0, io.SeekStart) 6647 if len(code) != 0 { 6648 errorCode = restjson.SanitizeErrorCode(code) 6649 } 6650 if len(message) != 0 { 6651 errorMessage = message 6652 } 6653 6654 switch { 6655 case strings.EqualFold("NotFoundException", errorCode): 6656 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6657 6658 case strings.EqualFold("TooManyRequestsException", errorCode): 6659 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6660 6661 default: 6662 genericError := &smithy.GenericAPIError{ 6663 Code: errorCode, 6664 Message: errorMessage, 6665 } 6666 return genericError 6667 6668 } 6669} 6670 6671func awsRestjson1_deserializeOpDocumentGetIntegrationResponseOutput(v **GetIntegrationResponseOutput, value interface{}) error { 6672 if v == nil { 6673 return fmt.Errorf("unexpected nil of type %T", v) 6674 } 6675 if value == nil { 6676 return nil 6677 } 6678 6679 shape, ok := value.(map[string]interface{}) 6680 if !ok { 6681 return fmt.Errorf("unexpected JSON type %v", value) 6682 } 6683 6684 var sv *GetIntegrationResponseOutput 6685 if *v == nil { 6686 sv = &GetIntegrationResponseOutput{} 6687 } else { 6688 sv = *v 6689 } 6690 6691 for key, value := range shape { 6692 switch key { 6693 case "contentHandlingStrategy": 6694 if value != nil { 6695 jtv, ok := value.(string) 6696 if !ok { 6697 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 6698 } 6699 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 6700 } 6701 6702 case "integrationResponseId": 6703 if value != nil { 6704 jtv, ok := value.(string) 6705 if !ok { 6706 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6707 } 6708 sv.IntegrationResponseId = ptr.String(jtv) 6709 } 6710 6711 case "integrationResponseKey": 6712 if value != nil { 6713 jtv, ok := value.(string) 6714 if !ok { 6715 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 6716 } 6717 sv.IntegrationResponseKey = ptr.String(jtv) 6718 } 6719 6720 case "responseParameters": 6721 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.ResponseParameters, value); err != nil { 6722 return err 6723 } 6724 6725 case "responseTemplates": 6726 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.ResponseTemplates, value); err != nil { 6727 return err 6728 } 6729 6730 case "templateSelectionExpression": 6731 if value != nil { 6732 jtv, ok := value.(string) 6733 if !ok { 6734 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 6735 } 6736 sv.TemplateSelectionExpression = ptr.String(jtv) 6737 } 6738 6739 default: 6740 _, _ = key, value 6741 6742 } 6743 } 6744 *v = sv 6745 return nil 6746} 6747 6748type awsRestjson1_deserializeOpGetIntegrationResponses struct { 6749} 6750 6751func (*awsRestjson1_deserializeOpGetIntegrationResponses) ID() string { 6752 return "OperationDeserializer" 6753} 6754 6755func (m *awsRestjson1_deserializeOpGetIntegrationResponses) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6756 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6757) { 6758 out, metadata, err = next.HandleDeserialize(ctx, in) 6759 if err != nil { 6760 return out, metadata, err 6761 } 6762 6763 response, ok := out.RawResponse.(*smithyhttp.Response) 6764 if !ok { 6765 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6766 } 6767 6768 if response.StatusCode < 200 || response.StatusCode >= 300 { 6769 return out, metadata, awsRestjson1_deserializeOpErrorGetIntegrationResponses(response, &metadata) 6770 } 6771 output := &GetIntegrationResponsesOutput{} 6772 out.Result = output 6773 6774 var buff [1024]byte 6775 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6776 6777 body := io.TeeReader(response.Body, ringBuffer) 6778 6779 decoder := json.NewDecoder(body) 6780 decoder.UseNumber() 6781 var shape interface{} 6782 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6783 var snapshot bytes.Buffer 6784 io.Copy(&snapshot, ringBuffer) 6785 err = &smithy.DeserializationError{ 6786 Err: fmt.Errorf("failed to decode response body, %w", err), 6787 Snapshot: snapshot.Bytes(), 6788 } 6789 return out, metadata, err 6790 } 6791 6792 err = awsRestjson1_deserializeOpDocumentGetIntegrationResponsesOutput(&output, shape) 6793 if err != nil { 6794 var snapshot bytes.Buffer 6795 io.Copy(&snapshot, ringBuffer) 6796 return out, metadata, &smithy.DeserializationError{ 6797 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6798 Snapshot: snapshot.Bytes(), 6799 } 6800 } 6801 6802 return out, metadata, err 6803} 6804 6805func awsRestjson1_deserializeOpErrorGetIntegrationResponses(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6806 var errorBuffer bytes.Buffer 6807 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6808 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6809 } 6810 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6811 6812 errorCode := "UnknownError" 6813 errorMessage := errorCode 6814 6815 code := response.Header.Get("X-Amzn-ErrorType") 6816 if len(code) != 0 { 6817 errorCode = restjson.SanitizeErrorCode(code) 6818 } 6819 6820 var buff [1024]byte 6821 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6822 6823 body := io.TeeReader(errorBody, ringBuffer) 6824 decoder := json.NewDecoder(body) 6825 decoder.UseNumber() 6826 code, message, err := restjson.GetErrorInfo(decoder) 6827 if err != nil { 6828 var snapshot bytes.Buffer 6829 io.Copy(&snapshot, ringBuffer) 6830 err = &smithy.DeserializationError{ 6831 Err: fmt.Errorf("failed to decode response body, %w", err), 6832 Snapshot: snapshot.Bytes(), 6833 } 6834 return err 6835 } 6836 6837 errorBody.Seek(0, io.SeekStart) 6838 if len(code) != 0 { 6839 errorCode = restjson.SanitizeErrorCode(code) 6840 } 6841 if len(message) != 0 { 6842 errorMessage = message 6843 } 6844 6845 switch { 6846 case strings.EqualFold("BadRequestException", errorCode): 6847 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 6848 6849 case strings.EqualFold("NotFoundException", errorCode): 6850 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6851 6852 case strings.EqualFold("TooManyRequestsException", errorCode): 6853 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6854 6855 default: 6856 genericError := &smithy.GenericAPIError{ 6857 Code: errorCode, 6858 Message: errorMessage, 6859 } 6860 return genericError 6861 6862 } 6863} 6864 6865func awsRestjson1_deserializeOpDocumentGetIntegrationResponsesOutput(v **GetIntegrationResponsesOutput, value interface{}) error { 6866 if v == nil { 6867 return fmt.Errorf("unexpected nil of type %T", v) 6868 } 6869 if value == nil { 6870 return nil 6871 } 6872 6873 shape, ok := value.(map[string]interface{}) 6874 if !ok { 6875 return fmt.Errorf("unexpected JSON type %v", value) 6876 } 6877 6878 var sv *GetIntegrationResponsesOutput 6879 if *v == nil { 6880 sv = &GetIntegrationResponsesOutput{} 6881 } else { 6882 sv = *v 6883 } 6884 6885 for key, value := range shape { 6886 switch key { 6887 case "items": 6888 if err := awsRestjson1_deserializeDocument__listOfIntegrationResponse(&sv.Items, value); err != nil { 6889 return err 6890 } 6891 6892 case "nextToken": 6893 if value != nil { 6894 jtv, ok := value.(string) 6895 if !ok { 6896 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6897 } 6898 sv.NextToken = ptr.String(jtv) 6899 } 6900 6901 default: 6902 _, _ = key, value 6903 6904 } 6905 } 6906 *v = sv 6907 return nil 6908} 6909 6910type awsRestjson1_deserializeOpGetIntegrations struct { 6911} 6912 6913func (*awsRestjson1_deserializeOpGetIntegrations) ID() string { 6914 return "OperationDeserializer" 6915} 6916 6917func (m *awsRestjson1_deserializeOpGetIntegrations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6918 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6919) { 6920 out, metadata, err = next.HandleDeserialize(ctx, in) 6921 if err != nil { 6922 return out, metadata, err 6923 } 6924 6925 response, ok := out.RawResponse.(*smithyhttp.Response) 6926 if !ok { 6927 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6928 } 6929 6930 if response.StatusCode < 200 || response.StatusCode >= 300 { 6931 return out, metadata, awsRestjson1_deserializeOpErrorGetIntegrations(response, &metadata) 6932 } 6933 output := &GetIntegrationsOutput{} 6934 out.Result = output 6935 6936 var buff [1024]byte 6937 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6938 6939 body := io.TeeReader(response.Body, ringBuffer) 6940 6941 decoder := json.NewDecoder(body) 6942 decoder.UseNumber() 6943 var shape interface{} 6944 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6945 var snapshot bytes.Buffer 6946 io.Copy(&snapshot, ringBuffer) 6947 err = &smithy.DeserializationError{ 6948 Err: fmt.Errorf("failed to decode response body, %w", err), 6949 Snapshot: snapshot.Bytes(), 6950 } 6951 return out, metadata, err 6952 } 6953 6954 err = awsRestjson1_deserializeOpDocumentGetIntegrationsOutput(&output, shape) 6955 if err != nil { 6956 var snapshot bytes.Buffer 6957 io.Copy(&snapshot, ringBuffer) 6958 return out, metadata, &smithy.DeserializationError{ 6959 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6960 Snapshot: snapshot.Bytes(), 6961 } 6962 } 6963 6964 return out, metadata, err 6965} 6966 6967func awsRestjson1_deserializeOpErrorGetIntegrations(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6968 var errorBuffer bytes.Buffer 6969 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6970 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6971 } 6972 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6973 6974 errorCode := "UnknownError" 6975 errorMessage := errorCode 6976 6977 code := response.Header.Get("X-Amzn-ErrorType") 6978 if len(code) != 0 { 6979 errorCode = restjson.SanitizeErrorCode(code) 6980 } 6981 6982 var buff [1024]byte 6983 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6984 6985 body := io.TeeReader(errorBody, ringBuffer) 6986 decoder := json.NewDecoder(body) 6987 decoder.UseNumber() 6988 code, message, err := restjson.GetErrorInfo(decoder) 6989 if err != nil { 6990 var snapshot bytes.Buffer 6991 io.Copy(&snapshot, ringBuffer) 6992 err = &smithy.DeserializationError{ 6993 Err: fmt.Errorf("failed to decode response body, %w", err), 6994 Snapshot: snapshot.Bytes(), 6995 } 6996 return err 6997 } 6998 6999 errorBody.Seek(0, io.SeekStart) 7000 if len(code) != 0 { 7001 errorCode = restjson.SanitizeErrorCode(code) 7002 } 7003 if len(message) != 0 { 7004 errorMessage = message 7005 } 7006 7007 switch { 7008 case strings.EqualFold("BadRequestException", errorCode): 7009 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 7010 7011 case strings.EqualFold("NotFoundException", errorCode): 7012 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7013 7014 case strings.EqualFold("TooManyRequestsException", errorCode): 7015 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7016 7017 default: 7018 genericError := &smithy.GenericAPIError{ 7019 Code: errorCode, 7020 Message: errorMessage, 7021 } 7022 return genericError 7023 7024 } 7025} 7026 7027func awsRestjson1_deserializeOpDocumentGetIntegrationsOutput(v **GetIntegrationsOutput, value interface{}) error { 7028 if v == nil { 7029 return fmt.Errorf("unexpected nil of type %T", v) 7030 } 7031 if value == nil { 7032 return nil 7033 } 7034 7035 shape, ok := value.(map[string]interface{}) 7036 if !ok { 7037 return fmt.Errorf("unexpected JSON type %v", value) 7038 } 7039 7040 var sv *GetIntegrationsOutput 7041 if *v == nil { 7042 sv = &GetIntegrationsOutput{} 7043 } else { 7044 sv = *v 7045 } 7046 7047 for key, value := range shape { 7048 switch key { 7049 case "items": 7050 if err := awsRestjson1_deserializeDocument__listOfIntegration(&sv.Items, value); err != nil { 7051 return err 7052 } 7053 7054 case "nextToken": 7055 if value != nil { 7056 jtv, ok := value.(string) 7057 if !ok { 7058 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7059 } 7060 sv.NextToken = ptr.String(jtv) 7061 } 7062 7063 default: 7064 _, _ = key, value 7065 7066 } 7067 } 7068 *v = sv 7069 return nil 7070} 7071 7072type awsRestjson1_deserializeOpGetModel struct { 7073} 7074 7075func (*awsRestjson1_deserializeOpGetModel) ID() string { 7076 return "OperationDeserializer" 7077} 7078 7079func (m *awsRestjson1_deserializeOpGetModel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7080 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7081) { 7082 out, metadata, err = next.HandleDeserialize(ctx, in) 7083 if err != nil { 7084 return out, metadata, err 7085 } 7086 7087 response, ok := out.RawResponse.(*smithyhttp.Response) 7088 if !ok { 7089 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7090 } 7091 7092 if response.StatusCode < 200 || response.StatusCode >= 300 { 7093 return out, metadata, awsRestjson1_deserializeOpErrorGetModel(response, &metadata) 7094 } 7095 output := &GetModelOutput{} 7096 out.Result = output 7097 7098 var buff [1024]byte 7099 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7100 7101 body := io.TeeReader(response.Body, ringBuffer) 7102 7103 decoder := json.NewDecoder(body) 7104 decoder.UseNumber() 7105 var shape interface{} 7106 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7107 var snapshot bytes.Buffer 7108 io.Copy(&snapshot, ringBuffer) 7109 err = &smithy.DeserializationError{ 7110 Err: fmt.Errorf("failed to decode response body, %w", err), 7111 Snapshot: snapshot.Bytes(), 7112 } 7113 return out, metadata, err 7114 } 7115 7116 err = awsRestjson1_deserializeOpDocumentGetModelOutput(&output, shape) 7117 if err != nil { 7118 var snapshot bytes.Buffer 7119 io.Copy(&snapshot, ringBuffer) 7120 return out, metadata, &smithy.DeserializationError{ 7121 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7122 Snapshot: snapshot.Bytes(), 7123 } 7124 } 7125 7126 return out, metadata, err 7127} 7128 7129func awsRestjson1_deserializeOpErrorGetModel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7130 var errorBuffer bytes.Buffer 7131 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7132 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7133 } 7134 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7135 7136 errorCode := "UnknownError" 7137 errorMessage := errorCode 7138 7139 code := response.Header.Get("X-Amzn-ErrorType") 7140 if len(code) != 0 { 7141 errorCode = restjson.SanitizeErrorCode(code) 7142 } 7143 7144 var buff [1024]byte 7145 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7146 7147 body := io.TeeReader(errorBody, ringBuffer) 7148 decoder := json.NewDecoder(body) 7149 decoder.UseNumber() 7150 code, message, err := restjson.GetErrorInfo(decoder) 7151 if err != nil { 7152 var snapshot bytes.Buffer 7153 io.Copy(&snapshot, ringBuffer) 7154 err = &smithy.DeserializationError{ 7155 Err: fmt.Errorf("failed to decode response body, %w", err), 7156 Snapshot: snapshot.Bytes(), 7157 } 7158 return err 7159 } 7160 7161 errorBody.Seek(0, io.SeekStart) 7162 if len(code) != 0 { 7163 errorCode = restjson.SanitizeErrorCode(code) 7164 } 7165 if len(message) != 0 { 7166 errorMessage = message 7167 } 7168 7169 switch { 7170 case strings.EqualFold("NotFoundException", errorCode): 7171 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7172 7173 case strings.EqualFold("TooManyRequestsException", errorCode): 7174 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7175 7176 default: 7177 genericError := &smithy.GenericAPIError{ 7178 Code: errorCode, 7179 Message: errorMessage, 7180 } 7181 return genericError 7182 7183 } 7184} 7185 7186func awsRestjson1_deserializeOpDocumentGetModelOutput(v **GetModelOutput, value interface{}) error { 7187 if v == nil { 7188 return fmt.Errorf("unexpected nil of type %T", v) 7189 } 7190 if value == nil { 7191 return nil 7192 } 7193 7194 shape, ok := value.(map[string]interface{}) 7195 if !ok { 7196 return fmt.Errorf("unexpected JSON type %v", value) 7197 } 7198 7199 var sv *GetModelOutput 7200 if *v == nil { 7201 sv = &GetModelOutput{} 7202 } else { 7203 sv = *v 7204 } 7205 7206 for key, value := range shape { 7207 switch key { 7208 case "contentType": 7209 if value != nil { 7210 jtv, ok := value.(string) 7211 if !ok { 7212 return fmt.Errorf("expected StringWithLengthBetween1And256 to be of type string, got %T instead", value) 7213 } 7214 sv.ContentType = ptr.String(jtv) 7215 } 7216 7217 case "description": 7218 if value != nil { 7219 jtv, ok := value.(string) 7220 if !ok { 7221 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 7222 } 7223 sv.Description = ptr.String(jtv) 7224 } 7225 7226 case "modelId": 7227 if value != nil { 7228 jtv, ok := value.(string) 7229 if !ok { 7230 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7231 } 7232 sv.ModelId = ptr.String(jtv) 7233 } 7234 7235 case "name": 7236 if value != nil { 7237 jtv, ok := value.(string) 7238 if !ok { 7239 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 7240 } 7241 sv.Name = ptr.String(jtv) 7242 } 7243 7244 case "schema": 7245 if value != nil { 7246 jtv, ok := value.(string) 7247 if !ok { 7248 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 7249 } 7250 sv.Schema = ptr.String(jtv) 7251 } 7252 7253 default: 7254 _, _ = key, value 7255 7256 } 7257 } 7258 *v = sv 7259 return nil 7260} 7261 7262type awsRestjson1_deserializeOpGetModels struct { 7263} 7264 7265func (*awsRestjson1_deserializeOpGetModels) ID() string { 7266 return "OperationDeserializer" 7267} 7268 7269func (m *awsRestjson1_deserializeOpGetModels) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7270 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7271) { 7272 out, metadata, err = next.HandleDeserialize(ctx, in) 7273 if err != nil { 7274 return out, metadata, err 7275 } 7276 7277 response, ok := out.RawResponse.(*smithyhttp.Response) 7278 if !ok { 7279 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7280 } 7281 7282 if response.StatusCode < 200 || response.StatusCode >= 300 { 7283 return out, metadata, awsRestjson1_deserializeOpErrorGetModels(response, &metadata) 7284 } 7285 output := &GetModelsOutput{} 7286 out.Result = output 7287 7288 var buff [1024]byte 7289 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7290 7291 body := io.TeeReader(response.Body, ringBuffer) 7292 7293 decoder := json.NewDecoder(body) 7294 decoder.UseNumber() 7295 var shape interface{} 7296 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7297 var snapshot bytes.Buffer 7298 io.Copy(&snapshot, ringBuffer) 7299 err = &smithy.DeserializationError{ 7300 Err: fmt.Errorf("failed to decode response body, %w", err), 7301 Snapshot: snapshot.Bytes(), 7302 } 7303 return out, metadata, err 7304 } 7305 7306 err = awsRestjson1_deserializeOpDocumentGetModelsOutput(&output, shape) 7307 if err != nil { 7308 var snapshot bytes.Buffer 7309 io.Copy(&snapshot, ringBuffer) 7310 return out, metadata, &smithy.DeserializationError{ 7311 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7312 Snapshot: snapshot.Bytes(), 7313 } 7314 } 7315 7316 return out, metadata, err 7317} 7318 7319func awsRestjson1_deserializeOpErrorGetModels(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7320 var errorBuffer bytes.Buffer 7321 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7322 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7323 } 7324 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7325 7326 errorCode := "UnknownError" 7327 errorMessage := errorCode 7328 7329 code := response.Header.Get("X-Amzn-ErrorType") 7330 if len(code) != 0 { 7331 errorCode = restjson.SanitizeErrorCode(code) 7332 } 7333 7334 var buff [1024]byte 7335 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7336 7337 body := io.TeeReader(errorBody, ringBuffer) 7338 decoder := json.NewDecoder(body) 7339 decoder.UseNumber() 7340 code, message, err := restjson.GetErrorInfo(decoder) 7341 if err != nil { 7342 var snapshot bytes.Buffer 7343 io.Copy(&snapshot, ringBuffer) 7344 err = &smithy.DeserializationError{ 7345 Err: fmt.Errorf("failed to decode response body, %w", err), 7346 Snapshot: snapshot.Bytes(), 7347 } 7348 return err 7349 } 7350 7351 errorBody.Seek(0, io.SeekStart) 7352 if len(code) != 0 { 7353 errorCode = restjson.SanitizeErrorCode(code) 7354 } 7355 if len(message) != 0 { 7356 errorMessage = message 7357 } 7358 7359 switch { 7360 case strings.EqualFold("BadRequestException", errorCode): 7361 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 7362 7363 case strings.EqualFold("NotFoundException", errorCode): 7364 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7365 7366 case strings.EqualFold("TooManyRequestsException", errorCode): 7367 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7368 7369 default: 7370 genericError := &smithy.GenericAPIError{ 7371 Code: errorCode, 7372 Message: errorMessage, 7373 } 7374 return genericError 7375 7376 } 7377} 7378 7379func awsRestjson1_deserializeOpDocumentGetModelsOutput(v **GetModelsOutput, value interface{}) error { 7380 if v == nil { 7381 return fmt.Errorf("unexpected nil of type %T", v) 7382 } 7383 if value == nil { 7384 return nil 7385 } 7386 7387 shape, ok := value.(map[string]interface{}) 7388 if !ok { 7389 return fmt.Errorf("unexpected JSON type %v", value) 7390 } 7391 7392 var sv *GetModelsOutput 7393 if *v == nil { 7394 sv = &GetModelsOutput{} 7395 } else { 7396 sv = *v 7397 } 7398 7399 for key, value := range shape { 7400 switch key { 7401 case "items": 7402 if err := awsRestjson1_deserializeDocument__listOfModel(&sv.Items, value); err != nil { 7403 return err 7404 } 7405 7406 case "nextToken": 7407 if value != nil { 7408 jtv, ok := value.(string) 7409 if !ok { 7410 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7411 } 7412 sv.NextToken = ptr.String(jtv) 7413 } 7414 7415 default: 7416 _, _ = key, value 7417 7418 } 7419 } 7420 *v = sv 7421 return nil 7422} 7423 7424type awsRestjson1_deserializeOpGetModelTemplate struct { 7425} 7426 7427func (*awsRestjson1_deserializeOpGetModelTemplate) ID() string { 7428 return "OperationDeserializer" 7429} 7430 7431func (m *awsRestjson1_deserializeOpGetModelTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7432 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7433) { 7434 out, metadata, err = next.HandleDeserialize(ctx, in) 7435 if err != nil { 7436 return out, metadata, err 7437 } 7438 7439 response, ok := out.RawResponse.(*smithyhttp.Response) 7440 if !ok { 7441 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7442 } 7443 7444 if response.StatusCode < 200 || response.StatusCode >= 300 { 7445 return out, metadata, awsRestjson1_deserializeOpErrorGetModelTemplate(response, &metadata) 7446 } 7447 output := &GetModelTemplateOutput{} 7448 out.Result = output 7449 7450 var buff [1024]byte 7451 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7452 7453 body := io.TeeReader(response.Body, ringBuffer) 7454 7455 decoder := json.NewDecoder(body) 7456 decoder.UseNumber() 7457 var shape interface{} 7458 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7459 var snapshot bytes.Buffer 7460 io.Copy(&snapshot, ringBuffer) 7461 err = &smithy.DeserializationError{ 7462 Err: fmt.Errorf("failed to decode response body, %w", err), 7463 Snapshot: snapshot.Bytes(), 7464 } 7465 return out, metadata, err 7466 } 7467 7468 err = awsRestjson1_deserializeOpDocumentGetModelTemplateOutput(&output, shape) 7469 if err != nil { 7470 var snapshot bytes.Buffer 7471 io.Copy(&snapshot, ringBuffer) 7472 return out, metadata, &smithy.DeserializationError{ 7473 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7474 Snapshot: snapshot.Bytes(), 7475 } 7476 } 7477 7478 return out, metadata, err 7479} 7480 7481func awsRestjson1_deserializeOpErrorGetModelTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7482 var errorBuffer bytes.Buffer 7483 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7484 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7485 } 7486 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7487 7488 errorCode := "UnknownError" 7489 errorMessage := errorCode 7490 7491 code := response.Header.Get("X-Amzn-ErrorType") 7492 if len(code) != 0 { 7493 errorCode = restjson.SanitizeErrorCode(code) 7494 } 7495 7496 var buff [1024]byte 7497 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7498 7499 body := io.TeeReader(errorBody, ringBuffer) 7500 decoder := json.NewDecoder(body) 7501 decoder.UseNumber() 7502 code, message, err := restjson.GetErrorInfo(decoder) 7503 if err != nil { 7504 var snapshot bytes.Buffer 7505 io.Copy(&snapshot, ringBuffer) 7506 err = &smithy.DeserializationError{ 7507 Err: fmt.Errorf("failed to decode response body, %w", err), 7508 Snapshot: snapshot.Bytes(), 7509 } 7510 return err 7511 } 7512 7513 errorBody.Seek(0, io.SeekStart) 7514 if len(code) != 0 { 7515 errorCode = restjson.SanitizeErrorCode(code) 7516 } 7517 if len(message) != 0 { 7518 errorMessage = message 7519 } 7520 7521 switch { 7522 case strings.EqualFold("NotFoundException", errorCode): 7523 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7524 7525 case strings.EqualFold("TooManyRequestsException", errorCode): 7526 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7527 7528 default: 7529 genericError := &smithy.GenericAPIError{ 7530 Code: errorCode, 7531 Message: errorMessage, 7532 } 7533 return genericError 7534 7535 } 7536} 7537 7538func awsRestjson1_deserializeOpDocumentGetModelTemplateOutput(v **GetModelTemplateOutput, value interface{}) error { 7539 if v == nil { 7540 return fmt.Errorf("unexpected nil of type %T", v) 7541 } 7542 if value == nil { 7543 return nil 7544 } 7545 7546 shape, ok := value.(map[string]interface{}) 7547 if !ok { 7548 return fmt.Errorf("unexpected JSON type %v", value) 7549 } 7550 7551 var sv *GetModelTemplateOutput 7552 if *v == nil { 7553 sv = &GetModelTemplateOutput{} 7554 } else { 7555 sv = *v 7556 } 7557 7558 for key, value := range shape { 7559 switch key { 7560 case "value": 7561 if value != nil { 7562 jtv, ok := value.(string) 7563 if !ok { 7564 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 7565 } 7566 sv.Value = ptr.String(jtv) 7567 } 7568 7569 default: 7570 _, _ = key, value 7571 7572 } 7573 } 7574 *v = sv 7575 return nil 7576} 7577 7578type awsRestjson1_deserializeOpGetRoute struct { 7579} 7580 7581func (*awsRestjson1_deserializeOpGetRoute) ID() string { 7582 return "OperationDeserializer" 7583} 7584 7585func (m *awsRestjson1_deserializeOpGetRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7586 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7587) { 7588 out, metadata, err = next.HandleDeserialize(ctx, in) 7589 if err != nil { 7590 return out, metadata, err 7591 } 7592 7593 response, ok := out.RawResponse.(*smithyhttp.Response) 7594 if !ok { 7595 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7596 } 7597 7598 if response.StatusCode < 200 || response.StatusCode >= 300 { 7599 return out, metadata, awsRestjson1_deserializeOpErrorGetRoute(response, &metadata) 7600 } 7601 output := &GetRouteOutput{} 7602 out.Result = output 7603 7604 var buff [1024]byte 7605 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7606 7607 body := io.TeeReader(response.Body, ringBuffer) 7608 7609 decoder := json.NewDecoder(body) 7610 decoder.UseNumber() 7611 var shape interface{} 7612 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7613 var snapshot bytes.Buffer 7614 io.Copy(&snapshot, ringBuffer) 7615 err = &smithy.DeserializationError{ 7616 Err: fmt.Errorf("failed to decode response body, %w", err), 7617 Snapshot: snapshot.Bytes(), 7618 } 7619 return out, metadata, err 7620 } 7621 7622 err = awsRestjson1_deserializeOpDocumentGetRouteOutput(&output, shape) 7623 if err != nil { 7624 var snapshot bytes.Buffer 7625 io.Copy(&snapshot, ringBuffer) 7626 return out, metadata, &smithy.DeserializationError{ 7627 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7628 Snapshot: snapshot.Bytes(), 7629 } 7630 } 7631 7632 return out, metadata, err 7633} 7634 7635func awsRestjson1_deserializeOpErrorGetRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7636 var errorBuffer bytes.Buffer 7637 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7638 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7639 } 7640 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7641 7642 errorCode := "UnknownError" 7643 errorMessage := errorCode 7644 7645 code := response.Header.Get("X-Amzn-ErrorType") 7646 if len(code) != 0 { 7647 errorCode = restjson.SanitizeErrorCode(code) 7648 } 7649 7650 var buff [1024]byte 7651 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7652 7653 body := io.TeeReader(errorBody, ringBuffer) 7654 decoder := json.NewDecoder(body) 7655 decoder.UseNumber() 7656 code, message, err := restjson.GetErrorInfo(decoder) 7657 if err != nil { 7658 var snapshot bytes.Buffer 7659 io.Copy(&snapshot, ringBuffer) 7660 err = &smithy.DeserializationError{ 7661 Err: fmt.Errorf("failed to decode response body, %w", err), 7662 Snapshot: snapshot.Bytes(), 7663 } 7664 return err 7665 } 7666 7667 errorBody.Seek(0, io.SeekStart) 7668 if len(code) != 0 { 7669 errorCode = restjson.SanitizeErrorCode(code) 7670 } 7671 if len(message) != 0 { 7672 errorMessage = message 7673 } 7674 7675 switch { 7676 case strings.EqualFold("NotFoundException", errorCode): 7677 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7678 7679 case strings.EqualFold("TooManyRequestsException", errorCode): 7680 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7681 7682 default: 7683 genericError := &smithy.GenericAPIError{ 7684 Code: errorCode, 7685 Message: errorMessage, 7686 } 7687 return genericError 7688 7689 } 7690} 7691 7692func awsRestjson1_deserializeOpDocumentGetRouteOutput(v **GetRouteOutput, value interface{}) error { 7693 if v == nil { 7694 return fmt.Errorf("unexpected nil of type %T", v) 7695 } 7696 if value == nil { 7697 return nil 7698 } 7699 7700 shape, ok := value.(map[string]interface{}) 7701 if !ok { 7702 return fmt.Errorf("unexpected JSON type %v", value) 7703 } 7704 7705 var sv *GetRouteOutput 7706 if *v == nil { 7707 sv = &GetRouteOutput{} 7708 } else { 7709 sv = *v 7710 } 7711 7712 for key, value := range shape { 7713 switch key { 7714 case "apiGatewayManaged": 7715 if value != nil { 7716 jtv, ok := value.(bool) 7717 if !ok { 7718 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 7719 } 7720 sv.ApiGatewayManaged = jtv 7721 } 7722 7723 case "apiKeyRequired": 7724 if value != nil { 7725 jtv, ok := value.(bool) 7726 if !ok { 7727 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 7728 } 7729 sv.ApiKeyRequired = jtv 7730 } 7731 7732 case "authorizationScopes": 7733 if err := awsRestjson1_deserializeDocumentAuthorizationScopes(&sv.AuthorizationScopes, value); err != nil { 7734 return err 7735 } 7736 7737 case "authorizationType": 7738 if value != nil { 7739 jtv, ok := value.(string) 7740 if !ok { 7741 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 7742 } 7743 sv.AuthorizationType = types.AuthorizationType(jtv) 7744 } 7745 7746 case "authorizerId": 7747 if value != nil { 7748 jtv, ok := value.(string) 7749 if !ok { 7750 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7751 } 7752 sv.AuthorizerId = ptr.String(jtv) 7753 } 7754 7755 case "modelSelectionExpression": 7756 if value != nil { 7757 jtv, ok := value.(string) 7758 if !ok { 7759 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 7760 } 7761 sv.ModelSelectionExpression = ptr.String(jtv) 7762 } 7763 7764 case "operationName": 7765 if value != nil { 7766 jtv, ok := value.(string) 7767 if !ok { 7768 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 7769 } 7770 sv.OperationName = ptr.String(jtv) 7771 } 7772 7773 case "requestModels": 7774 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.RequestModels, value); err != nil { 7775 return err 7776 } 7777 7778 case "requestParameters": 7779 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.RequestParameters, value); err != nil { 7780 return err 7781 } 7782 7783 case "routeId": 7784 if value != nil { 7785 jtv, ok := value.(string) 7786 if !ok { 7787 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7788 } 7789 sv.RouteId = ptr.String(jtv) 7790 } 7791 7792 case "routeKey": 7793 if value != nil { 7794 jtv, ok := value.(string) 7795 if !ok { 7796 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 7797 } 7798 sv.RouteKey = ptr.String(jtv) 7799 } 7800 7801 case "routeResponseSelectionExpression": 7802 if value != nil { 7803 jtv, ok := value.(string) 7804 if !ok { 7805 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 7806 } 7807 sv.RouteResponseSelectionExpression = ptr.String(jtv) 7808 } 7809 7810 case "target": 7811 if value != nil { 7812 jtv, ok := value.(string) 7813 if !ok { 7814 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 7815 } 7816 sv.Target = ptr.String(jtv) 7817 } 7818 7819 default: 7820 _, _ = key, value 7821 7822 } 7823 } 7824 *v = sv 7825 return nil 7826} 7827 7828type awsRestjson1_deserializeOpGetRouteResponse struct { 7829} 7830 7831func (*awsRestjson1_deserializeOpGetRouteResponse) ID() string { 7832 return "OperationDeserializer" 7833} 7834 7835func (m *awsRestjson1_deserializeOpGetRouteResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7836 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7837) { 7838 out, metadata, err = next.HandleDeserialize(ctx, in) 7839 if err != nil { 7840 return out, metadata, err 7841 } 7842 7843 response, ok := out.RawResponse.(*smithyhttp.Response) 7844 if !ok { 7845 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7846 } 7847 7848 if response.StatusCode < 200 || response.StatusCode >= 300 { 7849 return out, metadata, awsRestjson1_deserializeOpErrorGetRouteResponse(response, &metadata) 7850 } 7851 output := &GetRouteResponseOutput{} 7852 out.Result = output 7853 7854 var buff [1024]byte 7855 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7856 7857 body := io.TeeReader(response.Body, ringBuffer) 7858 7859 decoder := json.NewDecoder(body) 7860 decoder.UseNumber() 7861 var shape interface{} 7862 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7863 var snapshot bytes.Buffer 7864 io.Copy(&snapshot, ringBuffer) 7865 err = &smithy.DeserializationError{ 7866 Err: fmt.Errorf("failed to decode response body, %w", err), 7867 Snapshot: snapshot.Bytes(), 7868 } 7869 return out, metadata, err 7870 } 7871 7872 err = awsRestjson1_deserializeOpDocumentGetRouteResponseOutput(&output, shape) 7873 if err != nil { 7874 var snapshot bytes.Buffer 7875 io.Copy(&snapshot, ringBuffer) 7876 return out, metadata, &smithy.DeserializationError{ 7877 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7878 Snapshot: snapshot.Bytes(), 7879 } 7880 } 7881 7882 return out, metadata, err 7883} 7884 7885func awsRestjson1_deserializeOpErrorGetRouteResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7886 var errorBuffer bytes.Buffer 7887 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7888 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7889 } 7890 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7891 7892 errorCode := "UnknownError" 7893 errorMessage := errorCode 7894 7895 code := response.Header.Get("X-Amzn-ErrorType") 7896 if len(code) != 0 { 7897 errorCode = restjson.SanitizeErrorCode(code) 7898 } 7899 7900 var buff [1024]byte 7901 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7902 7903 body := io.TeeReader(errorBody, ringBuffer) 7904 decoder := json.NewDecoder(body) 7905 decoder.UseNumber() 7906 code, message, err := restjson.GetErrorInfo(decoder) 7907 if err != nil { 7908 var snapshot bytes.Buffer 7909 io.Copy(&snapshot, ringBuffer) 7910 err = &smithy.DeserializationError{ 7911 Err: fmt.Errorf("failed to decode response body, %w", err), 7912 Snapshot: snapshot.Bytes(), 7913 } 7914 return err 7915 } 7916 7917 errorBody.Seek(0, io.SeekStart) 7918 if len(code) != 0 { 7919 errorCode = restjson.SanitizeErrorCode(code) 7920 } 7921 if len(message) != 0 { 7922 errorMessage = message 7923 } 7924 7925 switch { 7926 case strings.EqualFold("NotFoundException", errorCode): 7927 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7928 7929 case strings.EqualFold("TooManyRequestsException", errorCode): 7930 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7931 7932 default: 7933 genericError := &smithy.GenericAPIError{ 7934 Code: errorCode, 7935 Message: errorMessage, 7936 } 7937 return genericError 7938 7939 } 7940} 7941 7942func awsRestjson1_deserializeOpDocumentGetRouteResponseOutput(v **GetRouteResponseOutput, value interface{}) error { 7943 if v == nil { 7944 return fmt.Errorf("unexpected nil of type %T", v) 7945 } 7946 if value == nil { 7947 return nil 7948 } 7949 7950 shape, ok := value.(map[string]interface{}) 7951 if !ok { 7952 return fmt.Errorf("unexpected JSON type %v", value) 7953 } 7954 7955 var sv *GetRouteResponseOutput 7956 if *v == nil { 7957 sv = &GetRouteResponseOutput{} 7958 } else { 7959 sv = *v 7960 } 7961 7962 for key, value := range shape { 7963 switch key { 7964 case "modelSelectionExpression": 7965 if value != nil { 7966 jtv, ok := value.(string) 7967 if !ok { 7968 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 7969 } 7970 sv.ModelSelectionExpression = ptr.String(jtv) 7971 } 7972 7973 case "responseModels": 7974 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.ResponseModels, value); err != nil { 7975 return err 7976 } 7977 7978 case "responseParameters": 7979 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.ResponseParameters, value); err != nil { 7980 return err 7981 } 7982 7983 case "routeResponseId": 7984 if value != nil { 7985 jtv, ok := value.(string) 7986 if !ok { 7987 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7988 } 7989 sv.RouteResponseId = ptr.String(jtv) 7990 } 7991 7992 case "routeResponseKey": 7993 if value != nil { 7994 jtv, ok := value.(string) 7995 if !ok { 7996 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 7997 } 7998 sv.RouteResponseKey = ptr.String(jtv) 7999 } 8000 8001 default: 8002 _, _ = key, value 8003 8004 } 8005 } 8006 *v = sv 8007 return nil 8008} 8009 8010type awsRestjson1_deserializeOpGetRouteResponses struct { 8011} 8012 8013func (*awsRestjson1_deserializeOpGetRouteResponses) ID() string { 8014 return "OperationDeserializer" 8015} 8016 8017func (m *awsRestjson1_deserializeOpGetRouteResponses) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8018 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8019) { 8020 out, metadata, err = next.HandleDeserialize(ctx, in) 8021 if err != nil { 8022 return out, metadata, err 8023 } 8024 8025 response, ok := out.RawResponse.(*smithyhttp.Response) 8026 if !ok { 8027 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8028 } 8029 8030 if response.StatusCode < 200 || response.StatusCode >= 300 { 8031 return out, metadata, awsRestjson1_deserializeOpErrorGetRouteResponses(response, &metadata) 8032 } 8033 output := &GetRouteResponsesOutput{} 8034 out.Result = output 8035 8036 var buff [1024]byte 8037 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8038 8039 body := io.TeeReader(response.Body, ringBuffer) 8040 8041 decoder := json.NewDecoder(body) 8042 decoder.UseNumber() 8043 var shape interface{} 8044 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8045 var snapshot bytes.Buffer 8046 io.Copy(&snapshot, ringBuffer) 8047 err = &smithy.DeserializationError{ 8048 Err: fmt.Errorf("failed to decode response body, %w", err), 8049 Snapshot: snapshot.Bytes(), 8050 } 8051 return out, metadata, err 8052 } 8053 8054 err = awsRestjson1_deserializeOpDocumentGetRouteResponsesOutput(&output, shape) 8055 if err != nil { 8056 var snapshot bytes.Buffer 8057 io.Copy(&snapshot, ringBuffer) 8058 return out, metadata, &smithy.DeserializationError{ 8059 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8060 Snapshot: snapshot.Bytes(), 8061 } 8062 } 8063 8064 return out, metadata, err 8065} 8066 8067func awsRestjson1_deserializeOpErrorGetRouteResponses(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8068 var errorBuffer bytes.Buffer 8069 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8070 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8071 } 8072 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8073 8074 errorCode := "UnknownError" 8075 errorMessage := errorCode 8076 8077 code := response.Header.Get("X-Amzn-ErrorType") 8078 if len(code) != 0 { 8079 errorCode = restjson.SanitizeErrorCode(code) 8080 } 8081 8082 var buff [1024]byte 8083 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8084 8085 body := io.TeeReader(errorBody, ringBuffer) 8086 decoder := json.NewDecoder(body) 8087 decoder.UseNumber() 8088 code, message, err := restjson.GetErrorInfo(decoder) 8089 if err != nil { 8090 var snapshot bytes.Buffer 8091 io.Copy(&snapshot, ringBuffer) 8092 err = &smithy.DeserializationError{ 8093 Err: fmt.Errorf("failed to decode response body, %w", err), 8094 Snapshot: snapshot.Bytes(), 8095 } 8096 return err 8097 } 8098 8099 errorBody.Seek(0, io.SeekStart) 8100 if len(code) != 0 { 8101 errorCode = restjson.SanitizeErrorCode(code) 8102 } 8103 if len(message) != 0 { 8104 errorMessage = message 8105 } 8106 8107 switch { 8108 case strings.EqualFold("BadRequestException", errorCode): 8109 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 8110 8111 case strings.EqualFold("NotFoundException", errorCode): 8112 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8113 8114 case strings.EqualFold("TooManyRequestsException", errorCode): 8115 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8116 8117 default: 8118 genericError := &smithy.GenericAPIError{ 8119 Code: errorCode, 8120 Message: errorMessage, 8121 } 8122 return genericError 8123 8124 } 8125} 8126 8127func awsRestjson1_deserializeOpDocumentGetRouteResponsesOutput(v **GetRouteResponsesOutput, value interface{}) error { 8128 if v == nil { 8129 return fmt.Errorf("unexpected nil of type %T", v) 8130 } 8131 if value == nil { 8132 return nil 8133 } 8134 8135 shape, ok := value.(map[string]interface{}) 8136 if !ok { 8137 return fmt.Errorf("unexpected JSON type %v", value) 8138 } 8139 8140 var sv *GetRouteResponsesOutput 8141 if *v == nil { 8142 sv = &GetRouteResponsesOutput{} 8143 } else { 8144 sv = *v 8145 } 8146 8147 for key, value := range shape { 8148 switch key { 8149 case "items": 8150 if err := awsRestjson1_deserializeDocument__listOfRouteResponse(&sv.Items, value); err != nil { 8151 return err 8152 } 8153 8154 case "nextToken": 8155 if value != nil { 8156 jtv, ok := value.(string) 8157 if !ok { 8158 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8159 } 8160 sv.NextToken = ptr.String(jtv) 8161 } 8162 8163 default: 8164 _, _ = key, value 8165 8166 } 8167 } 8168 *v = sv 8169 return nil 8170} 8171 8172type awsRestjson1_deserializeOpGetRoutes struct { 8173} 8174 8175func (*awsRestjson1_deserializeOpGetRoutes) ID() string { 8176 return "OperationDeserializer" 8177} 8178 8179func (m *awsRestjson1_deserializeOpGetRoutes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8180 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8181) { 8182 out, metadata, err = next.HandleDeserialize(ctx, in) 8183 if err != nil { 8184 return out, metadata, err 8185 } 8186 8187 response, ok := out.RawResponse.(*smithyhttp.Response) 8188 if !ok { 8189 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8190 } 8191 8192 if response.StatusCode < 200 || response.StatusCode >= 300 { 8193 return out, metadata, awsRestjson1_deserializeOpErrorGetRoutes(response, &metadata) 8194 } 8195 output := &GetRoutesOutput{} 8196 out.Result = output 8197 8198 var buff [1024]byte 8199 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8200 8201 body := io.TeeReader(response.Body, ringBuffer) 8202 8203 decoder := json.NewDecoder(body) 8204 decoder.UseNumber() 8205 var shape interface{} 8206 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8207 var snapshot bytes.Buffer 8208 io.Copy(&snapshot, ringBuffer) 8209 err = &smithy.DeserializationError{ 8210 Err: fmt.Errorf("failed to decode response body, %w", err), 8211 Snapshot: snapshot.Bytes(), 8212 } 8213 return out, metadata, err 8214 } 8215 8216 err = awsRestjson1_deserializeOpDocumentGetRoutesOutput(&output, shape) 8217 if err != nil { 8218 var snapshot bytes.Buffer 8219 io.Copy(&snapshot, ringBuffer) 8220 return out, metadata, &smithy.DeserializationError{ 8221 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8222 Snapshot: snapshot.Bytes(), 8223 } 8224 } 8225 8226 return out, metadata, err 8227} 8228 8229func awsRestjson1_deserializeOpErrorGetRoutes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8230 var errorBuffer bytes.Buffer 8231 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8232 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8233 } 8234 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8235 8236 errorCode := "UnknownError" 8237 errorMessage := errorCode 8238 8239 code := response.Header.Get("X-Amzn-ErrorType") 8240 if len(code) != 0 { 8241 errorCode = restjson.SanitizeErrorCode(code) 8242 } 8243 8244 var buff [1024]byte 8245 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8246 8247 body := io.TeeReader(errorBody, ringBuffer) 8248 decoder := json.NewDecoder(body) 8249 decoder.UseNumber() 8250 code, message, err := restjson.GetErrorInfo(decoder) 8251 if err != nil { 8252 var snapshot bytes.Buffer 8253 io.Copy(&snapshot, ringBuffer) 8254 err = &smithy.DeserializationError{ 8255 Err: fmt.Errorf("failed to decode response body, %w", err), 8256 Snapshot: snapshot.Bytes(), 8257 } 8258 return err 8259 } 8260 8261 errorBody.Seek(0, io.SeekStart) 8262 if len(code) != 0 { 8263 errorCode = restjson.SanitizeErrorCode(code) 8264 } 8265 if len(message) != 0 { 8266 errorMessage = message 8267 } 8268 8269 switch { 8270 case strings.EqualFold("BadRequestException", errorCode): 8271 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 8272 8273 case strings.EqualFold("NotFoundException", errorCode): 8274 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8275 8276 case strings.EqualFold("TooManyRequestsException", errorCode): 8277 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8278 8279 default: 8280 genericError := &smithy.GenericAPIError{ 8281 Code: errorCode, 8282 Message: errorMessage, 8283 } 8284 return genericError 8285 8286 } 8287} 8288 8289func awsRestjson1_deserializeOpDocumentGetRoutesOutput(v **GetRoutesOutput, value interface{}) error { 8290 if v == nil { 8291 return fmt.Errorf("unexpected nil of type %T", v) 8292 } 8293 if value == nil { 8294 return nil 8295 } 8296 8297 shape, ok := value.(map[string]interface{}) 8298 if !ok { 8299 return fmt.Errorf("unexpected JSON type %v", value) 8300 } 8301 8302 var sv *GetRoutesOutput 8303 if *v == nil { 8304 sv = &GetRoutesOutput{} 8305 } else { 8306 sv = *v 8307 } 8308 8309 for key, value := range shape { 8310 switch key { 8311 case "items": 8312 if err := awsRestjson1_deserializeDocument__listOfRoute(&sv.Items, value); err != nil { 8313 return err 8314 } 8315 8316 case "nextToken": 8317 if value != nil { 8318 jtv, ok := value.(string) 8319 if !ok { 8320 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8321 } 8322 sv.NextToken = ptr.String(jtv) 8323 } 8324 8325 default: 8326 _, _ = key, value 8327 8328 } 8329 } 8330 *v = sv 8331 return nil 8332} 8333 8334type awsRestjson1_deserializeOpGetStage struct { 8335} 8336 8337func (*awsRestjson1_deserializeOpGetStage) ID() string { 8338 return "OperationDeserializer" 8339} 8340 8341func (m *awsRestjson1_deserializeOpGetStage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8342 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8343) { 8344 out, metadata, err = next.HandleDeserialize(ctx, in) 8345 if err != nil { 8346 return out, metadata, err 8347 } 8348 8349 response, ok := out.RawResponse.(*smithyhttp.Response) 8350 if !ok { 8351 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8352 } 8353 8354 if response.StatusCode < 200 || response.StatusCode >= 300 { 8355 return out, metadata, awsRestjson1_deserializeOpErrorGetStage(response, &metadata) 8356 } 8357 output := &GetStageOutput{} 8358 out.Result = output 8359 8360 var buff [1024]byte 8361 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8362 8363 body := io.TeeReader(response.Body, ringBuffer) 8364 8365 decoder := json.NewDecoder(body) 8366 decoder.UseNumber() 8367 var shape interface{} 8368 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8369 var snapshot bytes.Buffer 8370 io.Copy(&snapshot, ringBuffer) 8371 err = &smithy.DeserializationError{ 8372 Err: fmt.Errorf("failed to decode response body, %w", err), 8373 Snapshot: snapshot.Bytes(), 8374 } 8375 return out, metadata, err 8376 } 8377 8378 err = awsRestjson1_deserializeOpDocumentGetStageOutput(&output, shape) 8379 if err != nil { 8380 var snapshot bytes.Buffer 8381 io.Copy(&snapshot, ringBuffer) 8382 return out, metadata, &smithy.DeserializationError{ 8383 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8384 Snapshot: snapshot.Bytes(), 8385 } 8386 } 8387 8388 return out, metadata, err 8389} 8390 8391func awsRestjson1_deserializeOpErrorGetStage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8392 var errorBuffer bytes.Buffer 8393 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8394 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8395 } 8396 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8397 8398 errorCode := "UnknownError" 8399 errorMessage := errorCode 8400 8401 code := response.Header.Get("X-Amzn-ErrorType") 8402 if len(code) != 0 { 8403 errorCode = restjson.SanitizeErrorCode(code) 8404 } 8405 8406 var buff [1024]byte 8407 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8408 8409 body := io.TeeReader(errorBody, ringBuffer) 8410 decoder := json.NewDecoder(body) 8411 decoder.UseNumber() 8412 code, message, err := restjson.GetErrorInfo(decoder) 8413 if err != nil { 8414 var snapshot bytes.Buffer 8415 io.Copy(&snapshot, ringBuffer) 8416 err = &smithy.DeserializationError{ 8417 Err: fmt.Errorf("failed to decode response body, %w", err), 8418 Snapshot: snapshot.Bytes(), 8419 } 8420 return err 8421 } 8422 8423 errorBody.Seek(0, io.SeekStart) 8424 if len(code) != 0 { 8425 errorCode = restjson.SanitizeErrorCode(code) 8426 } 8427 if len(message) != 0 { 8428 errorMessage = message 8429 } 8430 8431 switch { 8432 case strings.EqualFold("NotFoundException", errorCode): 8433 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8434 8435 case strings.EqualFold("TooManyRequestsException", errorCode): 8436 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8437 8438 default: 8439 genericError := &smithy.GenericAPIError{ 8440 Code: errorCode, 8441 Message: errorMessage, 8442 } 8443 return genericError 8444 8445 } 8446} 8447 8448func awsRestjson1_deserializeOpDocumentGetStageOutput(v **GetStageOutput, value interface{}) error { 8449 if v == nil { 8450 return fmt.Errorf("unexpected nil of type %T", v) 8451 } 8452 if value == nil { 8453 return nil 8454 } 8455 8456 shape, ok := value.(map[string]interface{}) 8457 if !ok { 8458 return fmt.Errorf("unexpected JSON type %v", value) 8459 } 8460 8461 var sv *GetStageOutput 8462 if *v == nil { 8463 sv = &GetStageOutput{} 8464 } else { 8465 sv = *v 8466 } 8467 8468 for key, value := range shape { 8469 switch key { 8470 case "accessLogSettings": 8471 if err := awsRestjson1_deserializeDocumentAccessLogSettings(&sv.AccessLogSettings, value); err != nil { 8472 return err 8473 } 8474 8475 case "apiGatewayManaged": 8476 if value != nil { 8477 jtv, ok := value.(bool) 8478 if !ok { 8479 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 8480 } 8481 sv.ApiGatewayManaged = jtv 8482 } 8483 8484 case "autoDeploy": 8485 if value != nil { 8486 jtv, ok := value.(bool) 8487 if !ok { 8488 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 8489 } 8490 sv.AutoDeploy = jtv 8491 } 8492 8493 case "clientCertificateId": 8494 if value != nil { 8495 jtv, ok := value.(string) 8496 if !ok { 8497 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8498 } 8499 sv.ClientCertificateId = ptr.String(jtv) 8500 } 8501 8502 case "createdDate": 8503 if value != nil { 8504 jtv, ok := value.(string) 8505 if !ok { 8506 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 8507 } 8508 t, err := smithytime.ParseDateTime(jtv) 8509 if err != nil { 8510 return err 8511 } 8512 sv.CreatedDate = ptr.Time(t) 8513 } 8514 8515 case "defaultRouteSettings": 8516 if err := awsRestjson1_deserializeDocumentRouteSettings(&sv.DefaultRouteSettings, value); err != nil { 8517 return err 8518 } 8519 8520 case "deploymentId": 8521 if value != nil { 8522 jtv, ok := value.(string) 8523 if !ok { 8524 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8525 } 8526 sv.DeploymentId = ptr.String(jtv) 8527 } 8528 8529 case "description": 8530 if value != nil { 8531 jtv, ok := value.(string) 8532 if !ok { 8533 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 8534 } 8535 sv.Description = ptr.String(jtv) 8536 } 8537 8538 case "lastDeploymentStatusMessage": 8539 if value != nil { 8540 jtv, ok := value.(string) 8541 if !ok { 8542 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 8543 } 8544 sv.LastDeploymentStatusMessage = ptr.String(jtv) 8545 } 8546 8547 case "lastUpdatedDate": 8548 if value != nil { 8549 jtv, ok := value.(string) 8550 if !ok { 8551 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 8552 } 8553 t, err := smithytime.ParseDateTime(jtv) 8554 if err != nil { 8555 return err 8556 } 8557 sv.LastUpdatedDate = ptr.Time(t) 8558 } 8559 8560 case "routeSettings": 8561 if err := awsRestjson1_deserializeDocumentRouteSettingsMap(&sv.RouteSettings, value); err != nil { 8562 return err 8563 } 8564 8565 case "stageName": 8566 if value != nil { 8567 jtv, ok := value.(string) 8568 if !ok { 8569 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 8570 } 8571 sv.StageName = ptr.String(jtv) 8572 } 8573 8574 case "stageVariables": 8575 if err := awsRestjson1_deserializeDocumentStageVariablesMap(&sv.StageVariables, value); err != nil { 8576 return err 8577 } 8578 8579 case "tags": 8580 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 8581 return err 8582 } 8583 8584 default: 8585 _, _ = key, value 8586 8587 } 8588 } 8589 *v = sv 8590 return nil 8591} 8592 8593type awsRestjson1_deserializeOpGetStages struct { 8594} 8595 8596func (*awsRestjson1_deserializeOpGetStages) ID() string { 8597 return "OperationDeserializer" 8598} 8599 8600func (m *awsRestjson1_deserializeOpGetStages) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8601 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8602) { 8603 out, metadata, err = next.HandleDeserialize(ctx, in) 8604 if err != nil { 8605 return out, metadata, err 8606 } 8607 8608 response, ok := out.RawResponse.(*smithyhttp.Response) 8609 if !ok { 8610 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8611 } 8612 8613 if response.StatusCode < 200 || response.StatusCode >= 300 { 8614 return out, metadata, awsRestjson1_deserializeOpErrorGetStages(response, &metadata) 8615 } 8616 output := &GetStagesOutput{} 8617 out.Result = output 8618 8619 var buff [1024]byte 8620 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8621 8622 body := io.TeeReader(response.Body, ringBuffer) 8623 8624 decoder := json.NewDecoder(body) 8625 decoder.UseNumber() 8626 var shape interface{} 8627 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8628 var snapshot bytes.Buffer 8629 io.Copy(&snapshot, ringBuffer) 8630 err = &smithy.DeserializationError{ 8631 Err: fmt.Errorf("failed to decode response body, %w", err), 8632 Snapshot: snapshot.Bytes(), 8633 } 8634 return out, metadata, err 8635 } 8636 8637 err = awsRestjson1_deserializeOpDocumentGetStagesOutput(&output, shape) 8638 if err != nil { 8639 var snapshot bytes.Buffer 8640 io.Copy(&snapshot, ringBuffer) 8641 return out, metadata, &smithy.DeserializationError{ 8642 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8643 Snapshot: snapshot.Bytes(), 8644 } 8645 } 8646 8647 return out, metadata, err 8648} 8649 8650func awsRestjson1_deserializeOpErrorGetStages(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8651 var errorBuffer bytes.Buffer 8652 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8653 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8654 } 8655 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8656 8657 errorCode := "UnknownError" 8658 errorMessage := errorCode 8659 8660 code := response.Header.Get("X-Amzn-ErrorType") 8661 if len(code) != 0 { 8662 errorCode = restjson.SanitizeErrorCode(code) 8663 } 8664 8665 var buff [1024]byte 8666 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8667 8668 body := io.TeeReader(errorBody, ringBuffer) 8669 decoder := json.NewDecoder(body) 8670 decoder.UseNumber() 8671 code, message, err := restjson.GetErrorInfo(decoder) 8672 if err != nil { 8673 var snapshot bytes.Buffer 8674 io.Copy(&snapshot, ringBuffer) 8675 err = &smithy.DeserializationError{ 8676 Err: fmt.Errorf("failed to decode response body, %w", err), 8677 Snapshot: snapshot.Bytes(), 8678 } 8679 return err 8680 } 8681 8682 errorBody.Seek(0, io.SeekStart) 8683 if len(code) != 0 { 8684 errorCode = restjson.SanitizeErrorCode(code) 8685 } 8686 if len(message) != 0 { 8687 errorMessage = message 8688 } 8689 8690 switch { 8691 case strings.EqualFold("BadRequestException", errorCode): 8692 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 8693 8694 case strings.EqualFold("NotFoundException", errorCode): 8695 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8696 8697 case strings.EqualFold("TooManyRequestsException", errorCode): 8698 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8699 8700 default: 8701 genericError := &smithy.GenericAPIError{ 8702 Code: errorCode, 8703 Message: errorMessage, 8704 } 8705 return genericError 8706 8707 } 8708} 8709 8710func awsRestjson1_deserializeOpDocumentGetStagesOutput(v **GetStagesOutput, value interface{}) error { 8711 if v == nil { 8712 return fmt.Errorf("unexpected nil of type %T", v) 8713 } 8714 if value == nil { 8715 return nil 8716 } 8717 8718 shape, ok := value.(map[string]interface{}) 8719 if !ok { 8720 return fmt.Errorf("unexpected JSON type %v", value) 8721 } 8722 8723 var sv *GetStagesOutput 8724 if *v == nil { 8725 sv = &GetStagesOutput{} 8726 } else { 8727 sv = *v 8728 } 8729 8730 for key, value := range shape { 8731 switch key { 8732 case "items": 8733 if err := awsRestjson1_deserializeDocument__listOfStage(&sv.Items, value); err != nil { 8734 return err 8735 } 8736 8737 case "nextToken": 8738 if value != nil { 8739 jtv, ok := value.(string) 8740 if !ok { 8741 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8742 } 8743 sv.NextToken = ptr.String(jtv) 8744 } 8745 8746 default: 8747 _, _ = key, value 8748 8749 } 8750 } 8751 *v = sv 8752 return nil 8753} 8754 8755type awsRestjson1_deserializeOpGetTags struct { 8756} 8757 8758func (*awsRestjson1_deserializeOpGetTags) ID() string { 8759 return "OperationDeserializer" 8760} 8761 8762func (m *awsRestjson1_deserializeOpGetTags) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8763 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8764) { 8765 out, metadata, err = next.HandleDeserialize(ctx, in) 8766 if err != nil { 8767 return out, metadata, err 8768 } 8769 8770 response, ok := out.RawResponse.(*smithyhttp.Response) 8771 if !ok { 8772 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8773 } 8774 8775 if response.StatusCode < 200 || response.StatusCode >= 300 { 8776 return out, metadata, awsRestjson1_deserializeOpErrorGetTags(response, &metadata) 8777 } 8778 output := &GetTagsOutput{} 8779 out.Result = output 8780 8781 var buff [1024]byte 8782 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8783 8784 body := io.TeeReader(response.Body, ringBuffer) 8785 8786 decoder := json.NewDecoder(body) 8787 decoder.UseNumber() 8788 var shape interface{} 8789 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8790 var snapshot bytes.Buffer 8791 io.Copy(&snapshot, ringBuffer) 8792 err = &smithy.DeserializationError{ 8793 Err: fmt.Errorf("failed to decode response body, %w", err), 8794 Snapshot: snapshot.Bytes(), 8795 } 8796 return out, metadata, err 8797 } 8798 8799 err = awsRestjson1_deserializeOpDocumentGetTagsOutput(&output, shape) 8800 if err != nil { 8801 var snapshot bytes.Buffer 8802 io.Copy(&snapshot, ringBuffer) 8803 return out, metadata, &smithy.DeserializationError{ 8804 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8805 Snapshot: snapshot.Bytes(), 8806 } 8807 } 8808 8809 return out, metadata, err 8810} 8811 8812func awsRestjson1_deserializeOpErrorGetTags(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8813 var errorBuffer bytes.Buffer 8814 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8815 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8816 } 8817 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8818 8819 errorCode := "UnknownError" 8820 errorMessage := errorCode 8821 8822 code := response.Header.Get("X-Amzn-ErrorType") 8823 if len(code) != 0 { 8824 errorCode = restjson.SanitizeErrorCode(code) 8825 } 8826 8827 var buff [1024]byte 8828 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8829 8830 body := io.TeeReader(errorBody, ringBuffer) 8831 decoder := json.NewDecoder(body) 8832 decoder.UseNumber() 8833 code, message, err := restjson.GetErrorInfo(decoder) 8834 if err != nil { 8835 var snapshot bytes.Buffer 8836 io.Copy(&snapshot, ringBuffer) 8837 err = &smithy.DeserializationError{ 8838 Err: fmt.Errorf("failed to decode response body, %w", err), 8839 Snapshot: snapshot.Bytes(), 8840 } 8841 return err 8842 } 8843 8844 errorBody.Seek(0, io.SeekStart) 8845 if len(code) != 0 { 8846 errorCode = restjson.SanitizeErrorCode(code) 8847 } 8848 if len(message) != 0 { 8849 errorMessage = message 8850 } 8851 8852 switch { 8853 case strings.EqualFold("BadRequestException", errorCode): 8854 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 8855 8856 case strings.EqualFold("ConflictException", errorCode): 8857 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 8858 8859 case strings.EqualFold("NotFoundException", errorCode): 8860 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8861 8862 case strings.EqualFold("TooManyRequestsException", errorCode): 8863 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8864 8865 default: 8866 genericError := &smithy.GenericAPIError{ 8867 Code: errorCode, 8868 Message: errorMessage, 8869 } 8870 return genericError 8871 8872 } 8873} 8874 8875func awsRestjson1_deserializeOpDocumentGetTagsOutput(v **GetTagsOutput, value interface{}) error { 8876 if v == nil { 8877 return fmt.Errorf("unexpected nil of type %T", v) 8878 } 8879 if value == nil { 8880 return nil 8881 } 8882 8883 shape, ok := value.(map[string]interface{}) 8884 if !ok { 8885 return fmt.Errorf("unexpected JSON type %v", value) 8886 } 8887 8888 var sv *GetTagsOutput 8889 if *v == nil { 8890 sv = &GetTagsOutput{} 8891 } else { 8892 sv = *v 8893 } 8894 8895 for key, value := range shape { 8896 switch key { 8897 case "tags": 8898 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 8899 return err 8900 } 8901 8902 default: 8903 _, _ = key, value 8904 8905 } 8906 } 8907 *v = sv 8908 return nil 8909} 8910 8911type awsRestjson1_deserializeOpGetVpcLink struct { 8912} 8913 8914func (*awsRestjson1_deserializeOpGetVpcLink) ID() string { 8915 return "OperationDeserializer" 8916} 8917 8918func (m *awsRestjson1_deserializeOpGetVpcLink) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8919 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8920) { 8921 out, metadata, err = next.HandleDeserialize(ctx, in) 8922 if err != nil { 8923 return out, metadata, err 8924 } 8925 8926 response, ok := out.RawResponse.(*smithyhttp.Response) 8927 if !ok { 8928 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8929 } 8930 8931 if response.StatusCode < 200 || response.StatusCode >= 300 { 8932 return out, metadata, awsRestjson1_deserializeOpErrorGetVpcLink(response, &metadata) 8933 } 8934 output := &GetVpcLinkOutput{} 8935 out.Result = output 8936 8937 var buff [1024]byte 8938 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8939 8940 body := io.TeeReader(response.Body, ringBuffer) 8941 8942 decoder := json.NewDecoder(body) 8943 decoder.UseNumber() 8944 var shape interface{} 8945 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8946 var snapshot bytes.Buffer 8947 io.Copy(&snapshot, ringBuffer) 8948 err = &smithy.DeserializationError{ 8949 Err: fmt.Errorf("failed to decode response body, %w", err), 8950 Snapshot: snapshot.Bytes(), 8951 } 8952 return out, metadata, err 8953 } 8954 8955 err = awsRestjson1_deserializeOpDocumentGetVpcLinkOutput(&output, shape) 8956 if err != nil { 8957 var snapshot bytes.Buffer 8958 io.Copy(&snapshot, ringBuffer) 8959 return out, metadata, &smithy.DeserializationError{ 8960 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8961 Snapshot: snapshot.Bytes(), 8962 } 8963 } 8964 8965 return out, metadata, err 8966} 8967 8968func awsRestjson1_deserializeOpErrorGetVpcLink(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8969 var errorBuffer bytes.Buffer 8970 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8971 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8972 } 8973 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8974 8975 errorCode := "UnknownError" 8976 errorMessage := errorCode 8977 8978 code := response.Header.Get("X-Amzn-ErrorType") 8979 if len(code) != 0 { 8980 errorCode = restjson.SanitizeErrorCode(code) 8981 } 8982 8983 var buff [1024]byte 8984 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8985 8986 body := io.TeeReader(errorBody, ringBuffer) 8987 decoder := json.NewDecoder(body) 8988 decoder.UseNumber() 8989 code, message, err := restjson.GetErrorInfo(decoder) 8990 if err != nil { 8991 var snapshot bytes.Buffer 8992 io.Copy(&snapshot, ringBuffer) 8993 err = &smithy.DeserializationError{ 8994 Err: fmt.Errorf("failed to decode response body, %w", err), 8995 Snapshot: snapshot.Bytes(), 8996 } 8997 return err 8998 } 8999 9000 errorBody.Seek(0, io.SeekStart) 9001 if len(code) != 0 { 9002 errorCode = restjson.SanitizeErrorCode(code) 9003 } 9004 if len(message) != 0 { 9005 errorMessage = message 9006 } 9007 9008 switch { 9009 case strings.EqualFold("NotFoundException", errorCode): 9010 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 9011 9012 case strings.EqualFold("TooManyRequestsException", errorCode): 9013 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9014 9015 default: 9016 genericError := &smithy.GenericAPIError{ 9017 Code: errorCode, 9018 Message: errorMessage, 9019 } 9020 return genericError 9021 9022 } 9023} 9024 9025func awsRestjson1_deserializeOpDocumentGetVpcLinkOutput(v **GetVpcLinkOutput, value interface{}) error { 9026 if v == nil { 9027 return fmt.Errorf("unexpected nil of type %T", v) 9028 } 9029 if value == nil { 9030 return nil 9031 } 9032 9033 shape, ok := value.(map[string]interface{}) 9034 if !ok { 9035 return fmt.Errorf("unexpected JSON type %v", value) 9036 } 9037 9038 var sv *GetVpcLinkOutput 9039 if *v == nil { 9040 sv = &GetVpcLinkOutput{} 9041 } else { 9042 sv = *v 9043 } 9044 9045 for key, value := range shape { 9046 switch key { 9047 case "createdDate": 9048 if value != nil { 9049 jtv, ok := value.(string) 9050 if !ok { 9051 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 9052 } 9053 t, err := smithytime.ParseDateTime(jtv) 9054 if err != nil { 9055 return err 9056 } 9057 sv.CreatedDate = ptr.Time(t) 9058 } 9059 9060 case "name": 9061 if value != nil { 9062 jtv, ok := value.(string) 9063 if !ok { 9064 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 9065 } 9066 sv.Name = ptr.String(jtv) 9067 } 9068 9069 case "securityGroupIds": 9070 if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { 9071 return err 9072 } 9073 9074 case "subnetIds": 9075 if err := awsRestjson1_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil { 9076 return err 9077 } 9078 9079 case "tags": 9080 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 9081 return err 9082 } 9083 9084 case "vpcLinkId": 9085 if value != nil { 9086 jtv, ok := value.(string) 9087 if !ok { 9088 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9089 } 9090 sv.VpcLinkId = ptr.String(jtv) 9091 } 9092 9093 case "vpcLinkStatus": 9094 if value != nil { 9095 jtv, ok := value.(string) 9096 if !ok { 9097 return fmt.Errorf("expected VpcLinkStatus to be of type string, got %T instead", value) 9098 } 9099 sv.VpcLinkStatus = types.VpcLinkStatus(jtv) 9100 } 9101 9102 case "vpcLinkStatusMessage": 9103 if value != nil { 9104 jtv, ok := value.(string) 9105 if !ok { 9106 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 9107 } 9108 sv.VpcLinkStatusMessage = ptr.String(jtv) 9109 } 9110 9111 case "vpcLinkVersion": 9112 if value != nil { 9113 jtv, ok := value.(string) 9114 if !ok { 9115 return fmt.Errorf("expected VpcLinkVersion to be of type string, got %T instead", value) 9116 } 9117 sv.VpcLinkVersion = types.VpcLinkVersion(jtv) 9118 } 9119 9120 default: 9121 _, _ = key, value 9122 9123 } 9124 } 9125 *v = sv 9126 return nil 9127} 9128 9129type awsRestjson1_deserializeOpGetVpcLinks struct { 9130} 9131 9132func (*awsRestjson1_deserializeOpGetVpcLinks) ID() string { 9133 return "OperationDeserializer" 9134} 9135 9136func (m *awsRestjson1_deserializeOpGetVpcLinks) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9137 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9138) { 9139 out, metadata, err = next.HandleDeserialize(ctx, in) 9140 if err != nil { 9141 return out, metadata, err 9142 } 9143 9144 response, ok := out.RawResponse.(*smithyhttp.Response) 9145 if !ok { 9146 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9147 } 9148 9149 if response.StatusCode < 200 || response.StatusCode >= 300 { 9150 return out, metadata, awsRestjson1_deserializeOpErrorGetVpcLinks(response, &metadata) 9151 } 9152 output := &GetVpcLinksOutput{} 9153 out.Result = output 9154 9155 var buff [1024]byte 9156 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9157 9158 body := io.TeeReader(response.Body, ringBuffer) 9159 9160 decoder := json.NewDecoder(body) 9161 decoder.UseNumber() 9162 var shape interface{} 9163 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9164 var snapshot bytes.Buffer 9165 io.Copy(&snapshot, ringBuffer) 9166 err = &smithy.DeserializationError{ 9167 Err: fmt.Errorf("failed to decode response body, %w", err), 9168 Snapshot: snapshot.Bytes(), 9169 } 9170 return out, metadata, err 9171 } 9172 9173 err = awsRestjson1_deserializeOpDocumentGetVpcLinksOutput(&output, shape) 9174 if err != nil { 9175 var snapshot bytes.Buffer 9176 io.Copy(&snapshot, ringBuffer) 9177 return out, metadata, &smithy.DeserializationError{ 9178 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9179 Snapshot: snapshot.Bytes(), 9180 } 9181 } 9182 9183 return out, metadata, err 9184} 9185 9186func awsRestjson1_deserializeOpErrorGetVpcLinks(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9187 var errorBuffer bytes.Buffer 9188 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9189 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9190 } 9191 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9192 9193 errorCode := "UnknownError" 9194 errorMessage := errorCode 9195 9196 code := response.Header.Get("X-Amzn-ErrorType") 9197 if len(code) != 0 { 9198 errorCode = restjson.SanitizeErrorCode(code) 9199 } 9200 9201 var buff [1024]byte 9202 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9203 9204 body := io.TeeReader(errorBody, ringBuffer) 9205 decoder := json.NewDecoder(body) 9206 decoder.UseNumber() 9207 code, message, err := restjson.GetErrorInfo(decoder) 9208 if err != nil { 9209 var snapshot bytes.Buffer 9210 io.Copy(&snapshot, ringBuffer) 9211 err = &smithy.DeserializationError{ 9212 Err: fmt.Errorf("failed to decode response body, %w", err), 9213 Snapshot: snapshot.Bytes(), 9214 } 9215 return err 9216 } 9217 9218 errorBody.Seek(0, io.SeekStart) 9219 if len(code) != 0 { 9220 errorCode = restjson.SanitizeErrorCode(code) 9221 } 9222 if len(message) != 0 { 9223 errorMessage = message 9224 } 9225 9226 switch { 9227 case strings.EqualFold("BadRequestException", errorCode): 9228 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 9229 9230 case strings.EqualFold("TooManyRequestsException", errorCode): 9231 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9232 9233 default: 9234 genericError := &smithy.GenericAPIError{ 9235 Code: errorCode, 9236 Message: errorMessage, 9237 } 9238 return genericError 9239 9240 } 9241} 9242 9243func awsRestjson1_deserializeOpDocumentGetVpcLinksOutput(v **GetVpcLinksOutput, value interface{}) error { 9244 if v == nil { 9245 return fmt.Errorf("unexpected nil of type %T", v) 9246 } 9247 if value == nil { 9248 return nil 9249 } 9250 9251 shape, ok := value.(map[string]interface{}) 9252 if !ok { 9253 return fmt.Errorf("unexpected JSON type %v", value) 9254 } 9255 9256 var sv *GetVpcLinksOutput 9257 if *v == nil { 9258 sv = &GetVpcLinksOutput{} 9259 } else { 9260 sv = *v 9261 } 9262 9263 for key, value := range shape { 9264 switch key { 9265 case "items": 9266 if err := awsRestjson1_deserializeDocument__listOfVpcLink(&sv.Items, value); err != nil { 9267 return err 9268 } 9269 9270 case "nextToken": 9271 if value != nil { 9272 jtv, ok := value.(string) 9273 if !ok { 9274 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 9275 } 9276 sv.NextToken = ptr.String(jtv) 9277 } 9278 9279 default: 9280 _, _ = key, value 9281 9282 } 9283 } 9284 *v = sv 9285 return nil 9286} 9287 9288type awsRestjson1_deserializeOpImportApi struct { 9289} 9290 9291func (*awsRestjson1_deserializeOpImportApi) ID() string { 9292 return "OperationDeserializer" 9293} 9294 9295func (m *awsRestjson1_deserializeOpImportApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9296 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9297) { 9298 out, metadata, err = next.HandleDeserialize(ctx, in) 9299 if err != nil { 9300 return out, metadata, err 9301 } 9302 9303 response, ok := out.RawResponse.(*smithyhttp.Response) 9304 if !ok { 9305 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9306 } 9307 9308 if response.StatusCode < 200 || response.StatusCode >= 300 { 9309 return out, metadata, awsRestjson1_deserializeOpErrorImportApi(response, &metadata) 9310 } 9311 output := &ImportApiOutput{} 9312 out.Result = output 9313 9314 var buff [1024]byte 9315 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9316 9317 body := io.TeeReader(response.Body, ringBuffer) 9318 9319 decoder := json.NewDecoder(body) 9320 decoder.UseNumber() 9321 var shape interface{} 9322 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9323 var snapshot bytes.Buffer 9324 io.Copy(&snapshot, ringBuffer) 9325 err = &smithy.DeserializationError{ 9326 Err: fmt.Errorf("failed to decode response body, %w", err), 9327 Snapshot: snapshot.Bytes(), 9328 } 9329 return out, metadata, err 9330 } 9331 9332 err = awsRestjson1_deserializeOpDocumentImportApiOutput(&output, shape) 9333 if err != nil { 9334 var snapshot bytes.Buffer 9335 io.Copy(&snapshot, ringBuffer) 9336 return out, metadata, &smithy.DeserializationError{ 9337 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9338 Snapshot: snapshot.Bytes(), 9339 } 9340 } 9341 9342 return out, metadata, err 9343} 9344 9345func awsRestjson1_deserializeOpErrorImportApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9346 var errorBuffer bytes.Buffer 9347 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9348 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9349 } 9350 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9351 9352 errorCode := "UnknownError" 9353 errorMessage := errorCode 9354 9355 code := response.Header.Get("X-Amzn-ErrorType") 9356 if len(code) != 0 { 9357 errorCode = restjson.SanitizeErrorCode(code) 9358 } 9359 9360 var buff [1024]byte 9361 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9362 9363 body := io.TeeReader(errorBody, ringBuffer) 9364 decoder := json.NewDecoder(body) 9365 decoder.UseNumber() 9366 code, message, err := restjson.GetErrorInfo(decoder) 9367 if err != nil { 9368 var snapshot bytes.Buffer 9369 io.Copy(&snapshot, ringBuffer) 9370 err = &smithy.DeserializationError{ 9371 Err: fmt.Errorf("failed to decode response body, %w", err), 9372 Snapshot: snapshot.Bytes(), 9373 } 9374 return err 9375 } 9376 9377 errorBody.Seek(0, io.SeekStart) 9378 if len(code) != 0 { 9379 errorCode = restjson.SanitizeErrorCode(code) 9380 } 9381 if len(message) != 0 { 9382 errorMessage = message 9383 } 9384 9385 switch { 9386 case strings.EqualFold("BadRequestException", errorCode): 9387 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 9388 9389 case strings.EqualFold("ConflictException", errorCode): 9390 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 9391 9392 case strings.EqualFold("NotFoundException", errorCode): 9393 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 9394 9395 case strings.EqualFold("TooManyRequestsException", errorCode): 9396 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9397 9398 default: 9399 genericError := &smithy.GenericAPIError{ 9400 Code: errorCode, 9401 Message: errorMessage, 9402 } 9403 return genericError 9404 9405 } 9406} 9407 9408func awsRestjson1_deserializeOpDocumentImportApiOutput(v **ImportApiOutput, value interface{}) error { 9409 if v == nil { 9410 return fmt.Errorf("unexpected nil of type %T", v) 9411 } 9412 if value == nil { 9413 return nil 9414 } 9415 9416 shape, ok := value.(map[string]interface{}) 9417 if !ok { 9418 return fmt.Errorf("unexpected JSON type %v", value) 9419 } 9420 9421 var sv *ImportApiOutput 9422 if *v == nil { 9423 sv = &ImportApiOutput{} 9424 } else { 9425 sv = *v 9426 } 9427 9428 for key, value := range shape { 9429 switch key { 9430 case "apiEndpoint": 9431 if value != nil { 9432 jtv, ok := value.(string) 9433 if !ok { 9434 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 9435 } 9436 sv.ApiEndpoint = ptr.String(jtv) 9437 } 9438 9439 case "apiGatewayManaged": 9440 if value != nil { 9441 jtv, ok := value.(bool) 9442 if !ok { 9443 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9444 } 9445 sv.ApiGatewayManaged = jtv 9446 } 9447 9448 case "apiId": 9449 if value != nil { 9450 jtv, ok := value.(string) 9451 if !ok { 9452 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9453 } 9454 sv.ApiId = ptr.String(jtv) 9455 } 9456 9457 case "apiKeySelectionExpression": 9458 if value != nil { 9459 jtv, ok := value.(string) 9460 if !ok { 9461 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 9462 } 9463 sv.ApiKeySelectionExpression = ptr.String(jtv) 9464 } 9465 9466 case "corsConfiguration": 9467 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 9468 return err 9469 } 9470 9471 case "createdDate": 9472 if value != nil { 9473 jtv, ok := value.(string) 9474 if !ok { 9475 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 9476 } 9477 t, err := smithytime.ParseDateTime(jtv) 9478 if err != nil { 9479 return err 9480 } 9481 sv.CreatedDate = ptr.Time(t) 9482 } 9483 9484 case "description": 9485 if value != nil { 9486 jtv, ok := value.(string) 9487 if !ok { 9488 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 9489 } 9490 sv.Description = ptr.String(jtv) 9491 } 9492 9493 case "disableExecuteApiEndpoint": 9494 if value != nil { 9495 jtv, ok := value.(bool) 9496 if !ok { 9497 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9498 } 9499 sv.DisableExecuteApiEndpoint = jtv 9500 } 9501 9502 case "disableSchemaValidation": 9503 if value != nil { 9504 jtv, ok := value.(bool) 9505 if !ok { 9506 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9507 } 9508 sv.DisableSchemaValidation = jtv 9509 } 9510 9511 case "importInfo": 9512 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 9513 return err 9514 } 9515 9516 case "name": 9517 if value != nil { 9518 jtv, ok := value.(string) 9519 if !ok { 9520 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 9521 } 9522 sv.Name = ptr.String(jtv) 9523 } 9524 9525 case "protocolType": 9526 if value != nil { 9527 jtv, ok := value.(string) 9528 if !ok { 9529 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 9530 } 9531 sv.ProtocolType = types.ProtocolType(jtv) 9532 } 9533 9534 case "routeSelectionExpression": 9535 if value != nil { 9536 jtv, ok := value.(string) 9537 if !ok { 9538 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 9539 } 9540 sv.RouteSelectionExpression = ptr.String(jtv) 9541 } 9542 9543 case "tags": 9544 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 9545 return err 9546 } 9547 9548 case "version": 9549 if value != nil { 9550 jtv, ok := value.(string) 9551 if !ok { 9552 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 9553 } 9554 sv.Version = ptr.String(jtv) 9555 } 9556 9557 case "warnings": 9558 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 9559 return err 9560 } 9561 9562 default: 9563 _, _ = key, value 9564 9565 } 9566 } 9567 *v = sv 9568 return nil 9569} 9570 9571type awsRestjson1_deserializeOpReimportApi struct { 9572} 9573 9574func (*awsRestjson1_deserializeOpReimportApi) ID() string { 9575 return "OperationDeserializer" 9576} 9577 9578func (m *awsRestjson1_deserializeOpReimportApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9579 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9580) { 9581 out, metadata, err = next.HandleDeserialize(ctx, in) 9582 if err != nil { 9583 return out, metadata, err 9584 } 9585 9586 response, ok := out.RawResponse.(*smithyhttp.Response) 9587 if !ok { 9588 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9589 } 9590 9591 if response.StatusCode < 200 || response.StatusCode >= 300 { 9592 return out, metadata, awsRestjson1_deserializeOpErrorReimportApi(response, &metadata) 9593 } 9594 output := &ReimportApiOutput{} 9595 out.Result = output 9596 9597 var buff [1024]byte 9598 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9599 9600 body := io.TeeReader(response.Body, ringBuffer) 9601 9602 decoder := json.NewDecoder(body) 9603 decoder.UseNumber() 9604 var shape interface{} 9605 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9606 var snapshot bytes.Buffer 9607 io.Copy(&snapshot, ringBuffer) 9608 err = &smithy.DeserializationError{ 9609 Err: fmt.Errorf("failed to decode response body, %w", err), 9610 Snapshot: snapshot.Bytes(), 9611 } 9612 return out, metadata, err 9613 } 9614 9615 err = awsRestjson1_deserializeOpDocumentReimportApiOutput(&output, shape) 9616 if err != nil { 9617 var snapshot bytes.Buffer 9618 io.Copy(&snapshot, ringBuffer) 9619 return out, metadata, &smithy.DeserializationError{ 9620 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9621 Snapshot: snapshot.Bytes(), 9622 } 9623 } 9624 9625 return out, metadata, err 9626} 9627 9628func awsRestjson1_deserializeOpErrorReimportApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9629 var errorBuffer bytes.Buffer 9630 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9631 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9632 } 9633 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9634 9635 errorCode := "UnknownError" 9636 errorMessage := errorCode 9637 9638 code := response.Header.Get("X-Amzn-ErrorType") 9639 if len(code) != 0 { 9640 errorCode = restjson.SanitizeErrorCode(code) 9641 } 9642 9643 var buff [1024]byte 9644 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9645 9646 body := io.TeeReader(errorBody, ringBuffer) 9647 decoder := json.NewDecoder(body) 9648 decoder.UseNumber() 9649 code, message, err := restjson.GetErrorInfo(decoder) 9650 if err != nil { 9651 var snapshot bytes.Buffer 9652 io.Copy(&snapshot, ringBuffer) 9653 err = &smithy.DeserializationError{ 9654 Err: fmt.Errorf("failed to decode response body, %w", err), 9655 Snapshot: snapshot.Bytes(), 9656 } 9657 return err 9658 } 9659 9660 errorBody.Seek(0, io.SeekStart) 9661 if len(code) != 0 { 9662 errorCode = restjson.SanitizeErrorCode(code) 9663 } 9664 if len(message) != 0 { 9665 errorMessage = message 9666 } 9667 9668 switch { 9669 case strings.EqualFold("BadRequestException", errorCode): 9670 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 9671 9672 case strings.EqualFold("ConflictException", errorCode): 9673 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 9674 9675 case strings.EqualFold("NotFoundException", errorCode): 9676 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 9677 9678 case strings.EqualFold("TooManyRequestsException", errorCode): 9679 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9680 9681 default: 9682 genericError := &smithy.GenericAPIError{ 9683 Code: errorCode, 9684 Message: errorMessage, 9685 } 9686 return genericError 9687 9688 } 9689} 9690 9691func awsRestjson1_deserializeOpDocumentReimportApiOutput(v **ReimportApiOutput, value interface{}) error { 9692 if v == nil { 9693 return fmt.Errorf("unexpected nil of type %T", v) 9694 } 9695 if value == nil { 9696 return nil 9697 } 9698 9699 shape, ok := value.(map[string]interface{}) 9700 if !ok { 9701 return fmt.Errorf("unexpected JSON type %v", value) 9702 } 9703 9704 var sv *ReimportApiOutput 9705 if *v == nil { 9706 sv = &ReimportApiOutput{} 9707 } else { 9708 sv = *v 9709 } 9710 9711 for key, value := range shape { 9712 switch key { 9713 case "apiEndpoint": 9714 if value != nil { 9715 jtv, ok := value.(string) 9716 if !ok { 9717 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 9718 } 9719 sv.ApiEndpoint = ptr.String(jtv) 9720 } 9721 9722 case "apiGatewayManaged": 9723 if value != nil { 9724 jtv, ok := value.(bool) 9725 if !ok { 9726 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9727 } 9728 sv.ApiGatewayManaged = jtv 9729 } 9730 9731 case "apiId": 9732 if value != nil { 9733 jtv, ok := value.(string) 9734 if !ok { 9735 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9736 } 9737 sv.ApiId = ptr.String(jtv) 9738 } 9739 9740 case "apiKeySelectionExpression": 9741 if value != nil { 9742 jtv, ok := value.(string) 9743 if !ok { 9744 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 9745 } 9746 sv.ApiKeySelectionExpression = ptr.String(jtv) 9747 } 9748 9749 case "corsConfiguration": 9750 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 9751 return err 9752 } 9753 9754 case "createdDate": 9755 if value != nil { 9756 jtv, ok := value.(string) 9757 if !ok { 9758 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 9759 } 9760 t, err := smithytime.ParseDateTime(jtv) 9761 if err != nil { 9762 return err 9763 } 9764 sv.CreatedDate = ptr.Time(t) 9765 } 9766 9767 case "description": 9768 if value != nil { 9769 jtv, ok := value.(string) 9770 if !ok { 9771 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 9772 } 9773 sv.Description = ptr.String(jtv) 9774 } 9775 9776 case "disableExecuteApiEndpoint": 9777 if value != nil { 9778 jtv, ok := value.(bool) 9779 if !ok { 9780 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9781 } 9782 sv.DisableExecuteApiEndpoint = jtv 9783 } 9784 9785 case "disableSchemaValidation": 9786 if value != nil { 9787 jtv, ok := value.(bool) 9788 if !ok { 9789 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9790 } 9791 sv.DisableSchemaValidation = jtv 9792 } 9793 9794 case "importInfo": 9795 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 9796 return err 9797 } 9798 9799 case "name": 9800 if value != nil { 9801 jtv, ok := value.(string) 9802 if !ok { 9803 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 9804 } 9805 sv.Name = ptr.String(jtv) 9806 } 9807 9808 case "protocolType": 9809 if value != nil { 9810 jtv, ok := value.(string) 9811 if !ok { 9812 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 9813 } 9814 sv.ProtocolType = types.ProtocolType(jtv) 9815 } 9816 9817 case "routeSelectionExpression": 9818 if value != nil { 9819 jtv, ok := value.(string) 9820 if !ok { 9821 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 9822 } 9823 sv.RouteSelectionExpression = ptr.String(jtv) 9824 } 9825 9826 case "tags": 9827 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 9828 return err 9829 } 9830 9831 case "version": 9832 if value != nil { 9833 jtv, ok := value.(string) 9834 if !ok { 9835 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 9836 } 9837 sv.Version = ptr.String(jtv) 9838 } 9839 9840 case "warnings": 9841 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 9842 return err 9843 } 9844 9845 default: 9846 _, _ = key, value 9847 9848 } 9849 } 9850 *v = sv 9851 return nil 9852} 9853 9854type awsRestjson1_deserializeOpResetAuthorizersCache struct { 9855} 9856 9857func (*awsRestjson1_deserializeOpResetAuthorizersCache) ID() string { 9858 return "OperationDeserializer" 9859} 9860 9861func (m *awsRestjson1_deserializeOpResetAuthorizersCache) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9862 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9863) { 9864 out, metadata, err = next.HandleDeserialize(ctx, in) 9865 if err != nil { 9866 return out, metadata, err 9867 } 9868 9869 response, ok := out.RawResponse.(*smithyhttp.Response) 9870 if !ok { 9871 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9872 } 9873 9874 if response.StatusCode < 200 || response.StatusCode >= 300 { 9875 return out, metadata, awsRestjson1_deserializeOpErrorResetAuthorizersCache(response, &metadata) 9876 } 9877 output := &ResetAuthorizersCacheOutput{} 9878 out.Result = output 9879 9880 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 9881 return out, metadata, &smithy.DeserializationError{ 9882 Err: fmt.Errorf("failed to discard response body, %w", err), 9883 } 9884 } 9885 9886 return out, metadata, err 9887} 9888 9889func awsRestjson1_deserializeOpErrorResetAuthorizersCache(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9890 var errorBuffer bytes.Buffer 9891 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9892 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9893 } 9894 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9895 9896 errorCode := "UnknownError" 9897 errorMessage := errorCode 9898 9899 code := response.Header.Get("X-Amzn-ErrorType") 9900 if len(code) != 0 { 9901 errorCode = restjson.SanitizeErrorCode(code) 9902 } 9903 9904 var buff [1024]byte 9905 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9906 9907 body := io.TeeReader(errorBody, ringBuffer) 9908 decoder := json.NewDecoder(body) 9909 decoder.UseNumber() 9910 code, message, err := restjson.GetErrorInfo(decoder) 9911 if err != nil { 9912 var snapshot bytes.Buffer 9913 io.Copy(&snapshot, ringBuffer) 9914 err = &smithy.DeserializationError{ 9915 Err: fmt.Errorf("failed to decode response body, %w", err), 9916 Snapshot: snapshot.Bytes(), 9917 } 9918 return err 9919 } 9920 9921 errorBody.Seek(0, io.SeekStart) 9922 if len(code) != 0 { 9923 errorCode = restjson.SanitizeErrorCode(code) 9924 } 9925 if len(message) != 0 { 9926 errorMessage = message 9927 } 9928 9929 switch { 9930 case strings.EqualFold("NotFoundException", errorCode): 9931 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 9932 9933 case strings.EqualFold("TooManyRequestsException", errorCode): 9934 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9935 9936 default: 9937 genericError := &smithy.GenericAPIError{ 9938 Code: errorCode, 9939 Message: errorMessage, 9940 } 9941 return genericError 9942 9943 } 9944} 9945 9946type awsRestjson1_deserializeOpTagResource struct { 9947} 9948 9949func (*awsRestjson1_deserializeOpTagResource) ID() string { 9950 return "OperationDeserializer" 9951} 9952 9953func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9954 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9955) { 9956 out, metadata, err = next.HandleDeserialize(ctx, in) 9957 if err != nil { 9958 return out, metadata, err 9959 } 9960 9961 response, ok := out.RawResponse.(*smithyhttp.Response) 9962 if !ok { 9963 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9964 } 9965 9966 if response.StatusCode < 200 || response.StatusCode >= 300 { 9967 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 9968 } 9969 output := &TagResourceOutput{} 9970 out.Result = output 9971 9972 return out, metadata, err 9973} 9974 9975func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9976 var errorBuffer bytes.Buffer 9977 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9978 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9979 } 9980 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9981 9982 errorCode := "UnknownError" 9983 errorMessage := errorCode 9984 9985 code := response.Header.Get("X-Amzn-ErrorType") 9986 if len(code) != 0 { 9987 errorCode = restjson.SanitizeErrorCode(code) 9988 } 9989 9990 var buff [1024]byte 9991 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9992 9993 body := io.TeeReader(errorBody, ringBuffer) 9994 decoder := json.NewDecoder(body) 9995 decoder.UseNumber() 9996 code, message, err := restjson.GetErrorInfo(decoder) 9997 if err != nil { 9998 var snapshot bytes.Buffer 9999 io.Copy(&snapshot, ringBuffer) 10000 err = &smithy.DeserializationError{ 10001 Err: fmt.Errorf("failed to decode response body, %w", err), 10002 Snapshot: snapshot.Bytes(), 10003 } 10004 return err 10005 } 10006 10007 errorBody.Seek(0, io.SeekStart) 10008 if len(code) != 0 { 10009 errorCode = restjson.SanitizeErrorCode(code) 10010 } 10011 if len(message) != 0 { 10012 errorMessage = message 10013 } 10014 10015 switch { 10016 case strings.EqualFold("BadRequestException", errorCode): 10017 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10018 10019 case strings.EqualFold("ConflictException", errorCode): 10020 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10021 10022 case strings.EqualFold("NotFoundException", errorCode): 10023 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10024 10025 case strings.EqualFold("TooManyRequestsException", errorCode): 10026 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10027 10028 default: 10029 genericError := &smithy.GenericAPIError{ 10030 Code: errorCode, 10031 Message: errorMessage, 10032 } 10033 return genericError 10034 10035 } 10036} 10037 10038type awsRestjson1_deserializeOpUntagResource struct { 10039} 10040 10041func (*awsRestjson1_deserializeOpUntagResource) ID() string { 10042 return "OperationDeserializer" 10043} 10044 10045func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10046 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10047) { 10048 out, metadata, err = next.HandleDeserialize(ctx, in) 10049 if err != nil { 10050 return out, metadata, err 10051 } 10052 10053 response, ok := out.RawResponse.(*smithyhttp.Response) 10054 if !ok { 10055 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10056 } 10057 10058 if response.StatusCode < 200 || response.StatusCode >= 300 { 10059 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 10060 } 10061 output := &UntagResourceOutput{} 10062 out.Result = output 10063 10064 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 10065 return out, metadata, &smithy.DeserializationError{ 10066 Err: fmt.Errorf("failed to discard response body, %w", err), 10067 } 10068 } 10069 10070 return out, metadata, err 10071} 10072 10073func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10074 var errorBuffer bytes.Buffer 10075 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10076 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10077 } 10078 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10079 10080 errorCode := "UnknownError" 10081 errorMessage := errorCode 10082 10083 code := response.Header.Get("X-Amzn-ErrorType") 10084 if len(code) != 0 { 10085 errorCode = restjson.SanitizeErrorCode(code) 10086 } 10087 10088 var buff [1024]byte 10089 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10090 10091 body := io.TeeReader(errorBody, ringBuffer) 10092 decoder := json.NewDecoder(body) 10093 decoder.UseNumber() 10094 code, message, err := restjson.GetErrorInfo(decoder) 10095 if err != nil { 10096 var snapshot bytes.Buffer 10097 io.Copy(&snapshot, ringBuffer) 10098 err = &smithy.DeserializationError{ 10099 Err: fmt.Errorf("failed to decode response body, %w", err), 10100 Snapshot: snapshot.Bytes(), 10101 } 10102 return err 10103 } 10104 10105 errorBody.Seek(0, io.SeekStart) 10106 if len(code) != 0 { 10107 errorCode = restjson.SanitizeErrorCode(code) 10108 } 10109 if len(message) != 0 { 10110 errorMessage = message 10111 } 10112 10113 switch { 10114 case strings.EqualFold("BadRequestException", errorCode): 10115 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10116 10117 case strings.EqualFold("ConflictException", errorCode): 10118 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10119 10120 case strings.EqualFold("NotFoundException", errorCode): 10121 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10122 10123 case strings.EqualFold("TooManyRequestsException", errorCode): 10124 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10125 10126 default: 10127 genericError := &smithy.GenericAPIError{ 10128 Code: errorCode, 10129 Message: errorMessage, 10130 } 10131 return genericError 10132 10133 } 10134} 10135 10136type awsRestjson1_deserializeOpUpdateApi struct { 10137} 10138 10139func (*awsRestjson1_deserializeOpUpdateApi) ID() string { 10140 return "OperationDeserializer" 10141} 10142 10143func (m *awsRestjson1_deserializeOpUpdateApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10144 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10145) { 10146 out, metadata, err = next.HandleDeserialize(ctx, in) 10147 if err != nil { 10148 return out, metadata, err 10149 } 10150 10151 response, ok := out.RawResponse.(*smithyhttp.Response) 10152 if !ok { 10153 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10154 } 10155 10156 if response.StatusCode < 200 || response.StatusCode >= 300 { 10157 return out, metadata, awsRestjson1_deserializeOpErrorUpdateApi(response, &metadata) 10158 } 10159 output := &UpdateApiOutput{} 10160 out.Result = output 10161 10162 var buff [1024]byte 10163 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10164 10165 body := io.TeeReader(response.Body, ringBuffer) 10166 10167 decoder := json.NewDecoder(body) 10168 decoder.UseNumber() 10169 var shape interface{} 10170 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10171 var snapshot bytes.Buffer 10172 io.Copy(&snapshot, ringBuffer) 10173 err = &smithy.DeserializationError{ 10174 Err: fmt.Errorf("failed to decode response body, %w", err), 10175 Snapshot: snapshot.Bytes(), 10176 } 10177 return out, metadata, err 10178 } 10179 10180 err = awsRestjson1_deserializeOpDocumentUpdateApiOutput(&output, shape) 10181 if err != nil { 10182 var snapshot bytes.Buffer 10183 io.Copy(&snapshot, ringBuffer) 10184 return out, metadata, &smithy.DeserializationError{ 10185 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10186 Snapshot: snapshot.Bytes(), 10187 } 10188 } 10189 10190 return out, metadata, err 10191} 10192 10193func awsRestjson1_deserializeOpErrorUpdateApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10194 var errorBuffer bytes.Buffer 10195 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10196 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10197 } 10198 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10199 10200 errorCode := "UnknownError" 10201 errorMessage := errorCode 10202 10203 code := response.Header.Get("X-Amzn-ErrorType") 10204 if len(code) != 0 { 10205 errorCode = restjson.SanitizeErrorCode(code) 10206 } 10207 10208 var buff [1024]byte 10209 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10210 10211 body := io.TeeReader(errorBody, ringBuffer) 10212 decoder := json.NewDecoder(body) 10213 decoder.UseNumber() 10214 code, message, err := restjson.GetErrorInfo(decoder) 10215 if err != nil { 10216 var snapshot bytes.Buffer 10217 io.Copy(&snapshot, ringBuffer) 10218 err = &smithy.DeserializationError{ 10219 Err: fmt.Errorf("failed to decode response body, %w", err), 10220 Snapshot: snapshot.Bytes(), 10221 } 10222 return err 10223 } 10224 10225 errorBody.Seek(0, io.SeekStart) 10226 if len(code) != 0 { 10227 errorCode = restjson.SanitizeErrorCode(code) 10228 } 10229 if len(message) != 0 { 10230 errorMessage = message 10231 } 10232 10233 switch { 10234 case strings.EqualFold("BadRequestException", errorCode): 10235 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10236 10237 case strings.EqualFold("ConflictException", errorCode): 10238 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10239 10240 case strings.EqualFold("NotFoundException", errorCode): 10241 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10242 10243 case strings.EqualFold("TooManyRequestsException", errorCode): 10244 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10245 10246 default: 10247 genericError := &smithy.GenericAPIError{ 10248 Code: errorCode, 10249 Message: errorMessage, 10250 } 10251 return genericError 10252 10253 } 10254} 10255 10256func awsRestjson1_deserializeOpDocumentUpdateApiOutput(v **UpdateApiOutput, value interface{}) error { 10257 if v == nil { 10258 return fmt.Errorf("unexpected nil of type %T", v) 10259 } 10260 if value == nil { 10261 return nil 10262 } 10263 10264 shape, ok := value.(map[string]interface{}) 10265 if !ok { 10266 return fmt.Errorf("unexpected JSON type %v", value) 10267 } 10268 10269 var sv *UpdateApiOutput 10270 if *v == nil { 10271 sv = &UpdateApiOutput{} 10272 } else { 10273 sv = *v 10274 } 10275 10276 for key, value := range shape { 10277 switch key { 10278 case "apiEndpoint": 10279 if value != nil { 10280 jtv, ok := value.(string) 10281 if !ok { 10282 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 10283 } 10284 sv.ApiEndpoint = ptr.String(jtv) 10285 } 10286 10287 case "apiGatewayManaged": 10288 if value != nil { 10289 jtv, ok := value.(bool) 10290 if !ok { 10291 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10292 } 10293 sv.ApiGatewayManaged = jtv 10294 } 10295 10296 case "apiId": 10297 if value != nil { 10298 jtv, ok := value.(string) 10299 if !ok { 10300 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10301 } 10302 sv.ApiId = ptr.String(jtv) 10303 } 10304 10305 case "apiKeySelectionExpression": 10306 if value != nil { 10307 jtv, ok := value.(string) 10308 if !ok { 10309 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 10310 } 10311 sv.ApiKeySelectionExpression = ptr.String(jtv) 10312 } 10313 10314 case "corsConfiguration": 10315 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 10316 return err 10317 } 10318 10319 case "createdDate": 10320 if value != nil { 10321 jtv, ok := value.(string) 10322 if !ok { 10323 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 10324 } 10325 t, err := smithytime.ParseDateTime(jtv) 10326 if err != nil { 10327 return err 10328 } 10329 sv.CreatedDate = ptr.Time(t) 10330 } 10331 10332 case "description": 10333 if value != nil { 10334 jtv, ok := value.(string) 10335 if !ok { 10336 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 10337 } 10338 sv.Description = ptr.String(jtv) 10339 } 10340 10341 case "disableExecuteApiEndpoint": 10342 if value != nil { 10343 jtv, ok := value.(bool) 10344 if !ok { 10345 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10346 } 10347 sv.DisableExecuteApiEndpoint = jtv 10348 } 10349 10350 case "disableSchemaValidation": 10351 if value != nil { 10352 jtv, ok := value.(bool) 10353 if !ok { 10354 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10355 } 10356 sv.DisableSchemaValidation = jtv 10357 } 10358 10359 case "importInfo": 10360 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 10361 return err 10362 } 10363 10364 case "name": 10365 if value != nil { 10366 jtv, ok := value.(string) 10367 if !ok { 10368 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 10369 } 10370 sv.Name = ptr.String(jtv) 10371 } 10372 10373 case "protocolType": 10374 if value != nil { 10375 jtv, ok := value.(string) 10376 if !ok { 10377 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 10378 } 10379 sv.ProtocolType = types.ProtocolType(jtv) 10380 } 10381 10382 case "routeSelectionExpression": 10383 if value != nil { 10384 jtv, ok := value.(string) 10385 if !ok { 10386 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 10387 } 10388 sv.RouteSelectionExpression = ptr.String(jtv) 10389 } 10390 10391 case "tags": 10392 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 10393 return err 10394 } 10395 10396 case "version": 10397 if value != nil { 10398 jtv, ok := value.(string) 10399 if !ok { 10400 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 10401 } 10402 sv.Version = ptr.String(jtv) 10403 } 10404 10405 case "warnings": 10406 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 10407 return err 10408 } 10409 10410 default: 10411 _, _ = key, value 10412 10413 } 10414 } 10415 *v = sv 10416 return nil 10417} 10418 10419type awsRestjson1_deserializeOpUpdateApiMapping struct { 10420} 10421 10422func (*awsRestjson1_deserializeOpUpdateApiMapping) ID() string { 10423 return "OperationDeserializer" 10424} 10425 10426func (m *awsRestjson1_deserializeOpUpdateApiMapping) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10427 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10428) { 10429 out, metadata, err = next.HandleDeserialize(ctx, in) 10430 if err != nil { 10431 return out, metadata, err 10432 } 10433 10434 response, ok := out.RawResponse.(*smithyhttp.Response) 10435 if !ok { 10436 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10437 } 10438 10439 if response.StatusCode < 200 || response.StatusCode >= 300 { 10440 return out, metadata, awsRestjson1_deserializeOpErrorUpdateApiMapping(response, &metadata) 10441 } 10442 output := &UpdateApiMappingOutput{} 10443 out.Result = output 10444 10445 var buff [1024]byte 10446 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10447 10448 body := io.TeeReader(response.Body, ringBuffer) 10449 10450 decoder := json.NewDecoder(body) 10451 decoder.UseNumber() 10452 var shape interface{} 10453 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10454 var snapshot bytes.Buffer 10455 io.Copy(&snapshot, ringBuffer) 10456 err = &smithy.DeserializationError{ 10457 Err: fmt.Errorf("failed to decode response body, %w", err), 10458 Snapshot: snapshot.Bytes(), 10459 } 10460 return out, metadata, err 10461 } 10462 10463 err = awsRestjson1_deserializeOpDocumentUpdateApiMappingOutput(&output, shape) 10464 if err != nil { 10465 var snapshot bytes.Buffer 10466 io.Copy(&snapshot, ringBuffer) 10467 return out, metadata, &smithy.DeserializationError{ 10468 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10469 Snapshot: snapshot.Bytes(), 10470 } 10471 } 10472 10473 return out, metadata, err 10474} 10475 10476func awsRestjson1_deserializeOpErrorUpdateApiMapping(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10477 var errorBuffer bytes.Buffer 10478 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10479 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10480 } 10481 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10482 10483 errorCode := "UnknownError" 10484 errorMessage := errorCode 10485 10486 code := response.Header.Get("X-Amzn-ErrorType") 10487 if len(code) != 0 { 10488 errorCode = restjson.SanitizeErrorCode(code) 10489 } 10490 10491 var buff [1024]byte 10492 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10493 10494 body := io.TeeReader(errorBody, ringBuffer) 10495 decoder := json.NewDecoder(body) 10496 decoder.UseNumber() 10497 code, message, err := restjson.GetErrorInfo(decoder) 10498 if err != nil { 10499 var snapshot bytes.Buffer 10500 io.Copy(&snapshot, ringBuffer) 10501 err = &smithy.DeserializationError{ 10502 Err: fmt.Errorf("failed to decode response body, %w", err), 10503 Snapshot: snapshot.Bytes(), 10504 } 10505 return err 10506 } 10507 10508 errorBody.Seek(0, io.SeekStart) 10509 if len(code) != 0 { 10510 errorCode = restjson.SanitizeErrorCode(code) 10511 } 10512 if len(message) != 0 { 10513 errorMessage = message 10514 } 10515 10516 switch { 10517 case strings.EqualFold("BadRequestException", errorCode): 10518 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10519 10520 case strings.EqualFold("ConflictException", errorCode): 10521 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10522 10523 case strings.EqualFold("NotFoundException", errorCode): 10524 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10525 10526 case strings.EqualFold("TooManyRequestsException", errorCode): 10527 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10528 10529 default: 10530 genericError := &smithy.GenericAPIError{ 10531 Code: errorCode, 10532 Message: errorMessage, 10533 } 10534 return genericError 10535 10536 } 10537} 10538 10539func awsRestjson1_deserializeOpDocumentUpdateApiMappingOutput(v **UpdateApiMappingOutput, value interface{}) error { 10540 if v == nil { 10541 return fmt.Errorf("unexpected nil of type %T", v) 10542 } 10543 if value == nil { 10544 return nil 10545 } 10546 10547 shape, ok := value.(map[string]interface{}) 10548 if !ok { 10549 return fmt.Errorf("unexpected JSON type %v", value) 10550 } 10551 10552 var sv *UpdateApiMappingOutput 10553 if *v == nil { 10554 sv = &UpdateApiMappingOutput{} 10555 } else { 10556 sv = *v 10557 } 10558 10559 for key, value := range shape { 10560 switch key { 10561 case "apiId": 10562 if value != nil { 10563 jtv, ok := value.(string) 10564 if !ok { 10565 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10566 } 10567 sv.ApiId = ptr.String(jtv) 10568 } 10569 10570 case "apiMappingId": 10571 if value != nil { 10572 jtv, ok := value.(string) 10573 if !ok { 10574 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10575 } 10576 sv.ApiMappingId = ptr.String(jtv) 10577 } 10578 10579 case "apiMappingKey": 10580 if value != nil { 10581 jtv, ok := value.(string) 10582 if !ok { 10583 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 10584 } 10585 sv.ApiMappingKey = ptr.String(jtv) 10586 } 10587 10588 case "stage": 10589 if value != nil { 10590 jtv, ok := value.(string) 10591 if !ok { 10592 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 10593 } 10594 sv.Stage = ptr.String(jtv) 10595 } 10596 10597 default: 10598 _, _ = key, value 10599 10600 } 10601 } 10602 *v = sv 10603 return nil 10604} 10605 10606type awsRestjson1_deserializeOpUpdateAuthorizer struct { 10607} 10608 10609func (*awsRestjson1_deserializeOpUpdateAuthorizer) ID() string { 10610 return "OperationDeserializer" 10611} 10612 10613func (m *awsRestjson1_deserializeOpUpdateAuthorizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10614 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10615) { 10616 out, metadata, err = next.HandleDeserialize(ctx, in) 10617 if err != nil { 10618 return out, metadata, err 10619 } 10620 10621 response, ok := out.RawResponse.(*smithyhttp.Response) 10622 if !ok { 10623 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10624 } 10625 10626 if response.StatusCode < 200 || response.StatusCode >= 300 { 10627 return out, metadata, awsRestjson1_deserializeOpErrorUpdateAuthorizer(response, &metadata) 10628 } 10629 output := &UpdateAuthorizerOutput{} 10630 out.Result = output 10631 10632 var buff [1024]byte 10633 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10634 10635 body := io.TeeReader(response.Body, ringBuffer) 10636 10637 decoder := json.NewDecoder(body) 10638 decoder.UseNumber() 10639 var shape interface{} 10640 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10641 var snapshot bytes.Buffer 10642 io.Copy(&snapshot, ringBuffer) 10643 err = &smithy.DeserializationError{ 10644 Err: fmt.Errorf("failed to decode response body, %w", err), 10645 Snapshot: snapshot.Bytes(), 10646 } 10647 return out, metadata, err 10648 } 10649 10650 err = awsRestjson1_deserializeOpDocumentUpdateAuthorizerOutput(&output, shape) 10651 if err != nil { 10652 var snapshot bytes.Buffer 10653 io.Copy(&snapshot, ringBuffer) 10654 return out, metadata, &smithy.DeserializationError{ 10655 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10656 Snapshot: snapshot.Bytes(), 10657 } 10658 } 10659 10660 return out, metadata, err 10661} 10662 10663func awsRestjson1_deserializeOpErrorUpdateAuthorizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10664 var errorBuffer bytes.Buffer 10665 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10666 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10667 } 10668 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10669 10670 errorCode := "UnknownError" 10671 errorMessage := errorCode 10672 10673 code := response.Header.Get("X-Amzn-ErrorType") 10674 if len(code) != 0 { 10675 errorCode = restjson.SanitizeErrorCode(code) 10676 } 10677 10678 var buff [1024]byte 10679 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10680 10681 body := io.TeeReader(errorBody, ringBuffer) 10682 decoder := json.NewDecoder(body) 10683 decoder.UseNumber() 10684 code, message, err := restjson.GetErrorInfo(decoder) 10685 if err != nil { 10686 var snapshot bytes.Buffer 10687 io.Copy(&snapshot, ringBuffer) 10688 err = &smithy.DeserializationError{ 10689 Err: fmt.Errorf("failed to decode response body, %w", err), 10690 Snapshot: snapshot.Bytes(), 10691 } 10692 return err 10693 } 10694 10695 errorBody.Seek(0, io.SeekStart) 10696 if len(code) != 0 { 10697 errorCode = restjson.SanitizeErrorCode(code) 10698 } 10699 if len(message) != 0 { 10700 errorMessage = message 10701 } 10702 10703 switch { 10704 case strings.EqualFold("BadRequestException", errorCode): 10705 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10706 10707 case strings.EqualFold("ConflictException", errorCode): 10708 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10709 10710 case strings.EqualFold("NotFoundException", errorCode): 10711 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10712 10713 case strings.EqualFold("TooManyRequestsException", errorCode): 10714 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10715 10716 default: 10717 genericError := &smithy.GenericAPIError{ 10718 Code: errorCode, 10719 Message: errorMessage, 10720 } 10721 return genericError 10722 10723 } 10724} 10725 10726func awsRestjson1_deserializeOpDocumentUpdateAuthorizerOutput(v **UpdateAuthorizerOutput, value interface{}) error { 10727 if v == nil { 10728 return fmt.Errorf("unexpected nil of type %T", v) 10729 } 10730 if value == nil { 10731 return nil 10732 } 10733 10734 shape, ok := value.(map[string]interface{}) 10735 if !ok { 10736 return fmt.Errorf("unexpected JSON type %v", value) 10737 } 10738 10739 var sv *UpdateAuthorizerOutput 10740 if *v == nil { 10741 sv = &UpdateAuthorizerOutput{} 10742 } else { 10743 sv = *v 10744 } 10745 10746 for key, value := range shape { 10747 switch key { 10748 case "authorizerCredentialsArn": 10749 if value != nil { 10750 jtv, ok := value.(string) 10751 if !ok { 10752 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 10753 } 10754 sv.AuthorizerCredentialsArn = ptr.String(jtv) 10755 } 10756 10757 case "authorizerId": 10758 if value != nil { 10759 jtv, ok := value.(string) 10760 if !ok { 10761 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10762 } 10763 sv.AuthorizerId = ptr.String(jtv) 10764 } 10765 10766 case "authorizerPayloadFormatVersion": 10767 if value != nil { 10768 jtv, ok := value.(string) 10769 if !ok { 10770 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 10771 } 10772 sv.AuthorizerPayloadFormatVersion = ptr.String(jtv) 10773 } 10774 10775 case "authorizerResultTtlInSeconds": 10776 if value != nil { 10777 jtv, ok := value.(json.Number) 10778 if !ok { 10779 return fmt.Errorf("expected IntegerWithLengthBetween0And3600 to be json.Number, got %T instead", value) 10780 } 10781 i64, err := jtv.Int64() 10782 if err != nil { 10783 return err 10784 } 10785 sv.AuthorizerResultTtlInSeconds = int32(i64) 10786 } 10787 10788 case "authorizerType": 10789 if value != nil { 10790 jtv, ok := value.(string) 10791 if !ok { 10792 return fmt.Errorf("expected AuthorizerType to be of type string, got %T instead", value) 10793 } 10794 sv.AuthorizerType = types.AuthorizerType(jtv) 10795 } 10796 10797 case "authorizerUri": 10798 if value != nil { 10799 jtv, ok := value.(string) 10800 if !ok { 10801 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 10802 } 10803 sv.AuthorizerUri = ptr.String(jtv) 10804 } 10805 10806 case "enableSimpleResponses": 10807 if value != nil { 10808 jtv, ok := value.(bool) 10809 if !ok { 10810 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10811 } 10812 sv.EnableSimpleResponses = jtv 10813 } 10814 10815 case "identitySource": 10816 if err := awsRestjson1_deserializeDocumentIdentitySourceList(&sv.IdentitySource, value); err != nil { 10817 return err 10818 } 10819 10820 case "identityValidationExpression": 10821 if value != nil { 10822 jtv, ok := value.(string) 10823 if !ok { 10824 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 10825 } 10826 sv.IdentityValidationExpression = ptr.String(jtv) 10827 } 10828 10829 case "jwtConfiguration": 10830 if err := awsRestjson1_deserializeDocumentJWTConfiguration(&sv.JwtConfiguration, value); err != nil { 10831 return err 10832 } 10833 10834 case "name": 10835 if value != nil { 10836 jtv, ok := value.(string) 10837 if !ok { 10838 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 10839 } 10840 sv.Name = ptr.String(jtv) 10841 } 10842 10843 default: 10844 _, _ = key, value 10845 10846 } 10847 } 10848 *v = sv 10849 return nil 10850} 10851 10852type awsRestjson1_deserializeOpUpdateDeployment struct { 10853} 10854 10855func (*awsRestjson1_deserializeOpUpdateDeployment) ID() string { 10856 return "OperationDeserializer" 10857} 10858 10859func (m *awsRestjson1_deserializeOpUpdateDeployment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10860 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10861) { 10862 out, metadata, err = next.HandleDeserialize(ctx, in) 10863 if err != nil { 10864 return out, metadata, err 10865 } 10866 10867 response, ok := out.RawResponse.(*smithyhttp.Response) 10868 if !ok { 10869 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10870 } 10871 10872 if response.StatusCode < 200 || response.StatusCode >= 300 { 10873 return out, metadata, awsRestjson1_deserializeOpErrorUpdateDeployment(response, &metadata) 10874 } 10875 output := &UpdateDeploymentOutput{} 10876 out.Result = output 10877 10878 var buff [1024]byte 10879 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10880 10881 body := io.TeeReader(response.Body, ringBuffer) 10882 10883 decoder := json.NewDecoder(body) 10884 decoder.UseNumber() 10885 var shape interface{} 10886 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10887 var snapshot bytes.Buffer 10888 io.Copy(&snapshot, ringBuffer) 10889 err = &smithy.DeserializationError{ 10890 Err: fmt.Errorf("failed to decode response body, %w", err), 10891 Snapshot: snapshot.Bytes(), 10892 } 10893 return out, metadata, err 10894 } 10895 10896 err = awsRestjson1_deserializeOpDocumentUpdateDeploymentOutput(&output, shape) 10897 if err != nil { 10898 var snapshot bytes.Buffer 10899 io.Copy(&snapshot, ringBuffer) 10900 return out, metadata, &smithy.DeserializationError{ 10901 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10902 Snapshot: snapshot.Bytes(), 10903 } 10904 } 10905 10906 return out, metadata, err 10907} 10908 10909func awsRestjson1_deserializeOpErrorUpdateDeployment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10910 var errorBuffer bytes.Buffer 10911 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10912 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10913 } 10914 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10915 10916 errorCode := "UnknownError" 10917 errorMessage := errorCode 10918 10919 code := response.Header.Get("X-Amzn-ErrorType") 10920 if len(code) != 0 { 10921 errorCode = restjson.SanitizeErrorCode(code) 10922 } 10923 10924 var buff [1024]byte 10925 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10926 10927 body := io.TeeReader(errorBody, ringBuffer) 10928 decoder := json.NewDecoder(body) 10929 decoder.UseNumber() 10930 code, message, err := restjson.GetErrorInfo(decoder) 10931 if err != nil { 10932 var snapshot bytes.Buffer 10933 io.Copy(&snapshot, ringBuffer) 10934 err = &smithy.DeserializationError{ 10935 Err: fmt.Errorf("failed to decode response body, %w", err), 10936 Snapshot: snapshot.Bytes(), 10937 } 10938 return err 10939 } 10940 10941 errorBody.Seek(0, io.SeekStart) 10942 if len(code) != 0 { 10943 errorCode = restjson.SanitizeErrorCode(code) 10944 } 10945 if len(message) != 0 { 10946 errorMessage = message 10947 } 10948 10949 switch { 10950 case strings.EqualFold("BadRequestException", errorCode): 10951 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10952 10953 case strings.EqualFold("ConflictException", errorCode): 10954 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10955 10956 case strings.EqualFold("NotFoundException", errorCode): 10957 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10958 10959 case strings.EqualFold("TooManyRequestsException", errorCode): 10960 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10961 10962 default: 10963 genericError := &smithy.GenericAPIError{ 10964 Code: errorCode, 10965 Message: errorMessage, 10966 } 10967 return genericError 10968 10969 } 10970} 10971 10972func awsRestjson1_deserializeOpDocumentUpdateDeploymentOutput(v **UpdateDeploymentOutput, value interface{}) error { 10973 if v == nil { 10974 return fmt.Errorf("unexpected nil of type %T", v) 10975 } 10976 if value == nil { 10977 return nil 10978 } 10979 10980 shape, ok := value.(map[string]interface{}) 10981 if !ok { 10982 return fmt.Errorf("unexpected JSON type %v", value) 10983 } 10984 10985 var sv *UpdateDeploymentOutput 10986 if *v == nil { 10987 sv = &UpdateDeploymentOutput{} 10988 } else { 10989 sv = *v 10990 } 10991 10992 for key, value := range shape { 10993 switch key { 10994 case "autoDeployed": 10995 if value != nil { 10996 jtv, ok := value.(bool) 10997 if !ok { 10998 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10999 } 11000 sv.AutoDeployed = jtv 11001 } 11002 11003 case "createdDate": 11004 if value != nil { 11005 jtv, ok := value.(string) 11006 if !ok { 11007 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 11008 } 11009 t, err := smithytime.ParseDateTime(jtv) 11010 if err != nil { 11011 return err 11012 } 11013 sv.CreatedDate = ptr.Time(t) 11014 } 11015 11016 case "deploymentId": 11017 if value != nil { 11018 jtv, ok := value.(string) 11019 if !ok { 11020 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11021 } 11022 sv.DeploymentId = ptr.String(jtv) 11023 } 11024 11025 case "deploymentStatus": 11026 if value != nil { 11027 jtv, ok := value.(string) 11028 if !ok { 11029 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 11030 } 11031 sv.DeploymentStatus = types.DeploymentStatus(jtv) 11032 } 11033 11034 case "deploymentStatusMessage": 11035 if value != nil { 11036 jtv, ok := value.(string) 11037 if !ok { 11038 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 11039 } 11040 sv.DeploymentStatusMessage = ptr.String(jtv) 11041 } 11042 11043 case "description": 11044 if value != nil { 11045 jtv, ok := value.(string) 11046 if !ok { 11047 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 11048 } 11049 sv.Description = ptr.String(jtv) 11050 } 11051 11052 default: 11053 _, _ = key, value 11054 11055 } 11056 } 11057 *v = sv 11058 return nil 11059} 11060 11061type awsRestjson1_deserializeOpUpdateDomainName struct { 11062} 11063 11064func (*awsRestjson1_deserializeOpUpdateDomainName) ID() string { 11065 return "OperationDeserializer" 11066} 11067 11068func (m *awsRestjson1_deserializeOpUpdateDomainName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11069 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11070) { 11071 out, metadata, err = next.HandleDeserialize(ctx, in) 11072 if err != nil { 11073 return out, metadata, err 11074 } 11075 11076 response, ok := out.RawResponse.(*smithyhttp.Response) 11077 if !ok { 11078 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11079 } 11080 11081 if response.StatusCode < 200 || response.StatusCode >= 300 { 11082 return out, metadata, awsRestjson1_deserializeOpErrorUpdateDomainName(response, &metadata) 11083 } 11084 output := &UpdateDomainNameOutput{} 11085 out.Result = output 11086 11087 var buff [1024]byte 11088 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11089 11090 body := io.TeeReader(response.Body, ringBuffer) 11091 11092 decoder := json.NewDecoder(body) 11093 decoder.UseNumber() 11094 var shape interface{} 11095 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11096 var snapshot bytes.Buffer 11097 io.Copy(&snapshot, ringBuffer) 11098 err = &smithy.DeserializationError{ 11099 Err: fmt.Errorf("failed to decode response body, %w", err), 11100 Snapshot: snapshot.Bytes(), 11101 } 11102 return out, metadata, err 11103 } 11104 11105 err = awsRestjson1_deserializeOpDocumentUpdateDomainNameOutput(&output, shape) 11106 if err != nil { 11107 var snapshot bytes.Buffer 11108 io.Copy(&snapshot, ringBuffer) 11109 return out, metadata, &smithy.DeserializationError{ 11110 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11111 Snapshot: snapshot.Bytes(), 11112 } 11113 } 11114 11115 return out, metadata, err 11116} 11117 11118func awsRestjson1_deserializeOpErrorUpdateDomainName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11119 var errorBuffer bytes.Buffer 11120 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11121 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11122 } 11123 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11124 11125 errorCode := "UnknownError" 11126 errorMessage := errorCode 11127 11128 code := response.Header.Get("X-Amzn-ErrorType") 11129 if len(code) != 0 { 11130 errorCode = restjson.SanitizeErrorCode(code) 11131 } 11132 11133 var buff [1024]byte 11134 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11135 11136 body := io.TeeReader(errorBody, ringBuffer) 11137 decoder := json.NewDecoder(body) 11138 decoder.UseNumber() 11139 code, message, err := restjson.GetErrorInfo(decoder) 11140 if err != nil { 11141 var snapshot bytes.Buffer 11142 io.Copy(&snapshot, ringBuffer) 11143 err = &smithy.DeserializationError{ 11144 Err: fmt.Errorf("failed to decode response body, %w", err), 11145 Snapshot: snapshot.Bytes(), 11146 } 11147 return err 11148 } 11149 11150 errorBody.Seek(0, io.SeekStart) 11151 if len(code) != 0 { 11152 errorCode = restjson.SanitizeErrorCode(code) 11153 } 11154 if len(message) != 0 { 11155 errorMessage = message 11156 } 11157 11158 switch { 11159 case strings.EqualFold("BadRequestException", errorCode): 11160 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 11161 11162 case strings.EqualFold("ConflictException", errorCode): 11163 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11164 11165 case strings.EqualFold("NotFoundException", errorCode): 11166 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 11167 11168 case strings.EqualFold("TooManyRequestsException", errorCode): 11169 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 11170 11171 default: 11172 genericError := &smithy.GenericAPIError{ 11173 Code: errorCode, 11174 Message: errorMessage, 11175 } 11176 return genericError 11177 11178 } 11179} 11180 11181func awsRestjson1_deserializeOpDocumentUpdateDomainNameOutput(v **UpdateDomainNameOutput, value interface{}) error { 11182 if v == nil { 11183 return fmt.Errorf("unexpected nil of type %T", v) 11184 } 11185 if value == nil { 11186 return nil 11187 } 11188 11189 shape, ok := value.(map[string]interface{}) 11190 if !ok { 11191 return fmt.Errorf("unexpected JSON type %v", value) 11192 } 11193 11194 var sv *UpdateDomainNameOutput 11195 if *v == nil { 11196 sv = &UpdateDomainNameOutput{} 11197 } else { 11198 sv = *v 11199 } 11200 11201 for key, value := range shape { 11202 switch key { 11203 case "apiMappingSelectionExpression": 11204 if value != nil { 11205 jtv, ok := value.(string) 11206 if !ok { 11207 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 11208 } 11209 sv.ApiMappingSelectionExpression = ptr.String(jtv) 11210 } 11211 11212 case "domainName": 11213 if value != nil { 11214 jtv, ok := value.(string) 11215 if !ok { 11216 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 11217 } 11218 sv.DomainName = ptr.String(jtv) 11219 } 11220 11221 case "domainNameConfigurations": 11222 if err := awsRestjson1_deserializeDocumentDomainNameConfigurations(&sv.DomainNameConfigurations, value); err != nil { 11223 return err 11224 } 11225 11226 case "mutualTlsAuthentication": 11227 if err := awsRestjson1_deserializeDocumentMutualTlsAuthentication(&sv.MutualTlsAuthentication, value); err != nil { 11228 return err 11229 } 11230 11231 case "tags": 11232 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 11233 return err 11234 } 11235 11236 default: 11237 _, _ = key, value 11238 11239 } 11240 } 11241 *v = sv 11242 return nil 11243} 11244 11245type awsRestjson1_deserializeOpUpdateIntegration struct { 11246} 11247 11248func (*awsRestjson1_deserializeOpUpdateIntegration) ID() string { 11249 return "OperationDeserializer" 11250} 11251 11252func (m *awsRestjson1_deserializeOpUpdateIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11253 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11254) { 11255 out, metadata, err = next.HandleDeserialize(ctx, in) 11256 if err != nil { 11257 return out, metadata, err 11258 } 11259 11260 response, ok := out.RawResponse.(*smithyhttp.Response) 11261 if !ok { 11262 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11263 } 11264 11265 if response.StatusCode < 200 || response.StatusCode >= 300 { 11266 return out, metadata, awsRestjson1_deserializeOpErrorUpdateIntegration(response, &metadata) 11267 } 11268 output := &UpdateIntegrationOutput{} 11269 out.Result = output 11270 11271 var buff [1024]byte 11272 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11273 11274 body := io.TeeReader(response.Body, ringBuffer) 11275 11276 decoder := json.NewDecoder(body) 11277 decoder.UseNumber() 11278 var shape interface{} 11279 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11280 var snapshot bytes.Buffer 11281 io.Copy(&snapshot, ringBuffer) 11282 err = &smithy.DeserializationError{ 11283 Err: fmt.Errorf("failed to decode response body, %w", err), 11284 Snapshot: snapshot.Bytes(), 11285 } 11286 return out, metadata, err 11287 } 11288 11289 err = awsRestjson1_deserializeOpDocumentUpdateIntegrationOutput(&output, shape) 11290 if err != nil { 11291 var snapshot bytes.Buffer 11292 io.Copy(&snapshot, ringBuffer) 11293 return out, metadata, &smithy.DeserializationError{ 11294 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11295 Snapshot: snapshot.Bytes(), 11296 } 11297 } 11298 11299 return out, metadata, err 11300} 11301 11302func awsRestjson1_deserializeOpErrorUpdateIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11303 var errorBuffer bytes.Buffer 11304 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11305 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11306 } 11307 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11308 11309 errorCode := "UnknownError" 11310 errorMessage := errorCode 11311 11312 code := response.Header.Get("X-Amzn-ErrorType") 11313 if len(code) != 0 { 11314 errorCode = restjson.SanitizeErrorCode(code) 11315 } 11316 11317 var buff [1024]byte 11318 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11319 11320 body := io.TeeReader(errorBody, ringBuffer) 11321 decoder := json.NewDecoder(body) 11322 decoder.UseNumber() 11323 code, message, err := restjson.GetErrorInfo(decoder) 11324 if err != nil { 11325 var snapshot bytes.Buffer 11326 io.Copy(&snapshot, ringBuffer) 11327 err = &smithy.DeserializationError{ 11328 Err: fmt.Errorf("failed to decode response body, %w", err), 11329 Snapshot: snapshot.Bytes(), 11330 } 11331 return err 11332 } 11333 11334 errorBody.Seek(0, io.SeekStart) 11335 if len(code) != 0 { 11336 errorCode = restjson.SanitizeErrorCode(code) 11337 } 11338 if len(message) != 0 { 11339 errorMessage = message 11340 } 11341 11342 switch { 11343 case strings.EqualFold("BadRequestException", errorCode): 11344 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 11345 11346 case strings.EqualFold("ConflictException", errorCode): 11347 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11348 11349 case strings.EqualFold("NotFoundException", errorCode): 11350 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 11351 11352 case strings.EqualFold("TooManyRequestsException", errorCode): 11353 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 11354 11355 default: 11356 genericError := &smithy.GenericAPIError{ 11357 Code: errorCode, 11358 Message: errorMessage, 11359 } 11360 return genericError 11361 11362 } 11363} 11364 11365func awsRestjson1_deserializeOpDocumentUpdateIntegrationOutput(v **UpdateIntegrationOutput, value interface{}) error { 11366 if v == nil { 11367 return fmt.Errorf("unexpected nil of type %T", v) 11368 } 11369 if value == nil { 11370 return nil 11371 } 11372 11373 shape, ok := value.(map[string]interface{}) 11374 if !ok { 11375 return fmt.Errorf("unexpected JSON type %v", value) 11376 } 11377 11378 var sv *UpdateIntegrationOutput 11379 if *v == nil { 11380 sv = &UpdateIntegrationOutput{} 11381 } else { 11382 sv = *v 11383 } 11384 11385 for key, value := range shape { 11386 switch key { 11387 case "apiGatewayManaged": 11388 if value != nil { 11389 jtv, ok := value.(bool) 11390 if !ok { 11391 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 11392 } 11393 sv.ApiGatewayManaged = jtv 11394 } 11395 11396 case "connectionId": 11397 if value != nil { 11398 jtv, ok := value.(string) 11399 if !ok { 11400 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 11401 } 11402 sv.ConnectionId = ptr.String(jtv) 11403 } 11404 11405 case "connectionType": 11406 if value != nil { 11407 jtv, ok := value.(string) 11408 if !ok { 11409 return fmt.Errorf("expected ConnectionType to be of type string, got %T instead", value) 11410 } 11411 sv.ConnectionType = types.ConnectionType(jtv) 11412 } 11413 11414 case "contentHandlingStrategy": 11415 if value != nil { 11416 jtv, ok := value.(string) 11417 if !ok { 11418 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 11419 } 11420 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 11421 } 11422 11423 case "credentialsArn": 11424 if value != nil { 11425 jtv, ok := value.(string) 11426 if !ok { 11427 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11428 } 11429 sv.CredentialsArn = ptr.String(jtv) 11430 } 11431 11432 case "description": 11433 if value != nil { 11434 jtv, ok := value.(string) 11435 if !ok { 11436 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 11437 } 11438 sv.Description = ptr.String(jtv) 11439 } 11440 11441 case "integrationId": 11442 if value != nil { 11443 jtv, ok := value.(string) 11444 if !ok { 11445 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11446 } 11447 sv.IntegrationId = ptr.String(jtv) 11448 } 11449 11450 case "integrationMethod": 11451 if value != nil { 11452 jtv, ok := value.(string) 11453 if !ok { 11454 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 11455 } 11456 sv.IntegrationMethod = ptr.String(jtv) 11457 } 11458 11459 case "integrationResponseSelectionExpression": 11460 if value != nil { 11461 jtv, ok := value.(string) 11462 if !ok { 11463 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 11464 } 11465 sv.IntegrationResponseSelectionExpression = ptr.String(jtv) 11466 } 11467 11468 case "integrationSubtype": 11469 if value != nil { 11470 jtv, ok := value.(string) 11471 if !ok { 11472 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 11473 } 11474 sv.IntegrationSubtype = ptr.String(jtv) 11475 } 11476 11477 case "integrationType": 11478 if value != nil { 11479 jtv, ok := value.(string) 11480 if !ok { 11481 return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) 11482 } 11483 sv.IntegrationType = types.IntegrationType(jtv) 11484 } 11485 11486 case "integrationUri": 11487 if value != nil { 11488 jtv, ok := value.(string) 11489 if !ok { 11490 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 11491 } 11492 sv.IntegrationUri = ptr.String(jtv) 11493 } 11494 11495 case "passthroughBehavior": 11496 if value != nil { 11497 jtv, ok := value.(string) 11498 if !ok { 11499 return fmt.Errorf("expected PassthroughBehavior to be of type string, got %T instead", value) 11500 } 11501 sv.PassthroughBehavior = types.PassthroughBehavior(jtv) 11502 } 11503 11504 case "payloadFormatVersion": 11505 if value != nil { 11506 jtv, ok := value.(string) 11507 if !ok { 11508 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 11509 } 11510 sv.PayloadFormatVersion = ptr.String(jtv) 11511 } 11512 11513 case "requestParameters": 11514 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.RequestParameters, value); err != nil { 11515 return err 11516 } 11517 11518 case "requestTemplates": 11519 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.RequestTemplates, value); err != nil { 11520 return err 11521 } 11522 11523 case "responseParameters": 11524 if err := awsRestjson1_deserializeDocumentResponseParameters(&sv.ResponseParameters, value); err != nil { 11525 return err 11526 } 11527 11528 case "templateSelectionExpression": 11529 if value != nil { 11530 jtv, ok := value.(string) 11531 if !ok { 11532 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 11533 } 11534 sv.TemplateSelectionExpression = ptr.String(jtv) 11535 } 11536 11537 case "timeoutInMillis": 11538 if value != nil { 11539 jtv, ok := value.(json.Number) 11540 if !ok { 11541 return fmt.Errorf("expected IntegerWithLengthBetween50And30000 to be json.Number, got %T instead", value) 11542 } 11543 i64, err := jtv.Int64() 11544 if err != nil { 11545 return err 11546 } 11547 sv.TimeoutInMillis = int32(i64) 11548 } 11549 11550 case "tlsConfig": 11551 if err := awsRestjson1_deserializeDocumentTlsConfig(&sv.TlsConfig, value); err != nil { 11552 return err 11553 } 11554 11555 default: 11556 _, _ = key, value 11557 11558 } 11559 } 11560 *v = sv 11561 return nil 11562} 11563 11564type awsRestjson1_deserializeOpUpdateIntegrationResponse struct { 11565} 11566 11567func (*awsRestjson1_deserializeOpUpdateIntegrationResponse) ID() string { 11568 return "OperationDeserializer" 11569} 11570 11571func (m *awsRestjson1_deserializeOpUpdateIntegrationResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11572 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11573) { 11574 out, metadata, err = next.HandleDeserialize(ctx, in) 11575 if err != nil { 11576 return out, metadata, err 11577 } 11578 11579 response, ok := out.RawResponse.(*smithyhttp.Response) 11580 if !ok { 11581 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11582 } 11583 11584 if response.StatusCode < 200 || response.StatusCode >= 300 { 11585 return out, metadata, awsRestjson1_deserializeOpErrorUpdateIntegrationResponse(response, &metadata) 11586 } 11587 output := &UpdateIntegrationResponseOutput{} 11588 out.Result = output 11589 11590 var buff [1024]byte 11591 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11592 11593 body := io.TeeReader(response.Body, ringBuffer) 11594 11595 decoder := json.NewDecoder(body) 11596 decoder.UseNumber() 11597 var shape interface{} 11598 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11599 var snapshot bytes.Buffer 11600 io.Copy(&snapshot, ringBuffer) 11601 err = &smithy.DeserializationError{ 11602 Err: fmt.Errorf("failed to decode response body, %w", err), 11603 Snapshot: snapshot.Bytes(), 11604 } 11605 return out, metadata, err 11606 } 11607 11608 err = awsRestjson1_deserializeOpDocumentUpdateIntegrationResponseOutput(&output, shape) 11609 if err != nil { 11610 var snapshot bytes.Buffer 11611 io.Copy(&snapshot, ringBuffer) 11612 return out, metadata, &smithy.DeserializationError{ 11613 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11614 Snapshot: snapshot.Bytes(), 11615 } 11616 } 11617 11618 return out, metadata, err 11619} 11620 11621func awsRestjson1_deserializeOpErrorUpdateIntegrationResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11622 var errorBuffer bytes.Buffer 11623 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11624 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11625 } 11626 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11627 11628 errorCode := "UnknownError" 11629 errorMessage := errorCode 11630 11631 code := response.Header.Get("X-Amzn-ErrorType") 11632 if len(code) != 0 { 11633 errorCode = restjson.SanitizeErrorCode(code) 11634 } 11635 11636 var buff [1024]byte 11637 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11638 11639 body := io.TeeReader(errorBody, ringBuffer) 11640 decoder := json.NewDecoder(body) 11641 decoder.UseNumber() 11642 code, message, err := restjson.GetErrorInfo(decoder) 11643 if err != nil { 11644 var snapshot bytes.Buffer 11645 io.Copy(&snapshot, ringBuffer) 11646 err = &smithy.DeserializationError{ 11647 Err: fmt.Errorf("failed to decode response body, %w", err), 11648 Snapshot: snapshot.Bytes(), 11649 } 11650 return err 11651 } 11652 11653 errorBody.Seek(0, io.SeekStart) 11654 if len(code) != 0 { 11655 errorCode = restjson.SanitizeErrorCode(code) 11656 } 11657 if len(message) != 0 { 11658 errorMessage = message 11659 } 11660 11661 switch { 11662 case strings.EqualFold("BadRequestException", errorCode): 11663 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 11664 11665 case strings.EqualFold("ConflictException", errorCode): 11666 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11667 11668 case strings.EqualFold("NotFoundException", errorCode): 11669 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 11670 11671 case strings.EqualFold("TooManyRequestsException", errorCode): 11672 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 11673 11674 default: 11675 genericError := &smithy.GenericAPIError{ 11676 Code: errorCode, 11677 Message: errorMessage, 11678 } 11679 return genericError 11680 11681 } 11682} 11683 11684func awsRestjson1_deserializeOpDocumentUpdateIntegrationResponseOutput(v **UpdateIntegrationResponseOutput, value interface{}) error { 11685 if v == nil { 11686 return fmt.Errorf("unexpected nil of type %T", v) 11687 } 11688 if value == nil { 11689 return nil 11690 } 11691 11692 shape, ok := value.(map[string]interface{}) 11693 if !ok { 11694 return fmt.Errorf("unexpected JSON type %v", value) 11695 } 11696 11697 var sv *UpdateIntegrationResponseOutput 11698 if *v == nil { 11699 sv = &UpdateIntegrationResponseOutput{} 11700 } else { 11701 sv = *v 11702 } 11703 11704 for key, value := range shape { 11705 switch key { 11706 case "contentHandlingStrategy": 11707 if value != nil { 11708 jtv, ok := value.(string) 11709 if !ok { 11710 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 11711 } 11712 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 11713 } 11714 11715 case "integrationResponseId": 11716 if value != nil { 11717 jtv, ok := value.(string) 11718 if !ok { 11719 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11720 } 11721 sv.IntegrationResponseId = ptr.String(jtv) 11722 } 11723 11724 case "integrationResponseKey": 11725 if value != nil { 11726 jtv, ok := value.(string) 11727 if !ok { 11728 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 11729 } 11730 sv.IntegrationResponseKey = ptr.String(jtv) 11731 } 11732 11733 case "responseParameters": 11734 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.ResponseParameters, value); err != nil { 11735 return err 11736 } 11737 11738 case "responseTemplates": 11739 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.ResponseTemplates, value); err != nil { 11740 return err 11741 } 11742 11743 case "templateSelectionExpression": 11744 if value != nil { 11745 jtv, ok := value.(string) 11746 if !ok { 11747 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 11748 } 11749 sv.TemplateSelectionExpression = ptr.String(jtv) 11750 } 11751 11752 default: 11753 _, _ = key, value 11754 11755 } 11756 } 11757 *v = sv 11758 return nil 11759} 11760 11761type awsRestjson1_deserializeOpUpdateModel struct { 11762} 11763 11764func (*awsRestjson1_deserializeOpUpdateModel) ID() string { 11765 return "OperationDeserializer" 11766} 11767 11768func (m *awsRestjson1_deserializeOpUpdateModel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11769 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11770) { 11771 out, metadata, err = next.HandleDeserialize(ctx, in) 11772 if err != nil { 11773 return out, metadata, err 11774 } 11775 11776 response, ok := out.RawResponse.(*smithyhttp.Response) 11777 if !ok { 11778 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11779 } 11780 11781 if response.StatusCode < 200 || response.StatusCode >= 300 { 11782 return out, metadata, awsRestjson1_deserializeOpErrorUpdateModel(response, &metadata) 11783 } 11784 output := &UpdateModelOutput{} 11785 out.Result = output 11786 11787 var buff [1024]byte 11788 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11789 11790 body := io.TeeReader(response.Body, ringBuffer) 11791 11792 decoder := json.NewDecoder(body) 11793 decoder.UseNumber() 11794 var shape interface{} 11795 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11796 var snapshot bytes.Buffer 11797 io.Copy(&snapshot, ringBuffer) 11798 err = &smithy.DeserializationError{ 11799 Err: fmt.Errorf("failed to decode response body, %w", err), 11800 Snapshot: snapshot.Bytes(), 11801 } 11802 return out, metadata, err 11803 } 11804 11805 err = awsRestjson1_deserializeOpDocumentUpdateModelOutput(&output, shape) 11806 if err != nil { 11807 var snapshot bytes.Buffer 11808 io.Copy(&snapshot, ringBuffer) 11809 return out, metadata, &smithy.DeserializationError{ 11810 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11811 Snapshot: snapshot.Bytes(), 11812 } 11813 } 11814 11815 return out, metadata, err 11816} 11817 11818func awsRestjson1_deserializeOpErrorUpdateModel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11819 var errorBuffer bytes.Buffer 11820 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11821 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11822 } 11823 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11824 11825 errorCode := "UnknownError" 11826 errorMessage := errorCode 11827 11828 code := response.Header.Get("X-Amzn-ErrorType") 11829 if len(code) != 0 { 11830 errorCode = restjson.SanitizeErrorCode(code) 11831 } 11832 11833 var buff [1024]byte 11834 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11835 11836 body := io.TeeReader(errorBody, ringBuffer) 11837 decoder := json.NewDecoder(body) 11838 decoder.UseNumber() 11839 code, message, err := restjson.GetErrorInfo(decoder) 11840 if err != nil { 11841 var snapshot bytes.Buffer 11842 io.Copy(&snapshot, ringBuffer) 11843 err = &smithy.DeserializationError{ 11844 Err: fmt.Errorf("failed to decode response body, %w", err), 11845 Snapshot: snapshot.Bytes(), 11846 } 11847 return err 11848 } 11849 11850 errorBody.Seek(0, io.SeekStart) 11851 if len(code) != 0 { 11852 errorCode = restjson.SanitizeErrorCode(code) 11853 } 11854 if len(message) != 0 { 11855 errorMessage = message 11856 } 11857 11858 switch { 11859 case strings.EqualFold("BadRequestException", errorCode): 11860 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 11861 11862 case strings.EqualFold("ConflictException", errorCode): 11863 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11864 11865 case strings.EqualFold("NotFoundException", errorCode): 11866 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 11867 11868 case strings.EqualFold("TooManyRequestsException", errorCode): 11869 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 11870 11871 default: 11872 genericError := &smithy.GenericAPIError{ 11873 Code: errorCode, 11874 Message: errorMessage, 11875 } 11876 return genericError 11877 11878 } 11879} 11880 11881func awsRestjson1_deserializeOpDocumentUpdateModelOutput(v **UpdateModelOutput, value interface{}) error { 11882 if v == nil { 11883 return fmt.Errorf("unexpected nil of type %T", v) 11884 } 11885 if value == nil { 11886 return nil 11887 } 11888 11889 shape, ok := value.(map[string]interface{}) 11890 if !ok { 11891 return fmt.Errorf("unexpected JSON type %v", value) 11892 } 11893 11894 var sv *UpdateModelOutput 11895 if *v == nil { 11896 sv = &UpdateModelOutput{} 11897 } else { 11898 sv = *v 11899 } 11900 11901 for key, value := range shape { 11902 switch key { 11903 case "contentType": 11904 if value != nil { 11905 jtv, ok := value.(string) 11906 if !ok { 11907 return fmt.Errorf("expected StringWithLengthBetween1And256 to be of type string, got %T instead", value) 11908 } 11909 sv.ContentType = ptr.String(jtv) 11910 } 11911 11912 case "description": 11913 if value != nil { 11914 jtv, ok := value.(string) 11915 if !ok { 11916 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 11917 } 11918 sv.Description = ptr.String(jtv) 11919 } 11920 11921 case "modelId": 11922 if value != nil { 11923 jtv, ok := value.(string) 11924 if !ok { 11925 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11926 } 11927 sv.ModelId = ptr.String(jtv) 11928 } 11929 11930 case "name": 11931 if value != nil { 11932 jtv, ok := value.(string) 11933 if !ok { 11934 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 11935 } 11936 sv.Name = ptr.String(jtv) 11937 } 11938 11939 case "schema": 11940 if value != nil { 11941 jtv, ok := value.(string) 11942 if !ok { 11943 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 11944 } 11945 sv.Schema = ptr.String(jtv) 11946 } 11947 11948 default: 11949 _, _ = key, value 11950 11951 } 11952 } 11953 *v = sv 11954 return nil 11955} 11956 11957type awsRestjson1_deserializeOpUpdateRoute struct { 11958} 11959 11960func (*awsRestjson1_deserializeOpUpdateRoute) ID() string { 11961 return "OperationDeserializer" 11962} 11963 11964func (m *awsRestjson1_deserializeOpUpdateRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11965 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11966) { 11967 out, metadata, err = next.HandleDeserialize(ctx, in) 11968 if err != nil { 11969 return out, metadata, err 11970 } 11971 11972 response, ok := out.RawResponse.(*smithyhttp.Response) 11973 if !ok { 11974 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11975 } 11976 11977 if response.StatusCode < 200 || response.StatusCode >= 300 { 11978 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoute(response, &metadata) 11979 } 11980 output := &UpdateRouteOutput{} 11981 out.Result = output 11982 11983 var buff [1024]byte 11984 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11985 11986 body := io.TeeReader(response.Body, ringBuffer) 11987 11988 decoder := json.NewDecoder(body) 11989 decoder.UseNumber() 11990 var shape interface{} 11991 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11992 var snapshot bytes.Buffer 11993 io.Copy(&snapshot, ringBuffer) 11994 err = &smithy.DeserializationError{ 11995 Err: fmt.Errorf("failed to decode response body, %w", err), 11996 Snapshot: snapshot.Bytes(), 11997 } 11998 return out, metadata, err 11999 } 12000 12001 err = awsRestjson1_deserializeOpDocumentUpdateRouteOutput(&output, shape) 12002 if err != nil { 12003 var snapshot bytes.Buffer 12004 io.Copy(&snapshot, ringBuffer) 12005 return out, metadata, &smithy.DeserializationError{ 12006 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 12007 Snapshot: snapshot.Bytes(), 12008 } 12009 } 12010 12011 return out, metadata, err 12012} 12013 12014func awsRestjson1_deserializeOpErrorUpdateRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12015 var errorBuffer bytes.Buffer 12016 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12017 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12018 } 12019 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12020 12021 errorCode := "UnknownError" 12022 errorMessage := errorCode 12023 12024 code := response.Header.Get("X-Amzn-ErrorType") 12025 if len(code) != 0 { 12026 errorCode = restjson.SanitizeErrorCode(code) 12027 } 12028 12029 var buff [1024]byte 12030 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12031 12032 body := io.TeeReader(errorBody, ringBuffer) 12033 decoder := json.NewDecoder(body) 12034 decoder.UseNumber() 12035 code, message, err := restjson.GetErrorInfo(decoder) 12036 if err != nil { 12037 var snapshot bytes.Buffer 12038 io.Copy(&snapshot, ringBuffer) 12039 err = &smithy.DeserializationError{ 12040 Err: fmt.Errorf("failed to decode response body, %w", err), 12041 Snapshot: snapshot.Bytes(), 12042 } 12043 return err 12044 } 12045 12046 errorBody.Seek(0, io.SeekStart) 12047 if len(code) != 0 { 12048 errorCode = restjson.SanitizeErrorCode(code) 12049 } 12050 if len(message) != 0 { 12051 errorMessage = message 12052 } 12053 12054 switch { 12055 case strings.EqualFold("BadRequestException", errorCode): 12056 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 12057 12058 case strings.EqualFold("ConflictException", errorCode): 12059 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 12060 12061 case strings.EqualFold("NotFoundException", errorCode): 12062 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 12063 12064 case strings.EqualFold("TooManyRequestsException", errorCode): 12065 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 12066 12067 default: 12068 genericError := &smithy.GenericAPIError{ 12069 Code: errorCode, 12070 Message: errorMessage, 12071 } 12072 return genericError 12073 12074 } 12075} 12076 12077func awsRestjson1_deserializeOpDocumentUpdateRouteOutput(v **UpdateRouteOutput, value interface{}) error { 12078 if v == nil { 12079 return fmt.Errorf("unexpected nil of type %T", v) 12080 } 12081 if value == nil { 12082 return nil 12083 } 12084 12085 shape, ok := value.(map[string]interface{}) 12086 if !ok { 12087 return fmt.Errorf("unexpected JSON type %v", value) 12088 } 12089 12090 var sv *UpdateRouteOutput 12091 if *v == nil { 12092 sv = &UpdateRouteOutput{} 12093 } else { 12094 sv = *v 12095 } 12096 12097 for key, value := range shape { 12098 switch key { 12099 case "apiGatewayManaged": 12100 if value != nil { 12101 jtv, ok := value.(bool) 12102 if !ok { 12103 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 12104 } 12105 sv.ApiGatewayManaged = jtv 12106 } 12107 12108 case "apiKeyRequired": 12109 if value != nil { 12110 jtv, ok := value.(bool) 12111 if !ok { 12112 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 12113 } 12114 sv.ApiKeyRequired = jtv 12115 } 12116 12117 case "authorizationScopes": 12118 if err := awsRestjson1_deserializeDocumentAuthorizationScopes(&sv.AuthorizationScopes, value); err != nil { 12119 return err 12120 } 12121 12122 case "authorizationType": 12123 if value != nil { 12124 jtv, ok := value.(string) 12125 if !ok { 12126 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 12127 } 12128 sv.AuthorizationType = types.AuthorizationType(jtv) 12129 } 12130 12131 case "authorizerId": 12132 if value != nil { 12133 jtv, ok := value.(string) 12134 if !ok { 12135 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12136 } 12137 sv.AuthorizerId = ptr.String(jtv) 12138 } 12139 12140 case "modelSelectionExpression": 12141 if value != nil { 12142 jtv, ok := value.(string) 12143 if !ok { 12144 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 12145 } 12146 sv.ModelSelectionExpression = ptr.String(jtv) 12147 } 12148 12149 case "operationName": 12150 if value != nil { 12151 jtv, ok := value.(string) 12152 if !ok { 12153 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 12154 } 12155 sv.OperationName = ptr.String(jtv) 12156 } 12157 12158 case "requestModels": 12159 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.RequestModels, value); err != nil { 12160 return err 12161 } 12162 12163 case "requestParameters": 12164 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.RequestParameters, value); err != nil { 12165 return err 12166 } 12167 12168 case "routeId": 12169 if value != nil { 12170 jtv, ok := value.(string) 12171 if !ok { 12172 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12173 } 12174 sv.RouteId = ptr.String(jtv) 12175 } 12176 12177 case "routeKey": 12178 if value != nil { 12179 jtv, ok := value.(string) 12180 if !ok { 12181 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 12182 } 12183 sv.RouteKey = ptr.String(jtv) 12184 } 12185 12186 case "routeResponseSelectionExpression": 12187 if value != nil { 12188 jtv, ok := value.(string) 12189 if !ok { 12190 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 12191 } 12192 sv.RouteResponseSelectionExpression = ptr.String(jtv) 12193 } 12194 12195 case "target": 12196 if value != nil { 12197 jtv, ok := value.(string) 12198 if !ok { 12199 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 12200 } 12201 sv.Target = ptr.String(jtv) 12202 } 12203 12204 default: 12205 _, _ = key, value 12206 12207 } 12208 } 12209 *v = sv 12210 return nil 12211} 12212 12213type awsRestjson1_deserializeOpUpdateRouteResponse struct { 12214} 12215 12216func (*awsRestjson1_deserializeOpUpdateRouteResponse) ID() string { 12217 return "OperationDeserializer" 12218} 12219 12220func (m *awsRestjson1_deserializeOpUpdateRouteResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12221 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12222) { 12223 out, metadata, err = next.HandleDeserialize(ctx, in) 12224 if err != nil { 12225 return out, metadata, err 12226 } 12227 12228 response, ok := out.RawResponse.(*smithyhttp.Response) 12229 if !ok { 12230 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12231 } 12232 12233 if response.StatusCode < 200 || response.StatusCode >= 300 { 12234 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRouteResponse(response, &metadata) 12235 } 12236 output := &UpdateRouteResponseOutput{} 12237 out.Result = output 12238 12239 var buff [1024]byte 12240 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12241 12242 body := io.TeeReader(response.Body, ringBuffer) 12243 12244 decoder := json.NewDecoder(body) 12245 decoder.UseNumber() 12246 var shape interface{} 12247 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12248 var snapshot bytes.Buffer 12249 io.Copy(&snapshot, ringBuffer) 12250 err = &smithy.DeserializationError{ 12251 Err: fmt.Errorf("failed to decode response body, %w", err), 12252 Snapshot: snapshot.Bytes(), 12253 } 12254 return out, metadata, err 12255 } 12256 12257 err = awsRestjson1_deserializeOpDocumentUpdateRouteResponseOutput(&output, shape) 12258 if err != nil { 12259 var snapshot bytes.Buffer 12260 io.Copy(&snapshot, ringBuffer) 12261 return out, metadata, &smithy.DeserializationError{ 12262 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 12263 Snapshot: snapshot.Bytes(), 12264 } 12265 } 12266 12267 return out, metadata, err 12268} 12269 12270func awsRestjson1_deserializeOpErrorUpdateRouteResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12271 var errorBuffer bytes.Buffer 12272 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12273 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12274 } 12275 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12276 12277 errorCode := "UnknownError" 12278 errorMessage := errorCode 12279 12280 code := response.Header.Get("X-Amzn-ErrorType") 12281 if len(code) != 0 { 12282 errorCode = restjson.SanitizeErrorCode(code) 12283 } 12284 12285 var buff [1024]byte 12286 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12287 12288 body := io.TeeReader(errorBody, ringBuffer) 12289 decoder := json.NewDecoder(body) 12290 decoder.UseNumber() 12291 code, message, err := restjson.GetErrorInfo(decoder) 12292 if err != nil { 12293 var snapshot bytes.Buffer 12294 io.Copy(&snapshot, ringBuffer) 12295 err = &smithy.DeserializationError{ 12296 Err: fmt.Errorf("failed to decode response body, %w", err), 12297 Snapshot: snapshot.Bytes(), 12298 } 12299 return err 12300 } 12301 12302 errorBody.Seek(0, io.SeekStart) 12303 if len(code) != 0 { 12304 errorCode = restjson.SanitizeErrorCode(code) 12305 } 12306 if len(message) != 0 { 12307 errorMessage = message 12308 } 12309 12310 switch { 12311 case strings.EqualFold("BadRequestException", errorCode): 12312 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 12313 12314 case strings.EqualFold("ConflictException", errorCode): 12315 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 12316 12317 case strings.EqualFold("NotFoundException", errorCode): 12318 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 12319 12320 case strings.EqualFold("TooManyRequestsException", errorCode): 12321 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 12322 12323 default: 12324 genericError := &smithy.GenericAPIError{ 12325 Code: errorCode, 12326 Message: errorMessage, 12327 } 12328 return genericError 12329 12330 } 12331} 12332 12333func awsRestjson1_deserializeOpDocumentUpdateRouteResponseOutput(v **UpdateRouteResponseOutput, value interface{}) error { 12334 if v == nil { 12335 return fmt.Errorf("unexpected nil of type %T", v) 12336 } 12337 if value == nil { 12338 return nil 12339 } 12340 12341 shape, ok := value.(map[string]interface{}) 12342 if !ok { 12343 return fmt.Errorf("unexpected JSON type %v", value) 12344 } 12345 12346 var sv *UpdateRouteResponseOutput 12347 if *v == nil { 12348 sv = &UpdateRouteResponseOutput{} 12349 } else { 12350 sv = *v 12351 } 12352 12353 for key, value := range shape { 12354 switch key { 12355 case "modelSelectionExpression": 12356 if value != nil { 12357 jtv, ok := value.(string) 12358 if !ok { 12359 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 12360 } 12361 sv.ModelSelectionExpression = ptr.String(jtv) 12362 } 12363 12364 case "responseModels": 12365 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.ResponseModels, value); err != nil { 12366 return err 12367 } 12368 12369 case "responseParameters": 12370 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.ResponseParameters, value); err != nil { 12371 return err 12372 } 12373 12374 case "routeResponseId": 12375 if value != nil { 12376 jtv, ok := value.(string) 12377 if !ok { 12378 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12379 } 12380 sv.RouteResponseId = ptr.String(jtv) 12381 } 12382 12383 case "routeResponseKey": 12384 if value != nil { 12385 jtv, ok := value.(string) 12386 if !ok { 12387 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 12388 } 12389 sv.RouteResponseKey = ptr.String(jtv) 12390 } 12391 12392 default: 12393 _, _ = key, value 12394 12395 } 12396 } 12397 *v = sv 12398 return nil 12399} 12400 12401type awsRestjson1_deserializeOpUpdateStage struct { 12402} 12403 12404func (*awsRestjson1_deserializeOpUpdateStage) ID() string { 12405 return "OperationDeserializer" 12406} 12407 12408func (m *awsRestjson1_deserializeOpUpdateStage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12409 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12410) { 12411 out, metadata, err = next.HandleDeserialize(ctx, in) 12412 if err != nil { 12413 return out, metadata, err 12414 } 12415 12416 response, ok := out.RawResponse.(*smithyhttp.Response) 12417 if !ok { 12418 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12419 } 12420 12421 if response.StatusCode < 200 || response.StatusCode >= 300 { 12422 return out, metadata, awsRestjson1_deserializeOpErrorUpdateStage(response, &metadata) 12423 } 12424 output := &UpdateStageOutput{} 12425 out.Result = output 12426 12427 var buff [1024]byte 12428 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12429 12430 body := io.TeeReader(response.Body, ringBuffer) 12431 12432 decoder := json.NewDecoder(body) 12433 decoder.UseNumber() 12434 var shape interface{} 12435 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12436 var snapshot bytes.Buffer 12437 io.Copy(&snapshot, ringBuffer) 12438 err = &smithy.DeserializationError{ 12439 Err: fmt.Errorf("failed to decode response body, %w", err), 12440 Snapshot: snapshot.Bytes(), 12441 } 12442 return out, metadata, err 12443 } 12444 12445 err = awsRestjson1_deserializeOpDocumentUpdateStageOutput(&output, shape) 12446 if err != nil { 12447 var snapshot bytes.Buffer 12448 io.Copy(&snapshot, ringBuffer) 12449 return out, metadata, &smithy.DeserializationError{ 12450 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 12451 Snapshot: snapshot.Bytes(), 12452 } 12453 } 12454 12455 return out, metadata, err 12456} 12457 12458func awsRestjson1_deserializeOpErrorUpdateStage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12459 var errorBuffer bytes.Buffer 12460 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12461 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12462 } 12463 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12464 12465 errorCode := "UnknownError" 12466 errorMessage := errorCode 12467 12468 code := response.Header.Get("X-Amzn-ErrorType") 12469 if len(code) != 0 { 12470 errorCode = restjson.SanitizeErrorCode(code) 12471 } 12472 12473 var buff [1024]byte 12474 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12475 12476 body := io.TeeReader(errorBody, ringBuffer) 12477 decoder := json.NewDecoder(body) 12478 decoder.UseNumber() 12479 code, message, err := restjson.GetErrorInfo(decoder) 12480 if err != nil { 12481 var snapshot bytes.Buffer 12482 io.Copy(&snapshot, ringBuffer) 12483 err = &smithy.DeserializationError{ 12484 Err: fmt.Errorf("failed to decode response body, %w", err), 12485 Snapshot: snapshot.Bytes(), 12486 } 12487 return err 12488 } 12489 12490 errorBody.Seek(0, io.SeekStart) 12491 if len(code) != 0 { 12492 errorCode = restjson.SanitizeErrorCode(code) 12493 } 12494 if len(message) != 0 { 12495 errorMessage = message 12496 } 12497 12498 switch { 12499 case strings.EqualFold("BadRequestException", errorCode): 12500 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 12501 12502 case strings.EqualFold("ConflictException", errorCode): 12503 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 12504 12505 case strings.EqualFold("NotFoundException", errorCode): 12506 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 12507 12508 case strings.EqualFold("TooManyRequestsException", errorCode): 12509 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 12510 12511 default: 12512 genericError := &smithy.GenericAPIError{ 12513 Code: errorCode, 12514 Message: errorMessage, 12515 } 12516 return genericError 12517 12518 } 12519} 12520 12521func awsRestjson1_deserializeOpDocumentUpdateStageOutput(v **UpdateStageOutput, value interface{}) error { 12522 if v == nil { 12523 return fmt.Errorf("unexpected nil of type %T", v) 12524 } 12525 if value == nil { 12526 return nil 12527 } 12528 12529 shape, ok := value.(map[string]interface{}) 12530 if !ok { 12531 return fmt.Errorf("unexpected JSON type %v", value) 12532 } 12533 12534 var sv *UpdateStageOutput 12535 if *v == nil { 12536 sv = &UpdateStageOutput{} 12537 } else { 12538 sv = *v 12539 } 12540 12541 for key, value := range shape { 12542 switch key { 12543 case "accessLogSettings": 12544 if err := awsRestjson1_deserializeDocumentAccessLogSettings(&sv.AccessLogSettings, value); err != nil { 12545 return err 12546 } 12547 12548 case "apiGatewayManaged": 12549 if value != nil { 12550 jtv, ok := value.(bool) 12551 if !ok { 12552 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 12553 } 12554 sv.ApiGatewayManaged = jtv 12555 } 12556 12557 case "autoDeploy": 12558 if value != nil { 12559 jtv, ok := value.(bool) 12560 if !ok { 12561 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 12562 } 12563 sv.AutoDeploy = jtv 12564 } 12565 12566 case "clientCertificateId": 12567 if value != nil { 12568 jtv, ok := value.(string) 12569 if !ok { 12570 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12571 } 12572 sv.ClientCertificateId = ptr.String(jtv) 12573 } 12574 12575 case "createdDate": 12576 if value != nil { 12577 jtv, ok := value.(string) 12578 if !ok { 12579 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 12580 } 12581 t, err := smithytime.ParseDateTime(jtv) 12582 if err != nil { 12583 return err 12584 } 12585 sv.CreatedDate = ptr.Time(t) 12586 } 12587 12588 case "defaultRouteSettings": 12589 if err := awsRestjson1_deserializeDocumentRouteSettings(&sv.DefaultRouteSettings, value); err != nil { 12590 return err 12591 } 12592 12593 case "deploymentId": 12594 if value != nil { 12595 jtv, ok := value.(string) 12596 if !ok { 12597 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12598 } 12599 sv.DeploymentId = ptr.String(jtv) 12600 } 12601 12602 case "description": 12603 if value != nil { 12604 jtv, ok := value.(string) 12605 if !ok { 12606 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 12607 } 12608 sv.Description = ptr.String(jtv) 12609 } 12610 12611 case "lastDeploymentStatusMessage": 12612 if value != nil { 12613 jtv, ok := value.(string) 12614 if !ok { 12615 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 12616 } 12617 sv.LastDeploymentStatusMessage = ptr.String(jtv) 12618 } 12619 12620 case "lastUpdatedDate": 12621 if value != nil { 12622 jtv, ok := value.(string) 12623 if !ok { 12624 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 12625 } 12626 t, err := smithytime.ParseDateTime(jtv) 12627 if err != nil { 12628 return err 12629 } 12630 sv.LastUpdatedDate = ptr.Time(t) 12631 } 12632 12633 case "routeSettings": 12634 if err := awsRestjson1_deserializeDocumentRouteSettingsMap(&sv.RouteSettings, value); err != nil { 12635 return err 12636 } 12637 12638 case "stageName": 12639 if value != nil { 12640 jtv, ok := value.(string) 12641 if !ok { 12642 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 12643 } 12644 sv.StageName = ptr.String(jtv) 12645 } 12646 12647 case "stageVariables": 12648 if err := awsRestjson1_deserializeDocumentStageVariablesMap(&sv.StageVariables, value); err != nil { 12649 return err 12650 } 12651 12652 case "tags": 12653 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 12654 return err 12655 } 12656 12657 default: 12658 _, _ = key, value 12659 12660 } 12661 } 12662 *v = sv 12663 return nil 12664} 12665 12666type awsRestjson1_deserializeOpUpdateVpcLink struct { 12667} 12668 12669func (*awsRestjson1_deserializeOpUpdateVpcLink) ID() string { 12670 return "OperationDeserializer" 12671} 12672 12673func (m *awsRestjson1_deserializeOpUpdateVpcLink) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12674 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12675) { 12676 out, metadata, err = next.HandleDeserialize(ctx, in) 12677 if err != nil { 12678 return out, metadata, err 12679 } 12680 12681 response, ok := out.RawResponse.(*smithyhttp.Response) 12682 if !ok { 12683 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12684 } 12685 12686 if response.StatusCode < 200 || response.StatusCode >= 300 { 12687 return out, metadata, awsRestjson1_deserializeOpErrorUpdateVpcLink(response, &metadata) 12688 } 12689 output := &UpdateVpcLinkOutput{} 12690 out.Result = output 12691 12692 var buff [1024]byte 12693 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12694 12695 body := io.TeeReader(response.Body, ringBuffer) 12696 12697 decoder := json.NewDecoder(body) 12698 decoder.UseNumber() 12699 var shape interface{} 12700 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12701 var snapshot bytes.Buffer 12702 io.Copy(&snapshot, ringBuffer) 12703 err = &smithy.DeserializationError{ 12704 Err: fmt.Errorf("failed to decode response body, %w", err), 12705 Snapshot: snapshot.Bytes(), 12706 } 12707 return out, metadata, err 12708 } 12709 12710 err = awsRestjson1_deserializeOpDocumentUpdateVpcLinkOutput(&output, shape) 12711 if err != nil { 12712 var snapshot bytes.Buffer 12713 io.Copy(&snapshot, ringBuffer) 12714 return out, metadata, &smithy.DeserializationError{ 12715 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 12716 Snapshot: snapshot.Bytes(), 12717 } 12718 } 12719 12720 return out, metadata, err 12721} 12722 12723func awsRestjson1_deserializeOpErrorUpdateVpcLink(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12724 var errorBuffer bytes.Buffer 12725 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12726 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12727 } 12728 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12729 12730 errorCode := "UnknownError" 12731 errorMessage := errorCode 12732 12733 code := response.Header.Get("X-Amzn-ErrorType") 12734 if len(code) != 0 { 12735 errorCode = restjson.SanitizeErrorCode(code) 12736 } 12737 12738 var buff [1024]byte 12739 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12740 12741 body := io.TeeReader(errorBody, ringBuffer) 12742 decoder := json.NewDecoder(body) 12743 decoder.UseNumber() 12744 code, message, err := restjson.GetErrorInfo(decoder) 12745 if err != nil { 12746 var snapshot bytes.Buffer 12747 io.Copy(&snapshot, ringBuffer) 12748 err = &smithy.DeserializationError{ 12749 Err: fmt.Errorf("failed to decode response body, %w", err), 12750 Snapshot: snapshot.Bytes(), 12751 } 12752 return err 12753 } 12754 12755 errorBody.Seek(0, io.SeekStart) 12756 if len(code) != 0 { 12757 errorCode = restjson.SanitizeErrorCode(code) 12758 } 12759 if len(message) != 0 { 12760 errorMessage = message 12761 } 12762 12763 switch { 12764 case strings.EqualFold("BadRequestException", errorCode): 12765 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 12766 12767 case strings.EqualFold("NotFoundException", errorCode): 12768 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 12769 12770 case strings.EqualFold("TooManyRequestsException", errorCode): 12771 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 12772 12773 default: 12774 genericError := &smithy.GenericAPIError{ 12775 Code: errorCode, 12776 Message: errorMessage, 12777 } 12778 return genericError 12779 12780 } 12781} 12782 12783func awsRestjson1_deserializeOpDocumentUpdateVpcLinkOutput(v **UpdateVpcLinkOutput, value interface{}) error { 12784 if v == nil { 12785 return fmt.Errorf("unexpected nil of type %T", v) 12786 } 12787 if value == nil { 12788 return nil 12789 } 12790 12791 shape, ok := value.(map[string]interface{}) 12792 if !ok { 12793 return fmt.Errorf("unexpected JSON type %v", value) 12794 } 12795 12796 var sv *UpdateVpcLinkOutput 12797 if *v == nil { 12798 sv = &UpdateVpcLinkOutput{} 12799 } else { 12800 sv = *v 12801 } 12802 12803 for key, value := range shape { 12804 switch key { 12805 case "createdDate": 12806 if value != nil { 12807 jtv, ok := value.(string) 12808 if !ok { 12809 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 12810 } 12811 t, err := smithytime.ParseDateTime(jtv) 12812 if err != nil { 12813 return err 12814 } 12815 sv.CreatedDate = ptr.Time(t) 12816 } 12817 12818 case "name": 12819 if value != nil { 12820 jtv, ok := value.(string) 12821 if !ok { 12822 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 12823 } 12824 sv.Name = ptr.String(jtv) 12825 } 12826 12827 case "securityGroupIds": 12828 if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { 12829 return err 12830 } 12831 12832 case "subnetIds": 12833 if err := awsRestjson1_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil { 12834 return err 12835 } 12836 12837 case "tags": 12838 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 12839 return err 12840 } 12841 12842 case "vpcLinkId": 12843 if value != nil { 12844 jtv, ok := value.(string) 12845 if !ok { 12846 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12847 } 12848 sv.VpcLinkId = ptr.String(jtv) 12849 } 12850 12851 case "vpcLinkStatus": 12852 if value != nil { 12853 jtv, ok := value.(string) 12854 if !ok { 12855 return fmt.Errorf("expected VpcLinkStatus to be of type string, got %T instead", value) 12856 } 12857 sv.VpcLinkStatus = types.VpcLinkStatus(jtv) 12858 } 12859 12860 case "vpcLinkStatusMessage": 12861 if value != nil { 12862 jtv, ok := value.(string) 12863 if !ok { 12864 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 12865 } 12866 sv.VpcLinkStatusMessage = ptr.String(jtv) 12867 } 12868 12869 case "vpcLinkVersion": 12870 if value != nil { 12871 jtv, ok := value.(string) 12872 if !ok { 12873 return fmt.Errorf("expected VpcLinkVersion to be of type string, got %T instead", value) 12874 } 12875 sv.VpcLinkVersion = types.VpcLinkVersion(jtv) 12876 } 12877 12878 default: 12879 _, _ = key, value 12880 12881 } 12882 } 12883 *v = sv 12884 return nil 12885} 12886 12887func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 12888 output := &types.AccessDeniedException{} 12889 var buff [1024]byte 12890 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12891 12892 body := io.TeeReader(errorBody, ringBuffer) 12893 decoder := json.NewDecoder(body) 12894 decoder.UseNumber() 12895 var shape interface{} 12896 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12897 var snapshot bytes.Buffer 12898 io.Copy(&snapshot, ringBuffer) 12899 err = &smithy.DeserializationError{ 12900 Err: fmt.Errorf("failed to decode response body, %w", err), 12901 Snapshot: snapshot.Bytes(), 12902 } 12903 return err 12904 } 12905 12906 err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) 12907 12908 if err != nil { 12909 var snapshot bytes.Buffer 12910 io.Copy(&snapshot, ringBuffer) 12911 err = &smithy.DeserializationError{ 12912 Err: fmt.Errorf("failed to decode response body, %w", err), 12913 Snapshot: snapshot.Bytes(), 12914 } 12915 return err 12916 } 12917 12918 errorBody.Seek(0, io.SeekStart) 12919 12920 return output 12921} 12922 12923func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 12924 output := &types.BadRequestException{} 12925 var buff [1024]byte 12926 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12927 12928 body := io.TeeReader(errorBody, ringBuffer) 12929 decoder := json.NewDecoder(body) 12930 decoder.UseNumber() 12931 var shape interface{} 12932 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12933 var snapshot bytes.Buffer 12934 io.Copy(&snapshot, ringBuffer) 12935 err = &smithy.DeserializationError{ 12936 Err: fmt.Errorf("failed to decode response body, %w", err), 12937 Snapshot: snapshot.Bytes(), 12938 } 12939 return err 12940 } 12941 12942 err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape) 12943 12944 if err != nil { 12945 var snapshot bytes.Buffer 12946 io.Copy(&snapshot, ringBuffer) 12947 err = &smithy.DeserializationError{ 12948 Err: fmt.Errorf("failed to decode response body, %w", err), 12949 Snapshot: snapshot.Bytes(), 12950 } 12951 return err 12952 } 12953 12954 errorBody.Seek(0, io.SeekStart) 12955 12956 return output 12957} 12958 12959func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 12960 output := &types.ConflictException{} 12961 var buff [1024]byte 12962 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12963 12964 body := io.TeeReader(errorBody, ringBuffer) 12965 decoder := json.NewDecoder(body) 12966 decoder.UseNumber() 12967 var shape interface{} 12968 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12969 var snapshot bytes.Buffer 12970 io.Copy(&snapshot, ringBuffer) 12971 err = &smithy.DeserializationError{ 12972 Err: fmt.Errorf("failed to decode response body, %w", err), 12973 Snapshot: snapshot.Bytes(), 12974 } 12975 return err 12976 } 12977 12978 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 12979 12980 if err != nil { 12981 var snapshot bytes.Buffer 12982 io.Copy(&snapshot, ringBuffer) 12983 err = &smithy.DeserializationError{ 12984 Err: fmt.Errorf("failed to decode response body, %w", err), 12985 Snapshot: snapshot.Bytes(), 12986 } 12987 return err 12988 } 12989 12990 errorBody.Seek(0, io.SeekStart) 12991 12992 return output 12993} 12994 12995func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 12996 output := &types.NotFoundException{} 12997 var buff [1024]byte 12998 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12999 13000 body := io.TeeReader(errorBody, ringBuffer) 13001 decoder := json.NewDecoder(body) 13002 decoder.UseNumber() 13003 var shape interface{} 13004 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13005 var snapshot bytes.Buffer 13006 io.Copy(&snapshot, ringBuffer) 13007 err = &smithy.DeserializationError{ 13008 Err: fmt.Errorf("failed to decode response body, %w", err), 13009 Snapshot: snapshot.Bytes(), 13010 } 13011 return err 13012 } 13013 13014 err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape) 13015 13016 if err != nil { 13017 var snapshot bytes.Buffer 13018 io.Copy(&snapshot, ringBuffer) 13019 err = &smithy.DeserializationError{ 13020 Err: fmt.Errorf("failed to decode response body, %w", err), 13021 Snapshot: snapshot.Bytes(), 13022 } 13023 return err 13024 } 13025 13026 errorBody.Seek(0, io.SeekStart) 13027 13028 return output 13029} 13030 13031func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13032 output := &types.TooManyRequestsException{} 13033 var buff [1024]byte 13034 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13035 13036 body := io.TeeReader(errorBody, ringBuffer) 13037 decoder := json.NewDecoder(body) 13038 decoder.UseNumber() 13039 var shape interface{} 13040 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13041 var snapshot bytes.Buffer 13042 io.Copy(&snapshot, ringBuffer) 13043 err = &smithy.DeserializationError{ 13044 Err: fmt.Errorf("failed to decode response body, %w", err), 13045 Snapshot: snapshot.Bytes(), 13046 } 13047 return err 13048 } 13049 13050 err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape) 13051 13052 if err != nil { 13053 var snapshot bytes.Buffer 13054 io.Copy(&snapshot, ringBuffer) 13055 err = &smithy.DeserializationError{ 13056 Err: fmt.Errorf("failed to decode response body, %w", err), 13057 Snapshot: snapshot.Bytes(), 13058 } 13059 return err 13060 } 13061 13062 errorBody.Seek(0, io.SeekStart) 13063 13064 return output 13065} 13066 13067func awsRestjson1_deserializeDocument__listOf__string(v *[]string, value interface{}) error { 13068 if v == nil { 13069 return fmt.Errorf("unexpected nil of type %T", v) 13070 } 13071 if value == nil { 13072 return nil 13073 } 13074 13075 shape, ok := value.([]interface{}) 13076 if !ok { 13077 return fmt.Errorf("unexpected JSON type %v", value) 13078 } 13079 13080 var cv []string 13081 if *v == nil { 13082 cv = []string{} 13083 } else { 13084 cv = *v 13085 } 13086 13087 for _, value := range shape { 13088 var col string 13089 if value != nil { 13090 jtv, ok := value.(string) 13091 if !ok { 13092 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 13093 } 13094 col = jtv 13095 } 13096 cv = append(cv, col) 13097 13098 } 13099 *v = cv 13100 return nil 13101} 13102 13103func awsRestjson1_deserializeDocument__listOfApi(v *[]types.Api, value interface{}) error { 13104 if v == nil { 13105 return fmt.Errorf("unexpected nil of type %T", v) 13106 } 13107 if value == nil { 13108 return nil 13109 } 13110 13111 shape, ok := value.([]interface{}) 13112 if !ok { 13113 return fmt.Errorf("unexpected JSON type %v", value) 13114 } 13115 13116 var cv []types.Api 13117 if *v == nil { 13118 cv = []types.Api{} 13119 } else { 13120 cv = *v 13121 } 13122 13123 for _, value := range shape { 13124 var col types.Api 13125 destAddr := &col 13126 if err := awsRestjson1_deserializeDocumentApi(&destAddr, value); err != nil { 13127 return err 13128 } 13129 col = *destAddr 13130 cv = append(cv, col) 13131 13132 } 13133 *v = cv 13134 return nil 13135} 13136 13137func awsRestjson1_deserializeDocument__listOfApiMapping(v *[]types.ApiMapping, value interface{}) error { 13138 if v == nil { 13139 return fmt.Errorf("unexpected nil of type %T", v) 13140 } 13141 if value == nil { 13142 return nil 13143 } 13144 13145 shape, ok := value.([]interface{}) 13146 if !ok { 13147 return fmt.Errorf("unexpected JSON type %v", value) 13148 } 13149 13150 var cv []types.ApiMapping 13151 if *v == nil { 13152 cv = []types.ApiMapping{} 13153 } else { 13154 cv = *v 13155 } 13156 13157 for _, value := range shape { 13158 var col types.ApiMapping 13159 destAddr := &col 13160 if err := awsRestjson1_deserializeDocumentApiMapping(&destAddr, value); err != nil { 13161 return err 13162 } 13163 col = *destAddr 13164 cv = append(cv, col) 13165 13166 } 13167 *v = cv 13168 return nil 13169} 13170 13171func awsRestjson1_deserializeDocument__listOfAuthorizer(v *[]types.Authorizer, value interface{}) error { 13172 if v == nil { 13173 return fmt.Errorf("unexpected nil of type %T", v) 13174 } 13175 if value == nil { 13176 return nil 13177 } 13178 13179 shape, ok := value.([]interface{}) 13180 if !ok { 13181 return fmt.Errorf("unexpected JSON type %v", value) 13182 } 13183 13184 var cv []types.Authorizer 13185 if *v == nil { 13186 cv = []types.Authorizer{} 13187 } else { 13188 cv = *v 13189 } 13190 13191 for _, value := range shape { 13192 var col types.Authorizer 13193 destAddr := &col 13194 if err := awsRestjson1_deserializeDocumentAuthorizer(&destAddr, value); err != nil { 13195 return err 13196 } 13197 col = *destAddr 13198 cv = append(cv, col) 13199 13200 } 13201 *v = cv 13202 return nil 13203} 13204 13205func awsRestjson1_deserializeDocument__listOfDeployment(v *[]types.Deployment, value interface{}) error { 13206 if v == nil { 13207 return fmt.Errorf("unexpected nil of type %T", v) 13208 } 13209 if value == nil { 13210 return nil 13211 } 13212 13213 shape, ok := value.([]interface{}) 13214 if !ok { 13215 return fmt.Errorf("unexpected JSON type %v", value) 13216 } 13217 13218 var cv []types.Deployment 13219 if *v == nil { 13220 cv = []types.Deployment{} 13221 } else { 13222 cv = *v 13223 } 13224 13225 for _, value := range shape { 13226 var col types.Deployment 13227 destAddr := &col 13228 if err := awsRestjson1_deserializeDocumentDeployment(&destAddr, value); err != nil { 13229 return err 13230 } 13231 col = *destAddr 13232 cv = append(cv, col) 13233 13234 } 13235 *v = cv 13236 return nil 13237} 13238 13239func awsRestjson1_deserializeDocument__listOfDomainName(v *[]types.DomainName, value interface{}) error { 13240 if v == nil { 13241 return fmt.Errorf("unexpected nil of type %T", v) 13242 } 13243 if value == nil { 13244 return nil 13245 } 13246 13247 shape, ok := value.([]interface{}) 13248 if !ok { 13249 return fmt.Errorf("unexpected JSON type %v", value) 13250 } 13251 13252 var cv []types.DomainName 13253 if *v == nil { 13254 cv = []types.DomainName{} 13255 } else { 13256 cv = *v 13257 } 13258 13259 for _, value := range shape { 13260 var col types.DomainName 13261 destAddr := &col 13262 if err := awsRestjson1_deserializeDocumentDomainName(&destAddr, value); err != nil { 13263 return err 13264 } 13265 col = *destAddr 13266 cv = append(cv, col) 13267 13268 } 13269 *v = cv 13270 return nil 13271} 13272 13273func awsRestjson1_deserializeDocument__listOfIntegration(v *[]types.Integration, value interface{}) error { 13274 if v == nil { 13275 return fmt.Errorf("unexpected nil of type %T", v) 13276 } 13277 if value == nil { 13278 return nil 13279 } 13280 13281 shape, ok := value.([]interface{}) 13282 if !ok { 13283 return fmt.Errorf("unexpected JSON type %v", value) 13284 } 13285 13286 var cv []types.Integration 13287 if *v == nil { 13288 cv = []types.Integration{} 13289 } else { 13290 cv = *v 13291 } 13292 13293 for _, value := range shape { 13294 var col types.Integration 13295 destAddr := &col 13296 if err := awsRestjson1_deserializeDocumentIntegration(&destAddr, value); err != nil { 13297 return err 13298 } 13299 col = *destAddr 13300 cv = append(cv, col) 13301 13302 } 13303 *v = cv 13304 return nil 13305} 13306 13307func awsRestjson1_deserializeDocument__listOfIntegrationResponse(v *[]types.IntegrationResponse, value interface{}) error { 13308 if v == nil { 13309 return fmt.Errorf("unexpected nil of type %T", v) 13310 } 13311 if value == nil { 13312 return nil 13313 } 13314 13315 shape, ok := value.([]interface{}) 13316 if !ok { 13317 return fmt.Errorf("unexpected JSON type %v", value) 13318 } 13319 13320 var cv []types.IntegrationResponse 13321 if *v == nil { 13322 cv = []types.IntegrationResponse{} 13323 } else { 13324 cv = *v 13325 } 13326 13327 for _, value := range shape { 13328 var col types.IntegrationResponse 13329 destAddr := &col 13330 if err := awsRestjson1_deserializeDocumentIntegrationResponse(&destAddr, value); err != nil { 13331 return err 13332 } 13333 col = *destAddr 13334 cv = append(cv, col) 13335 13336 } 13337 *v = cv 13338 return nil 13339} 13340 13341func awsRestjson1_deserializeDocument__listOfModel(v *[]types.Model, value interface{}) error { 13342 if v == nil { 13343 return fmt.Errorf("unexpected nil of type %T", v) 13344 } 13345 if value == nil { 13346 return nil 13347 } 13348 13349 shape, ok := value.([]interface{}) 13350 if !ok { 13351 return fmt.Errorf("unexpected JSON type %v", value) 13352 } 13353 13354 var cv []types.Model 13355 if *v == nil { 13356 cv = []types.Model{} 13357 } else { 13358 cv = *v 13359 } 13360 13361 for _, value := range shape { 13362 var col types.Model 13363 destAddr := &col 13364 if err := awsRestjson1_deserializeDocumentModel(&destAddr, value); err != nil { 13365 return err 13366 } 13367 col = *destAddr 13368 cv = append(cv, col) 13369 13370 } 13371 *v = cv 13372 return nil 13373} 13374 13375func awsRestjson1_deserializeDocument__listOfRoute(v *[]types.Route, value interface{}) error { 13376 if v == nil { 13377 return fmt.Errorf("unexpected nil of type %T", v) 13378 } 13379 if value == nil { 13380 return nil 13381 } 13382 13383 shape, ok := value.([]interface{}) 13384 if !ok { 13385 return fmt.Errorf("unexpected JSON type %v", value) 13386 } 13387 13388 var cv []types.Route 13389 if *v == nil { 13390 cv = []types.Route{} 13391 } else { 13392 cv = *v 13393 } 13394 13395 for _, value := range shape { 13396 var col types.Route 13397 destAddr := &col 13398 if err := awsRestjson1_deserializeDocumentRoute(&destAddr, value); err != nil { 13399 return err 13400 } 13401 col = *destAddr 13402 cv = append(cv, col) 13403 13404 } 13405 *v = cv 13406 return nil 13407} 13408 13409func awsRestjson1_deserializeDocument__listOfRouteResponse(v *[]types.RouteResponse, value interface{}) error { 13410 if v == nil { 13411 return fmt.Errorf("unexpected nil of type %T", v) 13412 } 13413 if value == nil { 13414 return nil 13415 } 13416 13417 shape, ok := value.([]interface{}) 13418 if !ok { 13419 return fmt.Errorf("unexpected JSON type %v", value) 13420 } 13421 13422 var cv []types.RouteResponse 13423 if *v == nil { 13424 cv = []types.RouteResponse{} 13425 } else { 13426 cv = *v 13427 } 13428 13429 for _, value := range shape { 13430 var col types.RouteResponse 13431 destAddr := &col 13432 if err := awsRestjson1_deserializeDocumentRouteResponse(&destAddr, value); err != nil { 13433 return err 13434 } 13435 col = *destAddr 13436 cv = append(cv, col) 13437 13438 } 13439 *v = cv 13440 return nil 13441} 13442 13443func awsRestjson1_deserializeDocument__listOfStage(v *[]types.Stage, value interface{}) error { 13444 if v == nil { 13445 return fmt.Errorf("unexpected nil of type %T", v) 13446 } 13447 if value == nil { 13448 return nil 13449 } 13450 13451 shape, ok := value.([]interface{}) 13452 if !ok { 13453 return fmt.Errorf("unexpected JSON type %v", value) 13454 } 13455 13456 var cv []types.Stage 13457 if *v == nil { 13458 cv = []types.Stage{} 13459 } else { 13460 cv = *v 13461 } 13462 13463 for _, value := range shape { 13464 var col types.Stage 13465 destAddr := &col 13466 if err := awsRestjson1_deserializeDocumentStage(&destAddr, value); err != nil { 13467 return err 13468 } 13469 col = *destAddr 13470 cv = append(cv, col) 13471 13472 } 13473 *v = cv 13474 return nil 13475} 13476 13477func awsRestjson1_deserializeDocument__listOfVpcLink(v *[]types.VpcLink, value interface{}) error { 13478 if v == nil { 13479 return fmt.Errorf("unexpected nil of type %T", v) 13480 } 13481 if value == nil { 13482 return nil 13483 } 13484 13485 shape, ok := value.([]interface{}) 13486 if !ok { 13487 return fmt.Errorf("unexpected JSON type %v", value) 13488 } 13489 13490 var cv []types.VpcLink 13491 if *v == nil { 13492 cv = []types.VpcLink{} 13493 } else { 13494 cv = *v 13495 } 13496 13497 for _, value := range shape { 13498 var col types.VpcLink 13499 destAddr := &col 13500 if err := awsRestjson1_deserializeDocumentVpcLink(&destAddr, value); err != nil { 13501 return err 13502 } 13503 col = *destAddr 13504 cv = append(cv, col) 13505 13506 } 13507 *v = cv 13508 return nil 13509} 13510 13511func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { 13512 if v == nil { 13513 return fmt.Errorf("unexpected nil of type %T", v) 13514 } 13515 if value == nil { 13516 return nil 13517 } 13518 13519 shape, ok := value.(map[string]interface{}) 13520 if !ok { 13521 return fmt.Errorf("unexpected JSON type %v", value) 13522 } 13523 13524 var sv *types.AccessDeniedException 13525 if *v == nil { 13526 sv = &types.AccessDeniedException{} 13527 } else { 13528 sv = *v 13529 } 13530 13531 for key, value := range shape { 13532 switch key { 13533 case "message": 13534 if value != nil { 13535 jtv, ok := value.(string) 13536 if !ok { 13537 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 13538 } 13539 sv.Message = ptr.String(jtv) 13540 } 13541 13542 default: 13543 _, _ = key, value 13544 13545 } 13546 } 13547 *v = sv 13548 return nil 13549} 13550 13551func awsRestjson1_deserializeDocumentAccessLogSettings(v **types.AccessLogSettings, value interface{}) error { 13552 if v == nil { 13553 return fmt.Errorf("unexpected nil of type %T", v) 13554 } 13555 if value == nil { 13556 return nil 13557 } 13558 13559 shape, ok := value.(map[string]interface{}) 13560 if !ok { 13561 return fmt.Errorf("unexpected JSON type %v", value) 13562 } 13563 13564 var sv *types.AccessLogSettings 13565 if *v == nil { 13566 sv = &types.AccessLogSettings{} 13567 } else { 13568 sv = *v 13569 } 13570 13571 for key, value := range shape { 13572 switch key { 13573 case "destinationArn": 13574 if value != nil { 13575 jtv, ok := value.(string) 13576 if !ok { 13577 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13578 } 13579 sv.DestinationArn = ptr.String(jtv) 13580 } 13581 13582 case "format": 13583 if value != nil { 13584 jtv, ok := value.(string) 13585 if !ok { 13586 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 13587 } 13588 sv.Format = ptr.String(jtv) 13589 } 13590 13591 default: 13592 _, _ = key, value 13593 13594 } 13595 } 13596 *v = sv 13597 return nil 13598} 13599 13600func awsRestjson1_deserializeDocumentApi(v **types.Api, value interface{}) error { 13601 if v == nil { 13602 return fmt.Errorf("unexpected nil of type %T", v) 13603 } 13604 if value == nil { 13605 return nil 13606 } 13607 13608 shape, ok := value.(map[string]interface{}) 13609 if !ok { 13610 return fmt.Errorf("unexpected JSON type %v", value) 13611 } 13612 13613 var sv *types.Api 13614 if *v == nil { 13615 sv = &types.Api{} 13616 } else { 13617 sv = *v 13618 } 13619 13620 for key, value := range shape { 13621 switch key { 13622 case "apiEndpoint": 13623 if value != nil { 13624 jtv, ok := value.(string) 13625 if !ok { 13626 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 13627 } 13628 sv.ApiEndpoint = ptr.String(jtv) 13629 } 13630 13631 case "apiGatewayManaged": 13632 if value != nil { 13633 jtv, ok := value.(bool) 13634 if !ok { 13635 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 13636 } 13637 sv.ApiGatewayManaged = jtv 13638 } 13639 13640 case "apiId": 13641 if value != nil { 13642 jtv, ok := value.(string) 13643 if !ok { 13644 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13645 } 13646 sv.ApiId = ptr.String(jtv) 13647 } 13648 13649 case "apiKeySelectionExpression": 13650 if value != nil { 13651 jtv, ok := value.(string) 13652 if !ok { 13653 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 13654 } 13655 sv.ApiKeySelectionExpression = ptr.String(jtv) 13656 } 13657 13658 case "corsConfiguration": 13659 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 13660 return err 13661 } 13662 13663 case "createdDate": 13664 if value != nil { 13665 jtv, ok := value.(string) 13666 if !ok { 13667 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 13668 } 13669 t, err := smithytime.ParseDateTime(jtv) 13670 if err != nil { 13671 return err 13672 } 13673 sv.CreatedDate = ptr.Time(t) 13674 } 13675 13676 case "description": 13677 if value != nil { 13678 jtv, ok := value.(string) 13679 if !ok { 13680 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 13681 } 13682 sv.Description = ptr.String(jtv) 13683 } 13684 13685 case "disableExecuteApiEndpoint": 13686 if value != nil { 13687 jtv, ok := value.(bool) 13688 if !ok { 13689 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 13690 } 13691 sv.DisableExecuteApiEndpoint = jtv 13692 } 13693 13694 case "disableSchemaValidation": 13695 if value != nil { 13696 jtv, ok := value.(bool) 13697 if !ok { 13698 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 13699 } 13700 sv.DisableSchemaValidation = jtv 13701 } 13702 13703 case "importInfo": 13704 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 13705 return err 13706 } 13707 13708 case "name": 13709 if value != nil { 13710 jtv, ok := value.(string) 13711 if !ok { 13712 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 13713 } 13714 sv.Name = ptr.String(jtv) 13715 } 13716 13717 case "protocolType": 13718 if value != nil { 13719 jtv, ok := value.(string) 13720 if !ok { 13721 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 13722 } 13723 sv.ProtocolType = types.ProtocolType(jtv) 13724 } 13725 13726 case "routeSelectionExpression": 13727 if value != nil { 13728 jtv, ok := value.(string) 13729 if !ok { 13730 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 13731 } 13732 sv.RouteSelectionExpression = ptr.String(jtv) 13733 } 13734 13735 case "tags": 13736 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 13737 return err 13738 } 13739 13740 case "version": 13741 if value != nil { 13742 jtv, ok := value.(string) 13743 if !ok { 13744 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 13745 } 13746 sv.Version = ptr.String(jtv) 13747 } 13748 13749 case "warnings": 13750 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 13751 return err 13752 } 13753 13754 default: 13755 _, _ = key, value 13756 13757 } 13758 } 13759 *v = sv 13760 return nil 13761} 13762 13763func awsRestjson1_deserializeDocumentApiMapping(v **types.ApiMapping, value interface{}) error { 13764 if v == nil { 13765 return fmt.Errorf("unexpected nil of type %T", v) 13766 } 13767 if value == nil { 13768 return nil 13769 } 13770 13771 shape, ok := value.(map[string]interface{}) 13772 if !ok { 13773 return fmt.Errorf("unexpected JSON type %v", value) 13774 } 13775 13776 var sv *types.ApiMapping 13777 if *v == nil { 13778 sv = &types.ApiMapping{} 13779 } else { 13780 sv = *v 13781 } 13782 13783 for key, value := range shape { 13784 switch key { 13785 case "apiId": 13786 if value != nil { 13787 jtv, ok := value.(string) 13788 if !ok { 13789 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13790 } 13791 sv.ApiId = ptr.String(jtv) 13792 } 13793 13794 case "apiMappingId": 13795 if value != nil { 13796 jtv, ok := value.(string) 13797 if !ok { 13798 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13799 } 13800 sv.ApiMappingId = ptr.String(jtv) 13801 } 13802 13803 case "apiMappingKey": 13804 if value != nil { 13805 jtv, ok := value.(string) 13806 if !ok { 13807 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 13808 } 13809 sv.ApiMappingKey = ptr.String(jtv) 13810 } 13811 13812 case "stage": 13813 if value != nil { 13814 jtv, ok := value.(string) 13815 if !ok { 13816 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 13817 } 13818 sv.Stage = ptr.String(jtv) 13819 } 13820 13821 default: 13822 _, _ = key, value 13823 13824 } 13825 } 13826 *v = sv 13827 return nil 13828} 13829 13830func awsRestjson1_deserializeDocumentAuthorizationScopes(v *[]string, value interface{}) error { 13831 if v == nil { 13832 return fmt.Errorf("unexpected nil of type %T", v) 13833 } 13834 if value == nil { 13835 return nil 13836 } 13837 13838 shape, ok := value.([]interface{}) 13839 if !ok { 13840 return fmt.Errorf("unexpected JSON type %v", value) 13841 } 13842 13843 var cv []string 13844 if *v == nil { 13845 cv = []string{} 13846 } else { 13847 cv = *v 13848 } 13849 13850 for _, value := range shape { 13851 var col string 13852 if value != nil { 13853 jtv, ok := value.(string) 13854 if !ok { 13855 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 13856 } 13857 col = jtv 13858 } 13859 cv = append(cv, col) 13860 13861 } 13862 *v = cv 13863 return nil 13864} 13865 13866func awsRestjson1_deserializeDocumentAuthorizer(v **types.Authorizer, value interface{}) error { 13867 if v == nil { 13868 return fmt.Errorf("unexpected nil of type %T", v) 13869 } 13870 if value == nil { 13871 return nil 13872 } 13873 13874 shape, ok := value.(map[string]interface{}) 13875 if !ok { 13876 return fmt.Errorf("unexpected JSON type %v", value) 13877 } 13878 13879 var sv *types.Authorizer 13880 if *v == nil { 13881 sv = &types.Authorizer{} 13882 } else { 13883 sv = *v 13884 } 13885 13886 for key, value := range shape { 13887 switch key { 13888 case "authorizerCredentialsArn": 13889 if value != nil { 13890 jtv, ok := value.(string) 13891 if !ok { 13892 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13893 } 13894 sv.AuthorizerCredentialsArn = ptr.String(jtv) 13895 } 13896 13897 case "authorizerId": 13898 if value != nil { 13899 jtv, ok := value.(string) 13900 if !ok { 13901 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13902 } 13903 sv.AuthorizerId = ptr.String(jtv) 13904 } 13905 13906 case "authorizerPayloadFormatVersion": 13907 if value != nil { 13908 jtv, ok := value.(string) 13909 if !ok { 13910 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 13911 } 13912 sv.AuthorizerPayloadFormatVersion = ptr.String(jtv) 13913 } 13914 13915 case "authorizerResultTtlInSeconds": 13916 if value != nil { 13917 jtv, ok := value.(json.Number) 13918 if !ok { 13919 return fmt.Errorf("expected IntegerWithLengthBetween0And3600 to be json.Number, got %T instead", value) 13920 } 13921 i64, err := jtv.Int64() 13922 if err != nil { 13923 return err 13924 } 13925 sv.AuthorizerResultTtlInSeconds = int32(i64) 13926 } 13927 13928 case "authorizerType": 13929 if value != nil { 13930 jtv, ok := value.(string) 13931 if !ok { 13932 return fmt.Errorf("expected AuthorizerType to be of type string, got %T instead", value) 13933 } 13934 sv.AuthorizerType = types.AuthorizerType(jtv) 13935 } 13936 13937 case "authorizerUri": 13938 if value != nil { 13939 jtv, ok := value.(string) 13940 if !ok { 13941 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 13942 } 13943 sv.AuthorizerUri = ptr.String(jtv) 13944 } 13945 13946 case "enableSimpleResponses": 13947 if value != nil { 13948 jtv, ok := value.(bool) 13949 if !ok { 13950 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 13951 } 13952 sv.EnableSimpleResponses = jtv 13953 } 13954 13955 case "identitySource": 13956 if err := awsRestjson1_deserializeDocumentIdentitySourceList(&sv.IdentitySource, value); err != nil { 13957 return err 13958 } 13959 13960 case "identityValidationExpression": 13961 if value != nil { 13962 jtv, ok := value.(string) 13963 if !ok { 13964 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 13965 } 13966 sv.IdentityValidationExpression = ptr.String(jtv) 13967 } 13968 13969 case "jwtConfiguration": 13970 if err := awsRestjson1_deserializeDocumentJWTConfiguration(&sv.JwtConfiguration, value); err != nil { 13971 return err 13972 } 13973 13974 case "name": 13975 if value != nil { 13976 jtv, ok := value.(string) 13977 if !ok { 13978 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 13979 } 13980 sv.Name = ptr.String(jtv) 13981 } 13982 13983 default: 13984 _, _ = key, value 13985 13986 } 13987 } 13988 *v = sv 13989 return nil 13990} 13991 13992func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 13993 if v == nil { 13994 return fmt.Errorf("unexpected nil of type %T", v) 13995 } 13996 if value == nil { 13997 return nil 13998 } 13999 14000 shape, ok := value.(map[string]interface{}) 14001 if !ok { 14002 return fmt.Errorf("unexpected JSON type %v", value) 14003 } 14004 14005 var sv *types.BadRequestException 14006 if *v == nil { 14007 sv = &types.BadRequestException{} 14008 } else { 14009 sv = *v 14010 } 14011 14012 for key, value := range shape { 14013 switch key { 14014 case "message": 14015 if value != nil { 14016 jtv, ok := value.(string) 14017 if !ok { 14018 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14019 } 14020 sv.Message = ptr.String(jtv) 14021 } 14022 14023 default: 14024 _, _ = key, value 14025 14026 } 14027 } 14028 *v = sv 14029 return nil 14030} 14031 14032func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 14033 if v == nil { 14034 return fmt.Errorf("unexpected nil of type %T", v) 14035 } 14036 if value == nil { 14037 return nil 14038 } 14039 14040 shape, ok := value.(map[string]interface{}) 14041 if !ok { 14042 return fmt.Errorf("unexpected JSON type %v", value) 14043 } 14044 14045 var sv *types.ConflictException 14046 if *v == nil { 14047 sv = &types.ConflictException{} 14048 } else { 14049 sv = *v 14050 } 14051 14052 for key, value := range shape { 14053 switch key { 14054 case "message": 14055 if value != nil { 14056 jtv, ok := value.(string) 14057 if !ok { 14058 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14059 } 14060 sv.Message = ptr.String(jtv) 14061 } 14062 14063 default: 14064 _, _ = key, value 14065 14066 } 14067 } 14068 *v = sv 14069 return nil 14070} 14071 14072func awsRestjson1_deserializeDocumentCors(v **types.Cors, value interface{}) error { 14073 if v == nil { 14074 return fmt.Errorf("unexpected nil of type %T", v) 14075 } 14076 if value == nil { 14077 return nil 14078 } 14079 14080 shape, ok := value.(map[string]interface{}) 14081 if !ok { 14082 return fmt.Errorf("unexpected JSON type %v", value) 14083 } 14084 14085 var sv *types.Cors 14086 if *v == nil { 14087 sv = &types.Cors{} 14088 } else { 14089 sv = *v 14090 } 14091 14092 for key, value := range shape { 14093 switch key { 14094 case "allowCredentials": 14095 if value != nil { 14096 jtv, ok := value.(bool) 14097 if !ok { 14098 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 14099 } 14100 sv.AllowCredentials = jtv 14101 } 14102 14103 case "allowHeaders": 14104 if err := awsRestjson1_deserializeDocumentCorsHeaderList(&sv.AllowHeaders, value); err != nil { 14105 return err 14106 } 14107 14108 case "allowMethods": 14109 if err := awsRestjson1_deserializeDocumentCorsMethodList(&sv.AllowMethods, value); err != nil { 14110 return err 14111 } 14112 14113 case "allowOrigins": 14114 if err := awsRestjson1_deserializeDocumentCorsOriginList(&sv.AllowOrigins, value); err != nil { 14115 return err 14116 } 14117 14118 case "exposeHeaders": 14119 if err := awsRestjson1_deserializeDocumentCorsHeaderList(&sv.ExposeHeaders, value); err != nil { 14120 return err 14121 } 14122 14123 case "maxAge": 14124 if value != nil { 14125 jtv, ok := value.(json.Number) 14126 if !ok { 14127 return fmt.Errorf("expected IntegerWithLengthBetweenMinus1And86400 to be json.Number, got %T instead", value) 14128 } 14129 i64, err := jtv.Int64() 14130 if err != nil { 14131 return err 14132 } 14133 sv.MaxAge = int32(i64) 14134 } 14135 14136 default: 14137 _, _ = key, value 14138 14139 } 14140 } 14141 *v = sv 14142 return nil 14143} 14144 14145func awsRestjson1_deserializeDocumentCorsHeaderList(v *[]string, value interface{}) error { 14146 if v == nil { 14147 return fmt.Errorf("unexpected nil of type %T", v) 14148 } 14149 if value == nil { 14150 return nil 14151 } 14152 14153 shape, ok := value.([]interface{}) 14154 if !ok { 14155 return fmt.Errorf("unexpected JSON type %v", value) 14156 } 14157 14158 var cv []string 14159 if *v == nil { 14160 cv = []string{} 14161 } else { 14162 cv = *v 14163 } 14164 14165 for _, value := range shape { 14166 var col string 14167 if value != nil { 14168 jtv, ok := value.(string) 14169 if !ok { 14170 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14171 } 14172 col = jtv 14173 } 14174 cv = append(cv, col) 14175 14176 } 14177 *v = cv 14178 return nil 14179} 14180 14181func awsRestjson1_deserializeDocumentCorsMethodList(v *[]string, value interface{}) error { 14182 if v == nil { 14183 return fmt.Errorf("unexpected nil of type %T", v) 14184 } 14185 if value == nil { 14186 return nil 14187 } 14188 14189 shape, ok := value.([]interface{}) 14190 if !ok { 14191 return fmt.Errorf("unexpected JSON type %v", value) 14192 } 14193 14194 var cv []string 14195 if *v == nil { 14196 cv = []string{} 14197 } else { 14198 cv = *v 14199 } 14200 14201 for _, value := range shape { 14202 var col string 14203 if value != nil { 14204 jtv, ok := value.(string) 14205 if !ok { 14206 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 14207 } 14208 col = jtv 14209 } 14210 cv = append(cv, col) 14211 14212 } 14213 *v = cv 14214 return nil 14215} 14216 14217func awsRestjson1_deserializeDocumentCorsOriginList(v *[]string, value interface{}) error { 14218 if v == nil { 14219 return fmt.Errorf("unexpected nil of type %T", v) 14220 } 14221 if value == nil { 14222 return nil 14223 } 14224 14225 shape, ok := value.([]interface{}) 14226 if !ok { 14227 return fmt.Errorf("unexpected JSON type %v", value) 14228 } 14229 14230 var cv []string 14231 if *v == nil { 14232 cv = []string{} 14233 } else { 14234 cv = *v 14235 } 14236 14237 for _, value := range shape { 14238 var col string 14239 if value != nil { 14240 jtv, ok := value.(string) 14241 if !ok { 14242 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14243 } 14244 col = jtv 14245 } 14246 cv = append(cv, col) 14247 14248 } 14249 *v = cv 14250 return nil 14251} 14252 14253func awsRestjson1_deserializeDocumentDeployment(v **types.Deployment, value interface{}) error { 14254 if v == nil { 14255 return fmt.Errorf("unexpected nil of type %T", v) 14256 } 14257 if value == nil { 14258 return nil 14259 } 14260 14261 shape, ok := value.(map[string]interface{}) 14262 if !ok { 14263 return fmt.Errorf("unexpected JSON type %v", value) 14264 } 14265 14266 var sv *types.Deployment 14267 if *v == nil { 14268 sv = &types.Deployment{} 14269 } else { 14270 sv = *v 14271 } 14272 14273 for key, value := range shape { 14274 switch key { 14275 case "autoDeployed": 14276 if value != nil { 14277 jtv, ok := value.(bool) 14278 if !ok { 14279 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 14280 } 14281 sv.AutoDeployed = jtv 14282 } 14283 14284 case "createdDate": 14285 if value != nil { 14286 jtv, ok := value.(string) 14287 if !ok { 14288 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 14289 } 14290 t, err := smithytime.ParseDateTime(jtv) 14291 if err != nil { 14292 return err 14293 } 14294 sv.CreatedDate = ptr.Time(t) 14295 } 14296 14297 case "deploymentId": 14298 if value != nil { 14299 jtv, ok := value.(string) 14300 if !ok { 14301 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14302 } 14303 sv.DeploymentId = ptr.String(jtv) 14304 } 14305 14306 case "deploymentStatus": 14307 if value != nil { 14308 jtv, ok := value.(string) 14309 if !ok { 14310 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 14311 } 14312 sv.DeploymentStatus = types.DeploymentStatus(jtv) 14313 } 14314 14315 case "deploymentStatusMessage": 14316 if value != nil { 14317 jtv, ok := value.(string) 14318 if !ok { 14319 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14320 } 14321 sv.DeploymentStatusMessage = ptr.String(jtv) 14322 } 14323 14324 case "description": 14325 if value != nil { 14326 jtv, ok := value.(string) 14327 if !ok { 14328 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 14329 } 14330 sv.Description = ptr.String(jtv) 14331 } 14332 14333 default: 14334 _, _ = key, value 14335 14336 } 14337 } 14338 *v = sv 14339 return nil 14340} 14341 14342func awsRestjson1_deserializeDocumentDomainName(v **types.DomainName, value interface{}) error { 14343 if v == nil { 14344 return fmt.Errorf("unexpected nil of type %T", v) 14345 } 14346 if value == nil { 14347 return nil 14348 } 14349 14350 shape, ok := value.(map[string]interface{}) 14351 if !ok { 14352 return fmt.Errorf("unexpected JSON type %v", value) 14353 } 14354 14355 var sv *types.DomainName 14356 if *v == nil { 14357 sv = &types.DomainName{} 14358 } else { 14359 sv = *v 14360 } 14361 14362 for key, value := range shape { 14363 switch key { 14364 case "apiMappingSelectionExpression": 14365 if value != nil { 14366 jtv, ok := value.(string) 14367 if !ok { 14368 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 14369 } 14370 sv.ApiMappingSelectionExpression = ptr.String(jtv) 14371 } 14372 14373 case "domainName": 14374 if value != nil { 14375 jtv, ok := value.(string) 14376 if !ok { 14377 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 14378 } 14379 sv.DomainName = ptr.String(jtv) 14380 } 14381 14382 case "domainNameConfigurations": 14383 if err := awsRestjson1_deserializeDocumentDomainNameConfigurations(&sv.DomainNameConfigurations, value); err != nil { 14384 return err 14385 } 14386 14387 case "mutualTlsAuthentication": 14388 if err := awsRestjson1_deserializeDocumentMutualTlsAuthentication(&sv.MutualTlsAuthentication, value); err != nil { 14389 return err 14390 } 14391 14392 case "tags": 14393 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 14394 return err 14395 } 14396 14397 default: 14398 _, _ = key, value 14399 14400 } 14401 } 14402 *v = sv 14403 return nil 14404} 14405 14406func awsRestjson1_deserializeDocumentDomainNameConfiguration(v **types.DomainNameConfiguration, value interface{}) error { 14407 if v == nil { 14408 return fmt.Errorf("unexpected nil of type %T", v) 14409 } 14410 if value == nil { 14411 return nil 14412 } 14413 14414 shape, ok := value.(map[string]interface{}) 14415 if !ok { 14416 return fmt.Errorf("unexpected JSON type %v", value) 14417 } 14418 14419 var sv *types.DomainNameConfiguration 14420 if *v == nil { 14421 sv = &types.DomainNameConfiguration{} 14422 } else { 14423 sv = *v 14424 } 14425 14426 for key, value := range shape { 14427 switch key { 14428 case "apiGatewayDomainName": 14429 if value != nil { 14430 jtv, ok := value.(string) 14431 if !ok { 14432 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14433 } 14434 sv.ApiGatewayDomainName = ptr.String(jtv) 14435 } 14436 14437 case "certificateArn": 14438 if value != nil { 14439 jtv, ok := value.(string) 14440 if !ok { 14441 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 14442 } 14443 sv.CertificateArn = ptr.String(jtv) 14444 } 14445 14446 case "certificateName": 14447 if value != nil { 14448 jtv, ok := value.(string) 14449 if !ok { 14450 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 14451 } 14452 sv.CertificateName = ptr.String(jtv) 14453 } 14454 14455 case "certificateUploadDate": 14456 if value != nil { 14457 jtv, ok := value.(string) 14458 if !ok { 14459 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 14460 } 14461 t, err := smithytime.ParseDateTime(jtv) 14462 if err != nil { 14463 return err 14464 } 14465 sv.CertificateUploadDate = ptr.Time(t) 14466 } 14467 14468 case "domainNameStatus": 14469 if value != nil { 14470 jtv, ok := value.(string) 14471 if !ok { 14472 return fmt.Errorf("expected DomainNameStatus to be of type string, got %T instead", value) 14473 } 14474 sv.DomainNameStatus = types.DomainNameStatus(jtv) 14475 } 14476 14477 case "domainNameStatusMessage": 14478 if value != nil { 14479 jtv, ok := value.(string) 14480 if !ok { 14481 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14482 } 14483 sv.DomainNameStatusMessage = ptr.String(jtv) 14484 } 14485 14486 case "endpointType": 14487 if value != nil { 14488 jtv, ok := value.(string) 14489 if !ok { 14490 return fmt.Errorf("expected EndpointType to be of type string, got %T instead", value) 14491 } 14492 sv.EndpointType = types.EndpointType(jtv) 14493 } 14494 14495 case "hostedZoneId": 14496 if value != nil { 14497 jtv, ok := value.(string) 14498 if !ok { 14499 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14500 } 14501 sv.HostedZoneId = ptr.String(jtv) 14502 } 14503 14504 case "securityPolicy": 14505 if value != nil { 14506 jtv, ok := value.(string) 14507 if !ok { 14508 return fmt.Errorf("expected SecurityPolicy to be of type string, got %T instead", value) 14509 } 14510 sv.SecurityPolicy = types.SecurityPolicy(jtv) 14511 } 14512 14513 default: 14514 _, _ = key, value 14515 14516 } 14517 } 14518 *v = sv 14519 return nil 14520} 14521 14522func awsRestjson1_deserializeDocumentDomainNameConfigurations(v *[]types.DomainNameConfiguration, value interface{}) error { 14523 if v == nil { 14524 return fmt.Errorf("unexpected nil of type %T", v) 14525 } 14526 if value == nil { 14527 return nil 14528 } 14529 14530 shape, ok := value.([]interface{}) 14531 if !ok { 14532 return fmt.Errorf("unexpected JSON type %v", value) 14533 } 14534 14535 var cv []types.DomainNameConfiguration 14536 if *v == nil { 14537 cv = []types.DomainNameConfiguration{} 14538 } else { 14539 cv = *v 14540 } 14541 14542 for _, value := range shape { 14543 var col types.DomainNameConfiguration 14544 destAddr := &col 14545 if err := awsRestjson1_deserializeDocumentDomainNameConfiguration(&destAddr, value); err != nil { 14546 return err 14547 } 14548 col = *destAddr 14549 cv = append(cv, col) 14550 14551 } 14552 *v = cv 14553 return nil 14554} 14555 14556func awsRestjson1_deserializeDocumentIdentitySourceList(v *[]string, value interface{}) error { 14557 if v == nil { 14558 return fmt.Errorf("unexpected nil of type %T", v) 14559 } 14560 if value == nil { 14561 return nil 14562 } 14563 14564 shape, ok := value.([]interface{}) 14565 if !ok { 14566 return fmt.Errorf("unexpected JSON type %v", value) 14567 } 14568 14569 var cv []string 14570 if *v == nil { 14571 cv = []string{} 14572 } else { 14573 cv = *v 14574 } 14575 14576 for _, value := range shape { 14577 var col string 14578 if value != nil { 14579 jtv, ok := value.(string) 14580 if !ok { 14581 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14582 } 14583 col = jtv 14584 } 14585 cv = append(cv, col) 14586 14587 } 14588 *v = cv 14589 return nil 14590} 14591 14592func awsRestjson1_deserializeDocumentIntegration(v **types.Integration, value interface{}) error { 14593 if v == nil { 14594 return fmt.Errorf("unexpected nil of type %T", v) 14595 } 14596 if value == nil { 14597 return nil 14598 } 14599 14600 shape, ok := value.(map[string]interface{}) 14601 if !ok { 14602 return fmt.Errorf("unexpected JSON type %v", value) 14603 } 14604 14605 var sv *types.Integration 14606 if *v == nil { 14607 sv = &types.Integration{} 14608 } else { 14609 sv = *v 14610 } 14611 14612 for key, value := range shape { 14613 switch key { 14614 case "apiGatewayManaged": 14615 if value != nil { 14616 jtv, ok := value.(bool) 14617 if !ok { 14618 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 14619 } 14620 sv.ApiGatewayManaged = jtv 14621 } 14622 14623 case "connectionId": 14624 if value != nil { 14625 jtv, ok := value.(string) 14626 if !ok { 14627 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 14628 } 14629 sv.ConnectionId = ptr.String(jtv) 14630 } 14631 14632 case "connectionType": 14633 if value != nil { 14634 jtv, ok := value.(string) 14635 if !ok { 14636 return fmt.Errorf("expected ConnectionType to be of type string, got %T instead", value) 14637 } 14638 sv.ConnectionType = types.ConnectionType(jtv) 14639 } 14640 14641 case "contentHandlingStrategy": 14642 if value != nil { 14643 jtv, ok := value.(string) 14644 if !ok { 14645 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 14646 } 14647 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 14648 } 14649 14650 case "credentialsArn": 14651 if value != nil { 14652 jtv, ok := value.(string) 14653 if !ok { 14654 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 14655 } 14656 sv.CredentialsArn = ptr.String(jtv) 14657 } 14658 14659 case "description": 14660 if value != nil { 14661 jtv, ok := value.(string) 14662 if !ok { 14663 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 14664 } 14665 sv.Description = ptr.String(jtv) 14666 } 14667 14668 case "integrationId": 14669 if value != nil { 14670 jtv, ok := value.(string) 14671 if !ok { 14672 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14673 } 14674 sv.IntegrationId = ptr.String(jtv) 14675 } 14676 14677 case "integrationMethod": 14678 if value != nil { 14679 jtv, ok := value.(string) 14680 if !ok { 14681 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 14682 } 14683 sv.IntegrationMethod = ptr.String(jtv) 14684 } 14685 14686 case "integrationResponseSelectionExpression": 14687 if value != nil { 14688 jtv, ok := value.(string) 14689 if !ok { 14690 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 14691 } 14692 sv.IntegrationResponseSelectionExpression = ptr.String(jtv) 14693 } 14694 14695 case "integrationSubtype": 14696 if value != nil { 14697 jtv, ok := value.(string) 14698 if !ok { 14699 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 14700 } 14701 sv.IntegrationSubtype = ptr.String(jtv) 14702 } 14703 14704 case "integrationType": 14705 if value != nil { 14706 jtv, ok := value.(string) 14707 if !ok { 14708 return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) 14709 } 14710 sv.IntegrationType = types.IntegrationType(jtv) 14711 } 14712 14713 case "integrationUri": 14714 if value != nil { 14715 jtv, ok := value.(string) 14716 if !ok { 14717 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 14718 } 14719 sv.IntegrationUri = ptr.String(jtv) 14720 } 14721 14722 case "passthroughBehavior": 14723 if value != nil { 14724 jtv, ok := value.(string) 14725 if !ok { 14726 return fmt.Errorf("expected PassthroughBehavior to be of type string, got %T instead", value) 14727 } 14728 sv.PassthroughBehavior = types.PassthroughBehavior(jtv) 14729 } 14730 14731 case "payloadFormatVersion": 14732 if value != nil { 14733 jtv, ok := value.(string) 14734 if !ok { 14735 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 14736 } 14737 sv.PayloadFormatVersion = ptr.String(jtv) 14738 } 14739 14740 case "requestParameters": 14741 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.RequestParameters, value); err != nil { 14742 return err 14743 } 14744 14745 case "requestTemplates": 14746 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.RequestTemplates, value); err != nil { 14747 return err 14748 } 14749 14750 case "responseParameters": 14751 if err := awsRestjson1_deserializeDocumentResponseParameters(&sv.ResponseParameters, value); err != nil { 14752 return err 14753 } 14754 14755 case "templateSelectionExpression": 14756 if value != nil { 14757 jtv, ok := value.(string) 14758 if !ok { 14759 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 14760 } 14761 sv.TemplateSelectionExpression = ptr.String(jtv) 14762 } 14763 14764 case "timeoutInMillis": 14765 if value != nil { 14766 jtv, ok := value.(json.Number) 14767 if !ok { 14768 return fmt.Errorf("expected IntegerWithLengthBetween50And30000 to be json.Number, got %T instead", value) 14769 } 14770 i64, err := jtv.Int64() 14771 if err != nil { 14772 return err 14773 } 14774 sv.TimeoutInMillis = int32(i64) 14775 } 14776 14777 case "tlsConfig": 14778 if err := awsRestjson1_deserializeDocumentTlsConfig(&sv.TlsConfig, value); err != nil { 14779 return err 14780 } 14781 14782 default: 14783 _, _ = key, value 14784 14785 } 14786 } 14787 *v = sv 14788 return nil 14789} 14790 14791func awsRestjson1_deserializeDocumentIntegrationParameters(v *map[string]string, value interface{}) error { 14792 if v == nil { 14793 return fmt.Errorf("unexpected nil of type %T", v) 14794 } 14795 if value == nil { 14796 return nil 14797 } 14798 14799 shape, ok := value.(map[string]interface{}) 14800 if !ok { 14801 return fmt.Errorf("unexpected JSON type %v", value) 14802 } 14803 14804 var mv map[string]string 14805 if *v == nil { 14806 mv = map[string]string{} 14807 } else { 14808 mv = *v 14809 } 14810 14811 for key, value := range shape { 14812 var parsedVal string 14813 if value != nil { 14814 jtv, ok := value.(string) 14815 if !ok { 14816 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 14817 } 14818 parsedVal = jtv 14819 } 14820 mv[key] = parsedVal 14821 14822 } 14823 *v = mv 14824 return nil 14825} 14826 14827func awsRestjson1_deserializeDocumentIntegrationResponse(v **types.IntegrationResponse, value interface{}) error { 14828 if v == nil { 14829 return fmt.Errorf("unexpected nil of type %T", v) 14830 } 14831 if value == nil { 14832 return nil 14833 } 14834 14835 shape, ok := value.(map[string]interface{}) 14836 if !ok { 14837 return fmt.Errorf("unexpected JSON type %v", value) 14838 } 14839 14840 var sv *types.IntegrationResponse 14841 if *v == nil { 14842 sv = &types.IntegrationResponse{} 14843 } else { 14844 sv = *v 14845 } 14846 14847 for key, value := range shape { 14848 switch key { 14849 case "contentHandlingStrategy": 14850 if value != nil { 14851 jtv, ok := value.(string) 14852 if !ok { 14853 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 14854 } 14855 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 14856 } 14857 14858 case "integrationResponseId": 14859 if value != nil { 14860 jtv, ok := value.(string) 14861 if !ok { 14862 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14863 } 14864 sv.IntegrationResponseId = ptr.String(jtv) 14865 } 14866 14867 case "integrationResponseKey": 14868 if value != nil { 14869 jtv, ok := value.(string) 14870 if !ok { 14871 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 14872 } 14873 sv.IntegrationResponseKey = ptr.String(jtv) 14874 } 14875 14876 case "responseParameters": 14877 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.ResponseParameters, value); err != nil { 14878 return err 14879 } 14880 14881 case "responseTemplates": 14882 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.ResponseTemplates, value); err != nil { 14883 return err 14884 } 14885 14886 case "templateSelectionExpression": 14887 if value != nil { 14888 jtv, ok := value.(string) 14889 if !ok { 14890 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 14891 } 14892 sv.TemplateSelectionExpression = ptr.String(jtv) 14893 } 14894 14895 default: 14896 _, _ = key, value 14897 14898 } 14899 } 14900 *v = sv 14901 return nil 14902} 14903 14904func awsRestjson1_deserializeDocumentJWTConfiguration(v **types.JWTConfiguration, value interface{}) error { 14905 if v == nil { 14906 return fmt.Errorf("unexpected nil of type %T", v) 14907 } 14908 if value == nil { 14909 return nil 14910 } 14911 14912 shape, ok := value.(map[string]interface{}) 14913 if !ok { 14914 return fmt.Errorf("unexpected JSON type %v", value) 14915 } 14916 14917 var sv *types.JWTConfiguration 14918 if *v == nil { 14919 sv = &types.JWTConfiguration{} 14920 } else { 14921 sv = *v 14922 } 14923 14924 for key, value := range shape { 14925 switch key { 14926 case "audience": 14927 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Audience, value); err != nil { 14928 return err 14929 } 14930 14931 case "issuer": 14932 if value != nil { 14933 jtv, ok := value.(string) 14934 if !ok { 14935 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 14936 } 14937 sv.Issuer = ptr.String(jtv) 14938 } 14939 14940 default: 14941 _, _ = key, value 14942 14943 } 14944 } 14945 *v = sv 14946 return nil 14947} 14948 14949func awsRestjson1_deserializeDocumentModel(v **types.Model, value interface{}) error { 14950 if v == nil { 14951 return fmt.Errorf("unexpected nil of type %T", v) 14952 } 14953 if value == nil { 14954 return nil 14955 } 14956 14957 shape, ok := value.(map[string]interface{}) 14958 if !ok { 14959 return fmt.Errorf("unexpected JSON type %v", value) 14960 } 14961 14962 var sv *types.Model 14963 if *v == nil { 14964 sv = &types.Model{} 14965 } else { 14966 sv = *v 14967 } 14968 14969 for key, value := range shape { 14970 switch key { 14971 case "contentType": 14972 if value != nil { 14973 jtv, ok := value.(string) 14974 if !ok { 14975 return fmt.Errorf("expected StringWithLengthBetween1And256 to be of type string, got %T instead", value) 14976 } 14977 sv.ContentType = ptr.String(jtv) 14978 } 14979 14980 case "description": 14981 if value != nil { 14982 jtv, ok := value.(string) 14983 if !ok { 14984 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 14985 } 14986 sv.Description = ptr.String(jtv) 14987 } 14988 14989 case "modelId": 14990 if value != nil { 14991 jtv, ok := value.(string) 14992 if !ok { 14993 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14994 } 14995 sv.ModelId = ptr.String(jtv) 14996 } 14997 14998 case "name": 14999 if value != nil { 15000 jtv, ok := value.(string) 15001 if !ok { 15002 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 15003 } 15004 sv.Name = ptr.String(jtv) 15005 } 15006 15007 case "schema": 15008 if value != nil { 15009 jtv, ok := value.(string) 15010 if !ok { 15011 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 15012 } 15013 sv.Schema = ptr.String(jtv) 15014 } 15015 15016 default: 15017 _, _ = key, value 15018 15019 } 15020 } 15021 *v = sv 15022 return nil 15023} 15024 15025func awsRestjson1_deserializeDocumentMutualTlsAuthentication(v **types.MutualTlsAuthentication, value interface{}) error { 15026 if v == nil { 15027 return fmt.Errorf("unexpected nil of type %T", v) 15028 } 15029 if value == nil { 15030 return nil 15031 } 15032 15033 shape, ok := value.(map[string]interface{}) 15034 if !ok { 15035 return fmt.Errorf("unexpected JSON type %v", value) 15036 } 15037 15038 var sv *types.MutualTlsAuthentication 15039 if *v == nil { 15040 sv = &types.MutualTlsAuthentication{} 15041 } else { 15042 sv = *v 15043 } 15044 15045 for key, value := range shape { 15046 switch key { 15047 case "truststoreUri": 15048 if value != nil { 15049 jtv, ok := value.(string) 15050 if !ok { 15051 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 15052 } 15053 sv.TruststoreUri = ptr.String(jtv) 15054 } 15055 15056 case "truststoreVersion": 15057 if value != nil { 15058 jtv, ok := value.(string) 15059 if !ok { 15060 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 15061 } 15062 sv.TruststoreVersion = ptr.String(jtv) 15063 } 15064 15065 case "truststoreWarnings": 15066 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.TruststoreWarnings, value); err != nil { 15067 return err 15068 } 15069 15070 default: 15071 _, _ = key, value 15072 15073 } 15074 } 15075 *v = sv 15076 return nil 15077} 15078 15079func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 15080 if v == nil { 15081 return fmt.Errorf("unexpected nil of type %T", v) 15082 } 15083 if value == nil { 15084 return nil 15085 } 15086 15087 shape, ok := value.(map[string]interface{}) 15088 if !ok { 15089 return fmt.Errorf("unexpected JSON type %v", value) 15090 } 15091 15092 var sv *types.NotFoundException 15093 if *v == nil { 15094 sv = &types.NotFoundException{} 15095 } else { 15096 sv = *v 15097 } 15098 15099 for key, value := range shape { 15100 switch key { 15101 case "message": 15102 if value != nil { 15103 jtv, ok := value.(string) 15104 if !ok { 15105 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15106 } 15107 sv.Message = ptr.String(jtv) 15108 } 15109 15110 case "resourceType": 15111 if value != nil { 15112 jtv, ok := value.(string) 15113 if !ok { 15114 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15115 } 15116 sv.ResourceType = ptr.String(jtv) 15117 } 15118 15119 default: 15120 _, _ = key, value 15121 15122 } 15123 } 15124 *v = sv 15125 return nil 15126} 15127 15128func awsRestjson1_deserializeDocumentParameterConstraints(v **types.ParameterConstraints, value interface{}) error { 15129 if v == nil { 15130 return fmt.Errorf("unexpected nil of type %T", v) 15131 } 15132 if value == nil { 15133 return nil 15134 } 15135 15136 shape, ok := value.(map[string]interface{}) 15137 if !ok { 15138 return fmt.Errorf("unexpected JSON type %v", value) 15139 } 15140 15141 var sv *types.ParameterConstraints 15142 if *v == nil { 15143 sv = &types.ParameterConstraints{} 15144 } else { 15145 sv = *v 15146 } 15147 15148 for key, value := range shape { 15149 switch key { 15150 case "required": 15151 if value != nil { 15152 jtv, ok := value.(bool) 15153 if !ok { 15154 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15155 } 15156 sv.Required = jtv 15157 } 15158 15159 default: 15160 _, _ = key, value 15161 15162 } 15163 } 15164 *v = sv 15165 return nil 15166} 15167 15168func awsRestjson1_deserializeDocumentResponseParameters(v *map[string]map[string]string, value interface{}) error { 15169 if v == nil { 15170 return fmt.Errorf("unexpected nil of type %T", v) 15171 } 15172 if value == nil { 15173 return nil 15174 } 15175 15176 shape, ok := value.(map[string]interface{}) 15177 if !ok { 15178 return fmt.Errorf("unexpected JSON type %v", value) 15179 } 15180 15181 var mv map[string]map[string]string 15182 if *v == nil { 15183 mv = map[string]map[string]string{} 15184 } else { 15185 mv = *v 15186 } 15187 15188 for key, value := range shape { 15189 var parsedVal map[string]string 15190 mapVar := parsedVal 15191 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&mapVar, value); err != nil { 15192 return err 15193 } 15194 parsedVal = mapVar 15195 mv[key] = parsedVal 15196 15197 } 15198 *v = mv 15199 return nil 15200} 15201 15202func awsRestjson1_deserializeDocumentRoute(v **types.Route, value interface{}) error { 15203 if v == nil { 15204 return fmt.Errorf("unexpected nil of type %T", v) 15205 } 15206 if value == nil { 15207 return nil 15208 } 15209 15210 shape, ok := value.(map[string]interface{}) 15211 if !ok { 15212 return fmt.Errorf("unexpected JSON type %v", value) 15213 } 15214 15215 var sv *types.Route 15216 if *v == nil { 15217 sv = &types.Route{} 15218 } else { 15219 sv = *v 15220 } 15221 15222 for key, value := range shape { 15223 switch key { 15224 case "apiGatewayManaged": 15225 if value != nil { 15226 jtv, ok := value.(bool) 15227 if !ok { 15228 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15229 } 15230 sv.ApiGatewayManaged = jtv 15231 } 15232 15233 case "apiKeyRequired": 15234 if value != nil { 15235 jtv, ok := value.(bool) 15236 if !ok { 15237 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15238 } 15239 sv.ApiKeyRequired = jtv 15240 } 15241 15242 case "authorizationScopes": 15243 if err := awsRestjson1_deserializeDocumentAuthorizationScopes(&sv.AuthorizationScopes, value); err != nil { 15244 return err 15245 } 15246 15247 case "authorizationType": 15248 if value != nil { 15249 jtv, ok := value.(string) 15250 if !ok { 15251 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 15252 } 15253 sv.AuthorizationType = types.AuthorizationType(jtv) 15254 } 15255 15256 case "authorizerId": 15257 if value != nil { 15258 jtv, ok := value.(string) 15259 if !ok { 15260 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15261 } 15262 sv.AuthorizerId = ptr.String(jtv) 15263 } 15264 15265 case "modelSelectionExpression": 15266 if value != nil { 15267 jtv, ok := value.(string) 15268 if !ok { 15269 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 15270 } 15271 sv.ModelSelectionExpression = ptr.String(jtv) 15272 } 15273 15274 case "operationName": 15275 if value != nil { 15276 jtv, ok := value.(string) 15277 if !ok { 15278 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 15279 } 15280 sv.OperationName = ptr.String(jtv) 15281 } 15282 15283 case "requestModels": 15284 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.RequestModels, value); err != nil { 15285 return err 15286 } 15287 15288 case "requestParameters": 15289 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.RequestParameters, value); err != nil { 15290 return err 15291 } 15292 15293 case "routeId": 15294 if value != nil { 15295 jtv, ok := value.(string) 15296 if !ok { 15297 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15298 } 15299 sv.RouteId = ptr.String(jtv) 15300 } 15301 15302 case "routeKey": 15303 if value != nil { 15304 jtv, ok := value.(string) 15305 if !ok { 15306 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 15307 } 15308 sv.RouteKey = ptr.String(jtv) 15309 } 15310 15311 case "routeResponseSelectionExpression": 15312 if value != nil { 15313 jtv, ok := value.(string) 15314 if !ok { 15315 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 15316 } 15317 sv.RouteResponseSelectionExpression = ptr.String(jtv) 15318 } 15319 15320 case "target": 15321 if value != nil { 15322 jtv, ok := value.(string) 15323 if !ok { 15324 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 15325 } 15326 sv.Target = ptr.String(jtv) 15327 } 15328 15329 default: 15330 _, _ = key, value 15331 15332 } 15333 } 15334 *v = sv 15335 return nil 15336} 15337 15338func awsRestjson1_deserializeDocumentRouteModels(v *map[string]string, value interface{}) error { 15339 if v == nil { 15340 return fmt.Errorf("unexpected nil of type %T", v) 15341 } 15342 if value == nil { 15343 return nil 15344 } 15345 15346 shape, ok := value.(map[string]interface{}) 15347 if !ok { 15348 return fmt.Errorf("unexpected JSON type %v", value) 15349 } 15350 15351 var mv map[string]string 15352 if *v == nil { 15353 mv = map[string]string{} 15354 } else { 15355 mv = *v 15356 } 15357 15358 for key, value := range shape { 15359 var parsedVal string 15360 if value != nil { 15361 jtv, ok := value.(string) 15362 if !ok { 15363 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 15364 } 15365 parsedVal = jtv 15366 } 15367 mv[key] = parsedVal 15368 15369 } 15370 *v = mv 15371 return nil 15372} 15373 15374func awsRestjson1_deserializeDocumentRouteParameters(v *map[string]types.ParameterConstraints, value interface{}) error { 15375 if v == nil { 15376 return fmt.Errorf("unexpected nil of type %T", v) 15377 } 15378 if value == nil { 15379 return nil 15380 } 15381 15382 shape, ok := value.(map[string]interface{}) 15383 if !ok { 15384 return fmt.Errorf("unexpected JSON type %v", value) 15385 } 15386 15387 var mv map[string]types.ParameterConstraints 15388 if *v == nil { 15389 mv = map[string]types.ParameterConstraints{} 15390 } else { 15391 mv = *v 15392 } 15393 15394 for key, value := range shape { 15395 var parsedVal types.ParameterConstraints 15396 mapVar := parsedVal 15397 destAddr := &mapVar 15398 if err := awsRestjson1_deserializeDocumentParameterConstraints(&destAddr, value); err != nil { 15399 return err 15400 } 15401 parsedVal = *destAddr 15402 mv[key] = parsedVal 15403 15404 } 15405 *v = mv 15406 return nil 15407} 15408 15409func awsRestjson1_deserializeDocumentRouteResponse(v **types.RouteResponse, value interface{}) error { 15410 if v == nil { 15411 return fmt.Errorf("unexpected nil of type %T", v) 15412 } 15413 if value == nil { 15414 return nil 15415 } 15416 15417 shape, ok := value.(map[string]interface{}) 15418 if !ok { 15419 return fmt.Errorf("unexpected JSON type %v", value) 15420 } 15421 15422 var sv *types.RouteResponse 15423 if *v == nil { 15424 sv = &types.RouteResponse{} 15425 } else { 15426 sv = *v 15427 } 15428 15429 for key, value := range shape { 15430 switch key { 15431 case "modelSelectionExpression": 15432 if value != nil { 15433 jtv, ok := value.(string) 15434 if !ok { 15435 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 15436 } 15437 sv.ModelSelectionExpression = ptr.String(jtv) 15438 } 15439 15440 case "responseModels": 15441 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.ResponseModels, value); err != nil { 15442 return err 15443 } 15444 15445 case "responseParameters": 15446 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.ResponseParameters, value); err != nil { 15447 return err 15448 } 15449 15450 case "routeResponseId": 15451 if value != nil { 15452 jtv, ok := value.(string) 15453 if !ok { 15454 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15455 } 15456 sv.RouteResponseId = ptr.String(jtv) 15457 } 15458 15459 case "routeResponseKey": 15460 if value != nil { 15461 jtv, ok := value.(string) 15462 if !ok { 15463 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 15464 } 15465 sv.RouteResponseKey = ptr.String(jtv) 15466 } 15467 15468 default: 15469 _, _ = key, value 15470 15471 } 15472 } 15473 *v = sv 15474 return nil 15475} 15476 15477func awsRestjson1_deserializeDocumentRouteSettings(v **types.RouteSettings, value interface{}) error { 15478 if v == nil { 15479 return fmt.Errorf("unexpected nil of type %T", v) 15480 } 15481 if value == nil { 15482 return nil 15483 } 15484 15485 shape, ok := value.(map[string]interface{}) 15486 if !ok { 15487 return fmt.Errorf("unexpected JSON type %v", value) 15488 } 15489 15490 var sv *types.RouteSettings 15491 if *v == nil { 15492 sv = &types.RouteSettings{} 15493 } else { 15494 sv = *v 15495 } 15496 15497 for key, value := range shape { 15498 switch key { 15499 case "dataTraceEnabled": 15500 if value != nil { 15501 jtv, ok := value.(bool) 15502 if !ok { 15503 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15504 } 15505 sv.DataTraceEnabled = jtv 15506 } 15507 15508 case "detailedMetricsEnabled": 15509 if value != nil { 15510 jtv, ok := value.(bool) 15511 if !ok { 15512 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15513 } 15514 sv.DetailedMetricsEnabled = jtv 15515 } 15516 15517 case "loggingLevel": 15518 if value != nil { 15519 jtv, ok := value.(string) 15520 if !ok { 15521 return fmt.Errorf("expected LoggingLevel to be of type string, got %T instead", value) 15522 } 15523 sv.LoggingLevel = types.LoggingLevel(jtv) 15524 } 15525 15526 case "throttlingBurstLimit": 15527 if value != nil { 15528 jtv, ok := value.(json.Number) 15529 if !ok { 15530 return fmt.Errorf("expected __integer to be json.Number, got %T instead", value) 15531 } 15532 i64, err := jtv.Int64() 15533 if err != nil { 15534 return err 15535 } 15536 sv.ThrottlingBurstLimit = int32(i64) 15537 } 15538 15539 case "throttlingRateLimit": 15540 if value != nil { 15541 jtv, ok := value.(json.Number) 15542 if !ok { 15543 return fmt.Errorf("expected __double to be json.Number, got %T instead", value) 15544 } 15545 f64, err := jtv.Float64() 15546 if err != nil { 15547 return err 15548 } 15549 sv.ThrottlingRateLimit = f64 15550 } 15551 15552 default: 15553 _, _ = key, value 15554 15555 } 15556 } 15557 *v = sv 15558 return nil 15559} 15560 15561func awsRestjson1_deserializeDocumentRouteSettingsMap(v *map[string]types.RouteSettings, value interface{}) error { 15562 if v == nil { 15563 return fmt.Errorf("unexpected nil of type %T", v) 15564 } 15565 if value == nil { 15566 return nil 15567 } 15568 15569 shape, ok := value.(map[string]interface{}) 15570 if !ok { 15571 return fmt.Errorf("unexpected JSON type %v", value) 15572 } 15573 15574 var mv map[string]types.RouteSettings 15575 if *v == nil { 15576 mv = map[string]types.RouteSettings{} 15577 } else { 15578 mv = *v 15579 } 15580 15581 for key, value := range shape { 15582 var parsedVal types.RouteSettings 15583 mapVar := parsedVal 15584 destAddr := &mapVar 15585 if err := awsRestjson1_deserializeDocumentRouteSettings(&destAddr, value); err != nil { 15586 return err 15587 } 15588 parsedVal = *destAddr 15589 mv[key] = parsedVal 15590 15591 } 15592 *v = mv 15593 return nil 15594} 15595 15596func awsRestjson1_deserializeDocumentSecurityGroupIdList(v *[]string, value interface{}) error { 15597 if v == nil { 15598 return fmt.Errorf("unexpected nil of type %T", v) 15599 } 15600 if value == nil { 15601 return nil 15602 } 15603 15604 shape, ok := value.([]interface{}) 15605 if !ok { 15606 return fmt.Errorf("unexpected JSON type %v", value) 15607 } 15608 15609 var cv []string 15610 if *v == nil { 15611 cv = []string{} 15612 } else { 15613 cv = *v 15614 } 15615 15616 for _, value := range shape { 15617 var col string 15618 if value != nil { 15619 jtv, ok := value.(string) 15620 if !ok { 15621 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15622 } 15623 col = jtv 15624 } 15625 cv = append(cv, col) 15626 15627 } 15628 *v = cv 15629 return nil 15630} 15631 15632func awsRestjson1_deserializeDocumentStage(v **types.Stage, value interface{}) error { 15633 if v == nil { 15634 return fmt.Errorf("unexpected nil of type %T", v) 15635 } 15636 if value == nil { 15637 return nil 15638 } 15639 15640 shape, ok := value.(map[string]interface{}) 15641 if !ok { 15642 return fmt.Errorf("unexpected JSON type %v", value) 15643 } 15644 15645 var sv *types.Stage 15646 if *v == nil { 15647 sv = &types.Stage{} 15648 } else { 15649 sv = *v 15650 } 15651 15652 for key, value := range shape { 15653 switch key { 15654 case "accessLogSettings": 15655 if err := awsRestjson1_deserializeDocumentAccessLogSettings(&sv.AccessLogSettings, value); err != nil { 15656 return err 15657 } 15658 15659 case "apiGatewayManaged": 15660 if value != nil { 15661 jtv, ok := value.(bool) 15662 if !ok { 15663 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15664 } 15665 sv.ApiGatewayManaged = jtv 15666 } 15667 15668 case "autoDeploy": 15669 if value != nil { 15670 jtv, ok := value.(bool) 15671 if !ok { 15672 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15673 } 15674 sv.AutoDeploy = jtv 15675 } 15676 15677 case "clientCertificateId": 15678 if value != nil { 15679 jtv, ok := value.(string) 15680 if !ok { 15681 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15682 } 15683 sv.ClientCertificateId = ptr.String(jtv) 15684 } 15685 15686 case "createdDate": 15687 if value != nil { 15688 jtv, ok := value.(string) 15689 if !ok { 15690 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 15691 } 15692 t, err := smithytime.ParseDateTime(jtv) 15693 if err != nil { 15694 return err 15695 } 15696 sv.CreatedDate = ptr.Time(t) 15697 } 15698 15699 case "defaultRouteSettings": 15700 if err := awsRestjson1_deserializeDocumentRouteSettings(&sv.DefaultRouteSettings, value); err != nil { 15701 return err 15702 } 15703 15704 case "deploymentId": 15705 if value != nil { 15706 jtv, ok := value.(string) 15707 if !ok { 15708 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15709 } 15710 sv.DeploymentId = ptr.String(jtv) 15711 } 15712 15713 case "description": 15714 if value != nil { 15715 jtv, ok := value.(string) 15716 if !ok { 15717 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 15718 } 15719 sv.Description = ptr.String(jtv) 15720 } 15721 15722 case "lastDeploymentStatusMessage": 15723 if value != nil { 15724 jtv, ok := value.(string) 15725 if !ok { 15726 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15727 } 15728 sv.LastDeploymentStatusMessage = ptr.String(jtv) 15729 } 15730 15731 case "lastUpdatedDate": 15732 if value != nil { 15733 jtv, ok := value.(string) 15734 if !ok { 15735 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 15736 } 15737 t, err := smithytime.ParseDateTime(jtv) 15738 if err != nil { 15739 return err 15740 } 15741 sv.LastUpdatedDate = ptr.Time(t) 15742 } 15743 15744 case "routeSettings": 15745 if err := awsRestjson1_deserializeDocumentRouteSettingsMap(&sv.RouteSettings, value); err != nil { 15746 return err 15747 } 15748 15749 case "stageName": 15750 if value != nil { 15751 jtv, ok := value.(string) 15752 if !ok { 15753 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 15754 } 15755 sv.StageName = ptr.String(jtv) 15756 } 15757 15758 case "stageVariables": 15759 if err := awsRestjson1_deserializeDocumentStageVariablesMap(&sv.StageVariables, value); err != nil { 15760 return err 15761 } 15762 15763 case "tags": 15764 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 15765 return err 15766 } 15767 15768 default: 15769 _, _ = key, value 15770 15771 } 15772 } 15773 *v = sv 15774 return nil 15775} 15776 15777func awsRestjson1_deserializeDocumentStageVariablesMap(v *map[string]string, value interface{}) error { 15778 if v == nil { 15779 return fmt.Errorf("unexpected nil of type %T", v) 15780 } 15781 if value == nil { 15782 return nil 15783 } 15784 15785 shape, ok := value.(map[string]interface{}) 15786 if !ok { 15787 return fmt.Errorf("unexpected JSON type %v", value) 15788 } 15789 15790 var mv map[string]string 15791 if *v == nil { 15792 mv = map[string]string{} 15793 } else { 15794 mv = *v 15795 } 15796 15797 for key, value := range shape { 15798 var parsedVal string 15799 if value != nil { 15800 jtv, ok := value.(string) 15801 if !ok { 15802 return fmt.Errorf("expected StringWithLengthBetween0And2048 to be of type string, got %T instead", value) 15803 } 15804 parsedVal = jtv 15805 } 15806 mv[key] = parsedVal 15807 15808 } 15809 *v = mv 15810 return nil 15811} 15812 15813func awsRestjson1_deserializeDocumentSubnetIdList(v *[]string, value interface{}) error { 15814 if v == nil { 15815 return fmt.Errorf("unexpected nil of type %T", v) 15816 } 15817 if value == nil { 15818 return nil 15819 } 15820 15821 shape, ok := value.([]interface{}) 15822 if !ok { 15823 return fmt.Errorf("unexpected JSON type %v", value) 15824 } 15825 15826 var cv []string 15827 if *v == nil { 15828 cv = []string{} 15829 } else { 15830 cv = *v 15831 } 15832 15833 for _, value := range shape { 15834 var col string 15835 if value != nil { 15836 jtv, ok := value.(string) 15837 if !ok { 15838 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15839 } 15840 col = jtv 15841 } 15842 cv = append(cv, col) 15843 15844 } 15845 *v = cv 15846 return nil 15847} 15848 15849func awsRestjson1_deserializeDocumentTags(v *map[string]string, value interface{}) error { 15850 if v == nil { 15851 return fmt.Errorf("unexpected nil of type %T", v) 15852 } 15853 if value == nil { 15854 return nil 15855 } 15856 15857 shape, ok := value.(map[string]interface{}) 15858 if !ok { 15859 return fmt.Errorf("unexpected JSON type %v", value) 15860 } 15861 15862 var mv map[string]string 15863 if *v == nil { 15864 mv = map[string]string{} 15865 } else { 15866 mv = *v 15867 } 15868 15869 for key, value := range shape { 15870 var parsedVal string 15871 if value != nil { 15872 jtv, ok := value.(string) 15873 if !ok { 15874 return fmt.Errorf("expected StringWithLengthBetween1And1600 to be of type string, got %T instead", value) 15875 } 15876 parsedVal = jtv 15877 } 15878 mv[key] = parsedVal 15879 15880 } 15881 *v = mv 15882 return nil 15883} 15884 15885func awsRestjson1_deserializeDocumentTemplateMap(v *map[string]string, value interface{}) error { 15886 if v == nil { 15887 return fmt.Errorf("unexpected nil of type %T", v) 15888 } 15889 if value == nil { 15890 return nil 15891 } 15892 15893 shape, ok := value.(map[string]interface{}) 15894 if !ok { 15895 return fmt.Errorf("unexpected JSON type %v", value) 15896 } 15897 15898 var mv map[string]string 15899 if *v == nil { 15900 mv = map[string]string{} 15901 } else { 15902 mv = *v 15903 } 15904 15905 for key, value := range shape { 15906 var parsedVal string 15907 if value != nil { 15908 jtv, ok := value.(string) 15909 if !ok { 15910 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 15911 } 15912 parsedVal = jtv 15913 } 15914 mv[key] = parsedVal 15915 15916 } 15917 *v = mv 15918 return nil 15919} 15920 15921func awsRestjson1_deserializeDocumentTlsConfig(v **types.TlsConfig, value interface{}) error { 15922 if v == nil { 15923 return fmt.Errorf("unexpected nil of type %T", v) 15924 } 15925 if value == nil { 15926 return nil 15927 } 15928 15929 shape, ok := value.(map[string]interface{}) 15930 if !ok { 15931 return fmt.Errorf("unexpected JSON type %v", value) 15932 } 15933 15934 var sv *types.TlsConfig 15935 if *v == nil { 15936 sv = &types.TlsConfig{} 15937 } else { 15938 sv = *v 15939 } 15940 15941 for key, value := range shape { 15942 switch key { 15943 case "serverNameToVerify": 15944 if value != nil { 15945 jtv, ok := value.(string) 15946 if !ok { 15947 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 15948 } 15949 sv.ServerNameToVerify = ptr.String(jtv) 15950 } 15951 15952 default: 15953 _, _ = key, value 15954 15955 } 15956 } 15957 *v = sv 15958 return nil 15959} 15960 15961func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { 15962 if v == nil { 15963 return fmt.Errorf("unexpected nil of type %T", v) 15964 } 15965 if value == nil { 15966 return nil 15967 } 15968 15969 shape, ok := value.(map[string]interface{}) 15970 if !ok { 15971 return fmt.Errorf("unexpected JSON type %v", value) 15972 } 15973 15974 var sv *types.TooManyRequestsException 15975 if *v == nil { 15976 sv = &types.TooManyRequestsException{} 15977 } else { 15978 sv = *v 15979 } 15980 15981 for key, value := range shape { 15982 switch key { 15983 case "limitType": 15984 if value != nil { 15985 jtv, ok := value.(string) 15986 if !ok { 15987 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15988 } 15989 sv.LimitType = ptr.String(jtv) 15990 } 15991 15992 case "message": 15993 if value != nil { 15994 jtv, ok := value.(string) 15995 if !ok { 15996 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15997 } 15998 sv.Message = ptr.String(jtv) 15999 } 16000 16001 default: 16002 _, _ = key, value 16003 16004 } 16005 } 16006 *v = sv 16007 return nil 16008} 16009 16010func awsRestjson1_deserializeDocumentVpcLink(v **types.VpcLink, value interface{}) error { 16011 if v == nil { 16012 return fmt.Errorf("unexpected nil of type %T", v) 16013 } 16014 if value == nil { 16015 return nil 16016 } 16017 16018 shape, ok := value.(map[string]interface{}) 16019 if !ok { 16020 return fmt.Errorf("unexpected JSON type %v", value) 16021 } 16022 16023 var sv *types.VpcLink 16024 if *v == nil { 16025 sv = &types.VpcLink{} 16026 } else { 16027 sv = *v 16028 } 16029 16030 for key, value := range shape { 16031 switch key { 16032 case "createdDate": 16033 if value != nil { 16034 jtv, ok := value.(string) 16035 if !ok { 16036 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 16037 } 16038 t, err := smithytime.ParseDateTime(jtv) 16039 if err != nil { 16040 return err 16041 } 16042 sv.CreatedDate = ptr.Time(t) 16043 } 16044 16045 case "name": 16046 if value != nil { 16047 jtv, ok := value.(string) 16048 if !ok { 16049 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 16050 } 16051 sv.Name = ptr.String(jtv) 16052 } 16053 16054 case "securityGroupIds": 16055 if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { 16056 return err 16057 } 16058 16059 case "subnetIds": 16060 if err := awsRestjson1_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil { 16061 return err 16062 } 16063 16064 case "tags": 16065 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 16066 return err 16067 } 16068 16069 case "vpcLinkId": 16070 if value != nil { 16071 jtv, ok := value.(string) 16072 if !ok { 16073 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 16074 } 16075 sv.VpcLinkId = ptr.String(jtv) 16076 } 16077 16078 case "vpcLinkStatus": 16079 if value != nil { 16080 jtv, ok := value.(string) 16081 if !ok { 16082 return fmt.Errorf("expected VpcLinkStatus to be of type string, got %T instead", value) 16083 } 16084 sv.VpcLinkStatus = types.VpcLinkStatus(jtv) 16085 } 16086 16087 case "vpcLinkStatusMessage": 16088 if value != nil { 16089 jtv, ok := value.(string) 16090 if !ok { 16091 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 16092 } 16093 sv.VpcLinkStatusMessage = ptr.String(jtv) 16094 } 16095 16096 case "vpcLinkVersion": 16097 if value != nil { 16098 jtv, ok := value.(string) 16099 if !ok { 16100 return fmt.Errorf("expected VpcLinkVersion to be of type string, got %T instead", value) 16101 } 16102 sv.VpcLinkVersion = types.VpcLinkVersion(jtv) 16103 } 16104 16105 default: 16106 _, _ = key, value 16107 16108 } 16109 } 16110 *v = sv 16111 return nil 16112} 16113