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 "templateSelectionExpression": 1414 if value != nil { 1415 jtv, ok := value.(string) 1416 if !ok { 1417 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 1418 } 1419 sv.TemplateSelectionExpression = ptr.String(jtv) 1420 } 1421 1422 case "timeoutInMillis": 1423 if value != nil { 1424 jtv, ok := value.(json.Number) 1425 if !ok { 1426 return fmt.Errorf("expected IntegerWithLengthBetween50And30000 to be json.Number, got %T instead", value) 1427 } 1428 i64, err := jtv.Int64() 1429 if err != nil { 1430 return err 1431 } 1432 sv.TimeoutInMillis = int32(i64) 1433 } 1434 1435 case "tlsConfig": 1436 if err := awsRestjson1_deserializeDocumentTlsConfig(&sv.TlsConfig, value); err != nil { 1437 return err 1438 } 1439 1440 default: 1441 _, _ = key, value 1442 1443 } 1444 } 1445 *v = sv 1446 return nil 1447} 1448 1449type awsRestjson1_deserializeOpCreateIntegrationResponse struct { 1450} 1451 1452func (*awsRestjson1_deserializeOpCreateIntegrationResponse) ID() string { 1453 return "OperationDeserializer" 1454} 1455 1456func (m *awsRestjson1_deserializeOpCreateIntegrationResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1457 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1458) { 1459 out, metadata, err = next.HandleDeserialize(ctx, in) 1460 if err != nil { 1461 return out, metadata, err 1462 } 1463 1464 response, ok := out.RawResponse.(*smithyhttp.Response) 1465 if !ok { 1466 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1467 } 1468 1469 if response.StatusCode < 200 || response.StatusCode >= 300 { 1470 return out, metadata, awsRestjson1_deserializeOpErrorCreateIntegrationResponse(response, &metadata) 1471 } 1472 output := &CreateIntegrationResponseOutput{} 1473 out.Result = output 1474 1475 var buff [1024]byte 1476 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1477 1478 body := io.TeeReader(response.Body, ringBuffer) 1479 1480 decoder := json.NewDecoder(body) 1481 decoder.UseNumber() 1482 var shape interface{} 1483 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1484 var snapshot bytes.Buffer 1485 io.Copy(&snapshot, ringBuffer) 1486 err = &smithy.DeserializationError{ 1487 Err: fmt.Errorf("failed to decode response body, %w", err), 1488 Snapshot: snapshot.Bytes(), 1489 } 1490 return out, metadata, err 1491 } 1492 1493 err = awsRestjson1_deserializeOpDocumentCreateIntegrationResponseOutput(&output, shape) 1494 if err != nil { 1495 var snapshot bytes.Buffer 1496 io.Copy(&snapshot, ringBuffer) 1497 return out, metadata, &smithy.DeserializationError{ 1498 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1499 Snapshot: snapshot.Bytes(), 1500 } 1501 } 1502 1503 return out, metadata, err 1504} 1505 1506func awsRestjson1_deserializeOpErrorCreateIntegrationResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1507 var errorBuffer bytes.Buffer 1508 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1509 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1510 } 1511 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1512 1513 errorCode := "UnknownError" 1514 errorMessage := errorCode 1515 1516 code := response.Header.Get("X-Amzn-ErrorType") 1517 if len(code) != 0 { 1518 errorCode = restjson.SanitizeErrorCode(code) 1519 } 1520 1521 var buff [1024]byte 1522 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1523 1524 body := io.TeeReader(errorBody, ringBuffer) 1525 decoder := json.NewDecoder(body) 1526 decoder.UseNumber() 1527 code, message, err := restjson.GetErrorInfo(decoder) 1528 if err != nil { 1529 var snapshot bytes.Buffer 1530 io.Copy(&snapshot, ringBuffer) 1531 err = &smithy.DeserializationError{ 1532 Err: fmt.Errorf("failed to decode response body, %w", err), 1533 Snapshot: snapshot.Bytes(), 1534 } 1535 return err 1536 } 1537 1538 errorBody.Seek(0, io.SeekStart) 1539 if len(code) != 0 { 1540 errorCode = restjson.SanitizeErrorCode(code) 1541 } 1542 if len(message) != 0 { 1543 errorMessage = message 1544 } 1545 1546 switch { 1547 case strings.EqualFold("BadRequestException", errorCode): 1548 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1549 1550 case strings.EqualFold("ConflictException", errorCode): 1551 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1552 1553 case strings.EqualFold("NotFoundException", errorCode): 1554 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1555 1556 case strings.EqualFold("TooManyRequestsException", errorCode): 1557 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1558 1559 default: 1560 genericError := &smithy.GenericAPIError{ 1561 Code: errorCode, 1562 Message: errorMessage, 1563 } 1564 return genericError 1565 1566 } 1567} 1568 1569func awsRestjson1_deserializeOpDocumentCreateIntegrationResponseOutput(v **CreateIntegrationResponseOutput, value interface{}) error { 1570 if v == nil { 1571 return fmt.Errorf("unexpected nil of type %T", v) 1572 } 1573 if value == nil { 1574 return nil 1575 } 1576 1577 shape, ok := value.(map[string]interface{}) 1578 if !ok { 1579 return fmt.Errorf("unexpected JSON type %v", value) 1580 } 1581 1582 var sv *CreateIntegrationResponseOutput 1583 if *v == nil { 1584 sv = &CreateIntegrationResponseOutput{} 1585 } else { 1586 sv = *v 1587 } 1588 1589 for key, value := range shape { 1590 switch key { 1591 case "contentHandlingStrategy": 1592 if value != nil { 1593 jtv, ok := value.(string) 1594 if !ok { 1595 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 1596 } 1597 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 1598 } 1599 1600 case "integrationResponseId": 1601 if value != nil { 1602 jtv, ok := value.(string) 1603 if !ok { 1604 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1605 } 1606 sv.IntegrationResponseId = ptr.String(jtv) 1607 } 1608 1609 case "integrationResponseKey": 1610 if value != nil { 1611 jtv, ok := value.(string) 1612 if !ok { 1613 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 1614 } 1615 sv.IntegrationResponseKey = ptr.String(jtv) 1616 } 1617 1618 case "responseParameters": 1619 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.ResponseParameters, value); err != nil { 1620 return err 1621 } 1622 1623 case "responseTemplates": 1624 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.ResponseTemplates, value); err != nil { 1625 return err 1626 } 1627 1628 case "templateSelectionExpression": 1629 if value != nil { 1630 jtv, ok := value.(string) 1631 if !ok { 1632 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 1633 } 1634 sv.TemplateSelectionExpression = ptr.String(jtv) 1635 } 1636 1637 default: 1638 _, _ = key, value 1639 1640 } 1641 } 1642 *v = sv 1643 return nil 1644} 1645 1646type awsRestjson1_deserializeOpCreateModel struct { 1647} 1648 1649func (*awsRestjson1_deserializeOpCreateModel) ID() string { 1650 return "OperationDeserializer" 1651} 1652 1653func (m *awsRestjson1_deserializeOpCreateModel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1654 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1655) { 1656 out, metadata, err = next.HandleDeserialize(ctx, in) 1657 if err != nil { 1658 return out, metadata, err 1659 } 1660 1661 response, ok := out.RawResponse.(*smithyhttp.Response) 1662 if !ok { 1663 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1664 } 1665 1666 if response.StatusCode < 200 || response.StatusCode >= 300 { 1667 return out, metadata, awsRestjson1_deserializeOpErrorCreateModel(response, &metadata) 1668 } 1669 output := &CreateModelOutput{} 1670 out.Result = output 1671 1672 var buff [1024]byte 1673 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1674 1675 body := io.TeeReader(response.Body, ringBuffer) 1676 1677 decoder := json.NewDecoder(body) 1678 decoder.UseNumber() 1679 var shape interface{} 1680 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1681 var snapshot bytes.Buffer 1682 io.Copy(&snapshot, ringBuffer) 1683 err = &smithy.DeserializationError{ 1684 Err: fmt.Errorf("failed to decode response body, %w", err), 1685 Snapshot: snapshot.Bytes(), 1686 } 1687 return out, metadata, err 1688 } 1689 1690 err = awsRestjson1_deserializeOpDocumentCreateModelOutput(&output, shape) 1691 if err != nil { 1692 var snapshot bytes.Buffer 1693 io.Copy(&snapshot, ringBuffer) 1694 return out, metadata, &smithy.DeserializationError{ 1695 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1696 Snapshot: snapshot.Bytes(), 1697 } 1698 } 1699 1700 return out, metadata, err 1701} 1702 1703func awsRestjson1_deserializeOpErrorCreateModel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1704 var errorBuffer bytes.Buffer 1705 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1706 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1707 } 1708 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1709 1710 errorCode := "UnknownError" 1711 errorMessage := errorCode 1712 1713 code := response.Header.Get("X-Amzn-ErrorType") 1714 if len(code) != 0 { 1715 errorCode = restjson.SanitizeErrorCode(code) 1716 } 1717 1718 var buff [1024]byte 1719 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1720 1721 body := io.TeeReader(errorBody, ringBuffer) 1722 decoder := json.NewDecoder(body) 1723 decoder.UseNumber() 1724 code, message, err := restjson.GetErrorInfo(decoder) 1725 if err != nil { 1726 var snapshot bytes.Buffer 1727 io.Copy(&snapshot, ringBuffer) 1728 err = &smithy.DeserializationError{ 1729 Err: fmt.Errorf("failed to decode response body, %w", err), 1730 Snapshot: snapshot.Bytes(), 1731 } 1732 return err 1733 } 1734 1735 errorBody.Seek(0, io.SeekStart) 1736 if len(code) != 0 { 1737 errorCode = restjson.SanitizeErrorCode(code) 1738 } 1739 if len(message) != 0 { 1740 errorMessage = message 1741 } 1742 1743 switch { 1744 case strings.EqualFold("BadRequestException", errorCode): 1745 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1746 1747 case strings.EqualFold("ConflictException", errorCode): 1748 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1749 1750 case strings.EqualFold("NotFoundException", errorCode): 1751 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1752 1753 case strings.EqualFold("TooManyRequestsException", errorCode): 1754 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1755 1756 default: 1757 genericError := &smithy.GenericAPIError{ 1758 Code: errorCode, 1759 Message: errorMessage, 1760 } 1761 return genericError 1762 1763 } 1764} 1765 1766func awsRestjson1_deserializeOpDocumentCreateModelOutput(v **CreateModelOutput, value interface{}) error { 1767 if v == nil { 1768 return fmt.Errorf("unexpected nil of type %T", v) 1769 } 1770 if value == nil { 1771 return nil 1772 } 1773 1774 shape, ok := value.(map[string]interface{}) 1775 if !ok { 1776 return fmt.Errorf("unexpected JSON type %v", value) 1777 } 1778 1779 var sv *CreateModelOutput 1780 if *v == nil { 1781 sv = &CreateModelOutput{} 1782 } else { 1783 sv = *v 1784 } 1785 1786 for key, value := range shape { 1787 switch key { 1788 case "contentType": 1789 if value != nil { 1790 jtv, ok := value.(string) 1791 if !ok { 1792 return fmt.Errorf("expected StringWithLengthBetween1And256 to be of type string, got %T instead", value) 1793 } 1794 sv.ContentType = ptr.String(jtv) 1795 } 1796 1797 case "description": 1798 if value != nil { 1799 jtv, ok := value.(string) 1800 if !ok { 1801 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 1802 } 1803 sv.Description = ptr.String(jtv) 1804 } 1805 1806 case "modelId": 1807 if value != nil { 1808 jtv, ok := value.(string) 1809 if !ok { 1810 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1811 } 1812 sv.ModelId = ptr.String(jtv) 1813 } 1814 1815 case "name": 1816 if value != nil { 1817 jtv, ok := value.(string) 1818 if !ok { 1819 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 1820 } 1821 sv.Name = ptr.String(jtv) 1822 } 1823 1824 case "schema": 1825 if value != nil { 1826 jtv, ok := value.(string) 1827 if !ok { 1828 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 1829 } 1830 sv.Schema = ptr.String(jtv) 1831 } 1832 1833 default: 1834 _, _ = key, value 1835 1836 } 1837 } 1838 *v = sv 1839 return nil 1840} 1841 1842type awsRestjson1_deserializeOpCreateRoute struct { 1843} 1844 1845func (*awsRestjson1_deserializeOpCreateRoute) ID() string { 1846 return "OperationDeserializer" 1847} 1848 1849func (m *awsRestjson1_deserializeOpCreateRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1850 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1851) { 1852 out, metadata, err = next.HandleDeserialize(ctx, in) 1853 if err != nil { 1854 return out, metadata, err 1855 } 1856 1857 response, ok := out.RawResponse.(*smithyhttp.Response) 1858 if !ok { 1859 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1860 } 1861 1862 if response.StatusCode < 200 || response.StatusCode >= 300 { 1863 return out, metadata, awsRestjson1_deserializeOpErrorCreateRoute(response, &metadata) 1864 } 1865 output := &CreateRouteOutput{} 1866 out.Result = output 1867 1868 var buff [1024]byte 1869 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1870 1871 body := io.TeeReader(response.Body, ringBuffer) 1872 1873 decoder := json.NewDecoder(body) 1874 decoder.UseNumber() 1875 var shape interface{} 1876 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1877 var snapshot bytes.Buffer 1878 io.Copy(&snapshot, ringBuffer) 1879 err = &smithy.DeserializationError{ 1880 Err: fmt.Errorf("failed to decode response body, %w", err), 1881 Snapshot: snapshot.Bytes(), 1882 } 1883 return out, metadata, err 1884 } 1885 1886 err = awsRestjson1_deserializeOpDocumentCreateRouteOutput(&output, shape) 1887 if err != nil { 1888 var snapshot bytes.Buffer 1889 io.Copy(&snapshot, ringBuffer) 1890 return out, metadata, &smithy.DeserializationError{ 1891 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1892 Snapshot: snapshot.Bytes(), 1893 } 1894 } 1895 1896 return out, metadata, err 1897} 1898 1899func awsRestjson1_deserializeOpErrorCreateRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1900 var errorBuffer bytes.Buffer 1901 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1902 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1903 } 1904 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1905 1906 errorCode := "UnknownError" 1907 errorMessage := errorCode 1908 1909 code := response.Header.Get("X-Amzn-ErrorType") 1910 if len(code) != 0 { 1911 errorCode = restjson.SanitizeErrorCode(code) 1912 } 1913 1914 var buff [1024]byte 1915 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1916 1917 body := io.TeeReader(errorBody, ringBuffer) 1918 decoder := json.NewDecoder(body) 1919 decoder.UseNumber() 1920 code, message, err := restjson.GetErrorInfo(decoder) 1921 if err != nil { 1922 var snapshot bytes.Buffer 1923 io.Copy(&snapshot, ringBuffer) 1924 err = &smithy.DeserializationError{ 1925 Err: fmt.Errorf("failed to decode response body, %w", err), 1926 Snapshot: snapshot.Bytes(), 1927 } 1928 return err 1929 } 1930 1931 errorBody.Seek(0, io.SeekStart) 1932 if len(code) != 0 { 1933 errorCode = restjson.SanitizeErrorCode(code) 1934 } 1935 if len(message) != 0 { 1936 errorMessage = message 1937 } 1938 1939 switch { 1940 case strings.EqualFold("BadRequestException", errorCode): 1941 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1942 1943 case strings.EqualFold("ConflictException", errorCode): 1944 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1945 1946 case strings.EqualFold("NotFoundException", errorCode): 1947 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1948 1949 case strings.EqualFold("TooManyRequestsException", errorCode): 1950 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1951 1952 default: 1953 genericError := &smithy.GenericAPIError{ 1954 Code: errorCode, 1955 Message: errorMessage, 1956 } 1957 return genericError 1958 1959 } 1960} 1961 1962func awsRestjson1_deserializeOpDocumentCreateRouteOutput(v **CreateRouteOutput, value interface{}) error { 1963 if v == nil { 1964 return fmt.Errorf("unexpected nil of type %T", v) 1965 } 1966 if value == nil { 1967 return nil 1968 } 1969 1970 shape, ok := value.(map[string]interface{}) 1971 if !ok { 1972 return fmt.Errorf("unexpected JSON type %v", value) 1973 } 1974 1975 var sv *CreateRouteOutput 1976 if *v == nil { 1977 sv = &CreateRouteOutput{} 1978 } else { 1979 sv = *v 1980 } 1981 1982 for key, value := range shape { 1983 switch key { 1984 case "apiGatewayManaged": 1985 if value != nil { 1986 jtv, ok := value.(bool) 1987 if !ok { 1988 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 1989 } 1990 sv.ApiGatewayManaged = jtv 1991 } 1992 1993 case "apiKeyRequired": 1994 if value != nil { 1995 jtv, ok := value.(bool) 1996 if !ok { 1997 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 1998 } 1999 sv.ApiKeyRequired = jtv 2000 } 2001 2002 case "authorizationScopes": 2003 if err := awsRestjson1_deserializeDocumentAuthorizationScopes(&sv.AuthorizationScopes, value); err != nil { 2004 return err 2005 } 2006 2007 case "authorizationType": 2008 if value != nil { 2009 jtv, ok := value.(string) 2010 if !ok { 2011 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 2012 } 2013 sv.AuthorizationType = types.AuthorizationType(jtv) 2014 } 2015 2016 case "authorizerId": 2017 if value != nil { 2018 jtv, ok := value.(string) 2019 if !ok { 2020 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2021 } 2022 sv.AuthorizerId = ptr.String(jtv) 2023 } 2024 2025 case "modelSelectionExpression": 2026 if value != nil { 2027 jtv, ok := value.(string) 2028 if !ok { 2029 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 2030 } 2031 sv.ModelSelectionExpression = ptr.String(jtv) 2032 } 2033 2034 case "operationName": 2035 if value != nil { 2036 jtv, ok := value.(string) 2037 if !ok { 2038 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 2039 } 2040 sv.OperationName = ptr.String(jtv) 2041 } 2042 2043 case "requestModels": 2044 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.RequestModels, value); err != nil { 2045 return err 2046 } 2047 2048 case "requestParameters": 2049 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.RequestParameters, value); err != nil { 2050 return err 2051 } 2052 2053 case "routeId": 2054 if value != nil { 2055 jtv, ok := value.(string) 2056 if !ok { 2057 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2058 } 2059 sv.RouteId = ptr.String(jtv) 2060 } 2061 2062 case "routeKey": 2063 if value != nil { 2064 jtv, ok := value.(string) 2065 if !ok { 2066 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 2067 } 2068 sv.RouteKey = ptr.String(jtv) 2069 } 2070 2071 case "routeResponseSelectionExpression": 2072 if value != nil { 2073 jtv, ok := value.(string) 2074 if !ok { 2075 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 2076 } 2077 sv.RouteResponseSelectionExpression = ptr.String(jtv) 2078 } 2079 2080 case "target": 2081 if value != nil { 2082 jtv, ok := value.(string) 2083 if !ok { 2084 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 2085 } 2086 sv.Target = ptr.String(jtv) 2087 } 2088 2089 default: 2090 _, _ = key, value 2091 2092 } 2093 } 2094 *v = sv 2095 return nil 2096} 2097 2098type awsRestjson1_deserializeOpCreateRouteResponse struct { 2099} 2100 2101func (*awsRestjson1_deserializeOpCreateRouteResponse) ID() string { 2102 return "OperationDeserializer" 2103} 2104 2105func (m *awsRestjson1_deserializeOpCreateRouteResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2106 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2107) { 2108 out, metadata, err = next.HandleDeserialize(ctx, in) 2109 if err != nil { 2110 return out, metadata, err 2111 } 2112 2113 response, ok := out.RawResponse.(*smithyhttp.Response) 2114 if !ok { 2115 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2116 } 2117 2118 if response.StatusCode < 200 || response.StatusCode >= 300 { 2119 return out, metadata, awsRestjson1_deserializeOpErrorCreateRouteResponse(response, &metadata) 2120 } 2121 output := &CreateRouteResponseOutput{} 2122 out.Result = output 2123 2124 var buff [1024]byte 2125 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2126 2127 body := io.TeeReader(response.Body, ringBuffer) 2128 2129 decoder := json.NewDecoder(body) 2130 decoder.UseNumber() 2131 var shape interface{} 2132 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2133 var snapshot bytes.Buffer 2134 io.Copy(&snapshot, ringBuffer) 2135 err = &smithy.DeserializationError{ 2136 Err: fmt.Errorf("failed to decode response body, %w", err), 2137 Snapshot: snapshot.Bytes(), 2138 } 2139 return out, metadata, err 2140 } 2141 2142 err = awsRestjson1_deserializeOpDocumentCreateRouteResponseOutput(&output, shape) 2143 if err != nil { 2144 var snapshot bytes.Buffer 2145 io.Copy(&snapshot, ringBuffer) 2146 return out, metadata, &smithy.DeserializationError{ 2147 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2148 Snapshot: snapshot.Bytes(), 2149 } 2150 } 2151 2152 return out, metadata, err 2153} 2154 2155func awsRestjson1_deserializeOpErrorCreateRouteResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2156 var errorBuffer bytes.Buffer 2157 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2158 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2159 } 2160 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2161 2162 errorCode := "UnknownError" 2163 errorMessage := errorCode 2164 2165 code := response.Header.Get("X-Amzn-ErrorType") 2166 if len(code) != 0 { 2167 errorCode = restjson.SanitizeErrorCode(code) 2168 } 2169 2170 var buff [1024]byte 2171 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2172 2173 body := io.TeeReader(errorBody, ringBuffer) 2174 decoder := json.NewDecoder(body) 2175 decoder.UseNumber() 2176 code, message, err := restjson.GetErrorInfo(decoder) 2177 if err != nil { 2178 var snapshot bytes.Buffer 2179 io.Copy(&snapshot, ringBuffer) 2180 err = &smithy.DeserializationError{ 2181 Err: fmt.Errorf("failed to decode response body, %w", err), 2182 Snapshot: snapshot.Bytes(), 2183 } 2184 return err 2185 } 2186 2187 errorBody.Seek(0, io.SeekStart) 2188 if len(code) != 0 { 2189 errorCode = restjson.SanitizeErrorCode(code) 2190 } 2191 if len(message) != 0 { 2192 errorMessage = message 2193 } 2194 2195 switch { 2196 case strings.EqualFold("BadRequestException", errorCode): 2197 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2198 2199 case strings.EqualFold("ConflictException", errorCode): 2200 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2201 2202 case strings.EqualFold("NotFoundException", errorCode): 2203 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2204 2205 case strings.EqualFold("TooManyRequestsException", errorCode): 2206 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2207 2208 default: 2209 genericError := &smithy.GenericAPIError{ 2210 Code: errorCode, 2211 Message: errorMessage, 2212 } 2213 return genericError 2214 2215 } 2216} 2217 2218func awsRestjson1_deserializeOpDocumentCreateRouteResponseOutput(v **CreateRouteResponseOutput, value interface{}) error { 2219 if v == nil { 2220 return fmt.Errorf("unexpected nil of type %T", v) 2221 } 2222 if value == nil { 2223 return nil 2224 } 2225 2226 shape, ok := value.(map[string]interface{}) 2227 if !ok { 2228 return fmt.Errorf("unexpected JSON type %v", value) 2229 } 2230 2231 var sv *CreateRouteResponseOutput 2232 if *v == nil { 2233 sv = &CreateRouteResponseOutput{} 2234 } else { 2235 sv = *v 2236 } 2237 2238 for key, value := range shape { 2239 switch key { 2240 case "modelSelectionExpression": 2241 if value != nil { 2242 jtv, ok := value.(string) 2243 if !ok { 2244 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 2245 } 2246 sv.ModelSelectionExpression = ptr.String(jtv) 2247 } 2248 2249 case "responseModels": 2250 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.ResponseModels, value); err != nil { 2251 return err 2252 } 2253 2254 case "responseParameters": 2255 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.ResponseParameters, value); err != nil { 2256 return err 2257 } 2258 2259 case "routeResponseId": 2260 if value != nil { 2261 jtv, ok := value.(string) 2262 if !ok { 2263 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2264 } 2265 sv.RouteResponseId = ptr.String(jtv) 2266 } 2267 2268 case "routeResponseKey": 2269 if value != nil { 2270 jtv, ok := value.(string) 2271 if !ok { 2272 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 2273 } 2274 sv.RouteResponseKey = ptr.String(jtv) 2275 } 2276 2277 default: 2278 _, _ = key, value 2279 2280 } 2281 } 2282 *v = sv 2283 return nil 2284} 2285 2286type awsRestjson1_deserializeOpCreateStage struct { 2287} 2288 2289func (*awsRestjson1_deserializeOpCreateStage) ID() string { 2290 return "OperationDeserializer" 2291} 2292 2293func (m *awsRestjson1_deserializeOpCreateStage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2294 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2295) { 2296 out, metadata, err = next.HandleDeserialize(ctx, in) 2297 if err != nil { 2298 return out, metadata, err 2299 } 2300 2301 response, ok := out.RawResponse.(*smithyhttp.Response) 2302 if !ok { 2303 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2304 } 2305 2306 if response.StatusCode < 200 || response.StatusCode >= 300 { 2307 return out, metadata, awsRestjson1_deserializeOpErrorCreateStage(response, &metadata) 2308 } 2309 output := &CreateStageOutput{} 2310 out.Result = output 2311 2312 var buff [1024]byte 2313 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2314 2315 body := io.TeeReader(response.Body, ringBuffer) 2316 2317 decoder := json.NewDecoder(body) 2318 decoder.UseNumber() 2319 var shape interface{} 2320 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2321 var snapshot bytes.Buffer 2322 io.Copy(&snapshot, ringBuffer) 2323 err = &smithy.DeserializationError{ 2324 Err: fmt.Errorf("failed to decode response body, %w", err), 2325 Snapshot: snapshot.Bytes(), 2326 } 2327 return out, metadata, err 2328 } 2329 2330 err = awsRestjson1_deserializeOpDocumentCreateStageOutput(&output, shape) 2331 if err != nil { 2332 var snapshot bytes.Buffer 2333 io.Copy(&snapshot, ringBuffer) 2334 return out, metadata, &smithy.DeserializationError{ 2335 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2336 Snapshot: snapshot.Bytes(), 2337 } 2338 } 2339 2340 return out, metadata, err 2341} 2342 2343func awsRestjson1_deserializeOpErrorCreateStage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2344 var errorBuffer bytes.Buffer 2345 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2346 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2347 } 2348 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2349 2350 errorCode := "UnknownError" 2351 errorMessage := errorCode 2352 2353 code := response.Header.Get("X-Amzn-ErrorType") 2354 if len(code) != 0 { 2355 errorCode = restjson.SanitizeErrorCode(code) 2356 } 2357 2358 var buff [1024]byte 2359 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2360 2361 body := io.TeeReader(errorBody, ringBuffer) 2362 decoder := json.NewDecoder(body) 2363 decoder.UseNumber() 2364 code, message, err := restjson.GetErrorInfo(decoder) 2365 if err != nil { 2366 var snapshot bytes.Buffer 2367 io.Copy(&snapshot, ringBuffer) 2368 err = &smithy.DeserializationError{ 2369 Err: fmt.Errorf("failed to decode response body, %w", err), 2370 Snapshot: snapshot.Bytes(), 2371 } 2372 return err 2373 } 2374 2375 errorBody.Seek(0, io.SeekStart) 2376 if len(code) != 0 { 2377 errorCode = restjson.SanitizeErrorCode(code) 2378 } 2379 if len(message) != 0 { 2380 errorMessage = message 2381 } 2382 2383 switch { 2384 case strings.EqualFold("BadRequestException", errorCode): 2385 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2386 2387 case strings.EqualFold("ConflictException", errorCode): 2388 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2389 2390 case strings.EqualFold("NotFoundException", errorCode): 2391 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2392 2393 case strings.EqualFold("TooManyRequestsException", errorCode): 2394 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2395 2396 default: 2397 genericError := &smithy.GenericAPIError{ 2398 Code: errorCode, 2399 Message: errorMessage, 2400 } 2401 return genericError 2402 2403 } 2404} 2405 2406func awsRestjson1_deserializeOpDocumentCreateStageOutput(v **CreateStageOutput, value interface{}) error { 2407 if v == nil { 2408 return fmt.Errorf("unexpected nil of type %T", v) 2409 } 2410 if value == nil { 2411 return nil 2412 } 2413 2414 shape, ok := value.(map[string]interface{}) 2415 if !ok { 2416 return fmt.Errorf("unexpected JSON type %v", value) 2417 } 2418 2419 var sv *CreateStageOutput 2420 if *v == nil { 2421 sv = &CreateStageOutput{} 2422 } else { 2423 sv = *v 2424 } 2425 2426 for key, value := range shape { 2427 switch key { 2428 case "accessLogSettings": 2429 if err := awsRestjson1_deserializeDocumentAccessLogSettings(&sv.AccessLogSettings, value); err != nil { 2430 return err 2431 } 2432 2433 case "apiGatewayManaged": 2434 if value != nil { 2435 jtv, ok := value.(bool) 2436 if !ok { 2437 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 2438 } 2439 sv.ApiGatewayManaged = jtv 2440 } 2441 2442 case "autoDeploy": 2443 if value != nil { 2444 jtv, ok := value.(bool) 2445 if !ok { 2446 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 2447 } 2448 sv.AutoDeploy = jtv 2449 } 2450 2451 case "clientCertificateId": 2452 if value != nil { 2453 jtv, ok := value.(string) 2454 if !ok { 2455 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2456 } 2457 sv.ClientCertificateId = ptr.String(jtv) 2458 } 2459 2460 case "createdDate": 2461 if value != nil { 2462 jtv, ok := value.(string) 2463 if !ok { 2464 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 2465 } 2466 t, err := smithytime.ParseDateTime(jtv) 2467 if err != nil { 2468 return err 2469 } 2470 sv.CreatedDate = ptr.Time(t) 2471 } 2472 2473 case "defaultRouteSettings": 2474 if err := awsRestjson1_deserializeDocumentRouteSettings(&sv.DefaultRouteSettings, value); err != nil { 2475 return err 2476 } 2477 2478 case "deploymentId": 2479 if value != nil { 2480 jtv, ok := value.(string) 2481 if !ok { 2482 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2483 } 2484 sv.DeploymentId = ptr.String(jtv) 2485 } 2486 2487 case "description": 2488 if value != nil { 2489 jtv, ok := value.(string) 2490 if !ok { 2491 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 2492 } 2493 sv.Description = ptr.String(jtv) 2494 } 2495 2496 case "lastDeploymentStatusMessage": 2497 if value != nil { 2498 jtv, ok := value.(string) 2499 if !ok { 2500 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2501 } 2502 sv.LastDeploymentStatusMessage = ptr.String(jtv) 2503 } 2504 2505 case "lastUpdatedDate": 2506 if value != nil { 2507 jtv, ok := value.(string) 2508 if !ok { 2509 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 2510 } 2511 t, err := smithytime.ParseDateTime(jtv) 2512 if err != nil { 2513 return err 2514 } 2515 sv.LastUpdatedDate = ptr.Time(t) 2516 } 2517 2518 case "routeSettings": 2519 if err := awsRestjson1_deserializeDocumentRouteSettingsMap(&sv.RouteSettings, value); err != nil { 2520 return err 2521 } 2522 2523 case "stageName": 2524 if value != nil { 2525 jtv, ok := value.(string) 2526 if !ok { 2527 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 2528 } 2529 sv.StageName = ptr.String(jtv) 2530 } 2531 2532 case "stageVariables": 2533 if err := awsRestjson1_deserializeDocumentStageVariablesMap(&sv.StageVariables, value); err != nil { 2534 return err 2535 } 2536 2537 case "tags": 2538 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 2539 return err 2540 } 2541 2542 default: 2543 _, _ = key, value 2544 2545 } 2546 } 2547 *v = sv 2548 return nil 2549} 2550 2551type awsRestjson1_deserializeOpCreateVpcLink struct { 2552} 2553 2554func (*awsRestjson1_deserializeOpCreateVpcLink) ID() string { 2555 return "OperationDeserializer" 2556} 2557 2558func (m *awsRestjson1_deserializeOpCreateVpcLink) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2559 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2560) { 2561 out, metadata, err = next.HandleDeserialize(ctx, in) 2562 if err != nil { 2563 return out, metadata, err 2564 } 2565 2566 response, ok := out.RawResponse.(*smithyhttp.Response) 2567 if !ok { 2568 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2569 } 2570 2571 if response.StatusCode < 200 || response.StatusCode >= 300 { 2572 return out, metadata, awsRestjson1_deserializeOpErrorCreateVpcLink(response, &metadata) 2573 } 2574 output := &CreateVpcLinkOutput{} 2575 out.Result = output 2576 2577 var buff [1024]byte 2578 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2579 2580 body := io.TeeReader(response.Body, ringBuffer) 2581 2582 decoder := json.NewDecoder(body) 2583 decoder.UseNumber() 2584 var shape interface{} 2585 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2586 var snapshot bytes.Buffer 2587 io.Copy(&snapshot, ringBuffer) 2588 err = &smithy.DeserializationError{ 2589 Err: fmt.Errorf("failed to decode response body, %w", err), 2590 Snapshot: snapshot.Bytes(), 2591 } 2592 return out, metadata, err 2593 } 2594 2595 err = awsRestjson1_deserializeOpDocumentCreateVpcLinkOutput(&output, shape) 2596 if err != nil { 2597 var snapshot bytes.Buffer 2598 io.Copy(&snapshot, ringBuffer) 2599 return out, metadata, &smithy.DeserializationError{ 2600 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2601 Snapshot: snapshot.Bytes(), 2602 } 2603 } 2604 2605 return out, metadata, err 2606} 2607 2608func awsRestjson1_deserializeOpErrorCreateVpcLink(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2609 var errorBuffer bytes.Buffer 2610 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2611 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2612 } 2613 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2614 2615 errorCode := "UnknownError" 2616 errorMessage := errorCode 2617 2618 code := response.Header.Get("X-Amzn-ErrorType") 2619 if len(code) != 0 { 2620 errorCode = restjson.SanitizeErrorCode(code) 2621 } 2622 2623 var buff [1024]byte 2624 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2625 2626 body := io.TeeReader(errorBody, ringBuffer) 2627 decoder := json.NewDecoder(body) 2628 decoder.UseNumber() 2629 code, message, err := restjson.GetErrorInfo(decoder) 2630 if err != nil { 2631 var snapshot bytes.Buffer 2632 io.Copy(&snapshot, ringBuffer) 2633 err = &smithy.DeserializationError{ 2634 Err: fmt.Errorf("failed to decode response body, %w", err), 2635 Snapshot: snapshot.Bytes(), 2636 } 2637 return err 2638 } 2639 2640 errorBody.Seek(0, io.SeekStart) 2641 if len(code) != 0 { 2642 errorCode = restjson.SanitizeErrorCode(code) 2643 } 2644 if len(message) != 0 { 2645 errorMessage = message 2646 } 2647 2648 switch { 2649 case strings.EqualFold("BadRequestException", errorCode): 2650 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2651 2652 case strings.EqualFold("TooManyRequestsException", errorCode): 2653 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2654 2655 default: 2656 genericError := &smithy.GenericAPIError{ 2657 Code: errorCode, 2658 Message: errorMessage, 2659 } 2660 return genericError 2661 2662 } 2663} 2664 2665func awsRestjson1_deserializeOpDocumentCreateVpcLinkOutput(v **CreateVpcLinkOutput, value interface{}) error { 2666 if v == nil { 2667 return fmt.Errorf("unexpected nil of type %T", v) 2668 } 2669 if value == nil { 2670 return nil 2671 } 2672 2673 shape, ok := value.(map[string]interface{}) 2674 if !ok { 2675 return fmt.Errorf("unexpected JSON type %v", value) 2676 } 2677 2678 var sv *CreateVpcLinkOutput 2679 if *v == nil { 2680 sv = &CreateVpcLinkOutput{} 2681 } else { 2682 sv = *v 2683 } 2684 2685 for key, value := range shape { 2686 switch key { 2687 case "createdDate": 2688 if value != nil { 2689 jtv, ok := value.(string) 2690 if !ok { 2691 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 2692 } 2693 t, err := smithytime.ParseDateTime(jtv) 2694 if err != nil { 2695 return err 2696 } 2697 sv.CreatedDate = ptr.Time(t) 2698 } 2699 2700 case "name": 2701 if value != nil { 2702 jtv, ok := value.(string) 2703 if !ok { 2704 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 2705 } 2706 sv.Name = ptr.String(jtv) 2707 } 2708 2709 case "securityGroupIds": 2710 if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { 2711 return err 2712 } 2713 2714 case "subnetIds": 2715 if err := awsRestjson1_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil { 2716 return err 2717 } 2718 2719 case "tags": 2720 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 2721 return err 2722 } 2723 2724 case "vpcLinkId": 2725 if value != nil { 2726 jtv, ok := value.(string) 2727 if !ok { 2728 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2729 } 2730 sv.VpcLinkId = ptr.String(jtv) 2731 } 2732 2733 case "vpcLinkStatus": 2734 if value != nil { 2735 jtv, ok := value.(string) 2736 if !ok { 2737 return fmt.Errorf("expected VpcLinkStatus to be of type string, got %T instead", value) 2738 } 2739 sv.VpcLinkStatus = types.VpcLinkStatus(jtv) 2740 } 2741 2742 case "vpcLinkStatusMessage": 2743 if value != nil { 2744 jtv, ok := value.(string) 2745 if !ok { 2746 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 2747 } 2748 sv.VpcLinkStatusMessage = ptr.String(jtv) 2749 } 2750 2751 case "vpcLinkVersion": 2752 if value != nil { 2753 jtv, ok := value.(string) 2754 if !ok { 2755 return fmt.Errorf("expected VpcLinkVersion to be of type string, got %T instead", value) 2756 } 2757 sv.VpcLinkVersion = types.VpcLinkVersion(jtv) 2758 } 2759 2760 default: 2761 _, _ = key, value 2762 2763 } 2764 } 2765 *v = sv 2766 return nil 2767} 2768 2769type awsRestjson1_deserializeOpDeleteAccessLogSettings struct { 2770} 2771 2772func (*awsRestjson1_deserializeOpDeleteAccessLogSettings) ID() string { 2773 return "OperationDeserializer" 2774} 2775 2776func (m *awsRestjson1_deserializeOpDeleteAccessLogSettings) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2777 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2778) { 2779 out, metadata, err = next.HandleDeserialize(ctx, in) 2780 if err != nil { 2781 return out, metadata, err 2782 } 2783 2784 response, ok := out.RawResponse.(*smithyhttp.Response) 2785 if !ok { 2786 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2787 } 2788 2789 if response.StatusCode < 200 || response.StatusCode >= 300 { 2790 return out, metadata, awsRestjson1_deserializeOpErrorDeleteAccessLogSettings(response, &metadata) 2791 } 2792 output := &DeleteAccessLogSettingsOutput{} 2793 out.Result = output 2794 2795 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2796 return out, metadata, &smithy.DeserializationError{ 2797 Err: fmt.Errorf("failed to discard response body, %w", err), 2798 } 2799 } 2800 2801 return out, metadata, err 2802} 2803 2804func awsRestjson1_deserializeOpErrorDeleteAccessLogSettings(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2805 var errorBuffer bytes.Buffer 2806 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2807 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2808 } 2809 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2810 2811 errorCode := "UnknownError" 2812 errorMessage := errorCode 2813 2814 code := response.Header.Get("X-Amzn-ErrorType") 2815 if len(code) != 0 { 2816 errorCode = restjson.SanitizeErrorCode(code) 2817 } 2818 2819 var buff [1024]byte 2820 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2821 2822 body := io.TeeReader(errorBody, ringBuffer) 2823 decoder := json.NewDecoder(body) 2824 decoder.UseNumber() 2825 code, message, err := restjson.GetErrorInfo(decoder) 2826 if err != nil { 2827 var snapshot bytes.Buffer 2828 io.Copy(&snapshot, ringBuffer) 2829 err = &smithy.DeserializationError{ 2830 Err: fmt.Errorf("failed to decode response body, %w", err), 2831 Snapshot: snapshot.Bytes(), 2832 } 2833 return err 2834 } 2835 2836 errorBody.Seek(0, io.SeekStart) 2837 if len(code) != 0 { 2838 errorCode = restjson.SanitizeErrorCode(code) 2839 } 2840 if len(message) != 0 { 2841 errorMessage = message 2842 } 2843 2844 switch { 2845 case strings.EqualFold("NotFoundException", errorCode): 2846 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2847 2848 case strings.EqualFold("TooManyRequestsException", errorCode): 2849 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2850 2851 default: 2852 genericError := &smithy.GenericAPIError{ 2853 Code: errorCode, 2854 Message: errorMessage, 2855 } 2856 return genericError 2857 2858 } 2859} 2860 2861type awsRestjson1_deserializeOpDeleteApi struct { 2862} 2863 2864func (*awsRestjson1_deserializeOpDeleteApi) ID() string { 2865 return "OperationDeserializer" 2866} 2867 2868func (m *awsRestjson1_deserializeOpDeleteApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2869 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2870) { 2871 out, metadata, err = next.HandleDeserialize(ctx, in) 2872 if err != nil { 2873 return out, metadata, err 2874 } 2875 2876 response, ok := out.RawResponse.(*smithyhttp.Response) 2877 if !ok { 2878 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2879 } 2880 2881 if response.StatusCode < 200 || response.StatusCode >= 300 { 2882 return out, metadata, awsRestjson1_deserializeOpErrorDeleteApi(response, &metadata) 2883 } 2884 output := &DeleteApiOutput{} 2885 out.Result = output 2886 2887 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2888 return out, metadata, &smithy.DeserializationError{ 2889 Err: fmt.Errorf("failed to discard response body, %w", err), 2890 } 2891 } 2892 2893 return out, metadata, err 2894} 2895 2896func awsRestjson1_deserializeOpErrorDeleteApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2897 var errorBuffer bytes.Buffer 2898 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2899 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2900 } 2901 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2902 2903 errorCode := "UnknownError" 2904 errorMessage := errorCode 2905 2906 code := response.Header.Get("X-Amzn-ErrorType") 2907 if len(code) != 0 { 2908 errorCode = restjson.SanitizeErrorCode(code) 2909 } 2910 2911 var buff [1024]byte 2912 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2913 2914 body := io.TeeReader(errorBody, ringBuffer) 2915 decoder := json.NewDecoder(body) 2916 decoder.UseNumber() 2917 code, message, err := restjson.GetErrorInfo(decoder) 2918 if err != nil { 2919 var snapshot bytes.Buffer 2920 io.Copy(&snapshot, ringBuffer) 2921 err = &smithy.DeserializationError{ 2922 Err: fmt.Errorf("failed to decode response body, %w", err), 2923 Snapshot: snapshot.Bytes(), 2924 } 2925 return err 2926 } 2927 2928 errorBody.Seek(0, io.SeekStart) 2929 if len(code) != 0 { 2930 errorCode = restjson.SanitizeErrorCode(code) 2931 } 2932 if len(message) != 0 { 2933 errorMessage = message 2934 } 2935 2936 switch { 2937 case strings.EqualFold("NotFoundException", errorCode): 2938 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2939 2940 case strings.EqualFold("TooManyRequestsException", errorCode): 2941 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2942 2943 default: 2944 genericError := &smithy.GenericAPIError{ 2945 Code: errorCode, 2946 Message: errorMessage, 2947 } 2948 return genericError 2949 2950 } 2951} 2952 2953type awsRestjson1_deserializeOpDeleteApiMapping struct { 2954} 2955 2956func (*awsRestjson1_deserializeOpDeleteApiMapping) ID() string { 2957 return "OperationDeserializer" 2958} 2959 2960func (m *awsRestjson1_deserializeOpDeleteApiMapping) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2961 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2962) { 2963 out, metadata, err = next.HandleDeserialize(ctx, in) 2964 if err != nil { 2965 return out, metadata, err 2966 } 2967 2968 response, ok := out.RawResponse.(*smithyhttp.Response) 2969 if !ok { 2970 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2971 } 2972 2973 if response.StatusCode < 200 || response.StatusCode >= 300 { 2974 return out, metadata, awsRestjson1_deserializeOpErrorDeleteApiMapping(response, &metadata) 2975 } 2976 output := &DeleteApiMappingOutput{} 2977 out.Result = output 2978 2979 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2980 return out, metadata, &smithy.DeserializationError{ 2981 Err: fmt.Errorf("failed to discard response body, %w", err), 2982 } 2983 } 2984 2985 return out, metadata, err 2986} 2987 2988func awsRestjson1_deserializeOpErrorDeleteApiMapping(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2989 var errorBuffer bytes.Buffer 2990 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2991 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2992 } 2993 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2994 2995 errorCode := "UnknownError" 2996 errorMessage := errorCode 2997 2998 code := response.Header.Get("X-Amzn-ErrorType") 2999 if len(code) != 0 { 3000 errorCode = restjson.SanitizeErrorCode(code) 3001 } 3002 3003 var buff [1024]byte 3004 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3005 3006 body := io.TeeReader(errorBody, ringBuffer) 3007 decoder := json.NewDecoder(body) 3008 decoder.UseNumber() 3009 code, message, err := restjson.GetErrorInfo(decoder) 3010 if err != nil { 3011 var snapshot bytes.Buffer 3012 io.Copy(&snapshot, ringBuffer) 3013 err = &smithy.DeserializationError{ 3014 Err: fmt.Errorf("failed to decode response body, %w", err), 3015 Snapshot: snapshot.Bytes(), 3016 } 3017 return err 3018 } 3019 3020 errorBody.Seek(0, io.SeekStart) 3021 if len(code) != 0 { 3022 errorCode = restjson.SanitizeErrorCode(code) 3023 } 3024 if len(message) != 0 { 3025 errorMessage = message 3026 } 3027 3028 switch { 3029 case strings.EqualFold("BadRequestException", errorCode): 3030 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3031 3032 case strings.EqualFold("NotFoundException", errorCode): 3033 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3034 3035 case strings.EqualFold("TooManyRequestsException", errorCode): 3036 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3037 3038 default: 3039 genericError := &smithy.GenericAPIError{ 3040 Code: errorCode, 3041 Message: errorMessage, 3042 } 3043 return genericError 3044 3045 } 3046} 3047 3048type awsRestjson1_deserializeOpDeleteAuthorizer struct { 3049} 3050 3051func (*awsRestjson1_deserializeOpDeleteAuthorizer) ID() string { 3052 return "OperationDeserializer" 3053} 3054 3055func (m *awsRestjson1_deserializeOpDeleteAuthorizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3056 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3057) { 3058 out, metadata, err = next.HandleDeserialize(ctx, in) 3059 if err != nil { 3060 return out, metadata, err 3061 } 3062 3063 response, ok := out.RawResponse.(*smithyhttp.Response) 3064 if !ok { 3065 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3066 } 3067 3068 if response.StatusCode < 200 || response.StatusCode >= 300 { 3069 return out, metadata, awsRestjson1_deserializeOpErrorDeleteAuthorizer(response, &metadata) 3070 } 3071 output := &DeleteAuthorizerOutput{} 3072 out.Result = output 3073 3074 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3075 return out, metadata, &smithy.DeserializationError{ 3076 Err: fmt.Errorf("failed to discard response body, %w", err), 3077 } 3078 } 3079 3080 return out, metadata, err 3081} 3082 3083func awsRestjson1_deserializeOpErrorDeleteAuthorizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3084 var errorBuffer bytes.Buffer 3085 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3086 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3087 } 3088 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3089 3090 errorCode := "UnknownError" 3091 errorMessage := errorCode 3092 3093 code := response.Header.Get("X-Amzn-ErrorType") 3094 if len(code) != 0 { 3095 errorCode = restjson.SanitizeErrorCode(code) 3096 } 3097 3098 var buff [1024]byte 3099 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3100 3101 body := io.TeeReader(errorBody, ringBuffer) 3102 decoder := json.NewDecoder(body) 3103 decoder.UseNumber() 3104 code, message, err := restjson.GetErrorInfo(decoder) 3105 if err != nil { 3106 var snapshot bytes.Buffer 3107 io.Copy(&snapshot, ringBuffer) 3108 err = &smithy.DeserializationError{ 3109 Err: fmt.Errorf("failed to decode response body, %w", err), 3110 Snapshot: snapshot.Bytes(), 3111 } 3112 return err 3113 } 3114 3115 errorBody.Seek(0, io.SeekStart) 3116 if len(code) != 0 { 3117 errorCode = restjson.SanitizeErrorCode(code) 3118 } 3119 if len(message) != 0 { 3120 errorMessage = message 3121 } 3122 3123 switch { 3124 case strings.EqualFold("NotFoundException", errorCode): 3125 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3126 3127 case strings.EqualFold("TooManyRequestsException", errorCode): 3128 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3129 3130 default: 3131 genericError := &smithy.GenericAPIError{ 3132 Code: errorCode, 3133 Message: errorMessage, 3134 } 3135 return genericError 3136 3137 } 3138} 3139 3140type awsRestjson1_deserializeOpDeleteCorsConfiguration struct { 3141} 3142 3143func (*awsRestjson1_deserializeOpDeleteCorsConfiguration) ID() string { 3144 return "OperationDeserializer" 3145} 3146 3147func (m *awsRestjson1_deserializeOpDeleteCorsConfiguration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3148 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3149) { 3150 out, metadata, err = next.HandleDeserialize(ctx, in) 3151 if err != nil { 3152 return out, metadata, err 3153 } 3154 3155 response, ok := out.RawResponse.(*smithyhttp.Response) 3156 if !ok { 3157 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3158 } 3159 3160 if response.StatusCode < 200 || response.StatusCode >= 300 { 3161 return out, metadata, awsRestjson1_deserializeOpErrorDeleteCorsConfiguration(response, &metadata) 3162 } 3163 output := &DeleteCorsConfigurationOutput{} 3164 out.Result = output 3165 3166 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3167 return out, metadata, &smithy.DeserializationError{ 3168 Err: fmt.Errorf("failed to discard response body, %w", err), 3169 } 3170 } 3171 3172 return out, metadata, err 3173} 3174 3175func awsRestjson1_deserializeOpErrorDeleteCorsConfiguration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3176 var errorBuffer bytes.Buffer 3177 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3178 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3179 } 3180 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3181 3182 errorCode := "UnknownError" 3183 errorMessage := errorCode 3184 3185 code := response.Header.Get("X-Amzn-ErrorType") 3186 if len(code) != 0 { 3187 errorCode = restjson.SanitizeErrorCode(code) 3188 } 3189 3190 var buff [1024]byte 3191 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3192 3193 body := io.TeeReader(errorBody, ringBuffer) 3194 decoder := json.NewDecoder(body) 3195 decoder.UseNumber() 3196 code, message, err := restjson.GetErrorInfo(decoder) 3197 if err != nil { 3198 var snapshot bytes.Buffer 3199 io.Copy(&snapshot, ringBuffer) 3200 err = &smithy.DeserializationError{ 3201 Err: fmt.Errorf("failed to decode response body, %w", err), 3202 Snapshot: snapshot.Bytes(), 3203 } 3204 return err 3205 } 3206 3207 errorBody.Seek(0, io.SeekStart) 3208 if len(code) != 0 { 3209 errorCode = restjson.SanitizeErrorCode(code) 3210 } 3211 if len(message) != 0 { 3212 errorMessage = message 3213 } 3214 3215 switch { 3216 case strings.EqualFold("NotFoundException", errorCode): 3217 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3218 3219 case strings.EqualFold("TooManyRequestsException", errorCode): 3220 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3221 3222 default: 3223 genericError := &smithy.GenericAPIError{ 3224 Code: errorCode, 3225 Message: errorMessage, 3226 } 3227 return genericError 3228 3229 } 3230} 3231 3232type awsRestjson1_deserializeOpDeleteDeployment struct { 3233} 3234 3235func (*awsRestjson1_deserializeOpDeleteDeployment) ID() string { 3236 return "OperationDeserializer" 3237} 3238 3239func (m *awsRestjson1_deserializeOpDeleteDeployment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3240 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3241) { 3242 out, metadata, err = next.HandleDeserialize(ctx, in) 3243 if err != nil { 3244 return out, metadata, err 3245 } 3246 3247 response, ok := out.RawResponse.(*smithyhttp.Response) 3248 if !ok { 3249 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3250 } 3251 3252 if response.StatusCode < 200 || response.StatusCode >= 300 { 3253 return out, metadata, awsRestjson1_deserializeOpErrorDeleteDeployment(response, &metadata) 3254 } 3255 output := &DeleteDeploymentOutput{} 3256 out.Result = output 3257 3258 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3259 return out, metadata, &smithy.DeserializationError{ 3260 Err: fmt.Errorf("failed to discard response body, %w", err), 3261 } 3262 } 3263 3264 return out, metadata, err 3265} 3266 3267func awsRestjson1_deserializeOpErrorDeleteDeployment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3268 var errorBuffer bytes.Buffer 3269 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3270 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3271 } 3272 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3273 3274 errorCode := "UnknownError" 3275 errorMessage := errorCode 3276 3277 code := response.Header.Get("X-Amzn-ErrorType") 3278 if len(code) != 0 { 3279 errorCode = restjson.SanitizeErrorCode(code) 3280 } 3281 3282 var buff [1024]byte 3283 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3284 3285 body := io.TeeReader(errorBody, ringBuffer) 3286 decoder := json.NewDecoder(body) 3287 decoder.UseNumber() 3288 code, message, err := restjson.GetErrorInfo(decoder) 3289 if err != nil { 3290 var snapshot bytes.Buffer 3291 io.Copy(&snapshot, ringBuffer) 3292 err = &smithy.DeserializationError{ 3293 Err: fmt.Errorf("failed to decode response body, %w", err), 3294 Snapshot: snapshot.Bytes(), 3295 } 3296 return err 3297 } 3298 3299 errorBody.Seek(0, io.SeekStart) 3300 if len(code) != 0 { 3301 errorCode = restjson.SanitizeErrorCode(code) 3302 } 3303 if len(message) != 0 { 3304 errorMessage = message 3305 } 3306 3307 switch { 3308 case strings.EqualFold("NotFoundException", errorCode): 3309 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3310 3311 case strings.EqualFold("TooManyRequestsException", errorCode): 3312 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3313 3314 default: 3315 genericError := &smithy.GenericAPIError{ 3316 Code: errorCode, 3317 Message: errorMessage, 3318 } 3319 return genericError 3320 3321 } 3322} 3323 3324type awsRestjson1_deserializeOpDeleteDomainName struct { 3325} 3326 3327func (*awsRestjson1_deserializeOpDeleteDomainName) ID() string { 3328 return "OperationDeserializer" 3329} 3330 3331func (m *awsRestjson1_deserializeOpDeleteDomainName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3332 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3333) { 3334 out, metadata, err = next.HandleDeserialize(ctx, in) 3335 if err != nil { 3336 return out, metadata, err 3337 } 3338 3339 response, ok := out.RawResponse.(*smithyhttp.Response) 3340 if !ok { 3341 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3342 } 3343 3344 if response.StatusCode < 200 || response.StatusCode >= 300 { 3345 return out, metadata, awsRestjson1_deserializeOpErrorDeleteDomainName(response, &metadata) 3346 } 3347 output := &DeleteDomainNameOutput{} 3348 out.Result = output 3349 3350 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3351 return out, metadata, &smithy.DeserializationError{ 3352 Err: fmt.Errorf("failed to discard response body, %w", err), 3353 } 3354 } 3355 3356 return out, metadata, err 3357} 3358 3359func awsRestjson1_deserializeOpErrorDeleteDomainName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3360 var errorBuffer bytes.Buffer 3361 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3362 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3363 } 3364 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3365 3366 errorCode := "UnknownError" 3367 errorMessage := errorCode 3368 3369 code := response.Header.Get("X-Amzn-ErrorType") 3370 if len(code) != 0 { 3371 errorCode = restjson.SanitizeErrorCode(code) 3372 } 3373 3374 var buff [1024]byte 3375 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3376 3377 body := io.TeeReader(errorBody, ringBuffer) 3378 decoder := json.NewDecoder(body) 3379 decoder.UseNumber() 3380 code, message, err := restjson.GetErrorInfo(decoder) 3381 if err != nil { 3382 var snapshot bytes.Buffer 3383 io.Copy(&snapshot, ringBuffer) 3384 err = &smithy.DeserializationError{ 3385 Err: fmt.Errorf("failed to decode response body, %w", err), 3386 Snapshot: snapshot.Bytes(), 3387 } 3388 return err 3389 } 3390 3391 errorBody.Seek(0, io.SeekStart) 3392 if len(code) != 0 { 3393 errorCode = restjson.SanitizeErrorCode(code) 3394 } 3395 if len(message) != 0 { 3396 errorMessage = message 3397 } 3398 3399 switch { 3400 case strings.EqualFold("NotFoundException", errorCode): 3401 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3402 3403 case strings.EqualFold("TooManyRequestsException", errorCode): 3404 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3405 3406 default: 3407 genericError := &smithy.GenericAPIError{ 3408 Code: errorCode, 3409 Message: errorMessage, 3410 } 3411 return genericError 3412 3413 } 3414} 3415 3416type awsRestjson1_deserializeOpDeleteIntegration struct { 3417} 3418 3419func (*awsRestjson1_deserializeOpDeleteIntegration) ID() string { 3420 return "OperationDeserializer" 3421} 3422 3423func (m *awsRestjson1_deserializeOpDeleteIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3424 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3425) { 3426 out, metadata, err = next.HandleDeserialize(ctx, in) 3427 if err != nil { 3428 return out, metadata, err 3429 } 3430 3431 response, ok := out.RawResponse.(*smithyhttp.Response) 3432 if !ok { 3433 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3434 } 3435 3436 if response.StatusCode < 200 || response.StatusCode >= 300 { 3437 return out, metadata, awsRestjson1_deserializeOpErrorDeleteIntegration(response, &metadata) 3438 } 3439 output := &DeleteIntegrationOutput{} 3440 out.Result = output 3441 3442 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3443 return out, metadata, &smithy.DeserializationError{ 3444 Err: fmt.Errorf("failed to discard response body, %w", err), 3445 } 3446 } 3447 3448 return out, metadata, err 3449} 3450 3451func awsRestjson1_deserializeOpErrorDeleteIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3452 var errorBuffer bytes.Buffer 3453 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3454 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3455 } 3456 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3457 3458 errorCode := "UnknownError" 3459 errorMessage := errorCode 3460 3461 code := response.Header.Get("X-Amzn-ErrorType") 3462 if len(code) != 0 { 3463 errorCode = restjson.SanitizeErrorCode(code) 3464 } 3465 3466 var buff [1024]byte 3467 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3468 3469 body := io.TeeReader(errorBody, ringBuffer) 3470 decoder := json.NewDecoder(body) 3471 decoder.UseNumber() 3472 code, message, err := restjson.GetErrorInfo(decoder) 3473 if err != nil { 3474 var snapshot bytes.Buffer 3475 io.Copy(&snapshot, ringBuffer) 3476 err = &smithy.DeserializationError{ 3477 Err: fmt.Errorf("failed to decode response body, %w", err), 3478 Snapshot: snapshot.Bytes(), 3479 } 3480 return err 3481 } 3482 3483 errorBody.Seek(0, io.SeekStart) 3484 if len(code) != 0 { 3485 errorCode = restjson.SanitizeErrorCode(code) 3486 } 3487 if len(message) != 0 { 3488 errorMessage = message 3489 } 3490 3491 switch { 3492 case strings.EqualFold("NotFoundException", errorCode): 3493 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3494 3495 case strings.EqualFold("TooManyRequestsException", errorCode): 3496 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3497 3498 default: 3499 genericError := &smithy.GenericAPIError{ 3500 Code: errorCode, 3501 Message: errorMessage, 3502 } 3503 return genericError 3504 3505 } 3506} 3507 3508type awsRestjson1_deserializeOpDeleteIntegrationResponse struct { 3509} 3510 3511func (*awsRestjson1_deserializeOpDeleteIntegrationResponse) ID() string { 3512 return "OperationDeserializer" 3513} 3514 3515func (m *awsRestjson1_deserializeOpDeleteIntegrationResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3516 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3517) { 3518 out, metadata, err = next.HandleDeserialize(ctx, in) 3519 if err != nil { 3520 return out, metadata, err 3521 } 3522 3523 response, ok := out.RawResponse.(*smithyhttp.Response) 3524 if !ok { 3525 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3526 } 3527 3528 if response.StatusCode < 200 || response.StatusCode >= 300 { 3529 return out, metadata, awsRestjson1_deserializeOpErrorDeleteIntegrationResponse(response, &metadata) 3530 } 3531 output := &DeleteIntegrationResponseOutput{} 3532 out.Result = output 3533 3534 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3535 return out, metadata, &smithy.DeserializationError{ 3536 Err: fmt.Errorf("failed to discard response body, %w", err), 3537 } 3538 } 3539 3540 return out, metadata, err 3541} 3542 3543func awsRestjson1_deserializeOpErrorDeleteIntegrationResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3544 var errorBuffer bytes.Buffer 3545 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3546 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3547 } 3548 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3549 3550 errorCode := "UnknownError" 3551 errorMessage := errorCode 3552 3553 code := response.Header.Get("X-Amzn-ErrorType") 3554 if len(code) != 0 { 3555 errorCode = restjson.SanitizeErrorCode(code) 3556 } 3557 3558 var buff [1024]byte 3559 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3560 3561 body := io.TeeReader(errorBody, ringBuffer) 3562 decoder := json.NewDecoder(body) 3563 decoder.UseNumber() 3564 code, message, err := restjson.GetErrorInfo(decoder) 3565 if err != nil { 3566 var snapshot bytes.Buffer 3567 io.Copy(&snapshot, ringBuffer) 3568 err = &smithy.DeserializationError{ 3569 Err: fmt.Errorf("failed to decode response body, %w", err), 3570 Snapshot: snapshot.Bytes(), 3571 } 3572 return err 3573 } 3574 3575 errorBody.Seek(0, io.SeekStart) 3576 if len(code) != 0 { 3577 errorCode = restjson.SanitizeErrorCode(code) 3578 } 3579 if len(message) != 0 { 3580 errorMessage = message 3581 } 3582 3583 switch { 3584 case strings.EqualFold("NotFoundException", errorCode): 3585 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3586 3587 case strings.EqualFold("TooManyRequestsException", errorCode): 3588 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3589 3590 default: 3591 genericError := &smithy.GenericAPIError{ 3592 Code: errorCode, 3593 Message: errorMessage, 3594 } 3595 return genericError 3596 3597 } 3598} 3599 3600type awsRestjson1_deserializeOpDeleteModel struct { 3601} 3602 3603func (*awsRestjson1_deserializeOpDeleteModel) ID() string { 3604 return "OperationDeserializer" 3605} 3606 3607func (m *awsRestjson1_deserializeOpDeleteModel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3608 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3609) { 3610 out, metadata, err = next.HandleDeserialize(ctx, in) 3611 if err != nil { 3612 return out, metadata, err 3613 } 3614 3615 response, ok := out.RawResponse.(*smithyhttp.Response) 3616 if !ok { 3617 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3618 } 3619 3620 if response.StatusCode < 200 || response.StatusCode >= 300 { 3621 return out, metadata, awsRestjson1_deserializeOpErrorDeleteModel(response, &metadata) 3622 } 3623 output := &DeleteModelOutput{} 3624 out.Result = output 3625 3626 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3627 return out, metadata, &smithy.DeserializationError{ 3628 Err: fmt.Errorf("failed to discard response body, %w", err), 3629 } 3630 } 3631 3632 return out, metadata, err 3633} 3634 3635func awsRestjson1_deserializeOpErrorDeleteModel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3636 var errorBuffer bytes.Buffer 3637 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3638 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3639 } 3640 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3641 3642 errorCode := "UnknownError" 3643 errorMessage := errorCode 3644 3645 code := response.Header.Get("X-Amzn-ErrorType") 3646 if len(code) != 0 { 3647 errorCode = restjson.SanitizeErrorCode(code) 3648 } 3649 3650 var buff [1024]byte 3651 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3652 3653 body := io.TeeReader(errorBody, ringBuffer) 3654 decoder := json.NewDecoder(body) 3655 decoder.UseNumber() 3656 code, message, err := restjson.GetErrorInfo(decoder) 3657 if err != nil { 3658 var snapshot bytes.Buffer 3659 io.Copy(&snapshot, ringBuffer) 3660 err = &smithy.DeserializationError{ 3661 Err: fmt.Errorf("failed to decode response body, %w", err), 3662 Snapshot: snapshot.Bytes(), 3663 } 3664 return err 3665 } 3666 3667 errorBody.Seek(0, io.SeekStart) 3668 if len(code) != 0 { 3669 errorCode = restjson.SanitizeErrorCode(code) 3670 } 3671 if len(message) != 0 { 3672 errorMessage = message 3673 } 3674 3675 switch { 3676 case strings.EqualFold("NotFoundException", errorCode): 3677 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3678 3679 case strings.EqualFold("TooManyRequestsException", errorCode): 3680 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3681 3682 default: 3683 genericError := &smithy.GenericAPIError{ 3684 Code: errorCode, 3685 Message: errorMessage, 3686 } 3687 return genericError 3688 3689 } 3690} 3691 3692type awsRestjson1_deserializeOpDeleteRoute struct { 3693} 3694 3695func (*awsRestjson1_deserializeOpDeleteRoute) ID() string { 3696 return "OperationDeserializer" 3697} 3698 3699func (m *awsRestjson1_deserializeOpDeleteRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3700 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3701) { 3702 out, metadata, err = next.HandleDeserialize(ctx, in) 3703 if err != nil { 3704 return out, metadata, err 3705 } 3706 3707 response, ok := out.RawResponse.(*smithyhttp.Response) 3708 if !ok { 3709 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3710 } 3711 3712 if response.StatusCode < 200 || response.StatusCode >= 300 { 3713 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRoute(response, &metadata) 3714 } 3715 output := &DeleteRouteOutput{} 3716 out.Result = output 3717 3718 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3719 return out, metadata, &smithy.DeserializationError{ 3720 Err: fmt.Errorf("failed to discard response body, %w", err), 3721 } 3722 } 3723 3724 return out, metadata, err 3725} 3726 3727func awsRestjson1_deserializeOpErrorDeleteRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3728 var errorBuffer bytes.Buffer 3729 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3730 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3731 } 3732 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3733 3734 errorCode := "UnknownError" 3735 errorMessage := errorCode 3736 3737 code := response.Header.Get("X-Amzn-ErrorType") 3738 if len(code) != 0 { 3739 errorCode = restjson.SanitizeErrorCode(code) 3740 } 3741 3742 var buff [1024]byte 3743 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3744 3745 body := io.TeeReader(errorBody, ringBuffer) 3746 decoder := json.NewDecoder(body) 3747 decoder.UseNumber() 3748 code, message, err := restjson.GetErrorInfo(decoder) 3749 if err != nil { 3750 var snapshot bytes.Buffer 3751 io.Copy(&snapshot, ringBuffer) 3752 err = &smithy.DeserializationError{ 3753 Err: fmt.Errorf("failed to decode response body, %w", err), 3754 Snapshot: snapshot.Bytes(), 3755 } 3756 return err 3757 } 3758 3759 errorBody.Seek(0, io.SeekStart) 3760 if len(code) != 0 { 3761 errorCode = restjson.SanitizeErrorCode(code) 3762 } 3763 if len(message) != 0 { 3764 errorMessage = message 3765 } 3766 3767 switch { 3768 case strings.EqualFold("NotFoundException", errorCode): 3769 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3770 3771 case strings.EqualFold("TooManyRequestsException", errorCode): 3772 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3773 3774 default: 3775 genericError := &smithy.GenericAPIError{ 3776 Code: errorCode, 3777 Message: errorMessage, 3778 } 3779 return genericError 3780 3781 } 3782} 3783 3784type awsRestjson1_deserializeOpDeleteRouteRequestParameter struct { 3785} 3786 3787func (*awsRestjson1_deserializeOpDeleteRouteRequestParameter) ID() string { 3788 return "OperationDeserializer" 3789} 3790 3791func (m *awsRestjson1_deserializeOpDeleteRouteRequestParameter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3792 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3793) { 3794 out, metadata, err = next.HandleDeserialize(ctx, in) 3795 if err != nil { 3796 return out, metadata, err 3797 } 3798 3799 response, ok := out.RawResponse.(*smithyhttp.Response) 3800 if !ok { 3801 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3802 } 3803 3804 if response.StatusCode < 200 || response.StatusCode >= 300 { 3805 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRouteRequestParameter(response, &metadata) 3806 } 3807 output := &DeleteRouteRequestParameterOutput{} 3808 out.Result = output 3809 3810 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3811 return out, metadata, &smithy.DeserializationError{ 3812 Err: fmt.Errorf("failed to discard response body, %w", err), 3813 } 3814 } 3815 3816 return out, metadata, err 3817} 3818 3819func awsRestjson1_deserializeOpErrorDeleteRouteRequestParameter(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3820 var errorBuffer bytes.Buffer 3821 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3822 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3823 } 3824 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3825 3826 errorCode := "UnknownError" 3827 errorMessage := errorCode 3828 3829 code := response.Header.Get("X-Amzn-ErrorType") 3830 if len(code) != 0 { 3831 errorCode = restjson.SanitizeErrorCode(code) 3832 } 3833 3834 var buff [1024]byte 3835 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3836 3837 body := io.TeeReader(errorBody, ringBuffer) 3838 decoder := json.NewDecoder(body) 3839 decoder.UseNumber() 3840 code, message, err := restjson.GetErrorInfo(decoder) 3841 if err != nil { 3842 var snapshot bytes.Buffer 3843 io.Copy(&snapshot, ringBuffer) 3844 err = &smithy.DeserializationError{ 3845 Err: fmt.Errorf("failed to decode response body, %w", err), 3846 Snapshot: snapshot.Bytes(), 3847 } 3848 return err 3849 } 3850 3851 errorBody.Seek(0, io.SeekStart) 3852 if len(code) != 0 { 3853 errorCode = restjson.SanitizeErrorCode(code) 3854 } 3855 if len(message) != 0 { 3856 errorMessage = message 3857 } 3858 3859 switch { 3860 case strings.EqualFold("NotFoundException", errorCode): 3861 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3862 3863 case strings.EqualFold("TooManyRequestsException", errorCode): 3864 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3865 3866 default: 3867 genericError := &smithy.GenericAPIError{ 3868 Code: errorCode, 3869 Message: errorMessage, 3870 } 3871 return genericError 3872 3873 } 3874} 3875 3876type awsRestjson1_deserializeOpDeleteRouteResponse struct { 3877} 3878 3879func (*awsRestjson1_deserializeOpDeleteRouteResponse) ID() string { 3880 return "OperationDeserializer" 3881} 3882 3883func (m *awsRestjson1_deserializeOpDeleteRouteResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3884 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3885) { 3886 out, metadata, err = next.HandleDeserialize(ctx, in) 3887 if err != nil { 3888 return out, metadata, err 3889 } 3890 3891 response, ok := out.RawResponse.(*smithyhttp.Response) 3892 if !ok { 3893 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3894 } 3895 3896 if response.StatusCode < 200 || response.StatusCode >= 300 { 3897 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRouteResponse(response, &metadata) 3898 } 3899 output := &DeleteRouteResponseOutput{} 3900 out.Result = output 3901 3902 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3903 return out, metadata, &smithy.DeserializationError{ 3904 Err: fmt.Errorf("failed to discard response body, %w", err), 3905 } 3906 } 3907 3908 return out, metadata, err 3909} 3910 3911func awsRestjson1_deserializeOpErrorDeleteRouteResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3912 var errorBuffer bytes.Buffer 3913 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3914 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3915 } 3916 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3917 3918 errorCode := "UnknownError" 3919 errorMessage := errorCode 3920 3921 code := response.Header.Get("X-Amzn-ErrorType") 3922 if len(code) != 0 { 3923 errorCode = restjson.SanitizeErrorCode(code) 3924 } 3925 3926 var buff [1024]byte 3927 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3928 3929 body := io.TeeReader(errorBody, ringBuffer) 3930 decoder := json.NewDecoder(body) 3931 decoder.UseNumber() 3932 code, message, err := restjson.GetErrorInfo(decoder) 3933 if err != nil { 3934 var snapshot bytes.Buffer 3935 io.Copy(&snapshot, ringBuffer) 3936 err = &smithy.DeserializationError{ 3937 Err: fmt.Errorf("failed to decode response body, %w", err), 3938 Snapshot: snapshot.Bytes(), 3939 } 3940 return err 3941 } 3942 3943 errorBody.Seek(0, io.SeekStart) 3944 if len(code) != 0 { 3945 errorCode = restjson.SanitizeErrorCode(code) 3946 } 3947 if len(message) != 0 { 3948 errorMessage = message 3949 } 3950 3951 switch { 3952 case strings.EqualFold("NotFoundException", errorCode): 3953 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3954 3955 case strings.EqualFold("TooManyRequestsException", errorCode): 3956 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 3957 3958 default: 3959 genericError := &smithy.GenericAPIError{ 3960 Code: errorCode, 3961 Message: errorMessage, 3962 } 3963 return genericError 3964 3965 } 3966} 3967 3968type awsRestjson1_deserializeOpDeleteRouteSettings struct { 3969} 3970 3971func (*awsRestjson1_deserializeOpDeleteRouteSettings) ID() string { 3972 return "OperationDeserializer" 3973} 3974 3975func (m *awsRestjson1_deserializeOpDeleteRouteSettings) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3976 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3977) { 3978 out, metadata, err = next.HandleDeserialize(ctx, in) 3979 if err != nil { 3980 return out, metadata, err 3981 } 3982 3983 response, ok := out.RawResponse.(*smithyhttp.Response) 3984 if !ok { 3985 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3986 } 3987 3988 if response.StatusCode < 200 || response.StatusCode >= 300 { 3989 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRouteSettings(response, &metadata) 3990 } 3991 output := &DeleteRouteSettingsOutput{} 3992 out.Result = output 3993 3994 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3995 return out, metadata, &smithy.DeserializationError{ 3996 Err: fmt.Errorf("failed to discard response body, %w", err), 3997 } 3998 } 3999 4000 return out, metadata, err 4001} 4002 4003func awsRestjson1_deserializeOpErrorDeleteRouteSettings(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4004 var errorBuffer bytes.Buffer 4005 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4006 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4007 } 4008 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4009 4010 errorCode := "UnknownError" 4011 errorMessage := errorCode 4012 4013 code := response.Header.Get("X-Amzn-ErrorType") 4014 if len(code) != 0 { 4015 errorCode = restjson.SanitizeErrorCode(code) 4016 } 4017 4018 var buff [1024]byte 4019 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4020 4021 body := io.TeeReader(errorBody, ringBuffer) 4022 decoder := json.NewDecoder(body) 4023 decoder.UseNumber() 4024 code, message, err := restjson.GetErrorInfo(decoder) 4025 if err != nil { 4026 var snapshot bytes.Buffer 4027 io.Copy(&snapshot, ringBuffer) 4028 err = &smithy.DeserializationError{ 4029 Err: fmt.Errorf("failed to decode response body, %w", err), 4030 Snapshot: snapshot.Bytes(), 4031 } 4032 return err 4033 } 4034 4035 errorBody.Seek(0, io.SeekStart) 4036 if len(code) != 0 { 4037 errorCode = restjson.SanitizeErrorCode(code) 4038 } 4039 if len(message) != 0 { 4040 errorMessage = message 4041 } 4042 4043 switch { 4044 case strings.EqualFold("NotFoundException", errorCode): 4045 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4046 4047 case strings.EqualFold("TooManyRequestsException", errorCode): 4048 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4049 4050 default: 4051 genericError := &smithy.GenericAPIError{ 4052 Code: errorCode, 4053 Message: errorMessage, 4054 } 4055 return genericError 4056 4057 } 4058} 4059 4060type awsRestjson1_deserializeOpDeleteStage struct { 4061} 4062 4063func (*awsRestjson1_deserializeOpDeleteStage) ID() string { 4064 return "OperationDeserializer" 4065} 4066 4067func (m *awsRestjson1_deserializeOpDeleteStage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4068 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4069) { 4070 out, metadata, err = next.HandleDeserialize(ctx, in) 4071 if err != nil { 4072 return out, metadata, err 4073 } 4074 4075 response, ok := out.RawResponse.(*smithyhttp.Response) 4076 if !ok { 4077 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4078 } 4079 4080 if response.StatusCode < 200 || response.StatusCode >= 300 { 4081 return out, metadata, awsRestjson1_deserializeOpErrorDeleteStage(response, &metadata) 4082 } 4083 output := &DeleteStageOutput{} 4084 out.Result = output 4085 4086 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4087 return out, metadata, &smithy.DeserializationError{ 4088 Err: fmt.Errorf("failed to discard response body, %w", err), 4089 } 4090 } 4091 4092 return out, metadata, err 4093} 4094 4095func awsRestjson1_deserializeOpErrorDeleteStage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4096 var errorBuffer bytes.Buffer 4097 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4098 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4099 } 4100 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4101 4102 errorCode := "UnknownError" 4103 errorMessage := errorCode 4104 4105 code := response.Header.Get("X-Amzn-ErrorType") 4106 if len(code) != 0 { 4107 errorCode = restjson.SanitizeErrorCode(code) 4108 } 4109 4110 var buff [1024]byte 4111 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4112 4113 body := io.TeeReader(errorBody, ringBuffer) 4114 decoder := json.NewDecoder(body) 4115 decoder.UseNumber() 4116 code, message, err := restjson.GetErrorInfo(decoder) 4117 if err != nil { 4118 var snapshot bytes.Buffer 4119 io.Copy(&snapshot, ringBuffer) 4120 err = &smithy.DeserializationError{ 4121 Err: fmt.Errorf("failed to decode response body, %w", err), 4122 Snapshot: snapshot.Bytes(), 4123 } 4124 return err 4125 } 4126 4127 errorBody.Seek(0, io.SeekStart) 4128 if len(code) != 0 { 4129 errorCode = restjson.SanitizeErrorCode(code) 4130 } 4131 if len(message) != 0 { 4132 errorMessage = message 4133 } 4134 4135 switch { 4136 case strings.EqualFold("NotFoundException", errorCode): 4137 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4138 4139 case strings.EqualFold("TooManyRequestsException", errorCode): 4140 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4141 4142 default: 4143 genericError := &smithy.GenericAPIError{ 4144 Code: errorCode, 4145 Message: errorMessage, 4146 } 4147 return genericError 4148 4149 } 4150} 4151 4152type awsRestjson1_deserializeOpDeleteVpcLink struct { 4153} 4154 4155func (*awsRestjson1_deserializeOpDeleteVpcLink) ID() string { 4156 return "OperationDeserializer" 4157} 4158 4159func (m *awsRestjson1_deserializeOpDeleteVpcLink) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4160 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4161) { 4162 out, metadata, err = next.HandleDeserialize(ctx, in) 4163 if err != nil { 4164 return out, metadata, err 4165 } 4166 4167 response, ok := out.RawResponse.(*smithyhttp.Response) 4168 if !ok { 4169 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4170 } 4171 4172 if response.StatusCode < 200 || response.StatusCode >= 300 { 4173 return out, metadata, awsRestjson1_deserializeOpErrorDeleteVpcLink(response, &metadata) 4174 } 4175 output := &DeleteVpcLinkOutput{} 4176 out.Result = output 4177 4178 return out, metadata, err 4179} 4180 4181func awsRestjson1_deserializeOpErrorDeleteVpcLink(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4182 var errorBuffer bytes.Buffer 4183 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4184 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4185 } 4186 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4187 4188 errorCode := "UnknownError" 4189 errorMessage := errorCode 4190 4191 code := response.Header.Get("X-Amzn-ErrorType") 4192 if len(code) != 0 { 4193 errorCode = restjson.SanitizeErrorCode(code) 4194 } 4195 4196 var buff [1024]byte 4197 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4198 4199 body := io.TeeReader(errorBody, ringBuffer) 4200 decoder := json.NewDecoder(body) 4201 decoder.UseNumber() 4202 code, message, err := restjson.GetErrorInfo(decoder) 4203 if err != nil { 4204 var snapshot bytes.Buffer 4205 io.Copy(&snapshot, ringBuffer) 4206 err = &smithy.DeserializationError{ 4207 Err: fmt.Errorf("failed to decode response body, %w", err), 4208 Snapshot: snapshot.Bytes(), 4209 } 4210 return err 4211 } 4212 4213 errorBody.Seek(0, io.SeekStart) 4214 if len(code) != 0 { 4215 errorCode = restjson.SanitizeErrorCode(code) 4216 } 4217 if len(message) != 0 { 4218 errorMessage = message 4219 } 4220 4221 switch { 4222 case strings.EqualFold("NotFoundException", errorCode): 4223 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4224 4225 case strings.EqualFold("TooManyRequestsException", errorCode): 4226 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4227 4228 default: 4229 genericError := &smithy.GenericAPIError{ 4230 Code: errorCode, 4231 Message: errorMessage, 4232 } 4233 return genericError 4234 4235 } 4236} 4237 4238type awsRestjson1_deserializeOpExportApi struct { 4239} 4240 4241func (*awsRestjson1_deserializeOpExportApi) ID() string { 4242 return "OperationDeserializer" 4243} 4244 4245func (m *awsRestjson1_deserializeOpExportApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4246 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4247) { 4248 out, metadata, err = next.HandleDeserialize(ctx, in) 4249 if err != nil { 4250 return out, metadata, err 4251 } 4252 4253 response, ok := out.RawResponse.(*smithyhttp.Response) 4254 if !ok { 4255 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4256 } 4257 4258 if response.StatusCode < 200 || response.StatusCode >= 300 { 4259 return out, metadata, awsRestjson1_deserializeOpErrorExportApi(response, &metadata) 4260 } 4261 output := &ExportApiOutput{} 4262 out.Result = output 4263 4264 err = awsRestjson1_deserializeOpDocumentExportApiOutput(output, response.Body) 4265 if err != nil { 4266 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} 4267 } 4268 4269 return out, metadata, err 4270} 4271 4272func awsRestjson1_deserializeOpErrorExportApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4273 var errorBuffer bytes.Buffer 4274 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4275 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4276 } 4277 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4278 4279 errorCode := "UnknownError" 4280 errorMessage := errorCode 4281 4282 code := response.Header.Get("X-Amzn-ErrorType") 4283 if len(code) != 0 { 4284 errorCode = restjson.SanitizeErrorCode(code) 4285 } 4286 4287 var buff [1024]byte 4288 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4289 4290 body := io.TeeReader(errorBody, ringBuffer) 4291 decoder := json.NewDecoder(body) 4292 decoder.UseNumber() 4293 code, message, err := restjson.GetErrorInfo(decoder) 4294 if err != nil { 4295 var snapshot bytes.Buffer 4296 io.Copy(&snapshot, ringBuffer) 4297 err = &smithy.DeserializationError{ 4298 Err: fmt.Errorf("failed to decode response body, %w", err), 4299 Snapshot: snapshot.Bytes(), 4300 } 4301 return err 4302 } 4303 4304 errorBody.Seek(0, io.SeekStart) 4305 if len(code) != 0 { 4306 errorCode = restjson.SanitizeErrorCode(code) 4307 } 4308 if len(message) != 0 { 4309 errorMessage = message 4310 } 4311 4312 switch { 4313 case strings.EqualFold("BadRequestException", errorCode): 4314 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4315 4316 case strings.EqualFold("NotFoundException", errorCode): 4317 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4318 4319 case strings.EqualFold("TooManyRequestsException", errorCode): 4320 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4321 4322 default: 4323 genericError := &smithy.GenericAPIError{ 4324 Code: errorCode, 4325 Message: errorMessage, 4326 } 4327 return genericError 4328 4329 } 4330} 4331 4332func awsRestjson1_deserializeOpDocumentExportApiOutput(v *ExportApiOutput, body io.ReadCloser) error { 4333 if v == nil { 4334 return fmt.Errorf("unsupported deserialization of nil %T", v) 4335 } 4336 4337 bs, err := ioutil.ReadAll(body) 4338 if err != nil { 4339 return err 4340 } 4341 if len(bs) > 0 { 4342 v.Body = bs 4343 } 4344 return nil 4345} 4346 4347type awsRestjson1_deserializeOpGetApi struct { 4348} 4349 4350func (*awsRestjson1_deserializeOpGetApi) ID() string { 4351 return "OperationDeserializer" 4352} 4353 4354func (m *awsRestjson1_deserializeOpGetApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4355 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4356) { 4357 out, metadata, err = next.HandleDeserialize(ctx, in) 4358 if err != nil { 4359 return out, metadata, err 4360 } 4361 4362 response, ok := out.RawResponse.(*smithyhttp.Response) 4363 if !ok { 4364 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4365 } 4366 4367 if response.StatusCode < 200 || response.StatusCode >= 300 { 4368 return out, metadata, awsRestjson1_deserializeOpErrorGetApi(response, &metadata) 4369 } 4370 output := &GetApiOutput{} 4371 out.Result = output 4372 4373 var buff [1024]byte 4374 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4375 4376 body := io.TeeReader(response.Body, ringBuffer) 4377 4378 decoder := json.NewDecoder(body) 4379 decoder.UseNumber() 4380 var shape interface{} 4381 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4382 var snapshot bytes.Buffer 4383 io.Copy(&snapshot, ringBuffer) 4384 err = &smithy.DeserializationError{ 4385 Err: fmt.Errorf("failed to decode response body, %w", err), 4386 Snapshot: snapshot.Bytes(), 4387 } 4388 return out, metadata, err 4389 } 4390 4391 err = awsRestjson1_deserializeOpDocumentGetApiOutput(&output, shape) 4392 if err != nil { 4393 var snapshot bytes.Buffer 4394 io.Copy(&snapshot, ringBuffer) 4395 return out, metadata, &smithy.DeserializationError{ 4396 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4397 Snapshot: snapshot.Bytes(), 4398 } 4399 } 4400 4401 return out, metadata, err 4402} 4403 4404func awsRestjson1_deserializeOpErrorGetApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4405 var errorBuffer bytes.Buffer 4406 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4407 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4408 } 4409 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4410 4411 errorCode := "UnknownError" 4412 errorMessage := errorCode 4413 4414 code := response.Header.Get("X-Amzn-ErrorType") 4415 if len(code) != 0 { 4416 errorCode = restjson.SanitizeErrorCode(code) 4417 } 4418 4419 var buff [1024]byte 4420 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4421 4422 body := io.TeeReader(errorBody, ringBuffer) 4423 decoder := json.NewDecoder(body) 4424 decoder.UseNumber() 4425 code, message, err := restjson.GetErrorInfo(decoder) 4426 if err != nil { 4427 var snapshot bytes.Buffer 4428 io.Copy(&snapshot, ringBuffer) 4429 err = &smithy.DeserializationError{ 4430 Err: fmt.Errorf("failed to decode response body, %w", err), 4431 Snapshot: snapshot.Bytes(), 4432 } 4433 return err 4434 } 4435 4436 errorBody.Seek(0, io.SeekStart) 4437 if len(code) != 0 { 4438 errorCode = restjson.SanitizeErrorCode(code) 4439 } 4440 if len(message) != 0 { 4441 errorMessage = message 4442 } 4443 4444 switch { 4445 case strings.EqualFold("NotFoundException", errorCode): 4446 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4447 4448 case strings.EqualFold("TooManyRequestsException", errorCode): 4449 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4450 4451 default: 4452 genericError := &smithy.GenericAPIError{ 4453 Code: errorCode, 4454 Message: errorMessage, 4455 } 4456 return genericError 4457 4458 } 4459} 4460 4461func awsRestjson1_deserializeOpDocumentGetApiOutput(v **GetApiOutput, value interface{}) error { 4462 if v == nil { 4463 return fmt.Errorf("unexpected nil of type %T", v) 4464 } 4465 if value == nil { 4466 return nil 4467 } 4468 4469 shape, ok := value.(map[string]interface{}) 4470 if !ok { 4471 return fmt.Errorf("unexpected JSON type %v", value) 4472 } 4473 4474 var sv *GetApiOutput 4475 if *v == nil { 4476 sv = &GetApiOutput{} 4477 } else { 4478 sv = *v 4479 } 4480 4481 for key, value := range shape { 4482 switch key { 4483 case "apiEndpoint": 4484 if value != nil { 4485 jtv, ok := value.(string) 4486 if !ok { 4487 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4488 } 4489 sv.ApiEndpoint = ptr.String(jtv) 4490 } 4491 4492 case "apiGatewayManaged": 4493 if value != nil { 4494 jtv, ok := value.(bool) 4495 if !ok { 4496 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 4497 } 4498 sv.ApiGatewayManaged = jtv 4499 } 4500 4501 case "apiId": 4502 if value != nil { 4503 jtv, ok := value.(string) 4504 if !ok { 4505 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4506 } 4507 sv.ApiId = ptr.String(jtv) 4508 } 4509 4510 case "apiKeySelectionExpression": 4511 if value != nil { 4512 jtv, ok := value.(string) 4513 if !ok { 4514 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 4515 } 4516 sv.ApiKeySelectionExpression = ptr.String(jtv) 4517 } 4518 4519 case "corsConfiguration": 4520 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 4521 return err 4522 } 4523 4524 case "createdDate": 4525 if value != nil { 4526 jtv, ok := value.(string) 4527 if !ok { 4528 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 4529 } 4530 t, err := smithytime.ParseDateTime(jtv) 4531 if err != nil { 4532 return err 4533 } 4534 sv.CreatedDate = ptr.Time(t) 4535 } 4536 4537 case "description": 4538 if value != nil { 4539 jtv, ok := value.(string) 4540 if !ok { 4541 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 4542 } 4543 sv.Description = ptr.String(jtv) 4544 } 4545 4546 case "disableExecuteApiEndpoint": 4547 if value != nil { 4548 jtv, ok := value.(bool) 4549 if !ok { 4550 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 4551 } 4552 sv.DisableExecuteApiEndpoint = jtv 4553 } 4554 4555 case "disableSchemaValidation": 4556 if value != nil { 4557 jtv, ok := value.(bool) 4558 if !ok { 4559 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 4560 } 4561 sv.DisableSchemaValidation = jtv 4562 } 4563 4564 case "importInfo": 4565 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 4566 return err 4567 } 4568 4569 case "name": 4570 if value != nil { 4571 jtv, ok := value.(string) 4572 if !ok { 4573 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 4574 } 4575 sv.Name = ptr.String(jtv) 4576 } 4577 4578 case "protocolType": 4579 if value != nil { 4580 jtv, ok := value.(string) 4581 if !ok { 4582 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 4583 } 4584 sv.ProtocolType = types.ProtocolType(jtv) 4585 } 4586 4587 case "routeSelectionExpression": 4588 if value != nil { 4589 jtv, ok := value.(string) 4590 if !ok { 4591 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 4592 } 4593 sv.RouteSelectionExpression = ptr.String(jtv) 4594 } 4595 4596 case "tags": 4597 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 4598 return err 4599 } 4600 4601 case "version": 4602 if value != nil { 4603 jtv, ok := value.(string) 4604 if !ok { 4605 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 4606 } 4607 sv.Version = ptr.String(jtv) 4608 } 4609 4610 case "warnings": 4611 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 4612 return err 4613 } 4614 4615 default: 4616 _, _ = key, value 4617 4618 } 4619 } 4620 *v = sv 4621 return nil 4622} 4623 4624type awsRestjson1_deserializeOpGetApiMapping struct { 4625} 4626 4627func (*awsRestjson1_deserializeOpGetApiMapping) ID() string { 4628 return "OperationDeserializer" 4629} 4630 4631func (m *awsRestjson1_deserializeOpGetApiMapping) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4632 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4633) { 4634 out, metadata, err = next.HandleDeserialize(ctx, in) 4635 if err != nil { 4636 return out, metadata, err 4637 } 4638 4639 response, ok := out.RawResponse.(*smithyhttp.Response) 4640 if !ok { 4641 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4642 } 4643 4644 if response.StatusCode < 200 || response.StatusCode >= 300 { 4645 return out, metadata, awsRestjson1_deserializeOpErrorGetApiMapping(response, &metadata) 4646 } 4647 output := &GetApiMappingOutput{} 4648 out.Result = output 4649 4650 var buff [1024]byte 4651 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4652 4653 body := io.TeeReader(response.Body, ringBuffer) 4654 4655 decoder := json.NewDecoder(body) 4656 decoder.UseNumber() 4657 var shape interface{} 4658 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4659 var snapshot bytes.Buffer 4660 io.Copy(&snapshot, ringBuffer) 4661 err = &smithy.DeserializationError{ 4662 Err: fmt.Errorf("failed to decode response body, %w", err), 4663 Snapshot: snapshot.Bytes(), 4664 } 4665 return out, metadata, err 4666 } 4667 4668 err = awsRestjson1_deserializeOpDocumentGetApiMappingOutput(&output, shape) 4669 if err != nil { 4670 var snapshot bytes.Buffer 4671 io.Copy(&snapshot, ringBuffer) 4672 return out, metadata, &smithy.DeserializationError{ 4673 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4674 Snapshot: snapshot.Bytes(), 4675 } 4676 } 4677 4678 return out, metadata, err 4679} 4680 4681func awsRestjson1_deserializeOpErrorGetApiMapping(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4682 var errorBuffer bytes.Buffer 4683 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4684 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4685 } 4686 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4687 4688 errorCode := "UnknownError" 4689 errorMessage := errorCode 4690 4691 code := response.Header.Get("X-Amzn-ErrorType") 4692 if len(code) != 0 { 4693 errorCode = restjson.SanitizeErrorCode(code) 4694 } 4695 4696 var buff [1024]byte 4697 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4698 4699 body := io.TeeReader(errorBody, ringBuffer) 4700 decoder := json.NewDecoder(body) 4701 decoder.UseNumber() 4702 code, message, err := restjson.GetErrorInfo(decoder) 4703 if err != nil { 4704 var snapshot bytes.Buffer 4705 io.Copy(&snapshot, ringBuffer) 4706 err = &smithy.DeserializationError{ 4707 Err: fmt.Errorf("failed to decode response body, %w", err), 4708 Snapshot: snapshot.Bytes(), 4709 } 4710 return err 4711 } 4712 4713 errorBody.Seek(0, io.SeekStart) 4714 if len(code) != 0 { 4715 errorCode = restjson.SanitizeErrorCode(code) 4716 } 4717 if len(message) != 0 { 4718 errorMessage = message 4719 } 4720 4721 switch { 4722 case strings.EqualFold("BadRequestException", errorCode): 4723 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4724 4725 case strings.EqualFold("NotFoundException", errorCode): 4726 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4727 4728 case strings.EqualFold("TooManyRequestsException", errorCode): 4729 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4730 4731 default: 4732 genericError := &smithy.GenericAPIError{ 4733 Code: errorCode, 4734 Message: errorMessage, 4735 } 4736 return genericError 4737 4738 } 4739} 4740 4741func awsRestjson1_deserializeOpDocumentGetApiMappingOutput(v **GetApiMappingOutput, value interface{}) error { 4742 if v == nil { 4743 return fmt.Errorf("unexpected nil of type %T", v) 4744 } 4745 if value == nil { 4746 return nil 4747 } 4748 4749 shape, ok := value.(map[string]interface{}) 4750 if !ok { 4751 return fmt.Errorf("unexpected JSON type %v", value) 4752 } 4753 4754 var sv *GetApiMappingOutput 4755 if *v == nil { 4756 sv = &GetApiMappingOutput{} 4757 } else { 4758 sv = *v 4759 } 4760 4761 for key, value := range shape { 4762 switch key { 4763 case "apiId": 4764 if value != nil { 4765 jtv, ok := value.(string) 4766 if !ok { 4767 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4768 } 4769 sv.ApiId = ptr.String(jtv) 4770 } 4771 4772 case "apiMappingId": 4773 if value != nil { 4774 jtv, ok := value.(string) 4775 if !ok { 4776 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4777 } 4778 sv.ApiMappingId = ptr.String(jtv) 4779 } 4780 4781 case "apiMappingKey": 4782 if value != nil { 4783 jtv, ok := value.(string) 4784 if !ok { 4785 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 4786 } 4787 sv.ApiMappingKey = ptr.String(jtv) 4788 } 4789 4790 case "stage": 4791 if value != nil { 4792 jtv, ok := value.(string) 4793 if !ok { 4794 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 4795 } 4796 sv.Stage = ptr.String(jtv) 4797 } 4798 4799 default: 4800 _, _ = key, value 4801 4802 } 4803 } 4804 *v = sv 4805 return nil 4806} 4807 4808type awsRestjson1_deserializeOpGetApiMappings struct { 4809} 4810 4811func (*awsRestjson1_deserializeOpGetApiMappings) ID() string { 4812 return "OperationDeserializer" 4813} 4814 4815func (m *awsRestjson1_deserializeOpGetApiMappings) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4816 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4817) { 4818 out, metadata, err = next.HandleDeserialize(ctx, in) 4819 if err != nil { 4820 return out, metadata, err 4821 } 4822 4823 response, ok := out.RawResponse.(*smithyhttp.Response) 4824 if !ok { 4825 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4826 } 4827 4828 if response.StatusCode < 200 || response.StatusCode >= 300 { 4829 return out, metadata, awsRestjson1_deserializeOpErrorGetApiMappings(response, &metadata) 4830 } 4831 output := &GetApiMappingsOutput{} 4832 out.Result = output 4833 4834 var buff [1024]byte 4835 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4836 4837 body := io.TeeReader(response.Body, ringBuffer) 4838 4839 decoder := json.NewDecoder(body) 4840 decoder.UseNumber() 4841 var shape interface{} 4842 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4843 var snapshot bytes.Buffer 4844 io.Copy(&snapshot, ringBuffer) 4845 err = &smithy.DeserializationError{ 4846 Err: fmt.Errorf("failed to decode response body, %w", err), 4847 Snapshot: snapshot.Bytes(), 4848 } 4849 return out, metadata, err 4850 } 4851 4852 err = awsRestjson1_deserializeOpDocumentGetApiMappingsOutput(&output, shape) 4853 if err != nil { 4854 var snapshot bytes.Buffer 4855 io.Copy(&snapshot, ringBuffer) 4856 return out, metadata, &smithy.DeserializationError{ 4857 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4858 Snapshot: snapshot.Bytes(), 4859 } 4860 } 4861 4862 return out, metadata, err 4863} 4864 4865func awsRestjson1_deserializeOpErrorGetApiMappings(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4866 var errorBuffer bytes.Buffer 4867 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4868 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4869 } 4870 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4871 4872 errorCode := "UnknownError" 4873 errorMessage := errorCode 4874 4875 code := response.Header.Get("X-Amzn-ErrorType") 4876 if len(code) != 0 { 4877 errorCode = restjson.SanitizeErrorCode(code) 4878 } 4879 4880 var buff [1024]byte 4881 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4882 4883 body := io.TeeReader(errorBody, ringBuffer) 4884 decoder := json.NewDecoder(body) 4885 decoder.UseNumber() 4886 code, message, err := restjson.GetErrorInfo(decoder) 4887 if err != nil { 4888 var snapshot bytes.Buffer 4889 io.Copy(&snapshot, ringBuffer) 4890 err = &smithy.DeserializationError{ 4891 Err: fmt.Errorf("failed to decode response body, %w", err), 4892 Snapshot: snapshot.Bytes(), 4893 } 4894 return err 4895 } 4896 4897 errorBody.Seek(0, io.SeekStart) 4898 if len(code) != 0 { 4899 errorCode = restjson.SanitizeErrorCode(code) 4900 } 4901 if len(message) != 0 { 4902 errorMessage = message 4903 } 4904 4905 switch { 4906 case strings.EqualFold("BadRequestException", errorCode): 4907 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4908 4909 case strings.EqualFold("NotFoundException", errorCode): 4910 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4911 4912 case strings.EqualFold("TooManyRequestsException", errorCode): 4913 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 4914 4915 default: 4916 genericError := &smithy.GenericAPIError{ 4917 Code: errorCode, 4918 Message: errorMessage, 4919 } 4920 return genericError 4921 4922 } 4923} 4924 4925func awsRestjson1_deserializeOpDocumentGetApiMappingsOutput(v **GetApiMappingsOutput, value interface{}) error { 4926 if v == nil { 4927 return fmt.Errorf("unexpected nil of type %T", v) 4928 } 4929 if value == nil { 4930 return nil 4931 } 4932 4933 shape, ok := value.(map[string]interface{}) 4934 if !ok { 4935 return fmt.Errorf("unexpected JSON type %v", value) 4936 } 4937 4938 var sv *GetApiMappingsOutput 4939 if *v == nil { 4940 sv = &GetApiMappingsOutput{} 4941 } else { 4942 sv = *v 4943 } 4944 4945 for key, value := range shape { 4946 switch key { 4947 case "items": 4948 if err := awsRestjson1_deserializeDocument__listOfApiMapping(&sv.Items, value); err != nil { 4949 return err 4950 } 4951 4952 case "nextToken": 4953 if value != nil { 4954 jtv, ok := value.(string) 4955 if !ok { 4956 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 4957 } 4958 sv.NextToken = ptr.String(jtv) 4959 } 4960 4961 default: 4962 _, _ = key, value 4963 4964 } 4965 } 4966 *v = sv 4967 return nil 4968} 4969 4970type awsRestjson1_deserializeOpGetApis struct { 4971} 4972 4973func (*awsRestjson1_deserializeOpGetApis) ID() string { 4974 return "OperationDeserializer" 4975} 4976 4977func (m *awsRestjson1_deserializeOpGetApis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4978 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4979) { 4980 out, metadata, err = next.HandleDeserialize(ctx, in) 4981 if err != nil { 4982 return out, metadata, err 4983 } 4984 4985 response, ok := out.RawResponse.(*smithyhttp.Response) 4986 if !ok { 4987 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4988 } 4989 4990 if response.StatusCode < 200 || response.StatusCode >= 300 { 4991 return out, metadata, awsRestjson1_deserializeOpErrorGetApis(response, &metadata) 4992 } 4993 output := &GetApisOutput{} 4994 out.Result = output 4995 4996 var buff [1024]byte 4997 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4998 4999 body := io.TeeReader(response.Body, ringBuffer) 5000 5001 decoder := json.NewDecoder(body) 5002 decoder.UseNumber() 5003 var shape interface{} 5004 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5005 var snapshot bytes.Buffer 5006 io.Copy(&snapshot, ringBuffer) 5007 err = &smithy.DeserializationError{ 5008 Err: fmt.Errorf("failed to decode response body, %w", err), 5009 Snapshot: snapshot.Bytes(), 5010 } 5011 return out, metadata, err 5012 } 5013 5014 err = awsRestjson1_deserializeOpDocumentGetApisOutput(&output, shape) 5015 if err != nil { 5016 var snapshot bytes.Buffer 5017 io.Copy(&snapshot, ringBuffer) 5018 return out, metadata, &smithy.DeserializationError{ 5019 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5020 Snapshot: snapshot.Bytes(), 5021 } 5022 } 5023 5024 return out, metadata, err 5025} 5026 5027func awsRestjson1_deserializeOpErrorGetApis(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5028 var errorBuffer bytes.Buffer 5029 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5030 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5031 } 5032 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5033 5034 errorCode := "UnknownError" 5035 errorMessage := errorCode 5036 5037 code := response.Header.Get("X-Amzn-ErrorType") 5038 if len(code) != 0 { 5039 errorCode = restjson.SanitizeErrorCode(code) 5040 } 5041 5042 var buff [1024]byte 5043 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5044 5045 body := io.TeeReader(errorBody, ringBuffer) 5046 decoder := json.NewDecoder(body) 5047 decoder.UseNumber() 5048 code, message, err := restjson.GetErrorInfo(decoder) 5049 if err != nil { 5050 var snapshot bytes.Buffer 5051 io.Copy(&snapshot, ringBuffer) 5052 err = &smithy.DeserializationError{ 5053 Err: fmt.Errorf("failed to decode response body, %w", err), 5054 Snapshot: snapshot.Bytes(), 5055 } 5056 return err 5057 } 5058 5059 errorBody.Seek(0, io.SeekStart) 5060 if len(code) != 0 { 5061 errorCode = restjson.SanitizeErrorCode(code) 5062 } 5063 if len(message) != 0 { 5064 errorMessage = message 5065 } 5066 5067 switch { 5068 case strings.EqualFold("BadRequestException", errorCode): 5069 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5070 5071 case strings.EqualFold("NotFoundException", errorCode): 5072 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5073 5074 case strings.EqualFold("TooManyRequestsException", errorCode): 5075 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5076 5077 default: 5078 genericError := &smithy.GenericAPIError{ 5079 Code: errorCode, 5080 Message: errorMessage, 5081 } 5082 return genericError 5083 5084 } 5085} 5086 5087func awsRestjson1_deserializeOpDocumentGetApisOutput(v **GetApisOutput, value interface{}) error { 5088 if v == nil { 5089 return fmt.Errorf("unexpected nil of type %T", v) 5090 } 5091 if value == nil { 5092 return nil 5093 } 5094 5095 shape, ok := value.(map[string]interface{}) 5096 if !ok { 5097 return fmt.Errorf("unexpected JSON type %v", value) 5098 } 5099 5100 var sv *GetApisOutput 5101 if *v == nil { 5102 sv = &GetApisOutput{} 5103 } else { 5104 sv = *v 5105 } 5106 5107 for key, value := range shape { 5108 switch key { 5109 case "items": 5110 if err := awsRestjson1_deserializeDocument__listOfApi(&sv.Items, value); err != nil { 5111 return err 5112 } 5113 5114 case "nextToken": 5115 if value != nil { 5116 jtv, ok := value.(string) 5117 if !ok { 5118 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5119 } 5120 sv.NextToken = ptr.String(jtv) 5121 } 5122 5123 default: 5124 _, _ = key, value 5125 5126 } 5127 } 5128 *v = sv 5129 return nil 5130} 5131 5132type awsRestjson1_deserializeOpGetAuthorizer struct { 5133} 5134 5135func (*awsRestjson1_deserializeOpGetAuthorizer) ID() string { 5136 return "OperationDeserializer" 5137} 5138 5139func (m *awsRestjson1_deserializeOpGetAuthorizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5140 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5141) { 5142 out, metadata, err = next.HandleDeserialize(ctx, in) 5143 if err != nil { 5144 return out, metadata, err 5145 } 5146 5147 response, ok := out.RawResponse.(*smithyhttp.Response) 5148 if !ok { 5149 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5150 } 5151 5152 if response.StatusCode < 200 || response.StatusCode >= 300 { 5153 return out, metadata, awsRestjson1_deserializeOpErrorGetAuthorizer(response, &metadata) 5154 } 5155 output := &GetAuthorizerOutput{} 5156 out.Result = output 5157 5158 var buff [1024]byte 5159 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5160 5161 body := io.TeeReader(response.Body, ringBuffer) 5162 5163 decoder := json.NewDecoder(body) 5164 decoder.UseNumber() 5165 var shape interface{} 5166 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5167 var snapshot bytes.Buffer 5168 io.Copy(&snapshot, ringBuffer) 5169 err = &smithy.DeserializationError{ 5170 Err: fmt.Errorf("failed to decode response body, %w", err), 5171 Snapshot: snapshot.Bytes(), 5172 } 5173 return out, metadata, err 5174 } 5175 5176 err = awsRestjson1_deserializeOpDocumentGetAuthorizerOutput(&output, shape) 5177 if err != nil { 5178 var snapshot bytes.Buffer 5179 io.Copy(&snapshot, ringBuffer) 5180 return out, metadata, &smithy.DeserializationError{ 5181 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5182 Snapshot: snapshot.Bytes(), 5183 } 5184 } 5185 5186 return out, metadata, err 5187} 5188 5189func awsRestjson1_deserializeOpErrorGetAuthorizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5190 var errorBuffer bytes.Buffer 5191 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5192 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5193 } 5194 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5195 5196 errorCode := "UnknownError" 5197 errorMessage := errorCode 5198 5199 code := response.Header.Get("X-Amzn-ErrorType") 5200 if len(code) != 0 { 5201 errorCode = restjson.SanitizeErrorCode(code) 5202 } 5203 5204 var buff [1024]byte 5205 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5206 5207 body := io.TeeReader(errorBody, ringBuffer) 5208 decoder := json.NewDecoder(body) 5209 decoder.UseNumber() 5210 code, message, err := restjson.GetErrorInfo(decoder) 5211 if err != nil { 5212 var snapshot bytes.Buffer 5213 io.Copy(&snapshot, ringBuffer) 5214 err = &smithy.DeserializationError{ 5215 Err: fmt.Errorf("failed to decode response body, %w", err), 5216 Snapshot: snapshot.Bytes(), 5217 } 5218 return err 5219 } 5220 5221 errorBody.Seek(0, io.SeekStart) 5222 if len(code) != 0 { 5223 errorCode = restjson.SanitizeErrorCode(code) 5224 } 5225 if len(message) != 0 { 5226 errorMessage = message 5227 } 5228 5229 switch { 5230 case strings.EqualFold("NotFoundException", errorCode): 5231 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5232 5233 case strings.EqualFold("TooManyRequestsException", errorCode): 5234 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5235 5236 default: 5237 genericError := &smithy.GenericAPIError{ 5238 Code: errorCode, 5239 Message: errorMessage, 5240 } 5241 return genericError 5242 5243 } 5244} 5245 5246func awsRestjson1_deserializeOpDocumentGetAuthorizerOutput(v **GetAuthorizerOutput, value interface{}) error { 5247 if v == nil { 5248 return fmt.Errorf("unexpected nil of type %T", v) 5249 } 5250 if value == nil { 5251 return nil 5252 } 5253 5254 shape, ok := value.(map[string]interface{}) 5255 if !ok { 5256 return fmt.Errorf("unexpected JSON type %v", value) 5257 } 5258 5259 var sv *GetAuthorizerOutput 5260 if *v == nil { 5261 sv = &GetAuthorizerOutput{} 5262 } else { 5263 sv = *v 5264 } 5265 5266 for key, value := range shape { 5267 switch key { 5268 case "authorizerCredentialsArn": 5269 if value != nil { 5270 jtv, ok := value.(string) 5271 if !ok { 5272 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5273 } 5274 sv.AuthorizerCredentialsArn = ptr.String(jtv) 5275 } 5276 5277 case "authorizerId": 5278 if value != nil { 5279 jtv, ok := value.(string) 5280 if !ok { 5281 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5282 } 5283 sv.AuthorizerId = ptr.String(jtv) 5284 } 5285 5286 case "authorizerPayloadFormatVersion": 5287 if value != nil { 5288 jtv, ok := value.(string) 5289 if !ok { 5290 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 5291 } 5292 sv.AuthorizerPayloadFormatVersion = ptr.String(jtv) 5293 } 5294 5295 case "authorizerResultTtlInSeconds": 5296 if value != nil { 5297 jtv, ok := value.(json.Number) 5298 if !ok { 5299 return fmt.Errorf("expected IntegerWithLengthBetween0And3600 to be json.Number, got %T instead", value) 5300 } 5301 i64, err := jtv.Int64() 5302 if err != nil { 5303 return err 5304 } 5305 sv.AuthorizerResultTtlInSeconds = int32(i64) 5306 } 5307 5308 case "authorizerType": 5309 if value != nil { 5310 jtv, ok := value.(string) 5311 if !ok { 5312 return fmt.Errorf("expected AuthorizerType to be of type string, got %T instead", value) 5313 } 5314 sv.AuthorizerType = types.AuthorizerType(jtv) 5315 } 5316 5317 case "authorizerUri": 5318 if value != nil { 5319 jtv, ok := value.(string) 5320 if !ok { 5321 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 5322 } 5323 sv.AuthorizerUri = ptr.String(jtv) 5324 } 5325 5326 case "enableSimpleResponses": 5327 if value != nil { 5328 jtv, ok := value.(bool) 5329 if !ok { 5330 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 5331 } 5332 sv.EnableSimpleResponses = jtv 5333 } 5334 5335 case "identitySource": 5336 if err := awsRestjson1_deserializeDocumentIdentitySourceList(&sv.IdentitySource, value); err != nil { 5337 return err 5338 } 5339 5340 case "identityValidationExpression": 5341 if value != nil { 5342 jtv, ok := value.(string) 5343 if !ok { 5344 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 5345 } 5346 sv.IdentityValidationExpression = ptr.String(jtv) 5347 } 5348 5349 case "jwtConfiguration": 5350 if err := awsRestjson1_deserializeDocumentJWTConfiguration(&sv.JwtConfiguration, value); err != nil { 5351 return err 5352 } 5353 5354 case "name": 5355 if value != nil { 5356 jtv, ok := value.(string) 5357 if !ok { 5358 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 5359 } 5360 sv.Name = ptr.String(jtv) 5361 } 5362 5363 default: 5364 _, _ = key, value 5365 5366 } 5367 } 5368 *v = sv 5369 return nil 5370} 5371 5372type awsRestjson1_deserializeOpGetAuthorizers struct { 5373} 5374 5375func (*awsRestjson1_deserializeOpGetAuthorizers) ID() string { 5376 return "OperationDeserializer" 5377} 5378 5379func (m *awsRestjson1_deserializeOpGetAuthorizers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5380 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5381) { 5382 out, metadata, err = next.HandleDeserialize(ctx, in) 5383 if err != nil { 5384 return out, metadata, err 5385 } 5386 5387 response, ok := out.RawResponse.(*smithyhttp.Response) 5388 if !ok { 5389 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5390 } 5391 5392 if response.StatusCode < 200 || response.StatusCode >= 300 { 5393 return out, metadata, awsRestjson1_deserializeOpErrorGetAuthorizers(response, &metadata) 5394 } 5395 output := &GetAuthorizersOutput{} 5396 out.Result = output 5397 5398 var buff [1024]byte 5399 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5400 5401 body := io.TeeReader(response.Body, ringBuffer) 5402 5403 decoder := json.NewDecoder(body) 5404 decoder.UseNumber() 5405 var shape interface{} 5406 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5407 var snapshot bytes.Buffer 5408 io.Copy(&snapshot, ringBuffer) 5409 err = &smithy.DeserializationError{ 5410 Err: fmt.Errorf("failed to decode response body, %w", err), 5411 Snapshot: snapshot.Bytes(), 5412 } 5413 return out, metadata, err 5414 } 5415 5416 err = awsRestjson1_deserializeOpDocumentGetAuthorizersOutput(&output, shape) 5417 if err != nil { 5418 var snapshot bytes.Buffer 5419 io.Copy(&snapshot, ringBuffer) 5420 return out, metadata, &smithy.DeserializationError{ 5421 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5422 Snapshot: snapshot.Bytes(), 5423 } 5424 } 5425 5426 return out, metadata, err 5427} 5428 5429func awsRestjson1_deserializeOpErrorGetAuthorizers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5430 var errorBuffer bytes.Buffer 5431 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5432 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5433 } 5434 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5435 5436 errorCode := "UnknownError" 5437 errorMessage := errorCode 5438 5439 code := response.Header.Get("X-Amzn-ErrorType") 5440 if len(code) != 0 { 5441 errorCode = restjson.SanitizeErrorCode(code) 5442 } 5443 5444 var buff [1024]byte 5445 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5446 5447 body := io.TeeReader(errorBody, ringBuffer) 5448 decoder := json.NewDecoder(body) 5449 decoder.UseNumber() 5450 code, message, err := restjson.GetErrorInfo(decoder) 5451 if err != nil { 5452 var snapshot bytes.Buffer 5453 io.Copy(&snapshot, ringBuffer) 5454 err = &smithy.DeserializationError{ 5455 Err: fmt.Errorf("failed to decode response body, %w", err), 5456 Snapshot: snapshot.Bytes(), 5457 } 5458 return err 5459 } 5460 5461 errorBody.Seek(0, io.SeekStart) 5462 if len(code) != 0 { 5463 errorCode = restjson.SanitizeErrorCode(code) 5464 } 5465 if len(message) != 0 { 5466 errorMessage = message 5467 } 5468 5469 switch { 5470 case strings.EqualFold("BadRequestException", errorCode): 5471 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5472 5473 case strings.EqualFold("NotFoundException", errorCode): 5474 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5475 5476 case strings.EqualFold("TooManyRequestsException", errorCode): 5477 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5478 5479 default: 5480 genericError := &smithy.GenericAPIError{ 5481 Code: errorCode, 5482 Message: errorMessage, 5483 } 5484 return genericError 5485 5486 } 5487} 5488 5489func awsRestjson1_deserializeOpDocumentGetAuthorizersOutput(v **GetAuthorizersOutput, value interface{}) error { 5490 if v == nil { 5491 return fmt.Errorf("unexpected nil of type %T", v) 5492 } 5493 if value == nil { 5494 return nil 5495 } 5496 5497 shape, ok := value.(map[string]interface{}) 5498 if !ok { 5499 return fmt.Errorf("unexpected JSON type %v", value) 5500 } 5501 5502 var sv *GetAuthorizersOutput 5503 if *v == nil { 5504 sv = &GetAuthorizersOutput{} 5505 } else { 5506 sv = *v 5507 } 5508 5509 for key, value := range shape { 5510 switch key { 5511 case "items": 5512 if err := awsRestjson1_deserializeDocument__listOfAuthorizer(&sv.Items, value); err != nil { 5513 return err 5514 } 5515 5516 case "nextToken": 5517 if value != nil { 5518 jtv, ok := value.(string) 5519 if !ok { 5520 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5521 } 5522 sv.NextToken = ptr.String(jtv) 5523 } 5524 5525 default: 5526 _, _ = key, value 5527 5528 } 5529 } 5530 *v = sv 5531 return nil 5532} 5533 5534type awsRestjson1_deserializeOpGetDeployment struct { 5535} 5536 5537func (*awsRestjson1_deserializeOpGetDeployment) ID() string { 5538 return "OperationDeserializer" 5539} 5540 5541func (m *awsRestjson1_deserializeOpGetDeployment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5542 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5543) { 5544 out, metadata, err = next.HandleDeserialize(ctx, in) 5545 if err != nil { 5546 return out, metadata, err 5547 } 5548 5549 response, ok := out.RawResponse.(*smithyhttp.Response) 5550 if !ok { 5551 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5552 } 5553 5554 if response.StatusCode < 200 || response.StatusCode >= 300 { 5555 return out, metadata, awsRestjson1_deserializeOpErrorGetDeployment(response, &metadata) 5556 } 5557 output := &GetDeploymentOutput{} 5558 out.Result = output 5559 5560 var buff [1024]byte 5561 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5562 5563 body := io.TeeReader(response.Body, ringBuffer) 5564 5565 decoder := json.NewDecoder(body) 5566 decoder.UseNumber() 5567 var shape interface{} 5568 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5569 var snapshot bytes.Buffer 5570 io.Copy(&snapshot, ringBuffer) 5571 err = &smithy.DeserializationError{ 5572 Err: fmt.Errorf("failed to decode response body, %w", err), 5573 Snapshot: snapshot.Bytes(), 5574 } 5575 return out, metadata, err 5576 } 5577 5578 err = awsRestjson1_deserializeOpDocumentGetDeploymentOutput(&output, shape) 5579 if err != nil { 5580 var snapshot bytes.Buffer 5581 io.Copy(&snapshot, ringBuffer) 5582 return out, metadata, &smithy.DeserializationError{ 5583 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5584 Snapshot: snapshot.Bytes(), 5585 } 5586 } 5587 5588 return out, metadata, err 5589} 5590 5591func awsRestjson1_deserializeOpErrorGetDeployment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5592 var errorBuffer bytes.Buffer 5593 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5594 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5595 } 5596 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5597 5598 errorCode := "UnknownError" 5599 errorMessage := errorCode 5600 5601 code := response.Header.Get("X-Amzn-ErrorType") 5602 if len(code) != 0 { 5603 errorCode = restjson.SanitizeErrorCode(code) 5604 } 5605 5606 var buff [1024]byte 5607 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5608 5609 body := io.TeeReader(errorBody, ringBuffer) 5610 decoder := json.NewDecoder(body) 5611 decoder.UseNumber() 5612 code, message, err := restjson.GetErrorInfo(decoder) 5613 if err != nil { 5614 var snapshot bytes.Buffer 5615 io.Copy(&snapshot, ringBuffer) 5616 err = &smithy.DeserializationError{ 5617 Err: fmt.Errorf("failed to decode response body, %w", err), 5618 Snapshot: snapshot.Bytes(), 5619 } 5620 return err 5621 } 5622 5623 errorBody.Seek(0, io.SeekStart) 5624 if len(code) != 0 { 5625 errorCode = restjson.SanitizeErrorCode(code) 5626 } 5627 if len(message) != 0 { 5628 errorMessage = message 5629 } 5630 5631 switch { 5632 case strings.EqualFold("NotFoundException", errorCode): 5633 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5634 5635 case strings.EqualFold("TooManyRequestsException", errorCode): 5636 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5637 5638 default: 5639 genericError := &smithy.GenericAPIError{ 5640 Code: errorCode, 5641 Message: errorMessage, 5642 } 5643 return genericError 5644 5645 } 5646} 5647 5648func awsRestjson1_deserializeOpDocumentGetDeploymentOutput(v **GetDeploymentOutput, value interface{}) error { 5649 if v == nil { 5650 return fmt.Errorf("unexpected nil of type %T", v) 5651 } 5652 if value == nil { 5653 return nil 5654 } 5655 5656 shape, ok := value.(map[string]interface{}) 5657 if !ok { 5658 return fmt.Errorf("unexpected JSON type %v", value) 5659 } 5660 5661 var sv *GetDeploymentOutput 5662 if *v == nil { 5663 sv = &GetDeploymentOutput{} 5664 } else { 5665 sv = *v 5666 } 5667 5668 for key, value := range shape { 5669 switch key { 5670 case "autoDeployed": 5671 if value != nil { 5672 jtv, ok := value.(bool) 5673 if !ok { 5674 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 5675 } 5676 sv.AutoDeployed = jtv 5677 } 5678 5679 case "createdDate": 5680 if value != nil { 5681 jtv, ok := value.(string) 5682 if !ok { 5683 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 5684 } 5685 t, err := smithytime.ParseDateTime(jtv) 5686 if err != nil { 5687 return err 5688 } 5689 sv.CreatedDate = ptr.Time(t) 5690 } 5691 5692 case "deploymentId": 5693 if value != nil { 5694 jtv, ok := value.(string) 5695 if !ok { 5696 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5697 } 5698 sv.DeploymentId = ptr.String(jtv) 5699 } 5700 5701 case "deploymentStatus": 5702 if value != nil { 5703 jtv, ok := value.(string) 5704 if !ok { 5705 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 5706 } 5707 sv.DeploymentStatus = types.DeploymentStatus(jtv) 5708 } 5709 5710 case "deploymentStatusMessage": 5711 if value != nil { 5712 jtv, ok := value.(string) 5713 if !ok { 5714 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5715 } 5716 sv.DeploymentStatusMessage = ptr.String(jtv) 5717 } 5718 5719 case "description": 5720 if value != nil { 5721 jtv, ok := value.(string) 5722 if !ok { 5723 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 5724 } 5725 sv.Description = ptr.String(jtv) 5726 } 5727 5728 default: 5729 _, _ = key, value 5730 5731 } 5732 } 5733 *v = sv 5734 return nil 5735} 5736 5737type awsRestjson1_deserializeOpGetDeployments struct { 5738} 5739 5740func (*awsRestjson1_deserializeOpGetDeployments) ID() string { 5741 return "OperationDeserializer" 5742} 5743 5744func (m *awsRestjson1_deserializeOpGetDeployments) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5745 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5746) { 5747 out, metadata, err = next.HandleDeserialize(ctx, in) 5748 if err != nil { 5749 return out, metadata, err 5750 } 5751 5752 response, ok := out.RawResponse.(*smithyhttp.Response) 5753 if !ok { 5754 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5755 } 5756 5757 if response.StatusCode < 200 || response.StatusCode >= 300 { 5758 return out, metadata, awsRestjson1_deserializeOpErrorGetDeployments(response, &metadata) 5759 } 5760 output := &GetDeploymentsOutput{} 5761 out.Result = output 5762 5763 var buff [1024]byte 5764 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5765 5766 body := io.TeeReader(response.Body, ringBuffer) 5767 5768 decoder := json.NewDecoder(body) 5769 decoder.UseNumber() 5770 var shape interface{} 5771 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5772 var snapshot bytes.Buffer 5773 io.Copy(&snapshot, ringBuffer) 5774 err = &smithy.DeserializationError{ 5775 Err: fmt.Errorf("failed to decode response body, %w", err), 5776 Snapshot: snapshot.Bytes(), 5777 } 5778 return out, metadata, err 5779 } 5780 5781 err = awsRestjson1_deserializeOpDocumentGetDeploymentsOutput(&output, shape) 5782 if err != nil { 5783 var snapshot bytes.Buffer 5784 io.Copy(&snapshot, ringBuffer) 5785 return out, metadata, &smithy.DeserializationError{ 5786 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5787 Snapshot: snapshot.Bytes(), 5788 } 5789 } 5790 5791 return out, metadata, err 5792} 5793 5794func awsRestjson1_deserializeOpErrorGetDeployments(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5795 var errorBuffer bytes.Buffer 5796 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5797 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5798 } 5799 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5800 5801 errorCode := "UnknownError" 5802 errorMessage := errorCode 5803 5804 code := response.Header.Get("X-Amzn-ErrorType") 5805 if len(code) != 0 { 5806 errorCode = restjson.SanitizeErrorCode(code) 5807 } 5808 5809 var buff [1024]byte 5810 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5811 5812 body := io.TeeReader(errorBody, ringBuffer) 5813 decoder := json.NewDecoder(body) 5814 decoder.UseNumber() 5815 code, message, err := restjson.GetErrorInfo(decoder) 5816 if err != nil { 5817 var snapshot bytes.Buffer 5818 io.Copy(&snapshot, ringBuffer) 5819 err = &smithy.DeserializationError{ 5820 Err: fmt.Errorf("failed to decode response body, %w", err), 5821 Snapshot: snapshot.Bytes(), 5822 } 5823 return err 5824 } 5825 5826 errorBody.Seek(0, io.SeekStart) 5827 if len(code) != 0 { 5828 errorCode = restjson.SanitizeErrorCode(code) 5829 } 5830 if len(message) != 0 { 5831 errorMessage = message 5832 } 5833 5834 switch { 5835 case strings.EqualFold("BadRequestException", errorCode): 5836 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5837 5838 case strings.EqualFold("NotFoundException", errorCode): 5839 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5840 5841 case strings.EqualFold("TooManyRequestsException", errorCode): 5842 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 5843 5844 default: 5845 genericError := &smithy.GenericAPIError{ 5846 Code: errorCode, 5847 Message: errorMessage, 5848 } 5849 return genericError 5850 5851 } 5852} 5853 5854func awsRestjson1_deserializeOpDocumentGetDeploymentsOutput(v **GetDeploymentsOutput, value interface{}) error { 5855 if v == nil { 5856 return fmt.Errorf("unexpected nil of type %T", v) 5857 } 5858 if value == nil { 5859 return nil 5860 } 5861 5862 shape, ok := value.(map[string]interface{}) 5863 if !ok { 5864 return fmt.Errorf("unexpected JSON type %v", value) 5865 } 5866 5867 var sv *GetDeploymentsOutput 5868 if *v == nil { 5869 sv = &GetDeploymentsOutput{} 5870 } else { 5871 sv = *v 5872 } 5873 5874 for key, value := range shape { 5875 switch key { 5876 case "items": 5877 if err := awsRestjson1_deserializeDocument__listOfDeployment(&sv.Items, value); err != nil { 5878 return err 5879 } 5880 5881 case "nextToken": 5882 if value != nil { 5883 jtv, ok := value.(string) 5884 if !ok { 5885 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5886 } 5887 sv.NextToken = ptr.String(jtv) 5888 } 5889 5890 default: 5891 _, _ = key, value 5892 5893 } 5894 } 5895 *v = sv 5896 return nil 5897} 5898 5899type awsRestjson1_deserializeOpGetDomainName struct { 5900} 5901 5902func (*awsRestjson1_deserializeOpGetDomainName) ID() string { 5903 return "OperationDeserializer" 5904} 5905 5906func (m *awsRestjson1_deserializeOpGetDomainName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5907 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5908) { 5909 out, metadata, err = next.HandleDeserialize(ctx, in) 5910 if err != nil { 5911 return out, metadata, err 5912 } 5913 5914 response, ok := out.RawResponse.(*smithyhttp.Response) 5915 if !ok { 5916 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5917 } 5918 5919 if response.StatusCode < 200 || response.StatusCode >= 300 { 5920 return out, metadata, awsRestjson1_deserializeOpErrorGetDomainName(response, &metadata) 5921 } 5922 output := &GetDomainNameOutput{} 5923 out.Result = output 5924 5925 var buff [1024]byte 5926 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5927 5928 body := io.TeeReader(response.Body, ringBuffer) 5929 5930 decoder := json.NewDecoder(body) 5931 decoder.UseNumber() 5932 var shape interface{} 5933 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5934 var snapshot bytes.Buffer 5935 io.Copy(&snapshot, ringBuffer) 5936 err = &smithy.DeserializationError{ 5937 Err: fmt.Errorf("failed to decode response body, %w", err), 5938 Snapshot: snapshot.Bytes(), 5939 } 5940 return out, metadata, err 5941 } 5942 5943 err = awsRestjson1_deserializeOpDocumentGetDomainNameOutput(&output, shape) 5944 if err != nil { 5945 var snapshot bytes.Buffer 5946 io.Copy(&snapshot, ringBuffer) 5947 return out, metadata, &smithy.DeserializationError{ 5948 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5949 Snapshot: snapshot.Bytes(), 5950 } 5951 } 5952 5953 return out, metadata, err 5954} 5955 5956func awsRestjson1_deserializeOpErrorGetDomainName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5957 var errorBuffer bytes.Buffer 5958 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5959 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5960 } 5961 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5962 5963 errorCode := "UnknownError" 5964 errorMessage := errorCode 5965 5966 code := response.Header.Get("X-Amzn-ErrorType") 5967 if len(code) != 0 { 5968 errorCode = restjson.SanitizeErrorCode(code) 5969 } 5970 5971 var buff [1024]byte 5972 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5973 5974 body := io.TeeReader(errorBody, ringBuffer) 5975 decoder := json.NewDecoder(body) 5976 decoder.UseNumber() 5977 code, message, err := restjson.GetErrorInfo(decoder) 5978 if err != nil { 5979 var snapshot bytes.Buffer 5980 io.Copy(&snapshot, ringBuffer) 5981 err = &smithy.DeserializationError{ 5982 Err: fmt.Errorf("failed to decode response body, %w", err), 5983 Snapshot: snapshot.Bytes(), 5984 } 5985 return err 5986 } 5987 5988 errorBody.Seek(0, io.SeekStart) 5989 if len(code) != 0 { 5990 errorCode = restjson.SanitizeErrorCode(code) 5991 } 5992 if len(message) != 0 { 5993 errorMessage = message 5994 } 5995 5996 switch { 5997 case strings.EqualFold("NotFoundException", errorCode): 5998 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5999 6000 case strings.EqualFold("TooManyRequestsException", errorCode): 6001 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6002 6003 default: 6004 genericError := &smithy.GenericAPIError{ 6005 Code: errorCode, 6006 Message: errorMessage, 6007 } 6008 return genericError 6009 6010 } 6011} 6012 6013func awsRestjson1_deserializeOpDocumentGetDomainNameOutput(v **GetDomainNameOutput, value interface{}) error { 6014 if v == nil { 6015 return fmt.Errorf("unexpected nil of type %T", v) 6016 } 6017 if value == nil { 6018 return nil 6019 } 6020 6021 shape, ok := value.(map[string]interface{}) 6022 if !ok { 6023 return fmt.Errorf("unexpected JSON type %v", value) 6024 } 6025 6026 var sv *GetDomainNameOutput 6027 if *v == nil { 6028 sv = &GetDomainNameOutput{} 6029 } else { 6030 sv = *v 6031 } 6032 6033 for key, value := range shape { 6034 switch key { 6035 case "apiMappingSelectionExpression": 6036 if value != nil { 6037 jtv, ok := value.(string) 6038 if !ok { 6039 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 6040 } 6041 sv.ApiMappingSelectionExpression = ptr.String(jtv) 6042 } 6043 6044 case "domainName": 6045 if value != nil { 6046 jtv, ok := value.(string) 6047 if !ok { 6048 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 6049 } 6050 sv.DomainName = ptr.String(jtv) 6051 } 6052 6053 case "domainNameConfigurations": 6054 if err := awsRestjson1_deserializeDocumentDomainNameConfigurations(&sv.DomainNameConfigurations, value); err != nil { 6055 return err 6056 } 6057 6058 case "mutualTlsAuthentication": 6059 if err := awsRestjson1_deserializeDocumentMutualTlsAuthentication(&sv.MutualTlsAuthentication, value); err != nil { 6060 return err 6061 } 6062 6063 case "tags": 6064 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 6065 return err 6066 } 6067 6068 default: 6069 _, _ = key, value 6070 6071 } 6072 } 6073 *v = sv 6074 return nil 6075} 6076 6077type awsRestjson1_deserializeOpGetDomainNames struct { 6078} 6079 6080func (*awsRestjson1_deserializeOpGetDomainNames) ID() string { 6081 return "OperationDeserializer" 6082} 6083 6084func (m *awsRestjson1_deserializeOpGetDomainNames) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6085 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6086) { 6087 out, metadata, err = next.HandleDeserialize(ctx, in) 6088 if err != nil { 6089 return out, metadata, err 6090 } 6091 6092 response, ok := out.RawResponse.(*smithyhttp.Response) 6093 if !ok { 6094 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6095 } 6096 6097 if response.StatusCode < 200 || response.StatusCode >= 300 { 6098 return out, metadata, awsRestjson1_deserializeOpErrorGetDomainNames(response, &metadata) 6099 } 6100 output := &GetDomainNamesOutput{} 6101 out.Result = output 6102 6103 var buff [1024]byte 6104 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6105 6106 body := io.TeeReader(response.Body, ringBuffer) 6107 6108 decoder := json.NewDecoder(body) 6109 decoder.UseNumber() 6110 var shape interface{} 6111 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6112 var snapshot bytes.Buffer 6113 io.Copy(&snapshot, ringBuffer) 6114 err = &smithy.DeserializationError{ 6115 Err: fmt.Errorf("failed to decode response body, %w", err), 6116 Snapshot: snapshot.Bytes(), 6117 } 6118 return out, metadata, err 6119 } 6120 6121 err = awsRestjson1_deserializeOpDocumentGetDomainNamesOutput(&output, shape) 6122 if err != nil { 6123 var snapshot bytes.Buffer 6124 io.Copy(&snapshot, ringBuffer) 6125 return out, metadata, &smithy.DeserializationError{ 6126 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6127 Snapshot: snapshot.Bytes(), 6128 } 6129 } 6130 6131 return out, metadata, err 6132} 6133 6134func awsRestjson1_deserializeOpErrorGetDomainNames(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6135 var errorBuffer bytes.Buffer 6136 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6137 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6138 } 6139 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6140 6141 errorCode := "UnknownError" 6142 errorMessage := errorCode 6143 6144 code := response.Header.Get("X-Amzn-ErrorType") 6145 if len(code) != 0 { 6146 errorCode = restjson.SanitizeErrorCode(code) 6147 } 6148 6149 var buff [1024]byte 6150 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6151 6152 body := io.TeeReader(errorBody, ringBuffer) 6153 decoder := json.NewDecoder(body) 6154 decoder.UseNumber() 6155 code, message, err := restjson.GetErrorInfo(decoder) 6156 if err != nil { 6157 var snapshot bytes.Buffer 6158 io.Copy(&snapshot, ringBuffer) 6159 err = &smithy.DeserializationError{ 6160 Err: fmt.Errorf("failed to decode response body, %w", err), 6161 Snapshot: snapshot.Bytes(), 6162 } 6163 return err 6164 } 6165 6166 errorBody.Seek(0, io.SeekStart) 6167 if len(code) != 0 { 6168 errorCode = restjson.SanitizeErrorCode(code) 6169 } 6170 if len(message) != 0 { 6171 errorMessage = message 6172 } 6173 6174 switch { 6175 case strings.EqualFold("BadRequestException", errorCode): 6176 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 6177 6178 case strings.EqualFold("NotFoundException", errorCode): 6179 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6180 6181 case strings.EqualFold("TooManyRequestsException", errorCode): 6182 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6183 6184 default: 6185 genericError := &smithy.GenericAPIError{ 6186 Code: errorCode, 6187 Message: errorMessage, 6188 } 6189 return genericError 6190 6191 } 6192} 6193 6194func awsRestjson1_deserializeOpDocumentGetDomainNamesOutput(v **GetDomainNamesOutput, value interface{}) error { 6195 if v == nil { 6196 return fmt.Errorf("unexpected nil of type %T", v) 6197 } 6198 if value == nil { 6199 return nil 6200 } 6201 6202 shape, ok := value.(map[string]interface{}) 6203 if !ok { 6204 return fmt.Errorf("unexpected JSON type %v", value) 6205 } 6206 6207 var sv *GetDomainNamesOutput 6208 if *v == nil { 6209 sv = &GetDomainNamesOutput{} 6210 } else { 6211 sv = *v 6212 } 6213 6214 for key, value := range shape { 6215 switch key { 6216 case "items": 6217 if err := awsRestjson1_deserializeDocument__listOfDomainName(&sv.Items, value); err != nil { 6218 return err 6219 } 6220 6221 case "nextToken": 6222 if value != nil { 6223 jtv, ok := value.(string) 6224 if !ok { 6225 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6226 } 6227 sv.NextToken = ptr.String(jtv) 6228 } 6229 6230 default: 6231 _, _ = key, value 6232 6233 } 6234 } 6235 *v = sv 6236 return nil 6237} 6238 6239type awsRestjson1_deserializeOpGetIntegration struct { 6240} 6241 6242func (*awsRestjson1_deserializeOpGetIntegration) ID() string { 6243 return "OperationDeserializer" 6244} 6245 6246func (m *awsRestjson1_deserializeOpGetIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6247 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6248) { 6249 out, metadata, err = next.HandleDeserialize(ctx, in) 6250 if err != nil { 6251 return out, metadata, err 6252 } 6253 6254 response, ok := out.RawResponse.(*smithyhttp.Response) 6255 if !ok { 6256 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6257 } 6258 6259 if response.StatusCode < 200 || response.StatusCode >= 300 { 6260 return out, metadata, awsRestjson1_deserializeOpErrorGetIntegration(response, &metadata) 6261 } 6262 output := &GetIntegrationOutput{} 6263 out.Result = output 6264 6265 var buff [1024]byte 6266 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6267 6268 body := io.TeeReader(response.Body, ringBuffer) 6269 6270 decoder := json.NewDecoder(body) 6271 decoder.UseNumber() 6272 var shape interface{} 6273 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6274 var snapshot bytes.Buffer 6275 io.Copy(&snapshot, ringBuffer) 6276 err = &smithy.DeserializationError{ 6277 Err: fmt.Errorf("failed to decode response body, %w", err), 6278 Snapshot: snapshot.Bytes(), 6279 } 6280 return out, metadata, err 6281 } 6282 6283 err = awsRestjson1_deserializeOpDocumentGetIntegrationOutput(&output, shape) 6284 if err != nil { 6285 var snapshot bytes.Buffer 6286 io.Copy(&snapshot, ringBuffer) 6287 return out, metadata, &smithy.DeserializationError{ 6288 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6289 Snapshot: snapshot.Bytes(), 6290 } 6291 } 6292 6293 return out, metadata, err 6294} 6295 6296func awsRestjson1_deserializeOpErrorGetIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6297 var errorBuffer bytes.Buffer 6298 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6299 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6300 } 6301 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6302 6303 errorCode := "UnknownError" 6304 errorMessage := errorCode 6305 6306 code := response.Header.Get("X-Amzn-ErrorType") 6307 if len(code) != 0 { 6308 errorCode = restjson.SanitizeErrorCode(code) 6309 } 6310 6311 var buff [1024]byte 6312 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6313 6314 body := io.TeeReader(errorBody, ringBuffer) 6315 decoder := json.NewDecoder(body) 6316 decoder.UseNumber() 6317 code, message, err := restjson.GetErrorInfo(decoder) 6318 if err != nil { 6319 var snapshot bytes.Buffer 6320 io.Copy(&snapshot, ringBuffer) 6321 err = &smithy.DeserializationError{ 6322 Err: fmt.Errorf("failed to decode response body, %w", err), 6323 Snapshot: snapshot.Bytes(), 6324 } 6325 return err 6326 } 6327 6328 errorBody.Seek(0, io.SeekStart) 6329 if len(code) != 0 { 6330 errorCode = restjson.SanitizeErrorCode(code) 6331 } 6332 if len(message) != 0 { 6333 errorMessage = message 6334 } 6335 6336 switch { 6337 case strings.EqualFold("NotFoundException", errorCode): 6338 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6339 6340 case strings.EqualFold("TooManyRequestsException", errorCode): 6341 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6342 6343 default: 6344 genericError := &smithy.GenericAPIError{ 6345 Code: errorCode, 6346 Message: errorMessage, 6347 } 6348 return genericError 6349 6350 } 6351} 6352 6353func awsRestjson1_deserializeOpDocumentGetIntegrationOutput(v **GetIntegrationOutput, value interface{}) error { 6354 if v == nil { 6355 return fmt.Errorf("unexpected nil of type %T", v) 6356 } 6357 if value == nil { 6358 return nil 6359 } 6360 6361 shape, ok := value.(map[string]interface{}) 6362 if !ok { 6363 return fmt.Errorf("unexpected JSON type %v", value) 6364 } 6365 6366 var sv *GetIntegrationOutput 6367 if *v == nil { 6368 sv = &GetIntegrationOutput{} 6369 } else { 6370 sv = *v 6371 } 6372 6373 for key, value := range shape { 6374 switch key { 6375 case "apiGatewayManaged": 6376 if value != nil { 6377 jtv, ok := value.(bool) 6378 if !ok { 6379 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 6380 } 6381 sv.ApiGatewayManaged = jtv 6382 } 6383 6384 case "connectionId": 6385 if value != nil { 6386 jtv, ok := value.(string) 6387 if !ok { 6388 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 6389 } 6390 sv.ConnectionId = ptr.String(jtv) 6391 } 6392 6393 case "connectionType": 6394 if value != nil { 6395 jtv, ok := value.(string) 6396 if !ok { 6397 return fmt.Errorf("expected ConnectionType to be of type string, got %T instead", value) 6398 } 6399 sv.ConnectionType = types.ConnectionType(jtv) 6400 } 6401 6402 case "contentHandlingStrategy": 6403 if value != nil { 6404 jtv, ok := value.(string) 6405 if !ok { 6406 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 6407 } 6408 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 6409 } 6410 6411 case "credentialsArn": 6412 if value != nil { 6413 jtv, ok := value.(string) 6414 if !ok { 6415 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 6416 } 6417 sv.CredentialsArn = ptr.String(jtv) 6418 } 6419 6420 case "description": 6421 if value != nil { 6422 jtv, ok := value.(string) 6423 if !ok { 6424 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 6425 } 6426 sv.Description = ptr.String(jtv) 6427 } 6428 6429 case "integrationId": 6430 if value != nil { 6431 jtv, ok := value.(string) 6432 if !ok { 6433 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6434 } 6435 sv.IntegrationId = ptr.String(jtv) 6436 } 6437 6438 case "integrationMethod": 6439 if value != nil { 6440 jtv, ok := value.(string) 6441 if !ok { 6442 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 6443 } 6444 sv.IntegrationMethod = ptr.String(jtv) 6445 } 6446 6447 case "integrationResponseSelectionExpression": 6448 if value != nil { 6449 jtv, ok := value.(string) 6450 if !ok { 6451 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 6452 } 6453 sv.IntegrationResponseSelectionExpression = ptr.String(jtv) 6454 } 6455 6456 case "integrationSubtype": 6457 if value != nil { 6458 jtv, ok := value.(string) 6459 if !ok { 6460 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 6461 } 6462 sv.IntegrationSubtype = ptr.String(jtv) 6463 } 6464 6465 case "integrationType": 6466 if value != nil { 6467 jtv, ok := value.(string) 6468 if !ok { 6469 return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) 6470 } 6471 sv.IntegrationType = types.IntegrationType(jtv) 6472 } 6473 6474 case "integrationUri": 6475 if value != nil { 6476 jtv, ok := value.(string) 6477 if !ok { 6478 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 6479 } 6480 sv.IntegrationUri = ptr.String(jtv) 6481 } 6482 6483 case "passthroughBehavior": 6484 if value != nil { 6485 jtv, ok := value.(string) 6486 if !ok { 6487 return fmt.Errorf("expected PassthroughBehavior to be of type string, got %T instead", value) 6488 } 6489 sv.PassthroughBehavior = types.PassthroughBehavior(jtv) 6490 } 6491 6492 case "payloadFormatVersion": 6493 if value != nil { 6494 jtv, ok := value.(string) 6495 if !ok { 6496 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 6497 } 6498 sv.PayloadFormatVersion = ptr.String(jtv) 6499 } 6500 6501 case "requestParameters": 6502 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.RequestParameters, value); err != nil { 6503 return err 6504 } 6505 6506 case "requestTemplates": 6507 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.RequestTemplates, value); err != nil { 6508 return err 6509 } 6510 6511 case "templateSelectionExpression": 6512 if value != nil { 6513 jtv, ok := value.(string) 6514 if !ok { 6515 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 6516 } 6517 sv.TemplateSelectionExpression = ptr.String(jtv) 6518 } 6519 6520 case "timeoutInMillis": 6521 if value != nil { 6522 jtv, ok := value.(json.Number) 6523 if !ok { 6524 return fmt.Errorf("expected IntegerWithLengthBetween50And30000 to be json.Number, got %T instead", value) 6525 } 6526 i64, err := jtv.Int64() 6527 if err != nil { 6528 return err 6529 } 6530 sv.TimeoutInMillis = int32(i64) 6531 } 6532 6533 case "tlsConfig": 6534 if err := awsRestjson1_deserializeDocumentTlsConfig(&sv.TlsConfig, value); err != nil { 6535 return err 6536 } 6537 6538 default: 6539 _, _ = key, value 6540 6541 } 6542 } 6543 *v = sv 6544 return nil 6545} 6546 6547type awsRestjson1_deserializeOpGetIntegrationResponse struct { 6548} 6549 6550func (*awsRestjson1_deserializeOpGetIntegrationResponse) ID() string { 6551 return "OperationDeserializer" 6552} 6553 6554func (m *awsRestjson1_deserializeOpGetIntegrationResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6555 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6556) { 6557 out, metadata, err = next.HandleDeserialize(ctx, in) 6558 if err != nil { 6559 return out, metadata, err 6560 } 6561 6562 response, ok := out.RawResponse.(*smithyhttp.Response) 6563 if !ok { 6564 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6565 } 6566 6567 if response.StatusCode < 200 || response.StatusCode >= 300 { 6568 return out, metadata, awsRestjson1_deserializeOpErrorGetIntegrationResponse(response, &metadata) 6569 } 6570 output := &GetIntegrationResponseOutput{} 6571 out.Result = output 6572 6573 var buff [1024]byte 6574 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6575 6576 body := io.TeeReader(response.Body, ringBuffer) 6577 6578 decoder := json.NewDecoder(body) 6579 decoder.UseNumber() 6580 var shape interface{} 6581 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6582 var snapshot bytes.Buffer 6583 io.Copy(&snapshot, ringBuffer) 6584 err = &smithy.DeserializationError{ 6585 Err: fmt.Errorf("failed to decode response body, %w", err), 6586 Snapshot: snapshot.Bytes(), 6587 } 6588 return out, metadata, err 6589 } 6590 6591 err = awsRestjson1_deserializeOpDocumentGetIntegrationResponseOutput(&output, shape) 6592 if err != nil { 6593 var snapshot bytes.Buffer 6594 io.Copy(&snapshot, ringBuffer) 6595 return out, metadata, &smithy.DeserializationError{ 6596 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6597 Snapshot: snapshot.Bytes(), 6598 } 6599 } 6600 6601 return out, metadata, err 6602} 6603 6604func awsRestjson1_deserializeOpErrorGetIntegrationResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6605 var errorBuffer bytes.Buffer 6606 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6607 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6608 } 6609 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6610 6611 errorCode := "UnknownError" 6612 errorMessage := errorCode 6613 6614 code := response.Header.Get("X-Amzn-ErrorType") 6615 if len(code) != 0 { 6616 errorCode = restjson.SanitizeErrorCode(code) 6617 } 6618 6619 var buff [1024]byte 6620 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6621 6622 body := io.TeeReader(errorBody, ringBuffer) 6623 decoder := json.NewDecoder(body) 6624 decoder.UseNumber() 6625 code, message, err := restjson.GetErrorInfo(decoder) 6626 if err != nil { 6627 var snapshot bytes.Buffer 6628 io.Copy(&snapshot, ringBuffer) 6629 err = &smithy.DeserializationError{ 6630 Err: fmt.Errorf("failed to decode response body, %w", err), 6631 Snapshot: snapshot.Bytes(), 6632 } 6633 return err 6634 } 6635 6636 errorBody.Seek(0, io.SeekStart) 6637 if len(code) != 0 { 6638 errorCode = restjson.SanitizeErrorCode(code) 6639 } 6640 if len(message) != 0 { 6641 errorMessage = message 6642 } 6643 6644 switch { 6645 case strings.EqualFold("NotFoundException", errorCode): 6646 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6647 6648 case strings.EqualFold("TooManyRequestsException", errorCode): 6649 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6650 6651 default: 6652 genericError := &smithy.GenericAPIError{ 6653 Code: errorCode, 6654 Message: errorMessage, 6655 } 6656 return genericError 6657 6658 } 6659} 6660 6661func awsRestjson1_deserializeOpDocumentGetIntegrationResponseOutput(v **GetIntegrationResponseOutput, value interface{}) error { 6662 if v == nil { 6663 return fmt.Errorf("unexpected nil of type %T", v) 6664 } 6665 if value == nil { 6666 return nil 6667 } 6668 6669 shape, ok := value.(map[string]interface{}) 6670 if !ok { 6671 return fmt.Errorf("unexpected JSON type %v", value) 6672 } 6673 6674 var sv *GetIntegrationResponseOutput 6675 if *v == nil { 6676 sv = &GetIntegrationResponseOutput{} 6677 } else { 6678 sv = *v 6679 } 6680 6681 for key, value := range shape { 6682 switch key { 6683 case "contentHandlingStrategy": 6684 if value != nil { 6685 jtv, ok := value.(string) 6686 if !ok { 6687 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 6688 } 6689 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 6690 } 6691 6692 case "integrationResponseId": 6693 if value != nil { 6694 jtv, ok := value.(string) 6695 if !ok { 6696 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6697 } 6698 sv.IntegrationResponseId = ptr.String(jtv) 6699 } 6700 6701 case "integrationResponseKey": 6702 if value != nil { 6703 jtv, ok := value.(string) 6704 if !ok { 6705 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 6706 } 6707 sv.IntegrationResponseKey = ptr.String(jtv) 6708 } 6709 6710 case "responseParameters": 6711 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.ResponseParameters, value); err != nil { 6712 return err 6713 } 6714 6715 case "responseTemplates": 6716 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.ResponseTemplates, value); err != nil { 6717 return err 6718 } 6719 6720 case "templateSelectionExpression": 6721 if value != nil { 6722 jtv, ok := value.(string) 6723 if !ok { 6724 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 6725 } 6726 sv.TemplateSelectionExpression = ptr.String(jtv) 6727 } 6728 6729 default: 6730 _, _ = key, value 6731 6732 } 6733 } 6734 *v = sv 6735 return nil 6736} 6737 6738type awsRestjson1_deserializeOpGetIntegrationResponses struct { 6739} 6740 6741func (*awsRestjson1_deserializeOpGetIntegrationResponses) ID() string { 6742 return "OperationDeserializer" 6743} 6744 6745func (m *awsRestjson1_deserializeOpGetIntegrationResponses) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6746 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6747) { 6748 out, metadata, err = next.HandleDeserialize(ctx, in) 6749 if err != nil { 6750 return out, metadata, err 6751 } 6752 6753 response, ok := out.RawResponse.(*smithyhttp.Response) 6754 if !ok { 6755 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6756 } 6757 6758 if response.StatusCode < 200 || response.StatusCode >= 300 { 6759 return out, metadata, awsRestjson1_deserializeOpErrorGetIntegrationResponses(response, &metadata) 6760 } 6761 output := &GetIntegrationResponsesOutput{} 6762 out.Result = output 6763 6764 var buff [1024]byte 6765 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6766 6767 body := io.TeeReader(response.Body, ringBuffer) 6768 6769 decoder := json.NewDecoder(body) 6770 decoder.UseNumber() 6771 var shape interface{} 6772 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6773 var snapshot bytes.Buffer 6774 io.Copy(&snapshot, ringBuffer) 6775 err = &smithy.DeserializationError{ 6776 Err: fmt.Errorf("failed to decode response body, %w", err), 6777 Snapshot: snapshot.Bytes(), 6778 } 6779 return out, metadata, err 6780 } 6781 6782 err = awsRestjson1_deserializeOpDocumentGetIntegrationResponsesOutput(&output, shape) 6783 if err != nil { 6784 var snapshot bytes.Buffer 6785 io.Copy(&snapshot, ringBuffer) 6786 return out, metadata, &smithy.DeserializationError{ 6787 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6788 Snapshot: snapshot.Bytes(), 6789 } 6790 } 6791 6792 return out, metadata, err 6793} 6794 6795func awsRestjson1_deserializeOpErrorGetIntegrationResponses(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6796 var errorBuffer bytes.Buffer 6797 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6798 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6799 } 6800 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6801 6802 errorCode := "UnknownError" 6803 errorMessage := errorCode 6804 6805 code := response.Header.Get("X-Amzn-ErrorType") 6806 if len(code) != 0 { 6807 errorCode = restjson.SanitizeErrorCode(code) 6808 } 6809 6810 var buff [1024]byte 6811 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6812 6813 body := io.TeeReader(errorBody, ringBuffer) 6814 decoder := json.NewDecoder(body) 6815 decoder.UseNumber() 6816 code, message, err := restjson.GetErrorInfo(decoder) 6817 if err != nil { 6818 var snapshot bytes.Buffer 6819 io.Copy(&snapshot, ringBuffer) 6820 err = &smithy.DeserializationError{ 6821 Err: fmt.Errorf("failed to decode response body, %w", err), 6822 Snapshot: snapshot.Bytes(), 6823 } 6824 return err 6825 } 6826 6827 errorBody.Seek(0, io.SeekStart) 6828 if len(code) != 0 { 6829 errorCode = restjson.SanitizeErrorCode(code) 6830 } 6831 if len(message) != 0 { 6832 errorMessage = message 6833 } 6834 6835 switch { 6836 case strings.EqualFold("BadRequestException", errorCode): 6837 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 6838 6839 case strings.EqualFold("NotFoundException", errorCode): 6840 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 6841 6842 case strings.EqualFold("TooManyRequestsException", errorCode): 6843 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 6844 6845 default: 6846 genericError := &smithy.GenericAPIError{ 6847 Code: errorCode, 6848 Message: errorMessage, 6849 } 6850 return genericError 6851 6852 } 6853} 6854 6855func awsRestjson1_deserializeOpDocumentGetIntegrationResponsesOutput(v **GetIntegrationResponsesOutput, value interface{}) error { 6856 if v == nil { 6857 return fmt.Errorf("unexpected nil of type %T", v) 6858 } 6859 if value == nil { 6860 return nil 6861 } 6862 6863 shape, ok := value.(map[string]interface{}) 6864 if !ok { 6865 return fmt.Errorf("unexpected JSON type %v", value) 6866 } 6867 6868 var sv *GetIntegrationResponsesOutput 6869 if *v == nil { 6870 sv = &GetIntegrationResponsesOutput{} 6871 } else { 6872 sv = *v 6873 } 6874 6875 for key, value := range shape { 6876 switch key { 6877 case "items": 6878 if err := awsRestjson1_deserializeDocument__listOfIntegrationResponse(&sv.Items, value); err != nil { 6879 return err 6880 } 6881 6882 case "nextToken": 6883 if value != nil { 6884 jtv, ok := value.(string) 6885 if !ok { 6886 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6887 } 6888 sv.NextToken = ptr.String(jtv) 6889 } 6890 6891 default: 6892 _, _ = key, value 6893 6894 } 6895 } 6896 *v = sv 6897 return nil 6898} 6899 6900type awsRestjson1_deserializeOpGetIntegrations struct { 6901} 6902 6903func (*awsRestjson1_deserializeOpGetIntegrations) ID() string { 6904 return "OperationDeserializer" 6905} 6906 6907func (m *awsRestjson1_deserializeOpGetIntegrations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6908 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6909) { 6910 out, metadata, err = next.HandleDeserialize(ctx, in) 6911 if err != nil { 6912 return out, metadata, err 6913 } 6914 6915 response, ok := out.RawResponse.(*smithyhttp.Response) 6916 if !ok { 6917 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6918 } 6919 6920 if response.StatusCode < 200 || response.StatusCode >= 300 { 6921 return out, metadata, awsRestjson1_deserializeOpErrorGetIntegrations(response, &metadata) 6922 } 6923 output := &GetIntegrationsOutput{} 6924 out.Result = output 6925 6926 var buff [1024]byte 6927 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6928 6929 body := io.TeeReader(response.Body, ringBuffer) 6930 6931 decoder := json.NewDecoder(body) 6932 decoder.UseNumber() 6933 var shape interface{} 6934 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6935 var snapshot bytes.Buffer 6936 io.Copy(&snapshot, ringBuffer) 6937 err = &smithy.DeserializationError{ 6938 Err: fmt.Errorf("failed to decode response body, %w", err), 6939 Snapshot: snapshot.Bytes(), 6940 } 6941 return out, metadata, err 6942 } 6943 6944 err = awsRestjson1_deserializeOpDocumentGetIntegrationsOutput(&output, shape) 6945 if err != nil { 6946 var snapshot bytes.Buffer 6947 io.Copy(&snapshot, ringBuffer) 6948 return out, metadata, &smithy.DeserializationError{ 6949 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6950 Snapshot: snapshot.Bytes(), 6951 } 6952 } 6953 6954 return out, metadata, err 6955} 6956 6957func awsRestjson1_deserializeOpErrorGetIntegrations(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6958 var errorBuffer bytes.Buffer 6959 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6960 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6961 } 6962 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6963 6964 errorCode := "UnknownError" 6965 errorMessage := errorCode 6966 6967 code := response.Header.Get("X-Amzn-ErrorType") 6968 if len(code) != 0 { 6969 errorCode = restjson.SanitizeErrorCode(code) 6970 } 6971 6972 var buff [1024]byte 6973 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6974 6975 body := io.TeeReader(errorBody, ringBuffer) 6976 decoder := json.NewDecoder(body) 6977 decoder.UseNumber() 6978 code, message, err := restjson.GetErrorInfo(decoder) 6979 if err != nil { 6980 var snapshot bytes.Buffer 6981 io.Copy(&snapshot, ringBuffer) 6982 err = &smithy.DeserializationError{ 6983 Err: fmt.Errorf("failed to decode response body, %w", err), 6984 Snapshot: snapshot.Bytes(), 6985 } 6986 return err 6987 } 6988 6989 errorBody.Seek(0, io.SeekStart) 6990 if len(code) != 0 { 6991 errorCode = restjson.SanitizeErrorCode(code) 6992 } 6993 if len(message) != 0 { 6994 errorMessage = message 6995 } 6996 6997 switch { 6998 case strings.EqualFold("BadRequestException", errorCode): 6999 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 7000 7001 case strings.EqualFold("NotFoundException", errorCode): 7002 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7003 7004 case strings.EqualFold("TooManyRequestsException", errorCode): 7005 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7006 7007 default: 7008 genericError := &smithy.GenericAPIError{ 7009 Code: errorCode, 7010 Message: errorMessage, 7011 } 7012 return genericError 7013 7014 } 7015} 7016 7017func awsRestjson1_deserializeOpDocumentGetIntegrationsOutput(v **GetIntegrationsOutput, value interface{}) error { 7018 if v == nil { 7019 return fmt.Errorf("unexpected nil of type %T", v) 7020 } 7021 if value == nil { 7022 return nil 7023 } 7024 7025 shape, ok := value.(map[string]interface{}) 7026 if !ok { 7027 return fmt.Errorf("unexpected JSON type %v", value) 7028 } 7029 7030 var sv *GetIntegrationsOutput 7031 if *v == nil { 7032 sv = &GetIntegrationsOutput{} 7033 } else { 7034 sv = *v 7035 } 7036 7037 for key, value := range shape { 7038 switch key { 7039 case "items": 7040 if err := awsRestjson1_deserializeDocument__listOfIntegration(&sv.Items, value); err != nil { 7041 return err 7042 } 7043 7044 case "nextToken": 7045 if value != nil { 7046 jtv, ok := value.(string) 7047 if !ok { 7048 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7049 } 7050 sv.NextToken = ptr.String(jtv) 7051 } 7052 7053 default: 7054 _, _ = key, value 7055 7056 } 7057 } 7058 *v = sv 7059 return nil 7060} 7061 7062type awsRestjson1_deserializeOpGetModel struct { 7063} 7064 7065func (*awsRestjson1_deserializeOpGetModel) ID() string { 7066 return "OperationDeserializer" 7067} 7068 7069func (m *awsRestjson1_deserializeOpGetModel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7070 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7071) { 7072 out, metadata, err = next.HandleDeserialize(ctx, in) 7073 if err != nil { 7074 return out, metadata, err 7075 } 7076 7077 response, ok := out.RawResponse.(*smithyhttp.Response) 7078 if !ok { 7079 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7080 } 7081 7082 if response.StatusCode < 200 || response.StatusCode >= 300 { 7083 return out, metadata, awsRestjson1_deserializeOpErrorGetModel(response, &metadata) 7084 } 7085 output := &GetModelOutput{} 7086 out.Result = output 7087 7088 var buff [1024]byte 7089 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7090 7091 body := io.TeeReader(response.Body, ringBuffer) 7092 7093 decoder := json.NewDecoder(body) 7094 decoder.UseNumber() 7095 var shape interface{} 7096 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7097 var snapshot bytes.Buffer 7098 io.Copy(&snapshot, ringBuffer) 7099 err = &smithy.DeserializationError{ 7100 Err: fmt.Errorf("failed to decode response body, %w", err), 7101 Snapshot: snapshot.Bytes(), 7102 } 7103 return out, metadata, err 7104 } 7105 7106 err = awsRestjson1_deserializeOpDocumentGetModelOutput(&output, shape) 7107 if err != nil { 7108 var snapshot bytes.Buffer 7109 io.Copy(&snapshot, ringBuffer) 7110 return out, metadata, &smithy.DeserializationError{ 7111 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7112 Snapshot: snapshot.Bytes(), 7113 } 7114 } 7115 7116 return out, metadata, err 7117} 7118 7119func awsRestjson1_deserializeOpErrorGetModel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7120 var errorBuffer bytes.Buffer 7121 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7122 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7123 } 7124 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7125 7126 errorCode := "UnknownError" 7127 errorMessage := errorCode 7128 7129 code := response.Header.Get("X-Amzn-ErrorType") 7130 if len(code) != 0 { 7131 errorCode = restjson.SanitizeErrorCode(code) 7132 } 7133 7134 var buff [1024]byte 7135 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7136 7137 body := io.TeeReader(errorBody, ringBuffer) 7138 decoder := json.NewDecoder(body) 7139 decoder.UseNumber() 7140 code, message, err := restjson.GetErrorInfo(decoder) 7141 if err != nil { 7142 var snapshot bytes.Buffer 7143 io.Copy(&snapshot, ringBuffer) 7144 err = &smithy.DeserializationError{ 7145 Err: fmt.Errorf("failed to decode response body, %w", err), 7146 Snapshot: snapshot.Bytes(), 7147 } 7148 return err 7149 } 7150 7151 errorBody.Seek(0, io.SeekStart) 7152 if len(code) != 0 { 7153 errorCode = restjson.SanitizeErrorCode(code) 7154 } 7155 if len(message) != 0 { 7156 errorMessage = message 7157 } 7158 7159 switch { 7160 case strings.EqualFold("NotFoundException", errorCode): 7161 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7162 7163 case strings.EqualFold("TooManyRequestsException", errorCode): 7164 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7165 7166 default: 7167 genericError := &smithy.GenericAPIError{ 7168 Code: errorCode, 7169 Message: errorMessage, 7170 } 7171 return genericError 7172 7173 } 7174} 7175 7176func awsRestjson1_deserializeOpDocumentGetModelOutput(v **GetModelOutput, value interface{}) error { 7177 if v == nil { 7178 return fmt.Errorf("unexpected nil of type %T", v) 7179 } 7180 if value == nil { 7181 return nil 7182 } 7183 7184 shape, ok := value.(map[string]interface{}) 7185 if !ok { 7186 return fmt.Errorf("unexpected JSON type %v", value) 7187 } 7188 7189 var sv *GetModelOutput 7190 if *v == nil { 7191 sv = &GetModelOutput{} 7192 } else { 7193 sv = *v 7194 } 7195 7196 for key, value := range shape { 7197 switch key { 7198 case "contentType": 7199 if value != nil { 7200 jtv, ok := value.(string) 7201 if !ok { 7202 return fmt.Errorf("expected StringWithLengthBetween1And256 to be of type string, got %T instead", value) 7203 } 7204 sv.ContentType = ptr.String(jtv) 7205 } 7206 7207 case "description": 7208 if value != nil { 7209 jtv, ok := value.(string) 7210 if !ok { 7211 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 7212 } 7213 sv.Description = ptr.String(jtv) 7214 } 7215 7216 case "modelId": 7217 if value != nil { 7218 jtv, ok := value.(string) 7219 if !ok { 7220 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7221 } 7222 sv.ModelId = ptr.String(jtv) 7223 } 7224 7225 case "name": 7226 if value != nil { 7227 jtv, ok := value.(string) 7228 if !ok { 7229 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 7230 } 7231 sv.Name = ptr.String(jtv) 7232 } 7233 7234 case "schema": 7235 if value != nil { 7236 jtv, ok := value.(string) 7237 if !ok { 7238 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 7239 } 7240 sv.Schema = ptr.String(jtv) 7241 } 7242 7243 default: 7244 _, _ = key, value 7245 7246 } 7247 } 7248 *v = sv 7249 return nil 7250} 7251 7252type awsRestjson1_deserializeOpGetModels struct { 7253} 7254 7255func (*awsRestjson1_deserializeOpGetModels) ID() string { 7256 return "OperationDeserializer" 7257} 7258 7259func (m *awsRestjson1_deserializeOpGetModels) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7260 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7261) { 7262 out, metadata, err = next.HandleDeserialize(ctx, in) 7263 if err != nil { 7264 return out, metadata, err 7265 } 7266 7267 response, ok := out.RawResponse.(*smithyhttp.Response) 7268 if !ok { 7269 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7270 } 7271 7272 if response.StatusCode < 200 || response.StatusCode >= 300 { 7273 return out, metadata, awsRestjson1_deserializeOpErrorGetModels(response, &metadata) 7274 } 7275 output := &GetModelsOutput{} 7276 out.Result = output 7277 7278 var buff [1024]byte 7279 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7280 7281 body := io.TeeReader(response.Body, ringBuffer) 7282 7283 decoder := json.NewDecoder(body) 7284 decoder.UseNumber() 7285 var shape interface{} 7286 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7287 var snapshot bytes.Buffer 7288 io.Copy(&snapshot, ringBuffer) 7289 err = &smithy.DeserializationError{ 7290 Err: fmt.Errorf("failed to decode response body, %w", err), 7291 Snapshot: snapshot.Bytes(), 7292 } 7293 return out, metadata, err 7294 } 7295 7296 err = awsRestjson1_deserializeOpDocumentGetModelsOutput(&output, shape) 7297 if err != nil { 7298 var snapshot bytes.Buffer 7299 io.Copy(&snapshot, ringBuffer) 7300 return out, metadata, &smithy.DeserializationError{ 7301 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7302 Snapshot: snapshot.Bytes(), 7303 } 7304 } 7305 7306 return out, metadata, err 7307} 7308 7309func awsRestjson1_deserializeOpErrorGetModels(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7310 var errorBuffer bytes.Buffer 7311 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7312 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7313 } 7314 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7315 7316 errorCode := "UnknownError" 7317 errorMessage := errorCode 7318 7319 code := response.Header.Get("X-Amzn-ErrorType") 7320 if len(code) != 0 { 7321 errorCode = restjson.SanitizeErrorCode(code) 7322 } 7323 7324 var buff [1024]byte 7325 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7326 7327 body := io.TeeReader(errorBody, ringBuffer) 7328 decoder := json.NewDecoder(body) 7329 decoder.UseNumber() 7330 code, message, err := restjson.GetErrorInfo(decoder) 7331 if err != nil { 7332 var snapshot bytes.Buffer 7333 io.Copy(&snapshot, ringBuffer) 7334 err = &smithy.DeserializationError{ 7335 Err: fmt.Errorf("failed to decode response body, %w", err), 7336 Snapshot: snapshot.Bytes(), 7337 } 7338 return err 7339 } 7340 7341 errorBody.Seek(0, io.SeekStart) 7342 if len(code) != 0 { 7343 errorCode = restjson.SanitizeErrorCode(code) 7344 } 7345 if len(message) != 0 { 7346 errorMessage = message 7347 } 7348 7349 switch { 7350 case strings.EqualFold("BadRequestException", errorCode): 7351 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 7352 7353 case strings.EqualFold("NotFoundException", errorCode): 7354 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7355 7356 case strings.EqualFold("TooManyRequestsException", errorCode): 7357 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7358 7359 default: 7360 genericError := &smithy.GenericAPIError{ 7361 Code: errorCode, 7362 Message: errorMessage, 7363 } 7364 return genericError 7365 7366 } 7367} 7368 7369func awsRestjson1_deserializeOpDocumentGetModelsOutput(v **GetModelsOutput, value interface{}) error { 7370 if v == nil { 7371 return fmt.Errorf("unexpected nil of type %T", v) 7372 } 7373 if value == nil { 7374 return nil 7375 } 7376 7377 shape, ok := value.(map[string]interface{}) 7378 if !ok { 7379 return fmt.Errorf("unexpected JSON type %v", value) 7380 } 7381 7382 var sv *GetModelsOutput 7383 if *v == nil { 7384 sv = &GetModelsOutput{} 7385 } else { 7386 sv = *v 7387 } 7388 7389 for key, value := range shape { 7390 switch key { 7391 case "items": 7392 if err := awsRestjson1_deserializeDocument__listOfModel(&sv.Items, value); err != nil { 7393 return err 7394 } 7395 7396 case "nextToken": 7397 if value != nil { 7398 jtv, ok := value.(string) 7399 if !ok { 7400 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7401 } 7402 sv.NextToken = ptr.String(jtv) 7403 } 7404 7405 default: 7406 _, _ = key, value 7407 7408 } 7409 } 7410 *v = sv 7411 return nil 7412} 7413 7414type awsRestjson1_deserializeOpGetModelTemplate struct { 7415} 7416 7417func (*awsRestjson1_deserializeOpGetModelTemplate) ID() string { 7418 return "OperationDeserializer" 7419} 7420 7421func (m *awsRestjson1_deserializeOpGetModelTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7422 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7423) { 7424 out, metadata, err = next.HandleDeserialize(ctx, in) 7425 if err != nil { 7426 return out, metadata, err 7427 } 7428 7429 response, ok := out.RawResponse.(*smithyhttp.Response) 7430 if !ok { 7431 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7432 } 7433 7434 if response.StatusCode < 200 || response.StatusCode >= 300 { 7435 return out, metadata, awsRestjson1_deserializeOpErrorGetModelTemplate(response, &metadata) 7436 } 7437 output := &GetModelTemplateOutput{} 7438 out.Result = output 7439 7440 var buff [1024]byte 7441 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7442 7443 body := io.TeeReader(response.Body, ringBuffer) 7444 7445 decoder := json.NewDecoder(body) 7446 decoder.UseNumber() 7447 var shape interface{} 7448 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7449 var snapshot bytes.Buffer 7450 io.Copy(&snapshot, ringBuffer) 7451 err = &smithy.DeserializationError{ 7452 Err: fmt.Errorf("failed to decode response body, %w", err), 7453 Snapshot: snapshot.Bytes(), 7454 } 7455 return out, metadata, err 7456 } 7457 7458 err = awsRestjson1_deserializeOpDocumentGetModelTemplateOutput(&output, shape) 7459 if err != nil { 7460 var snapshot bytes.Buffer 7461 io.Copy(&snapshot, ringBuffer) 7462 return out, metadata, &smithy.DeserializationError{ 7463 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7464 Snapshot: snapshot.Bytes(), 7465 } 7466 } 7467 7468 return out, metadata, err 7469} 7470 7471func awsRestjson1_deserializeOpErrorGetModelTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7472 var errorBuffer bytes.Buffer 7473 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7474 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7475 } 7476 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7477 7478 errorCode := "UnknownError" 7479 errorMessage := errorCode 7480 7481 code := response.Header.Get("X-Amzn-ErrorType") 7482 if len(code) != 0 { 7483 errorCode = restjson.SanitizeErrorCode(code) 7484 } 7485 7486 var buff [1024]byte 7487 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7488 7489 body := io.TeeReader(errorBody, ringBuffer) 7490 decoder := json.NewDecoder(body) 7491 decoder.UseNumber() 7492 code, message, err := restjson.GetErrorInfo(decoder) 7493 if err != nil { 7494 var snapshot bytes.Buffer 7495 io.Copy(&snapshot, ringBuffer) 7496 err = &smithy.DeserializationError{ 7497 Err: fmt.Errorf("failed to decode response body, %w", err), 7498 Snapshot: snapshot.Bytes(), 7499 } 7500 return err 7501 } 7502 7503 errorBody.Seek(0, io.SeekStart) 7504 if len(code) != 0 { 7505 errorCode = restjson.SanitizeErrorCode(code) 7506 } 7507 if len(message) != 0 { 7508 errorMessage = message 7509 } 7510 7511 switch { 7512 case strings.EqualFold("NotFoundException", errorCode): 7513 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7514 7515 case strings.EqualFold("TooManyRequestsException", errorCode): 7516 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7517 7518 default: 7519 genericError := &smithy.GenericAPIError{ 7520 Code: errorCode, 7521 Message: errorMessage, 7522 } 7523 return genericError 7524 7525 } 7526} 7527 7528func awsRestjson1_deserializeOpDocumentGetModelTemplateOutput(v **GetModelTemplateOutput, value interface{}) error { 7529 if v == nil { 7530 return fmt.Errorf("unexpected nil of type %T", v) 7531 } 7532 if value == nil { 7533 return nil 7534 } 7535 7536 shape, ok := value.(map[string]interface{}) 7537 if !ok { 7538 return fmt.Errorf("unexpected JSON type %v", value) 7539 } 7540 7541 var sv *GetModelTemplateOutput 7542 if *v == nil { 7543 sv = &GetModelTemplateOutput{} 7544 } else { 7545 sv = *v 7546 } 7547 7548 for key, value := range shape { 7549 switch key { 7550 case "value": 7551 if value != nil { 7552 jtv, ok := value.(string) 7553 if !ok { 7554 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 7555 } 7556 sv.Value = ptr.String(jtv) 7557 } 7558 7559 default: 7560 _, _ = key, value 7561 7562 } 7563 } 7564 *v = sv 7565 return nil 7566} 7567 7568type awsRestjson1_deserializeOpGetRoute struct { 7569} 7570 7571func (*awsRestjson1_deserializeOpGetRoute) ID() string { 7572 return "OperationDeserializer" 7573} 7574 7575func (m *awsRestjson1_deserializeOpGetRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7576 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7577) { 7578 out, metadata, err = next.HandleDeserialize(ctx, in) 7579 if err != nil { 7580 return out, metadata, err 7581 } 7582 7583 response, ok := out.RawResponse.(*smithyhttp.Response) 7584 if !ok { 7585 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7586 } 7587 7588 if response.StatusCode < 200 || response.StatusCode >= 300 { 7589 return out, metadata, awsRestjson1_deserializeOpErrorGetRoute(response, &metadata) 7590 } 7591 output := &GetRouteOutput{} 7592 out.Result = output 7593 7594 var buff [1024]byte 7595 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7596 7597 body := io.TeeReader(response.Body, ringBuffer) 7598 7599 decoder := json.NewDecoder(body) 7600 decoder.UseNumber() 7601 var shape interface{} 7602 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7603 var snapshot bytes.Buffer 7604 io.Copy(&snapshot, ringBuffer) 7605 err = &smithy.DeserializationError{ 7606 Err: fmt.Errorf("failed to decode response body, %w", err), 7607 Snapshot: snapshot.Bytes(), 7608 } 7609 return out, metadata, err 7610 } 7611 7612 err = awsRestjson1_deserializeOpDocumentGetRouteOutput(&output, shape) 7613 if err != nil { 7614 var snapshot bytes.Buffer 7615 io.Copy(&snapshot, ringBuffer) 7616 return out, metadata, &smithy.DeserializationError{ 7617 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7618 Snapshot: snapshot.Bytes(), 7619 } 7620 } 7621 7622 return out, metadata, err 7623} 7624 7625func awsRestjson1_deserializeOpErrorGetRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7626 var errorBuffer bytes.Buffer 7627 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7628 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7629 } 7630 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7631 7632 errorCode := "UnknownError" 7633 errorMessage := errorCode 7634 7635 code := response.Header.Get("X-Amzn-ErrorType") 7636 if len(code) != 0 { 7637 errorCode = restjson.SanitizeErrorCode(code) 7638 } 7639 7640 var buff [1024]byte 7641 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7642 7643 body := io.TeeReader(errorBody, ringBuffer) 7644 decoder := json.NewDecoder(body) 7645 decoder.UseNumber() 7646 code, message, err := restjson.GetErrorInfo(decoder) 7647 if err != nil { 7648 var snapshot bytes.Buffer 7649 io.Copy(&snapshot, ringBuffer) 7650 err = &smithy.DeserializationError{ 7651 Err: fmt.Errorf("failed to decode response body, %w", err), 7652 Snapshot: snapshot.Bytes(), 7653 } 7654 return err 7655 } 7656 7657 errorBody.Seek(0, io.SeekStart) 7658 if len(code) != 0 { 7659 errorCode = restjson.SanitizeErrorCode(code) 7660 } 7661 if len(message) != 0 { 7662 errorMessage = message 7663 } 7664 7665 switch { 7666 case strings.EqualFold("NotFoundException", errorCode): 7667 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7668 7669 case strings.EqualFold("TooManyRequestsException", errorCode): 7670 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7671 7672 default: 7673 genericError := &smithy.GenericAPIError{ 7674 Code: errorCode, 7675 Message: errorMessage, 7676 } 7677 return genericError 7678 7679 } 7680} 7681 7682func awsRestjson1_deserializeOpDocumentGetRouteOutput(v **GetRouteOutput, value interface{}) error { 7683 if v == nil { 7684 return fmt.Errorf("unexpected nil of type %T", v) 7685 } 7686 if value == nil { 7687 return nil 7688 } 7689 7690 shape, ok := value.(map[string]interface{}) 7691 if !ok { 7692 return fmt.Errorf("unexpected JSON type %v", value) 7693 } 7694 7695 var sv *GetRouteOutput 7696 if *v == nil { 7697 sv = &GetRouteOutput{} 7698 } else { 7699 sv = *v 7700 } 7701 7702 for key, value := range shape { 7703 switch key { 7704 case "apiGatewayManaged": 7705 if value != nil { 7706 jtv, ok := value.(bool) 7707 if !ok { 7708 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 7709 } 7710 sv.ApiGatewayManaged = jtv 7711 } 7712 7713 case "apiKeyRequired": 7714 if value != nil { 7715 jtv, ok := value.(bool) 7716 if !ok { 7717 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 7718 } 7719 sv.ApiKeyRequired = jtv 7720 } 7721 7722 case "authorizationScopes": 7723 if err := awsRestjson1_deserializeDocumentAuthorizationScopes(&sv.AuthorizationScopes, value); err != nil { 7724 return err 7725 } 7726 7727 case "authorizationType": 7728 if value != nil { 7729 jtv, ok := value.(string) 7730 if !ok { 7731 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 7732 } 7733 sv.AuthorizationType = types.AuthorizationType(jtv) 7734 } 7735 7736 case "authorizerId": 7737 if value != nil { 7738 jtv, ok := value.(string) 7739 if !ok { 7740 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7741 } 7742 sv.AuthorizerId = ptr.String(jtv) 7743 } 7744 7745 case "modelSelectionExpression": 7746 if value != nil { 7747 jtv, ok := value.(string) 7748 if !ok { 7749 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 7750 } 7751 sv.ModelSelectionExpression = ptr.String(jtv) 7752 } 7753 7754 case "operationName": 7755 if value != nil { 7756 jtv, ok := value.(string) 7757 if !ok { 7758 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 7759 } 7760 sv.OperationName = ptr.String(jtv) 7761 } 7762 7763 case "requestModels": 7764 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.RequestModels, value); err != nil { 7765 return err 7766 } 7767 7768 case "requestParameters": 7769 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.RequestParameters, value); err != nil { 7770 return err 7771 } 7772 7773 case "routeId": 7774 if value != nil { 7775 jtv, ok := value.(string) 7776 if !ok { 7777 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7778 } 7779 sv.RouteId = ptr.String(jtv) 7780 } 7781 7782 case "routeKey": 7783 if value != nil { 7784 jtv, ok := value.(string) 7785 if !ok { 7786 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 7787 } 7788 sv.RouteKey = ptr.String(jtv) 7789 } 7790 7791 case "routeResponseSelectionExpression": 7792 if value != nil { 7793 jtv, ok := value.(string) 7794 if !ok { 7795 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 7796 } 7797 sv.RouteResponseSelectionExpression = ptr.String(jtv) 7798 } 7799 7800 case "target": 7801 if value != nil { 7802 jtv, ok := value.(string) 7803 if !ok { 7804 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 7805 } 7806 sv.Target = ptr.String(jtv) 7807 } 7808 7809 default: 7810 _, _ = key, value 7811 7812 } 7813 } 7814 *v = sv 7815 return nil 7816} 7817 7818type awsRestjson1_deserializeOpGetRouteResponse struct { 7819} 7820 7821func (*awsRestjson1_deserializeOpGetRouteResponse) ID() string { 7822 return "OperationDeserializer" 7823} 7824 7825func (m *awsRestjson1_deserializeOpGetRouteResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7826 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7827) { 7828 out, metadata, err = next.HandleDeserialize(ctx, in) 7829 if err != nil { 7830 return out, metadata, err 7831 } 7832 7833 response, ok := out.RawResponse.(*smithyhttp.Response) 7834 if !ok { 7835 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7836 } 7837 7838 if response.StatusCode < 200 || response.StatusCode >= 300 { 7839 return out, metadata, awsRestjson1_deserializeOpErrorGetRouteResponse(response, &metadata) 7840 } 7841 output := &GetRouteResponseOutput{} 7842 out.Result = output 7843 7844 var buff [1024]byte 7845 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7846 7847 body := io.TeeReader(response.Body, ringBuffer) 7848 7849 decoder := json.NewDecoder(body) 7850 decoder.UseNumber() 7851 var shape interface{} 7852 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7853 var snapshot bytes.Buffer 7854 io.Copy(&snapshot, ringBuffer) 7855 err = &smithy.DeserializationError{ 7856 Err: fmt.Errorf("failed to decode response body, %w", err), 7857 Snapshot: snapshot.Bytes(), 7858 } 7859 return out, metadata, err 7860 } 7861 7862 err = awsRestjson1_deserializeOpDocumentGetRouteResponseOutput(&output, shape) 7863 if err != nil { 7864 var snapshot bytes.Buffer 7865 io.Copy(&snapshot, ringBuffer) 7866 return out, metadata, &smithy.DeserializationError{ 7867 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7868 Snapshot: snapshot.Bytes(), 7869 } 7870 } 7871 7872 return out, metadata, err 7873} 7874 7875func awsRestjson1_deserializeOpErrorGetRouteResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7876 var errorBuffer bytes.Buffer 7877 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7878 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7879 } 7880 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7881 7882 errorCode := "UnknownError" 7883 errorMessage := errorCode 7884 7885 code := response.Header.Get("X-Amzn-ErrorType") 7886 if len(code) != 0 { 7887 errorCode = restjson.SanitizeErrorCode(code) 7888 } 7889 7890 var buff [1024]byte 7891 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7892 7893 body := io.TeeReader(errorBody, ringBuffer) 7894 decoder := json.NewDecoder(body) 7895 decoder.UseNumber() 7896 code, message, err := restjson.GetErrorInfo(decoder) 7897 if err != nil { 7898 var snapshot bytes.Buffer 7899 io.Copy(&snapshot, ringBuffer) 7900 err = &smithy.DeserializationError{ 7901 Err: fmt.Errorf("failed to decode response body, %w", err), 7902 Snapshot: snapshot.Bytes(), 7903 } 7904 return err 7905 } 7906 7907 errorBody.Seek(0, io.SeekStart) 7908 if len(code) != 0 { 7909 errorCode = restjson.SanitizeErrorCode(code) 7910 } 7911 if len(message) != 0 { 7912 errorMessage = message 7913 } 7914 7915 switch { 7916 case strings.EqualFold("NotFoundException", errorCode): 7917 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 7918 7919 case strings.EqualFold("TooManyRequestsException", errorCode): 7920 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 7921 7922 default: 7923 genericError := &smithy.GenericAPIError{ 7924 Code: errorCode, 7925 Message: errorMessage, 7926 } 7927 return genericError 7928 7929 } 7930} 7931 7932func awsRestjson1_deserializeOpDocumentGetRouteResponseOutput(v **GetRouteResponseOutput, value interface{}) error { 7933 if v == nil { 7934 return fmt.Errorf("unexpected nil of type %T", v) 7935 } 7936 if value == nil { 7937 return nil 7938 } 7939 7940 shape, ok := value.(map[string]interface{}) 7941 if !ok { 7942 return fmt.Errorf("unexpected JSON type %v", value) 7943 } 7944 7945 var sv *GetRouteResponseOutput 7946 if *v == nil { 7947 sv = &GetRouteResponseOutput{} 7948 } else { 7949 sv = *v 7950 } 7951 7952 for key, value := range shape { 7953 switch key { 7954 case "modelSelectionExpression": 7955 if value != nil { 7956 jtv, ok := value.(string) 7957 if !ok { 7958 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 7959 } 7960 sv.ModelSelectionExpression = ptr.String(jtv) 7961 } 7962 7963 case "responseModels": 7964 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.ResponseModels, value); err != nil { 7965 return err 7966 } 7967 7968 case "responseParameters": 7969 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.ResponseParameters, value); err != nil { 7970 return err 7971 } 7972 7973 case "routeResponseId": 7974 if value != nil { 7975 jtv, ok := value.(string) 7976 if !ok { 7977 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7978 } 7979 sv.RouteResponseId = ptr.String(jtv) 7980 } 7981 7982 case "routeResponseKey": 7983 if value != nil { 7984 jtv, ok := value.(string) 7985 if !ok { 7986 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 7987 } 7988 sv.RouteResponseKey = ptr.String(jtv) 7989 } 7990 7991 default: 7992 _, _ = key, value 7993 7994 } 7995 } 7996 *v = sv 7997 return nil 7998} 7999 8000type awsRestjson1_deserializeOpGetRouteResponses struct { 8001} 8002 8003func (*awsRestjson1_deserializeOpGetRouteResponses) ID() string { 8004 return "OperationDeserializer" 8005} 8006 8007func (m *awsRestjson1_deserializeOpGetRouteResponses) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8008 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8009) { 8010 out, metadata, err = next.HandleDeserialize(ctx, in) 8011 if err != nil { 8012 return out, metadata, err 8013 } 8014 8015 response, ok := out.RawResponse.(*smithyhttp.Response) 8016 if !ok { 8017 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8018 } 8019 8020 if response.StatusCode < 200 || response.StatusCode >= 300 { 8021 return out, metadata, awsRestjson1_deserializeOpErrorGetRouteResponses(response, &metadata) 8022 } 8023 output := &GetRouteResponsesOutput{} 8024 out.Result = output 8025 8026 var buff [1024]byte 8027 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8028 8029 body := io.TeeReader(response.Body, ringBuffer) 8030 8031 decoder := json.NewDecoder(body) 8032 decoder.UseNumber() 8033 var shape interface{} 8034 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8035 var snapshot bytes.Buffer 8036 io.Copy(&snapshot, ringBuffer) 8037 err = &smithy.DeserializationError{ 8038 Err: fmt.Errorf("failed to decode response body, %w", err), 8039 Snapshot: snapshot.Bytes(), 8040 } 8041 return out, metadata, err 8042 } 8043 8044 err = awsRestjson1_deserializeOpDocumentGetRouteResponsesOutput(&output, shape) 8045 if err != nil { 8046 var snapshot bytes.Buffer 8047 io.Copy(&snapshot, ringBuffer) 8048 return out, metadata, &smithy.DeserializationError{ 8049 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8050 Snapshot: snapshot.Bytes(), 8051 } 8052 } 8053 8054 return out, metadata, err 8055} 8056 8057func awsRestjson1_deserializeOpErrorGetRouteResponses(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8058 var errorBuffer bytes.Buffer 8059 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8060 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8061 } 8062 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8063 8064 errorCode := "UnknownError" 8065 errorMessage := errorCode 8066 8067 code := response.Header.Get("X-Amzn-ErrorType") 8068 if len(code) != 0 { 8069 errorCode = restjson.SanitizeErrorCode(code) 8070 } 8071 8072 var buff [1024]byte 8073 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8074 8075 body := io.TeeReader(errorBody, ringBuffer) 8076 decoder := json.NewDecoder(body) 8077 decoder.UseNumber() 8078 code, message, err := restjson.GetErrorInfo(decoder) 8079 if err != nil { 8080 var snapshot bytes.Buffer 8081 io.Copy(&snapshot, ringBuffer) 8082 err = &smithy.DeserializationError{ 8083 Err: fmt.Errorf("failed to decode response body, %w", err), 8084 Snapshot: snapshot.Bytes(), 8085 } 8086 return err 8087 } 8088 8089 errorBody.Seek(0, io.SeekStart) 8090 if len(code) != 0 { 8091 errorCode = restjson.SanitizeErrorCode(code) 8092 } 8093 if len(message) != 0 { 8094 errorMessage = message 8095 } 8096 8097 switch { 8098 case strings.EqualFold("BadRequestException", errorCode): 8099 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 8100 8101 case strings.EqualFold("NotFoundException", errorCode): 8102 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8103 8104 case strings.EqualFold("TooManyRequestsException", errorCode): 8105 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8106 8107 default: 8108 genericError := &smithy.GenericAPIError{ 8109 Code: errorCode, 8110 Message: errorMessage, 8111 } 8112 return genericError 8113 8114 } 8115} 8116 8117func awsRestjson1_deserializeOpDocumentGetRouteResponsesOutput(v **GetRouteResponsesOutput, value interface{}) error { 8118 if v == nil { 8119 return fmt.Errorf("unexpected nil of type %T", v) 8120 } 8121 if value == nil { 8122 return nil 8123 } 8124 8125 shape, ok := value.(map[string]interface{}) 8126 if !ok { 8127 return fmt.Errorf("unexpected JSON type %v", value) 8128 } 8129 8130 var sv *GetRouteResponsesOutput 8131 if *v == nil { 8132 sv = &GetRouteResponsesOutput{} 8133 } else { 8134 sv = *v 8135 } 8136 8137 for key, value := range shape { 8138 switch key { 8139 case "items": 8140 if err := awsRestjson1_deserializeDocument__listOfRouteResponse(&sv.Items, value); err != nil { 8141 return err 8142 } 8143 8144 case "nextToken": 8145 if value != nil { 8146 jtv, ok := value.(string) 8147 if !ok { 8148 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8149 } 8150 sv.NextToken = ptr.String(jtv) 8151 } 8152 8153 default: 8154 _, _ = key, value 8155 8156 } 8157 } 8158 *v = sv 8159 return nil 8160} 8161 8162type awsRestjson1_deserializeOpGetRoutes struct { 8163} 8164 8165func (*awsRestjson1_deserializeOpGetRoutes) ID() string { 8166 return "OperationDeserializer" 8167} 8168 8169func (m *awsRestjson1_deserializeOpGetRoutes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8170 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8171) { 8172 out, metadata, err = next.HandleDeserialize(ctx, in) 8173 if err != nil { 8174 return out, metadata, err 8175 } 8176 8177 response, ok := out.RawResponse.(*smithyhttp.Response) 8178 if !ok { 8179 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8180 } 8181 8182 if response.StatusCode < 200 || response.StatusCode >= 300 { 8183 return out, metadata, awsRestjson1_deserializeOpErrorGetRoutes(response, &metadata) 8184 } 8185 output := &GetRoutesOutput{} 8186 out.Result = output 8187 8188 var buff [1024]byte 8189 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8190 8191 body := io.TeeReader(response.Body, ringBuffer) 8192 8193 decoder := json.NewDecoder(body) 8194 decoder.UseNumber() 8195 var shape interface{} 8196 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8197 var snapshot bytes.Buffer 8198 io.Copy(&snapshot, ringBuffer) 8199 err = &smithy.DeserializationError{ 8200 Err: fmt.Errorf("failed to decode response body, %w", err), 8201 Snapshot: snapshot.Bytes(), 8202 } 8203 return out, metadata, err 8204 } 8205 8206 err = awsRestjson1_deserializeOpDocumentGetRoutesOutput(&output, shape) 8207 if err != nil { 8208 var snapshot bytes.Buffer 8209 io.Copy(&snapshot, ringBuffer) 8210 return out, metadata, &smithy.DeserializationError{ 8211 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8212 Snapshot: snapshot.Bytes(), 8213 } 8214 } 8215 8216 return out, metadata, err 8217} 8218 8219func awsRestjson1_deserializeOpErrorGetRoutes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8220 var errorBuffer bytes.Buffer 8221 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8222 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8223 } 8224 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8225 8226 errorCode := "UnknownError" 8227 errorMessage := errorCode 8228 8229 code := response.Header.Get("X-Amzn-ErrorType") 8230 if len(code) != 0 { 8231 errorCode = restjson.SanitizeErrorCode(code) 8232 } 8233 8234 var buff [1024]byte 8235 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8236 8237 body := io.TeeReader(errorBody, ringBuffer) 8238 decoder := json.NewDecoder(body) 8239 decoder.UseNumber() 8240 code, message, err := restjson.GetErrorInfo(decoder) 8241 if err != nil { 8242 var snapshot bytes.Buffer 8243 io.Copy(&snapshot, ringBuffer) 8244 err = &smithy.DeserializationError{ 8245 Err: fmt.Errorf("failed to decode response body, %w", err), 8246 Snapshot: snapshot.Bytes(), 8247 } 8248 return err 8249 } 8250 8251 errorBody.Seek(0, io.SeekStart) 8252 if len(code) != 0 { 8253 errorCode = restjson.SanitizeErrorCode(code) 8254 } 8255 if len(message) != 0 { 8256 errorMessage = message 8257 } 8258 8259 switch { 8260 case strings.EqualFold("BadRequestException", errorCode): 8261 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 8262 8263 case strings.EqualFold("NotFoundException", errorCode): 8264 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8265 8266 case strings.EqualFold("TooManyRequestsException", errorCode): 8267 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8268 8269 default: 8270 genericError := &smithy.GenericAPIError{ 8271 Code: errorCode, 8272 Message: errorMessage, 8273 } 8274 return genericError 8275 8276 } 8277} 8278 8279func awsRestjson1_deserializeOpDocumentGetRoutesOutput(v **GetRoutesOutput, value interface{}) error { 8280 if v == nil { 8281 return fmt.Errorf("unexpected nil of type %T", v) 8282 } 8283 if value == nil { 8284 return nil 8285 } 8286 8287 shape, ok := value.(map[string]interface{}) 8288 if !ok { 8289 return fmt.Errorf("unexpected JSON type %v", value) 8290 } 8291 8292 var sv *GetRoutesOutput 8293 if *v == nil { 8294 sv = &GetRoutesOutput{} 8295 } else { 8296 sv = *v 8297 } 8298 8299 for key, value := range shape { 8300 switch key { 8301 case "items": 8302 if err := awsRestjson1_deserializeDocument__listOfRoute(&sv.Items, value); err != nil { 8303 return err 8304 } 8305 8306 case "nextToken": 8307 if value != nil { 8308 jtv, ok := value.(string) 8309 if !ok { 8310 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8311 } 8312 sv.NextToken = ptr.String(jtv) 8313 } 8314 8315 default: 8316 _, _ = key, value 8317 8318 } 8319 } 8320 *v = sv 8321 return nil 8322} 8323 8324type awsRestjson1_deserializeOpGetStage struct { 8325} 8326 8327func (*awsRestjson1_deserializeOpGetStage) ID() string { 8328 return "OperationDeserializer" 8329} 8330 8331func (m *awsRestjson1_deserializeOpGetStage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8332 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8333) { 8334 out, metadata, err = next.HandleDeserialize(ctx, in) 8335 if err != nil { 8336 return out, metadata, err 8337 } 8338 8339 response, ok := out.RawResponse.(*smithyhttp.Response) 8340 if !ok { 8341 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8342 } 8343 8344 if response.StatusCode < 200 || response.StatusCode >= 300 { 8345 return out, metadata, awsRestjson1_deserializeOpErrorGetStage(response, &metadata) 8346 } 8347 output := &GetStageOutput{} 8348 out.Result = output 8349 8350 var buff [1024]byte 8351 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8352 8353 body := io.TeeReader(response.Body, ringBuffer) 8354 8355 decoder := json.NewDecoder(body) 8356 decoder.UseNumber() 8357 var shape interface{} 8358 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8359 var snapshot bytes.Buffer 8360 io.Copy(&snapshot, ringBuffer) 8361 err = &smithy.DeserializationError{ 8362 Err: fmt.Errorf("failed to decode response body, %w", err), 8363 Snapshot: snapshot.Bytes(), 8364 } 8365 return out, metadata, err 8366 } 8367 8368 err = awsRestjson1_deserializeOpDocumentGetStageOutput(&output, shape) 8369 if err != nil { 8370 var snapshot bytes.Buffer 8371 io.Copy(&snapshot, ringBuffer) 8372 return out, metadata, &smithy.DeserializationError{ 8373 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8374 Snapshot: snapshot.Bytes(), 8375 } 8376 } 8377 8378 return out, metadata, err 8379} 8380 8381func awsRestjson1_deserializeOpErrorGetStage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8382 var errorBuffer bytes.Buffer 8383 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8384 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8385 } 8386 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8387 8388 errorCode := "UnknownError" 8389 errorMessage := errorCode 8390 8391 code := response.Header.Get("X-Amzn-ErrorType") 8392 if len(code) != 0 { 8393 errorCode = restjson.SanitizeErrorCode(code) 8394 } 8395 8396 var buff [1024]byte 8397 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8398 8399 body := io.TeeReader(errorBody, ringBuffer) 8400 decoder := json.NewDecoder(body) 8401 decoder.UseNumber() 8402 code, message, err := restjson.GetErrorInfo(decoder) 8403 if err != nil { 8404 var snapshot bytes.Buffer 8405 io.Copy(&snapshot, ringBuffer) 8406 err = &smithy.DeserializationError{ 8407 Err: fmt.Errorf("failed to decode response body, %w", err), 8408 Snapshot: snapshot.Bytes(), 8409 } 8410 return err 8411 } 8412 8413 errorBody.Seek(0, io.SeekStart) 8414 if len(code) != 0 { 8415 errorCode = restjson.SanitizeErrorCode(code) 8416 } 8417 if len(message) != 0 { 8418 errorMessage = message 8419 } 8420 8421 switch { 8422 case strings.EqualFold("NotFoundException", errorCode): 8423 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8424 8425 case strings.EqualFold("TooManyRequestsException", errorCode): 8426 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8427 8428 default: 8429 genericError := &smithy.GenericAPIError{ 8430 Code: errorCode, 8431 Message: errorMessage, 8432 } 8433 return genericError 8434 8435 } 8436} 8437 8438func awsRestjson1_deserializeOpDocumentGetStageOutput(v **GetStageOutput, value interface{}) error { 8439 if v == nil { 8440 return fmt.Errorf("unexpected nil of type %T", v) 8441 } 8442 if value == nil { 8443 return nil 8444 } 8445 8446 shape, ok := value.(map[string]interface{}) 8447 if !ok { 8448 return fmt.Errorf("unexpected JSON type %v", value) 8449 } 8450 8451 var sv *GetStageOutput 8452 if *v == nil { 8453 sv = &GetStageOutput{} 8454 } else { 8455 sv = *v 8456 } 8457 8458 for key, value := range shape { 8459 switch key { 8460 case "accessLogSettings": 8461 if err := awsRestjson1_deserializeDocumentAccessLogSettings(&sv.AccessLogSettings, value); err != nil { 8462 return err 8463 } 8464 8465 case "apiGatewayManaged": 8466 if value != nil { 8467 jtv, ok := value.(bool) 8468 if !ok { 8469 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 8470 } 8471 sv.ApiGatewayManaged = jtv 8472 } 8473 8474 case "autoDeploy": 8475 if value != nil { 8476 jtv, ok := value.(bool) 8477 if !ok { 8478 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 8479 } 8480 sv.AutoDeploy = jtv 8481 } 8482 8483 case "clientCertificateId": 8484 if value != nil { 8485 jtv, ok := value.(string) 8486 if !ok { 8487 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8488 } 8489 sv.ClientCertificateId = ptr.String(jtv) 8490 } 8491 8492 case "createdDate": 8493 if value != nil { 8494 jtv, ok := value.(string) 8495 if !ok { 8496 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 8497 } 8498 t, err := smithytime.ParseDateTime(jtv) 8499 if err != nil { 8500 return err 8501 } 8502 sv.CreatedDate = ptr.Time(t) 8503 } 8504 8505 case "defaultRouteSettings": 8506 if err := awsRestjson1_deserializeDocumentRouteSettings(&sv.DefaultRouteSettings, value); err != nil { 8507 return err 8508 } 8509 8510 case "deploymentId": 8511 if value != nil { 8512 jtv, ok := value.(string) 8513 if !ok { 8514 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8515 } 8516 sv.DeploymentId = ptr.String(jtv) 8517 } 8518 8519 case "description": 8520 if value != nil { 8521 jtv, ok := value.(string) 8522 if !ok { 8523 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 8524 } 8525 sv.Description = ptr.String(jtv) 8526 } 8527 8528 case "lastDeploymentStatusMessage": 8529 if value != nil { 8530 jtv, ok := value.(string) 8531 if !ok { 8532 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 8533 } 8534 sv.LastDeploymentStatusMessage = ptr.String(jtv) 8535 } 8536 8537 case "lastUpdatedDate": 8538 if value != nil { 8539 jtv, ok := value.(string) 8540 if !ok { 8541 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 8542 } 8543 t, err := smithytime.ParseDateTime(jtv) 8544 if err != nil { 8545 return err 8546 } 8547 sv.LastUpdatedDate = ptr.Time(t) 8548 } 8549 8550 case "routeSettings": 8551 if err := awsRestjson1_deserializeDocumentRouteSettingsMap(&sv.RouteSettings, value); err != nil { 8552 return err 8553 } 8554 8555 case "stageName": 8556 if value != nil { 8557 jtv, ok := value.(string) 8558 if !ok { 8559 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 8560 } 8561 sv.StageName = ptr.String(jtv) 8562 } 8563 8564 case "stageVariables": 8565 if err := awsRestjson1_deserializeDocumentStageVariablesMap(&sv.StageVariables, value); err != nil { 8566 return err 8567 } 8568 8569 case "tags": 8570 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 8571 return err 8572 } 8573 8574 default: 8575 _, _ = key, value 8576 8577 } 8578 } 8579 *v = sv 8580 return nil 8581} 8582 8583type awsRestjson1_deserializeOpGetStages struct { 8584} 8585 8586func (*awsRestjson1_deserializeOpGetStages) ID() string { 8587 return "OperationDeserializer" 8588} 8589 8590func (m *awsRestjson1_deserializeOpGetStages) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8591 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8592) { 8593 out, metadata, err = next.HandleDeserialize(ctx, in) 8594 if err != nil { 8595 return out, metadata, err 8596 } 8597 8598 response, ok := out.RawResponse.(*smithyhttp.Response) 8599 if !ok { 8600 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8601 } 8602 8603 if response.StatusCode < 200 || response.StatusCode >= 300 { 8604 return out, metadata, awsRestjson1_deserializeOpErrorGetStages(response, &metadata) 8605 } 8606 output := &GetStagesOutput{} 8607 out.Result = output 8608 8609 var buff [1024]byte 8610 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8611 8612 body := io.TeeReader(response.Body, ringBuffer) 8613 8614 decoder := json.NewDecoder(body) 8615 decoder.UseNumber() 8616 var shape interface{} 8617 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8618 var snapshot bytes.Buffer 8619 io.Copy(&snapshot, ringBuffer) 8620 err = &smithy.DeserializationError{ 8621 Err: fmt.Errorf("failed to decode response body, %w", err), 8622 Snapshot: snapshot.Bytes(), 8623 } 8624 return out, metadata, err 8625 } 8626 8627 err = awsRestjson1_deserializeOpDocumentGetStagesOutput(&output, shape) 8628 if err != nil { 8629 var snapshot bytes.Buffer 8630 io.Copy(&snapshot, ringBuffer) 8631 return out, metadata, &smithy.DeserializationError{ 8632 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8633 Snapshot: snapshot.Bytes(), 8634 } 8635 } 8636 8637 return out, metadata, err 8638} 8639 8640func awsRestjson1_deserializeOpErrorGetStages(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8641 var errorBuffer bytes.Buffer 8642 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8643 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8644 } 8645 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8646 8647 errorCode := "UnknownError" 8648 errorMessage := errorCode 8649 8650 code := response.Header.Get("X-Amzn-ErrorType") 8651 if len(code) != 0 { 8652 errorCode = restjson.SanitizeErrorCode(code) 8653 } 8654 8655 var buff [1024]byte 8656 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8657 8658 body := io.TeeReader(errorBody, ringBuffer) 8659 decoder := json.NewDecoder(body) 8660 decoder.UseNumber() 8661 code, message, err := restjson.GetErrorInfo(decoder) 8662 if err != nil { 8663 var snapshot bytes.Buffer 8664 io.Copy(&snapshot, ringBuffer) 8665 err = &smithy.DeserializationError{ 8666 Err: fmt.Errorf("failed to decode response body, %w", err), 8667 Snapshot: snapshot.Bytes(), 8668 } 8669 return err 8670 } 8671 8672 errorBody.Seek(0, io.SeekStart) 8673 if len(code) != 0 { 8674 errorCode = restjson.SanitizeErrorCode(code) 8675 } 8676 if len(message) != 0 { 8677 errorMessage = message 8678 } 8679 8680 switch { 8681 case strings.EqualFold("BadRequestException", errorCode): 8682 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 8683 8684 case strings.EqualFold("NotFoundException", errorCode): 8685 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8686 8687 case strings.EqualFold("TooManyRequestsException", errorCode): 8688 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8689 8690 default: 8691 genericError := &smithy.GenericAPIError{ 8692 Code: errorCode, 8693 Message: errorMessage, 8694 } 8695 return genericError 8696 8697 } 8698} 8699 8700func awsRestjson1_deserializeOpDocumentGetStagesOutput(v **GetStagesOutput, value interface{}) error { 8701 if v == nil { 8702 return fmt.Errorf("unexpected nil of type %T", v) 8703 } 8704 if value == nil { 8705 return nil 8706 } 8707 8708 shape, ok := value.(map[string]interface{}) 8709 if !ok { 8710 return fmt.Errorf("unexpected JSON type %v", value) 8711 } 8712 8713 var sv *GetStagesOutput 8714 if *v == nil { 8715 sv = &GetStagesOutput{} 8716 } else { 8717 sv = *v 8718 } 8719 8720 for key, value := range shape { 8721 switch key { 8722 case "items": 8723 if err := awsRestjson1_deserializeDocument__listOfStage(&sv.Items, value); err != nil { 8724 return err 8725 } 8726 8727 case "nextToken": 8728 if value != nil { 8729 jtv, ok := value.(string) 8730 if !ok { 8731 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8732 } 8733 sv.NextToken = ptr.String(jtv) 8734 } 8735 8736 default: 8737 _, _ = key, value 8738 8739 } 8740 } 8741 *v = sv 8742 return nil 8743} 8744 8745type awsRestjson1_deserializeOpGetTags struct { 8746} 8747 8748func (*awsRestjson1_deserializeOpGetTags) ID() string { 8749 return "OperationDeserializer" 8750} 8751 8752func (m *awsRestjson1_deserializeOpGetTags) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8753 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8754) { 8755 out, metadata, err = next.HandleDeserialize(ctx, in) 8756 if err != nil { 8757 return out, metadata, err 8758 } 8759 8760 response, ok := out.RawResponse.(*smithyhttp.Response) 8761 if !ok { 8762 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8763 } 8764 8765 if response.StatusCode < 200 || response.StatusCode >= 300 { 8766 return out, metadata, awsRestjson1_deserializeOpErrorGetTags(response, &metadata) 8767 } 8768 output := &GetTagsOutput{} 8769 out.Result = output 8770 8771 var buff [1024]byte 8772 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8773 8774 body := io.TeeReader(response.Body, ringBuffer) 8775 8776 decoder := json.NewDecoder(body) 8777 decoder.UseNumber() 8778 var shape interface{} 8779 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8780 var snapshot bytes.Buffer 8781 io.Copy(&snapshot, ringBuffer) 8782 err = &smithy.DeserializationError{ 8783 Err: fmt.Errorf("failed to decode response body, %w", err), 8784 Snapshot: snapshot.Bytes(), 8785 } 8786 return out, metadata, err 8787 } 8788 8789 err = awsRestjson1_deserializeOpDocumentGetTagsOutput(&output, shape) 8790 if err != nil { 8791 var snapshot bytes.Buffer 8792 io.Copy(&snapshot, ringBuffer) 8793 return out, metadata, &smithy.DeserializationError{ 8794 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8795 Snapshot: snapshot.Bytes(), 8796 } 8797 } 8798 8799 return out, metadata, err 8800} 8801 8802func awsRestjson1_deserializeOpErrorGetTags(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8803 var errorBuffer bytes.Buffer 8804 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8805 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8806 } 8807 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8808 8809 errorCode := "UnknownError" 8810 errorMessage := errorCode 8811 8812 code := response.Header.Get("X-Amzn-ErrorType") 8813 if len(code) != 0 { 8814 errorCode = restjson.SanitizeErrorCode(code) 8815 } 8816 8817 var buff [1024]byte 8818 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8819 8820 body := io.TeeReader(errorBody, ringBuffer) 8821 decoder := json.NewDecoder(body) 8822 decoder.UseNumber() 8823 code, message, err := restjson.GetErrorInfo(decoder) 8824 if err != nil { 8825 var snapshot bytes.Buffer 8826 io.Copy(&snapshot, ringBuffer) 8827 err = &smithy.DeserializationError{ 8828 Err: fmt.Errorf("failed to decode response body, %w", err), 8829 Snapshot: snapshot.Bytes(), 8830 } 8831 return err 8832 } 8833 8834 errorBody.Seek(0, io.SeekStart) 8835 if len(code) != 0 { 8836 errorCode = restjson.SanitizeErrorCode(code) 8837 } 8838 if len(message) != 0 { 8839 errorMessage = message 8840 } 8841 8842 switch { 8843 case strings.EqualFold("BadRequestException", errorCode): 8844 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 8845 8846 case strings.EqualFold("ConflictException", errorCode): 8847 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 8848 8849 case strings.EqualFold("NotFoundException", errorCode): 8850 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 8851 8852 case strings.EqualFold("TooManyRequestsException", errorCode): 8853 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 8854 8855 default: 8856 genericError := &smithy.GenericAPIError{ 8857 Code: errorCode, 8858 Message: errorMessage, 8859 } 8860 return genericError 8861 8862 } 8863} 8864 8865func awsRestjson1_deserializeOpDocumentGetTagsOutput(v **GetTagsOutput, value interface{}) error { 8866 if v == nil { 8867 return fmt.Errorf("unexpected nil of type %T", v) 8868 } 8869 if value == nil { 8870 return nil 8871 } 8872 8873 shape, ok := value.(map[string]interface{}) 8874 if !ok { 8875 return fmt.Errorf("unexpected JSON type %v", value) 8876 } 8877 8878 var sv *GetTagsOutput 8879 if *v == nil { 8880 sv = &GetTagsOutput{} 8881 } else { 8882 sv = *v 8883 } 8884 8885 for key, value := range shape { 8886 switch key { 8887 case "tags": 8888 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 8889 return err 8890 } 8891 8892 default: 8893 _, _ = key, value 8894 8895 } 8896 } 8897 *v = sv 8898 return nil 8899} 8900 8901type awsRestjson1_deserializeOpGetVpcLink struct { 8902} 8903 8904func (*awsRestjson1_deserializeOpGetVpcLink) ID() string { 8905 return "OperationDeserializer" 8906} 8907 8908func (m *awsRestjson1_deserializeOpGetVpcLink) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8909 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8910) { 8911 out, metadata, err = next.HandleDeserialize(ctx, in) 8912 if err != nil { 8913 return out, metadata, err 8914 } 8915 8916 response, ok := out.RawResponse.(*smithyhttp.Response) 8917 if !ok { 8918 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8919 } 8920 8921 if response.StatusCode < 200 || response.StatusCode >= 300 { 8922 return out, metadata, awsRestjson1_deserializeOpErrorGetVpcLink(response, &metadata) 8923 } 8924 output := &GetVpcLinkOutput{} 8925 out.Result = output 8926 8927 var buff [1024]byte 8928 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8929 8930 body := io.TeeReader(response.Body, ringBuffer) 8931 8932 decoder := json.NewDecoder(body) 8933 decoder.UseNumber() 8934 var shape interface{} 8935 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8936 var snapshot bytes.Buffer 8937 io.Copy(&snapshot, ringBuffer) 8938 err = &smithy.DeserializationError{ 8939 Err: fmt.Errorf("failed to decode response body, %w", err), 8940 Snapshot: snapshot.Bytes(), 8941 } 8942 return out, metadata, err 8943 } 8944 8945 err = awsRestjson1_deserializeOpDocumentGetVpcLinkOutput(&output, shape) 8946 if err != nil { 8947 var snapshot bytes.Buffer 8948 io.Copy(&snapshot, ringBuffer) 8949 return out, metadata, &smithy.DeserializationError{ 8950 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8951 Snapshot: snapshot.Bytes(), 8952 } 8953 } 8954 8955 return out, metadata, err 8956} 8957 8958func awsRestjson1_deserializeOpErrorGetVpcLink(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8959 var errorBuffer bytes.Buffer 8960 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8961 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8962 } 8963 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8964 8965 errorCode := "UnknownError" 8966 errorMessage := errorCode 8967 8968 code := response.Header.Get("X-Amzn-ErrorType") 8969 if len(code) != 0 { 8970 errorCode = restjson.SanitizeErrorCode(code) 8971 } 8972 8973 var buff [1024]byte 8974 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8975 8976 body := io.TeeReader(errorBody, ringBuffer) 8977 decoder := json.NewDecoder(body) 8978 decoder.UseNumber() 8979 code, message, err := restjson.GetErrorInfo(decoder) 8980 if err != nil { 8981 var snapshot bytes.Buffer 8982 io.Copy(&snapshot, ringBuffer) 8983 err = &smithy.DeserializationError{ 8984 Err: fmt.Errorf("failed to decode response body, %w", err), 8985 Snapshot: snapshot.Bytes(), 8986 } 8987 return err 8988 } 8989 8990 errorBody.Seek(0, io.SeekStart) 8991 if len(code) != 0 { 8992 errorCode = restjson.SanitizeErrorCode(code) 8993 } 8994 if len(message) != 0 { 8995 errorMessage = message 8996 } 8997 8998 switch { 8999 case strings.EqualFold("NotFoundException", errorCode): 9000 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 9001 9002 case strings.EqualFold("TooManyRequestsException", errorCode): 9003 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9004 9005 default: 9006 genericError := &smithy.GenericAPIError{ 9007 Code: errorCode, 9008 Message: errorMessage, 9009 } 9010 return genericError 9011 9012 } 9013} 9014 9015func awsRestjson1_deserializeOpDocumentGetVpcLinkOutput(v **GetVpcLinkOutput, value interface{}) error { 9016 if v == nil { 9017 return fmt.Errorf("unexpected nil of type %T", v) 9018 } 9019 if value == nil { 9020 return nil 9021 } 9022 9023 shape, ok := value.(map[string]interface{}) 9024 if !ok { 9025 return fmt.Errorf("unexpected JSON type %v", value) 9026 } 9027 9028 var sv *GetVpcLinkOutput 9029 if *v == nil { 9030 sv = &GetVpcLinkOutput{} 9031 } else { 9032 sv = *v 9033 } 9034 9035 for key, value := range shape { 9036 switch key { 9037 case "createdDate": 9038 if value != nil { 9039 jtv, ok := value.(string) 9040 if !ok { 9041 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 9042 } 9043 t, err := smithytime.ParseDateTime(jtv) 9044 if err != nil { 9045 return err 9046 } 9047 sv.CreatedDate = ptr.Time(t) 9048 } 9049 9050 case "name": 9051 if value != nil { 9052 jtv, ok := value.(string) 9053 if !ok { 9054 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 9055 } 9056 sv.Name = ptr.String(jtv) 9057 } 9058 9059 case "securityGroupIds": 9060 if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { 9061 return err 9062 } 9063 9064 case "subnetIds": 9065 if err := awsRestjson1_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil { 9066 return err 9067 } 9068 9069 case "tags": 9070 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 9071 return err 9072 } 9073 9074 case "vpcLinkId": 9075 if value != nil { 9076 jtv, ok := value.(string) 9077 if !ok { 9078 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9079 } 9080 sv.VpcLinkId = ptr.String(jtv) 9081 } 9082 9083 case "vpcLinkStatus": 9084 if value != nil { 9085 jtv, ok := value.(string) 9086 if !ok { 9087 return fmt.Errorf("expected VpcLinkStatus to be of type string, got %T instead", value) 9088 } 9089 sv.VpcLinkStatus = types.VpcLinkStatus(jtv) 9090 } 9091 9092 case "vpcLinkStatusMessage": 9093 if value != nil { 9094 jtv, ok := value.(string) 9095 if !ok { 9096 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 9097 } 9098 sv.VpcLinkStatusMessage = ptr.String(jtv) 9099 } 9100 9101 case "vpcLinkVersion": 9102 if value != nil { 9103 jtv, ok := value.(string) 9104 if !ok { 9105 return fmt.Errorf("expected VpcLinkVersion to be of type string, got %T instead", value) 9106 } 9107 sv.VpcLinkVersion = types.VpcLinkVersion(jtv) 9108 } 9109 9110 default: 9111 _, _ = key, value 9112 9113 } 9114 } 9115 *v = sv 9116 return nil 9117} 9118 9119type awsRestjson1_deserializeOpGetVpcLinks struct { 9120} 9121 9122func (*awsRestjson1_deserializeOpGetVpcLinks) ID() string { 9123 return "OperationDeserializer" 9124} 9125 9126func (m *awsRestjson1_deserializeOpGetVpcLinks) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9127 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9128) { 9129 out, metadata, err = next.HandleDeserialize(ctx, in) 9130 if err != nil { 9131 return out, metadata, err 9132 } 9133 9134 response, ok := out.RawResponse.(*smithyhttp.Response) 9135 if !ok { 9136 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9137 } 9138 9139 if response.StatusCode < 200 || response.StatusCode >= 300 { 9140 return out, metadata, awsRestjson1_deserializeOpErrorGetVpcLinks(response, &metadata) 9141 } 9142 output := &GetVpcLinksOutput{} 9143 out.Result = output 9144 9145 var buff [1024]byte 9146 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9147 9148 body := io.TeeReader(response.Body, ringBuffer) 9149 9150 decoder := json.NewDecoder(body) 9151 decoder.UseNumber() 9152 var shape interface{} 9153 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9154 var snapshot bytes.Buffer 9155 io.Copy(&snapshot, ringBuffer) 9156 err = &smithy.DeserializationError{ 9157 Err: fmt.Errorf("failed to decode response body, %w", err), 9158 Snapshot: snapshot.Bytes(), 9159 } 9160 return out, metadata, err 9161 } 9162 9163 err = awsRestjson1_deserializeOpDocumentGetVpcLinksOutput(&output, shape) 9164 if err != nil { 9165 var snapshot bytes.Buffer 9166 io.Copy(&snapshot, ringBuffer) 9167 return out, metadata, &smithy.DeserializationError{ 9168 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9169 Snapshot: snapshot.Bytes(), 9170 } 9171 } 9172 9173 return out, metadata, err 9174} 9175 9176func awsRestjson1_deserializeOpErrorGetVpcLinks(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9177 var errorBuffer bytes.Buffer 9178 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9179 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9180 } 9181 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9182 9183 errorCode := "UnknownError" 9184 errorMessage := errorCode 9185 9186 code := response.Header.Get("X-Amzn-ErrorType") 9187 if len(code) != 0 { 9188 errorCode = restjson.SanitizeErrorCode(code) 9189 } 9190 9191 var buff [1024]byte 9192 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9193 9194 body := io.TeeReader(errorBody, ringBuffer) 9195 decoder := json.NewDecoder(body) 9196 decoder.UseNumber() 9197 code, message, err := restjson.GetErrorInfo(decoder) 9198 if err != nil { 9199 var snapshot bytes.Buffer 9200 io.Copy(&snapshot, ringBuffer) 9201 err = &smithy.DeserializationError{ 9202 Err: fmt.Errorf("failed to decode response body, %w", err), 9203 Snapshot: snapshot.Bytes(), 9204 } 9205 return err 9206 } 9207 9208 errorBody.Seek(0, io.SeekStart) 9209 if len(code) != 0 { 9210 errorCode = restjson.SanitizeErrorCode(code) 9211 } 9212 if len(message) != 0 { 9213 errorMessage = message 9214 } 9215 9216 switch { 9217 case strings.EqualFold("BadRequestException", errorCode): 9218 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 9219 9220 case strings.EqualFold("TooManyRequestsException", errorCode): 9221 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9222 9223 default: 9224 genericError := &smithy.GenericAPIError{ 9225 Code: errorCode, 9226 Message: errorMessage, 9227 } 9228 return genericError 9229 9230 } 9231} 9232 9233func awsRestjson1_deserializeOpDocumentGetVpcLinksOutput(v **GetVpcLinksOutput, value interface{}) error { 9234 if v == nil { 9235 return fmt.Errorf("unexpected nil of type %T", v) 9236 } 9237 if value == nil { 9238 return nil 9239 } 9240 9241 shape, ok := value.(map[string]interface{}) 9242 if !ok { 9243 return fmt.Errorf("unexpected JSON type %v", value) 9244 } 9245 9246 var sv *GetVpcLinksOutput 9247 if *v == nil { 9248 sv = &GetVpcLinksOutput{} 9249 } else { 9250 sv = *v 9251 } 9252 9253 for key, value := range shape { 9254 switch key { 9255 case "items": 9256 if err := awsRestjson1_deserializeDocument__listOfVpcLink(&sv.Items, value); err != nil { 9257 return err 9258 } 9259 9260 case "nextToken": 9261 if value != nil { 9262 jtv, ok := value.(string) 9263 if !ok { 9264 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 9265 } 9266 sv.NextToken = ptr.String(jtv) 9267 } 9268 9269 default: 9270 _, _ = key, value 9271 9272 } 9273 } 9274 *v = sv 9275 return nil 9276} 9277 9278type awsRestjson1_deserializeOpImportApi struct { 9279} 9280 9281func (*awsRestjson1_deserializeOpImportApi) ID() string { 9282 return "OperationDeserializer" 9283} 9284 9285func (m *awsRestjson1_deserializeOpImportApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9286 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9287) { 9288 out, metadata, err = next.HandleDeserialize(ctx, in) 9289 if err != nil { 9290 return out, metadata, err 9291 } 9292 9293 response, ok := out.RawResponse.(*smithyhttp.Response) 9294 if !ok { 9295 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9296 } 9297 9298 if response.StatusCode < 200 || response.StatusCode >= 300 { 9299 return out, metadata, awsRestjson1_deserializeOpErrorImportApi(response, &metadata) 9300 } 9301 output := &ImportApiOutput{} 9302 out.Result = output 9303 9304 var buff [1024]byte 9305 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9306 9307 body := io.TeeReader(response.Body, ringBuffer) 9308 9309 decoder := json.NewDecoder(body) 9310 decoder.UseNumber() 9311 var shape interface{} 9312 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9313 var snapshot bytes.Buffer 9314 io.Copy(&snapshot, ringBuffer) 9315 err = &smithy.DeserializationError{ 9316 Err: fmt.Errorf("failed to decode response body, %w", err), 9317 Snapshot: snapshot.Bytes(), 9318 } 9319 return out, metadata, err 9320 } 9321 9322 err = awsRestjson1_deserializeOpDocumentImportApiOutput(&output, shape) 9323 if err != nil { 9324 var snapshot bytes.Buffer 9325 io.Copy(&snapshot, ringBuffer) 9326 return out, metadata, &smithy.DeserializationError{ 9327 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9328 Snapshot: snapshot.Bytes(), 9329 } 9330 } 9331 9332 return out, metadata, err 9333} 9334 9335func awsRestjson1_deserializeOpErrorImportApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9336 var errorBuffer bytes.Buffer 9337 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9338 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9339 } 9340 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9341 9342 errorCode := "UnknownError" 9343 errorMessage := errorCode 9344 9345 code := response.Header.Get("X-Amzn-ErrorType") 9346 if len(code) != 0 { 9347 errorCode = restjson.SanitizeErrorCode(code) 9348 } 9349 9350 var buff [1024]byte 9351 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9352 9353 body := io.TeeReader(errorBody, ringBuffer) 9354 decoder := json.NewDecoder(body) 9355 decoder.UseNumber() 9356 code, message, err := restjson.GetErrorInfo(decoder) 9357 if err != nil { 9358 var snapshot bytes.Buffer 9359 io.Copy(&snapshot, ringBuffer) 9360 err = &smithy.DeserializationError{ 9361 Err: fmt.Errorf("failed to decode response body, %w", err), 9362 Snapshot: snapshot.Bytes(), 9363 } 9364 return err 9365 } 9366 9367 errorBody.Seek(0, io.SeekStart) 9368 if len(code) != 0 { 9369 errorCode = restjson.SanitizeErrorCode(code) 9370 } 9371 if len(message) != 0 { 9372 errorMessage = message 9373 } 9374 9375 switch { 9376 case strings.EqualFold("BadRequestException", errorCode): 9377 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 9378 9379 case strings.EqualFold("ConflictException", errorCode): 9380 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 9381 9382 case strings.EqualFold("NotFoundException", errorCode): 9383 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 9384 9385 case strings.EqualFold("TooManyRequestsException", errorCode): 9386 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9387 9388 default: 9389 genericError := &smithy.GenericAPIError{ 9390 Code: errorCode, 9391 Message: errorMessage, 9392 } 9393 return genericError 9394 9395 } 9396} 9397 9398func awsRestjson1_deserializeOpDocumentImportApiOutput(v **ImportApiOutput, value interface{}) error { 9399 if v == nil { 9400 return fmt.Errorf("unexpected nil of type %T", v) 9401 } 9402 if value == nil { 9403 return nil 9404 } 9405 9406 shape, ok := value.(map[string]interface{}) 9407 if !ok { 9408 return fmt.Errorf("unexpected JSON type %v", value) 9409 } 9410 9411 var sv *ImportApiOutput 9412 if *v == nil { 9413 sv = &ImportApiOutput{} 9414 } else { 9415 sv = *v 9416 } 9417 9418 for key, value := range shape { 9419 switch key { 9420 case "apiEndpoint": 9421 if value != nil { 9422 jtv, ok := value.(string) 9423 if !ok { 9424 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 9425 } 9426 sv.ApiEndpoint = ptr.String(jtv) 9427 } 9428 9429 case "apiGatewayManaged": 9430 if value != nil { 9431 jtv, ok := value.(bool) 9432 if !ok { 9433 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9434 } 9435 sv.ApiGatewayManaged = jtv 9436 } 9437 9438 case "apiId": 9439 if value != nil { 9440 jtv, ok := value.(string) 9441 if !ok { 9442 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9443 } 9444 sv.ApiId = ptr.String(jtv) 9445 } 9446 9447 case "apiKeySelectionExpression": 9448 if value != nil { 9449 jtv, ok := value.(string) 9450 if !ok { 9451 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 9452 } 9453 sv.ApiKeySelectionExpression = ptr.String(jtv) 9454 } 9455 9456 case "corsConfiguration": 9457 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 9458 return err 9459 } 9460 9461 case "createdDate": 9462 if value != nil { 9463 jtv, ok := value.(string) 9464 if !ok { 9465 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 9466 } 9467 t, err := smithytime.ParseDateTime(jtv) 9468 if err != nil { 9469 return err 9470 } 9471 sv.CreatedDate = ptr.Time(t) 9472 } 9473 9474 case "description": 9475 if value != nil { 9476 jtv, ok := value.(string) 9477 if !ok { 9478 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 9479 } 9480 sv.Description = ptr.String(jtv) 9481 } 9482 9483 case "disableExecuteApiEndpoint": 9484 if value != nil { 9485 jtv, ok := value.(bool) 9486 if !ok { 9487 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9488 } 9489 sv.DisableExecuteApiEndpoint = jtv 9490 } 9491 9492 case "disableSchemaValidation": 9493 if value != nil { 9494 jtv, ok := value.(bool) 9495 if !ok { 9496 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9497 } 9498 sv.DisableSchemaValidation = jtv 9499 } 9500 9501 case "importInfo": 9502 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 9503 return err 9504 } 9505 9506 case "name": 9507 if value != nil { 9508 jtv, ok := value.(string) 9509 if !ok { 9510 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 9511 } 9512 sv.Name = ptr.String(jtv) 9513 } 9514 9515 case "protocolType": 9516 if value != nil { 9517 jtv, ok := value.(string) 9518 if !ok { 9519 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 9520 } 9521 sv.ProtocolType = types.ProtocolType(jtv) 9522 } 9523 9524 case "routeSelectionExpression": 9525 if value != nil { 9526 jtv, ok := value.(string) 9527 if !ok { 9528 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 9529 } 9530 sv.RouteSelectionExpression = ptr.String(jtv) 9531 } 9532 9533 case "tags": 9534 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 9535 return err 9536 } 9537 9538 case "version": 9539 if value != nil { 9540 jtv, ok := value.(string) 9541 if !ok { 9542 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 9543 } 9544 sv.Version = ptr.String(jtv) 9545 } 9546 9547 case "warnings": 9548 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 9549 return err 9550 } 9551 9552 default: 9553 _, _ = key, value 9554 9555 } 9556 } 9557 *v = sv 9558 return nil 9559} 9560 9561type awsRestjson1_deserializeOpReimportApi struct { 9562} 9563 9564func (*awsRestjson1_deserializeOpReimportApi) ID() string { 9565 return "OperationDeserializer" 9566} 9567 9568func (m *awsRestjson1_deserializeOpReimportApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9569 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9570) { 9571 out, metadata, err = next.HandleDeserialize(ctx, in) 9572 if err != nil { 9573 return out, metadata, err 9574 } 9575 9576 response, ok := out.RawResponse.(*smithyhttp.Response) 9577 if !ok { 9578 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9579 } 9580 9581 if response.StatusCode < 200 || response.StatusCode >= 300 { 9582 return out, metadata, awsRestjson1_deserializeOpErrorReimportApi(response, &metadata) 9583 } 9584 output := &ReimportApiOutput{} 9585 out.Result = output 9586 9587 var buff [1024]byte 9588 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9589 9590 body := io.TeeReader(response.Body, ringBuffer) 9591 9592 decoder := json.NewDecoder(body) 9593 decoder.UseNumber() 9594 var shape interface{} 9595 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9596 var snapshot bytes.Buffer 9597 io.Copy(&snapshot, ringBuffer) 9598 err = &smithy.DeserializationError{ 9599 Err: fmt.Errorf("failed to decode response body, %w", err), 9600 Snapshot: snapshot.Bytes(), 9601 } 9602 return out, metadata, err 9603 } 9604 9605 err = awsRestjson1_deserializeOpDocumentReimportApiOutput(&output, shape) 9606 if err != nil { 9607 var snapshot bytes.Buffer 9608 io.Copy(&snapshot, ringBuffer) 9609 return out, metadata, &smithy.DeserializationError{ 9610 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9611 Snapshot: snapshot.Bytes(), 9612 } 9613 } 9614 9615 return out, metadata, err 9616} 9617 9618func awsRestjson1_deserializeOpErrorReimportApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9619 var errorBuffer bytes.Buffer 9620 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9621 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9622 } 9623 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9624 9625 errorCode := "UnknownError" 9626 errorMessage := errorCode 9627 9628 code := response.Header.Get("X-Amzn-ErrorType") 9629 if len(code) != 0 { 9630 errorCode = restjson.SanitizeErrorCode(code) 9631 } 9632 9633 var buff [1024]byte 9634 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9635 9636 body := io.TeeReader(errorBody, ringBuffer) 9637 decoder := json.NewDecoder(body) 9638 decoder.UseNumber() 9639 code, message, err := restjson.GetErrorInfo(decoder) 9640 if err != nil { 9641 var snapshot bytes.Buffer 9642 io.Copy(&snapshot, ringBuffer) 9643 err = &smithy.DeserializationError{ 9644 Err: fmt.Errorf("failed to decode response body, %w", err), 9645 Snapshot: snapshot.Bytes(), 9646 } 9647 return err 9648 } 9649 9650 errorBody.Seek(0, io.SeekStart) 9651 if len(code) != 0 { 9652 errorCode = restjson.SanitizeErrorCode(code) 9653 } 9654 if len(message) != 0 { 9655 errorMessage = message 9656 } 9657 9658 switch { 9659 case strings.EqualFold("BadRequestException", errorCode): 9660 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 9661 9662 case strings.EqualFold("ConflictException", errorCode): 9663 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 9664 9665 case strings.EqualFold("NotFoundException", errorCode): 9666 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 9667 9668 case strings.EqualFold("TooManyRequestsException", errorCode): 9669 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9670 9671 default: 9672 genericError := &smithy.GenericAPIError{ 9673 Code: errorCode, 9674 Message: errorMessage, 9675 } 9676 return genericError 9677 9678 } 9679} 9680 9681func awsRestjson1_deserializeOpDocumentReimportApiOutput(v **ReimportApiOutput, value interface{}) error { 9682 if v == nil { 9683 return fmt.Errorf("unexpected nil of type %T", v) 9684 } 9685 if value == nil { 9686 return nil 9687 } 9688 9689 shape, ok := value.(map[string]interface{}) 9690 if !ok { 9691 return fmt.Errorf("unexpected JSON type %v", value) 9692 } 9693 9694 var sv *ReimportApiOutput 9695 if *v == nil { 9696 sv = &ReimportApiOutput{} 9697 } else { 9698 sv = *v 9699 } 9700 9701 for key, value := range shape { 9702 switch key { 9703 case "apiEndpoint": 9704 if value != nil { 9705 jtv, ok := value.(string) 9706 if !ok { 9707 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 9708 } 9709 sv.ApiEndpoint = ptr.String(jtv) 9710 } 9711 9712 case "apiGatewayManaged": 9713 if value != nil { 9714 jtv, ok := value.(bool) 9715 if !ok { 9716 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9717 } 9718 sv.ApiGatewayManaged = jtv 9719 } 9720 9721 case "apiId": 9722 if value != nil { 9723 jtv, ok := value.(string) 9724 if !ok { 9725 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9726 } 9727 sv.ApiId = ptr.String(jtv) 9728 } 9729 9730 case "apiKeySelectionExpression": 9731 if value != nil { 9732 jtv, ok := value.(string) 9733 if !ok { 9734 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 9735 } 9736 sv.ApiKeySelectionExpression = ptr.String(jtv) 9737 } 9738 9739 case "corsConfiguration": 9740 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 9741 return err 9742 } 9743 9744 case "createdDate": 9745 if value != nil { 9746 jtv, ok := value.(string) 9747 if !ok { 9748 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 9749 } 9750 t, err := smithytime.ParseDateTime(jtv) 9751 if err != nil { 9752 return err 9753 } 9754 sv.CreatedDate = ptr.Time(t) 9755 } 9756 9757 case "description": 9758 if value != nil { 9759 jtv, ok := value.(string) 9760 if !ok { 9761 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 9762 } 9763 sv.Description = ptr.String(jtv) 9764 } 9765 9766 case "disableExecuteApiEndpoint": 9767 if value != nil { 9768 jtv, ok := value.(bool) 9769 if !ok { 9770 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9771 } 9772 sv.DisableExecuteApiEndpoint = jtv 9773 } 9774 9775 case "disableSchemaValidation": 9776 if value != nil { 9777 jtv, ok := value.(bool) 9778 if !ok { 9779 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 9780 } 9781 sv.DisableSchemaValidation = jtv 9782 } 9783 9784 case "importInfo": 9785 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 9786 return err 9787 } 9788 9789 case "name": 9790 if value != nil { 9791 jtv, ok := value.(string) 9792 if !ok { 9793 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 9794 } 9795 sv.Name = ptr.String(jtv) 9796 } 9797 9798 case "protocolType": 9799 if value != nil { 9800 jtv, ok := value.(string) 9801 if !ok { 9802 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 9803 } 9804 sv.ProtocolType = types.ProtocolType(jtv) 9805 } 9806 9807 case "routeSelectionExpression": 9808 if value != nil { 9809 jtv, ok := value.(string) 9810 if !ok { 9811 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 9812 } 9813 sv.RouteSelectionExpression = ptr.String(jtv) 9814 } 9815 9816 case "tags": 9817 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 9818 return err 9819 } 9820 9821 case "version": 9822 if value != nil { 9823 jtv, ok := value.(string) 9824 if !ok { 9825 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 9826 } 9827 sv.Version = ptr.String(jtv) 9828 } 9829 9830 case "warnings": 9831 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 9832 return err 9833 } 9834 9835 default: 9836 _, _ = key, value 9837 9838 } 9839 } 9840 *v = sv 9841 return nil 9842} 9843 9844type awsRestjson1_deserializeOpResetAuthorizersCache struct { 9845} 9846 9847func (*awsRestjson1_deserializeOpResetAuthorizersCache) ID() string { 9848 return "OperationDeserializer" 9849} 9850 9851func (m *awsRestjson1_deserializeOpResetAuthorizersCache) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9852 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9853) { 9854 out, metadata, err = next.HandleDeserialize(ctx, in) 9855 if err != nil { 9856 return out, metadata, err 9857 } 9858 9859 response, ok := out.RawResponse.(*smithyhttp.Response) 9860 if !ok { 9861 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9862 } 9863 9864 if response.StatusCode < 200 || response.StatusCode >= 300 { 9865 return out, metadata, awsRestjson1_deserializeOpErrorResetAuthorizersCache(response, &metadata) 9866 } 9867 output := &ResetAuthorizersCacheOutput{} 9868 out.Result = output 9869 9870 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 9871 return out, metadata, &smithy.DeserializationError{ 9872 Err: fmt.Errorf("failed to discard response body, %w", err), 9873 } 9874 } 9875 9876 return out, metadata, err 9877} 9878 9879func awsRestjson1_deserializeOpErrorResetAuthorizersCache(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9880 var errorBuffer bytes.Buffer 9881 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9882 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9883 } 9884 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9885 9886 errorCode := "UnknownError" 9887 errorMessage := errorCode 9888 9889 code := response.Header.Get("X-Amzn-ErrorType") 9890 if len(code) != 0 { 9891 errorCode = restjson.SanitizeErrorCode(code) 9892 } 9893 9894 var buff [1024]byte 9895 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9896 9897 body := io.TeeReader(errorBody, ringBuffer) 9898 decoder := json.NewDecoder(body) 9899 decoder.UseNumber() 9900 code, message, err := restjson.GetErrorInfo(decoder) 9901 if err != nil { 9902 var snapshot bytes.Buffer 9903 io.Copy(&snapshot, ringBuffer) 9904 err = &smithy.DeserializationError{ 9905 Err: fmt.Errorf("failed to decode response body, %w", err), 9906 Snapshot: snapshot.Bytes(), 9907 } 9908 return err 9909 } 9910 9911 errorBody.Seek(0, io.SeekStart) 9912 if len(code) != 0 { 9913 errorCode = restjson.SanitizeErrorCode(code) 9914 } 9915 if len(message) != 0 { 9916 errorMessage = message 9917 } 9918 9919 switch { 9920 case strings.EqualFold("NotFoundException", errorCode): 9921 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 9922 9923 case strings.EqualFold("TooManyRequestsException", errorCode): 9924 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 9925 9926 default: 9927 genericError := &smithy.GenericAPIError{ 9928 Code: errorCode, 9929 Message: errorMessage, 9930 } 9931 return genericError 9932 9933 } 9934} 9935 9936type awsRestjson1_deserializeOpTagResource struct { 9937} 9938 9939func (*awsRestjson1_deserializeOpTagResource) ID() string { 9940 return "OperationDeserializer" 9941} 9942 9943func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9944 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9945) { 9946 out, metadata, err = next.HandleDeserialize(ctx, in) 9947 if err != nil { 9948 return out, metadata, err 9949 } 9950 9951 response, ok := out.RawResponse.(*smithyhttp.Response) 9952 if !ok { 9953 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9954 } 9955 9956 if response.StatusCode < 200 || response.StatusCode >= 300 { 9957 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 9958 } 9959 output := &TagResourceOutput{} 9960 out.Result = output 9961 9962 return out, metadata, err 9963} 9964 9965func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9966 var errorBuffer bytes.Buffer 9967 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9968 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9969 } 9970 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9971 9972 errorCode := "UnknownError" 9973 errorMessage := errorCode 9974 9975 code := response.Header.Get("X-Amzn-ErrorType") 9976 if len(code) != 0 { 9977 errorCode = restjson.SanitizeErrorCode(code) 9978 } 9979 9980 var buff [1024]byte 9981 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9982 9983 body := io.TeeReader(errorBody, ringBuffer) 9984 decoder := json.NewDecoder(body) 9985 decoder.UseNumber() 9986 code, message, err := restjson.GetErrorInfo(decoder) 9987 if err != nil { 9988 var snapshot bytes.Buffer 9989 io.Copy(&snapshot, ringBuffer) 9990 err = &smithy.DeserializationError{ 9991 Err: fmt.Errorf("failed to decode response body, %w", err), 9992 Snapshot: snapshot.Bytes(), 9993 } 9994 return err 9995 } 9996 9997 errorBody.Seek(0, io.SeekStart) 9998 if len(code) != 0 { 9999 errorCode = restjson.SanitizeErrorCode(code) 10000 } 10001 if len(message) != 0 { 10002 errorMessage = message 10003 } 10004 10005 switch { 10006 case strings.EqualFold("BadRequestException", errorCode): 10007 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10008 10009 case strings.EqualFold("ConflictException", errorCode): 10010 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10011 10012 case strings.EqualFold("NotFoundException", errorCode): 10013 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10014 10015 case strings.EqualFold("TooManyRequestsException", errorCode): 10016 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10017 10018 default: 10019 genericError := &smithy.GenericAPIError{ 10020 Code: errorCode, 10021 Message: errorMessage, 10022 } 10023 return genericError 10024 10025 } 10026} 10027 10028type awsRestjson1_deserializeOpUntagResource struct { 10029} 10030 10031func (*awsRestjson1_deserializeOpUntagResource) ID() string { 10032 return "OperationDeserializer" 10033} 10034 10035func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10036 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10037) { 10038 out, metadata, err = next.HandleDeserialize(ctx, in) 10039 if err != nil { 10040 return out, metadata, err 10041 } 10042 10043 response, ok := out.RawResponse.(*smithyhttp.Response) 10044 if !ok { 10045 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10046 } 10047 10048 if response.StatusCode < 200 || response.StatusCode >= 300 { 10049 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 10050 } 10051 output := &UntagResourceOutput{} 10052 out.Result = output 10053 10054 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 10055 return out, metadata, &smithy.DeserializationError{ 10056 Err: fmt.Errorf("failed to discard response body, %w", err), 10057 } 10058 } 10059 10060 return out, metadata, err 10061} 10062 10063func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10064 var errorBuffer bytes.Buffer 10065 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10066 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10067 } 10068 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10069 10070 errorCode := "UnknownError" 10071 errorMessage := errorCode 10072 10073 code := response.Header.Get("X-Amzn-ErrorType") 10074 if len(code) != 0 { 10075 errorCode = restjson.SanitizeErrorCode(code) 10076 } 10077 10078 var buff [1024]byte 10079 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10080 10081 body := io.TeeReader(errorBody, ringBuffer) 10082 decoder := json.NewDecoder(body) 10083 decoder.UseNumber() 10084 code, message, err := restjson.GetErrorInfo(decoder) 10085 if err != nil { 10086 var snapshot bytes.Buffer 10087 io.Copy(&snapshot, ringBuffer) 10088 err = &smithy.DeserializationError{ 10089 Err: fmt.Errorf("failed to decode response body, %w", err), 10090 Snapshot: snapshot.Bytes(), 10091 } 10092 return err 10093 } 10094 10095 errorBody.Seek(0, io.SeekStart) 10096 if len(code) != 0 { 10097 errorCode = restjson.SanitizeErrorCode(code) 10098 } 10099 if len(message) != 0 { 10100 errorMessage = message 10101 } 10102 10103 switch { 10104 case strings.EqualFold("BadRequestException", errorCode): 10105 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10106 10107 case strings.EqualFold("ConflictException", errorCode): 10108 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10109 10110 case strings.EqualFold("NotFoundException", errorCode): 10111 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10112 10113 case strings.EqualFold("TooManyRequestsException", errorCode): 10114 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10115 10116 default: 10117 genericError := &smithy.GenericAPIError{ 10118 Code: errorCode, 10119 Message: errorMessage, 10120 } 10121 return genericError 10122 10123 } 10124} 10125 10126type awsRestjson1_deserializeOpUpdateApi struct { 10127} 10128 10129func (*awsRestjson1_deserializeOpUpdateApi) ID() string { 10130 return "OperationDeserializer" 10131} 10132 10133func (m *awsRestjson1_deserializeOpUpdateApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10134 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10135) { 10136 out, metadata, err = next.HandleDeserialize(ctx, in) 10137 if err != nil { 10138 return out, metadata, err 10139 } 10140 10141 response, ok := out.RawResponse.(*smithyhttp.Response) 10142 if !ok { 10143 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10144 } 10145 10146 if response.StatusCode < 200 || response.StatusCode >= 300 { 10147 return out, metadata, awsRestjson1_deserializeOpErrorUpdateApi(response, &metadata) 10148 } 10149 output := &UpdateApiOutput{} 10150 out.Result = output 10151 10152 var buff [1024]byte 10153 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10154 10155 body := io.TeeReader(response.Body, ringBuffer) 10156 10157 decoder := json.NewDecoder(body) 10158 decoder.UseNumber() 10159 var shape interface{} 10160 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10161 var snapshot bytes.Buffer 10162 io.Copy(&snapshot, ringBuffer) 10163 err = &smithy.DeserializationError{ 10164 Err: fmt.Errorf("failed to decode response body, %w", err), 10165 Snapshot: snapshot.Bytes(), 10166 } 10167 return out, metadata, err 10168 } 10169 10170 err = awsRestjson1_deserializeOpDocumentUpdateApiOutput(&output, shape) 10171 if err != nil { 10172 var snapshot bytes.Buffer 10173 io.Copy(&snapshot, ringBuffer) 10174 return out, metadata, &smithy.DeserializationError{ 10175 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10176 Snapshot: snapshot.Bytes(), 10177 } 10178 } 10179 10180 return out, metadata, err 10181} 10182 10183func awsRestjson1_deserializeOpErrorUpdateApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10184 var errorBuffer bytes.Buffer 10185 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10186 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10187 } 10188 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10189 10190 errorCode := "UnknownError" 10191 errorMessage := errorCode 10192 10193 code := response.Header.Get("X-Amzn-ErrorType") 10194 if len(code) != 0 { 10195 errorCode = restjson.SanitizeErrorCode(code) 10196 } 10197 10198 var buff [1024]byte 10199 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10200 10201 body := io.TeeReader(errorBody, ringBuffer) 10202 decoder := json.NewDecoder(body) 10203 decoder.UseNumber() 10204 code, message, err := restjson.GetErrorInfo(decoder) 10205 if err != nil { 10206 var snapshot bytes.Buffer 10207 io.Copy(&snapshot, ringBuffer) 10208 err = &smithy.DeserializationError{ 10209 Err: fmt.Errorf("failed to decode response body, %w", err), 10210 Snapshot: snapshot.Bytes(), 10211 } 10212 return err 10213 } 10214 10215 errorBody.Seek(0, io.SeekStart) 10216 if len(code) != 0 { 10217 errorCode = restjson.SanitizeErrorCode(code) 10218 } 10219 if len(message) != 0 { 10220 errorMessage = message 10221 } 10222 10223 switch { 10224 case strings.EqualFold("BadRequestException", errorCode): 10225 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10226 10227 case strings.EqualFold("ConflictException", errorCode): 10228 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10229 10230 case strings.EqualFold("NotFoundException", errorCode): 10231 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10232 10233 case strings.EqualFold("TooManyRequestsException", errorCode): 10234 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10235 10236 default: 10237 genericError := &smithy.GenericAPIError{ 10238 Code: errorCode, 10239 Message: errorMessage, 10240 } 10241 return genericError 10242 10243 } 10244} 10245 10246func awsRestjson1_deserializeOpDocumentUpdateApiOutput(v **UpdateApiOutput, value interface{}) error { 10247 if v == nil { 10248 return fmt.Errorf("unexpected nil of type %T", v) 10249 } 10250 if value == nil { 10251 return nil 10252 } 10253 10254 shape, ok := value.(map[string]interface{}) 10255 if !ok { 10256 return fmt.Errorf("unexpected JSON type %v", value) 10257 } 10258 10259 var sv *UpdateApiOutput 10260 if *v == nil { 10261 sv = &UpdateApiOutput{} 10262 } else { 10263 sv = *v 10264 } 10265 10266 for key, value := range shape { 10267 switch key { 10268 case "apiEndpoint": 10269 if value != nil { 10270 jtv, ok := value.(string) 10271 if !ok { 10272 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 10273 } 10274 sv.ApiEndpoint = ptr.String(jtv) 10275 } 10276 10277 case "apiGatewayManaged": 10278 if value != nil { 10279 jtv, ok := value.(bool) 10280 if !ok { 10281 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10282 } 10283 sv.ApiGatewayManaged = jtv 10284 } 10285 10286 case "apiId": 10287 if value != nil { 10288 jtv, ok := value.(string) 10289 if !ok { 10290 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10291 } 10292 sv.ApiId = ptr.String(jtv) 10293 } 10294 10295 case "apiKeySelectionExpression": 10296 if value != nil { 10297 jtv, ok := value.(string) 10298 if !ok { 10299 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 10300 } 10301 sv.ApiKeySelectionExpression = ptr.String(jtv) 10302 } 10303 10304 case "corsConfiguration": 10305 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 10306 return err 10307 } 10308 10309 case "createdDate": 10310 if value != nil { 10311 jtv, ok := value.(string) 10312 if !ok { 10313 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 10314 } 10315 t, err := smithytime.ParseDateTime(jtv) 10316 if err != nil { 10317 return err 10318 } 10319 sv.CreatedDate = ptr.Time(t) 10320 } 10321 10322 case "description": 10323 if value != nil { 10324 jtv, ok := value.(string) 10325 if !ok { 10326 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 10327 } 10328 sv.Description = ptr.String(jtv) 10329 } 10330 10331 case "disableExecuteApiEndpoint": 10332 if value != nil { 10333 jtv, ok := value.(bool) 10334 if !ok { 10335 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10336 } 10337 sv.DisableExecuteApiEndpoint = jtv 10338 } 10339 10340 case "disableSchemaValidation": 10341 if value != nil { 10342 jtv, ok := value.(bool) 10343 if !ok { 10344 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10345 } 10346 sv.DisableSchemaValidation = jtv 10347 } 10348 10349 case "importInfo": 10350 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 10351 return err 10352 } 10353 10354 case "name": 10355 if value != nil { 10356 jtv, ok := value.(string) 10357 if !ok { 10358 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 10359 } 10360 sv.Name = ptr.String(jtv) 10361 } 10362 10363 case "protocolType": 10364 if value != nil { 10365 jtv, ok := value.(string) 10366 if !ok { 10367 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 10368 } 10369 sv.ProtocolType = types.ProtocolType(jtv) 10370 } 10371 10372 case "routeSelectionExpression": 10373 if value != nil { 10374 jtv, ok := value.(string) 10375 if !ok { 10376 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 10377 } 10378 sv.RouteSelectionExpression = ptr.String(jtv) 10379 } 10380 10381 case "tags": 10382 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 10383 return err 10384 } 10385 10386 case "version": 10387 if value != nil { 10388 jtv, ok := value.(string) 10389 if !ok { 10390 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 10391 } 10392 sv.Version = ptr.String(jtv) 10393 } 10394 10395 case "warnings": 10396 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 10397 return err 10398 } 10399 10400 default: 10401 _, _ = key, value 10402 10403 } 10404 } 10405 *v = sv 10406 return nil 10407} 10408 10409type awsRestjson1_deserializeOpUpdateApiMapping struct { 10410} 10411 10412func (*awsRestjson1_deserializeOpUpdateApiMapping) ID() string { 10413 return "OperationDeserializer" 10414} 10415 10416func (m *awsRestjson1_deserializeOpUpdateApiMapping) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10417 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10418) { 10419 out, metadata, err = next.HandleDeserialize(ctx, in) 10420 if err != nil { 10421 return out, metadata, err 10422 } 10423 10424 response, ok := out.RawResponse.(*smithyhttp.Response) 10425 if !ok { 10426 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10427 } 10428 10429 if response.StatusCode < 200 || response.StatusCode >= 300 { 10430 return out, metadata, awsRestjson1_deserializeOpErrorUpdateApiMapping(response, &metadata) 10431 } 10432 output := &UpdateApiMappingOutput{} 10433 out.Result = output 10434 10435 var buff [1024]byte 10436 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10437 10438 body := io.TeeReader(response.Body, ringBuffer) 10439 10440 decoder := json.NewDecoder(body) 10441 decoder.UseNumber() 10442 var shape interface{} 10443 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10444 var snapshot bytes.Buffer 10445 io.Copy(&snapshot, ringBuffer) 10446 err = &smithy.DeserializationError{ 10447 Err: fmt.Errorf("failed to decode response body, %w", err), 10448 Snapshot: snapshot.Bytes(), 10449 } 10450 return out, metadata, err 10451 } 10452 10453 err = awsRestjson1_deserializeOpDocumentUpdateApiMappingOutput(&output, shape) 10454 if err != nil { 10455 var snapshot bytes.Buffer 10456 io.Copy(&snapshot, ringBuffer) 10457 return out, metadata, &smithy.DeserializationError{ 10458 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10459 Snapshot: snapshot.Bytes(), 10460 } 10461 } 10462 10463 return out, metadata, err 10464} 10465 10466func awsRestjson1_deserializeOpErrorUpdateApiMapping(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10467 var errorBuffer bytes.Buffer 10468 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10469 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10470 } 10471 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10472 10473 errorCode := "UnknownError" 10474 errorMessage := errorCode 10475 10476 code := response.Header.Get("X-Amzn-ErrorType") 10477 if len(code) != 0 { 10478 errorCode = restjson.SanitizeErrorCode(code) 10479 } 10480 10481 var buff [1024]byte 10482 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10483 10484 body := io.TeeReader(errorBody, ringBuffer) 10485 decoder := json.NewDecoder(body) 10486 decoder.UseNumber() 10487 code, message, err := restjson.GetErrorInfo(decoder) 10488 if err != nil { 10489 var snapshot bytes.Buffer 10490 io.Copy(&snapshot, ringBuffer) 10491 err = &smithy.DeserializationError{ 10492 Err: fmt.Errorf("failed to decode response body, %w", err), 10493 Snapshot: snapshot.Bytes(), 10494 } 10495 return err 10496 } 10497 10498 errorBody.Seek(0, io.SeekStart) 10499 if len(code) != 0 { 10500 errorCode = restjson.SanitizeErrorCode(code) 10501 } 10502 if len(message) != 0 { 10503 errorMessage = message 10504 } 10505 10506 switch { 10507 case strings.EqualFold("BadRequestException", errorCode): 10508 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10509 10510 case strings.EqualFold("ConflictException", errorCode): 10511 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10512 10513 case strings.EqualFold("NotFoundException", errorCode): 10514 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10515 10516 case strings.EqualFold("TooManyRequestsException", errorCode): 10517 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10518 10519 default: 10520 genericError := &smithy.GenericAPIError{ 10521 Code: errorCode, 10522 Message: errorMessage, 10523 } 10524 return genericError 10525 10526 } 10527} 10528 10529func awsRestjson1_deserializeOpDocumentUpdateApiMappingOutput(v **UpdateApiMappingOutput, value interface{}) error { 10530 if v == nil { 10531 return fmt.Errorf("unexpected nil of type %T", v) 10532 } 10533 if value == nil { 10534 return nil 10535 } 10536 10537 shape, ok := value.(map[string]interface{}) 10538 if !ok { 10539 return fmt.Errorf("unexpected JSON type %v", value) 10540 } 10541 10542 var sv *UpdateApiMappingOutput 10543 if *v == nil { 10544 sv = &UpdateApiMappingOutput{} 10545 } else { 10546 sv = *v 10547 } 10548 10549 for key, value := range shape { 10550 switch key { 10551 case "apiId": 10552 if value != nil { 10553 jtv, ok := value.(string) 10554 if !ok { 10555 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10556 } 10557 sv.ApiId = ptr.String(jtv) 10558 } 10559 10560 case "apiMappingId": 10561 if value != nil { 10562 jtv, ok := value.(string) 10563 if !ok { 10564 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10565 } 10566 sv.ApiMappingId = ptr.String(jtv) 10567 } 10568 10569 case "apiMappingKey": 10570 if value != nil { 10571 jtv, ok := value.(string) 10572 if !ok { 10573 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 10574 } 10575 sv.ApiMappingKey = ptr.String(jtv) 10576 } 10577 10578 case "stage": 10579 if value != nil { 10580 jtv, ok := value.(string) 10581 if !ok { 10582 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 10583 } 10584 sv.Stage = ptr.String(jtv) 10585 } 10586 10587 default: 10588 _, _ = key, value 10589 10590 } 10591 } 10592 *v = sv 10593 return nil 10594} 10595 10596type awsRestjson1_deserializeOpUpdateAuthorizer struct { 10597} 10598 10599func (*awsRestjson1_deserializeOpUpdateAuthorizer) ID() string { 10600 return "OperationDeserializer" 10601} 10602 10603func (m *awsRestjson1_deserializeOpUpdateAuthorizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10604 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10605) { 10606 out, metadata, err = next.HandleDeserialize(ctx, in) 10607 if err != nil { 10608 return out, metadata, err 10609 } 10610 10611 response, ok := out.RawResponse.(*smithyhttp.Response) 10612 if !ok { 10613 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10614 } 10615 10616 if response.StatusCode < 200 || response.StatusCode >= 300 { 10617 return out, metadata, awsRestjson1_deserializeOpErrorUpdateAuthorizer(response, &metadata) 10618 } 10619 output := &UpdateAuthorizerOutput{} 10620 out.Result = output 10621 10622 var buff [1024]byte 10623 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10624 10625 body := io.TeeReader(response.Body, ringBuffer) 10626 10627 decoder := json.NewDecoder(body) 10628 decoder.UseNumber() 10629 var shape interface{} 10630 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10631 var snapshot bytes.Buffer 10632 io.Copy(&snapshot, ringBuffer) 10633 err = &smithy.DeserializationError{ 10634 Err: fmt.Errorf("failed to decode response body, %w", err), 10635 Snapshot: snapshot.Bytes(), 10636 } 10637 return out, metadata, err 10638 } 10639 10640 err = awsRestjson1_deserializeOpDocumentUpdateAuthorizerOutput(&output, shape) 10641 if err != nil { 10642 var snapshot bytes.Buffer 10643 io.Copy(&snapshot, ringBuffer) 10644 return out, metadata, &smithy.DeserializationError{ 10645 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10646 Snapshot: snapshot.Bytes(), 10647 } 10648 } 10649 10650 return out, metadata, err 10651} 10652 10653func awsRestjson1_deserializeOpErrorUpdateAuthorizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10654 var errorBuffer bytes.Buffer 10655 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10656 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10657 } 10658 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10659 10660 errorCode := "UnknownError" 10661 errorMessage := errorCode 10662 10663 code := response.Header.Get("X-Amzn-ErrorType") 10664 if len(code) != 0 { 10665 errorCode = restjson.SanitizeErrorCode(code) 10666 } 10667 10668 var buff [1024]byte 10669 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10670 10671 body := io.TeeReader(errorBody, ringBuffer) 10672 decoder := json.NewDecoder(body) 10673 decoder.UseNumber() 10674 code, message, err := restjson.GetErrorInfo(decoder) 10675 if err != nil { 10676 var snapshot bytes.Buffer 10677 io.Copy(&snapshot, ringBuffer) 10678 err = &smithy.DeserializationError{ 10679 Err: fmt.Errorf("failed to decode response body, %w", err), 10680 Snapshot: snapshot.Bytes(), 10681 } 10682 return err 10683 } 10684 10685 errorBody.Seek(0, io.SeekStart) 10686 if len(code) != 0 { 10687 errorCode = restjson.SanitizeErrorCode(code) 10688 } 10689 if len(message) != 0 { 10690 errorMessage = message 10691 } 10692 10693 switch { 10694 case strings.EqualFold("BadRequestException", errorCode): 10695 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10696 10697 case strings.EqualFold("ConflictException", errorCode): 10698 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10699 10700 case strings.EqualFold("NotFoundException", errorCode): 10701 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10702 10703 case strings.EqualFold("TooManyRequestsException", errorCode): 10704 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10705 10706 default: 10707 genericError := &smithy.GenericAPIError{ 10708 Code: errorCode, 10709 Message: errorMessage, 10710 } 10711 return genericError 10712 10713 } 10714} 10715 10716func awsRestjson1_deserializeOpDocumentUpdateAuthorizerOutput(v **UpdateAuthorizerOutput, value interface{}) error { 10717 if v == nil { 10718 return fmt.Errorf("unexpected nil of type %T", v) 10719 } 10720 if value == nil { 10721 return nil 10722 } 10723 10724 shape, ok := value.(map[string]interface{}) 10725 if !ok { 10726 return fmt.Errorf("unexpected JSON type %v", value) 10727 } 10728 10729 var sv *UpdateAuthorizerOutput 10730 if *v == nil { 10731 sv = &UpdateAuthorizerOutput{} 10732 } else { 10733 sv = *v 10734 } 10735 10736 for key, value := range shape { 10737 switch key { 10738 case "authorizerCredentialsArn": 10739 if value != nil { 10740 jtv, ok := value.(string) 10741 if !ok { 10742 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 10743 } 10744 sv.AuthorizerCredentialsArn = ptr.String(jtv) 10745 } 10746 10747 case "authorizerId": 10748 if value != nil { 10749 jtv, ok := value.(string) 10750 if !ok { 10751 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10752 } 10753 sv.AuthorizerId = ptr.String(jtv) 10754 } 10755 10756 case "authorizerPayloadFormatVersion": 10757 if value != nil { 10758 jtv, ok := value.(string) 10759 if !ok { 10760 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 10761 } 10762 sv.AuthorizerPayloadFormatVersion = ptr.String(jtv) 10763 } 10764 10765 case "authorizerResultTtlInSeconds": 10766 if value != nil { 10767 jtv, ok := value.(json.Number) 10768 if !ok { 10769 return fmt.Errorf("expected IntegerWithLengthBetween0And3600 to be json.Number, got %T instead", value) 10770 } 10771 i64, err := jtv.Int64() 10772 if err != nil { 10773 return err 10774 } 10775 sv.AuthorizerResultTtlInSeconds = int32(i64) 10776 } 10777 10778 case "authorizerType": 10779 if value != nil { 10780 jtv, ok := value.(string) 10781 if !ok { 10782 return fmt.Errorf("expected AuthorizerType to be of type string, got %T instead", value) 10783 } 10784 sv.AuthorizerType = types.AuthorizerType(jtv) 10785 } 10786 10787 case "authorizerUri": 10788 if value != nil { 10789 jtv, ok := value.(string) 10790 if !ok { 10791 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 10792 } 10793 sv.AuthorizerUri = ptr.String(jtv) 10794 } 10795 10796 case "enableSimpleResponses": 10797 if value != nil { 10798 jtv, ok := value.(bool) 10799 if !ok { 10800 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10801 } 10802 sv.EnableSimpleResponses = jtv 10803 } 10804 10805 case "identitySource": 10806 if err := awsRestjson1_deserializeDocumentIdentitySourceList(&sv.IdentitySource, value); err != nil { 10807 return err 10808 } 10809 10810 case "identityValidationExpression": 10811 if value != nil { 10812 jtv, ok := value.(string) 10813 if !ok { 10814 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 10815 } 10816 sv.IdentityValidationExpression = ptr.String(jtv) 10817 } 10818 10819 case "jwtConfiguration": 10820 if err := awsRestjson1_deserializeDocumentJWTConfiguration(&sv.JwtConfiguration, value); err != nil { 10821 return err 10822 } 10823 10824 case "name": 10825 if value != nil { 10826 jtv, ok := value.(string) 10827 if !ok { 10828 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 10829 } 10830 sv.Name = ptr.String(jtv) 10831 } 10832 10833 default: 10834 _, _ = key, value 10835 10836 } 10837 } 10838 *v = sv 10839 return nil 10840} 10841 10842type awsRestjson1_deserializeOpUpdateDeployment struct { 10843} 10844 10845func (*awsRestjson1_deserializeOpUpdateDeployment) ID() string { 10846 return "OperationDeserializer" 10847} 10848 10849func (m *awsRestjson1_deserializeOpUpdateDeployment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10850 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10851) { 10852 out, metadata, err = next.HandleDeserialize(ctx, in) 10853 if err != nil { 10854 return out, metadata, err 10855 } 10856 10857 response, ok := out.RawResponse.(*smithyhttp.Response) 10858 if !ok { 10859 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10860 } 10861 10862 if response.StatusCode < 200 || response.StatusCode >= 300 { 10863 return out, metadata, awsRestjson1_deserializeOpErrorUpdateDeployment(response, &metadata) 10864 } 10865 output := &UpdateDeploymentOutput{} 10866 out.Result = output 10867 10868 var buff [1024]byte 10869 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10870 10871 body := io.TeeReader(response.Body, ringBuffer) 10872 10873 decoder := json.NewDecoder(body) 10874 decoder.UseNumber() 10875 var shape interface{} 10876 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10877 var snapshot bytes.Buffer 10878 io.Copy(&snapshot, ringBuffer) 10879 err = &smithy.DeserializationError{ 10880 Err: fmt.Errorf("failed to decode response body, %w", err), 10881 Snapshot: snapshot.Bytes(), 10882 } 10883 return out, metadata, err 10884 } 10885 10886 err = awsRestjson1_deserializeOpDocumentUpdateDeploymentOutput(&output, shape) 10887 if err != nil { 10888 var snapshot bytes.Buffer 10889 io.Copy(&snapshot, ringBuffer) 10890 return out, metadata, &smithy.DeserializationError{ 10891 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10892 Snapshot: snapshot.Bytes(), 10893 } 10894 } 10895 10896 return out, metadata, err 10897} 10898 10899func awsRestjson1_deserializeOpErrorUpdateDeployment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10900 var errorBuffer bytes.Buffer 10901 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10902 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10903 } 10904 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10905 10906 errorCode := "UnknownError" 10907 errorMessage := errorCode 10908 10909 code := response.Header.Get("X-Amzn-ErrorType") 10910 if len(code) != 0 { 10911 errorCode = restjson.SanitizeErrorCode(code) 10912 } 10913 10914 var buff [1024]byte 10915 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10916 10917 body := io.TeeReader(errorBody, ringBuffer) 10918 decoder := json.NewDecoder(body) 10919 decoder.UseNumber() 10920 code, message, err := restjson.GetErrorInfo(decoder) 10921 if err != nil { 10922 var snapshot bytes.Buffer 10923 io.Copy(&snapshot, ringBuffer) 10924 err = &smithy.DeserializationError{ 10925 Err: fmt.Errorf("failed to decode response body, %w", err), 10926 Snapshot: snapshot.Bytes(), 10927 } 10928 return err 10929 } 10930 10931 errorBody.Seek(0, io.SeekStart) 10932 if len(code) != 0 { 10933 errorCode = restjson.SanitizeErrorCode(code) 10934 } 10935 if len(message) != 0 { 10936 errorMessage = message 10937 } 10938 10939 switch { 10940 case strings.EqualFold("BadRequestException", errorCode): 10941 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 10942 10943 case strings.EqualFold("ConflictException", errorCode): 10944 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10945 10946 case strings.EqualFold("NotFoundException", errorCode): 10947 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 10948 10949 case strings.EqualFold("TooManyRequestsException", errorCode): 10950 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 10951 10952 default: 10953 genericError := &smithy.GenericAPIError{ 10954 Code: errorCode, 10955 Message: errorMessage, 10956 } 10957 return genericError 10958 10959 } 10960} 10961 10962func awsRestjson1_deserializeOpDocumentUpdateDeploymentOutput(v **UpdateDeploymentOutput, value interface{}) error { 10963 if v == nil { 10964 return fmt.Errorf("unexpected nil of type %T", v) 10965 } 10966 if value == nil { 10967 return nil 10968 } 10969 10970 shape, ok := value.(map[string]interface{}) 10971 if !ok { 10972 return fmt.Errorf("unexpected JSON type %v", value) 10973 } 10974 10975 var sv *UpdateDeploymentOutput 10976 if *v == nil { 10977 sv = &UpdateDeploymentOutput{} 10978 } else { 10979 sv = *v 10980 } 10981 10982 for key, value := range shape { 10983 switch key { 10984 case "autoDeployed": 10985 if value != nil { 10986 jtv, ok := value.(bool) 10987 if !ok { 10988 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 10989 } 10990 sv.AutoDeployed = jtv 10991 } 10992 10993 case "createdDate": 10994 if value != nil { 10995 jtv, ok := value.(string) 10996 if !ok { 10997 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 10998 } 10999 t, err := smithytime.ParseDateTime(jtv) 11000 if err != nil { 11001 return err 11002 } 11003 sv.CreatedDate = ptr.Time(t) 11004 } 11005 11006 case "deploymentId": 11007 if value != nil { 11008 jtv, ok := value.(string) 11009 if !ok { 11010 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11011 } 11012 sv.DeploymentId = ptr.String(jtv) 11013 } 11014 11015 case "deploymentStatus": 11016 if value != nil { 11017 jtv, ok := value.(string) 11018 if !ok { 11019 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 11020 } 11021 sv.DeploymentStatus = types.DeploymentStatus(jtv) 11022 } 11023 11024 case "deploymentStatusMessage": 11025 if value != nil { 11026 jtv, ok := value.(string) 11027 if !ok { 11028 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 11029 } 11030 sv.DeploymentStatusMessage = ptr.String(jtv) 11031 } 11032 11033 case "description": 11034 if value != nil { 11035 jtv, ok := value.(string) 11036 if !ok { 11037 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 11038 } 11039 sv.Description = ptr.String(jtv) 11040 } 11041 11042 default: 11043 _, _ = key, value 11044 11045 } 11046 } 11047 *v = sv 11048 return nil 11049} 11050 11051type awsRestjson1_deserializeOpUpdateDomainName struct { 11052} 11053 11054func (*awsRestjson1_deserializeOpUpdateDomainName) ID() string { 11055 return "OperationDeserializer" 11056} 11057 11058func (m *awsRestjson1_deserializeOpUpdateDomainName) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11059 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11060) { 11061 out, metadata, err = next.HandleDeserialize(ctx, in) 11062 if err != nil { 11063 return out, metadata, err 11064 } 11065 11066 response, ok := out.RawResponse.(*smithyhttp.Response) 11067 if !ok { 11068 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11069 } 11070 11071 if response.StatusCode < 200 || response.StatusCode >= 300 { 11072 return out, metadata, awsRestjson1_deserializeOpErrorUpdateDomainName(response, &metadata) 11073 } 11074 output := &UpdateDomainNameOutput{} 11075 out.Result = output 11076 11077 var buff [1024]byte 11078 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11079 11080 body := io.TeeReader(response.Body, ringBuffer) 11081 11082 decoder := json.NewDecoder(body) 11083 decoder.UseNumber() 11084 var shape interface{} 11085 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11086 var snapshot bytes.Buffer 11087 io.Copy(&snapshot, ringBuffer) 11088 err = &smithy.DeserializationError{ 11089 Err: fmt.Errorf("failed to decode response body, %w", err), 11090 Snapshot: snapshot.Bytes(), 11091 } 11092 return out, metadata, err 11093 } 11094 11095 err = awsRestjson1_deserializeOpDocumentUpdateDomainNameOutput(&output, shape) 11096 if err != nil { 11097 var snapshot bytes.Buffer 11098 io.Copy(&snapshot, ringBuffer) 11099 return out, metadata, &smithy.DeserializationError{ 11100 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11101 Snapshot: snapshot.Bytes(), 11102 } 11103 } 11104 11105 return out, metadata, err 11106} 11107 11108func awsRestjson1_deserializeOpErrorUpdateDomainName(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11109 var errorBuffer bytes.Buffer 11110 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11111 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11112 } 11113 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11114 11115 errorCode := "UnknownError" 11116 errorMessage := errorCode 11117 11118 code := response.Header.Get("X-Amzn-ErrorType") 11119 if len(code) != 0 { 11120 errorCode = restjson.SanitizeErrorCode(code) 11121 } 11122 11123 var buff [1024]byte 11124 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11125 11126 body := io.TeeReader(errorBody, ringBuffer) 11127 decoder := json.NewDecoder(body) 11128 decoder.UseNumber() 11129 code, message, err := restjson.GetErrorInfo(decoder) 11130 if err != nil { 11131 var snapshot bytes.Buffer 11132 io.Copy(&snapshot, ringBuffer) 11133 err = &smithy.DeserializationError{ 11134 Err: fmt.Errorf("failed to decode response body, %w", err), 11135 Snapshot: snapshot.Bytes(), 11136 } 11137 return err 11138 } 11139 11140 errorBody.Seek(0, io.SeekStart) 11141 if len(code) != 0 { 11142 errorCode = restjson.SanitizeErrorCode(code) 11143 } 11144 if len(message) != 0 { 11145 errorMessage = message 11146 } 11147 11148 switch { 11149 case strings.EqualFold("BadRequestException", errorCode): 11150 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 11151 11152 case strings.EqualFold("ConflictException", errorCode): 11153 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11154 11155 case strings.EqualFold("NotFoundException", errorCode): 11156 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 11157 11158 case strings.EqualFold("TooManyRequestsException", errorCode): 11159 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 11160 11161 default: 11162 genericError := &smithy.GenericAPIError{ 11163 Code: errorCode, 11164 Message: errorMessage, 11165 } 11166 return genericError 11167 11168 } 11169} 11170 11171func awsRestjson1_deserializeOpDocumentUpdateDomainNameOutput(v **UpdateDomainNameOutput, value interface{}) error { 11172 if v == nil { 11173 return fmt.Errorf("unexpected nil of type %T", v) 11174 } 11175 if value == nil { 11176 return nil 11177 } 11178 11179 shape, ok := value.(map[string]interface{}) 11180 if !ok { 11181 return fmt.Errorf("unexpected JSON type %v", value) 11182 } 11183 11184 var sv *UpdateDomainNameOutput 11185 if *v == nil { 11186 sv = &UpdateDomainNameOutput{} 11187 } else { 11188 sv = *v 11189 } 11190 11191 for key, value := range shape { 11192 switch key { 11193 case "apiMappingSelectionExpression": 11194 if value != nil { 11195 jtv, ok := value.(string) 11196 if !ok { 11197 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 11198 } 11199 sv.ApiMappingSelectionExpression = ptr.String(jtv) 11200 } 11201 11202 case "domainName": 11203 if value != nil { 11204 jtv, ok := value.(string) 11205 if !ok { 11206 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 11207 } 11208 sv.DomainName = ptr.String(jtv) 11209 } 11210 11211 case "domainNameConfigurations": 11212 if err := awsRestjson1_deserializeDocumentDomainNameConfigurations(&sv.DomainNameConfigurations, value); err != nil { 11213 return err 11214 } 11215 11216 case "mutualTlsAuthentication": 11217 if err := awsRestjson1_deserializeDocumentMutualTlsAuthentication(&sv.MutualTlsAuthentication, value); err != nil { 11218 return err 11219 } 11220 11221 case "tags": 11222 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 11223 return err 11224 } 11225 11226 default: 11227 _, _ = key, value 11228 11229 } 11230 } 11231 *v = sv 11232 return nil 11233} 11234 11235type awsRestjson1_deserializeOpUpdateIntegration struct { 11236} 11237 11238func (*awsRestjson1_deserializeOpUpdateIntegration) ID() string { 11239 return "OperationDeserializer" 11240} 11241 11242func (m *awsRestjson1_deserializeOpUpdateIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11243 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11244) { 11245 out, metadata, err = next.HandleDeserialize(ctx, in) 11246 if err != nil { 11247 return out, metadata, err 11248 } 11249 11250 response, ok := out.RawResponse.(*smithyhttp.Response) 11251 if !ok { 11252 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11253 } 11254 11255 if response.StatusCode < 200 || response.StatusCode >= 300 { 11256 return out, metadata, awsRestjson1_deserializeOpErrorUpdateIntegration(response, &metadata) 11257 } 11258 output := &UpdateIntegrationOutput{} 11259 out.Result = output 11260 11261 var buff [1024]byte 11262 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11263 11264 body := io.TeeReader(response.Body, ringBuffer) 11265 11266 decoder := json.NewDecoder(body) 11267 decoder.UseNumber() 11268 var shape interface{} 11269 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11270 var snapshot bytes.Buffer 11271 io.Copy(&snapshot, ringBuffer) 11272 err = &smithy.DeserializationError{ 11273 Err: fmt.Errorf("failed to decode response body, %w", err), 11274 Snapshot: snapshot.Bytes(), 11275 } 11276 return out, metadata, err 11277 } 11278 11279 err = awsRestjson1_deserializeOpDocumentUpdateIntegrationOutput(&output, shape) 11280 if err != nil { 11281 var snapshot bytes.Buffer 11282 io.Copy(&snapshot, ringBuffer) 11283 return out, metadata, &smithy.DeserializationError{ 11284 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11285 Snapshot: snapshot.Bytes(), 11286 } 11287 } 11288 11289 return out, metadata, err 11290} 11291 11292func awsRestjson1_deserializeOpErrorUpdateIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11293 var errorBuffer bytes.Buffer 11294 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11295 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11296 } 11297 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11298 11299 errorCode := "UnknownError" 11300 errorMessage := errorCode 11301 11302 code := response.Header.Get("X-Amzn-ErrorType") 11303 if len(code) != 0 { 11304 errorCode = restjson.SanitizeErrorCode(code) 11305 } 11306 11307 var buff [1024]byte 11308 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11309 11310 body := io.TeeReader(errorBody, ringBuffer) 11311 decoder := json.NewDecoder(body) 11312 decoder.UseNumber() 11313 code, message, err := restjson.GetErrorInfo(decoder) 11314 if err != nil { 11315 var snapshot bytes.Buffer 11316 io.Copy(&snapshot, ringBuffer) 11317 err = &smithy.DeserializationError{ 11318 Err: fmt.Errorf("failed to decode response body, %w", err), 11319 Snapshot: snapshot.Bytes(), 11320 } 11321 return err 11322 } 11323 11324 errorBody.Seek(0, io.SeekStart) 11325 if len(code) != 0 { 11326 errorCode = restjson.SanitizeErrorCode(code) 11327 } 11328 if len(message) != 0 { 11329 errorMessage = message 11330 } 11331 11332 switch { 11333 case strings.EqualFold("BadRequestException", errorCode): 11334 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 11335 11336 case strings.EqualFold("ConflictException", errorCode): 11337 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11338 11339 case strings.EqualFold("NotFoundException", errorCode): 11340 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 11341 11342 case strings.EqualFold("TooManyRequestsException", errorCode): 11343 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 11344 11345 default: 11346 genericError := &smithy.GenericAPIError{ 11347 Code: errorCode, 11348 Message: errorMessage, 11349 } 11350 return genericError 11351 11352 } 11353} 11354 11355func awsRestjson1_deserializeOpDocumentUpdateIntegrationOutput(v **UpdateIntegrationOutput, value interface{}) error { 11356 if v == nil { 11357 return fmt.Errorf("unexpected nil of type %T", v) 11358 } 11359 if value == nil { 11360 return nil 11361 } 11362 11363 shape, ok := value.(map[string]interface{}) 11364 if !ok { 11365 return fmt.Errorf("unexpected JSON type %v", value) 11366 } 11367 11368 var sv *UpdateIntegrationOutput 11369 if *v == nil { 11370 sv = &UpdateIntegrationOutput{} 11371 } else { 11372 sv = *v 11373 } 11374 11375 for key, value := range shape { 11376 switch key { 11377 case "apiGatewayManaged": 11378 if value != nil { 11379 jtv, ok := value.(bool) 11380 if !ok { 11381 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 11382 } 11383 sv.ApiGatewayManaged = jtv 11384 } 11385 11386 case "connectionId": 11387 if value != nil { 11388 jtv, ok := value.(string) 11389 if !ok { 11390 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 11391 } 11392 sv.ConnectionId = ptr.String(jtv) 11393 } 11394 11395 case "connectionType": 11396 if value != nil { 11397 jtv, ok := value.(string) 11398 if !ok { 11399 return fmt.Errorf("expected ConnectionType to be of type string, got %T instead", value) 11400 } 11401 sv.ConnectionType = types.ConnectionType(jtv) 11402 } 11403 11404 case "contentHandlingStrategy": 11405 if value != nil { 11406 jtv, ok := value.(string) 11407 if !ok { 11408 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 11409 } 11410 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 11411 } 11412 11413 case "credentialsArn": 11414 if value != nil { 11415 jtv, ok := value.(string) 11416 if !ok { 11417 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 11418 } 11419 sv.CredentialsArn = ptr.String(jtv) 11420 } 11421 11422 case "description": 11423 if value != nil { 11424 jtv, ok := value.(string) 11425 if !ok { 11426 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 11427 } 11428 sv.Description = ptr.String(jtv) 11429 } 11430 11431 case "integrationId": 11432 if value != nil { 11433 jtv, ok := value.(string) 11434 if !ok { 11435 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11436 } 11437 sv.IntegrationId = ptr.String(jtv) 11438 } 11439 11440 case "integrationMethod": 11441 if value != nil { 11442 jtv, ok := value.(string) 11443 if !ok { 11444 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 11445 } 11446 sv.IntegrationMethod = ptr.String(jtv) 11447 } 11448 11449 case "integrationResponseSelectionExpression": 11450 if value != nil { 11451 jtv, ok := value.(string) 11452 if !ok { 11453 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 11454 } 11455 sv.IntegrationResponseSelectionExpression = ptr.String(jtv) 11456 } 11457 11458 case "integrationSubtype": 11459 if value != nil { 11460 jtv, ok := value.(string) 11461 if !ok { 11462 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 11463 } 11464 sv.IntegrationSubtype = ptr.String(jtv) 11465 } 11466 11467 case "integrationType": 11468 if value != nil { 11469 jtv, ok := value.(string) 11470 if !ok { 11471 return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) 11472 } 11473 sv.IntegrationType = types.IntegrationType(jtv) 11474 } 11475 11476 case "integrationUri": 11477 if value != nil { 11478 jtv, ok := value.(string) 11479 if !ok { 11480 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 11481 } 11482 sv.IntegrationUri = ptr.String(jtv) 11483 } 11484 11485 case "passthroughBehavior": 11486 if value != nil { 11487 jtv, ok := value.(string) 11488 if !ok { 11489 return fmt.Errorf("expected PassthroughBehavior to be of type string, got %T instead", value) 11490 } 11491 sv.PassthroughBehavior = types.PassthroughBehavior(jtv) 11492 } 11493 11494 case "payloadFormatVersion": 11495 if value != nil { 11496 jtv, ok := value.(string) 11497 if !ok { 11498 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 11499 } 11500 sv.PayloadFormatVersion = ptr.String(jtv) 11501 } 11502 11503 case "requestParameters": 11504 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.RequestParameters, value); err != nil { 11505 return err 11506 } 11507 11508 case "requestTemplates": 11509 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.RequestTemplates, value); err != nil { 11510 return err 11511 } 11512 11513 case "templateSelectionExpression": 11514 if value != nil { 11515 jtv, ok := value.(string) 11516 if !ok { 11517 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 11518 } 11519 sv.TemplateSelectionExpression = ptr.String(jtv) 11520 } 11521 11522 case "timeoutInMillis": 11523 if value != nil { 11524 jtv, ok := value.(json.Number) 11525 if !ok { 11526 return fmt.Errorf("expected IntegerWithLengthBetween50And30000 to be json.Number, got %T instead", value) 11527 } 11528 i64, err := jtv.Int64() 11529 if err != nil { 11530 return err 11531 } 11532 sv.TimeoutInMillis = int32(i64) 11533 } 11534 11535 case "tlsConfig": 11536 if err := awsRestjson1_deserializeDocumentTlsConfig(&sv.TlsConfig, value); err != nil { 11537 return err 11538 } 11539 11540 default: 11541 _, _ = key, value 11542 11543 } 11544 } 11545 *v = sv 11546 return nil 11547} 11548 11549type awsRestjson1_deserializeOpUpdateIntegrationResponse struct { 11550} 11551 11552func (*awsRestjson1_deserializeOpUpdateIntegrationResponse) ID() string { 11553 return "OperationDeserializer" 11554} 11555 11556func (m *awsRestjson1_deserializeOpUpdateIntegrationResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11557 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11558) { 11559 out, metadata, err = next.HandleDeserialize(ctx, in) 11560 if err != nil { 11561 return out, metadata, err 11562 } 11563 11564 response, ok := out.RawResponse.(*smithyhttp.Response) 11565 if !ok { 11566 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11567 } 11568 11569 if response.StatusCode < 200 || response.StatusCode >= 300 { 11570 return out, metadata, awsRestjson1_deserializeOpErrorUpdateIntegrationResponse(response, &metadata) 11571 } 11572 output := &UpdateIntegrationResponseOutput{} 11573 out.Result = output 11574 11575 var buff [1024]byte 11576 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11577 11578 body := io.TeeReader(response.Body, ringBuffer) 11579 11580 decoder := json.NewDecoder(body) 11581 decoder.UseNumber() 11582 var shape interface{} 11583 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11584 var snapshot bytes.Buffer 11585 io.Copy(&snapshot, ringBuffer) 11586 err = &smithy.DeserializationError{ 11587 Err: fmt.Errorf("failed to decode response body, %w", err), 11588 Snapshot: snapshot.Bytes(), 11589 } 11590 return out, metadata, err 11591 } 11592 11593 err = awsRestjson1_deserializeOpDocumentUpdateIntegrationResponseOutput(&output, shape) 11594 if err != nil { 11595 var snapshot bytes.Buffer 11596 io.Copy(&snapshot, ringBuffer) 11597 return out, metadata, &smithy.DeserializationError{ 11598 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11599 Snapshot: snapshot.Bytes(), 11600 } 11601 } 11602 11603 return out, metadata, err 11604} 11605 11606func awsRestjson1_deserializeOpErrorUpdateIntegrationResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11607 var errorBuffer bytes.Buffer 11608 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11609 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11610 } 11611 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11612 11613 errorCode := "UnknownError" 11614 errorMessage := errorCode 11615 11616 code := response.Header.Get("X-Amzn-ErrorType") 11617 if len(code) != 0 { 11618 errorCode = restjson.SanitizeErrorCode(code) 11619 } 11620 11621 var buff [1024]byte 11622 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11623 11624 body := io.TeeReader(errorBody, ringBuffer) 11625 decoder := json.NewDecoder(body) 11626 decoder.UseNumber() 11627 code, message, err := restjson.GetErrorInfo(decoder) 11628 if err != nil { 11629 var snapshot bytes.Buffer 11630 io.Copy(&snapshot, ringBuffer) 11631 err = &smithy.DeserializationError{ 11632 Err: fmt.Errorf("failed to decode response body, %w", err), 11633 Snapshot: snapshot.Bytes(), 11634 } 11635 return err 11636 } 11637 11638 errorBody.Seek(0, io.SeekStart) 11639 if len(code) != 0 { 11640 errorCode = restjson.SanitizeErrorCode(code) 11641 } 11642 if len(message) != 0 { 11643 errorMessage = message 11644 } 11645 11646 switch { 11647 case strings.EqualFold("BadRequestException", errorCode): 11648 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 11649 11650 case strings.EqualFold("ConflictException", errorCode): 11651 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11652 11653 case strings.EqualFold("NotFoundException", errorCode): 11654 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 11655 11656 case strings.EqualFold("TooManyRequestsException", errorCode): 11657 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 11658 11659 default: 11660 genericError := &smithy.GenericAPIError{ 11661 Code: errorCode, 11662 Message: errorMessage, 11663 } 11664 return genericError 11665 11666 } 11667} 11668 11669func awsRestjson1_deserializeOpDocumentUpdateIntegrationResponseOutput(v **UpdateIntegrationResponseOutput, value interface{}) error { 11670 if v == nil { 11671 return fmt.Errorf("unexpected nil of type %T", v) 11672 } 11673 if value == nil { 11674 return nil 11675 } 11676 11677 shape, ok := value.(map[string]interface{}) 11678 if !ok { 11679 return fmt.Errorf("unexpected JSON type %v", value) 11680 } 11681 11682 var sv *UpdateIntegrationResponseOutput 11683 if *v == nil { 11684 sv = &UpdateIntegrationResponseOutput{} 11685 } else { 11686 sv = *v 11687 } 11688 11689 for key, value := range shape { 11690 switch key { 11691 case "contentHandlingStrategy": 11692 if value != nil { 11693 jtv, ok := value.(string) 11694 if !ok { 11695 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 11696 } 11697 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 11698 } 11699 11700 case "integrationResponseId": 11701 if value != nil { 11702 jtv, ok := value.(string) 11703 if !ok { 11704 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11705 } 11706 sv.IntegrationResponseId = ptr.String(jtv) 11707 } 11708 11709 case "integrationResponseKey": 11710 if value != nil { 11711 jtv, ok := value.(string) 11712 if !ok { 11713 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 11714 } 11715 sv.IntegrationResponseKey = ptr.String(jtv) 11716 } 11717 11718 case "responseParameters": 11719 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.ResponseParameters, value); err != nil { 11720 return err 11721 } 11722 11723 case "responseTemplates": 11724 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.ResponseTemplates, value); err != nil { 11725 return err 11726 } 11727 11728 case "templateSelectionExpression": 11729 if value != nil { 11730 jtv, ok := value.(string) 11731 if !ok { 11732 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 11733 } 11734 sv.TemplateSelectionExpression = ptr.String(jtv) 11735 } 11736 11737 default: 11738 _, _ = key, value 11739 11740 } 11741 } 11742 *v = sv 11743 return nil 11744} 11745 11746type awsRestjson1_deserializeOpUpdateModel struct { 11747} 11748 11749func (*awsRestjson1_deserializeOpUpdateModel) ID() string { 11750 return "OperationDeserializer" 11751} 11752 11753func (m *awsRestjson1_deserializeOpUpdateModel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11754 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11755) { 11756 out, metadata, err = next.HandleDeserialize(ctx, in) 11757 if err != nil { 11758 return out, metadata, err 11759 } 11760 11761 response, ok := out.RawResponse.(*smithyhttp.Response) 11762 if !ok { 11763 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11764 } 11765 11766 if response.StatusCode < 200 || response.StatusCode >= 300 { 11767 return out, metadata, awsRestjson1_deserializeOpErrorUpdateModel(response, &metadata) 11768 } 11769 output := &UpdateModelOutput{} 11770 out.Result = output 11771 11772 var buff [1024]byte 11773 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11774 11775 body := io.TeeReader(response.Body, ringBuffer) 11776 11777 decoder := json.NewDecoder(body) 11778 decoder.UseNumber() 11779 var shape interface{} 11780 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11781 var snapshot bytes.Buffer 11782 io.Copy(&snapshot, ringBuffer) 11783 err = &smithy.DeserializationError{ 11784 Err: fmt.Errorf("failed to decode response body, %w", err), 11785 Snapshot: snapshot.Bytes(), 11786 } 11787 return out, metadata, err 11788 } 11789 11790 err = awsRestjson1_deserializeOpDocumentUpdateModelOutput(&output, shape) 11791 if err != nil { 11792 var snapshot bytes.Buffer 11793 io.Copy(&snapshot, ringBuffer) 11794 return out, metadata, &smithy.DeserializationError{ 11795 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11796 Snapshot: snapshot.Bytes(), 11797 } 11798 } 11799 11800 return out, metadata, err 11801} 11802 11803func awsRestjson1_deserializeOpErrorUpdateModel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11804 var errorBuffer bytes.Buffer 11805 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11806 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11807 } 11808 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11809 11810 errorCode := "UnknownError" 11811 errorMessage := errorCode 11812 11813 code := response.Header.Get("X-Amzn-ErrorType") 11814 if len(code) != 0 { 11815 errorCode = restjson.SanitizeErrorCode(code) 11816 } 11817 11818 var buff [1024]byte 11819 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11820 11821 body := io.TeeReader(errorBody, ringBuffer) 11822 decoder := json.NewDecoder(body) 11823 decoder.UseNumber() 11824 code, message, err := restjson.GetErrorInfo(decoder) 11825 if err != nil { 11826 var snapshot bytes.Buffer 11827 io.Copy(&snapshot, ringBuffer) 11828 err = &smithy.DeserializationError{ 11829 Err: fmt.Errorf("failed to decode response body, %w", err), 11830 Snapshot: snapshot.Bytes(), 11831 } 11832 return err 11833 } 11834 11835 errorBody.Seek(0, io.SeekStart) 11836 if len(code) != 0 { 11837 errorCode = restjson.SanitizeErrorCode(code) 11838 } 11839 if len(message) != 0 { 11840 errorMessage = message 11841 } 11842 11843 switch { 11844 case strings.EqualFold("BadRequestException", errorCode): 11845 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 11846 11847 case strings.EqualFold("ConflictException", errorCode): 11848 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11849 11850 case strings.EqualFold("NotFoundException", errorCode): 11851 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 11852 11853 case strings.EqualFold("TooManyRequestsException", errorCode): 11854 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 11855 11856 default: 11857 genericError := &smithy.GenericAPIError{ 11858 Code: errorCode, 11859 Message: errorMessage, 11860 } 11861 return genericError 11862 11863 } 11864} 11865 11866func awsRestjson1_deserializeOpDocumentUpdateModelOutput(v **UpdateModelOutput, value interface{}) error { 11867 if v == nil { 11868 return fmt.Errorf("unexpected nil of type %T", v) 11869 } 11870 if value == nil { 11871 return nil 11872 } 11873 11874 shape, ok := value.(map[string]interface{}) 11875 if !ok { 11876 return fmt.Errorf("unexpected JSON type %v", value) 11877 } 11878 11879 var sv *UpdateModelOutput 11880 if *v == nil { 11881 sv = &UpdateModelOutput{} 11882 } else { 11883 sv = *v 11884 } 11885 11886 for key, value := range shape { 11887 switch key { 11888 case "contentType": 11889 if value != nil { 11890 jtv, ok := value.(string) 11891 if !ok { 11892 return fmt.Errorf("expected StringWithLengthBetween1And256 to be of type string, got %T instead", value) 11893 } 11894 sv.ContentType = ptr.String(jtv) 11895 } 11896 11897 case "description": 11898 if value != nil { 11899 jtv, ok := value.(string) 11900 if !ok { 11901 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 11902 } 11903 sv.Description = ptr.String(jtv) 11904 } 11905 11906 case "modelId": 11907 if value != nil { 11908 jtv, ok := value.(string) 11909 if !ok { 11910 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11911 } 11912 sv.ModelId = ptr.String(jtv) 11913 } 11914 11915 case "name": 11916 if value != nil { 11917 jtv, ok := value.(string) 11918 if !ok { 11919 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 11920 } 11921 sv.Name = ptr.String(jtv) 11922 } 11923 11924 case "schema": 11925 if value != nil { 11926 jtv, ok := value.(string) 11927 if !ok { 11928 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 11929 } 11930 sv.Schema = ptr.String(jtv) 11931 } 11932 11933 default: 11934 _, _ = key, value 11935 11936 } 11937 } 11938 *v = sv 11939 return nil 11940} 11941 11942type awsRestjson1_deserializeOpUpdateRoute struct { 11943} 11944 11945func (*awsRestjson1_deserializeOpUpdateRoute) ID() string { 11946 return "OperationDeserializer" 11947} 11948 11949func (m *awsRestjson1_deserializeOpUpdateRoute) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11950 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11951) { 11952 out, metadata, err = next.HandleDeserialize(ctx, in) 11953 if err != nil { 11954 return out, metadata, err 11955 } 11956 11957 response, ok := out.RawResponse.(*smithyhttp.Response) 11958 if !ok { 11959 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11960 } 11961 11962 if response.StatusCode < 200 || response.StatusCode >= 300 { 11963 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRoute(response, &metadata) 11964 } 11965 output := &UpdateRouteOutput{} 11966 out.Result = output 11967 11968 var buff [1024]byte 11969 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11970 11971 body := io.TeeReader(response.Body, ringBuffer) 11972 11973 decoder := json.NewDecoder(body) 11974 decoder.UseNumber() 11975 var shape interface{} 11976 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11977 var snapshot bytes.Buffer 11978 io.Copy(&snapshot, ringBuffer) 11979 err = &smithy.DeserializationError{ 11980 Err: fmt.Errorf("failed to decode response body, %w", err), 11981 Snapshot: snapshot.Bytes(), 11982 } 11983 return out, metadata, err 11984 } 11985 11986 err = awsRestjson1_deserializeOpDocumentUpdateRouteOutput(&output, shape) 11987 if err != nil { 11988 var snapshot bytes.Buffer 11989 io.Copy(&snapshot, ringBuffer) 11990 return out, metadata, &smithy.DeserializationError{ 11991 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11992 Snapshot: snapshot.Bytes(), 11993 } 11994 } 11995 11996 return out, metadata, err 11997} 11998 11999func awsRestjson1_deserializeOpErrorUpdateRoute(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12000 var errorBuffer bytes.Buffer 12001 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12002 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12003 } 12004 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12005 12006 errorCode := "UnknownError" 12007 errorMessage := errorCode 12008 12009 code := response.Header.Get("X-Amzn-ErrorType") 12010 if len(code) != 0 { 12011 errorCode = restjson.SanitizeErrorCode(code) 12012 } 12013 12014 var buff [1024]byte 12015 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12016 12017 body := io.TeeReader(errorBody, ringBuffer) 12018 decoder := json.NewDecoder(body) 12019 decoder.UseNumber() 12020 code, message, err := restjson.GetErrorInfo(decoder) 12021 if err != nil { 12022 var snapshot bytes.Buffer 12023 io.Copy(&snapshot, ringBuffer) 12024 err = &smithy.DeserializationError{ 12025 Err: fmt.Errorf("failed to decode response body, %w", err), 12026 Snapshot: snapshot.Bytes(), 12027 } 12028 return err 12029 } 12030 12031 errorBody.Seek(0, io.SeekStart) 12032 if len(code) != 0 { 12033 errorCode = restjson.SanitizeErrorCode(code) 12034 } 12035 if len(message) != 0 { 12036 errorMessage = message 12037 } 12038 12039 switch { 12040 case strings.EqualFold("BadRequestException", errorCode): 12041 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 12042 12043 case strings.EqualFold("ConflictException", errorCode): 12044 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 12045 12046 case strings.EqualFold("NotFoundException", errorCode): 12047 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 12048 12049 case strings.EqualFold("TooManyRequestsException", errorCode): 12050 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 12051 12052 default: 12053 genericError := &smithy.GenericAPIError{ 12054 Code: errorCode, 12055 Message: errorMessage, 12056 } 12057 return genericError 12058 12059 } 12060} 12061 12062func awsRestjson1_deserializeOpDocumentUpdateRouteOutput(v **UpdateRouteOutput, value interface{}) error { 12063 if v == nil { 12064 return fmt.Errorf("unexpected nil of type %T", v) 12065 } 12066 if value == nil { 12067 return nil 12068 } 12069 12070 shape, ok := value.(map[string]interface{}) 12071 if !ok { 12072 return fmt.Errorf("unexpected JSON type %v", value) 12073 } 12074 12075 var sv *UpdateRouteOutput 12076 if *v == nil { 12077 sv = &UpdateRouteOutput{} 12078 } else { 12079 sv = *v 12080 } 12081 12082 for key, value := range shape { 12083 switch key { 12084 case "apiGatewayManaged": 12085 if value != nil { 12086 jtv, ok := value.(bool) 12087 if !ok { 12088 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 12089 } 12090 sv.ApiGatewayManaged = jtv 12091 } 12092 12093 case "apiKeyRequired": 12094 if value != nil { 12095 jtv, ok := value.(bool) 12096 if !ok { 12097 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 12098 } 12099 sv.ApiKeyRequired = jtv 12100 } 12101 12102 case "authorizationScopes": 12103 if err := awsRestjson1_deserializeDocumentAuthorizationScopes(&sv.AuthorizationScopes, value); err != nil { 12104 return err 12105 } 12106 12107 case "authorizationType": 12108 if value != nil { 12109 jtv, ok := value.(string) 12110 if !ok { 12111 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 12112 } 12113 sv.AuthorizationType = types.AuthorizationType(jtv) 12114 } 12115 12116 case "authorizerId": 12117 if value != nil { 12118 jtv, ok := value.(string) 12119 if !ok { 12120 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12121 } 12122 sv.AuthorizerId = ptr.String(jtv) 12123 } 12124 12125 case "modelSelectionExpression": 12126 if value != nil { 12127 jtv, ok := value.(string) 12128 if !ok { 12129 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 12130 } 12131 sv.ModelSelectionExpression = ptr.String(jtv) 12132 } 12133 12134 case "operationName": 12135 if value != nil { 12136 jtv, ok := value.(string) 12137 if !ok { 12138 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 12139 } 12140 sv.OperationName = ptr.String(jtv) 12141 } 12142 12143 case "requestModels": 12144 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.RequestModels, value); err != nil { 12145 return err 12146 } 12147 12148 case "requestParameters": 12149 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.RequestParameters, value); err != nil { 12150 return err 12151 } 12152 12153 case "routeId": 12154 if value != nil { 12155 jtv, ok := value.(string) 12156 if !ok { 12157 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12158 } 12159 sv.RouteId = ptr.String(jtv) 12160 } 12161 12162 case "routeKey": 12163 if value != nil { 12164 jtv, ok := value.(string) 12165 if !ok { 12166 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 12167 } 12168 sv.RouteKey = ptr.String(jtv) 12169 } 12170 12171 case "routeResponseSelectionExpression": 12172 if value != nil { 12173 jtv, ok := value.(string) 12174 if !ok { 12175 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 12176 } 12177 sv.RouteResponseSelectionExpression = ptr.String(jtv) 12178 } 12179 12180 case "target": 12181 if value != nil { 12182 jtv, ok := value.(string) 12183 if !ok { 12184 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 12185 } 12186 sv.Target = ptr.String(jtv) 12187 } 12188 12189 default: 12190 _, _ = key, value 12191 12192 } 12193 } 12194 *v = sv 12195 return nil 12196} 12197 12198type awsRestjson1_deserializeOpUpdateRouteResponse struct { 12199} 12200 12201func (*awsRestjson1_deserializeOpUpdateRouteResponse) ID() string { 12202 return "OperationDeserializer" 12203} 12204 12205func (m *awsRestjson1_deserializeOpUpdateRouteResponse) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12206 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12207) { 12208 out, metadata, err = next.HandleDeserialize(ctx, in) 12209 if err != nil { 12210 return out, metadata, err 12211 } 12212 12213 response, ok := out.RawResponse.(*smithyhttp.Response) 12214 if !ok { 12215 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12216 } 12217 12218 if response.StatusCode < 200 || response.StatusCode >= 300 { 12219 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRouteResponse(response, &metadata) 12220 } 12221 output := &UpdateRouteResponseOutput{} 12222 out.Result = output 12223 12224 var buff [1024]byte 12225 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12226 12227 body := io.TeeReader(response.Body, ringBuffer) 12228 12229 decoder := json.NewDecoder(body) 12230 decoder.UseNumber() 12231 var shape interface{} 12232 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12233 var snapshot bytes.Buffer 12234 io.Copy(&snapshot, ringBuffer) 12235 err = &smithy.DeserializationError{ 12236 Err: fmt.Errorf("failed to decode response body, %w", err), 12237 Snapshot: snapshot.Bytes(), 12238 } 12239 return out, metadata, err 12240 } 12241 12242 err = awsRestjson1_deserializeOpDocumentUpdateRouteResponseOutput(&output, shape) 12243 if err != nil { 12244 var snapshot bytes.Buffer 12245 io.Copy(&snapshot, ringBuffer) 12246 return out, metadata, &smithy.DeserializationError{ 12247 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 12248 Snapshot: snapshot.Bytes(), 12249 } 12250 } 12251 12252 return out, metadata, err 12253} 12254 12255func awsRestjson1_deserializeOpErrorUpdateRouteResponse(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12256 var errorBuffer bytes.Buffer 12257 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12258 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12259 } 12260 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12261 12262 errorCode := "UnknownError" 12263 errorMessage := errorCode 12264 12265 code := response.Header.Get("X-Amzn-ErrorType") 12266 if len(code) != 0 { 12267 errorCode = restjson.SanitizeErrorCode(code) 12268 } 12269 12270 var buff [1024]byte 12271 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12272 12273 body := io.TeeReader(errorBody, ringBuffer) 12274 decoder := json.NewDecoder(body) 12275 decoder.UseNumber() 12276 code, message, err := restjson.GetErrorInfo(decoder) 12277 if err != nil { 12278 var snapshot bytes.Buffer 12279 io.Copy(&snapshot, ringBuffer) 12280 err = &smithy.DeserializationError{ 12281 Err: fmt.Errorf("failed to decode response body, %w", err), 12282 Snapshot: snapshot.Bytes(), 12283 } 12284 return err 12285 } 12286 12287 errorBody.Seek(0, io.SeekStart) 12288 if len(code) != 0 { 12289 errorCode = restjson.SanitizeErrorCode(code) 12290 } 12291 if len(message) != 0 { 12292 errorMessage = message 12293 } 12294 12295 switch { 12296 case strings.EqualFold("BadRequestException", errorCode): 12297 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 12298 12299 case strings.EqualFold("ConflictException", errorCode): 12300 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 12301 12302 case strings.EqualFold("NotFoundException", errorCode): 12303 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 12304 12305 case strings.EqualFold("TooManyRequestsException", errorCode): 12306 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 12307 12308 default: 12309 genericError := &smithy.GenericAPIError{ 12310 Code: errorCode, 12311 Message: errorMessage, 12312 } 12313 return genericError 12314 12315 } 12316} 12317 12318func awsRestjson1_deserializeOpDocumentUpdateRouteResponseOutput(v **UpdateRouteResponseOutput, value interface{}) error { 12319 if v == nil { 12320 return fmt.Errorf("unexpected nil of type %T", v) 12321 } 12322 if value == nil { 12323 return nil 12324 } 12325 12326 shape, ok := value.(map[string]interface{}) 12327 if !ok { 12328 return fmt.Errorf("unexpected JSON type %v", value) 12329 } 12330 12331 var sv *UpdateRouteResponseOutput 12332 if *v == nil { 12333 sv = &UpdateRouteResponseOutput{} 12334 } else { 12335 sv = *v 12336 } 12337 12338 for key, value := range shape { 12339 switch key { 12340 case "modelSelectionExpression": 12341 if value != nil { 12342 jtv, ok := value.(string) 12343 if !ok { 12344 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 12345 } 12346 sv.ModelSelectionExpression = ptr.String(jtv) 12347 } 12348 12349 case "responseModels": 12350 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.ResponseModels, value); err != nil { 12351 return err 12352 } 12353 12354 case "responseParameters": 12355 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.ResponseParameters, value); err != nil { 12356 return err 12357 } 12358 12359 case "routeResponseId": 12360 if value != nil { 12361 jtv, ok := value.(string) 12362 if !ok { 12363 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12364 } 12365 sv.RouteResponseId = ptr.String(jtv) 12366 } 12367 12368 case "routeResponseKey": 12369 if value != nil { 12370 jtv, ok := value.(string) 12371 if !ok { 12372 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 12373 } 12374 sv.RouteResponseKey = ptr.String(jtv) 12375 } 12376 12377 default: 12378 _, _ = key, value 12379 12380 } 12381 } 12382 *v = sv 12383 return nil 12384} 12385 12386type awsRestjson1_deserializeOpUpdateStage struct { 12387} 12388 12389func (*awsRestjson1_deserializeOpUpdateStage) ID() string { 12390 return "OperationDeserializer" 12391} 12392 12393func (m *awsRestjson1_deserializeOpUpdateStage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12394 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12395) { 12396 out, metadata, err = next.HandleDeserialize(ctx, in) 12397 if err != nil { 12398 return out, metadata, err 12399 } 12400 12401 response, ok := out.RawResponse.(*smithyhttp.Response) 12402 if !ok { 12403 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12404 } 12405 12406 if response.StatusCode < 200 || response.StatusCode >= 300 { 12407 return out, metadata, awsRestjson1_deserializeOpErrorUpdateStage(response, &metadata) 12408 } 12409 output := &UpdateStageOutput{} 12410 out.Result = output 12411 12412 var buff [1024]byte 12413 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12414 12415 body := io.TeeReader(response.Body, ringBuffer) 12416 12417 decoder := json.NewDecoder(body) 12418 decoder.UseNumber() 12419 var shape interface{} 12420 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12421 var snapshot bytes.Buffer 12422 io.Copy(&snapshot, ringBuffer) 12423 err = &smithy.DeserializationError{ 12424 Err: fmt.Errorf("failed to decode response body, %w", err), 12425 Snapshot: snapshot.Bytes(), 12426 } 12427 return out, metadata, err 12428 } 12429 12430 err = awsRestjson1_deserializeOpDocumentUpdateStageOutput(&output, shape) 12431 if err != nil { 12432 var snapshot bytes.Buffer 12433 io.Copy(&snapshot, ringBuffer) 12434 return out, metadata, &smithy.DeserializationError{ 12435 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 12436 Snapshot: snapshot.Bytes(), 12437 } 12438 } 12439 12440 return out, metadata, err 12441} 12442 12443func awsRestjson1_deserializeOpErrorUpdateStage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12444 var errorBuffer bytes.Buffer 12445 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12446 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12447 } 12448 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12449 12450 errorCode := "UnknownError" 12451 errorMessage := errorCode 12452 12453 code := response.Header.Get("X-Amzn-ErrorType") 12454 if len(code) != 0 { 12455 errorCode = restjson.SanitizeErrorCode(code) 12456 } 12457 12458 var buff [1024]byte 12459 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12460 12461 body := io.TeeReader(errorBody, ringBuffer) 12462 decoder := json.NewDecoder(body) 12463 decoder.UseNumber() 12464 code, message, err := restjson.GetErrorInfo(decoder) 12465 if err != nil { 12466 var snapshot bytes.Buffer 12467 io.Copy(&snapshot, ringBuffer) 12468 err = &smithy.DeserializationError{ 12469 Err: fmt.Errorf("failed to decode response body, %w", err), 12470 Snapshot: snapshot.Bytes(), 12471 } 12472 return err 12473 } 12474 12475 errorBody.Seek(0, io.SeekStart) 12476 if len(code) != 0 { 12477 errorCode = restjson.SanitizeErrorCode(code) 12478 } 12479 if len(message) != 0 { 12480 errorMessage = message 12481 } 12482 12483 switch { 12484 case strings.EqualFold("BadRequestException", errorCode): 12485 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 12486 12487 case strings.EqualFold("ConflictException", errorCode): 12488 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 12489 12490 case strings.EqualFold("NotFoundException", errorCode): 12491 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 12492 12493 case strings.EqualFold("TooManyRequestsException", errorCode): 12494 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 12495 12496 default: 12497 genericError := &smithy.GenericAPIError{ 12498 Code: errorCode, 12499 Message: errorMessage, 12500 } 12501 return genericError 12502 12503 } 12504} 12505 12506func awsRestjson1_deserializeOpDocumentUpdateStageOutput(v **UpdateStageOutput, value interface{}) error { 12507 if v == nil { 12508 return fmt.Errorf("unexpected nil of type %T", v) 12509 } 12510 if value == nil { 12511 return nil 12512 } 12513 12514 shape, ok := value.(map[string]interface{}) 12515 if !ok { 12516 return fmt.Errorf("unexpected JSON type %v", value) 12517 } 12518 12519 var sv *UpdateStageOutput 12520 if *v == nil { 12521 sv = &UpdateStageOutput{} 12522 } else { 12523 sv = *v 12524 } 12525 12526 for key, value := range shape { 12527 switch key { 12528 case "accessLogSettings": 12529 if err := awsRestjson1_deserializeDocumentAccessLogSettings(&sv.AccessLogSettings, value); err != nil { 12530 return err 12531 } 12532 12533 case "apiGatewayManaged": 12534 if value != nil { 12535 jtv, ok := value.(bool) 12536 if !ok { 12537 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 12538 } 12539 sv.ApiGatewayManaged = jtv 12540 } 12541 12542 case "autoDeploy": 12543 if value != nil { 12544 jtv, ok := value.(bool) 12545 if !ok { 12546 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 12547 } 12548 sv.AutoDeploy = jtv 12549 } 12550 12551 case "clientCertificateId": 12552 if value != nil { 12553 jtv, ok := value.(string) 12554 if !ok { 12555 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12556 } 12557 sv.ClientCertificateId = ptr.String(jtv) 12558 } 12559 12560 case "createdDate": 12561 if value != nil { 12562 jtv, ok := value.(string) 12563 if !ok { 12564 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 12565 } 12566 t, err := smithytime.ParseDateTime(jtv) 12567 if err != nil { 12568 return err 12569 } 12570 sv.CreatedDate = ptr.Time(t) 12571 } 12572 12573 case "defaultRouteSettings": 12574 if err := awsRestjson1_deserializeDocumentRouteSettings(&sv.DefaultRouteSettings, value); err != nil { 12575 return err 12576 } 12577 12578 case "deploymentId": 12579 if value != nil { 12580 jtv, ok := value.(string) 12581 if !ok { 12582 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12583 } 12584 sv.DeploymentId = ptr.String(jtv) 12585 } 12586 12587 case "description": 12588 if value != nil { 12589 jtv, ok := value.(string) 12590 if !ok { 12591 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 12592 } 12593 sv.Description = ptr.String(jtv) 12594 } 12595 12596 case "lastDeploymentStatusMessage": 12597 if value != nil { 12598 jtv, ok := value.(string) 12599 if !ok { 12600 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 12601 } 12602 sv.LastDeploymentStatusMessage = ptr.String(jtv) 12603 } 12604 12605 case "lastUpdatedDate": 12606 if value != nil { 12607 jtv, ok := value.(string) 12608 if !ok { 12609 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 12610 } 12611 t, err := smithytime.ParseDateTime(jtv) 12612 if err != nil { 12613 return err 12614 } 12615 sv.LastUpdatedDate = ptr.Time(t) 12616 } 12617 12618 case "routeSettings": 12619 if err := awsRestjson1_deserializeDocumentRouteSettingsMap(&sv.RouteSettings, value); err != nil { 12620 return err 12621 } 12622 12623 case "stageName": 12624 if value != nil { 12625 jtv, ok := value.(string) 12626 if !ok { 12627 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 12628 } 12629 sv.StageName = ptr.String(jtv) 12630 } 12631 12632 case "stageVariables": 12633 if err := awsRestjson1_deserializeDocumentStageVariablesMap(&sv.StageVariables, value); err != nil { 12634 return err 12635 } 12636 12637 case "tags": 12638 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 12639 return err 12640 } 12641 12642 default: 12643 _, _ = key, value 12644 12645 } 12646 } 12647 *v = sv 12648 return nil 12649} 12650 12651type awsRestjson1_deserializeOpUpdateVpcLink struct { 12652} 12653 12654func (*awsRestjson1_deserializeOpUpdateVpcLink) ID() string { 12655 return "OperationDeserializer" 12656} 12657 12658func (m *awsRestjson1_deserializeOpUpdateVpcLink) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 12659 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 12660) { 12661 out, metadata, err = next.HandleDeserialize(ctx, in) 12662 if err != nil { 12663 return out, metadata, err 12664 } 12665 12666 response, ok := out.RawResponse.(*smithyhttp.Response) 12667 if !ok { 12668 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 12669 } 12670 12671 if response.StatusCode < 200 || response.StatusCode >= 300 { 12672 return out, metadata, awsRestjson1_deserializeOpErrorUpdateVpcLink(response, &metadata) 12673 } 12674 output := &UpdateVpcLinkOutput{} 12675 out.Result = output 12676 12677 var buff [1024]byte 12678 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12679 12680 body := io.TeeReader(response.Body, ringBuffer) 12681 12682 decoder := json.NewDecoder(body) 12683 decoder.UseNumber() 12684 var shape interface{} 12685 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12686 var snapshot bytes.Buffer 12687 io.Copy(&snapshot, ringBuffer) 12688 err = &smithy.DeserializationError{ 12689 Err: fmt.Errorf("failed to decode response body, %w", err), 12690 Snapshot: snapshot.Bytes(), 12691 } 12692 return out, metadata, err 12693 } 12694 12695 err = awsRestjson1_deserializeOpDocumentUpdateVpcLinkOutput(&output, shape) 12696 if err != nil { 12697 var snapshot bytes.Buffer 12698 io.Copy(&snapshot, ringBuffer) 12699 return out, metadata, &smithy.DeserializationError{ 12700 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 12701 Snapshot: snapshot.Bytes(), 12702 } 12703 } 12704 12705 return out, metadata, err 12706} 12707 12708func awsRestjson1_deserializeOpErrorUpdateVpcLink(response *smithyhttp.Response, metadata *middleware.Metadata) error { 12709 var errorBuffer bytes.Buffer 12710 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 12711 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 12712 } 12713 errorBody := bytes.NewReader(errorBuffer.Bytes()) 12714 12715 errorCode := "UnknownError" 12716 errorMessage := errorCode 12717 12718 code := response.Header.Get("X-Amzn-ErrorType") 12719 if len(code) != 0 { 12720 errorCode = restjson.SanitizeErrorCode(code) 12721 } 12722 12723 var buff [1024]byte 12724 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12725 12726 body := io.TeeReader(errorBody, ringBuffer) 12727 decoder := json.NewDecoder(body) 12728 decoder.UseNumber() 12729 code, message, err := restjson.GetErrorInfo(decoder) 12730 if err != nil { 12731 var snapshot bytes.Buffer 12732 io.Copy(&snapshot, ringBuffer) 12733 err = &smithy.DeserializationError{ 12734 Err: fmt.Errorf("failed to decode response body, %w", err), 12735 Snapshot: snapshot.Bytes(), 12736 } 12737 return err 12738 } 12739 12740 errorBody.Seek(0, io.SeekStart) 12741 if len(code) != 0 { 12742 errorCode = restjson.SanitizeErrorCode(code) 12743 } 12744 if len(message) != 0 { 12745 errorMessage = message 12746 } 12747 12748 switch { 12749 case strings.EqualFold("BadRequestException", errorCode): 12750 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 12751 12752 case strings.EqualFold("NotFoundException", errorCode): 12753 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 12754 12755 case strings.EqualFold("TooManyRequestsException", errorCode): 12756 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 12757 12758 default: 12759 genericError := &smithy.GenericAPIError{ 12760 Code: errorCode, 12761 Message: errorMessage, 12762 } 12763 return genericError 12764 12765 } 12766} 12767 12768func awsRestjson1_deserializeOpDocumentUpdateVpcLinkOutput(v **UpdateVpcLinkOutput, value interface{}) error { 12769 if v == nil { 12770 return fmt.Errorf("unexpected nil of type %T", v) 12771 } 12772 if value == nil { 12773 return nil 12774 } 12775 12776 shape, ok := value.(map[string]interface{}) 12777 if !ok { 12778 return fmt.Errorf("unexpected JSON type %v", value) 12779 } 12780 12781 var sv *UpdateVpcLinkOutput 12782 if *v == nil { 12783 sv = &UpdateVpcLinkOutput{} 12784 } else { 12785 sv = *v 12786 } 12787 12788 for key, value := range shape { 12789 switch key { 12790 case "createdDate": 12791 if value != nil { 12792 jtv, ok := value.(string) 12793 if !ok { 12794 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 12795 } 12796 t, err := smithytime.ParseDateTime(jtv) 12797 if err != nil { 12798 return err 12799 } 12800 sv.CreatedDate = ptr.Time(t) 12801 } 12802 12803 case "name": 12804 if value != nil { 12805 jtv, ok := value.(string) 12806 if !ok { 12807 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 12808 } 12809 sv.Name = ptr.String(jtv) 12810 } 12811 12812 case "securityGroupIds": 12813 if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { 12814 return err 12815 } 12816 12817 case "subnetIds": 12818 if err := awsRestjson1_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil { 12819 return err 12820 } 12821 12822 case "tags": 12823 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 12824 return err 12825 } 12826 12827 case "vpcLinkId": 12828 if value != nil { 12829 jtv, ok := value.(string) 12830 if !ok { 12831 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12832 } 12833 sv.VpcLinkId = ptr.String(jtv) 12834 } 12835 12836 case "vpcLinkStatus": 12837 if value != nil { 12838 jtv, ok := value.(string) 12839 if !ok { 12840 return fmt.Errorf("expected VpcLinkStatus to be of type string, got %T instead", value) 12841 } 12842 sv.VpcLinkStatus = types.VpcLinkStatus(jtv) 12843 } 12844 12845 case "vpcLinkStatusMessage": 12846 if value != nil { 12847 jtv, ok := value.(string) 12848 if !ok { 12849 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 12850 } 12851 sv.VpcLinkStatusMessage = ptr.String(jtv) 12852 } 12853 12854 case "vpcLinkVersion": 12855 if value != nil { 12856 jtv, ok := value.(string) 12857 if !ok { 12858 return fmt.Errorf("expected VpcLinkVersion to be of type string, got %T instead", value) 12859 } 12860 sv.VpcLinkVersion = types.VpcLinkVersion(jtv) 12861 } 12862 12863 default: 12864 _, _ = key, value 12865 12866 } 12867 } 12868 *v = sv 12869 return nil 12870} 12871 12872func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 12873 output := &types.AccessDeniedException{} 12874 var buff [1024]byte 12875 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12876 12877 body := io.TeeReader(errorBody, ringBuffer) 12878 decoder := json.NewDecoder(body) 12879 decoder.UseNumber() 12880 var shape interface{} 12881 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12882 var snapshot bytes.Buffer 12883 io.Copy(&snapshot, ringBuffer) 12884 err = &smithy.DeserializationError{ 12885 Err: fmt.Errorf("failed to decode response body, %w", err), 12886 Snapshot: snapshot.Bytes(), 12887 } 12888 return err 12889 } 12890 12891 err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) 12892 12893 if err != nil { 12894 var snapshot bytes.Buffer 12895 io.Copy(&snapshot, ringBuffer) 12896 err = &smithy.DeserializationError{ 12897 Err: fmt.Errorf("failed to decode response body, %w", err), 12898 Snapshot: snapshot.Bytes(), 12899 } 12900 return err 12901 } 12902 12903 errorBody.Seek(0, io.SeekStart) 12904 12905 return output 12906} 12907 12908func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 12909 output := &types.BadRequestException{} 12910 var buff [1024]byte 12911 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12912 12913 body := io.TeeReader(errorBody, ringBuffer) 12914 decoder := json.NewDecoder(body) 12915 decoder.UseNumber() 12916 var shape interface{} 12917 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12918 var snapshot bytes.Buffer 12919 io.Copy(&snapshot, ringBuffer) 12920 err = &smithy.DeserializationError{ 12921 Err: fmt.Errorf("failed to decode response body, %w", err), 12922 Snapshot: snapshot.Bytes(), 12923 } 12924 return err 12925 } 12926 12927 err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape) 12928 12929 if err != nil { 12930 var snapshot bytes.Buffer 12931 io.Copy(&snapshot, ringBuffer) 12932 err = &smithy.DeserializationError{ 12933 Err: fmt.Errorf("failed to decode response body, %w", err), 12934 Snapshot: snapshot.Bytes(), 12935 } 12936 return err 12937 } 12938 12939 errorBody.Seek(0, io.SeekStart) 12940 12941 return output 12942} 12943 12944func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 12945 output := &types.ConflictException{} 12946 var buff [1024]byte 12947 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12948 12949 body := io.TeeReader(errorBody, ringBuffer) 12950 decoder := json.NewDecoder(body) 12951 decoder.UseNumber() 12952 var shape interface{} 12953 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12954 var snapshot bytes.Buffer 12955 io.Copy(&snapshot, ringBuffer) 12956 err = &smithy.DeserializationError{ 12957 Err: fmt.Errorf("failed to decode response body, %w", err), 12958 Snapshot: snapshot.Bytes(), 12959 } 12960 return err 12961 } 12962 12963 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 12964 12965 if err != nil { 12966 var snapshot bytes.Buffer 12967 io.Copy(&snapshot, ringBuffer) 12968 err = &smithy.DeserializationError{ 12969 Err: fmt.Errorf("failed to decode response body, %w", err), 12970 Snapshot: snapshot.Bytes(), 12971 } 12972 return err 12973 } 12974 12975 errorBody.Seek(0, io.SeekStart) 12976 12977 return output 12978} 12979 12980func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 12981 output := &types.NotFoundException{} 12982 var buff [1024]byte 12983 ringBuffer := smithyio.NewRingBuffer(buff[:]) 12984 12985 body := io.TeeReader(errorBody, ringBuffer) 12986 decoder := json.NewDecoder(body) 12987 decoder.UseNumber() 12988 var shape interface{} 12989 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 12990 var snapshot bytes.Buffer 12991 io.Copy(&snapshot, ringBuffer) 12992 err = &smithy.DeserializationError{ 12993 Err: fmt.Errorf("failed to decode response body, %w", err), 12994 Snapshot: snapshot.Bytes(), 12995 } 12996 return err 12997 } 12998 12999 err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape) 13000 13001 if err != nil { 13002 var snapshot bytes.Buffer 13003 io.Copy(&snapshot, ringBuffer) 13004 err = &smithy.DeserializationError{ 13005 Err: fmt.Errorf("failed to decode response body, %w", err), 13006 Snapshot: snapshot.Bytes(), 13007 } 13008 return err 13009 } 13010 13011 errorBody.Seek(0, io.SeekStart) 13012 13013 return output 13014} 13015 13016func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 13017 output := &types.TooManyRequestsException{} 13018 var buff [1024]byte 13019 ringBuffer := smithyio.NewRingBuffer(buff[:]) 13020 13021 body := io.TeeReader(errorBody, ringBuffer) 13022 decoder := json.NewDecoder(body) 13023 decoder.UseNumber() 13024 var shape interface{} 13025 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 13026 var snapshot bytes.Buffer 13027 io.Copy(&snapshot, ringBuffer) 13028 err = &smithy.DeserializationError{ 13029 Err: fmt.Errorf("failed to decode response body, %w", err), 13030 Snapshot: snapshot.Bytes(), 13031 } 13032 return err 13033 } 13034 13035 err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape) 13036 13037 if err != nil { 13038 var snapshot bytes.Buffer 13039 io.Copy(&snapshot, ringBuffer) 13040 err = &smithy.DeserializationError{ 13041 Err: fmt.Errorf("failed to decode response body, %w", err), 13042 Snapshot: snapshot.Bytes(), 13043 } 13044 return err 13045 } 13046 13047 errorBody.Seek(0, io.SeekStart) 13048 13049 return output 13050} 13051 13052func awsRestjson1_deserializeDocument__listOf__string(v *[]string, value interface{}) error { 13053 if v == nil { 13054 return fmt.Errorf("unexpected nil of type %T", v) 13055 } 13056 if value == nil { 13057 return nil 13058 } 13059 13060 shape, ok := value.([]interface{}) 13061 if !ok { 13062 return fmt.Errorf("unexpected JSON type %v", value) 13063 } 13064 13065 var cv []string 13066 if *v == nil { 13067 cv = []string{} 13068 } else { 13069 cv = *v 13070 } 13071 13072 for _, value := range shape { 13073 var col string 13074 if value != nil { 13075 jtv, ok := value.(string) 13076 if !ok { 13077 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 13078 } 13079 col = jtv 13080 } 13081 cv = append(cv, col) 13082 13083 } 13084 *v = cv 13085 return nil 13086} 13087 13088func awsRestjson1_deserializeDocument__listOfApi(v *[]types.Api, value interface{}) error { 13089 if v == nil { 13090 return fmt.Errorf("unexpected nil of type %T", v) 13091 } 13092 if value == nil { 13093 return nil 13094 } 13095 13096 shape, ok := value.([]interface{}) 13097 if !ok { 13098 return fmt.Errorf("unexpected JSON type %v", value) 13099 } 13100 13101 var cv []types.Api 13102 if *v == nil { 13103 cv = []types.Api{} 13104 } else { 13105 cv = *v 13106 } 13107 13108 for _, value := range shape { 13109 var col types.Api 13110 destAddr := &col 13111 if err := awsRestjson1_deserializeDocumentApi(&destAddr, value); err != nil { 13112 return err 13113 } 13114 col = *destAddr 13115 cv = append(cv, col) 13116 13117 } 13118 *v = cv 13119 return nil 13120} 13121 13122func awsRestjson1_deserializeDocument__listOfApiMapping(v *[]types.ApiMapping, value interface{}) error { 13123 if v == nil { 13124 return fmt.Errorf("unexpected nil of type %T", v) 13125 } 13126 if value == nil { 13127 return nil 13128 } 13129 13130 shape, ok := value.([]interface{}) 13131 if !ok { 13132 return fmt.Errorf("unexpected JSON type %v", value) 13133 } 13134 13135 var cv []types.ApiMapping 13136 if *v == nil { 13137 cv = []types.ApiMapping{} 13138 } else { 13139 cv = *v 13140 } 13141 13142 for _, value := range shape { 13143 var col types.ApiMapping 13144 destAddr := &col 13145 if err := awsRestjson1_deserializeDocumentApiMapping(&destAddr, value); err != nil { 13146 return err 13147 } 13148 col = *destAddr 13149 cv = append(cv, col) 13150 13151 } 13152 *v = cv 13153 return nil 13154} 13155 13156func awsRestjson1_deserializeDocument__listOfAuthorizer(v *[]types.Authorizer, value interface{}) error { 13157 if v == nil { 13158 return fmt.Errorf("unexpected nil of type %T", v) 13159 } 13160 if value == nil { 13161 return nil 13162 } 13163 13164 shape, ok := value.([]interface{}) 13165 if !ok { 13166 return fmt.Errorf("unexpected JSON type %v", value) 13167 } 13168 13169 var cv []types.Authorizer 13170 if *v == nil { 13171 cv = []types.Authorizer{} 13172 } else { 13173 cv = *v 13174 } 13175 13176 for _, value := range shape { 13177 var col types.Authorizer 13178 destAddr := &col 13179 if err := awsRestjson1_deserializeDocumentAuthorizer(&destAddr, value); err != nil { 13180 return err 13181 } 13182 col = *destAddr 13183 cv = append(cv, col) 13184 13185 } 13186 *v = cv 13187 return nil 13188} 13189 13190func awsRestjson1_deserializeDocument__listOfDeployment(v *[]types.Deployment, value interface{}) error { 13191 if v == nil { 13192 return fmt.Errorf("unexpected nil of type %T", v) 13193 } 13194 if value == nil { 13195 return nil 13196 } 13197 13198 shape, ok := value.([]interface{}) 13199 if !ok { 13200 return fmt.Errorf("unexpected JSON type %v", value) 13201 } 13202 13203 var cv []types.Deployment 13204 if *v == nil { 13205 cv = []types.Deployment{} 13206 } else { 13207 cv = *v 13208 } 13209 13210 for _, value := range shape { 13211 var col types.Deployment 13212 destAddr := &col 13213 if err := awsRestjson1_deserializeDocumentDeployment(&destAddr, value); err != nil { 13214 return err 13215 } 13216 col = *destAddr 13217 cv = append(cv, col) 13218 13219 } 13220 *v = cv 13221 return nil 13222} 13223 13224func awsRestjson1_deserializeDocument__listOfDomainName(v *[]types.DomainName, value interface{}) error { 13225 if v == nil { 13226 return fmt.Errorf("unexpected nil of type %T", v) 13227 } 13228 if value == nil { 13229 return nil 13230 } 13231 13232 shape, ok := value.([]interface{}) 13233 if !ok { 13234 return fmt.Errorf("unexpected JSON type %v", value) 13235 } 13236 13237 var cv []types.DomainName 13238 if *v == nil { 13239 cv = []types.DomainName{} 13240 } else { 13241 cv = *v 13242 } 13243 13244 for _, value := range shape { 13245 var col types.DomainName 13246 destAddr := &col 13247 if err := awsRestjson1_deserializeDocumentDomainName(&destAddr, value); err != nil { 13248 return err 13249 } 13250 col = *destAddr 13251 cv = append(cv, col) 13252 13253 } 13254 *v = cv 13255 return nil 13256} 13257 13258func awsRestjson1_deserializeDocument__listOfIntegration(v *[]types.Integration, value interface{}) error { 13259 if v == nil { 13260 return fmt.Errorf("unexpected nil of type %T", v) 13261 } 13262 if value == nil { 13263 return nil 13264 } 13265 13266 shape, ok := value.([]interface{}) 13267 if !ok { 13268 return fmt.Errorf("unexpected JSON type %v", value) 13269 } 13270 13271 var cv []types.Integration 13272 if *v == nil { 13273 cv = []types.Integration{} 13274 } else { 13275 cv = *v 13276 } 13277 13278 for _, value := range shape { 13279 var col types.Integration 13280 destAddr := &col 13281 if err := awsRestjson1_deserializeDocumentIntegration(&destAddr, value); err != nil { 13282 return err 13283 } 13284 col = *destAddr 13285 cv = append(cv, col) 13286 13287 } 13288 *v = cv 13289 return nil 13290} 13291 13292func awsRestjson1_deserializeDocument__listOfIntegrationResponse(v *[]types.IntegrationResponse, value interface{}) error { 13293 if v == nil { 13294 return fmt.Errorf("unexpected nil of type %T", v) 13295 } 13296 if value == nil { 13297 return nil 13298 } 13299 13300 shape, ok := value.([]interface{}) 13301 if !ok { 13302 return fmt.Errorf("unexpected JSON type %v", value) 13303 } 13304 13305 var cv []types.IntegrationResponse 13306 if *v == nil { 13307 cv = []types.IntegrationResponse{} 13308 } else { 13309 cv = *v 13310 } 13311 13312 for _, value := range shape { 13313 var col types.IntegrationResponse 13314 destAddr := &col 13315 if err := awsRestjson1_deserializeDocumentIntegrationResponse(&destAddr, value); err != nil { 13316 return err 13317 } 13318 col = *destAddr 13319 cv = append(cv, col) 13320 13321 } 13322 *v = cv 13323 return nil 13324} 13325 13326func awsRestjson1_deserializeDocument__listOfModel(v *[]types.Model, value interface{}) error { 13327 if v == nil { 13328 return fmt.Errorf("unexpected nil of type %T", v) 13329 } 13330 if value == nil { 13331 return nil 13332 } 13333 13334 shape, ok := value.([]interface{}) 13335 if !ok { 13336 return fmt.Errorf("unexpected JSON type %v", value) 13337 } 13338 13339 var cv []types.Model 13340 if *v == nil { 13341 cv = []types.Model{} 13342 } else { 13343 cv = *v 13344 } 13345 13346 for _, value := range shape { 13347 var col types.Model 13348 destAddr := &col 13349 if err := awsRestjson1_deserializeDocumentModel(&destAddr, value); err != nil { 13350 return err 13351 } 13352 col = *destAddr 13353 cv = append(cv, col) 13354 13355 } 13356 *v = cv 13357 return nil 13358} 13359 13360func awsRestjson1_deserializeDocument__listOfRoute(v *[]types.Route, value interface{}) error { 13361 if v == nil { 13362 return fmt.Errorf("unexpected nil of type %T", v) 13363 } 13364 if value == nil { 13365 return nil 13366 } 13367 13368 shape, ok := value.([]interface{}) 13369 if !ok { 13370 return fmt.Errorf("unexpected JSON type %v", value) 13371 } 13372 13373 var cv []types.Route 13374 if *v == nil { 13375 cv = []types.Route{} 13376 } else { 13377 cv = *v 13378 } 13379 13380 for _, value := range shape { 13381 var col types.Route 13382 destAddr := &col 13383 if err := awsRestjson1_deserializeDocumentRoute(&destAddr, value); err != nil { 13384 return err 13385 } 13386 col = *destAddr 13387 cv = append(cv, col) 13388 13389 } 13390 *v = cv 13391 return nil 13392} 13393 13394func awsRestjson1_deserializeDocument__listOfRouteResponse(v *[]types.RouteResponse, value interface{}) error { 13395 if v == nil { 13396 return fmt.Errorf("unexpected nil of type %T", v) 13397 } 13398 if value == nil { 13399 return nil 13400 } 13401 13402 shape, ok := value.([]interface{}) 13403 if !ok { 13404 return fmt.Errorf("unexpected JSON type %v", value) 13405 } 13406 13407 var cv []types.RouteResponse 13408 if *v == nil { 13409 cv = []types.RouteResponse{} 13410 } else { 13411 cv = *v 13412 } 13413 13414 for _, value := range shape { 13415 var col types.RouteResponse 13416 destAddr := &col 13417 if err := awsRestjson1_deserializeDocumentRouteResponse(&destAddr, value); err != nil { 13418 return err 13419 } 13420 col = *destAddr 13421 cv = append(cv, col) 13422 13423 } 13424 *v = cv 13425 return nil 13426} 13427 13428func awsRestjson1_deserializeDocument__listOfStage(v *[]types.Stage, value interface{}) error { 13429 if v == nil { 13430 return fmt.Errorf("unexpected nil of type %T", v) 13431 } 13432 if value == nil { 13433 return nil 13434 } 13435 13436 shape, ok := value.([]interface{}) 13437 if !ok { 13438 return fmt.Errorf("unexpected JSON type %v", value) 13439 } 13440 13441 var cv []types.Stage 13442 if *v == nil { 13443 cv = []types.Stage{} 13444 } else { 13445 cv = *v 13446 } 13447 13448 for _, value := range shape { 13449 var col types.Stage 13450 destAddr := &col 13451 if err := awsRestjson1_deserializeDocumentStage(&destAddr, value); err != nil { 13452 return err 13453 } 13454 col = *destAddr 13455 cv = append(cv, col) 13456 13457 } 13458 *v = cv 13459 return nil 13460} 13461 13462func awsRestjson1_deserializeDocument__listOfVpcLink(v *[]types.VpcLink, value interface{}) error { 13463 if v == nil { 13464 return fmt.Errorf("unexpected nil of type %T", v) 13465 } 13466 if value == nil { 13467 return nil 13468 } 13469 13470 shape, ok := value.([]interface{}) 13471 if !ok { 13472 return fmt.Errorf("unexpected JSON type %v", value) 13473 } 13474 13475 var cv []types.VpcLink 13476 if *v == nil { 13477 cv = []types.VpcLink{} 13478 } else { 13479 cv = *v 13480 } 13481 13482 for _, value := range shape { 13483 var col types.VpcLink 13484 destAddr := &col 13485 if err := awsRestjson1_deserializeDocumentVpcLink(&destAddr, value); err != nil { 13486 return err 13487 } 13488 col = *destAddr 13489 cv = append(cv, col) 13490 13491 } 13492 *v = cv 13493 return nil 13494} 13495 13496func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { 13497 if v == nil { 13498 return fmt.Errorf("unexpected nil of type %T", v) 13499 } 13500 if value == nil { 13501 return nil 13502 } 13503 13504 shape, ok := value.(map[string]interface{}) 13505 if !ok { 13506 return fmt.Errorf("unexpected JSON type %v", value) 13507 } 13508 13509 var sv *types.AccessDeniedException 13510 if *v == nil { 13511 sv = &types.AccessDeniedException{} 13512 } else { 13513 sv = *v 13514 } 13515 13516 for key, value := range shape { 13517 switch key { 13518 case "message": 13519 if value != nil { 13520 jtv, ok := value.(string) 13521 if !ok { 13522 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 13523 } 13524 sv.Message = ptr.String(jtv) 13525 } 13526 13527 default: 13528 _, _ = key, value 13529 13530 } 13531 } 13532 *v = sv 13533 return nil 13534} 13535 13536func awsRestjson1_deserializeDocumentAccessLogSettings(v **types.AccessLogSettings, value interface{}) error { 13537 if v == nil { 13538 return fmt.Errorf("unexpected nil of type %T", v) 13539 } 13540 if value == nil { 13541 return nil 13542 } 13543 13544 shape, ok := value.(map[string]interface{}) 13545 if !ok { 13546 return fmt.Errorf("unexpected JSON type %v", value) 13547 } 13548 13549 var sv *types.AccessLogSettings 13550 if *v == nil { 13551 sv = &types.AccessLogSettings{} 13552 } else { 13553 sv = *v 13554 } 13555 13556 for key, value := range shape { 13557 switch key { 13558 case "destinationArn": 13559 if value != nil { 13560 jtv, ok := value.(string) 13561 if !ok { 13562 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13563 } 13564 sv.DestinationArn = ptr.String(jtv) 13565 } 13566 13567 case "format": 13568 if value != nil { 13569 jtv, ok := value.(string) 13570 if !ok { 13571 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 13572 } 13573 sv.Format = ptr.String(jtv) 13574 } 13575 13576 default: 13577 _, _ = key, value 13578 13579 } 13580 } 13581 *v = sv 13582 return nil 13583} 13584 13585func awsRestjson1_deserializeDocumentApi(v **types.Api, value interface{}) error { 13586 if v == nil { 13587 return fmt.Errorf("unexpected nil of type %T", v) 13588 } 13589 if value == nil { 13590 return nil 13591 } 13592 13593 shape, ok := value.(map[string]interface{}) 13594 if !ok { 13595 return fmt.Errorf("unexpected JSON type %v", value) 13596 } 13597 13598 var sv *types.Api 13599 if *v == nil { 13600 sv = &types.Api{} 13601 } else { 13602 sv = *v 13603 } 13604 13605 for key, value := range shape { 13606 switch key { 13607 case "apiEndpoint": 13608 if value != nil { 13609 jtv, ok := value.(string) 13610 if !ok { 13611 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 13612 } 13613 sv.ApiEndpoint = ptr.String(jtv) 13614 } 13615 13616 case "apiGatewayManaged": 13617 if value != nil { 13618 jtv, ok := value.(bool) 13619 if !ok { 13620 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 13621 } 13622 sv.ApiGatewayManaged = jtv 13623 } 13624 13625 case "apiId": 13626 if value != nil { 13627 jtv, ok := value.(string) 13628 if !ok { 13629 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13630 } 13631 sv.ApiId = ptr.String(jtv) 13632 } 13633 13634 case "apiKeySelectionExpression": 13635 if value != nil { 13636 jtv, ok := value.(string) 13637 if !ok { 13638 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 13639 } 13640 sv.ApiKeySelectionExpression = ptr.String(jtv) 13641 } 13642 13643 case "corsConfiguration": 13644 if err := awsRestjson1_deserializeDocumentCors(&sv.CorsConfiguration, value); err != nil { 13645 return err 13646 } 13647 13648 case "createdDate": 13649 if value != nil { 13650 jtv, ok := value.(string) 13651 if !ok { 13652 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 13653 } 13654 t, err := smithytime.ParseDateTime(jtv) 13655 if err != nil { 13656 return err 13657 } 13658 sv.CreatedDate = ptr.Time(t) 13659 } 13660 13661 case "description": 13662 if value != nil { 13663 jtv, ok := value.(string) 13664 if !ok { 13665 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 13666 } 13667 sv.Description = ptr.String(jtv) 13668 } 13669 13670 case "disableExecuteApiEndpoint": 13671 if value != nil { 13672 jtv, ok := value.(bool) 13673 if !ok { 13674 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 13675 } 13676 sv.DisableExecuteApiEndpoint = jtv 13677 } 13678 13679 case "disableSchemaValidation": 13680 if value != nil { 13681 jtv, ok := value.(bool) 13682 if !ok { 13683 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 13684 } 13685 sv.DisableSchemaValidation = jtv 13686 } 13687 13688 case "importInfo": 13689 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ImportInfo, value); err != nil { 13690 return err 13691 } 13692 13693 case "name": 13694 if value != nil { 13695 jtv, ok := value.(string) 13696 if !ok { 13697 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 13698 } 13699 sv.Name = ptr.String(jtv) 13700 } 13701 13702 case "protocolType": 13703 if value != nil { 13704 jtv, ok := value.(string) 13705 if !ok { 13706 return fmt.Errorf("expected ProtocolType to be of type string, got %T instead", value) 13707 } 13708 sv.ProtocolType = types.ProtocolType(jtv) 13709 } 13710 13711 case "routeSelectionExpression": 13712 if value != nil { 13713 jtv, ok := value.(string) 13714 if !ok { 13715 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 13716 } 13717 sv.RouteSelectionExpression = ptr.String(jtv) 13718 } 13719 13720 case "tags": 13721 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 13722 return err 13723 } 13724 13725 case "version": 13726 if value != nil { 13727 jtv, ok := value.(string) 13728 if !ok { 13729 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 13730 } 13731 sv.Version = ptr.String(jtv) 13732 } 13733 13734 case "warnings": 13735 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Warnings, value); err != nil { 13736 return err 13737 } 13738 13739 default: 13740 _, _ = key, value 13741 13742 } 13743 } 13744 *v = sv 13745 return nil 13746} 13747 13748func awsRestjson1_deserializeDocumentApiMapping(v **types.ApiMapping, value interface{}) error { 13749 if v == nil { 13750 return fmt.Errorf("unexpected nil of type %T", v) 13751 } 13752 if value == nil { 13753 return nil 13754 } 13755 13756 shape, ok := value.(map[string]interface{}) 13757 if !ok { 13758 return fmt.Errorf("unexpected JSON type %v", value) 13759 } 13760 13761 var sv *types.ApiMapping 13762 if *v == nil { 13763 sv = &types.ApiMapping{} 13764 } else { 13765 sv = *v 13766 } 13767 13768 for key, value := range shape { 13769 switch key { 13770 case "apiId": 13771 if value != nil { 13772 jtv, ok := value.(string) 13773 if !ok { 13774 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13775 } 13776 sv.ApiId = ptr.String(jtv) 13777 } 13778 13779 case "apiMappingId": 13780 if value != nil { 13781 jtv, ok := value.(string) 13782 if !ok { 13783 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13784 } 13785 sv.ApiMappingId = ptr.String(jtv) 13786 } 13787 13788 case "apiMappingKey": 13789 if value != nil { 13790 jtv, ok := value.(string) 13791 if !ok { 13792 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 13793 } 13794 sv.ApiMappingKey = ptr.String(jtv) 13795 } 13796 13797 case "stage": 13798 if value != nil { 13799 jtv, ok := value.(string) 13800 if !ok { 13801 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 13802 } 13803 sv.Stage = ptr.String(jtv) 13804 } 13805 13806 default: 13807 _, _ = key, value 13808 13809 } 13810 } 13811 *v = sv 13812 return nil 13813} 13814 13815func awsRestjson1_deserializeDocumentAuthorizationScopes(v *[]string, value interface{}) error { 13816 if v == nil { 13817 return fmt.Errorf("unexpected nil of type %T", v) 13818 } 13819 if value == nil { 13820 return nil 13821 } 13822 13823 shape, ok := value.([]interface{}) 13824 if !ok { 13825 return fmt.Errorf("unexpected JSON type %v", value) 13826 } 13827 13828 var cv []string 13829 if *v == nil { 13830 cv = []string{} 13831 } else { 13832 cv = *v 13833 } 13834 13835 for _, value := range shape { 13836 var col string 13837 if value != nil { 13838 jtv, ok := value.(string) 13839 if !ok { 13840 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 13841 } 13842 col = jtv 13843 } 13844 cv = append(cv, col) 13845 13846 } 13847 *v = cv 13848 return nil 13849} 13850 13851func awsRestjson1_deserializeDocumentAuthorizer(v **types.Authorizer, value interface{}) error { 13852 if v == nil { 13853 return fmt.Errorf("unexpected nil of type %T", v) 13854 } 13855 if value == nil { 13856 return nil 13857 } 13858 13859 shape, ok := value.(map[string]interface{}) 13860 if !ok { 13861 return fmt.Errorf("unexpected JSON type %v", value) 13862 } 13863 13864 var sv *types.Authorizer 13865 if *v == nil { 13866 sv = &types.Authorizer{} 13867 } else { 13868 sv = *v 13869 } 13870 13871 for key, value := range shape { 13872 switch key { 13873 case "authorizerCredentialsArn": 13874 if value != nil { 13875 jtv, ok := value.(string) 13876 if !ok { 13877 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 13878 } 13879 sv.AuthorizerCredentialsArn = ptr.String(jtv) 13880 } 13881 13882 case "authorizerId": 13883 if value != nil { 13884 jtv, ok := value.(string) 13885 if !ok { 13886 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13887 } 13888 sv.AuthorizerId = ptr.String(jtv) 13889 } 13890 13891 case "authorizerPayloadFormatVersion": 13892 if value != nil { 13893 jtv, ok := value.(string) 13894 if !ok { 13895 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 13896 } 13897 sv.AuthorizerPayloadFormatVersion = ptr.String(jtv) 13898 } 13899 13900 case "authorizerResultTtlInSeconds": 13901 if value != nil { 13902 jtv, ok := value.(json.Number) 13903 if !ok { 13904 return fmt.Errorf("expected IntegerWithLengthBetween0And3600 to be json.Number, got %T instead", value) 13905 } 13906 i64, err := jtv.Int64() 13907 if err != nil { 13908 return err 13909 } 13910 sv.AuthorizerResultTtlInSeconds = int32(i64) 13911 } 13912 13913 case "authorizerType": 13914 if value != nil { 13915 jtv, ok := value.(string) 13916 if !ok { 13917 return fmt.Errorf("expected AuthorizerType to be of type string, got %T instead", value) 13918 } 13919 sv.AuthorizerType = types.AuthorizerType(jtv) 13920 } 13921 13922 case "authorizerUri": 13923 if value != nil { 13924 jtv, ok := value.(string) 13925 if !ok { 13926 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 13927 } 13928 sv.AuthorizerUri = ptr.String(jtv) 13929 } 13930 13931 case "enableSimpleResponses": 13932 if value != nil { 13933 jtv, ok := value.(bool) 13934 if !ok { 13935 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 13936 } 13937 sv.EnableSimpleResponses = jtv 13938 } 13939 13940 case "identitySource": 13941 if err := awsRestjson1_deserializeDocumentIdentitySourceList(&sv.IdentitySource, value); err != nil { 13942 return err 13943 } 13944 13945 case "identityValidationExpression": 13946 if value != nil { 13947 jtv, ok := value.(string) 13948 if !ok { 13949 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 13950 } 13951 sv.IdentityValidationExpression = ptr.String(jtv) 13952 } 13953 13954 case "jwtConfiguration": 13955 if err := awsRestjson1_deserializeDocumentJWTConfiguration(&sv.JwtConfiguration, value); err != nil { 13956 return err 13957 } 13958 13959 case "name": 13960 if value != nil { 13961 jtv, ok := value.(string) 13962 if !ok { 13963 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 13964 } 13965 sv.Name = ptr.String(jtv) 13966 } 13967 13968 default: 13969 _, _ = key, value 13970 13971 } 13972 } 13973 *v = sv 13974 return nil 13975} 13976 13977func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 13978 if v == nil { 13979 return fmt.Errorf("unexpected nil of type %T", v) 13980 } 13981 if value == nil { 13982 return nil 13983 } 13984 13985 shape, ok := value.(map[string]interface{}) 13986 if !ok { 13987 return fmt.Errorf("unexpected JSON type %v", value) 13988 } 13989 13990 var sv *types.BadRequestException 13991 if *v == nil { 13992 sv = &types.BadRequestException{} 13993 } else { 13994 sv = *v 13995 } 13996 13997 for key, value := range shape { 13998 switch key { 13999 case "message": 14000 if value != nil { 14001 jtv, ok := value.(string) 14002 if !ok { 14003 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14004 } 14005 sv.Message = ptr.String(jtv) 14006 } 14007 14008 default: 14009 _, _ = key, value 14010 14011 } 14012 } 14013 *v = sv 14014 return nil 14015} 14016 14017func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 14018 if v == nil { 14019 return fmt.Errorf("unexpected nil of type %T", v) 14020 } 14021 if value == nil { 14022 return nil 14023 } 14024 14025 shape, ok := value.(map[string]interface{}) 14026 if !ok { 14027 return fmt.Errorf("unexpected JSON type %v", value) 14028 } 14029 14030 var sv *types.ConflictException 14031 if *v == nil { 14032 sv = &types.ConflictException{} 14033 } else { 14034 sv = *v 14035 } 14036 14037 for key, value := range shape { 14038 switch key { 14039 case "message": 14040 if value != nil { 14041 jtv, ok := value.(string) 14042 if !ok { 14043 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14044 } 14045 sv.Message = ptr.String(jtv) 14046 } 14047 14048 default: 14049 _, _ = key, value 14050 14051 } 14052 } 14053 *v = sv 14054 return nil 14055} 14056 14057func awsRestjson1_deserializeDocumentCors(v **types.Cors, value interface{}) error { 14058 if v == nil { 14059 return fmt.Errorf("unexpected nil of type %T", v) 14060 } 14061 if value == nil { 14062 return nil 14063 } 14064 14065 shape, ok := value.(map[string]interface{}) 14066 if !ok { 14067 return fmt.Errorf("unexpected JSON type %v", value) 14068 } 14069 14070 var sv *types.Cors 14071 if *v == nil { 14072 sv = &types.Cors{} 14073 } else { 14074 sv = *v 14075 } 14076 14077 for key, value := range shape { 14078 switch key { 14079 case "allowCredentials": 14080 if value != nil { 14081 jtv, ok := value.(bool) 14082 if !ok { 14083 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 14084 } 14085 sv.AllowCredentials = jtv 14086 } 14087 14088 case "allowHeaders": 14089 if err := awsRestjson1_deserializeDocumentCorsHeaderList(&sv.AllowHeaders, value); err != nil { 14090 return err 14091 } 14092 14093 case "allowMethods": 14094 if err := awsRestjson1_deserializeDocumentCorsMethodList(&sv.AllowMethods, value); err != nil { 14095 return err 14096 } 14097 14098 case "allowOrigins": 14099 if err := awsRestjson1_deserializeDocumentCorsOriginList(&sv.AllowOrigins, value); err != nil { 14100 return err 14101 } 14102 14103 case "exposeHeaders": 14104 if err := awsRestjson1_deserializeDocumentCorsHeaderList(&sv.ExposeHeaders, value); err != nil { 14105 return err 14106 } 14107 14108 case "maxAge": 14109 if value != nil { 14110 jtv, ok := value.(json.Number) 14111 if !ok { 14112 return fmt.Errorf("expected IntegerWithLengthBetweenMinus1And86400 to be json.Number, got %T instead", value) 14113 } 14114 i64, err := jtv.Int64() 14115 if err != nil { 14116 return err 14117 } 14118 sv.MaxAge = int32(i64) 14119 } 14120 14121 default: 14122 _, _ = key, value 14123 14124 } 14125 } 14126 *v = sv 14127 return nil 14128} 14129 14130func awsRestjson1_deserializeDocumentCorsHeaderList(v *[]string, value interface{}) error { 14131 if v == nil { 14132 return fmt.Errorf("unexpected nil of type %T", v) 14133 } 14134 if value == nil { 14135 return nil 14136 } 14137 14138 shape, ok := value.([]interface{}) 14139 if !ok { 14140 return fmt.Errorf("unexpected JSON type %v", value) 14141 } 14142 14143 var cv []string 14144 if *v == nil { 14145 cv = []string{} 14146 } else { 14147 cv = *v 14148 } 14149 14150 for _, value := range shape { 14151 var col string 14152 if value != nil { 14153 jtv, ok := value.(string) 14154 if !ok { 14155 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14156 } 14157 col = jtv 14158 } 14159 cv = append(cv, col) 14160 14161 } 14162 *v = cv 14163 return nil 14164} 14165 14166func awsRestjson1_deserializeDocumentCorsMethodList(v *[]string, value interface{}) error { 14167 if v == nil { 14168 return fmt.Errorf("unexpected nil of type %T", v) 14169 } 14170 if value == nil { 14171 return nil 14172 } 14173 14174 shape, ok := value.([]interface{}) 14175 if !ok { 14176 return fmt.Errorf("unexpected JSON type %v", value) 14177 } 14178 14179 var cv []string 14180 if *v == nil { 14181 cv = []string{} 14182 } else { 14183 cv = *v 14184 } 14185 14186 for _, value := range shape { 14187 var col string 14188 if value != nil { 14189 jtv, ok := value.(string) 14190 if !ok { 14191 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 14192 } 14193 col = jtv 14194 } 14195 cv = append(cv, col) 14196 14197 } 14198 *v = cv 14199 return nil 14200} 14201 14202func awsRestjson1_deserializeDocumentCorsOriginList(v *[]string, value interface{}) error { 14203 if v == nil { 14204 return fmt.Errorf("unexpected nil of type %T", v) 14205 } 14206 if value == nil { 14207 return nil 14208 } 14209 14210 shape, ok := value.([]interface{}) 14211 if !ok { 14212 return fmt.Errorf("unexpected JSON type %v", value) 14213 } 14214 14215 var cv []string 14216 if *v == nil { 14217 cv = []string{} 14218 } else { 14219 cv = *v 14220 } 14221 14222 for _, value := range shape { 14223 var col string 14224 if value != nil { 14225 jtv, ok := value.(string) 14226 if !ok { 14227 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14228 } 14229 col = jtv 14230 } 14231 cv = append(cv, col) 14232 14233 } 14234 *v = cv 14235 return nil 14236} 14237 14238func awsRestjson1_deserializeDocumentDeployment(v **types.Deployment, value interface{}) error { 14239 if v == nil { 14240 return fmt.Errorf("unexpected nil of type %T", v) 14241 } 14242 if value == nil { 14243 return nil 14244 } 14245 14246 shape, ok := value.(map[string]interface{}) 14247 if !ok { 14248 return fmt.Errorf("unexpected JSON type %v", value) 14249 } 14250 14251 var sv *types.Deployment 14252 if *v == nil { 14253 sv = &types.Deployment{} 14254 } else { 14255 sv = *v 14256 } 14257 14258 for key, value := range shape { 14259 switch key { 14260 case "autoDeployed": 14261 if value != nil { 14262 jtv, ok := value.(bool) 14263 if !ok { 14264 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 14265 } 14266 sv.AutoDeployed = jtv 14267 } 14268 14269 case "createdDate": 14270 if value != nil { 14271 jtv, ok := value.(string) 14272 if !ok { 14273 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 14274 } 14275 t, err := smithytime.ParseDateTime(jtv) 14276 if err != nil { 14277 return err 14278 } 14279 sv.CreatedDate = ptr.Time(t) 14280 } 14281 14282 case "deploymentId": 14283 if value != nil { 14284 jtv, ok := value.(string) 14285 if !ok { 14286 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14287 } 14288 sv.DeploymentId = ptr.String(jtv) 14289 } 14290 14291 case "deploymentStatus": 14292 if value != nil { 14293 jtv, ok := value.(string) 14294 if !ok { 14295 return fmt.Errorf("expected DeploymentStatus to be of type string, got %T instead", value) 14296 } 14297 sv.DeploymentStatus = types.DeploymentStatus(jtv) 14298 } 14299 14300 case "deploymentStatusMessage": 14301 if value != nil { 14302 jtv, ok := value.(string) 14303 if !ok { 14304 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14305 } 14306 sv.DeploymentStatusMessage = ptr.String(jtv) 14307 } 14308 14309 case "description": 14310 if value != nil { 14311 jtv, ok := value.(string) 14312 if !ok { 14313 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 14314 } 14315 sv.Description = ptr.String(jtv) 14316 } 14317 14318 default: 14319 _, _ = key, value 14320 14321 } 14322 } 14323 *v = sv 14324 return nil 14325} 14326 14327func awsRestjson1_deserializeDocumentDomainName(v **types.DomainName, value interface{}) error { 14328 if v == nil { 14329 return fmt.Errorf("unexpected nil of type %T", v) 14330 } 14331 if value == nil { 14332 return nil 14333 } 14334 14335 shape, ok := value.(map[string]interface{}) 14336 if !ok { 14337 return fmt.Errorf("unexpected JSON type %v", value) 14338 } 14339 14340 var sv *types.DomainName 14341 if *v == nil { 14342 sv = &types.DomainName{} 14343 } else { 14344 sv = *v 14345 } 14346 14347 for key, value := range shape { 14348 switch key { 14349 case "apiMappingSelectionExpression": 14350 if value != nil { 14351 jtv, ok := value.(string) 14352 if !ok { 14353 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 14354 } 14355 sv.ApiMappingSelectionExpression = ptr.String(jtv) 14356 } 14357 14358 case "domainName": 14359 if value != nil { 14360 jtv, ok := value.(string) 14361 if !ok { 14362 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 14363 } 14364 sv.DomainName = ptr.String(jtv) 14365 } 14366 14367 case "domainNameConfigurations": 14368 if err := awsRestjson1_deserializeDocumentDomainNameConfigurations(&sv.DomainNameConfigurations, value); err != nil { 14369 return err 14370 } 14371 14372 case "mutualTlsAuthentication": 14373 if err := awsRestjson1_deserializeDocumentMutualTlsAuthentication(&sv.MutualTlsAuthentication, value); err != nil { 14374 return err 14375 } 14376 14377 case "tags": 14378 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 14379 return err 14380 } 14381 14382 default: 14383 _, _ = key, value 14384 14385 } 14386 } 14387 *v = sv 14388 return nil 14389} 14390 14391func awsRestjson1_deserializeDocumentDomainNameConfiguration(v **types.DomainNameConfiguration, value interface{}) error { 14392 if v == nil { 14393 return fmt.Errorf("unexpected nil of type %T", v) 14394 } 14395 if value == nil { 14396 return nil 14397 } 14398 14399 shape, ok := value.(map[string]interface{}) 14400 if !ok { 14401 return fmt.Errorf("unexpected JSON type %v", value) 14402 } 14403 14404 var sv *types.DomainNameConfiguration 14405 if *v == nil { 14406 sv = &types.DomainNameConfiguration{} 14407 } else { 14408 sv = *v 14409 } 14410 14411 for key, value := range shape { 14412 switch key { 14413 case "apiGatewayDomainName": 14414 if value != nil { 14415 jtv, ok := value.(string) 14416 if !ok { 14417 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14418 } 14419 sv.ApiGatewayDomainName = ptr.String(jtv) 14420 } 14421 14422 case "certificateArn": 14423 if value != nil { 14424 jtv, ok := value.(string) 14425 if !ok { 14426 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 14427 } 14428 sv.CertificateArn = ptr.String(jtv) 14429 } 14430 14431 case "certificateName": 14432 if value != nil { 14433 jtv, ok := value.(string) 14434 if !ok { 14435 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 14436 } 14437 sv.CertificateName = ptr.String(jtv) 14438 } 14439 14440 case "certificateUploadDate": 14441 if value != nil { 14442 jtv, ok := value.(string) 14443 if !ok { 14444 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 14445 } 14446 t, err := smithytime.ParseDateTime(jtv) 14447 if err != nil { 14448 return err 14449 } 14450 sv.CertificateUploadDate = ptr.Time(t) 14451 } 14452 14453 case "domainNameStatus": 14454 if value != nil { 14455 jtv, ok := value.(string) 14456 if !ok { 14457 return fmt.Errorf("expected DomainNameStatus to be of type string, got %T instead", value) 14458 } 14459 sv.DomainNameStatus = types.DomainNameStatus(jtv) 14460 } 14461 14462 case "domainNameStatusMessage": 14463 if value != nil { 14464 jtv, ok := value.(string) 14465 if !ok { 14466 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14467 } 14468 sv.DomainNameStatusMessage = ptr.String(jtv) 14469 } 14470 14471 case "endpointType": 14472 if value != nil { 14473 jtv, ok := value.(string) 14474 if !ok { 14475 return fmt.Errorf("expected EndpointType to be of type string, got %T instead", value) 14476 } 14477 sv.EndpointType = types.EndpointType(jtv) 14478 } 14479 14480 case "hostedZoneId": 14481 if value != nil { 14482 jtv, ok := value.(string) 14483 if !ok { 14484 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14485 } 14486 sv.HostedZoneId = ptr.String(jtv) 14487 } 14488 14489 case "securityPolicy": 14490 if value != nil { 14491 jtv, ok := value.(string) 14492 if !ok { 14493 return fmt.Errorf("expected SecurityPolicy to be of type string, got %T instead", value) 14494 } 14495 sv.SecurityPolicy = types.SecurityPolicy(jtv) 14496 } 14497 14498 default: 14499 _, _ = key, value 14500 14501 } 14502 } 14503 *v = sv 14504 return nil 14505} 14506 14507func awsRestjson1_deserializeDocumentDomainNameConfigurations(v *[]types.DomainNameConfiguration, value interface{}) error { 14508 if v == nil { 14509 return fmt.Errorf("unexpected nil of type %T", v) 14510 } 14511 if value == nil { 14512 return nil 14513 } 14514 14515 shape, ok := value.([]interface{}) 14516 if !ok { 14517 return fmt.Errorf("unexpected JSON type %v", value) 14518 } 14519 14520 var cv []types.DomainNameConfiguration 14521 if *v == nil { 14522 cv = []types.DomainNameConfiguration{} 14523 } else { 14524 cv = *v 14525 } 14526 14527 for _, value := range shape { 14528 var col types.DomainNameConfiguration 14529 destAddr := &col 14530 if err := awsRestjson1_deserializeDocumentDomainNameConfiguration(&destAddr, value); err != nil { 14531 return err 14532 } 14533 col = *destAddr 14534 cv = append(cv, col) 14535 14536 } 14537 *v = cv 14538 return nil 14539} 14540 14541func awsRestjson1_deserializeDocumentIdentitySourceList(v *[]string, value interface{}) error { 14542 if v == nil { 14543 return fmt.Errorf("unexpected nil of type %T", v) 14544 } 14545 if value == nil { 14546 return nil 14547 } 14548 14549 shape, ok := value.([]interface{}) 14550 if !ok { 14551 return fmt.Errorf("unexpected JSON type %v", value) 14552 } 14553 14554 var cv []string 14555 if *v == nil { 14556 cv = []string{} 14557 } else { 14558 cv = *v 14559 } 14560 14561 for _, value := range shape { 14562 var col string 14563 if value != nil { 14564 jtv, ok := value.(string) 14565 if !ok { 14566 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 14567 } 14568 col = jtv 14569 } 14570 cv = append(cv, col) 14571 14572 } 14573 *v = cv 14574 return nil 14575} 14576 14577func awsRestjson1_deserializeDocumentIntegration(v **types.Integration, value interface{}) error { 14578 if v == nil { 14579 return fmt.Errorf("unexpected nil of type %T", v) 14580 } 14581 if value == nil { 14582 return nil 14583 } 14584 14585 shape, ok := value.(map[string]interface{}) 14586 if !ok { 14587 return fmt.Errorf("unexpected JSON type %v", value) 14588 } 14589 14590 var sv *types.Integration 14591 if *v == nil { 14592 sv = &types.Integration{} 14593 } else { 14594 sv = *v 14595 } 14596 14597 for key, value := range shape { 14598 switch key { 14599 case "apiGatewayManaged": 14600 if value != nil { 14601 jtv, ok := value.(bool) 14602 if !ok { 14603 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 14604 } 14605 sv.ApiGatewayManaged = jtv 14606 } 14607 14608 case "connectionId": 14609 if value != nil { 14610 jtv, ok := value.(string) 14611 if !ok { 14612 return fmt.Errorf("expected StringWithLengthBetween1And1024 to be of type string, got %T instead", value) 14613 } 14614 sv.ConnectionId = ptr.String(jtv) 14615 } 14616 14617 case "connectionType": 14618 if value != nil { 14619 jtv, ok := value.(string) 14620 if !ok { 14621 return fmt.Errorf("expected ConnectionType to be of type string, got %T instead", value) 14622 } 14623 sv.ConnectionType = types.ConnectionType(jtv) 14624 } 14625 14626 case "contentHandlingStrategy": 14627 if value != nil { 14628 jtv, ok := value.(string) 14629 if !ok { 14630 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 14631 } 14632 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 14633 } 14634 14635 case "credentialsArn": 14636 if value != nil { 14637 jtv, ok := value.(string) 14638 if !ok { 14639 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 14640 } 14641 sv.CredentialsArn = ptr.String(jtv) 14642 } 14643 14644 case "description": 14645 if value != nil { 14646 jtv, ok := value.(string) 14647 if !ok { 14648 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 14649 } 14650 sv.Description = ptr.String(jtv) 14651 } 14652 14653 case "integrationId": 14654 if value != nil { 14655 jtv, ok := value.(string) 14656 if !ok { 14657 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14658 } 14659 sv.IntegrationId = ptr.String(jtv) 14660 } 14661 14662 case "integrationMethod": 14663 if value != nil { 14664 jtv, ok := value.(string) 14665 if !ok { 14666 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 14667 } 14668 sv.IntegrationMethod = ptr.String(jtv) 14669 } 14670 14671 case "integrationResponseSelectionExpression": 14672 if value != nil { 14673 jtv, ok := value.(string) 14674 if !ok { 14675 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 14676 } 14677 sv.IntegrationResponseSelectionExpression = ptr.String(jtv) 14678 } 14679 14680 case "integrationSubtype": 14681 if value != nil { 14682 jtv, ok := value.(string) 14683 if !ok { 14684 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 14685 } 14686 sv.IntegrationSubtype = ptr.String(jtv) 14687 } 14688 14689 case "integrationType": 14690 if value != nil { 14691 jtv, ok := value.(string) 14692 if !ok { 14693 return fmt.Errorf("expected IntegrationType to be of type string, got %T instead", value) 14694 } 14695 sv.IntegrationType = types.IntegrationType(jtv) 14696 } 14697 14698 case "integrationUri": 14699 if value != nil { 14700 jtv, ok := value.(string) 14701 if !ok { 14702 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 14703 } 14704 sv.IntegrationUri = ptr.String(jtv) 14705 } 14706 14707 case "passthroughBehavior": 14708 if value != nil { 14709 jtv, ok := value.(string) 14710 if !ok { 14711 return fmt.Errorf("expected PassthroughBehavior to be of type string, got %T instead", value) 14712 } 14713 sv.PassthroughBehavior = types.PassthroughBehavior(jtv) 14714 } 14715 14716 case "payloadFormatVersion": 14717 if value != nil { 14718 jtv, ok := value.(string) 14719 if !ok { 14720 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 14721 } 14722 sv.PayloadFormatVersion = ptr.String(jtv) 14723 } 14724 14725 case "requestParameters": 14726 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.RequestParameters, value); err != nil { 14727 return err 14728 } 14729 14730 case "requestTemplates": 14731 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.RequestTemplates, value); err != nil { 14732 return err 14733 } 14734 14735 case "templateSelectionExpression": 14736 if value != nil { 14737 jtv, ok := value.(string) 14738 if !ok { 14739 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 14740 } 14741 sv.TemplateSelectionExpression = ptr.String(jtv) 14742 } 14743 14744 case "timeoutInMillis": 14745 if value != nil { 14746 jtv, ok := value.(json.Number) 14747 if !ok { 14748 return fmt.Errorf("expected IntegerWithLengthBetween50And30000 to be json.Number, got %T instead", value) 14749 } 14750 i64, err := jtv.Int64() 14751 if err != nil { 14752 return err 14753 } 14754 sv.TimeoutInMillis = int32(i64) 14755 } 14756 14757 case "tlsConfig": 14758 if err := awsRestjson1_deserializeDocumentTlsConfig(&sv.TlsConfig, value); err != nil { 14759 return err 14760 } 14761 14762 default: 14763 _, _ = key, value 14764 14765 } 14766 } 14767 *v = sv 14768 return nil 14769} 14770 14771func awsRestjson1_deserializeDocumentIntegrationParameters(v *map[string]string, value interface{}) error { 14772 if v == nil { 14773 return fmt.Errorf("unexpected nil of type %T", v) 14774 } 14775 if value == nil { 14776 return nil 14777 } 14778 14779 shape, ok := value.(map[string]interface{}) 14780 if !ok { 14781 return fmt.Errorf("unexpected JSON type %v", value) 14782 } 14783 14784 var mv map[string]string 14785 if *v == nil { 14786 mv = map[string]string{} 14787 } else { 14788 mv = *v 14789 } 14790 14791 for key, value := range shape { 14792 var parsedVal string 14793 if value != nil { 14794 jtv, ok := value.(string) 14795 if !ok { 14796 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 14797 } 14798 parsedVal = jtv 14799 } 14800 mv[key] = parsedVal 14801 14802 } 14803 *v = mv 14804 return nil 14805} 14806 14807func awsRestjson1_deserializeDocumentIntegrationResponse(v **types.IntegrationResponse, value interface{}) error { 14808 if v == nil { 14809 return fmt.Errorf("unexpected nil of type %T", v) 14810 } 14811 if value == nil { 14812 return nil 14813 } 14814 14815 shape, ok := value.(map[string]interface{}) 14816 if !ok { 14817 return fmt.Errorf("unexpected JSON type %v", value) 14818 } 14819 14820 var sv *types.IntegrationResponse 14821 if *v == nil { 14822 sv = &types.IntegrationResponse{} 14823 } else { 14824 sv = *v 14825 } 14826 14827 for key, value := range shape { 14828 switch key { 14829 case "contentHandlingStrategy": 14830 if value != nil { 14831 jtv, ok := value.(string) 14832 if !ok { 14833 return fmt.Errorf("expected ContentHandlingStrategy to be of type string, got %T instead", value) 14834 } 14835 sv.ContentHandlingStrategy = types.ContentHandlingStrategy(jtv) 14836 } 14837 14838 case "integrationResponseId": 14839 if value != nil { 14840 jtv, ok := value.(string) 14841 if !ok { 14842 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14843 } 14844 sv.IntegrationResponseId = ptr.String(jtv) 14845 } 14846 14847 case "integrationResponseKey": 14848 if value != nil { 14849 jtv, ok := value.(string) 14850 if !ok { 14851 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 14852 } 14853 sv.IntegrationResponseKey = ptr.String(jtv) 14854 } 14855 14856 case "responseParameters": 14857 if err := awsRestjson1_deserializeDocumentIntegrationParameters(&sv.ResponseParameters, value); err != nil { 14858 return err 14859 } 14860 14861 case "responseTemplates": 14862 if err := awsRestjson1_deserializeDocumentTemplateMap(&sv.ResponseTemplates, value); err != nil { 14863 return err 14864 } 14865 14866 case "templateSelectionExpression": 14867 if value != nil { 14868 jtv, ok := value.(string) 14869 if !ok { 14870 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 14871 } 14872 sv.TemplateSelectionExpression = ptr.String(jtv) 14873 } 14874 14875 default: 14876 _, _ = key, value 14877 14878 } 14879 } 14880 *v = sv 14881 return nil 14882} 14883 14884func awsRestjson1_deserializeDocumentJWTConfiguration(v **types.JWTConfiguration, value interface{}) error { 14885 if v == nil { 14886 return fmt.Errorf("unexpected nil of type %T", v) 14887 } 14888 if value == nil { 14889 return nil 14890 } 14891 14892 shape, ok := value.(map[string]interface{}) 14893 if !ok { 14894 return fmt.Errorf("unexpected JSON type %v", value) 14895 } 14896 14897 var sv *types.JWTConfiguration 14898 if *v == nil { 14899 sv = &types.JWTConfiguration{} 14900 } else { 14901 sv = *v 14902 } 14903 14904 for key, value := range shape { 14905 switch key { 14906 case "audience": 14907 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Audience, value); err != nil { 14908 return err 14909 } 14910 14911 case "issuer": 14912 if value != nil { 14913 jtv, ok := value.(string) 14914 if !ok { 14915 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 14916 } 14917 sv.Issuer = ptr.String(jtv) 14918 } 14919 14920 default: 14921 _, _ = key, value 14922 14923 } 14924 } 14925 *v = sv 14926 return nil 14927} 14928 14929func awsRestjson1_deserializeDocumentModel(v **types.Model, value interface{}) error { 14930 if v == nil { 14931 return fmt.Errorf("unexpected nil of type %T", v) 14932 } 14933 if value == nil { 14934 return nil 14935 } 14936 14937 shape, ok := value.(map[string]interface{}) 14938 if !ok { 14939 return fmt.Errorf("unexpected JSON type %v", value) 14940 } 14941 14942 var sv *types.Model 14943 if *v == nil { 14944 sv = &types.Model{} 14945 } else { 14946 sv = *v 14947 } 14948 14949 for key, value := range shape { 14950 switch key { 14951 case "contentType": 14952 if value != nil { 14953 jtv, ok := value.(string) 14954 if !ok { 14955 return fmt.Errorf("expected StringWithLengthBetween1And256 to be of type string, got %T instead", value) 14956 } 14957 sv.ContentType = ptr.String(jtv) 14958 } 14959 14960 case "description": 14961 if value != nil { 14962 jtv, ok := value.(string) 14963 if !ok { 14964 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 14965 } 14966 sv.Description = ptr.String(jtv) 14967 } 14968 14969 case "modelId": 14970 if value != nil { 14971 jtv, ok := value.(string) 14972 if !ok { 14973 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14974 } 14975 sv.ModelId = ptr.String(jtv) 14976 } 14977 14978 case "name": 14979 if value != nil { 14980 jtv, ok := value.(string) 14981 if !ok { 14982 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 14983 } 14984 sv.Name = ptr.String(jtv) 14985 } 14986 14987 case "schema": 14988 if value != nil { 14989 jtv, ok := value.(string) 14990 if !ok { 14991 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 14992 } 14993 sv.Schema = ptr.String(jtv) 14994 } 14995 14996 default: 14997 _, _ = key, value 14998 14999 } 15000 } 15001 *v = sv 15002 return nil 15003} 15004 15005func awsRestjson1_deserializeDocumentMutualTlsAuthentication(v **types.MutualTlsAuthentication, value interface{}) error { 15006 if v == nil { 15007 return fmt.Errorf("unexpected nil of type %T", v) 15008 } 15009 if value == nil { 15010 return nil 15011 } 15012 15013 shape, ok := value.(map[string]interface{}) 15014 if !ok { 15015 return fmt.Errorf("unexpected JSON type %v", value) 15016 } 15017 15018 var sv *types.MutualTlsAuthentication 15019 if *v == nil { 15020 sv = &types.MutualTlsAuthentication{} 15021 } else { 15022 sv = *v 15023 } 15024 15025 for key, value := range shape { 15026 switch key { 15027 case "truststoreUri": 15028 if value != nil { 15029 jtv, ok := value.(string) 15030 if !ok { 15031 return fmt.Errorf("expected UriWithLengthBetween1And2048 to be of type string, got %T instead", value) 15032 } 15033 sv.TruststoreUri = ptr.String(jtv) 15034 } 15035 15036 case "truststoreVersion": 15037 if value != nil { 15038 jtv, ok := value.(string) 15039 if !ok { 15040 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 15041 } 15042 sv.TruststoreVersion = ptr.String(jtv) 15043 } 15044 15045 case "truststoreWarnings": 15046 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.TruststoreWarnings, value); err != nil { 15047 return err 15048 } 15049 15050 default: 15051 _, _ = key, value 15052 15053 } 15054 } 15055 *v = sv 15056 return nil 15057} 15058 15059func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 15060 if v == nil { 15061 return fmt.Errorf("unexpected nil of type %T", v) 15062 } 15063 if value == nil { 15064 return nil 15065 } 15066 15067 shape, ok := value.(map[string]interface{}) 15068 if !ok { 15069 return fmt.Errorf("unexpected JSON type %v", value) 15070 } 15071 15072 var sv *types.NotFoundException 15073 if *v == nil { 15074 sv = &types.NotFoundException{} 15075 } else { 15076 sv = *v 15077 } 15078 15079 for key, value := range shape { 15080 switch key { 15081 case "message": 15082 if value != nil { 15083 jtv, ok := value.(string) 15084 if !ok { 15085 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15086 } 15087 sv.Message = ptr.String(jtv) 15088 } 15089 15090 case "resourceType": 15091 if value != nil { 15092 jtv, ok := value.(string) 15093 if !ok { 15094 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15095 } 15096 sv.ResourceType = ptr.String(jtv) 15097 } 15098 15099 default: 15100 _, _ = key, value 15101 15102 } 15103 } 15104 *v = sv 15105 return nil 15106} 15107 15108func awsRestjson1_deserializeDocumentParameterConstraints(v **types.ParameterConstraints, value interface{}) error { 15109 if v == nil { 15110 return fmt.Errorf("unexpected nil of type %T", v) 15111 } 15112 if value == nil { 15113 return nil 15114 } 15115 15116 shape, ok := value.(map[string]interface{}) 15117 if !ok { 15118 return fmt.Errorf("unexpected JSON type %v", value) 15119 } 15120 15121 var sv *types.ParameterConstraints 15122 if *v == nil { 15123 sv = &types.ParameterConstraints{} 15124 } else { 15125 sv = *v 15126 } 15127 15128 for key, value := range shape { 15129 switch key { 15130 case "required": 15131 if value != nil { 15132 jtv, ok := value.(bool) 15133 if !ok { 15134 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15135 } 15136 sv.Required = jtv 15137 } 15138 15139 default: 15140 _, _ = key, value 15141 15142 } 15143 } 15144 *v = sv 15145 return nil 15146} 15147 15148func awsRestjson1_deserializeDocumentRoute(v **types.Route, value interface{}) error { 15149 if v == nil { 15150 return fmt.Errorf("unexpected nil of type %T", v) 15151 } 15152 if value == nil { 15153 return nil 15154 } 15155 15156 shape, ok := value.(map[string]interface{}) 15157 if !ok { 15158 return fmt.Errorf("unexpected JSON type %v", value) 15159 } 15160 15161 var sv *types.Route 15162 if *v == nil { 15163 sv = &types.Route{} 15164 } else { 15165 sv = *v 15166 } 15167 15168 for key, value := range shape { 15169 switch key { 15170 case "apiGatewayManaged": 15171 if value != nil { 15172 jtv, ok := value.(bool) 15173 if !ok { 15174 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15175 } 15176 sv.ApiGatewayManaged = jtv 15177 } 15178 15179 case "apiKeyRequired": 15180 if value != nil { 15181 jtv, ok := value.(bool) 15182 if !ok { 15183 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15184 } 15185 sv.ApiKeyRequired = jtv 15186 } 15187 15188 case "authorizationScopes": 15189 if err := awsRestjson1_deserializeDocumentAuthorizationScopes(&sv.AuthorizationScopes, value); err != nil { 15190 return err 15191 } 15192 15193 case "authorizationType": 15194 if value != nil { 15195 jtv, ok := value.(string) 15196 if !ok { 15197 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 15198 } 15199 sv.AuthorizationType = types.AuthorizationType(jtv) 15200 } 15201 15202 case "authorizerId": 15203 if value != nil { 15204 jtv, ok := value.(string) 15205 if !ok { 15206 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15207 } 15208 sv.AuthorizerId = ptr.String(jtv) 15209 } 15210 15211 case "modelSelectionExpression": 15212 if value != nil { 15213 jtv, ok := value.(string) 15214 if !ok { 15215 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 15216 } 15217 sv.ModelSelectionExpression = ptr.String(jtv) 15218 } 15219 15220 case "operationName": 15221 if value != nil { 15222 jtv, ok := value.(string) 15223 if !ok { 15224 return fmt.Errorf("expected StringWithLengthBetween1And64 to be of type string, got %T instead", value) 15225 } 15226 sv.OperationName = ptr.String(jtv) 15227 } 15228 15229 case "requestModels": 15230 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.RequestModels, value); err != nil { 15231 return err 15232 } 15233 15234 case "requestParameters": 15235 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.RequestParameters, value); err != nil { 15236 return err 15237 } 15238 15239 case "routeId": 15240 if value != nil { 15241 jtv, ok := value.(string) 15242 if !ok { 15243 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15244 } 15245 sv.RouteId = ptr.String(jtv) 15246 } 15247 15248 case "routeKey": 15249 if value != nil { 15250 jtv, ok := value.(string) 15251 if !ok { 15252 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 15253 } 15254 sv.RouteKey = ptr.String(jtv) 15255 } 15256 15257 case "routeResponseSelectionExpression": 15258 if value != nil { 15259 jtv, ok := value.(string) 15260 if !ok { 15261 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 15262 } 15263 sv.RouteResponseSelectionExpression = ptr.String(jtv) 15264 } 15265 15266 case "target": 15267 if value != nil { 15268 jtv, ok := value.(string) 15269 if !ok { 15270 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 15271 } 15272 sv.Target = ptr.String(jtv) 15273 } 15274 15275 default: 15276 _, _ = key, value 15277 15278 } 15279 } 15280 *v = sv 15281 return nil 15282} 15283 15284func awsRestjson1_deserializeDocumentRouteModels(v *map[string]string, value interface{}) error { 15285 if v == nil { 15286 return fmt.Errorf("unexpected nil of type %T", v) 15287 } 15288 if value == nil { 15289 return nil 15290 } 15291 15292 shape, ok := value.(map[string]interface{}) 15293 if !ok { 15294 return fmt.Errorf("unexpected JSON type %v", value) 15295 } 15296 15297 var mv map[string]string 15298 if *v == nil { 15299 mv = map[string]string{} 15300 } else { 15301 mv = *v 15302 } 15303 15304 for key, value := range shape { 15305 var parsedVal string 15306 if value != nil { 15307 jtv, ok := value.(string) 15308 if !ok { 15309 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 15310 } 15311 parsedVal = jtv 15312 } 15313 mv[key] = parsedVal 15314 15315 } 15316 *v = mv 15317 return nil 15318} 15319 15320func awsRestjson1_deserializeDocumentRouteParameters(v *map[string]types.ParameterConstraints, value interface{}) error { 15321 if v == nil { 15322 return fmt.Errorf("unexpected nil of type %T", v) 15323 } 15324 if value == nil { 15325 return nil 15326 } 15327 15328 shape, ok := value.(map[string]interface{}) 15329 if !ok { 15330 return fmt.Errorf("unexpected JSON type %v", value) 15331 } 15332 15333 var mv map[string]types.ParameterConstraints 15334 if *v == nil { 15335 mv = map[string]types.ParameterConstraints{} 15336 } else { 15337 mv = *v 15338 } 15339 15340 for key, value := range shape { 15341 var parsedVal types.ParameterConstraints 15342 mapVar := parsedVal 15343 destAddr := &mapVar 15344 if err := awsRestjson1_deserializeDocumentParameterConstraints(&destAddr, value); err != nil { 15345 return err 15346 } 15347 parsedVal = *destAddr 15348 mv[key] = parsedVal 15349 15350 } 15351 *v = mv 15352 return nil 15353} 15354 15355func awsRestjson1_deserializeDocumentRouteResponse(v **types.RouteResponse, value interface{}) error { 15356 if v == nil { 15357 return fmt.Errorf("unexpected nil of type %T", v) 15358 } 15359 if value == nil { 15360 return nil 15361 } 15362 15363 shape, ok := value.(map[string]interface{}) 15364 if !ok { 15365 return fmt.Errorf("unexpected JSON type %v", value) 15366 } 15367 15368 var sv *types.RouteResponse 15369 if *v == nil { 15370 sv = &types.RouteResponse{} 15371 } else { 15372 sv = *v 15373 } 15374 15375 for key, value := range shape { 15376 switch key { 15377 case "modelSelectionExpression": 15378 if value != nil { 15379 jtv, ok := value.(string) 15380 if !ok { 15381 return fmt.Errorf("expected SelectionExpression to be of type string, got %T instead", value) 15382 } 15383 sv.ModelSelectionExpression = ptr.String(jtv) 15384 } 15385 15386 case "responseModels": 15387 if err := awsRestjson1_deserializeDocumentRouteModels(&sv.ResponseModels, value); err != nil { 15388 return err 15389 } 15390 15391 case "responseParameters": 15392 if err := awsRestjson1_deserializeDocumentRouteParameters(&sv.ResponseParameters, value); err != nil { 15393 return err 15394 } 15395 15396 case "routeResponseId": 15397 if value != nil { 15398 jtv, ok := value.(string) 15399 if !ok { 15400 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15401 } 15402 sv.RouteResponseId = ptr.String(jtv) 15403 } 15404 15405 case "routeResponseKey": 15406 if value != nil { 15407 jtv, ok := value.(string) 15408 if !ok { 15409 return fmt.Errorf("expected SelectionKey to be of type string, got %T instead", value) 15410 } 15411 sv.RouteResponseKey = ptr.String(jtv) 15412 } 15413 15414 default: 15415 _, _ = key, value 15416 15417 } 15418 } 15419 *v = sv 15420 return nil 15421} 15422 15423func awsRestjson1_deserializeDocumentRouteSettings(v **types.RouteSettings, value interface{}) error { 15424 if v == nil { 15425 return fmt.Errorf("unexpected nil of type %T", v) 15426 } 15427 if value == nil { 15428 return nil 15429 } 15430 15431 shape, ok := value.(map[string]interface{}) 15432 if !ok { 15433 return fmt.Errorf("unexpected JSON type %v", value) 15434 } 15435 15436 var sv *types.RouteSettings 15437 if *v == nil { 15438 sv = &types.RouteSettings{} 15439 } else { 15440 sv = *v 15441 } 15442 15443 for key, value := range shape { 15444 switch key { 15445 case "dataTraceEnabled": 15446 if value != nil { 15447 jtv, ok := value.(bool) 15448 if !ok { 15449 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15450 } 15451 sv.DataTraceEnabled = jtv 15452 } 15453 15454 case "detailedMetricsEnabled": 15455 if value != nil { 15456 jtv, ok := value.(bool) 15457 if !ok { 15458 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15459 } 15460 sv.DetailedMetricsEnabled = jtv 15461 } 15462 15463 case "loggingLevel": 15464 if value != nil { 15465 jtv, ok := value.(string) 15466 if !ok { 15467 return fmt.Errorf("expected LoggingLevel to be of type string, got %T instead", value) 15468 } 15469 sv.LoggingLevel = types.LoggingLevel(jtv) 15470 } 15471 15472 case "throttlingBurstLimit": 15473 if value != nil { 15474 jtv, ok := value.(json.Number) 15475 if !ok { 15476 return fmt.Errorf("expected __integer to be json.Number, got %T instead", value) 15477 } 15478 i64, err := jtv.Int64() 15479 if err != nil { 15480 return err 15481 } 15482 sv.ThrottlingBurstLimit = int32(i64) 15483 } 15484 15485 case "throttlingRateLimit": 15486 if value != nil { 15487 jtv, ok := value.(json.Number) 15488 if !ok { 15489 return fmt.Errorf("expected __double to be json.Number, got %T instead", value) 15490 } 15491 f64, err := jtv.Float64() 15492 if err != nil { 15493 return err 15494 } 15495 sv.ThrottlingRateLimit = f64 15496 } 15497 15498 default: 15499 _, _ = key, value 15500 15501 } 15502 } 15503 *v = sv 15504 return nil 15505} 15506 15507func awsRestjson1_deserializeDocumentRouteSettingsMap(v *map[string]types.RouteSettings, value interface{}) error { 15508 if v == nil { 15509 return fmt.Errorf("unexpected nil of type %T", v) 15510 } 15511 if value == nil { 15512 return nil 15513 } 15514 15515 shape, ok := value.(map[string]interface{}) 15516 if !ok { 15517 return fmt.Errorf("unexpected JSON type %v", value) 15518 } 15519 15520 var mv map[string]types.RouteSettings 15521 if *v == nil { 15522 mv = map[string]types.RouteSettings{} 15523 } else { 15524 mv = *v 15525 } 15526 15527 for key, value := range shape { 15528 var parsedVal types.RouteSettings 15529 mapVar := parsedVal 15530 destAddr := &mapVar 15531 if err := awsRestjson1_deserializeDocumentRouteSettings(&destAddr, value); err != nil { 15532 return err 15533 } 15534 parsedVal = *destAddr 15535 mv[key] = parsedVal 15536 15537 } 15538 *v = mv 15539 return nil 15540} 15541 15542func awsRestjson1_deserializeDocumentSecurityGroupIdList(v *[]string, value interface{}) error { 15543 if v == nil { 15544 return fmt.Errorf("unexpected nil of type %T", v) 15545 } 15546 if value == nil { 15547 return nil 15548 } 15549 15550 shape, ok := value.([]interface{}) 15551 if !ok { 15552 return fmt.Errorf("unexpected JSON type %v", value) 15553 } 15554 15555 var cv []string 15556 if *v == nil { 15557 cv = []string{} 15558 } else { 15559 cv = *v 15560 } 15561 15562 for _, value := range shape { 15563 var col string 15564 if value != nil { 15565 jtv, ok := value.(string) 15566 if !ok { 15567 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15568 } 15569 col = jtv 15570 } 15571 cv = append(cv, col) 15572 15573 } 15574 *v = cv 15575 return nil 15576} 15577 15578func awsRestjson1_deserializeDocumentStage(v **types.Stage, value interface{}) error { 15579 if v == nil { 15580 return fmt.Errorf("unexpected nil of type %T", v) 15581 } 15582 if value == nil { 15583 return nil 15584 } 15585 15586 shape, ok := value.(map[string]interface{}) 15587 if !ok { 15588 return fmt.Errorf("unexpected JSON type %v", value) 15589 } 15590 15591 var sv *types.Stage 15592 if *v == nil { 15593 sv = &types.Stage{} 15594 } else { 15595 sv = *v 15596 } 15597 15598 for key, value := range shape { 15599 switch key { 15600 case "accessLogSettings": 15601 if err := awsRestjson1_deserializeDocumentAccessLogSettings(&sv.AccessLogSettings, value); err != nil { 15602 return err 15603 } 15604 15605 case "apiGatewayManaged": 15606 if value != nil { 15607 jtv, ok := value.(bool) 15608 if !ok { 15609 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15610 } 15611 sv.ApiGatewayManaged = jtv 15612 } 15613 15614 case "autoDeploy": 15615 if value != nil { 15616 jtv, ok := value.(bool) 15617 if !ok { 15618 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 15619 } 15620 sv.AutoDeploy = jtv 15621 } 15622 15623 case "clientCertificateId": 15624 if value != nil { 15625 jtv, ok := value.(string) 15626 if !ok { 15627 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15628 } 15629 sv.ClientCertificateId = ptr.String(jtv) 15630 } 15631 15632 case "createdDate": 15633 if value != nil { 15634 jtv, ok := value.(string) 15635 if !ok { 15636 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 15637 } 15638 t, err := smithytime.ParseDateTime(jtv) 15639 if err != nil { 15640 return err 15641 } 15642 sv.CreatedDate = ptr.Time(t) 15643 } 15644 15645 case "defaultRouteSettings": 15646 if err := awsRestjson1_deserializeDocumentRouteSettings(&sv.DefaultRouteSettings, value); err != nil { 15647 return err 15648 } 15649 15650 case "deploymentId": 15651 if value != nil { 15652 jtv, ok := value.(string) 15653 if !ok { 15654 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15655 } 15656 sv.DeploymentId = ptr.String(jtv) 15657 } 15658 15659 case "description": 15660 if value != nil { 15661 jtv, ok := value.(string) 15662 if !ok { 15663 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 15664 } 15665 sv.Description = ptr.String(jtv) 15666 } 15667 15668 case "lastDeploymentStatusMessage": 15669 if value != nil { 15670 jtv, ok := value.(string) 15671 if !ok { 15672 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15673 } 15674 sv.LastDeploymentStatusMessage = ptr.String(jtv) 15675 } 15676 15677 case "lastUpdatedDate": 15678 if value != nil { 15679 jtv, ok := value.(string) 15680 if !ok { 15681 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 15682 } 15683 t, err := smithytime.ParseDateTime(jtv) 15684 if err != nil { 15685 return err 15686 } 15687 sv.LastUpdatedDate = ptr.Time(t) 15688 } 15689 15690 case "routeSettings": 15691 if err := awsRestjson1_deserializeDocumentRouteSettingsMap(&sv.RouteSettings, value); err != nil { 15692 return err 15693 } 15694 15695 case "stageName": 15696 if value != nil { 15697 jtv, ok := value.(string) 15698 if !ok { 15699 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 15700 } 15701 sv.StageName = ptr.String(jtv) 15702 } 15703 15704 case "stageVariables": 15705 if err := awsRestjson1_deserializeDocumentStageVariablesMap(&sv.StageVariables, value); err != nil { 15706 return err 15707 } 15708 15709 case "tags": 15710 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 15711 return err 15712 } 15713 15714 default: 15715 _, _ = key, value 15716 15717 } 15718 } 15719 *v = sv 15720 return nil 15721} 15722 15723func awsRestjson1_deserializeDocumentStageVariablesMap(v *map[string]string, value interface{}) error { 15724 if v == nil { 15725 return fmt.Errorf("unexpected nil of type %T", v) 15726 } 15727 if value == nil { 15728 return nil 15729 } 15730 15731 shape, ok := value.(map[string]interface{}) 15732 if !ok { 15733 return fmt.Errorf("unexpected JSON type %v", value) 15734 } 15735 15736 var mv map[string]string 15737 if *v == nil { 15738 mv = map[string]string{} 15739 } else { 15740 mv = *v 15741 } 15742 15743 for key, value := range shape { 15744 var parsedVal string 15745 if value != nil { 15746 jtv, ok := value.(string) 15747 if !ok { 15748 return fmt.Errorf("expected StringWithLengthBetween0And2048 to be of type string, got %T instead", value) 15749 } 15750 parsedVal = jtv 15751 } 15752 mv[key] = parsedVal 15753 15754 } 15755 *v = mv 15756 return nil 15757} 15758 15759func awsRestjson1_deserializeDocumentSubnetIdList(v *[]string, value interface{}) error { 15760 if v == nil { 15761 return fmt.Errorf("unexpected nil of type %T", v) 15762 } 15763 if value == nil { 15764 return nil 15765 } 15766 15767 shape, ok := value.([]interface{}) 15768 if !ok { 15769 return fmt.Errorf("unexpected JSON type %v", value) 15770 } 15771 15772 var cv []string 15773 if *v == nil { 15774 cv = []string{} 15775 } else { 15776 cv = *v 15777 } 15778 15779 for _, value := range shape { 15780 var col string 15781 if value != nil { 15782 jtv, ok := value.(string) 15783 if !ok { 15784 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15785 } 15786 col = jtv 15787 } 15788 cv = append(cv, col) 15789 15790 } 15791 *v = cv 15792 return nil 15793} 15794 15795func awsRestjson1_deserializeDocumentTags(v *map[string]string, value interface{}) error { 15796 if v == nil { 15797 return fmt.Errorf("unexpected nil of type %T", v) 15798 } 15799 if value == nil { 15800 return nil 15801 } 15802 15803 shape, ok := value.(map[string]interface{}) 15804 if !ok { 15805 return fmt.Errorf("unexpected JSON type %v", value) 15806 } 15807 15808 var mv map[string]string 15809 if *v == nil { 15810 mv = map[string]string{} 15811 } else { 15812 mv = *v 15813 } 15814 15815 for key, value := range shape { 15816 var parsedVal string 15817 if value != nil { 15818 jtv, ok := value.(string) 15819 if !ok { 15820 return fmt.Errorf("expected StringWithLengthBetween1And1600 to be of type string, got %T instead", value) 15821 } 15822 parsedVal = jtv 15823 } 15824 mv[key] = parsedVal 15825 15826 } 15827 *v = mv 15828 return nil 15829} 15830 15831func awsRestjson1_deserializeDocumentTemplateMap(v *map[string]string, value interface{}) error { 15832 if v == nil { 15833 return fmt.Errorf("unexpected nil of type %T", v) 15834 } 15835 if value == nil { 15836 return nil 15837 } 15838 15839 shape, ok := value.(map[string]interface{}) 15840 if !ok { 15841 return fmt.Errorf("unexpected JSON type %v", value) 15842 } 15843 15844 var mv map[string]string 15845 if *v == nil { 15846 mv = map[string]string{} 15847 } else { 15848 mv = *v 15849 } 15850 15851 for key, value := range shape { 15852 var parsedVal string 15853 if value != nil { 15854 jtv, ok := value.(string) 15855 if !ok { 15856 return fmt.Errorf("expected StringWithLengthBetween0And32K to be of type string, got %T instead", value) 15857 } 15858 parsedVal = jtv 15859 } 15860 mv[key] = parsedVal 15861 15862 } 15863 *v = mv 15864 return nil 15865} 15866 15867func awsRestjson1_deserializeDocumentTlsConfig(v **types.TlsConfig, value interface{}) error { 15868 if v == nil { 15869 return fmt.Errorf("unexpected nil of type %T", v) 15870 } 15871 if value == nil { 15872 return nil 15873 } 15874 15875 shape, ok := value.(map[string]interface{}) 15876 if !ok { 15877 return fmt.Errorf("unexpected JSON type %v", value) 15878 } 15879 15880 var sv *types.TlsConfig 15881 if *v == nil { 15882 sv = &types.TlsConfig{} 15883 } else { 15884 sv = *v 15885 } 15886 15887 for key, value := range shape { 15888 switch key { 15889 case "serverNameToVerify": 15890 if value != nil { 15891 jtv, ok := value.(string) 15892 if !ok { 15893 return fmt.Errorf("expected StringWithLengthBetween1And512 to be of type string, got %T instead", value) 15894 } 15895 sv.ServerNameToVerify = ptr.String(jtv) 15896 } 15897 15898 default: 15899 _, _ = key, value 15900 15901 } 15902 } 15903 *v = sv 15904 return nil 15905} 15906 15907func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { 15908 if v == nil { 15909 return fmt.Errorf("unexpected nil of type %T", v) 15910 } 15911 if value == nil { 15912 return nil 15913 } 15914 15915 shape, ok := value.(map[string]interface{}) 15916 if !ok { 15917 return fmt.Errorf("unexpected JSON type %v", value) 15918 } 15919 15920 var sv *types.TooManyRequestsException 15921 if *v == nil { 15922 sv = &types.TooManyRequestsException{} 15923 } else { 15924 sv = *v 15925 } 15926 15927 for key, value := range shape { 15928 switch key { 15929 case "limitType": 15930 if value != nil { 15931 jtv, ok := value.(string) 15932 if !ok { 15933 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15934 } 15935 sv.LimitType = ptr.String(jtv) 15936 } 15937 15938 case "message": 15939 if value != nil { 15940 jtv, ok := value.(string) 15941 if !ok { 15942 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 15943 } 15944 sv.Message = ptr.String(jtv) 15945 } 15946 15947 default: 15948 _, _ = key, value 15949 15950 } 15951 } 15952 *v = sv 15953 return nil 15954} 15955 15956func awsRestjson1_deserializeDocumentVpcLink(v **types.VpcLink, value interface{}) error { 15957 if v == nil { 15958 return fmt.Errorf("unexpected nil of type %T", v) 15959 } 15960 if value == nil { 15961 return nil 15962 } 15963 15964 shape, ok := value.(map[string]interface{}) 15965 if !ok { 15966 return fmt.Errorf("unexpected JSON type %v", value) 15967 } 15968 15969 var sv *types.VpcLink 15970 if *v == nil { 15971 sv = &types.VpcLink{} 15972 } else { 15973 sv = *v 15974 } 15975 15976 for key, value := range shape { 15977 switch key { 15978 case "createdDate": 15979 if value != nil { 15980 jtv, ok := value.(string) 15981 if !ok { 15982 return fmt.Errorf("expected __timestampIso8601 to be of type string, got %T instead", value) 15983 } 15984 t, err := smithytime.ParseDateTime(jtv) 15985 if err != nil { 15986 return err 15987 } 15988 sv.CreatedDate = ptr.Time(t) 15989 } 15990 15991 case "name": 15992 if value != nil { 15993 jtv, ok := value.(string) 15994 if !ok { 15995 return fmt.Errorf("expected StringWithLengthBetween1And128 to be of type string, got %T instead", value) 15996 } 15997 sv.Name = ptr.String(jtv) 15998 } 15999 16000 case "securityGroupIds": 16001 if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { 16002 return err 16003 } 16004 16005 case "subnetIds": 16006 if err := awsRestjson1_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil { 16007 return err 16008 } 16009 16010 case "tags": 16011 if err := awsRestjson1_deserializeDocumentTags(&sv.Tags, value); err != nil { 16012 return err 16013 } 16014 16015 case "vpcLinkId": 16016 if value != nil { 16017 jtv, ok := value.(string) 16018 if !ok { 16019 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 16020 } 16021 sv.VpcLinkId = ptr.String(jtv) 16022 } 16023 16024 case "vpcLinkStatus": 16025 if value != nil { 16026 jtv, ok := value.(string) 16027 if !ok { 16028 return fmt.Errorf("expected VpcLinkStatus to be of type string, got %T instead", value) 16029 } 16030 sv.VpcLinkStatus = types.VpcLinkStatus(jtv) 16031 } 16032 16033 case "vpcLinkStatusMessage": 16034 if value != nil { 16035 jtv, ok := value.(string) 16036 if !ok { 16037 return fmt.Errorf("expected StringWithLengthBetween0And1024 to be of type string, got %T instead", value) 16038 } 16039 sv.VpcLinkStatusMessage = ptr.String(jtv) 16040 } 16041 16042 case "vpcLinkVersion": 16043 if value != nil { 16044 jtv, ok := value.(string) 16045 if !ok { 16046 return fmt.Errorf("expected VpcLinkVersion to be of type string, got %T instead", value) 16047 } 16048 sv.VpcLinkVersion = types.VpcLinkVersion(jtv) 16049 } 16050 16051 default: 16052 _, _ = key, value 16053 16054 } 16055 } 16056 *v = sv 16057 return nil 16058} 16059