1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package appsync 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/appsync/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithyhttp "github.com/aws/smithy-go/transport/http" 17 "io" 18 "io/ioutil" 19 "strings" 20) 21 22type awsRestjson1_deserializeOpCreateApiCache struct { 23} 24 25func (*awsRestjson1_deserializeOpCreateApiCache) ID() string { 26 return "OperationDeserializer" 27} 28 29func (m *awsRestjson1_deserializeOpCreateApiCache) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 30 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 31) { 32 out, metadata, err = next.HandleDeserialize(ctx, in) 33 if err != nil { 34 return out, metadata, err 35 } 36 37 response, ok := out.RawResponse.(*smithyhttp.Response) 38 if !ok { 39 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 40 } 41 42 if response.StatusCode < 200 || response.StatusCode >= 300 { 43 return out, metadata, awsRestjson1_deserializeOpErrorCreateApiCache(response, &metadata) 44 } 45 output := &CreateApiCacheOutput{} 46 out.Result = output 47 48 var buff [1024]byte 49 ringBuffer := smithyio.NewRingBuffer(buff[:]) 50 51 body := io.TeeReader(response.Body, ringBuffer) 52 53 decoder := json.NewDecoder(body) 54 decoder.UseNumber() 55 var shape interface{} 56 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 57 var snapshot bytes.Buffer 58 io.Copy(&snapshot, ringBuffer) 59 err = &smithy.DeserializationError{ 60 Err: fmt.Errorf("failed to decode response body, %w", err), 61 Snapshot: snapshot.Bytes(), 62 } 63 return out, metadata, err 64 } 65 66 err = awsRestjson1_deserializeOpDocumentCreateApiCacheOutput(&output, shape) 67 if err != nil { 68 var snapshot bytes.Buffer 69 io.Copy(&snapshot, ringBuffer) 70 return out, metadata, &smithy.DeserializationError{ 71 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 72 Snapshot: snapshot.Bytes(), 73 } 74 } 75 76 return out, metadata, err 77} 78 79func awsRestjson1_deserializeOpErrorCreateApiCache(response *smithyhttp.Response, metadata *middleware.Metadata) error { 80 var errorBuffer bytes.Buffer 81 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 82 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 83 } 84 errorBody := bytes.NewReader(errorBuffer.Bytes()) 85 86 errorCode := "UnknownError" 87 errorMessage := errorCode 88 89 code := response.Header.Get("X-Amzn-ErrorType") 90 if len(code) != 0 { 91 errorCode = restjson.SanitizeErrorCode(code) 92 } 93 94 var buff [1024]byte 95 ringBuffer := smithyio.NewRingBuffer(buff[:]) 96 97 body := io.TeeReader(errorBody, ringBuffer) 98 decoder := json.NewDecoder(body) 99 decoder.UseNumber() 100 code, message, err := restjson.GetErrorInfo(decoder) 101 if err != nil { 102 var snapshot bytes.Buffer 103 io.Copy(&snapshot, ringBuffer) 104 err = &smithy.DeserializationError{ 105 Err: fmt.Errorf("failed to decode response body, %w", err), 106 Snapshot: snapshot.Bytes(), 107 } 108 return err 109 } 110 111 errorBody.Seek(0, io.SeekStart) 112 if len(code) != 0 { 113 errorCode = restjson.SanitizeErrorCode(code) 114 } 115 if len(message) != 0 { 116 errorMessage = message 117 } 118 119 switch { 120 case strings.EqualFold("BadRequestException", errorCode): 121 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 122 123 case strings.EqualFold("ConcurrentModificationException", errorCode): 124 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 125 126 case strings.EqualFold("InternalFailureException", errorCode): 127 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 128 129 case strings.EqualFold("NotFoundException", errorCode): 130 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 131 132 case strings.EqualFold("UnauthorizedException", errorCode): 133 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 134 135 default: 136 genericError := &smithy.GenericAPIError{ 137 Code: errorCode, 138 Message: errorMessage, 139 } 140 return genericError 141 142 } 143} 144 145func awsRestjson1_deserializeOpDocumentCreateApiCacheOutput(v **CreateApiCacheOutput, value interface{}) error { 146 if v == nil { 147 return fmt.Errorf("unexpected nil of type %T", v) 148 } 149 if value == nil { 150 return nil 151 } 152 153 shape, ok := value.(map[string]interface{}) 154 if !ok { 155 return fmt.Errorf("unexpected JSON type %v", value) 156 } 157 158 var sv *CreateApiCacheOutput 159 if *v == nil { 160 sv = &CreateApiCacheOutput{} 161 } else { 162 sv = *v 163 } 164 165 for key, value := range shape { 166 switch key { 167 case "apiCache": 168 if err := awsRestjson1_deserializeDocumentApiCache(&sv.ApiCache, value); err != nil { 169 return err 170 } 171 172 default: 173 _, _ = key, value 174 175 } 176 } 177 *v = sv 178 return nil 179} 180 181type awsRestjson1_deserializeOpCreateApiKey struct { 182} 183 184func (*awsRestjson1_deserializeOpCreateApiKey) ID() string { 185 return "OperationDeserializer" 186} 187 188func (m *awsRestjson1_deserializeOpCreateApiKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 189 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 190) { 191 out, metadata, err = next.HandleDeserialize(ctx, in) 192 if err != nil { 193 return out, metadata, err 194 } 195 196 response, ok := out.RawResponse.(*smithyhttp.Response) 197 if !ok { 198 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 199 } 200 201 if response.StatusCode < 200 || response.StatusCode >= 300 { 202 return out, metadata, awsRestjson1_deserializeOpErrorCreateApiKey(response, &metadata) 203 } 204 output := &CreateApiKeyOutput{} 205 out.Result = output 206 207 var buff [1024]byte 208 ringBuffer := smithyio.NewRingBuffer(buff[:]) 209 210 body := io.TeeReader(response.Body, ringBuffer) 211 212 decoder := json.NewDecoder(body) 213 decoder.UseNumber() 214 var shape interface{} 215 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 216 var snapshot bytes.Buffer 217 io.Copy(&snapshot, ringBuffer) 218 err = &smithy.DeserializationError{ 219 Err: fmt.Errorf("failed to decode response body, %w", err), 220 Snapshot: snapshot.Bytes(), 221 } 222 return out, metadata, err 223 } 224 225 err = awsRestjson1_deserializeOpDocumentCreateApiKeyOutput(&output, shape) 226 if err != nil { 227 var snapshot bytes.Buffer 228 io.Copy(&snapshot, ringBuffer) 229 return out, metadata, &smithy.DeserializationError{ 230 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 231 Snapshot: snapshot.Bytes(), 232 } 233 } 234 235 return out, metadata, err 236} 237 238func awsRestjson1_deserializeOpErrorCreateApiKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 239 var errorBuffer bytes.Buffer 240 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 241 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 242 } 243 errorBody := bytes.NewReader(errorBuffer.Bytes()) 244 245 errorCode := "UnknownError" 246 errorMessage := errorCode 247 248 code := response.Header.Get("X-Amzn-ErrorType") 249 if len(code) != 0 { 250 errorCode = restjson.SanitizeErrorCode(code) 251 } 252 253 var buff [1024]byte 254 ringBuffer := smithyio.NewRingBuffer(buff[:]) 255 256 body := io.TeeReader(errorBody, ringBuffer) 257 decoder := json.NewDecoder(body) 258 decoder.UseNumber() 259 code, message, err := restjson.GetErrorInfo(decoder) 260 if err != nil { 261 var snapshot bytes.Buffer 262 io.Copy(&snapshot, ringBuffer) 263 err = &smithy.DeserializationError{ 264 Err: fmt.Errorf("failed to decode response body, %w", err), 265 Snapshot: snapshot.Bytes(), 266 } 267 return err 268 } 269 270 errorBody.Seek(0, io.SeekStart) 271 if len(code) != 0 { 272 errorCode = restjson.SanitizeErrorCode(code) 273 } 274 if len(message) != 0 { 275 errorMessage = message 276 } 277 278 switch { 279 case strings.EqualFold("ApiKeyLimitExceededException", errorCode): 280 return awsRestjson1_deserializeErrorApiKeyLimitExceededException(response, errorBody) 281 282 case strings.EqualFold("ApiKeyValidityOutOfBoundsException", errorCode): 283 return awsRestjson1_deserializeErrorApiKeyValidityOutOfBoundsException(response, errorBody) 284 285 case strings.EqualFold("BadRequestException", errorCode): 286 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 287 288 case strings.EqualFold("InternalFailureException", errorCode): 289 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 290 291 case strings.EqualFold("LimitExceededException", errorCode): 292 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 293 294 case strings.EqualFold("NotFoundException", errorCode): 295 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 296 297 case strings.EqualFold("UnauthorizedException", errorCode): 298 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 299 300 default: 301 genericError := &smithy.GenericAPIError{ 302 Code: errorCode, 303 Message: errorMessage, 304 } 305 return genericError 306 307 } 308} 309 310func awsRestjson1_deserializeOpDocumentCreateApiKeyOutput(v **CreateApiKeyOutput, value interface{}) error { 311 if v == nil { 312 return fmt.Errorf("unexpected nil of type %T", v) 313 } 314 if value == nil { 315 return nil 316 } 317 318 shape, ok := value.(map[string]interface{}) 319 if !ok { 320 return fmt.Errorf("unexpected JSON type %v", value) 321 } 322 323 var sv *CreateApiKeyOutput 324 if *v == nil { 325 sv = &CreateApiKeyOutput{} 326 } else { 327 sv = *v 328 } 329 330 for key, value := range shape { 331 switch key { 332 case "apiKey": 333 if err := awsRestjson1_deserializeDocumentApiKey(&sv.ApiKey, value); err != nil { 334 return err 335 } 336 337 default: 338 _, _ = key, value 339 340 } 341 } 342 *v = sv 343 return nil 344} 345 346type awsRestjson1_deserializeOpCreateDataSource struct { 347} 348 349func (*awsRestjson1_deserializeOpCreateDataSource) ID() string { 350 return "OperationDeserializer" 351} 352 353func (m *awsRestjson1_deserializeOpCreateDataSource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 354 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 355) { 356 out, metadata, err = next.HandleDeserialize(ctx, in) 357 if err != nil { 358 return out, metadata, err 359 } 360 361 response, ok := out.RawResponse.(*smithyhttp.Response) 362 if !ok { 363 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 364 } 365 366 if response.StatusCode < 200 || response.StatusCode >= 300 { 367 return out, metadata, awsRestjson1_deserializeOpErrorCreateDataSource(response, &metadata) 368 } 369 output := &CreateDataSourceOutput{} 370 out.Result = output 371 372 var buff [1024]byte 373 ringBuffer := smithyio.NewRingBuffer(buff[:]) 374 375 body := io.TeeReader(response.Body, ringBuffer) 376 377 decoder := json.NewDecoder(body) 378 decoder.UseNumber() 379 var shape interface{} 380 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 381 var snapshot bytes.Buffer 382 io.Copy(&snapshot, ringBuffer) 383 err = &smithy.DeserializationError{ 384 Err: fmt.Errorf("failed to decode response body, %w", err), 385 Snapshot: snapshot.Bytes(), 386 } 387 return out, metadata, err 388 } 389 390 err = awsRestjson1_deserializeOpDocumentCreateDataSourceOutput(&output, shape) 391 if err != nil { 392 var snapshot bytes.Buffer 393 io.Copy(&snapshot, ringBuffer) 394 return out, metadata, &smithy.DeserializationError{ 395 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 396 Snapshot: snapshot.Bytes(), 397 } 398 } 399 400 return out, metadata, err 401} 402 403func awsRestjson1_deserializeOpErrorCreateDataSource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 404 var errorBuffer bytes.Buffer 405 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 406 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 407 } 408 errorBody := bytes.NewReader(errorBuffer.Bytes()) 409 410 errorCode := "UnknownError" 411 errorMessage := errorCode 412 413 code := response.Header.Get("X-Amzn-ErrorType") 414 if len(code) != 0 { 415 errorCode = restjson.SanitizeErrorCode(code) 416 } 417 418 var buff [1024]byte 419 ringBuffer := smithyio.NewRingBuffer(buff[:]) 420 421 body := io.TeeReader(errorBody, ringBuffer) 422 decoder := json.NewDecoder(body) 423 decoder.UseNumber() 424 code, message, err := restjson.GetErrorInfo(decoder) 425 if err != nil { 426 var snapshot bytes.Buffer 427 io.Copy(&snapshot, ringBuffer) 428 err = &smithy.DeserializationError{ 429 Err: fmt.Errorf("failed to decode response body, %w", err), 430 Snapshot: snapshot.Bytes(), 431 } 432 return err 433 } 434 435 errorBody.Seek(0, io.SeekStart) 436 if len(code) != 0 { 437 errorCode = restjson.SanitizeErrorCode(code) 438 } 439 if len(message) != 0 { 440 errorMessage = message 441 } 442 443 switch { 444 case strings.EqualFold("BadRequestException", errorCode): 445 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 446 447 case strings.EqualFold("ConcurrentModificationException", errorCode): 448 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 449 450 case strings.EqualFold("InternalFailureException", errorCode): 451 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 452 453 case strings.EqualFold("NotFoundException", errorCode): 454 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 455 456 case strings.EqualFold("UnauthorizedException", errorCode): 457 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 458 459 default: 460 genericError := &smithy.GenericAPIError{ 461 Code: errorCode, 462 Message: errorMessage, 463 } 464 return genericError 465 466 } 467} 468 469func awsRestjson1_deserializeOpDocumentCreateDataSourceOutput(v **CreateDataSourceOutput, value interface{}) error { 470 if v == nil { 471 return fmt.Errorf("unexpected nil of type %T", v) 472 } 473 if value == nil { 474 return nil 475 } 476 477 shape, ok := value.(map[string]interface{}) 478 if !ok { 479 return fmt.Errorf("unexpected JSON type %v", value) 480 } 481 482 var sv *CreateDataSourceOutput 483 if *v == nil { 484 sv = &CreateDataSourceOutput{} 485 } else { 486 sv = *v 487 } 488 489 for key, value := range shape { 490 switch key { 491 case "dataSource": 492 if err := awsRestjson1_deserializeDocumentDataSource(&sv.DataSource, value); err != nil { 493 return err 494 } 495 496 default: 497 _, _ = key, value 498 499 } 500 } 501 *v = sv 502 return nil 503} 504 505type awsRestjson1_deserializeOpCreateFunction struct { 506} 507 508func (*awsRestjson1_deserializeOpCreateFunction) ID() string { 509 return "OperationDeserializer" 510} 511 512func (m *awsRestjson1_deserializeOpCreateFunction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 513 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 514) { 515 out, metadata, err = next.HandleDeserialize(ctx, in) 516 if err != nil { 517 return out, metadata, err 518 } 519 520 response, ok := out.RawResponse.(*smithyhttp.Response) 521 if !ok { 522 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 523 } 524 525 if response.StatusCode < 200 || response.StatusCode >= 300 { 526 return out, metadata, awsRestjson1_deserializeOpErrorCreateFunction(response, &metadata) 527 } 528 output := &CreateFunctionOutput{} 529 out.Result = output 530 531 var buff [1024]byte 532 ringBuffer := smithyio.NewRingBuffer(buff[:]) 533 534 body := io.TeeReader(response.Body, ringBuffer) 535 536 decoder := json.NewDecoder(body) 537 decoder.UseNumber() 538 var shape interface{} 539 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 540 var snapshot bytes.Buffer 541 io.Copy(&snapshot, ringBuffer) 542 err = &smithy.DeserializationError{ 543 Err: fmt.Errorf("failed to decode response body, %w", err), 544 Snapshot: snapshot.Bytes(), 545 } 546 return out, metadata, err 547 } 548 549 err = awsRestjson1_deserializeOpDocumentCreateFunctionOutput(&output, shape) 550 if err != nil { 551 var snapshot bytes.Buffer 552 io.Copy(&snapshot, ringBuffer) 553 return out, metadata, &smithy.DeserializationError{ 554 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 555 Snapshot: snapshot.Bytes(), 556 } 557 } 558 559 return out, metadata, err 560} 561 562func awsRestjson1_deserializeOpErrorCreateFunction(response *smithyhttp.Response, metadata *middleware.Metadata) error { 563 var errorBuffer bytes.Buffer 564 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 565 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 566 } 567 errorBody := bytes.NewReader(errorBuffer.Bytes()) 568 569 errorCode := "UnknownError" 570 errorMessage := errorCode 571 572 code := response.Header.Get("X-Amzn-ErrorType") 573 if len(code) != 0 { 574 errorCode = restjson.SanitizeErrorCode(code) 575 } 576 577 var buff [1024]byte 578 ringBuffer := smithyio.NewRingBuffer(buff[:]) 579 580 body := io.TeeReader(errorBody, ringBuffer) 581 decoder := json.NewDecoder(body) 582 decoder.UseNumber() 583 code, message, err := restjson.GetErrorInfo(decoder) 584 if err != nil { 585 var snapshot bytes.Buffer 586 io.Copy(&snapshot, ringBuffer) 587 err = &smithy.DeserializationError{ 588 Err: fmt.Errorf("failed to decode response body, %w", err), 589 Snapshot: snapshot.Bytes(), 590 } 591 return err 592 } 593 594 errorBody.Seek(0, io.SeekStart) 595 if len(code) != 0 { 596 errorCode = restjson.SanitizeErrorCode(code) 597 } 598 if len(message) != 0 { 599 errorMessage = message 600 } 601 602 switch { 603 case strings.EqualFold("ConcurrentModificationException", errorCode): 604 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 605 606 case strings.EqualFold("InternalFailureException", errorCode): 607 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 608 609 case strings.EqualFold("NotFoundException", errorCode): 610 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 611 612 case strings.EqualFold("UnauthorizedException", errorCode): 613 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 614 615 default: 616 genericError := &smithy.GenericAPIError{ 617 Code: errorCode, 618 Message: errorMessage, 619 } 620 return genericError 621 622 } 623} 624 625func awsRestjson1_deserializeOpDocumentCreateFunctionOutput(v **CreateFunctionOutput, value interface{}) error { 626 if v == nil { 627 return fmt.Errorf("unexpected nil of type %T", v) 628 } 629 if value == nil { 630 return nil 631 } 632 633 shape, ok := value.(map[string]interface{}) 634 if !ok { 635 return fmt.Errorf("unexpected JSON type %v", value) 636 } 637 638 var sv *CreateFunctionOutput 639 if *v == nil { 640 sv = &CreateFunctionOutput{} 641 } else { 642 sv = *v 643 } 644 645 for key, value := range shape { 646 switch key { 647 case "functionConfiguration": 648 if err := awsRestjson1_deserializeDocumentFunctionConfiguration(&sv.FunctionConfiguration, value); err != nil { 649 return err 650 } 651 652 default: 653 _, _ = key, value 654 655 } 656 } 657 *v = sv 658 return nil 659} 660 661type awsRestjson1_deserializeOpCreateGraphqlApi struct { 662} 663 664func (*awsRestjson1_deserializeOpCreateGraphqlApi) ID() string { 665 return "OperationDeserializer" 666} 667 668func (m *awsRestjson1_deserializeOpCreateGraphqlApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 669 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 670) { 671 out, metadata, err = next.HandleDeserialize(ctx, in) 672 if err != nil { 673 return out, metadata, err 674 } 675 676 response, ok := out.RawResponse.(*smithyhttp.Response) 677 if !ok { 678 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 679 } 680 681 if response.StatusCode < 200 || response.StatusCode >= 300 { 682 return out, metadata, awsRestjson1_deserializeOpErrorCreateGraphqlApi(response, &metadata) 683 } 684 output := &CreateGraphqlApiOutput{} 685 out.Result = output 686 687 var buff [1024]byte 688 ringBuffer := smithyio.NewRingBuffer(buff[:]) 689 690 body := io.TeeReader(response.Body, ringBuffer) 691 692 decoder := json.NewDecoder(body) 693 decoder.UseNumber() 694 var shape interface{} 695 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 696 var snapshot bytes.Buffer 697 io.Copy(&snapshot, ringBuffer) 698 err = &smithy.DeserializationError{ 699 Err: fmt.Errorf("failed to decode response body, %w", err), 700 Snapshot: snapshot.Bytes(), 701 } 702 return out, metadata, err 703 } 704 705 err = awsRestjson1_deserializeOpDocumentCreateGraphqlApiOutput(&output, shape) 706 if err != nil { 707 var snapshot bytes.Buffer 708 io.Copy(&snapshot, ringBuffer) 709 return out, metadata, &smithy.DeserializationError{ 710 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 711 Snapshot: snapshot.Bytes(), 712 } 713 } 714 715 return out, metadata, err 716} 717 718func awsRestjson1_deserializeOpErrorCreateGraphqlApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 719 var errorBuffer bytes.Buffer 720 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 721 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 722 } 723 errorBody := bytes.NewReader(errorBuffer.Bytes()) 724 725 errorCode := "UnknownError" 726 errorMessage := errorCode 727 728 code := response.Header.Get("X-Amzn-ErrorType") 729 if len(code) != 0 { 730 errorCode = restjson.SanitizeErrorCode(code) 731 } 732 733 var buff [1024]byte 734 ringBuffer := smithyio.NewRingBuffer(buff[:]) 735 736 body := io.TeeReader(errorBody, ringBuffer) 737 decoder := json.NewDecoder(body) 738 decoder.UseNumber() 739 code, message, err := restjson.GetErrorInfo(decoder) 740 if err != nil { 741 var snapshot bytes.Buffer 742 io.Copy(&snapshot, ringBuffer) 743 err = &smithy.DeserializationError{ 744 Err: fmt.Errorf("failed to decode response body, %w", err), 745 Snapshot: snapshot.Bytes(), 746 } 747 return err 748 } 749 750 errorBody.Seek(0, io.SeekStart) 751 if len(code) != 0 { 752 errorCode = restjson.SanitizeErrorCode(code) 753 } 754 if len(message) != 0 { 755 errorMessage = message 756 } 757 758 switch { 759 case strings.EqualFold("ApiLimitExceededException", errorCode): 760 return awsRestjson1_deserializeErrorApiLimitExceededException(response, errorBody) 761 762 case strings.EqualFold("BadRequestException", errorCode): 763 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 764 765 case strings.EqualFold("ConcurrentModificationException", errorCode): 766 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 767 768 case strings.EqualFold("InternalFailureException", errorCode): 769 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 770 771 case strings.EqualFold("LimitExceededException", errorCode): 772 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 773 774 case strings.EqualFold("UnauthorizedException", errorCode): 775 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 776 777 default: 778 genericError := &smithy.GenericAPIError{ 779 Code: errorCode, 780 Message: errorMessage, 781 } 782 return genericError 783 784 } 785} 786 787func awsRestjson1_deserializeOpDocumentCreateGraphqlApiOutput(v **CreateGraphqlApiOutput, value interface{}) error { 788 if v == nil { 789 return fmt.Errorf("unexpected nil of type %T", v) 790 } 791 if value == nil { 792 return nil 793 } 794 795 shape, ok := value.(map[string]interface{}) 796 if !ok { 797 return fmt.Errorf("unexpected JSON type %v", value) 798 } 799 800 var sv *CreateGraphqlApiOutput 801 if *v == nil { 802 sv = &CreateGraphqlApiOutput{} 803 } else { 804 sv = *v 805 } 806 807 for key, value := range shape { 808 switch key { 809 case "graphqlApi": 810 if err := awsRestjson1_deserializeDocumentGraphqlApi(&sv.GraphqlApi, value); err != nil { 811 return err 812 } 813 814 default: 815 _, _ = key, value 816 817 } 818 } 819 *v = sv 820 return nil 821} 822 823type awsRestjson1_deserializeOpCreateResolver struct { 824} 825 826func (*awsRestjson1_deserializeOpCreateResolver) ID() string { 827 return "OperationDeserializer" 828} 829 830func (m *awsRestjson1_deserializeOpCreateResolver) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 831 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 832) { 833 out, metadata, err = next.HandleDeserialize(ctx, in) 834 if err != nil { 835 return out, metadata, err 836 } 837 838 response, ok := out.RawResponse.(*smithyhttp.Response) 839 if !ok { 840 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 841 } 842 843 if response.StatusCode < 200 || response.StatusCode >= 300 { 844 return out, metadata, awsRestjson1_deserializeOpErrorCreateResolver(response, &metadata) 845 } 846 output := &CreateResolverOutput{} 847 out.Result = output 848 849 var buff [1024]byte 850 ringBuffer := smithyio.NewRingBuffer(buff[:]) 851 852 body := io.TeeReader(response.Body, ringBuffer) 853 854 decoder := json.NewDecoder(body) 855 decoder.UseNumber() 856 var shape interface{} 857 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 858 var snapshot bytes.Buffer 859 io.Copy(&snapshot, ringBuffer) 860 err = &smithy.DeserializationError{ 861 Err: fmt.Errorf("failed to decode response body, %w", err), 862 Snapshot: snapshot.Bytes(), 863 } 864 return out, metadata, err 865 } 866 867 err = awsRestjson1_deserializeOpDocumentCreateResolverOutput(&output, shape) 868 if err != nil { 869 var snapshot bytes.Buffer 870 io.Copy(&snapshot, ringBuffer) 871 return out, metadata, &smithy.DeserializationError{ 872 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 873 Snapshot: snapshot.Bytes(), 874 } 875 } 876 877 return out, metadata, err 878} 879 880func awsRestjson1_deserializeOpErrorCreateResolver(response *smithyhttp.Response, metadata *middleware.Metadata) error { 881 var errorBuffer bytes.Buffer 882 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 883 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 884 } 885 errorBody := bytes.NewReader(errorBuffer.Bytes()) 886 887 errorCode := "UnknownError" 888 errorMessage := errorCode 889 890 code := response.Header.Get("X-Amzn-ErrorType") 891 if len(code) != 0 { 892 errorCode = restjson.SanitizeErrorCode(code) 893 } 894 895 var buff [1024]byte 896 ringBuffer := smithyio.NewRingBuffer(buff[:]) 897 898 body := io.TeeReader(errorBody, ringBuffer) 899 decoder := json.NewDecoder(body) 900 decoder.UseNumber() 901 code, message, err := restjson.GetErrorInfo(decoder) 902 if err != nil { 903 var snapshot bytes.Buffer 904 io.Copy(&snapshot, ringBuffer) 905 err = &smithy.DeserializationError{ 906 Err: fmt.Errorf("failed to decode response body, %w", err), 907 Snapshot: snapshot.Bytes(), 908 } 909 return err 910 } 911 912 errorBody.Seek(0, io.SeekStart) 913 if len(code) != 0 { 914 errorCode = restjson.SanitizeErrorCode(code) 915 } 916 if len(message) != 0 { 917 errorMessage = message 918 } 919 920 switch { 921 case strings.EqualFold("ConcurrentModificationException", errorCode): 922 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 923 924 case strings.EqualFold("InternalFailureException", errorCode): 925 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 926 927 case strings.EqualFold("NotFoundException", errorCode): 928 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 929 930 case strings.EqualFold("UnauthorizedException", errorCode): 931 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 932 933 default: 934 genericError := &smithy.GenericAPIError{ 935 Code: errorCode, 936 Message: errorMessage, 937 } 938 return genericError 939 940 } 941} 942 943func awsRestjson1_deserializeOpDocumentCreateResolverOutput(v **CreateResolverOutput, value interface{}) error { 944 if v == nil { 945 return fmt.Errorf("unexpected nil of type %T", v) 946 } 947 if value == nil { 948 return nil 949 } 950 951 shape, ok := value.(map[string]interface{}) 952 if !ok { 953 return fmt.Errorf("unexpected JSON type %v", value) 954 } 955 956 var sv *CreateResolverOutput 957 if *v == nil { 958 sv = &CreateResolverOutput{} 959 } else { 960 sv = *v 961 } 962 963 for key, value := range shape { 964 switch key { 965 case "resolver": 966 if err := awsRestjson1_deserializeDocumentResolver(&sv.Resolver, value); err != nil { 967 return err 968 } 969 970 default: 971 _, _ = key, value 972 973 } 974 } 975 *v = sv 976 return nil 977} 978 979type awsRestjson1_deserializeOpCreateType struct { 980} 981 982func (*awsRestjson1_deserializeOpCreateType) ID() string { 983 return "OperationDeserializer" 984} 985 986func (m *awsRestjson1_deserializeOpCreateType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 987 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 988) { 989 out, metadata, err = next.HandleDeserialize(ctx, in) 990 if err != nil { 991 return out, metadata, err 992 } 993 994 response, ok := out.RawResponse.(*smithyhttp.Response) 995 if !ok { 996 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 997 } 998 999 if response.StatusCode < 200 || response.StatusCode >= 300 { 1000 return out, metadata, awsRestjson1_deserializeOpErrorCreateType(response, &metadata) 1001 } 1002 output := &CreateTypeOutput{} 1003 out.Result = output 1004 1005 var buff [1024]byte 1006 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1007 1008 body := io.TeeReader(response.Body, ringBuffer) 1009 1010 decoder := json.NewDecoder(body) 1011 decoder.UseNumber() 1012 var shape interface{} 1013 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1014 var snapshot bytes.Buffer 1015 io.Copy(&snapshot, ringBuffer) 1016 err = &smithy.DeserializationError{ 1017 Err: fmt.Errorf("failed to decode response body, %w", err), 1018 Snapshot: snapshot.Bytes(), 1019 } 1020 return out, metadata, err 1021 } 1022 1023 err = awsRestjson1_deserializeOpDocumentCreateTypeOutput(&output, shape) 1024 if err != nil { 1025 var snapshot bytes.Buffer 1026 io.Copy(&snapshot, ringBuffer) 1027 return out, metadata, &smithy.DeserializationError{ 1028 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1029 Snapshot: snapshot.Bytes(), 1030 } 1031 } 1032 1033 return out, metadata, err 1034} 1035 1036func awsRestjson1_deserializeOpErrorCreateType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1037 var errorBuffer bytes.Buffer 1038 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1039 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1040 } 1041 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1042 1043 errorCode := "UnknownError" 1044 errorMessage := errorCode 1045 1046 code := response.Header.Get("X-Amzn-ErrorType") 1047 if len(code) != 0 { 1048 errorCode = restjson.SanitizeErrorCode(code) 1049 } 1050 1051 var buff [1024]byte 1052 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1053 1054 body := io.TeeReader(errorBody, ringBuffer) 1055 decoder := json.NewDecoder(body) 1056 decoder.UseNumber() 1057 code, message, err := restjson.GetErrorInfo(decoder) 1058 if err != nil { 1059 var snapshot bytes.Buffer 1060 io.Copy(&snapshot, ringBuffer) 1061 err = &smithy.DeserializationError{ 1062 Err: fmt.Errorf("failed to decode response body, %w", err), 1063 Snapshot: snapshot.Bytes(), 1064 } 1065 return err 1066 } 1067 1068 errorBody.Seek(0, io.SeekStart) 1069 if len(code) != 0 { 1070 errorCode = restjson.SanitizeErrorCode(code) 1071 } 1072 if len(message) != 0 { 1073 errorMessage = message 1074 } 1075 1076 switch { 1077 case strings.EqualFold("BadRequestException", errorCode): 1078 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1079 1080 case strings.EqualFold("ConcurrentModificationException", errorCode): 1081 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1082 1083 case strings.EqualFold("InternalFailureException", errorCode): 1084 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1085 1086 case strings.EqualFold("NotFoundException", errorCode): 1087 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1088 1089 case strings.EqualFold("UnauthorizedException", errorCode): 1090 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1091 1092 default: 1093 genericError := &smithy.GenericAPIError{ 1094 Code: errorCode, 1095 Message: errorMessage, 1096 } 1097 return genericError 1098 1099 } 1100} 1101 1102func awsRestjson1_deserializeOpDocumentCreateTypeOutput(v **CreateTypeOutput, value interface{}) error { 1103 if v == nil { 1104 return fmt.Errorf("unexpected nil of type %T", v) 1105 } 1106 if value == nil { 1107 return nil 1108 } 1109 1110 shape, ok := value.(map[string]interface{}) 1111 if !ok { 1112 return fmt.Errorf("unexpected JSON type %v", value) 1113 } 1114 1115 var sv *CreateTypeOutput 1116 if *v == nil { 1117 sv = &CreateTypeOutput{} 1118 } else { 1119 sv = *v 1120 } 1121 1122 for key, value := range shape { 1123 switch key { 1124 case "type": 1125 if err := awsRestjson1_deserializeDocumentType(&sv.Type, value); err != nil { 1126 return err 1127 } 1128 1129 default: 1130 _, _ = key, value 1131 1132 } 1133 } 1134 *v = sv 1135 return nil 1136} 1137 1138type awsRestjson1_deserializeOpDeleteApiCache struct { 1139} 1140 1141func (*awsRestjson1_deserializeOpDeleteApiCache) ID() string { 1142 return "OperationDeserializer" 1143} 1144 1145func (m *awsRestjson1_deserializeOpDeleteApiCache) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1146 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1147) { 1148 out, metadata, err = next.HandleDeserialize(ctx, in) 1149 if err != nil { 1150 return out, metadata, err 1151 } 1152 1153 response, ok := out.RawResponse.(*smithyhttp.Response) 1154 if !ok { 1155 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1156 } 1157 1158 if response.StatusCode < 200 || response.StatusCode >= 300 { 1159 return out, metadata, awsRestjson1_deserializeOpErrorDeleteApiCache(response, &metadata) 1160 } 1161 output := &DeleteApiCacheOutput{} 1162 out.Result = output 1163 1164 return out, metadata, err 1165} 1166 1167func awsRestjson1_deserializeOpErrorDeleteApiCache(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1168 var errorBuffer bytes.Buffer 1169 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1170 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1171 } 1172 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1173 1174 errorCode := "UnknownError" 1175 errorMessage := errorCode 1176 1177 code := response.Header.Get("X-Amzn-ErrorType") 1178 if len(code) != 0 { 1179 errorCode = restjson.SanitizeErrorCode(code) 1180 } 1181 1182 var buff [1024]byte 1183 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1184 1185 body := io.TeeReader(errorBody, ringBuffer) 1186 decoder := json.NewDecoder(body) 1187 decoder.UseNumber() 1188 code, message, err := restjson.GetErrorInfo(decoder) 1189 if err != nil { 1190 var snapshot bytes.Buffer 1191 io.Copy(&snapshot, ringBuffer) 1192 err = &smithy.DeserializationError{ 1193 Err: fmt.Errorf("failed to decode response body, %w", err), 1194 Snapshot: snapshot.Bytes(), 1195 } 1196 return err 1197 } 1198 1199 errorBody.Seek(0, io.SeekStart) 1200 if len(code) != 0 { 1201 errorCode = restjson.SanitizeErrorCode(code) 1202 } 1203 if len(message) != 0 { 1204 errorMessage = message 1205 } 1206 1207 switch { 1208 case strings.EqualFold("BadRequestException", errorCode): 1209 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1210 1211 case strings.EqualFold("ConcurrentModificationException", errorCode): 1212 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1213 1214 case strings.EqualFold("InternalFailureException", errorCode): 1215 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1216 1217 case strings.EqualFold("NotFoundException", errorCode): 1218 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1219 1220 case strings.EqualFold("UnauthorizedException", errorCode): 1221 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1222 1223 default: 1224 genericError := &smithy.GenericAPIError{ 1225 Code: errorCode, 1226 Message: errorMessage, 1227 } 1228 return genericError 1229 1230 } 1231} 1232 1233type awsRestjson1_deserializeOpDeleteApiKey struct { 1234} 1235 1236func (*awsRestjson1_deserializeOpDeleteApiKey) ID() string { 1237 return "OperationDeserializer" 1238} 1239 1240func (m *awsRestjson1_deserializeOpDeleteApiKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1241 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1242) { 1243 out, metadata, err = next.HandleDeserialize(ctx, in) 1244 if err != nil { 1245 return out, metadata, err 1246 } 1247 1248 response, ok := out.RawResponse.(*smithyhttp.Response) 1249 if !ok { 1250 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1251 } 1252 1253 if response.StatusCode < 200 || response.StatusCode >= 300 { 1254 return out, metadata, awsRestjson1_deserializeOpErrorDeleteApiKey(response, &metadata) 1255 } 1256 output := &DeleteApiKeyOutput{} 1257 out.Result = output 1258 1259 return out, metadata, err 1260} 1261 1262func awsRestjson1_deserializeOpErrorDeleteApiKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1263 var errorBuffer bytes.Buffer 1264 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1265 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1266 } 1267 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1268 1269 errorCode := "UnknownError" 1270 errorMessage := errorCode 1271 1272 code := response.Header.Get("X-Amzn-ErrorType") 1273 if len(code) != 0 { 1274 errorCode = restjson.SanitizeErrorCode(code) 1275 } 1276 1277 var buff [1024]byte 1278 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1279 1280 body := io.TeeReader(errorBody, ringBuffer) 1281 decoder := json.NewDecoder(body) 1282 decoder.UseNumber() 1283 code, message, err := restjson.GetErrorInfo(decoder) 1284 if err != nil { 1285 var snapshot bytes.Buffer 1286 io.Copy(&snapshot, ringBuffer) 1287 err = &smithy.DeserializationError{ 1288 Err: fmt.Errorf("failed to decode response body, %w", err), 1289 Snapshot: snapshot.Bytes(), 1290 } 1291 return err 1292 } 1293 1294 errorBody.Seek(0, io.SeekStart) 1295 if len(code) != 0 { 1296 errorCode = restjson.SanitizeErrorCode(code) 1297 } 1298 if len(message) != 0 { 1299 errorMessage = message 1300 } 1301 1302 switch { 1303 case strings.EqualFold("BadRequestException", errorCode): 1304 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1305 1306 case strings.EqualFold("InternalFailureException", errorCode): 1307 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1308 1309 case strings.EqualFold("NotFoundException", errorCode): 1310 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1311 1312 case strings.EqualFold("UnauthorizedException", errorCode): 1313 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1314 1315 default: 1316 genericError := &smithy.GenericAPIError{ 1317 Code: errorCode, 1318 Message: errorMessage, 1319 } 1320 return genericError 1321 1322 } 1323} 1324 1325type awsRestjson1_deserializeOpDeleteDataSource struct { 1326} 1327 1328func (*awsRestjson1_deserializeOpDeleteDataSource) ID() string { 1329 return "OperationDeserializer" 1330} 1331 1332func (m *awsRestjson1_deserializeOpDeleteDataSource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1333 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1334) { 1335 out, metadata, err = next.HandleDeserialize(ctx, in) 1336 if err != nil { 1337 return out, metadata, err 1338 } 1339 1340 response, ok := out.RawResponse.(*smithyhttp.Response) 1341 if !ok { 1342 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1343 } 1344 1345 if response.StatusCode < 200 || response.StatusCode >= 300 { 1346 return out, metadata, awsRestjson1_deserializeOpErrorDeleteDataSource(response, &metadata) 1347 } 1348 output := &DeleteDataSourceOutput{} 1349 out.Result = output 1350 1351 return out, metadata, err 1352} 1353 1354func awsRestjson1_deserializeOpErrorDeleteDataSource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1355 var errorBuffer bytes.Buffer 1356 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1357 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1358 } 1359 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1360 1361 errorCode := "UnknownError" 1362 errorMessage := errorCode 1363 1364 code := response.Header.Get("X-Amzn-ErrorType") 1365 if len(code) != 0 { 1366 errorCode = restjson.SanitizeErrorCode(code) 1367 } 1368 1369 var buff [1024]byte 1370 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1371 1372 body := io.TeeReader(errorBody, ringBuffer) 1373 decoder := json.NewDecoder(body) 1374 decoder.UseNumber() 1375 code, message, err := restjson.GetErrorInfo(decoder) 1376 if err != nil { 1377 var snapshot bytes.Buffer 1378 io.Copy(&snapshot, ringBuffer) 1379 err = &smithy.DeserializationError{ 1380 Err: fmt.Errorf("failed to decode response body, %w", err), 1381 Snapshot: snapshot.Bytes(), 1382 } 1383 return err 1384 } 1385 1386 errorBody.Seek(0, io.SeekStart) 1387 if len(code) != 0 { 1388 errorCode = restjson.SanitizeErrorCode(code) 1389 } 1390 if len(message) != 0 { 1391 errorMessage = message 1392 } 1393 1394 switch { 1395 case strings.EqualFold("BadRequestException", errorCode): 1396 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1397 1398 case strings.EqualFold("ConcurrentModificationException", errorCode): 1399 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1400 1401 case strings.EqualFold("InternalFailureException", errorCode): 1402 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1403 1404 case strings.EqualFold("NotFoundException", errorCode): 1405 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1406 1407 case strings.EqualFold("UnauthorizedException", errorCode): 1408 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1409 1410 default: 1411 genericError := &smithy.GenericAPIError{ 1412 Code: errorCode, 1413 Message: errorMessage, 1414 } 1415 return genericError 1416 1417 } 1418} 1419 1420type awsRestjson1_deserializeOpDeleteFunction struct { 1421} 1422 1423func (*awsRestjson1_deserializeOpDeleteFunction) ID() string { 1424 return "OperationDeserializer" 1425} 1426 1427func (m *awsRestjson1_deserializeOpDeleteFunction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1428 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1429) { 1430 out, metadata, err = next.HandleDeserialize(ctx, in) 1431 if err != nil { 1432 return out, metadata, err 1433 } 1434 1435 response, ok := out.RawResponse.(*smithyhttp.Response) 1436 if !ok { 1437 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1438 } 1439 1440 if response.StatusCode < 200 || response.StatusCode >= 300 { 1441 return out, metadata, awsRestjson1_deserializeOpErrorDeleteFunction(response, &metadata) 1442 } 1443 output := &DeleteFunctionOutput{} 1444 out.Result = output 1445 1446 return out, metadata, err 1447} 1448 1449func awsRestjson1_deserializeOpErrorDeleteFunction(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1450 var errorBuffer bytes.Buffer 1451 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1452 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1453 } 1454 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1455 1456 errorCode := "UnknownError" 1457 errorMessage := errorCode 1458 1459 code := response.Header.Get("X-Amzn-ErrorType") 1460 if len(code) != 0 { 1461 errorCode = restjson.SanitizeErrorCode(code) 1462 } 1463 1464 var buff [1024]byte 1465 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1466 1467 body := io.TeeReader(errorBody, ringBuffer) 1468 decoder := json.NewDecoder(body) 1469 decoder.UseNumber() 1470 code, message, err := restjson.GetErrorInfo(decoder) 1471 if err != nil { 1472 var snapshot bytes.Buffer 1473 io.Copy(&snapshot, ringBuffer) 1474 err = &smithy.DeserializationError{ 1475 Err: fmt.Errorf("failed to decode response body, %w", err), 1476 Snapshot: snapshot.Bytes(), 1477 } 1478 return err 1479 } 1480 1481 errorBody.Seek(0, io.SeekStart) 1482 if len(code) != 0 { 1483 errorCode = restjson.SanitizeErrorCode(code) 1484 } 1485 if len(message) != 0 { 1486 errorMessage = message 1487 } 1488 1489 switch { 1490 case strings.EqualFold("ConcurrentModificationException", errorCode): 1491 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1492 1493 case strings.EqualFold("InternalFailureException", errorCode): 1494 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1495 1496 case strings.EqualFold("NotFoundException", errorCode): 1497 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1498 1499 case strings.EqualFold("UnauthorizedException", errorCode): 1500 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1501 1502 default: 1503 genericError := &smithy.GenericAPIError{ 1504 Code: errorCode, 1505 Message: errorMessage, 1506 } 1507 return genericError 1508 1509 } 1510} 1511 1512type awsRestjson1_deserializeOpDeleteGraphqlApi struct { 1513} 1514 1515func (*awsRestjson1_deserializeOpDeleteGraphqlApi) ID() string { 1516 return "OperationDeserializer" 1517} 1518 1519func (m *awsRestjson1_deserializeOpDeleteGraphqlApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1520 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1521) { 1522 out, metadata, err = next.HandleDeserialize(ctx, in) 1523 if err != nil { 1524 return out, metadata, err 1525 } 1526 1527 response, ok := out.RawResponse.(*smithyhttp.Response) 1528 if !ok { 1529 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1530 } 1531 1532 if response.StatusCode < 200 || response.StatusCode >= 300 { 1533 return out, metadata, awsRestjson1_deserializeOpErrorDeleteGraphqlApi(response, &metadata) 1534 } 1535 output := &DeleteGraphqlApiOutput{} 1536 out.Result = output 1537 1538 return out, metadata, err 1539} 1540 1541func awsRestjson1_deserializeOpErrorDeleteGraphqlApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1542 var errorBuffer bytes.Buffer 1543 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1544 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1545 } 1546 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1547 1548 errorCode := "UnknownError" 1549 errorMessage := errorCode 1550 1551 code := response.Header.Get("X-Amzn-ErrorType") 1552 if len(code) != 0 { 1553 errorCode = restjson.SanitizeErrorCode(code) 1554 } 1555 1556 var buff [1024]byte 1557 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1558 1559 body := io.TeeReader(errorBody, ringBuffer) 1560 decoder := json.NewDecoder(body) 1561 decoder.UseNumber() 1562 code, message, err := restjson.GetErrorInfo(decoder) 1563 if err != nil { 1564 var snapshot bytes.Buffer 1565 io.Copy(&snapshot, ringBuffer) 1566 err = &smithy.DeserializationError{ 1567 Err: fmt.Errorf("failed to decode response body, %w", err), 1568 Snapshot: snapshot.Bytes(), 1569 } 1570 return err 1571 } 1572 1573 errorBody.Seek(0, io.SeekStart) 1574 if len(code) != 0 { 1575 errorCode = restjson.SanitizeErrorCode(code) 1576 } 1577 if len(message) != 0 { 1578 errorMessage = message 1579 } 1580 1581 switch { 1582 case strings.EqualFold("AccessDeniedException", errorCode): 1583 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1584 1585 case strings.EqualFold("BadRequestException", errorCode): 1586 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1587 1588 case strings.EqualFold("ConcurrentModificationException", errorCode): 1589 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1590 1591 case strings.EqualFold("InternalFailureException", errorCode): 1592 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1593 1594 case strings.EqualFold("NotFoundException", errorCode): 1595 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1596 1597 case strings.EqualFold("UnauthorizedException", errorCode): 1598 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1599 1600 default: 1601 genericError := &smithy.GenericAPIError{ 1602 Code: errorCode, 1603 Message: errorMessage, 1604 } 1605 return genericError 1606 1607 } 1608} 1609 1610type awsRestjson1_deserializeOpDeleteResolver struct { 1611} 1612 1613func (*awsRestjson1_deserializeOpDeleteResolver) ID() string { 1614 return "OperationDeserializer" 1615} 1616 1617func (m *awsRestjson1_deserializeOpDeleteResolver) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1618 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1619) { 1620 out, metadata, err = next.HandleDeserialize(ctx, in) 1621 if err != nil { 1622 return out, metadata, err 1623 } 1624 1625 response, ok := out.RawResponse.(*smithyhttp.Response) 1626 if !ok { 1627 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1628 } 1629 1630 if response.StatusCode < 200 || response.StatusCode >= 300 { 1631 return out, metadata, awsRestjson1_deserializeOpErrorDeleteResolver(response, &metadata) 1632 } 1633 output := &DeleteResolverOutput{} 1634 out.Result = output 1635 1636 return out, metadata, err 1637} 1638 1639func awsRestjson1_deserializeOpErrorDeleteResolver(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1640 var errorBuffer bytes.Buffer 1641 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1642 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1643 } 1644 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1645 1646 errorCode := "UnknownError" 1647 errorMessage := errorCode 1648 1649 code := response.Header.Get("X-Amzn-ErrorType") 1650 if len(code) != 0 { 1651 errorCode = restjson.SanitizeErrorCode(code) 1652 } 1653 1654 var buff [1024]byte 1655 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1656 1657 body := io.TeeReader(errorBody, ringBuffer) 1658 decoder := json.NewDecoder(body) 1659 decoder.UseNumber() 1660 code, message, err := restjson.GetErrorInfo(decoder) 1661 if err != nil { 1662 var snapshot bytes.Buffer 1663 io.Copy(&snapshot, ringBuffer) 1664 err = &smithy.DeserializationError{ 1665 Err: fmt.Errorf("failed to decode response body, %w", err), 1666 Snapshot: snapshot.Bytes(), 1667 } 1668 return err 1669 } 1670 1671 errorBody.Seek(0, io.SeekStart) 1672 if len(code) != 0 { 1673 errorCode = restjson.SanitizeErrorCode(code) 1674 } 1675 if len(message) != 0 { 1676 errorMessage = message 1677 } 1678 1679 switch { 1680 case strings.EqualFold("ConcurrentModificationException", errorCode): 1681 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1682 1683 case strings.EqualFold("InternalFailureException", errorCode): 1684 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1685 1686 case strings.EqualFold("NotFoundException", errorCode): 1687 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1688 1689 case strings.EqualFold("UnauthorizedException", errorCode): 1690 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1691 1692 default: 1693 genericError := &smithy.GenericAPIError{ 1694 Code: errorCode, 1695 Message: errorMessage, 1696 } 1697 return genericError 1698 1699 } 1700} 1701 1702type awsRestjson1_deserializeOpDeleteType struct { 1703} 1704 1705func (*awsRestjson1_deserializeOpDeleteType) ID() string { 1706 return "OperationDeserializer" 1707} 1708 1709func (m *awsRestjson1_deserializeOpDeleteType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1710 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1711) { 1712 out, metadata, err = next.HandleDeserialize(ctx, in) 1713 if err != nil { 1714 return out, metadata, err 1715 } 1716 1717 response, ok := out.RawResponse.(*smithyhttp.Response) 1718 if !ok { 1719 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1720 } 1721 1722 if response.StatusCode < 200 || response.StatusCode >= 300 { 1723 return out, metadata, awsRestjson1_deserializeOpErrorDeleteType(response, &metadata) 1724 } 1725 output := &DeleteTypeOutput{} 1726 out.Result = output 1727 1728 return out, metadata, err 1729} 1730 1731func awsRestjson1_deserializeOpErrorDeleteType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1732 var errorBuffer bytes.Buffer 1733 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1734 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1735 } 1736 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1737 1738 errorCode := "UnknownError" 1739 errorMessage := errorCode 1740 1741 code := response.Header.Get("X-Amzn-ErrorType") 1742 if len(code) != 0 { 1743 errorCode = restjson.SanitizeErrorCode(code) 1744 } 1745 1746 var buff [1024]byte 1747 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1748 1749 body := io.TeeReader(errorBody, ringBuffer) 1750 decoder := json.NewDecoder(body) 1751 decoder.UseNumber() 1752 code, message, err := restjson.GetErrorInfo(decoder) 1753 if err != nil { 1754 var snapshot bytes.Buffer 1755 io.Copy(&snapshot, ringBuffer) 1756 err = &smithy.DeserializationError{ 1757 Err: fmt.Errorf("failed to decode response body, %w", err), 1758 Snapshot: snapshot.Bytes(), 1759 } 1760 return err 1761 } 1762 1763 errorBody.Seek(0, io.SeekStart) 1764 if len(code) != 0 { 1765 errorCode = restjson.SanitizeErrorCode(code) 1766 } 1767 if len(message) != 0 { 1768 errorMessage = message 1769 } 1770 1771 switch { 1772 case strings.EqualFold("BadRequestException", errorCode): 1773 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1774 1775 case strings.EqualFold("ConcurrentModificationException", errorCode): 1776 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1777 1778 case strings.EqualFold("InternalFailureException", errorCode): 1779 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1780 1781 case strings.EqualFold("NotFoundException", errorCode): 1782 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1783 1784 case strings.EqualFold("UnauthorizedException", errorCode): 1785 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1786 1787 default: 1788 genericError := &smithy.GenericAPIError{ 1789 Code: errorCode, 1790 Message: errorMessage, 1791 } 1792 return genericError 1793 1794 } 1795} 1796 1797type awsRestjson1_deserializeOpFlushApiCache struct { 1798} 1799 1800func (*awsRestjson1_deserializeOpFlushApiCache) ID() string { 1801 return "OperationDeserializer" 1802} 1803 1804func (m *awsRestjson1_deserializeOpFlushApiCache) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1805 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1806) { 1807 out, metadata, err = next.HandleDeserialize(ctx, in) 1808 if err != nil { 1809 return out, metadata, err 1810 } 1811 1812 response, ok := out.RawResponse.(*smithyhttp.Response) 1813 if !ok { 1814 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1815 } 1816 1817 if response.StatusCode < 200 || response.StatusCode >= 300 { 1818 return out, metadata, awsRestjson1_deserializeOpErrorFlushApiCache(response, &metadata) 1819 } 1820 output := &FlushApiCacheOutput{} 1821 out.Result = output 1822 1823 return out, metadata, err 1824} 1825 1826func awsRestjson1_deserializeOpErrorFlushApiCache(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1827 var errorBuffer bytes.Buffer 1828 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1829 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1830 } 1831 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1832 1833 errorCode := "UnknownError" 1834 errorMessage := errorCode 1835 1836 code := response.Header.Get("X-Amzn-ErrorType") 1837 if len(code) != 0 { 1838 errorCode = restjson.SanitizeErrorCode(code) 1839 } 1840 1841 var buff [1024]byte 1842 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1843 1844 body := io.TeeReader(errorBody, ringBuffer) 1845 decoder := json.NewDecoder(body) 1846 decoder.UseNumber() 1847 code, message, err := restjson.GetErrorInfo(decoder) 1848 if err != nil { 1849 var snapshot bytes.Buffer 1850 io.Copy(&snapshot, ringBuffer) 1851 err = &smithy.DeserializationError{ 1852 Err: fmt.Errorf("failed to decode response body, %w", err), 1853 Snapshot: snapshot.Bytes(), 1854 } 1855 return err 1856 } 1857 1858 errorBody.Seek(0, io.SeekStart) 1859 if len(code) != 0 { 1860 errorCode = restjson.SanitizeErrorCode(code) 1861 } 1862 if len(message) != 0 { 1863 errorMessage = message 1864 } 1865 1866 switch { 1867 case strings.EqualFold("BadRequestException", errorCode): 1868 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1869 1870 case strings.EqualFold("ConcurrentModificationException", errorCode): 1871 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1872 1873 case strings.EqualFold("InternalFailureException", errorCode): 1874 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1875 1876 case strings.EqualFold("NotFoundException", errorCode): 1877 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1878 1879 case strings.EqualFold("UnauthorizedException", errorCode): 1880 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 1881 1882 default: 1883 genericError := &smithy.GenericAPIError{ 1884 Code: errorCode, 1885 Message: errorMessage, 1886 } 1887 return genericError 1888 1889 } 1890} 1891 1892type awsRestjson1_deserializeOpGetApiCache struct { 1893} 1894 1895func (*awsRestjson1_deserializeOpGetApiCache) ID() string { 1896 return "OperationDeserializer" 1897} 1898 1899func (m *awsRestjson1_deserializeOpGetApiCache) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1900 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1901) { 1902 out, metadata, err = next.HandleDeserialize(ctx, in) 1903 if err != nil { 1904 return out, metadata, err 1905 } 1906 1907 response, ok := out.RawResponse.(*smithyhttp.Response) 1908 if !ok { 1909 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1910 } 1911 1912 if response.StatusCode < 200 || response.StatusCode >= 300 { 1913 return out, metadata, awsRestjson1_deserializeOpErrorGetApiCache(response, &metadata) 1914 } 1915 output := &GetApiCacheOutput{} 1916 out.Result = output 1917 1918 var buff [1024]byte 1919 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1920 1921 body := io.TeeReader(response.Body, ringBuffer) 1922 1923 decoder := json.NewDecoder(body) 1924 decoder.UseNumber() 1925 var shape interface{} 1926 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1927 var snapshot bytes.Buffer 1928 io.Copy(&snapshot, ringBuffer) 1929 err = &smithy.DeserializationError{ 1930 Err: fmt.Errorf("failed to decode response body, %w", err), 1931 Snapshot: snapshot.Bytes(), 1932 } 1933 return out, metadata, err 1934 } 1935 1936 err = awsRestjson1_deserializeOpDocumentGetApiCacheOutput(&output, shape) 1937 if err != nil { 1938 var snapshot bytes.Buffer 1939 io.Copy(&snapshot, ringBuffer) 1940 return out, metadata, &smithy.DeserializationError{ 1941 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1942 Snapshot: snapshot.Bytes(), 1943 } 1944 } 1945 1946 return out, metadata, err 1947} 1948 1949func awsRestjson1_deserializeOpErrorGetApiCache(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1950 var errorBuffer bytes.Buffer 1951 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1952 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1953 } 1954 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1955 1956 errorCode := "UnknownError" 1957 errorMessage := errorCode 1958 1959 code := response.Header.Get("X-Amzn-ErrorType") 1960 if len(code) != 0 { 1961 errorCode = restjson.SanitizeErrorCode(code) 1962 } 1963 1964 var buff [1024]byte 1965 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1966 1967 body := io.TeeReader(errorBody, ringBuffer) 1968 decoder := json.NewDecoder(body) 1969 decoder.UseNumber() 1970 code, message, err := restjson.GetErrorInfo(decoder) 1971 if err != nil { 1972 var snapshot bytes.Buffer 1973 io.Copy(&snapshot, ringBuffer) 1974 err = &smithy.DeserializationError{ 1975 Err: fmt.Errorf("failed to decode response body, %w", err), 1976 Snapshot: snapshot.Bytes(), 1977 } 1978 return err 1979 } 1980 1981 errorBody.Seek(0, io.SeekStart) 1982 if len(code) != 0 { 1983 errorCode = restjson.SanitizeErrorCode(code) 1984 } 1985 if len(message) != 0 { 1986 errorMessage = message 1987 } 1988 1989 switch { 1990 case strings.EqualFold("BadRequestException", errorCode): 1991 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1992 1993 case strings.EqualFold("ConcurrentModificationException", errorCode): 1994 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 1995 1996 case strings.EqualFold("InternalFailureException", errorCode): 1997 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1998 1999 case strings.EqualFold("NotFoundException", errorCode): 2000 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2001 2002 case strings.EqualFold("UnauthorizedException", errorCode): 2003 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 2004 2005 default: 2006 genericError := &smithy.GenericAPIError{ 2007 Code: errorCode, 2008 Message: errorMessage, 2009 } 2010 return genericError 2011 2012 } 2013} 2014 2015func awsRestjson1_deserializeOpDocumentGetApiCacheOutput(v **GetApiCacheOutput, value interface{}) error { 2016 if v == nil { 2017 return fmt.Errorf("unexpected nil of type %T", v) 2018 } 2019 if value == nil { 2020 return nil 2021 } 2022 2023 shape, ok := value.(map[string]interface{}) 2024 if !ok { 2025 return fmt.Errorf("unexpected JSON type %v", value) 2026 } 2027 2028 var sv *GetApiCacheOutput 2029 if *v == nil { 2030 sv = &GetApiCacheOutput{} 2031 } else { 2032 sv = *v 2033 } 2034 2035 for key, value := range shape { 2036 switch key { 2037 case "apiCache": 2038 if err := awsRestjson1_deserializeDocumentApiCache(&sv.ApiCache, value); err != nil { 2039 return err 2040 } 2041 2042 default: 2043 _, _ = key, value 2044 2045 } 2046 } 2047 *v = sv 2048 return nil 2049} 2050 2051type awsRestjson1_deserializeOpGetDataSource struct { 2052} 2053 2054func (*awsRestjson1_deserializeOpGetDataSource) ID() string { 2055 return "OperationDeserializer" 2056} 2057 2058func (m *awsRestjson1_deserializeOpGetDataSource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2059 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2060) { 2061 out, metadata, err = next.HandleDeserialize(ctx, in) 2062 if err != nil { 2063 return out, metadata, err 2064 } 2065 2066 response, ok := out.RawResponse.(*smithyhttp.Response) 2067 if !ok { 2068 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2069 } 2070 2071 if response.StatusCode < 200 || response.StatusCode >= 300 { 2072 return out, metadata, awsRestjson1_deserializeOpErrorGetDataSource(response, &metadata) 2073 } 2074 output := &GetDataSourceOutput{} 2075 out.Result = output 2076 2077 var buff [1024]byte 2078 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2079 2080 body := io.TeeReader(response.Body, ringBuffer) 2081 2082 decoder := json.NewDecoder(body) 2083 decoder.UseNumber() 2084 var shape interface{} 2085 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2086 var snapshot bytes.Buffer 2087 io.Copy(&snapshot, ringBuffer) 2088 err = &smithy.DeserializationError{ 2089 Err: fmt.Errorf("failed to decode response body, %w", err), 2090 Snapshot: snapshot.Bytes(), 2091 } 2092 return out, metadata, err 2093 } 2094 2095 err = awsRestjson1_deserializeOpDocumentGetDataSourceOutput(&output, shape) 2096 if err != nil { 2097 var snapshot bytes.Buffer 2098 io.Copy(&snapshot, ringBuffer) 2099 return out, metadata, &smithy.DeserializationError{ 2100 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2101 Snapshot: snapshot.Bytes(), 2102 } 2103 } 2104 2105 return out, metadata, err 2106} 2107 2108func awsRestjson1_deserializeOpErrorGetDataSource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2109 var errorBuffer bytes.Buffer 2110 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2111 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2112 } 2113 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2114 2115 errorCode := "UnknownError" 2116 errorMessage := errorCode 2117 2118 code := response.Header.Get("X-Amzn-ErrorType") 2119 if len(code) != 0 { 2120 errorCode = restjson.SanitizeErrorCode(code) 2121 } 2122 2123 var buff [1024]byte 2124 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2125 2126 body := io.TeeReader(errorBody, ringBuffer) 2127 decoder := json.NewDecoder(body) 2128 decoder.UseNumber() 2129 code, message, err := restjson.GetErrorInfo(decoder) 2130 if err != nil { 2131 var snapshot bytes.Buffer 2132 io.Copy(&snapshot, ringBuffer) 2133 err = &smithy.DeserializationError{ 2134 Err: fmt.Errorf("failed to decode response body, %w", err), 2135 Snapshot: snapshot.Bytes(), 2136 } 2137 return err 2138 } 2139 2140 errorBody.Seek(0, io.SeekStart) 2141 if len(code) != 0 { 2142 errorCode = restjson.SanitizeErrorCode(code) 2143 } 2144 if len(message) != 0 { 2145 errorMessage = message 2146 } 2147 2148 switch { 2149 case strings.EqualFold("BadRequestException", errorCode): 2150 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2151 2152 case strings.EqualFold("ConcurrentModificationException", errorCode): 2153 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 2154 2155 case strings.EqualFold("InternalFailureException", errorCode): 2156 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 2157 2158 case strings.EqualFold("NotFoundException", errorCode): 2159 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2160 2161 case strings.EqualFold("UnauthorizedException", errorCode): 2162 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 2163 2164 default: 2165 genericError := &smithy.GenericAPIError{ 2166 Code: errorCode, 2167 Message: errorMessage, 2168 } 2169 return genericError 2170 2171 } 2172} 2173 2174func awsRestjson1_deserializeOpDocumentGetDataSourceOutput(v **GetDataSourceOutput, value interface{}) error { 2175 if v == nil { 2176 return fmt.Errorf("unexpected nil of type %T", v) 2177 } 2178 if value == nil { 2179 return nil 2180 } 2181 2182 shape, ok := value.(map[string]interface{}) 2183 if !ok { 2184 return fmt.Errorf("unexpected JSON type %v", value) 2185 } 2186 2187 var sv *GetDataSourceOutput 2188 if *v == nil { 2189 sv = &GetDataSourceOutput{} 2190 } else { 2191 sv = *v 2192 } 2193 2194 for key, value := range shape { 2195 switch key { 2196 case "dataSource": 2197 if err := awsRestjson1_deserializeDocumentDataSource(&sv.DataSource, value); err != nil { 2198 return err 2199 } 2200 2201 default: 2202 _, _ = key, value 2203 2204 } 2205 } 2206 *v = sv 2207 return nil 2208} 2209 2210type awsRestjson1_deserializeOpGetFunction struct { 2211} 2212 2213func (*awsRestjson1_deserializeOpGetFunction) ID() string { 2214 return "OperationDeserializer" 2215} 2216 2217func (m *awsRestjson1_deserializeOpGetFunction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2218 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2219) { 2220 out, metadata, err = next.HandleDeserialize(ctx, in) 2221 if err != nil { 2222 return out, metadata, err 2223 } 2224 2225 response, ok := out.RawResponse.(*smithyhttp.Response) 2226 if !ok { 2227 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2228 } 2229 2230 if response.StatusCode < 200 || response.StatusCode >= 300 { 2231 return out, metadata, awsRestjson1_deserializeOpErrorGetFunction(response, &metadata) 2232 } 2233 output := &GetFunctionOutput{} 2234 out.Result = output 2235 2236 var buff [1024]byte 2237 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2238 2239 body := io.TeeReader(response.Body, ringBuffer) 2240 2241 decoder := json.NewDecoder(body) 2242 decoder.UseNumber() 2243 var shape interface{} 2244 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2245 var snapshot bytes.Buffer 2246 io.Copy(&snapshot, ringBuffer) 2247 err = &smithy.DeserializationError{ 2248 Err: fmt.Errorf("failed to decode response body, %w", err), 2249 Snapshot: snapshot.Bytes(), 2250 } 2251 return out, metadata, err 2252 } 2253 2254 err = awsRestjson1_deserializeOpDocumentGetFunctionOutput(&output, shape) 2255 if err != nil { 2256 var snapshot bytes.Buffer 2257 io.Copy(&snapshot, ringBuffer) 2258 return out, metadata, &smithy.DeserializationError{ 2259 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2260 Snapshot: snapshot.Bytes(), 2261 } 2262 } 2263 2264 return out, metadata, err 2265} 2266 2267func awsRestjson1_deserializeOpErrorGetFunction(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2268 var errorBuffer bytes.Buffer 2269 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2270 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2271 } 2272 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2273 2274 errorCode := "UnknownError" 2275 errorMessage := errorCode 2276 2277 code := response.Header.Get("X-Amzn-ErrorType") 2278 if len(code) != 0 { 2279 errorCode = restjson.SanitizeErrorCode(code) 2280 } 2281 2282 var buff [1024]byte 2283 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2284 2285 body := io.TeeReader(errorBody, ringBuffer) 2286 decoder := json.NewDecoder(body) 2287 decoder.UseNumber() 2288 code, message, err := restjson.GetErrorInfo(decoder) 2289 if err != nil { 2290 var snapshot bytes.Buffer 2291 io.Copy(&snapshot, ringBuffer) 2292 err = &smithy.DeserializationError{ 2293 Err: fmt.Errorf("failed to decode response body, %w", err), 2294 Snapshot: snapshot.Bytes(), 2295 } 2296 return err 2297 } 2298 2299 errorBody.Seek(0, io.SeekStart) 2300 if len(code) != 0 { 2301 errorCode = restjson.SanitizeErrorCode(code) 2302 } 2303 if len(message) != 0 { 2304 errorMessage = message 2305 } 2306 2307 switch { 2308 case strings.EqualFold("ConcurrentModificationException", errorCode): 2309 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 2310 2311 case strings.EqualFold("NotFoundException", errorCode): 2312 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2313 2314 case strings.EqualFold("UnauthorizedException", errorCode): 2315 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 2316 2317 default: 2318 genericError := &smithy.GenericAPIError{ 2319 Code: errorCode, 2320 Message: errorMessage, 2321 } 2322 return genericError 2323 2324 } 2325} 2326 2327func awsRestjson1_deserializeOpDocumentGetFunctionOutput(v **GetFunctionOutput, value interface{}) error { 2328 if v == nil { 2329 return fmt.Errorf("unexpected nil of type %T", v) 2330 } 2331 if value == nil { 2332 return nil 2333 } 2334 2335 shape, ok := value.(map[string]interface{}) 2336 if !ok { 2337 return fmt.Errorf("unexpected JSON type %v", value) 2338 } 2339 2340 var sv *GetFunctionOutput 2341 if *v == nil { 2342 sv = &GetFunctionOutput{} 2343 } else { 2344 sv = *v 2345 } 2346 2347 for key, value := range shape { 2348 switch key { 2349 case "functionConfiguration": 2350 if err := awsRestjson1_deserializeDocumentFunctionConfiguration(&sv.FunctionConfiguration, value); err != nil { 2351 return err 2352 } 2353 2354 default: 2355 _, _ = key, value 2356 2357 } 2358 } 2359 *v = sv 2360 return nil 2361} 2362 2363type awsRestjson1_deserializeOpGetGraphqlApi struct { 2364} 2365 2366func (*awsRestjson1_deserializeOpGetGraphqlApi) ID() string { 2367 return "OperationDeserializer" 2368} 2369 2370func (m *awsRestjson1_deserializeOpGetGraphqlApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2371 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2372) { 2373 out, metadata, err = next.HandleDeserialize(ctx, in) 2374 if err != nil { 2375 return out, metadata, err 2376 } 2377 2378 response, ok := out.RawResponse.(*smithyhttp.Response) 2379 if !ok { 2380 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2381 } 2382 2383 if response.StatusCode < 200 || response.StatusCode >= 300 { 2384 return out, metadata, awsRestjson1_deserializeOpErrorGetGraphqlApi(response, &metadata) 2385 } 2386 output := &GetGraphqlApiOutput{} 2387 out.Result = output 2388 2389 var buff [1024]byte 2390 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2391 2392 body := io.TeeReader(response.Body, ringBuffer) 2393 2394 decoder := json.NewDecoder(body) 2395 decoder.UseNumber() 2396 var shape interface{} 2397 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2398 var snapshot bytes.Buffer 2399 io.Copy(&snapshot, ringBuffer) 2400 err = &smithy.DeserializationError{ 2401 Err: fmt.Errorf("failed to decode response body, %w", err), 2402 Snapshot: snapshot.Bytes(), 2403 } 2404 return out, metadata, err 2405 } 2406 2407 err = awsRestjson1_deserializeOpDocumentGetGraphqlApiOutput(&output, shape) 2408 if err != nil { 2409 var snapshot bytes.Buffer 2410 io.Copy(&snapshot, ringBuffer) 2411 return out, metadata, &smithy.DeserializationError{ 2412 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2413 Snapshot: snapshot.Bytes(), 2414 } 2415 } 2416 2417 return out, metadata, err 2418} 2419 2420func awsRestjson1_deserializeOpErrorGetGraphqlApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2421 var errorBuffer bytes.Buffer 2422 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2423 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2424 } 2425 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2426 2427 errorCode := "UnknownError" 2428 errorMessage := errorCode 2429 2430 code := response.Header.Get("X-Amzn-ErrorType") 2431 if len(code) != 0 { 2432 errorCode = restjson.SanitizeErrorCode(code) 2433 } 2434 2435 var buff [1024]byte 2436 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2437 2438 body := io.TeeReader(errorBody, ringBuffer) 2439 decoder := json.NewDecoder(body) 2440 decoder.UseNumber() 2441 code, message, err := restjson.GetErrorInfo(decoder) 2442 if err != nil { 2443 var snapshot bytes.Buffer 2444 io.Copy(&snapshot, ringBuffer) 2445 err = &smithy.DeserializationError{ 2446 Err: fmt.Errorf("failed to decode response body, %w", err), 2447 Snapshot: snapshot.Bytes(), 2448 } 2449 return err 2450 } 2451 2452 errorBody.Seek(0, io.SeekStart) 2453 if len(code) != 0 { 2454 errorCode = restjson.SanitizeErrorCode(code) 2455 } 2456 if len(message) != 0 { 2457 errorMessage = message 2458 } 2459 2460 switch { 2461 case strings.EqualFold("AccessDeniedException", errorCode): 2462 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2463 2464 case strings.EqualFold("BadRequestException", errorCode): 2465 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2466 2467 case strings.EqualFold("InternalFailureException", errorCode): 2468 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 2469 2470 case strings.EqualFold("NotFoundException", errorCode): 2471 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2472 2473 case strings.EqualFold("UnauthorizedException", errorCode): 2474 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 2475 2476 default: 2477 genericError := &smithy.GenericAPIError{ 2478 Code: errorCode, 2479 Message: errorMessage, 2480 } 2481 return genericError 2482 2483 } 2484} 2485 2486func awsRestjson1_deserializeOpDocumentGetGraphqlApiOutput(v **GetGraphqlApiOutput, value interface{}) error { 2487 if v == nil { 2488 return fmt.Errorf("unexpected nil of type %T", v) 2489 } 2490 if value == nil { 2491 return nil 2492 } 2493 2494 shape, ok := value.(map[string]interface{}) 2495 if !ok { 2496 return fmt.Errorf("unexpected JSON type %v", value) 2497 } 2498 2499 var sv *GetGraphqlApiOutput 2500 if *v == nil { 2501 sv = &GetGraphqlApiOutput{} 2502 } else { 2503 sv = *v 2504 } 2505 2506 for key, value := range shape { 2507 switch key { 2508 case "graphqlApi": 2509 if err := awsRestjson1_deserializeDocumentGraphqlApi(&sv.GraphqlApi, value); err != nil { 2510 return err 2511 } 2512 2513 default: 2514 _, _ = key, value 2515 2516 } 2517 } 2518 *v = sv 2519 return nil 2520} 2521 2522type awsRestjson1_deserializeOpGetIntrospectionSchema struct { 2523} 2524 2525func (*awsRestjson1_deserializeOpGetIntrospectionSchema) ID() string { 2526 return "OperationDeserializer" 2527} 2528 2529func (m *awsRestjson1_deserializeOpGetIntrospectionSchema) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2530 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2531) { 2532 out, metadata, err = next.HandleDeserialize(ctx, in) 2533 if err != nil { 2534 return out, metadata, err 2535 } 2536 2537 response, ok := out.RawResponse.(*smithyhttp.Response) 2538 if !ok { 2539 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2540 } 2541 2542 if response.StatusCode < 200 || response.StatusCode >= 300 { 2543 return out, metadata, awsRestjson1_deserializeOpErrorGetIntrospectionSchema(response, &metadata) 2544 } 2545 output := &GetIntrospectionSchemaOutput{} 2546 out.Result = output 2547 2548 err = awsRestjson1_deserializeOpDocumentGetIntrospectionSchemaOutput(output, response.Body) 2549 if err != nil { 2550 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} 2551 } 2552 2553 return out, metadata, err 2554} 2555 2556func awsRestjson1_deserializeOpErrorGetIntrospectionSchema(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2557 var errorBuffer bytes.Buffer 2558 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2559 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2560 } 2561 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2562 2563 errorCode := "UnknownError" 2564 errorMessage := errorCode 2565 2566 code := response.Header.Get("X-Amzn-ErrorType") 2567 if len(code) != 0 { 2568 errorCode = restjson.SanitizeErrorCode(code) 2569 } 2570 2571 var buff [1024]byte 2572 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2573 2574 body := io.TeeReader(errorBody, ringBuffer) 2575 decoder := json.NewDecoder(body) 2576 decoder.UseNumber() 2577 code, message, err := restjson.GetErrorInfo(decoder) 2578 if err != nil { 2579 var snapshot bytes.Buffer 2580 io.Copy(&snapshot, ringBuffer) 2581 err = &smithy.DeserializationError{ 2582 Err: fmt.Errorf("failed to decode response body, %w", err), 2583 Snapshot: snapshot.Bytes(), 2584 } 2585 return err 2586 } 2587 2588 errorBody.Seek(0, io.SeekStart) 2589 if len(code) != 0 { 2590 errorCode = restjson.SanitizeErrorCode(code) 2591 } 2592 if len(message) != 0 { 2593 errorMessage = message 2594 } 2595 2596 switch { 2597 case strings.EqualFold("GraphQLSchemaException", errorCode): 2598 return awsRestjson1_deserializeErrorGraphQLSchemaException(response, errorBody) 2599 2600 case strings.EqualFold("InternalFailureException", errorCode): 2601 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 2602 2603 case strings.EqualFold("NotFoundException", errorCode): 2604 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2605 2606 case strings.EqualFold("UnauthorizedException", errorCode): 2607 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 2608 2609 default: 2610 genericError := &smithy.GenericAPIError{ 2611 Code: errorCode, 2612 Message: errorMessage, 2613 } 2614 return genericError 2615 2616 } 2617} 2618 2619func awsRestjson1_deserializeOpDocumentGetIntrospectionSchemaOutput(v *GetIntrospectionSchemaOutput, body io.ReadCloser) error { 2620 if v == nil { 2621 return fmt.Errorf("unsupported deserialization of nil %T", v) 2622 } 2623 2624 bs, err := ioutil.ReadAll(body) 2625 if err != nil { 2626 return err 2627 } 2628 if len(bs) > 0 { 2629 v.Schema = bs 2630 } 2631 return nil 2632} 2633 2634type awsRestjson1_deserializeOpGetResolver struct { 2635} 2636 2637func (*awsRestjson1_deserializeOpGetResolver) ID() string { 2638 return "OperationDeserializer" 2639} 2640 2641func (m *awsRestjson1_deserializeOpGetResolver) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2642 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2643) { 2644 out, metadata, err = next.HandleDeserialize(ctx, in) 2645 if err != nil { 2646 return out, metadata, err 2647 } 2648 2649 response, ok := out.RawResponse.(*smithyhttp.Response) 2650 if !ok { 2651 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2652 } 2653 2654 if response.StatusCode < 200 || response.StatusCode >= 300 { 2655 return out, metadata, awsRestjson1_deserializeOpErrorGetResolver(response, &metadata) 2656 } 2657 output := &GetResolverOutput{} 2658 out.Result = output 2659 2660 var buff [1024]byte 2661 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2662 2663 body := io.TeeReader(response.Body, ringBuffer) 2664 2665 decoder := json.NewDecoder(body) 2666 decoder.UseNumber() 2667 var shape interface{} 2668 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2669 var snapshot bytes.Buffer 2670 io.Copy(&snapshot, ringBuffer) 2671 err = &smithy.DeserializationError{ 2672 Err: fmt.Errorf("failed to decode response body, %w", err), 2673 Snapshot: snapshot.Bytes(), 2674 } 2675 return out, metadata, err 2676 } 2677 2678 err = awsRestjson1_deserializeOpDocumentGetResolverOutput(&output, shape) 2679 if err != nil { 2680 var snapshot bytes.Buffer 2681 io.Copy(&snapshot, ringBuffer) 2682 return out, metadata, &smithy.DeserializationError{ 2683 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2684 Snapshot: snapshot.Bytes(), 2685 } 2686 } 2687 2688 return out, metadata, err 2689} 2690 2691func awsRestjson1_deserializeOpErrorGetResolver(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2692 var errorBuffer bytes.Buffer 2693 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2694 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2695 } 2696 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2697 2698 errorCode := "UnknownError" 2699 errorMessage := errorCode 2700 2701 code := response.Header.Get("X-Amzn-ErrorType") 2702 if len(code) != 0 { 2703 errorCode = restjson.SanitizeErrorCode(code) 2704 } 2705 2706 var buff [1024]byte 2707 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2708 2709 body := io.TeeReader(errorBody, ringBuffer) 2710 decoder := json.NewDecoder(body) 2711 decoder.UseNumber() 2712 code, message, err := restjson.GetErrorInfo(decoder) 2713 if err != nil { 2714 var snapshot bytes.Buffer 2715 io.Copy(&snapshot, ringBuffer) 2716 err = &smithy.DeserializationError{ 2717 Err: fmt.Errorf("failed to decode response body, %w", err), 2718 Snapshot: snapshot.Bytes(), 2719 } 2720 return err 2721 } 2722 2723 errorBody.Seek(0, io.SeekStart) 2724 if len(code) != 0 { 2725 errorCode = restjson.SanitizeErrorCode(code) 2726 } 2727 if len(message) != 0 { 2728 errorMessage = message 2729 } 2730 2731 switch { 2732 case strings.EqualFold("ConcurrentModificationException", errorCode): 2733 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 2734 2735 case strings.EqualFold("NotFoundException", errorCode): 2736 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2737 2738 case strings.EqualFold("UnauthorizedException", errorCode): 2739 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 2740 2741 default: 2742 genericError := &smithy.GenericAPIError{ 2743 Code: errorCode, 2744 Message: errorMessage, 2745 } 2746 return genericError 2747 2748 } 2749} 2750 2751func awsRestjson1_deserializeOpDocumentGetResolverOutput(v **GetResolverOutput, value interface{}) error { 2752 if v == nil { 2753 return fmt.Errorf("unexpected nil of type %T", v) 2754 } 2755 if value == nil { 2756 return nil 2757 } 2758 2759 shape, ok := value.(map[string]interface{}) 2760 if !ok { 2761 return fmt.Errorf("unexpected JSON type %v", value) 2762 } 2763 2764 var sv *GetResolverOutput 2765 if *v == nil { 2766 sv = &GetResolverOutput{} 2767 } else { 2768 sv = *v 2769 } 2770 2771 for key, value := range shape { 2772 switch key { 2773 case "resolver": 2774 if err := awsRestjson1_deserializeDocumentResolver(&sv.Resolver, value); err != nil { 2775 return err 2776 } 2777 2778 default: 2779 _, _ = key, value 2780 2781 } 2782 } 2783 *v = sv 2784 return nil 2785} 2786 2787type awsRestjson1_deserializeOpGetSchemaCreationStatus struct { 2788} 2789 2790func (*awsRestjson1_deserializeOpGetSchemaCreationStatus) ID() string { 2791 return "OperationDeserializer" 2792} 2793 2794func (m *awsRestjson1_deserializeOpGetSchemaCreationStatus) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2795 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2796) { 2797 out, metadata, err = next.HandleDeserialize(ctx, in) 2798 if err != nil { 2799 return out, metadata, err 2800 } 2801 2802 response, ok := out.RawResponse.(*smithyhttp.Response) 2803 if !ok { 2804 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2805 } 2806 2807 if response.StatusCode < 200 || response.StatusCode >= 300 { 2808 return out, metadata, awsRestjson1_deserializeOpErrorGetSchemaCreationStatus(response, &metadata) 2809 } 2810 output := &GetSchemaCreationStatusOutput{} 2811 out.Result = output 2812 2813 var buff [1024]byte 2814 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2815 2816 body := io.TeeReader(response.Body, ringBuffer) 2817 2818 decoder := json.NewDecoder(body) 2819 decoder.UseNumber() 2820 var shape interface{} 2821 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2822 var snapshot bytes.Buffer 2823 io.Copy(&snapshot, ringBuffer) 2824 err = &smithy.DeserializationError{ 2825 Err: fmt.Errorf("failed to decode response body, %w", err), 2826 Snapshot: snapshot.Bytes(), 2827 } 2828 return out, metadata, err 2829 } 2830 2831 err = awsRestjson1_deserializeOpDocumentGetSchemaCreationStatusOutput(&output, shape) 2832 if err != nil { 2833 var snapshot bytes.Buffer 2834 io.Copy(&snapshot, ringBuffer) 2835 return out, metadata, &smithy.DeserializationError{ 2836 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2837 Snapshot: snapshot.Bytes(), 2838 } 2839 } 2840 2841 return out, metadata, err 2842} 2843 2844func awsRestjson1_deserializeOpErrorGetSchemaCreationStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2845 var errorBuffer bytes.Buffer 2846 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2847 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2848 } 2849 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2850 2851 errorCode := "UnknownError" 2852 errorMessage := errorCode 2853 2854 code := response.Header.Get("X-Amzn-ErrorType") 2855 if len(code) != 0 { 2856 errorCode = restjson.SanitizeErrorCode(code) 2857 } 2858 2859 var buff [1024]byte 2860 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2861 2862 body := io.TeeReader(errorBody, ringBuffer) 2863 decoder := json.NewDecoder(body) 2864 decoder.UseNumber() 2865 code, message, err := restjson.GetErrorInfo(decoder) 2866 if err != nil { 2867 var snapshot bytes.Buffer 2868 io.Copy(&snapshot, ringBuffer) 2869 err = &smithy.DeserializationError{ 2870 Err: fmt.Errorf("failed to decode response body, %w", err), 2871 Snapshot: snapshot.Bytes(), 2872 } 2873 return err 2874 } 2875 2876 errorBody.Seek(0, io.SeekStart) 2877 if len(code) != 0 { 2878 errorCode = restjson.SanitizeErrorCode(code) 2879 } 2880 if len(message) != 0 { 2881 errorMessage = message 2882 } 2883 2884 switch { 2885 case strings.EqualFold("BadRequestException", errorCode): 2886 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2887 2888 case strings.EqualFold("InternalFailureException", errorCode): 2889 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 2890 2891 case strings.EqualFold("NotFoundException", errorCode): 2892 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2893 2894 case strings.EqualFold("UnauthorizedException", errorCode): 2895 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 2896 2897 default: 2898 genericError := &smithy.GenericAPIError{ 2899 Code: errorCode, 2900 Message: errorMessage, 2901 } 2902 return genericError 2903 2904 } 2905} 2906 2907func awsRestjson1_deserializeOpDocumentGetSchemaCreationStatusOutput(v **GetSchemaCreationStatusOutput, value interface{}) error { 2908 if v == nil { 2909 return fmt.Errorf("unexpected nil of type %T", v) 2910 } 2911 if value == nil { 2912 return nil 2913 } 2914 2915 shape, ok := value.(map[string]interface{}) 2916 if !ok { 2917 return fmt.Errorf("unexpected JSON type %v", value) 2918 } 2919 2920 var sv *GetSchemaCreationStatusOutput 2921 if *v == nil { 2922 sv = &GetSchemaCreationStatusOutput{} 2923 } else { 2924 sv = *v 2925 } 2926 2927 for key, value := range shape { 2928 switch key { 2929 case "details": 2930 if value != nil { 2931 jtv, ok := value.(string) 2932 if !ok { 2933 return fmt.Errorf("expected String to be of type string, got %T instead", value) 2934 } 2935 sv.Details = ptr.String(jtv) 2936 } 2937 2938 case "status": 2939 if value != nil { 2940 jtv, ok := value.(string) 2941 if !ok { 2942 return fmt.Errorf("expected SchemaStatus to be of type string, got %T instead", value) 2943 } 2944 sv.Status = types.SchemaStatus(jtv) 2945 } 2946 2947 default: 2948 _, _ = key, value 2949 2950 } 2951 } 2952 *v = sv 2953 return nil 2954} 2955 2956type awsRestjson1_deserializeOpGetType struct { 2957} 2958 2959func (*awsRestjson1_deserializeOpGetType) ID() string { 2960 return "OperationDeserializer" 2961} 2962 2963func (m *awsRestjson1_deserializeOpGetType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2964 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2965) { 2966 out, metadata, err = next.HandleDeserialize(ctx, in) 2967 if err != nil { 2968 return out, metadata, err 2969 } 2970 2971 response, ok := out.RawResponse.(*smithyhttp.Response) 2972 if !ok { 2973 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2974 } 2975 2976 if response.StatusCode < 200 || response.StatusCode >= 300 { 2977 return out, metadata, awsRestjson1_deserializeOpErrorGetType(response, &metadata) 2978 } 2979 output := &GetTypeOutput{} 2980 out.Result = output 2981 2982 var buff [1024]byte 2983 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2984 2985 body := io.TeeReader(response.Body, ringBuffer) 2986 2987 decoder := json.NewDecoder(body) 2988 decoder.UseNumber() 2989 var shape interface{} 2990 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2991 var snapshot bytes.Buffer 2992 io.Copy(&snapshot, ringBuffer) 2993 err = &smithy.DeserializationError{ 2994 Err: fmt.Errorf("failed to decode response body, %w", err), 2995 Snapshot: snapshot.Bytes(), 2996 } 2997 return out, metadata, err 2998 } 2999 3000 err = awsRestjson1_deserializeOpDocumentGetTypeOutput(&output, shape) 3001 if err != nil { 3002 var snapshot bytes.Buffer 3003 io.Copy(&snapshot, ringBuffer) 3004 return out, metadata, &smithy.DeserializationError{ 3005 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3006 Snapshot: snapshot.Bytes(), 3007 } 3008 } 3009 3010 return out, metadata, err 3011} 3012 3013func awsRestjson1_deserializeOpErrorGetType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3014 var errorBuffer bytes.Buffer 3015 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3016 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3017 } 3018 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3019 3020 errorCode := "UnknownError" 3021 errorMessage := errorCode 3022 3023 code := response.Header.Get("X-Amzn-ErrorType") 3024 if len(code) != 0 { 3025 errorCode = restjson.SanitizeErrorCode(code) 3026 } 3027 3028 var buff [1024]byte 3029 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3030 3031 body := io.TeeReader(errorBody, ringBuffer) 3032 decoder := json.NewDecoder(body) 3033 decoder.UseNumber() 3034 code, message, err := restjson.GetErrorInfo(decoder) 3035 if err != nil { 3036 var snapshot bytes.Buffer 3037 io.Copy(&snapshot, ringBuffer) 3038 err = &smithy.DeserializationError{ 3039 Err: fmt.Errorf("failed to decode response body, %w", err), 3040 Snapshot: snapshot.Bytes(), 3041 } 3042 return err 3043 } 3044 3045 errorBody.Seek(0, io.SeekStart) 3046 if len(code) != 0 { 3047 errorCode = restjson.SanitizeErrorCode(code) 3048 } 3049 if len(message) != 0 { 3050 errorMessage = message 3051 } 3052 3053 switch { 3054 case strings.EqualFold("BadRequestException", errorCode): 3055 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3056 3057 case strings.EqualFold("ConcurrentModificationException", errorCode): 3058 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 3059 3060 case strings.EqualFold("InternalFailureException", errorCode): 3061 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 3062 3063 case strings.EqualFold("NotFoundException", errorCode): 3064 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3065 3066 case strings.EqualFold("UnauthorizedException", errorCode): 3067 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 3068 3069 default: 3070 genericError := &smithy.GenericAPIError{ 3071 Code: errorCode, 3072 Message: errorMessage, 3073 } 3074 return genericError 3075 3076 } 3077} 3078 3079func awsRestjson1_deserializeOpDocumentGetTypeOutput(v **GetTypeOutput, value interface{}) error { 3080 if v == nil { 3081 return fmt.Errorf("unexpected nil of type %T", v) 3082 } 3083 if value == nil { 3084 return nil 3085 } 3086 3087 shape, ok := value.(map[string]interface{}) 3088 if !ok { 3089 return fmt.Errorf("unexpected JSON type %v", value) 3090 } 3091 3092 var sv *GetTypeOutput 3093 if *v == nil { 3094 sv = &GetTypeOutput{} 3095 } else { 3096 sv = *v 3097 } 3098 3099 for key, value := range shape { 3100 switch key { 3101 case "type": 3102 if err := awsRestjson1_deserializeDocumentType(&sv.Type, value); err != nil { 3103 return err 3104 } 3105 3106 default: 3107 _, _ = key, value 3108 3109 } 3110 } 3111 *v = sv 3112 return nil 3113} 3114 3115type awsRestjson1_deserializeOpListApiKeys struct { 3116} 3117 3118func (*awsRestjson1_deserializeOpListApiKeys) ID() string { 3119 return "OperationDeserializer" 3120} 3121 3122func (m *awsRestjson1_deserializeOpListApiKeys) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3123 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3124) { 3125 out, metadata, err = next.HandleDeserialize(ctx, in) 3126 if err != nil { 3127 return out, metadata, err 3128 } 3129 3130 response, ok := out.RawResponse.(*smithyhttp.Response) 3131 if !ok { 3132 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3133 } 3134 3135 if response.StatusCode < 200 || response.StatusCode >= 300 { 3136 return out, metadata, awsRestjson1_deserializeOpErrorListApiKeys(response, &metadata) 3137 } 3138 output := &ListApiKeysOutput{} 3139 out.Result = output 3140 3141 var buff [1024]byte 3142 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3143 3144 body := io.TeeReader(response.Body, ringBuffer) 3145 3146 decoder := json.NewDecoder(body) 3147 decoder.UseNumber() 3148 var shape interface{} 3149 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3150 var snapshot bytes.Buffer 3151 io.Copy(&snapshot, ringBuffer) 3152 err = &smithy.DeserializationError{ 3153 Err: fmt.Errorf("failed to decode response body, %w", err), 3154 Snapshot: snapshot.Bytes(), 3155 } 3156 return out, metadata, err 3157 } 3158 3159 err = awsRestjson1_deserializeOpDocumentListApiKeysOutput(&output, shape) 3160 if err != nil { 3161 var snapshot bytes.Buffer 3162 io.Copy(&snapshot, ringBuffer) 3163 return out, metadata, &smithy.DeserializationError{ 3164 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3165 Snapshot: snapshot.Bytes(), 3166 } 3167 } 3168 3169 return out, metadata, err 3170} 3171 3172func awsRestjson1_deserializeOpErrorListApiKeys(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3173 var errorBuffer bytes.Buffer 3174 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3175 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3176 } 3177 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3178 3179 errorCode := "UnknownError" 3180 errorMessage := errorCode 3181 3182 code := response.Header.Get("X-Amzn-ErrorType") 3183 if len(code) != 0 { 3184 errorCode = restjson.SanitizeErrorCode(code) 3185 } 3186 3187 var buff [1024]byte 3188 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3189 3190 body := io.TeeReader(errorBody, ringBuffer) 3191 decoder := json.NewDecoder(body) 3192 decoder.UseNumber() 3193 code, message, err := restjson.GetErrorInfo(decoder) 3194 if err != nil { 3195 var snapshot bytes.Buffer 3196 io.Copy(&snapshot, ringBuffer) 3197 err = &smithy.DeserializationError{ 3198 Err: fmt.Errorf("failed to decode response body, %w", err), 3199 Snapshot: snapshot.Bytes(), 3200 } 3201 return err 3202 } 3203 3204 errorBody.Seek(0, io.SeekStart) 3205 if len(code) != 0 { 3206 errorCode = restjson.SanitizeErrorCode(code) 3207 } 3208 if len(message) != 0 { 3209 errorMessage = message 3210 } 3211 3212 switch { 3213 case strings.EqualFold("BadRequestException", errorCode): 3214 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3215 3216 case strings.EqualFold("InternalFailureException", errorCode): 3217 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 3218 3219 case strings.EqualFold("NotFoundException", errorCode): 3220 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3221 3222 case strings.EqualFold("UnauthorizedException", errorCode): 3223 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 3224 3225 default: 3226 genericError := &smithy.GenericAPIError{ 3227 Code: errorCode, 3228 Message: errorMessage, 3229 } 3230 return genericError 3231 3232 } 3233} 3234 3235func awsRestjson1_deserializeOpDocumentListApiKeysOutput(v **ListApiKeysOutput, value interface{}) error { 3236 if v == nil { 3237 return fmt.Errorf("unexpected nil of type %T", v) 3238 } 3239 if value == nil { 3240 return nil 3241 } 3242 3243 shape, ok := value.(map[string]interface{}) 3244 if !ok { 3245 return fmt.Errorf("unexpected JSON type %v", value) 3246 } 3247 3248 var sv *ListApiKeysOutput 3249 if *v == nil { 3250 sv = &ListApiKeysOutput{} 3251 } else { 3252 sv = *v 3253 } 3254 3255 for key, value := range shape { 3256 switch key { 3257 case "apiKeys": 3258 if err := awsRestjson1_deserializeDocumentApiKeys(&sv.ApiKeys, value); err != nil { 3259 return err 3260 } 3261 3262 case "nextToken": 3263 if value != nil { 3264 jtv, ok := value.(string) 3265 if !ok { 3266 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 3267 } 3268 sv.NextToken = ptr.String(jtv) 3269 } 3270 3271 default: 3272 _, _ = key, value 3273 3274 } 3275 } 3276 *v = sv 3277 return nil 3278} 3279 3280type awsRestjson1_deserializeOpListDataSources struct { 3281} 3282 3283func (*awsRestjson1_deserializeOpListDataSources) ID() string { 3284 return "OperationDeserializer" 3285} 3286 3287func (m *awsRestjson1_deserializeOpListDataSources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3288 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3289) { 3290 out, metadata, err = next.HandleDeserialize(ctx, in) 3291 if err != nil { 3292 return out, metadata, err 3293 } 3294 3295 response, ok := out.RawResponse.(*smithyhttp.Response) 3296 if !ok { 3297 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3298 } 3299 3300 if response.StatusCode < 200 || response.StatusCode >= 300 { 3301 return out, metadata, awsRestjson1_deserializeOpErrorListDataSources(response, &metadata) 3302 } 3303 output := &ListDataSourcesOutput{} 3304 out.Result = output 3305 3306 var buff [1024]byte 3307 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3308 3309 body := io.TeeReader(response.Body, ringBuffer) 3310 3311 decoder := json.NewDecoder(body) 3312 decoder.UseNumber() 3313 var shape interface{} 3314 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3315 var snapshot bytes.Buffer 3316 io.Copy(&snapshot, ringBuffer) 3317 err = &smithy.DeserializationError{ 3318 Err: fmt.Errorf("failed to decode response body, %w", err), 3319 Snapshot: snapshot.Bytes(), 3320 } 3321 return out, metadata, err 3322 } 3323 3324 err = awsRestjson1_deserializeOpDocumentListDataSourcesOutput(&output, shape) 3325 if err != nil { 3326 var snapshot bytes.Buffer 3327 io.Copy(&snapshot, ringBuffer) 3328 return out, metadata, &smithy.DeserializationError{ 3329 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3330 Snapshot: snapshot.Bytes(), 3331 } 3332 } 3333 3334 return out, metadata, err 3335} 3336 3337func awsRestjson1_deserializeOpErrorListDataSources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3338 var errorBuffer bytes.Buffer 3339 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3340 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3341 } 3342 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3343 3344 errorCode := "UnknownError" 3345 errorMessage := errorCode 3346 3347 code := response.Header.Get("X-Amzn-ErrorType") 3348 if len(code) != 0 { 3349 errorCode = restjson.SanitizeErrorCode(code) 3350 } 3351 3352 var buff [1024]byte 3353 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3354 3355 body := io.TeeReader(errorBody, ringBuffer) 3356 decoder := json.NewDecoder(body) 3357 decoder.UseNumber() 3358 code, message, err := restjson.GetErrorInfo(decoder) 3359 if err != nil { 3360 var snapshot bytes.Buffer 3361 io.Copy(&snapshot, ringBuffer) 3362 err = &smithy.DeserializationError{ 3363 Err: fmt.Errorf("failed to decode response body, %w", err), 3364 Snapshot: snapshot.Bytes(), 3365 } 3366 return err 3367 } 3368 3369 errorBody.Seek(0, io.SeekStart) 3370 if len(code) != 0 { 3371 errorCode = restjson.SanitizeErrorCode(code) 3372 } 3373 if len(message) != 0 { 3374 errorMessage = message 3375 } 3376 3377 switch { 3378 case strings.EqualFold("BadRequestException", errorCode): 3379 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3380 3381 case strings.EqualFold("InternalFailureException", errorCode): 3382 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 3383 3384 case strings.EqualFold("NotFoundException", errorCode): 3385 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3386 3387 case strings.EqualFold("UnauthorizedException", errorCode): 3388 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 3389 3390 default: 3391 genericError := &smithy.GenericAPIError{ 3392 Code: errorCode, 3393 Message: errorMessage, 3394 } 3395 return genericError 3396 3397 } 3398} 3399 3400func awsRestjson1_deserializeOpDocumentListDataSourcesOutput(v **ListDataSourcesOutput, value interface{}) error { 3401 if v == nil { 3402 return fmt.Errorf("unexpected nil of type %T", v) 3403 } 3404 if value == nil { 3405 return nil 3406 } 3407 3408 shape, ok := value.(map[string]interface{}) 3409 if !ok { 3410 return fmt.Errorf("unexpected JSON type %v", value) 3411 } 3412 3413 var sv *ListDataSourcesOutput 3414 if *v == nil { 3415 sv = &ListDataSourcesOutput{} 3416 } else { 3417 sv = *v 3418 } 3419 3420 for key, value := range shape { 3421 switch key { 3422 case "dataSources": 3423 if err := awsRestjson1_deserializeDocumentDataSources(&sv.DataSources, value); err != nil { 3424 return err 3425 } 3426 3427 case "nextToken": 3428 if value != nil { 3429 jtv, ok := value.(string) 3430 if !ok { 3431 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 3432 } 3433 sv.NextToken = ptr.String(jtv) 3434 } 3435 3436 default: 3437 _, _ = key, value 3438 3439 } 3440 } 3441 *v = sv 3442 return nil 3443} 3444 3445type awsRestjson1_deserializeOpListFunctions struct { 3446} 3447 3448func (*awsRestjson1_deserializeOpListFunctions) ID() string { 3449 return "OperationDeserializer" 3450} 3451 3452func (m *awsRestjson1_deserializeOpListFunctions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3453 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3454) { 3455 out, metadata, err = next.HandleDeserialize(ctx, in) 3456 if err != nil { 3457 return out, metadata, err 3458 } 3459 3460 response, ok := out.RawResponse.(*smithyhttp.Response) 3461 if !ok { 3462 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3463 } 3464 3465 if response.StatusCode < 200 || response.StatusCode >= 300 { 3466 return out, metadata, awsRestjson1_deserializeOpErrorListFunctions(response, &metadata) 3467 } 3468 output := &ListFunctionsOutput{} 3469 out.Result = output 3470 3471 var buff [1024]byte 3472 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3473 3474 body := io.TeeReader(response.Body, ringBuffer) 3475 3476 decoder := json.NewDecoder(body) 3477 decoder.UseNumber() 3478 var shape interface{} 3479 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3480 var snapshot bytes.Buffer 3481 io.Copy(&snapshot, ringBuffer) 3482 err = &smithy.DeserializationError{ 3483 Err: fmt.Errorf("failed to decode response body, %w", err), 3484 Snapshot: snapshot.Bytes(), 3485 } 3486 return out, metadata, err 3487 } 3488 3489 err = awsRestjson1_deserializeOpDocumentListFunctionsOutput(&output, shape) 3490 if err != nil { 3491 var snapshot bytes.Buffer 3492 io.Copy(&snapshot, ringBuffer) 3493 return out, metadata, &smithy.DeserializationError{ 3494 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3495 Snapshot: snapshot.Bytes(), 3496 } 3497 } 3498 3499 return out, metadata, err 3500} 3501 3502func awsRestjson1_deserializeOpErrorListFunctions(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3503 var errorBuffer bytes.Buffer 3504 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3505 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3506 } 3507 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3508 3509 errorCode := "UnknownError" 3510 errorMessage := errorCode 3511 3512 code := response.Header.Get("X-Amzn-ErrorType") 3513 if len(code) != 0 { 3514 errorCode = restjson.SanitizeErrorCode(code) 3515 } 3516 3517 var buff [1024]byte 3518 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3519 3520 body := io.TeeReader(errorBody, ringBuffer) 3521 decoder := json.NewDecoder(body) 3522 decoder.UseNumber() 3523 code, message, err := restjson.GetErrorInfo(decoder) 3524 if err != nil { 3525 var snapshot bytes.Buffer 3526 io.Copy(&snapshot, ringBuffer) 3527 err = &smithy.DeserializationError{ 3528 Err: fmt.Errorf("failed to decode response body, %w", err), 3529 Snapshot: snapshot.Bytes(), 3530 } 3531 return err 3532 } 3533 3534 errorBody.Seek(0, io.SeekStart) 3535 if len(code) != 0 { 3536 errorCode = restjson.SanitizeErrorCode(code) 3537 } 3538 if len(message) != 0 { 3539 errorMessage = message 3540 } 3541 3542 switch { 3543 case strings.EqualFold("BadRequestException", errorCode): 3544 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3545 3546 case strings.EqualFold("InternalFailureException", errorCode): 3547 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 3548 3549 case strings.EqualFold("NotFoundException", errorCode): 3550 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3551 3552 case strings.EqualFold("UnauthorizedException", errorCode): 3553 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 3554 3555 default: 3556 genericError := &smithy.GenericAPIError{ 3557 Code: errorCode, 3558 Message: errorMessage, 3559 } 3560 return genericError 3561 3562 } 3563} 3564 3565func awsRestjson1_deserializeOpDocumentListFunctionsOutput(v **ListFunctionsOutput, value interface{}) error { 3566 if v == nil { 3567 return fmt.Errorf("unexpected nil of type %T", v) 3568 } 3569 if value == nil { 3570 return nil 3571 } 3572 3573 shape, ok := value.(map[string]interface{}) 3574 if !ok { 3575 return fmt.Errorf("unexpected JSON type %v", value) 3576 } 3577 3578 var sv *ListFunctionsOutput 3579 if *v == nil { 3580 sv = &ListFunctionsOutput{} 3581 } else { 3582 sv = *v 3583 } 3584 3585 for key, value := range shape { 3586 switch key { 3587 case "functions": 3588 if err := awsRestjson1_deserializeDocumentFunctions(&sv.Functions, value); err != nil { 3589 return err 3590 } 3591 3592 case "nextToken": 3593 if value != nil { 3594 jtv, ok := value.(string) 3595 if !ok { 3596 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 3597 } 3598 sv.NextToken = ptr.String(jtv) 3599 } 3600 3601 default: 3602 _, _ = key, value 3603 3604 } 3605 } 3606 *v = sv 3607 return nil 3608} 3609 3610type awsRestjson1_deserializeOpListGraphqlApis struct { 3611} 3612 3613func (*awsRestjson1_deserializeOpListGraphqlApis) ID() string { 3614 return "OperationDeserializer" 3615} 3616 3617func (m *awsRestjson1_deserializeOpListGraphqlApis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3618 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3619) { 3620 out, metadata, err = next.HandleDeserialize(ctx, in) 3621 if err != nil { 3622 return out, metadata, err 3623 } 3624 3625 response, ok := out.RawResponse.(*smithyhttp.Response) 3626 if !ok { 3627 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3628 } 3629 3630 if response.StatusCode < 200 || response.StatusCode >= 300 { 3631 return out, metadata, awsRestjson1_deserializeOpErrorListGraphqlApis(response, &metadata) 3632 } 3633 output := &ListGraphqlApisOutput{} 3634 out.Result = output 3635 3636 var buff [1024]byte 3637 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3638 3639 body := io.TeeReader(response.Body, ringBuffer) 3640 3641 decoder := json.NewDecoder(body) 3642 decoder.UseNumber() 3643 var shape interface{} 3644 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3645 var snapshot bytes.Buffer 3646 io.Copy(&snapshot, ringBuffer) 3647 err = &smithy.DeserializationError{ 3648 Err: fmt.Errorf("failed to decode response body, %w", err), 3649 Snapshot: snapshot.Bytes(), 3650 } 3651 return out, metadata, err 3652 } 3653 3654 err = awsRestjson1_deserializeOpDocumentListGraphqlApisOutput(&output, shape) 3655 if err != nil { 3656 var snapshot bytes.Buffer 3657 io.Copy(&snapshot, ringBuffer) 3658 return out, metadata, &smithy.DeserializationError{ 3659 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3660 Snapshot: snapshot.Bytes(), 3661 } 3662 } 3663 3664 return out, metadata, err 3665} 3666 3667func awsRestjson1_deserializeOpErrorListGraphqlApis(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3668 var errorBuffer bytes.Buffer 3669 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3670 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3671 } 3672 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3673 3674 errorCode := "UnknownError" 3675 errorMessage := errorCode 3676 3677 code := response.Header.Get("X-Amzn-ErrorType") 3678 if len(code) != 0 { 3679 errorCode = restjson.SanitizeErrorCode(code) 3680 } 3681 3682 var buff [1024]byte 3683 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3684 3685 body := io.TeeReader(errorBody, ringBuffer) 3686 decoder := json.NewDecoder(body) 3687 decoder.UseNumber() 3688 code, message, err := restjson.GetErrorInfo(decoder) 3689 if err != nil { 3690 var snapshot bytes.Buffer 3691 io.Copy(&snapshot, ringBuffer) 3692 err = &smithy.DeserializationError{ 3693 Err: fmt.Errorf("failed to decode response body, %w", err), 3694 Snapshot: snapshot.Bytes(), 3695 } 3696 return err 3697 } 3698 3699 errorBody.Seek(0, io.SeekStart) 3700 if len(code) != 0 { 3701 errorCode = restjson.SanitizeErrorCode(code) 3702 } 3703 if len(message) != 0 { 3704 errorMessage = message 3705 } 3706 3707 switch { 3708 case strings.EqualFold("BadRequestException", errorCode): 3709 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3710 3711 case strings.EqualFold("InternalFailureException", errorCode): 3712 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 3713 3714 case strings.EqualFold("UnauthorizedException", errorCode): 3715 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 3716 3717 default: 3718 genericError := &smithy.GenericAPIError{ 3719 Code: errorCode, 3720 Message: errorMessage, 3721 } 3722 return genericError 3723 3724 } 3725} 3726 3727func awsRestjson1_deserializeOpDocumentListGraphqlApisOutput(v **ListGraphqlApisOutput, value interface{}) error { 3728 if v == nil { 3729 return fmt.Errorf("unexpected nil of type %T", v) 3730 } 3731 if value == nil { 3732 return nil 3733 } 3734 3735 shape, ok := value.(map[string]interface{}) 3736 if !ok { 3737 return fmt.Errorf("unexpected JSON type %v", value) 3738 } 3739 3740 var sv *ListGraphqlApisOutput 3741 if *v == nil { 3742 sv = &ListGraphqlApisOutput{} 3743 } else { 3744 sv = *v 3745 } 3746 3747 for key, value := range shape { 3748 switch key { 3749 case "graphqlApis": 3750 if err := awsRestjson1_deserializeDocumentGraphqlApis(&sv.GraphqlApis, value); err != nil { 3751 return err 3752 } 3753 3754 case "nextToken": 3755 if value != nil { 3756 jtv, ok := value.(string) 3757 if !ok { 3758 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 3759 } 3760 sv.NextToken = ptr.String(jtv) 3761 } 3762 3763 default: 3764 _, _ = key, value 3765 3766 } 3767 } 3768 *v = sv 3769 return nil 3770} 3771 3772type awsRestjson1_deserializeOpListResolvers struct { 3773} 3774 3775func (*awsRestjson1_deserializeOpListResolvers) ID() string { 3776 return "OperationDeserializer" 3777} 3778 3779func (m *awsRestjson1_deserializeOpListResolvers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3780 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3781) { 3782 out, metadata, err = next.HandleDeserialize(ctx, in) 3783 if err != nil { 3784 return out, metadata, err 3785 } 3786 3787 response, ok := out.RawResponse.(*smithyhttp.Response) 3788 if !ok { 3789 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3790 } 3791 3792 if response.StatusCode < 200 || response.StatusCode >= 300 { 3793 return out, metadata, awsRestjson1_deserializeOpErrorListResolvers(response, &metadata) 3794 } 3795 output := &ListResolversOutput{} 3796 out.Result = output 3797 3798 var buff [1024]byte 3799 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3800 3801 body := io.TeeReader(response.Body, ringBuffer) 3802 3803 decoder := json.NewDecoder(body) 3804 decoder.UseNumber() 3805 var shape interface{} 3806 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3807 var snapshot bytes.Buffer 3808 io.Copy(&snapshot, ringBuffer) 3809 err = &smithy.DeserializationError{ 3810 Err: fmt.Errorf("failed to decode response body, %w", err), 3811 Snapshot: snapshot.Bytes(), 3812 } 3813 return out, metadata, err 3814 } 3815 3816 err = awsRestjson1_deserializeOpDocumentListResolversOutput(&output, shape) 3817 if err != nil { 3818 var snapshot bytes.Buffer 3819 io.Copy(&snapshot, ringBuffer) 3820 return out, metadata, &smithy.DeserializationError{ 3821 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3822 Snapshot: snapshot.Bytes(), 3823 } 3824 } 3825 3826 return out, metadata, err 3827} 3828 3829func awsRestjson1_deserializeOpErrorListResolvers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3830 var errorBuffer bytes.Buffer 3831 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3832 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3833 } 3834 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3835 3836 errorCode := "UnknownError" 3837 errorMessage := errorCode 3838 3839 code := response.Header.Get("X-Amzn-ErrorType") 3840 if len(code) != 0 { 3841 errorCode = restjson.SanitizeErrorCode(code) 3842 } 3843 3844 var buff [1024]byte 3845 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3846 3847 body := io.TeeReader(errorBody, ringBuffer) 3848 decoder := json.NewDecoder(body) 3849 decoder.UseNumber() 3850 code, message, err := restjson.GetErrorInfo(decoder) 3851 if err != nil { 3852 var snapshot bytes.Buffer 3853 io.Copy(&snapshot, ringBuffer) 3854 err = &smithy.DeserializationError{ 3855 Err: fmt.Errorf("failed to decode response body, %w", err), 3856 Snapshot: snapshot.Bytes(), 3857 } 3858 return err 3859 } 3860 3861 errorBody.Seek(0, io.SeekStart) 3862 if len(code) != 0 { 3863 errorCode = restjson.SanitizeErrorCode(code) 3864 } 3865 if len(message) != 0 { 3866 errorMessage = message 3867 } 3868 3869 switch { 3870 case strings.EqualFold("BadRequestException", errorCode): 3871 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 3872 3873 case strings.EqualFold("InternalFailureException", errorCode): 3874 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 3875 3876 case strings.EqualFold("NotFoundException", errorCode): 3877 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 3878 3879 case strings.EqualFold("UnauthorizedException", errorCode): 3880 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 3881 3882 default: 3883 genericError := &smithy.GenericAPIError{ 3884 Code: errorCode, 3885 Message: errorMessage, 3886 } 3887 return genericError 3888 3889 } 3890} 3891 3892func awsRestjson1_deserializeOpDocumentListResolversOutput(v **ListResolversOutput, value interface{}) error { 3893 if v == nil { 3894 return fmt.Errorf("unexpected nil of type %T", v) 3895 } 3896 if value == nil { 3897 return nil 3898 } 3899 3900 shape, ok := value.(map[string]interface{}) 3901 if !ok { 3902 return fmt.Errorf("unexpected JSON type %v", value) 3903 } 3904 3905 var sv *ListResolversOutput 3906 if *v == nil { 3907 sv = &ListResolversOutput{} 3908 } else { 3909 sv = *v 3910 } 3911 3912 for key, value := range shape { 3913 switch key { 3914 case "nextToken": 3915 if value != nil { 3916 jtv, ok := value.(string) 3917 if !ok { 3918 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 3919 } 3920 sv.NextToken = ptr.String(jtv) 3921 } 3922 3923 case "resolvers": 3924 if err := awsRestjson1_deserializeDocumentResolvers(&sv.Resolvers, value); err != nil { 3925 return err 3926 } 3927 3928 default: 3929 _, _ = key, value 3930 3931 } 3932 } 3933 *v = sv 3934 return nil 3935} 3936 3937type awsRestjson1_deserializeOpListResolversByFunction struct { 3938} 3939 3940func (*awsRestjson1_deserializeOpListResolversByFunction) ID() string { 3941 return "OperationDeserializer" 3942} 3943 3944func (m *awsRestjson1_deserializeOpListResolversByFunction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3945 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3946) { 3947 out, metadata, err = next.HandleDeserialize(ctx, in) 3948 if err != nil { 3949 return out, metadata, err 3950 } 3951 3952 response, ok := out.RawResponse.(*smithyhttp.Response) 3953 if !ok { 3954 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3955 } 3956 3957 if response.StatusCode < 200 || response.StatusCode >= 300 { 3958 return out, metadata, awsRestjson1_deserializeOpErrorListResolversByFunction(response, &metadata) 3959 } 3960 output := &ListResolversByFunctionOutput{} 3961 out.Result = output 3962 3963 var buff [1024]byte 3964 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3965 3966 body := io.TeeReader(response.Body, ringBuffer) 3967 3968 decoder := json.NewDecoder(body) 3969 decoder.UseNumber() 3970 var shape interface{} 3971 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3972 var snapshot bytes.Buffer 3973 io.Copy(&snapshot, ringBuffer) 3974 err = &smithy.DeserializationError{ 3975 Err: fmt.Errorf("failed to decode response body, %w", err), 3976 Snapshot: snapshot.Bytes(), 3977 } 3978 return out, metadata, err 3979 } 3980 3981 err = awsRestjson1_deserializeOpDocumentListResolversByFunctionOutput(&output, shape) 3982 if err != nil { 3983 var snapshot bytes.Buffer 3984 io.Copy(&snapshot, ringBuffer) 3985 return out, metadata, &smithy.DeserializationError{ 3986 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3987 Snapshot: snapshot.Bytes(), 3988 } 3989 } 3990 3991 return out, metadata, err 3992} 3993 3994func awsRestjson1_deserializeOpErrorListResolversByFunction(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3995 var errorBuffer bytes.Buffer 3996 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3997 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3998 } 3999 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4000 4001 errorCode := "UnknownError" 4002 errorMessage := errorCode 4003 4004 code := response.Header.Get("X-Amzn-ErrorType") 4005 if len(code) != 0 { 4006 errorCode = restjson.SanitizeErrorCode(code) 4007 } 4008 4009 var buff [1024]byte 4010 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4011 4012 body := io.TeeReader(errorBody, ringBuffer) 4013 decoder := json.NewDecoder(body) 4014 decoder.UseNumber() 4015 code, message, err := restjson.GetErrorInfo(decoder) 4016 if err != nil { 4017 var snapshot bytes.Buffer 4018 io.Copy(&snapshot, ringBuffer) 4019 err = &smithy.DeserializationError{ 4020 Err: fmt.Errorf("failed to decode response body, %w", err), 4021 Snapshot: snapshot.Bytes(), 4022 } 4023 return err 4024 } 4025 4026 errorBody.Seek(0, io.SeekStart) 4027 if len(code) != 0 { 4028 errorCode = restjson.SanitizeErrorCode(code) 4029 } 4030 if len(message) != 0 { 4031 errorMessage = message 4032 } 4033 4034 switch { 4035 case strings.EqualFold("BadRequestException", errorCode): 4036 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4037 4038 case strings.EqualFold("InternalFailureException", errorCode): 4039 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 4040 4041 case strings.EqualFold("NotFoundException", errorCode): 4042 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4043 4044 case strings.EqualFold("UnauthorizedException", errorCode): 4045 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 4046 4047 default: 4048 genericError := &smithy.GenericAPIError{ 4049 Code: errorCode, 4050 Message: errorMessage, 4051 } 4052 return genericError 4053 4054 } 4055} 4056 4057func awsRestjson1_deserializeOpDocumentListResolversByFunctionOutput(v **ListResolversByFunctionOutput, value interface{}) error { 4058 if v == nil { 4059 return fmt.Errorf("unexpected nil of type %T", v) 4060 } 4061 if value == nil { 4062 return nil 4063 } 4064 4065 shape, ok := value.(map[string]interface{}) 4066 if !ok { 4067 return fmt.Errorf("unexpected JSON type %v", value) 4068 } 4069 4070 var sv *ListResolversByFunctionOutput 4071 if *v == nil { 4072 sv = &ListResolversByFunctionOutput{} 4073 } else { 4074 sv = *v 4075 } 4076 4077 for key, value := range shape { 4078 switch key { 4079 case "nextToken": 4080 if value != nil { 4081 jtv, ok := value.(string) 4082 if !ok { 4083 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 4084 } 4085 sv.NextToken = ptr.String(jtv) 4086 } 4087 4088 case "resolvers": 4089 if err := awsRestjson1_deserializeDocumentResolvers(&sv.Resolvers, value); err != nil { 4090 return err 4091 } 4092 4093 default: 4094 _, _ = key, value 4095 4096 } 4097 } 4098 *v = sv 4099 return nil 4100} 4101 4102type awsRestjson1_deserializeOpListTagsForResource struct { 4103} 4104 4105func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { 4106 return "OperationDeserializer" 4107} 4108 4109func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4110 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4111) { 4112 out, metadata, err = next.HandleDeserialize(ctx, in) 4113 if err != nil { 4114 return out, metadata, err 4115 } 4116 4117 response, ok := out.RawResponse.(*smithyhttp.Response) 4118 if !ok { 4119 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4120 } 4121 4122 if response.StatusCode < 200 || response.StatusCode >= 300 { 4123 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) 4124 } 4125 output := &ListTagsForResourceOutput{} 4126 out.Result = output 4127 4128 var buff [1024]byte 4129 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4130 4131 body := io.TeeReader(response.Body, ringBuffer) 4132 4133 decoder := json.NewDecoder(body) 4134 decoder.UseNumber() 4135 var shape interface{} 4136 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4137 var snapshot bytes.Buffer 4138 io.Copy(&snapshot, ringBuffer) 4139 err = &smithy.DeserializationError{ 4140 Err: fmt.Errorf("failed to decode response body, %w", err), 4141 Snapshot: snapshot.Bytes(), 4142 } 4143 return out, metadata, err 4144 } 4145 4146 err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 4147 if err != nil { 4148 var snapshot bytes.Buffer 4149 io.Copy(&snapshot, ringBuffer) 4150 return out, metadata, &smithy.DeserializationError{ 4151 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4152 Snapshot: snapshot.Bytes(), 4153 } 4154 } 4155 4156 return out, metadata, err 4157} 4158 4159func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4160 var errorBuffer bytes.Buffer 4161 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4162 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4163 } 4164 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4165 4166 errorCode := "UnknownError" 4167 errorMessage := errorCode 4168 4169 code := response.Header.Get("X-Amzn-ErrorType") 4170 if len(code) != 0 { 4171 errorCode = restjson.SanitizeErrorCode(code) 4172 } 4173 4174 var buff [1024]byte 4175 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4176 4177 body := io.TeeReader(errorBody, ringBuffer) 4178 decoder := json.NewDecoder(body) 4179 decoder.UseNumber() 4180 code, message, err := restjson.GetErrorInfo(decoder) 4181 if err != nil { 4182 var snapshot bytes.Buffer 4183 io.Copy(&snapshot, ringBuffer) 4184 err = &smithy.DeserializationError{ 4185 Err: fmt.Errorf("failed to decode response body, %w", err), 4186 Snapshot: snapshot.Bytes(), 4187 } 4188 return err 4189 } 4190 4191 errorBody.Seek(0, io.SeekStart) 4192 if len(code) != 0 { 4193 errorCode = restjson.SanitizeErrorCode(code) 4194 } 4195 if len(message) != 0 { 4196 errorMessage = message 4197 } 4198 4199 switch { 4200 case strings.EqualFold("AccessDeniedException", errorCode): 4201 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4202 4203 case strings.EqualFold("BadRequestException", errorCode): 4204 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4205 4206 case strings.EqualFold("InternalFailureException", errorCode): 4207 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 4208 4209 case strings.EqualFold("LimitExceededException", errorCode): 4210 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 4211 4212 case strings.EqualFold("NotFoundException", errorCode): 4213 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4214 4215 case strings.EqualFold("UnauthorizedException", errorCode): 4216 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 4217 4218 default: 4219 genericError := &smithy.GenericAPIError{ 4220 Code: errorCode, 4221 Message: errorMessage, 4222 } 4223 return genericError 4224 4225 } 4226} 4227 4228func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 4229 if v == nil { 4230 return fmt.Errorf("unexpected nil of type %T", v) 4231 } 4232 if value == nil { 4233 return nil 4234 } 4235 4236 shape, ok := value.(map[string]interface{}) 4237 if !ok { 4238 return fmt.Errorf("unexpected JSON type %v", value) 4239 } 4240 4241 var sv *ListTagsForResourceOutput 4242 if *v == nil { 4243 sv = &ListTagsForResourceOutput{} 4244 } else { 4245 sv = *v 4246 } 4247 4248 for key, value := range shape { 4249 switch key { 4250 case "tags": 4251 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 4252 return err 4253 } 4254 4255 default: 4256 _, _ = key, value 4257 4258 } 4259 } 4260 *v = sv 4261 return nil 4262} 4263 4264type awsRestjson1_deserializeOpListTypes struct { 4265} 4266 4267func (*awsRestjson1_deserializeOpListTypes) ID() string { 4268 return "OperationDeserializer" 4269} 4270 4271func (m *awsRestjson1_deserializeOpListTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4272 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4273) { 4274 out, metadata, err = next.HandleDeserialize(ctx, in) 4275 if err != nil { 4276 return out, metadata, err 4277 } 4278 4279 response, ok := out.RawResponse.(*smithyhttp.Response) 4280 if !ok { 4281 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4282 } 4283 4284 if response.StatusCode < 200 || response.StatusCode >= 300 { 4285 return out, metadata, awsRestjson1_deserializeOpErrorListTypes(response, &metadata) 4286 } 4287 output := &ListTypesOutput{} 4288 out.Result = output 4289 4290 var buff [1024]byte 4291 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4292 4293 body := io.TeeReader(response.Body, ringBuffer) 4294 4295 decoder := json.NewDecoder(body) 4296 decoder.UseNumber() 4297 var shape interface{} 4298 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4299 var snapshot bytes.Buffer 4300 io.Copy(&snapshot, ringBuffer) 4301 err = &smithy.DeserializationError{ 4302 Err: fmt.Errorf("failed to decode response body, %w", err), 4303 Snapshot: snapshot.Bytes(), 4304 } 4305 return out, metadata, err 4306 } 4307 4308 err = awsRestjson1_deserializeOpDocumentListTypesOutput(&output, shape) 4309 if err != nil { 4310 var snapshot bytes.Buffer 4311 io.Copy(&snapshot, ringBuffer) 4312 return out, metadata, &smithy.DeserializationError{ 4313 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4314 Snapshot: snapshot.Bytes(), 4315 } 4316 } 4317 4318 return out, metadata, err 4319} 4320 4321func awsRestjson1_deserializeOpErrorListTypes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4322 var errorBuffer bytes.Buffer 4323 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4324 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4325 } 4326 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4327 4328 errorCode := "UnknownError" 4329 errorMessage := errorCode 4330 4331 code := response.Header.Get("X-Amzn-ErrorType") 4332 if len(code) != 0 { 4333 errorCode = restjson.SanitizeErrorCode(code) 4334 } 4335 4336 var buff [1024]byte 4337 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4338 4339 body := io.TeeReader(errorBody, ringBuffer) 4340 decoder := json.NewDecoder(body) 4341 decoder.UseNumber() 4342 code, message, err := restjson.GetErrorInfo(decoder) 4343 if err != nil { 4344 var snapshot bytes.Buffer 4345 io.Copy(&snapshot, ringBuffer) 4346 err = &smithy.DeserializationError{ 4347 Err: fmt.Errorf("failed to decode response body, %w", err), 4348 Snapshot: snapshot.Bytes(), 4349 } 4350 return err 4351 } 4352 4353 errorBody.Seek(0, io.SeekStart) 4354 if len(code) != 0 { 4355 errorCode = restjson.SanitizeErrorCode(code) 4356 } 4357 if len(message) != 0 { 4358 errorMessage = message 4359 } 4360 4361 switch { 4362 case strings.EqualFold("BadRequestException", errorCode): 4363 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4364 4365 case strings.EqualFold("ConcurrentModificationException", errorCode): 4366 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 4367 4368 case strings.EqualFold("InternalFailureException", errorCode): 4369 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 4370 4371 case strings.EqualFold("NotFoundException", errorCode): 4372 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4373 4374 case strings.EqualFold("UnauthorizedException", errorCode): 4375 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 4376 4377 default: 4378 genericError := &smithy.GenericAPIError{ 4379 Code: errorCode, 4380 Message: errorMessage, 4381 } 4382 return genericError 4383 4384 } 4385} 4386 4387func awsRestjson1_deserializeOpDocumentListTypesOutput(v **ListTypesOutput, value interface{}) error { 4388 if v == nil { 4389 return fmt.Errorf("unexpected nil of type %T", v) 4390 } 4391 if value == nil { 4392 return nil 4393 } 4394 4395 shape, ok := value.(map[string]interface{}) 4396 if !ok { 4397 return fmt.Errorf("unexpected JSON type %v", value) 4398 } 4399 4400 var sv *ListTypesOutput 4401 if *v == nil { 4402 sv = &ListTypesOutput{} 4403 } else { 4404 sv = *v 4405 } 4406 4407 for key, value := range shape { 4408 switch key { 4409 case "nextToken": 4410 if value != nil { 4411 jtv, ok := value.(string) 4412 if !ok { 4413 return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) 4414 } 4415 sv.NextToken = ptr.String(jtv) 4416 } 4417 4418 case "types": 4419 if err := awsRestjson1_deserializeDocumentTypeList(&sv.Types, value); err != nil { 4420 return err 4421 } 4422 4423 default: 4424 _, _ = key, value 4425 4426 } 4427 } 4428 *v = sv 4429 return nil 4430} 4431 4432type awsRestjson1_deserializeOpStartSchemaCreation struct { 4433} 4434 4435func (*awsRestjson1_deserializeOpStartSchemaCreation) ID() string { 4436 return "OperationDeserializer" 4437} 4438 4439func (m *awsRestjson1_deserializeOpStartSchemaCreation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4440 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4441) { 4442 out, metadata, err = next.HandleDeserialize(ctx, in) 4443 if err != nil { 4444 return out, metadata, err 4445 } 4446 4447 response, ok := out.RawResponse.(*smithyhttp.Response) 4448 if !ok { 4449 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4450 } 4451 4452 if response.StatusCode < 200 || response.StatusCode >= 300 { 4453 return out, metadata, awsRestjson1_deserializeOpErrorStartSchemaCreation(response, &metadata) 4454 } 4455 output := &StartSchemaCreationOutput{} 4456 out.Result = output 4457 4458 var buff [1024]byte 4459 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4460 4461 body := io.TeeReader(response.Body, ringBuffer) 4462 4463 decoder := json.NewDecoder(body) 4464 decoder.UseNumber() 4465 var shape interface{} 4466 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4467 var snapshot bytes.Buffer 4468 io.Copy(&snapshot, ringBuffer) 4469 err = &smithy.DeserializationError{ 4470 Err: fmt.Errorf("failed to decode response body, %w", err), 4471 Snapshot: snapshot.Bytes(), 4472 } 4473 return out, metadata, err 4474 } 4475 4476 err = awsRestjson1_deserializeOpDocumentStartSchemaCreationOutput(&output, shape) 4477 if err != nil { 4478 var snapshot bytes.Buffer 4479 io.Copy(&snapshot, ringBuffer) 4480 return out, metadata, &smithy.DeserializationError{ 4481 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4482 Snapshot: snapshot.Bytes(), 4483 } 4484 } 4485 4486 return out, metadata, err 4487} 4488 4489func awsRestjson1_deserializeOpErrorStartSchemaCreation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4490 var errorBuffer bytes.Buffer 4491 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4492 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4493 } 4494 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4495 4496 errorCode := "UnknownError" 4497 errorMessage := errorCode 4498 4499 code := response.Header.Get("X-Amzn-ErrorType") 4500 if len(code) != 0 { 4501 errorCode = restjson.SanitizeErrorCode(code) 4502 } 4503 4504 var buff [1024]byte 4505 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4506 4507 body := io.TeeReader(errorBody, ringBuffer) 4508 decoder := json.NewDecoder(body) 4509 decoder.UseNumber() 4510 code, message, err := restjson.GetErrorInfo(decoder) 4511 if err != nil { 4512 var snapshot bytes.Buffer 4513 io.Copy(&snapshot, ringBuffer) 4514 err = &smithy.DeserializationError{ 4515 Err: fmt.Errorf("failed to decode response body, %w", err), 4516 Snapshot: snapshot.Bytes(), 4517 } 4518 return err 4519 } 4520 4521 errorBody.Seek(0, io.SeekStart) 4522 if len(code) != 0 { 4523 errorCode = restjson.SanitizeErrorCode(code) 4524 } 4525 if len(message) != 0 { 4526 errorMessage = message 4527 } 4528 4529 switch { 4530 case strings.EqualFold("BadRequestException", errorCode): 4531 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4532 4533 case strings.EqualFold("ConcurrentModificationException", errorCode): 4534 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 4535 4536 case strings.EqualFold("InternalFailureException", errorCode): 4537 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 4538 4539 case strings.EqualFold("NotFoundException", errorCode): 4540 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4541 4542 case strings.EqualFold("UnauthorizedException", errorCode): 4543 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 4544 4545 default: 4546 genericError := &smithy.GenericAPIError{ 4547 Code: errorCode, 4548 Message: errorMessage, 4549 } 4550 return genericError 4551 4552 } 4553} 4554 4555func awsRestjson1_deserializeOpDocumentStartSchemaCreationOutput(v **StartSchemaCreationOutput, value interface{}) error { 4556 if v == nil { 4557 return fmt.Errorf("unexpected nil of type %T", v) 4558 } 4559 if value == nil { 4560 return nil 4561 } 4562 4563 shape, ok := value.(map[string]interface{}) 4564 if !ok { 4565 return fmt.Errorf("unexpected JSON type %v", value) 4566 } 4567 4568 var sv *StartSchemaCreationOutput 4569 if *v == nil { 4570 sv = &StartSchemaCreationOutput{} 4571 } else { 4572 sv = *v 4573 } 4574 4575 for key, value := range shape { 4576 switch key { 4577 case "status": 4578 if value != nil { 4579 jtv, ok := value.(string) 4580 if !ok { 4581 return fmt.Errorf("expected SchemaStatus to be of type string, got %T instead", value) 4582 } 4583 sv.Status = types.SchemaStatus(jtv) 4584 } 4585 4586 default: 4587 _, _ = key, value 4588 4589 } 4590 } 4591 *v = sv 4592 return nil 4593} 4594 4595type awsRestjson1_deserializeOpTagResource struct { 4596} 4597 4598func (*awsRestjson1_deserializeOpTagResource) ID() string { 4599 return "OperationDeserializer" 4600} 4601 4602func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4603 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4604) { 4605 out, metadata, err = next.HandleDeserialize(ctx, in) 4606 if err != nil { 4607 return out, metadata, err 4608 } 4609 4610 response, ok := out.RawResponse.(*smithyhttp.Response) 4611 if !ok { 4612 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4613 } 4614 4615 if response.StatusCode < 200 || response.StatusCode >= 300 { 4616 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 4617 } 4618 output := &TagResourceOutput{} 4619 out.Result = output 4620 4621 return out, metadata, err 4622} 4623 4624func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4625 var errorBuffer bytes.Buffer 4626 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4627 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4628 } 4629 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4630 4631 errorCode := "UnknownError" 4632 errorMessage := errorCode 4633 4634 code := response.Header.Get("X-Amzn-ErrorType") 4635 if len(code) != 0 { 4636 errorCode = restjson.SanitizeErrorCode(code) 4637 } 4638 4639 var buff [1024]byte 4640 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4641 4642 body := io.TeeReader(errorBody, ringBuffer) 4643 decoder := json.NewDecoder(body) 4644 decoder.UseNumber() 4645 code, message, err := restjson.GetErrorInfo(decoder) 4646 if err != nil { 4647 var snapshot bytes.Buffer 4648 io.Copy(&snapshot, ringBuffer) 4649 err = &smithy.DeserializationError{ 4650 Err: fmt.Errorf("failed to decode response body, %w", err), 4651 Snapshot: snapshot.Bytes(), 4652 } 4653 return err 4654 } 4655 4656 errorBody.Seek(0, io.SeekStart) 4657 if len(code) != 0 { 4658 errorCode = restjson.SanitizeErrorCode(code) 4659 } 4660 if len(message) != 0 { 4661 errorMessage = message 4662 } 4663 4664 switch { 4665 case strings.EqualFold("AccessDeniedException", errorCode): 4666 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4667 4668 case strings.EqualFold("BadRequestException", errorCode): 4669 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4670 4671 case strings.EqualFold("InternalFailureException", errorCode): 4672 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 4673 4674 case strings.EqualFold("LimitExceededException", errorCode): 4675 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 4676 4677 case strings.EqualFold("NotFoundException", errorCode): 4678 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4679 4680 case strings.EqualFold("UnauthorizedException", errorCode): 4681 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 4682 4683 default: 4684 genericError := &smithy.GenericAPIError{ 4685 Code: errorCode, 4686 Message: errorMessage, 4687 } 4688 return genericError 4689 4690 } 4691} 4692 4693type awsRestjson1_deserializeOpUntagResource struct { 4694} 4695 4696func (*awsRestjson1_deserializeOpUntagResource) ID() string { 4697 return "OperationDeserializer" 4698} 4699 4700func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4701 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4702) { 4703 out, metadata, err = next.HandleDeserialize(ctx, in) 4704 if err != nil { 4705 return out, metadata, err 4706 } 4707 4708 response, ok := out.RawResponse.(*smithyhttp.Response) 4709 if !ok { 4710 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4711 } 4712 4713 if response.StatusCode < 200 || response.StatusCode >= 300 { 4714 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 4715 } 4716 output := &UntagResourceOutput{} 4717 out.Result = output 4718 4719 return out, metadata, err 4720} 4721 4722func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4723 var errorBuffer bytes.Buffer 4724 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4725 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4726 } 4727 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4728 4729 errorCode := "UnknownError" 4730 errorMessage := errorCode 4731 4732 code := response.Header.Get("X-Amzn-ErrorType") 4733 if len(code) != 0 { 4734 errorCode = restjson.SanitizeErrorCode(code) 4735 } 4736 4737 var buff [1024]byte 4738 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4739 4740 body := io.TeeReader(errorBody, ringBuffer) 4741 decoder := json.NewDecoder(body) 4742 decoder.UseNumber() 4743 code, message, err := restjson.GetErrorInfo(decoder) 4744 if err != nil { 4745 var snapshot bytes.Buffer 4746 io.Copy(&snapshot, ringBuffer) 4747 err = &smithy.DeserializationError{ 4748 Err: fmt.Errorf("failed to decode response body, %w", err), 4749 Snapshot: snapshot.Bytes(), 4750 } 4751 return err 4752 } 4753 4754 errorBody.Seek(0, io.SeekStart) 4755 if len(code) != 0 { 4756 errorCode = restjson.SanitizeErrorCode(code) 4757 } 4758 if len(message) != 0 { 4759 errorMessage = message 4760 } 4761 4762 switch { 4763 case strings.EqualFold("AccessDeniedException", errorCode): 4764 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 4765 4766 case strings.EqualFold("BadRequestException", errorCode): 4767 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4768 4769 case strings.EqualFold("InternalFailureException", errorCode): 4770 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 4771 4772 case strings.EqualFold("LimitExceededException", errorCode): 4773 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 4774 4775 case strings.EqualFold("NotFoundException", errorCode): 4776 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4777 4778 case strings.EqualFold("UnauthorizedException", errorCode): 4779 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 4780 4781 default: 4782 genericError := &smithy.GenericAPIError{ 4783 Code: errorCode, 4784 Message: errorMessage, 4785 } 4786 return genericError 4787 4788 } 4789} 4790 4791type awsRestjson1_deserializeOpUpdateApiCache struct { 4792} 4793 4794func (*awsRestjson1_deserializeOpUpdateApiCache) ID() string { 4795 return "OperationDeserializer" 4796} 4797 4798func (m *awsRestjson1_deserializeOpUpdateApiCache) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4799 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4800) { 4801 out, metadata, err = next.HandleDeserialize(ctx, in) 4802 if err != nil { 4803 return out, metadata, err 4804 } 4805 4806 response, ok := out.RawResponse.(*smithyhttp.Response) 4807 if !ok { 4808 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4809 } 4810 4811 if response.StatusCode < 200 || response.StatusCode >= 300 { 4812 return out, metadata, awsRestjson1_deserializeOpErrorUpdateApiCache(response, &metadata) 4813 } 4814 output := &UpdateApiCacheOutput{} 4815 out.Result = output 4816 4817 var buff [1024]byte 4818 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4819 4820 body := io.TeeReader(response.Body, ringBuffer) 4821 4822 decoder := json.NewDecoder(body) 4823 decoder.UseNumber() 4824 var shape interface{} 4825 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4826 var snapshot bytes.Buffer 4827 io.Copy(&snapshot, ringBuffer) 4828 err = &smithy.DeserializationError{ 4829 Err: fmt.Errorf("failed to decode response body, %w", err), 4830 Snapshot: snapshot.Bytes(), 4831 } 4832 return out, metadata, err 4833 } 4834 4835 err = awsRestjson1_deserializeOpDocumentUpdateApiCacheOutput(&output, shape) 4836 if err != nil { 4837 var snapshot bytes.Buffer 4838 io.Copy(&snapshot, ringBuffer) 4839 return out, metadata, &smithy.DeserializationError{ 4840 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4841 Snapshot: snapshot.Bytes(), 4842 } 4843 } 4844 4845 return out, metadata, err 4846} 4847 4848func awsRestjson1_deserializeOpErrorUpdateApiCache(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4849 var errorBuffer bytes.Buffer 4850 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4851 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4852 } 4853 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4854 4855 errorCode := "UnknownError" 4856 errorMessage := errorCode 4857 4858 code := response.Header.Get("X-Amzn-ErrorType") 4859 if len(code) != 0 { 4860 errorCode = restjson.SanitizeErrorCode(code) 4861 } 4862 4863 var buff [1024]byte 4864 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4865 4866 body := io.TeeReader(errorBody, ringBuffer) 4867 decoder := json.NewDecoder(body) 4868 decoder.UseNumber() 4869 code, message, err := restjson.GetErrorInfo(decoder) 4870 if err != nil { 4871 var snapshot bytes.Buffer 4872 io.Copy(&snapshot, ringBuffer) 4873 err = &smithy.DeserializationError{ 4874 Err: fmt.Errorf("failed to decode response body, %w", err), 4875 Snapshot: snapshot.Bytes(), 4876 } 4877 return err 4878 } 4879 4880 errorBody.Seek(0, io.SeekStart) 4881 if len(code) != 0 { 4882 errorCode = restjson.SanitizeErrorCode(code) 4883 } 4884 if len(message) != 0 { 4885 errorMessage = message 4886 } 4887 4888 switch { 4889 case strings.EqualFold("BadRequestException", errorCode): 4890 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 4891 4892 case strings.EqualFold("ConcurrentModificationException", errorCode): 4893 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 4894 4895 case strings.EqualFold("InternalFailureException", errorCode): 4896 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 4897 4898 case strings.EqualFold("NotFoundException", errorCode): 4899 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 4900 4901 case strings.EqualFold("UnauthorizedException", errorCode): 4902 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 4903 4904 default: 4905 genericError := &smithy.GenericAPIError{ 4906 Code: errorCode, 4907 Message: errorMessage, 4908 } 4909 return genericError 4910 4911 } 4912} 4913 4914func awsRestjson1_deserializeOpDocumentUpdateApiCacheOutput(v **UpdateApiCacheOutput, value interface{}) error { 4915 if v == nil { 4916 return fmt.Errorf("unexpected nil of type %T", v) 4917 } 4918 if value == nil { 4919 return nil 4920 } 4921 4922 shape, ok := value.(map[string]interface{}) 4923 if !ok { 4924 return fmt.Errorf("unexpected JSON type %v", value) 4925 } 4926 4927 var sv *UpdateApiCacheOutput 4928 if *v == nil { 4929 sv = &UpdateApiCacheOutput{} 4930 } else { 4931 sv = *v 4932 } 4933 4934 for key, value := range shape { 4935 switch key { 4936 case "apiCache": 4937 if err := awsRestjson1_deserializeDocumentApiCache(&sv.ApiCache, value); err != nil { 4938 return err 4939 } 4940 4941 default: 4942 _, _ = key, value 4943 4944 } 4945 } 4946 *v = sv 4947 return nil 4948} 4949 4950type awsRestjson1_deserializeOpUpdateApiKey struct { 4951} 4952 4953func (*awsRestjson1_deserializeOpUpdateApiKey) ID() string { 4954 return "OperationDeserializer" 4955} 4956 4957func (m *awsRestjson1_deserializeOpUpdateApiKey) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4958 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4959) { 4960 out, metadata, err = next.HandleDeserialize(ctx, in) 4961 if err != nil { 4962 return out, metadata, err 4963 } 4964 4965 response, ok := out.RawResponse.(*smithyhttp.Response) 4966 if !ok { 4967 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4968 } 4969 4970 if response.StatusCode < 200 || response.StatusCode >= 300 { 4971 return out, metadata, awsRestjson1_deserializeOpErrorUpdateApiKey(response, &metadata) 4972 } 4973 output := &UpdateApiKeyOutput{} 4974 out.Result = output 4975 4976 var buff [1024]byte 4977 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4978 4979 body := io.TeeReader(response.Body, ringBuffer) 4980 4981 decoder := json.NewDecoder(body) 4982 decoder.UseNumber() 4983 var shape interface{} 4984 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4985 var snapshot bytes.Buffer 4986 io.Copy(&snapshot, ringBuffer) 4987 err = &smithy.DeserializationError{ 4988 Err: fmt.Errorf("failed to decode response body, %w", err), 4989 Snapshot: snapshot.Bytes(), 4990 } 4991 return out, metadata, err 4992 } 4993 4994 err = awsRestjson1_deserializeOpDocumentUpdateApiKeyOutput(&output, shape) 4995 if err != nil { 4996 var snapshot bytes.Buffer 4997 io.Copy(&snapshot, ringBuffer) 4998 return out, metadata, &smithy.DeserializationError{ 4999 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5000 Snapshot: snapshot.Bytes(), 5001 } 5002 } 5003 5004 return out, metadata, err 5005} 5006 5007func awsRestjson1_deserializeOpErrorUpdateApiKey(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5008 var errorBuffer bytes.Buffer 5009 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5010 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5011 } 5012 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5013 5014 errorCode := "UnknownError" 5015 errorMessage := errorCode 5016 5017 code := response.Header.Get("X-Amzn-ErrorType") 5018 if len(code) != 0 { 5019 errorCode = restjson.SanitizeErrorCode(code) 5020 } 5021 5022 var buff [1024]byte 5023 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5024 5025 body := io.TeeReader(errorBody, ringBuffer) 5026 decoder := json.NewDecoder(body) 5027 decoder.UseNumber() 5028 code, message, err := restjson.GetErrorInfo(decoder) 5029 if err != nil { 5030 var snapshot bytes.Buffer 5031 io.Copy(&snapshot, ringBuffer) 5032 err = &smithy.DeserializationError{ 5033 Err: fmt.Errorf("failed to decode response body, %w", err), 5034 Snapshot: snapshot.Bytes(), 5035 } 5036 return err 5037 } 5038 5039 errorBody.Seek(0, io.SeekStart) 5040 if len(code) != 0 { 5041 errorCode = restjson.SanitizeErrorCode(code) 5042 } 5043 if len(message) != 0 { 5044 errorMessage = message 5045 } 5046 5047 switch { 5048 case strings.EqualFold("ApiKeyValidityOutOfBoundsException", errorCode): 5049 return awsRestjson1_deserializeErrorApiKeyValidityOutOfBoundsException(response, errorBody) 5050 5051 case strings.EqualFold("BadRequestException", errorCode): 5052 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5053 5054 case strings.EqualFold("InternalFailureException", errorCode): 5055 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 5056 5057 case strings.EqualFold("LimitExceededException", errorCode): 5058 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 5059 5060 case strings.EqualFold("NotFoundException", errorCode): 5061 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5062 5063 case strings.EqualFold("UnauthorizedException", errorCode): 5064 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 5065 5066 default: 5067 genericError := &smithy.GenericAPIError{ 5068 Code: errorCode, 5069 Message: errorMessage, 5070 } 5071 return genericError 5072 5073 } 5074} 5075 5076func awsRestjson1_deserializeOpDocumentUpdateApiKeyOutput(v **UpdateApiKeyOutput, value interface{}) error { 5077 if v == nil { 5078 return fmt.Errorf("unexpected nil of type %T", v) 5079 } 5080 if value == nil { 5081 return nil 5082 } 5083 5084 shape, ok := value.(map[string]interface{}) 5085 if !ok { 5086 return fmt.Errorf("unexpected JSON type %v", value) 5087 } 5088 5089 var sv *UpdateApiKeyOutput 5090 if *v == nil { 5091 sv = &UpdateApiKeyOutput{} 5092 } else { 5093 sv = *v 5094 } 5095 5096 for key, value := range shape { 5097 switch key { 5098 case "apiKey": 5099 if err := awsRestjson1_deserializeDocumentApiKey(&sv.ApiKey, value); err != nil { 5100 return err 5101 } 5102 5103 default: 5104 _, _ = key, value 5105 5106 } 5107 } 5108 *v = sv 5109 return nil 5110} 5111 5112type awsRestjson1_deserializeOpUpdateDataSource struct { 5113} 5114 5115func (*awsRestjson1_deserializeOpUpdateDataSource) ID() string { 5116 return "OperationDeserializer" 5117} 5118 5119func (m *awsRestjson1_deserializeOpUpdateDataSource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5120 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5121) { 5122 out, metadata, err = next.HandleDeserialize(ctx, in) 5123 if err != nil { 5124 return out, metadata, err 5125 } 5126 5127 response, ok := out.RawResponse.(*smithyhttp.Response) 5128 if !ok { 5129 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5130 } 5131 5132 if response.StatusCode < 200 || response.StatusCode >= 300 { 5133 return out, metadata, awsRestjson1_deserializeOpErrorUpdateDataSource(response, &metadata) 5134 } 5135 output := &UpdateDataSourceOutput{} 5136 out.Result = output 5137 5138 var buff [1024]byte 5139 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5140 5141 body := io.TeeReader(response.Body, ringBuffer) 5142 5143 decoder := json.NewDecoder(body) 5144 decoder.UseNumber() 5145 var shape interface{} 5146 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5147 var snapshot bytes.Buffer 5148 io.Copy(&snapshot, ringBuffer) 5149 err = &smithy.DeserializationError{ 5150 Err: fmt.Errorf("failed to decode response body, %w", err), 5151 Snapshot: snapshot.Bytes(), 5152 } 5153 return out, metadata, err 5154 } 5155 5156 err = awsRestjson1_deserializeOpDocumentUpdateDataSourceOutput(&output, shape) 5157 if err != nil { 5158 var snapshot bytes.Buffer 5159 io.Copy(&snapshot, ringBuffer) 5160 return out, metadata, &smithy.DeserializationError{ 5161 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5162 Snapshot: snapshot.Bytes(), 5163 } 5164 } 5165 5166 return out, metadata, err 5167} 5168 5169func awsRestjson1_deserializeOpErrorUpdateDataSource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5170 var errorBuffer bytes.Buffer 5171 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5172 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5173 } 5174 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5175 5176 errorCode := "UnknownError" 5177 errorMessage := errorCode 5178 5179 code := response.Header.Get("X-Amzn-ErrorType") 5180 if len(code) != 0 { 5181 errorCode = restjson.SanitizeErrorCode(code) 5182 } 5183 5184 var buff [1024]byte 5185 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5186 5187 body := io.TeeReader(errorBody, ringBuffer) 5188 decoder := json.NewDecoder(body) 5189 decoder.UseNumber() 5190 code, message, err := restjson.GetErrorInfo(decoder) 5191 if err != nil { 5192 var snapshot bytes.Buffer 5193 io.Copy(&snapshot, ringBuffer) 5194 err = &smithy.DeserializationError{ 5195 Err: fmt.Errorf("failed to decode response body, %w", err), 5196 Snapshot: snapshot.Bytes(), 5197 } 5198 return err 5199 } 5200 5201 errorBody.Seek(0, io.SeekStart) 5202 if len(code) != 0 { 5203 errorCode = restjson.SanitizeErrorCode(code) 5204 } 5205 if len(message) != 0 { 5206 errorMessage = message 5207 } 5208 5209 switch { 5210 case strings.EqualFold("BadRequestException", errorCode): 5211 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5212 5213 case strings.EqualFold("ConcurrentModificationException", errorCode): 5214 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 5215 5216 case strings.EqualFold("InternalFailureException", errorCode): 5217 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 5218 5219 case strings.EqualFold("NotFoundException", errorCode): 5220 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5221 5222 case strings.EqualFold("UnauthorizedException", errorCode): 5223 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 5224 5225 default: 5226 genericError := &smithy.GenericAPIError{ 5227 Code: errorCode, 5228 Message: errorMessage, 5229 } 5230 return genericError 5231 5232 } 5233} 5234 5235func awsRestjson1_deserializeOpDocumentUpdateDataSourceOutput(v **UpdateDataSourceOutput, value interface{}) error { 5236 if v == nil { 5237 return fmt.Errorf("unexpected nil of type %T", v) 5238 } 5239 if value == nil { 5240 return nil 5241 } 5242 5243 shape, ok := value.(map[string]interface{}) 5244 if !ok { 5245 return fmt.Errorf("unexpected JSON type %v", value) 5246 } 5247 5248 var sv *UpdateDataSourceOutput 5249 if *v == nil { 5250 sv = &UpdateDataSourceOutput{} 5251 } else { 5252 sv = *v 5253 } 5254 5255 for key, value := range shape { 5256 switch key { 5257 case "dataSource": 5258 if err := awsRestjson1_deserializeDocumentDataSource(&sv.DataSource, value); err != nil { 5259 return err 5260 } 5261 5262 default: 5263 _, _ = key, value 5264 5265 } 5266 } 5267 *v = sv 5268 return nil 5269} 5270 5271type awsRestjson1_deserializeOpUpdateFunction struct { 5272} 5273 5274func (*awsRestjson1_deserializeOpUpdateFunction) ID() string { 5275 return "OperationDeserializer" 5276} 5277 5278func (m *awsRestjson1_deserializeOpUpdateFunction) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5279 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5280) { 5281 out, metadata, err = next.HandleDeserialize(ctx, in) 5282 if err != nil { 5283 return out, metadata, err 5284 } 5285 5286 response, ok := out.RawResponse.(*smithyhttp.Response) 5287 if !ok { 5288 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5289 } 5290 5291 if response.StatusCode < 200 || response.StatusCode >= 300 { 5292 return out, metadata, awsRestjson1_deserializeOpErrorUpdateFunction(response, &metadata) 5293 } 5294 output := &UpdateFunctionOutput{} 5295 out.Result = output 5296 5297 var buff [1024]byte 5298 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5299 5300 body := io.TeeReader(response.Body, ringBuffer) 5301 5302 decoder := json.NewDecoder(body) 5303 decoder.UseNumber() 5304 var shape interface{} 5305 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5306 var snapshot bytes.Buffer 5307 io.Copy(&snapshot, ringBuffer) 5308 err = &smithy.DeserializationError{ 5309 Err: fmt.Errorf("failed to decode response body, %w", err), 5310 Snapshot: snapshot.Bytes(), 5311 } 5312 return out, metadata, err 5313 } 5314 5315 err = awsRestjson1_deserializeOpDocumentUpdateFunctionOutput(&output, shape) 5316 if err != nil { 5317 var snapshot bytes.Buffer 5318 io.Copy(&snapshot, ringBuffer) 5319 return out, metadata, &smithy.DeserializationError{ 5320 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5321 Snapshot: snapshot.Bytes(), 5322 } 5323 } 5324 5325 return out, metadata, err 5326} 5327 5328func awsRestjson1_deserializeOpErrorUpdateFunction(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5329 var errorBuffer bytes.Buffer 5330 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5331 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5332 } 5333 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5334 5335 errorCode := "UnknownError" 5336 errorMessage := errorCode 5337 5338 code := response.Header.Get("X-Amzn-ErrorType") 5339 if len(code) != 0 { 5340 errorCode = restjson.SanitizeErrorCode(code) 5341 } 5342 5343 var buff [1024]byte 5344 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5345 5346 body := io.TeeReader(errorBody, ringBuffer) 5347 decoder := json.NewDecoder(body) 5348 decoder.UseNumber() 5349 code, message, err := restjson.GetErrorInfo(decoder) 5350 if err != nil { 5351 var snapshot bytes.Buffer 5352 io.Copy(&snapshot, ringBuffer) 5353 err = &smithy.DeserializationError{ 5354 Err: fmt.Errorf("failed to decode response body, %w", err), 5355 Snapshot: snapshot.Bytes(), 5356 } 5357 return err 5358 } 5359 5360 errorBody.Seek(0, io.SeekStart) 5361 if len(code) != 0 { 5362 errorCode = restjson.SanitizeErrorCode(code) 5363 } 5364 if len(message) != 0 { 5365 errorMessage = message 5366 } 5367 5368 switch { 5369 case strings.EqualFold("ConcurrentModificationException", errorCode): 5370 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 5371 5372 case strings.EqualFold("InternalFailureException", errorCode): 5373 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 5374 5375 case strings.EqualFold("NotFoundException", errorCode): 5376 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5377 5378 case strings.EqualFold("UnauthorizedException", errorCode): 5379 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 5380 5381 default: 5382 genericError := &smithy.GenericAPIError{ 5383 Code: errorCode, 5384 Message: errorMessage, 5385 } 5386 return genericError 5387 5388 } 5389} 5390 5391func awsRestjson1_deserializeOpDocumentUpdateFunctionOutput(v **UpdateFunctionOutput, value interface{}) error { 5392 if v == nil { 5393 return fmt.Errorf("unexpected nil of type %T", v) 5394 } 5395 if value == nil { 5396 return nil 5397 } 5398 5399 shape, ok := value.(map[string]interface{}) 5400 if !ok { 5401 return fmt.Errorf("unexpected JSON type %v", value) 5402 } 5403 5404 var sv *UpdateFunctionOutput 5405 if *v == nil { 5406 sv = &UpdateFunctionOutput{} 5407 } else { 5408 sv = *v 5409 } 5410 5411 for key, value := range shape { 5412 switch key { 5413 case "functionConfiguration": 5414 if err := awsRestjson1_deserializeDocumentFunctionConfiguration(&sv.FunctionConfiguration, value); err != nil { 5415 return err 5416 } 5417 5418 default: 5419 _, _ = key, value 5420 5421 } 5422 } 5423 *v = sv 5424 return nil 5425} 5426 5427type awsRestjson1_deserializeOpUpdateGraphqlApi struct { 5428} 5429 5430func (*awsRestjson1_deserializeOpUpdateGraphqlApi) ID() string { 5431 return "OperationDeserializer" 5432} 5433 5434func (m *awsRestjson1_deserializeOpUpdateGraphqlApi) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5435 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5436) { 5437 out, metadata, err = next.HandleDeserialize(ctx, in) 5438 if err != nil { 5439 return out, metadata, err 5440 } 5441 5442 response, ok := out.RawResponse.(*smithyhttp.Response) 5443 if !ok { 5444 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5445 } 5446 5447 if response.StatusCode < 200 || response.StatusCode >= 300 { 5448 return out, metadata, awsRestjson1_deserializeOpErrorUpdateGraphqlApi(response, &metadata) 5449 } 5450 output := &UpdateGraphqlApiOutput{} 5451 out.Result = output 5452 5453 var buff [1024]byte 5454 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5455 5456 body := io.TeeReader(response.Body, ringBuffer) 5457 5458 decoder := json.NewDecoder(body) 5459 decoder.UseNumber() 5460 var shape interface{} 5461 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5462 var snapshot bytes.Buffer 5463 io.Copy(&snapshot, ringBuffer) 5464 err = &smithy.DeserializationError{ 5465 Err: fmt.Errorf("failed to decode response body, %w", err), 5466 Snapshot: snapshot.Bytes(), 5467 } 5468 return out, metadata, err 5469 } 5470 5471 err = awsRestjson1_deserializeOpDocumentUpdateGraphqlApiOutput(&output, shape) 5472 if err != nil { 5473 var snapshot bytes.Buffer 5474 io.Copy(&snapshot, ringBuffer) 5475 return out, metadata, &smithy.DeserializationError{ 5476 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5477 Snapshot: snapshot.Bytes(), 5478 } 5479 } 5480 5481 return out, metadata, err 5482} 5483 5484func awsRestjson1_deserializeOpErrorUpdateGraphqlApi(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5485 var errorBuffer bytes.Buffer 5486 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5487 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5488 } 5489 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5490 5491 errorCode := "UnknownError" 5492 errorMessage := errorCode 5493 5494 code := response.Header.Get("X-Amzn-ErrorType") 5495 if len(code) != 0 { 5496 errorCode = restjson.SanitizeErrorCode(code) 5497 } 5498 5499 var buff [1024]byte 5500 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5501 5502 body := io.TeeReader(errorBody, ringBuffer) 5503 decoder := json.NewDecoder(body) 5504 decoder.UseNumber() 5505 code, message, err := restjson.GetErrorInfo(decoder) 5506 if err != nil { 5507 var snapshot bytes.Buffer 5508 io.Copy(&snapshot, ringBuffer) 5509 err = &smithy.DeserializationError{ 5510 Err: fmt.Errorf("failed to decode response body, %w", err), 5511 Snapshot: snapshot.Bytes(), 5512 } 5513 return err 5514 } 5515 5516 errorBody.Seek(0, io.SeekStart) 5517 if len(code) != 0 { 5518 errorCode = restjson.SanitizeErrorCode(code) 5519 } 5520 if len(message) != 0 { 5521 errorMessage = message 5522 } 5523 5524 switch { 5525 case strings.EqualFold("AccessDeniedException", errorCode): 5526 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 5527 5528 case strings.EqualFold("BadRequestException", errorCode): 5529 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5530 5531 case strings.EqualFold("ConcurrentModificationException", errorCode): 5532 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 5533 5534 case strings.EqualFold("InternalFailureException", errorCode): 5535 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 5536 5537 case strings.EqualFold("NotFoundException", errorCode): 5538 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5539 5540 case strings.EqualFold("UnauthorizedException", errorCode): 5541 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 5542 5543 default: 5544 genericError := &smithy.GenericAPIError{ 5545 Code: errorCode, 5546 Message: errorMessage, 5547 } 5548 return genericError 5549 5550 } 5551} 5552 5553func awsRestjson1_deserializeOpDocumentUpdateGraphqlApiOutput(v **UpdateGraphqlApiOutput, value interface{}) error { 5554 if v == nil { 5555 return fmt.Errorf("unexpected nil of type %T", v) 5556 } 5557 if value == nil { 5558 return nil 5559 } 5560 5561 shape, ok := value.(map[string]interface{}) 5562 if !ok { 5563 return fmt.Errorf("unexpected JSON type %v", value) 5564 } 5565 5566 var sv *UpdateGraphqlApiOutput 5567 if *v == nil { 5568 sv = &UpdateGraphqlApiOutput{} 5569 } else { 5570 sv = *v 5571 } 5572 5573 for key, value := range shape { 5574 switch key { 5575 case "graphqlApi": 5576 if err := awsRestjson1_deserializeDocumentGraphqlApi(&sv.GraphqlApi, value); err != nil { 5577 return err 5578 } 5579 5580 default: 5581 _, _ = key, value 5582 5583 } 5584 } 5585 *v = sv 5586 return nil 5587} 5588 5589type awsRestjson1_deserializeOpUpdateResolver struct { 5590} 5591 5592func (*awsRestjson1_deserializeOpUpdateResolver) ID() string { 5593 return "OperationDeserializer" 5594} 5595 5596func (m *awsRestjson1_deserializeOpUpdateResolver) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5597 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5598) { 5599 out, metadata, err = next.HandleDeserialize(ctx, in) 5600 if err != nil { 5601 return out, metadata, err 5602 } 5603 5604 response, ok := out.RawResponse.(*smithyhttp.Response) 5605 if !ok { 5606 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5607 } 5608 5609 if response.StatusCode < 200 || response.StatusCode >= 300 { 5610 return out, metadata, awsRestjson1_deserializeOpErrorUpdateResolver(response, &metadata) 5611 } 5612 output := &UpdateResolverOutput{} 5613 out.Result = output 5614 5615 var buff [1024]byte 5616 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5617 5618 body := io.TeeReader(response.Body, ringBuffer) 5619 5620 decoder := json.NewDecoder(body) 5621 decoder.UseNumber() 5622 var shape interface{} 5623 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5624 var snapshot bytes.Buffer 5625 io.Copy(&snapshot, ringBuffer) 5626 err = &smithy.DeserializationError{ 5627 Err: fmt.Errorf("failed to decode response body, %w", err), 5628 Snapshot: snapshot.Bytes(), 5629 } 5630 return out, metadata, err 5631 } 5632 5633 err = awsRestjson1_deserializeOpDocumentUpdateResolverOutput(&output, shape) 5634 if err != nil { 5635 var snapshot bytes.Buffer 5636 io.Copy(&snapshot, ringBuffer) 5637 return out, metadata, &smithy.DeserializationError{ 5638 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5639 Snapshot: snapshot.Bytes(), 5640 } 5641 } 5642 5643 return out, metadata, err 5644} 5645 5646func awsRestjson1_deserializeOpErrorUpdateResolver(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5647 var errorBuffer bytes.Buffer 5648 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5649 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5650 } 5651 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5652 5653 errorCode := "UnknownError" 5654 errorMessage := errorCode 5655 5656 code := response.Header.Get("X-Amzn-ErrorType") 5657 if len(code) != 0 { 5658 errorCode = restjson.SanitizeErrorCode(code) 5659 } 5660 5661 var buff [1024]byte 5662 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5663 5664 body := io.TeeReader(errorBody, ringBuffer) 5665 decoder := json.NewDecoder(body) 5666 decoder.UseNumber() 5667 code, message, err := restjson.GetErrorInfo(decoder) 5668 if err != nil { 5669 var snapshot bytes.Buffer 5670 io.Copy(&snapshot, ringBuffer) 5671 err = &smithy.DeserializationError{ 5672 Err: fmt.Errorf("failed to decode response body, %w", err), 5673 Snapshot: snapshot.Bytes(), 5674 } 5675 return err 5676 } 5677 5678 errorBody.Seek(0, io.SeekStart) 5679 if len(code) != 0 { 5680 errorCode = restjson.SanitizeErrorCode(code) 5681 } 5682 if len(message) != 0 { 5683 errorMessage = message 5684 } 5685 5686 switch { 5687 case strings.EqualFold("ConcurrentModificationException", errorCode): 5688 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 5689 5690 case strings.EqualFold("InternalFailureException", errorCode): 5691 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 5692 5693 case strings.EqualFold("NotFoundException", errorCode): 5694 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5695 5696 case strings.EqualFold("UnauthorizedException", errorCode): 5697 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 5698 5699 default: 5700 genericError := &smithy.GenericAPIError{ 5701 Code: errorCode, 5702 Message: errorMessage, 5703 } 5704 return genericError 5705 5706 } 5707} 5708 5709func awsRestjson1_deserializeOpDocumentUpdateResolverOutput(v **UpdateResolverOutput, value interface{}) error { 5710 if v == nil { 5711 return fmt.Errorf("unexpected nil of type %T", v) 5712 } 5713 if value == nil { 5714 return nil 5715 } 5716 5717 shape, ok := value.(map[string]interface{}) 5718 if !ok { 5719 return fmt.Errorf("unexpected JSON type %v", value) 5720 } 5721 5722 var sv *UpdateResolverOutput 5723 if *v == nil { 5724 sv = &UpdateResolverOutput{} 5725 } else { 5726 sv = *v 5727 } 5728 5729 for key, value := range shape { 5730 switch key { 5731 case "resolver": 5732 if err := awsRestjson1_deserializeDocumentResolver(&sv.Resolver, value); err != nil { 5733 return err 5734 } 5735 5736 default: 5737 _, _ = key, value 5738 5739 } 5740 } 5741 *v = sv 5742 return nil 5743} 5744 5745type awsRestjson1_deserializeOpUpdateType struct { 5746} 5747 5748func (*awsRestjson1_deserializeOpUpdateType) ID() string { 5749 return "OperationDeserializer" 5750} 5751 5752func (m *awsRestjson1_deserializeOpUpdateType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5753 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5754) { 5755 out, metadata, err = next.HandleDeserialize(ctx, in) 5756 if err != nil { 5757 return out, metadata, err 5758 } 5759 5760 response, ok := out.RawResponse.(*smithyhttp.Response) 5761 if !ok { 5762 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5763 } 5764 5765 if response.StatusCode < 200 || response.StatusCode >= 300 { 5766 return out, metadata, awsRestjson1_deserializeOpErrorUpdateType(response, &metadata) 5767 } 5768 output := &UpdateTypeOutput{} 5769 out.Result = output 5770 5771 var buff [1024]byte 5772 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5773 5774 body := io.TeeReader(response.Body, ringBuffer) 5775 5776 decoder := json.NewDecoder(body) 5777 decoder.UseNumber() 5778 var shape interface{} 5779 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5780 var snapshot bytes.Buffer 5781 io.Copy(&snapshot, ringBuffer) 5782 err = &smithy.DeserializationError{ 5783 Err: fmt.Errorf("failed to decode response body, %w", err), 5784 Snapshot: snapshot.Bytes(), 5785 } 5786 return out, metadata, err 5787 } 5788 5789 err = awsRestjson1_deserializeOpDocumentUpdateTypeOutput(&output, shape) 5790 if err != nil { 5791 var snapshot bytes.Buffer 5792 io.Copy(&snapshot, ringBuffer) 5793 return out, metadata, &smithy.DeserializationError{ 5794 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5795 Snapshot: snapshot.Bytes(), 5796 } 5797 } 5798 5799 return out, metadata, err 5800} 5801 5802func awsRestjson1_deserializeOpErrorUpdateType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5803 var errorBuffer bytes.Buffer 5804 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5805 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5806 } 5807 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5808 5809 errorCode := "UnknownError" 5810 errorMessage := errorCode 5811 5812 code := response.Header.Get("X-Amzn-ErrorType") 5813 if len(code) != 0 { 5814 errorCode = restjson.SanitizeErrorCode(code) 5815 } 5816 5817 var buff [1024]byte 5818 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5819 5820 body := io.TeeReader(errorBody, ringBuffer) 5821 decoder := json.NewDecoder(body) 5822 decoder.UseNumber() 5823 code, message, err := restjson.GetErrorInfo(decoder) 5824 if err != nil { 5825 var snapshot bytes.Buffer 5826 io.Copy(&snapshot, ringBuffer) 5827 err = &smithy.DeserializationError{ 5828 Err: fmt.Errorf("failed to decode response body, %w", err), 5829 Snapshot: snapshot.Bytes(), 5830 } 5831 return err 5832 } 5833 5834 errorBody.Seek(0, io.SeekStart) 5835 if len(code) != 0 { 5836 errorCode = restjson.SanitizeErrorCode(code) 5837 } 5838 if len(message) != 0 { 5839 errorMessage = message 5840 } 5841 5842 switch { 5843 case strings.EqualFold("BadRequestException", errorCode): 5844 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 5845 5846 case strings.EqualFold("ConcurrentModificationException", errorCode): 5847 return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) 5848 5849 case strings.EqualFold("InternalFailureException", errorCode): 5850 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 5851 5852 case strings.EqualFold("NotFoundException", errorCode): 5853 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 5854 5855 case strings.EqualFold("UnauthorizedException", errorCode): 5856 return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) 5857 5858 default: 5859 genericError := &smithy.GenericAPIError{ 5860 Code: errorCode, 5861 Message: errorMessage, 5862 } 5863 return genericError 5864 5865 } 5866} 5867 5868func awsRestjson1_deserializeOpDocumentUpdateTypeOutput(v **UpdateTypeOutput, value interface{}) error { 5869 if v == nil { 5870 return fmt.Errorf("unexpected nil of type %T", v) 5871 } 5872 if value == nil { 5873 return nil 5874 } 5875 5876 shape, ok := value.(map[string]interface{}) 5877 if !ok { 5878 return fmt.Errorf("unexpected JSON type %v", value) 5879 } 5880 5881 var sv *UpdateTypeOutput 5882 if *v == nil { 5883 sv = &UpdateTypeOutput{} 5884 } else { 5885 sv = *v 5886 } 5887 5888 for key, value := range shape { 5889 switch key { 5890 case "type": 5891 if err := awsRestjson1_deserializeDocumentType(&sv.Type, value); err != nil { 5892 return err 5893 } 5894 5895 default: 5896 _, _ = key, value 5897 5898 } 5899 } 5900 *v = sv 5901 return nil 5902} 5903 5904func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5905 output := &types.AccessDeniedException{} 5906 var buff [1024]byte 5907 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5908 5909 body := io.TeeReader(errorBody, ringBuffer) 5910 decoder := json.NewDecoder(body) 5911 decoder.UseNumber() 5912 var shape interface{} 5913 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5914 var snapshot bytes.Buffer 5915 io.Copy(&snapshot, ringBuffer) 5916 err = &smithy.DeserializationError{ 5917 Err: fmt.Errorf("failed to decode response body, %w", err), 5918 Snapshot: snapshot.Bytes(), 5919 } 5920 return err 5921 } 5922 5923 err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) 5924 5925 if err != nil { 5926 var snapshot bytes.Buffer 5927 io.Copy(&snapshot, ringBuffer) 5928 err = &smithy.DeserializationError{ 5929 Err: fmt.Errorf("failed to decode response body, %w", err), 5930 Snapshot: snapshot.Bytes(), 5931 } 5932 return err 5933 } 5934 5935 errorBody.Seek(0, io.SeekStart) 5936 5937 return output 5938} 5939 5940func awsRestjson1_deserializeErrorApiKeyLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5941 output := &types.ApiKeyLimitExceededException{} 5942 var buff [1024]byte 5943 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5944 5945 body := io.TeeReader(errorBody, ringBuffer) 5946 decoder := json.NewDecoder(body) 5947 decoder.UseNumber() 5948 var shape interface{} 5949 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5950 var snapshot bytes.Buffer 5951 io.Copy(&snapshot, ringBuffer) 5952 err = &smithy.DeserializationError{ 5953 Err: fmt.Errorf("failed to decode response body, %w", err), 5954 Snapshot: snapshot.Bytes(), 5955 } 5956 return err 5957 } 5958 5959 err := awsRestjson1_deserializeDocumentApiKeyLimitExceededException(&output, shape) 5960 5961 if err != nil { 5962 var snapshot bytes.Buffer 5963 io.Copy(&snapshot, ringBuffer) 5964 err = &smithy.DeserializationError{ 5965 Err: fmt.Errorf("failed to decode response body, %w", err), 5966 Snapshot: snapshot.Bytes(), 5967 } 5968 return err 5969 } 5970 5971 errorBody.Seek(0, io.SeekStart) 5972 5973 return output 5974} 5975 5976func awsRestjson1_deserializeErrorApiKeyValidityOutOfBoundsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 5977 output := &types.ApiKeyValidityOutOfBoundsException{} 5978 var buff [1024]byte 5979 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5980 5981 body := io.TeeReader(errorBody, ringBuffer) 5982 decoder := json.NewDecoder(body) 5983 decoder.UseNumber() 5984 var shape interface{} 5985 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5986 var snapshot bytes.Buffer 5987 io.Copy(&snapshot, ringBuffer) 5988 err = &smithy.DeserializationError{ 5989 Err: fmt.Errorf("failed to decode response body, %w", err), 5990 Snapshot: snapshot.Bytes(), 5991 } 5992 return err 5993 } 5994 5995 err := awsRestjson1_deserializeDocumentApiKeyValidityOutOfBoundsException(&output, shape) 5996 5997 if err != nil { 5998 var snapshot bytes.Buffer 5999 io.Copy(&snapshot, ringBuffer) 6000 err = &smithy.DeserializationError{ 6001 Err: fmt.Errorf("failed to decode response body, %w", err), 6002 Snapshot: snapshot.Bytes(), 6003 } 6004 return err 6005 } 6006 6007 errorBody.Seek(0, io.SeekStart) 6008 6009 return output 6010} 6011 6012func awsRestjson1_deserializeErrorApiLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6013 output := &types.ApiLimitExceededException{} 6014 var buff [1024]byte 6015 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6016 6017 body := io.TeeReader(errorBody, ringBuffer) 6018 decoder := json.NewDecoder(body) 6019 decoder.UseNumber() 6020 var shape interface{} 6021 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6022 var snapshot bytes.Buffer 6023 io.Copy(&snapshot, ringBuffer) 6024 err = &smithy.DeserializationError{ 6025 Err: fmt.Errorf("failed to decode response body, %w", err), 6026 Snapshot: snapshot.Bytes(), 6027 } 6028 return err 6029 } 6030 6031 err := awsRestjson1_deserializeDocumentApiLimitExceededException(&output, shape) 6032 6033 if err != nil { 6034 var snapshot bytes.Buffer 6035 io.Copy(&snapshot, ringBuffer) 6036 err = &smithy.DeserializationError{ 6037 Err: fmt.Errorf("failed to decode response body, %w", err), 6038 Snapshot: snapshot.Bytes(), 6039 } 6040 return err 6041 } 6042 6043 errorBody.Seek(0, io.SeekStart) 6044 6045 return output 6046} 6047 6048func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6049 output := &types.BadRequestException{} 6050 var buff [1024]byte 6051 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6052 6053 body := io.TeeReader(errorBody, ringBuffer) 6054 decoder := json.NewDecoder(body) 6055 decoder.UseNumber() 6056 var shape interface{} 6057 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6058 var snapshot bytes.Buffer 6059 io.Copy(&snapshot, ringBuffer) 6060 err = &smithy.DeserializationError{ 6061 Err: fmt.Errorf("failed to decode response body, %w", err), 6062 Snapshot: snapshot.Bytes(), 6063 } 6064 return err 6065 } 6066 6067 err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape) 6068 6069 if err != nil { 6070 var snapshot bytes.Buffer 6071 io.Copy(&snapshot, ringBuffer) 6072 err = &smithy.DeserializationError{ 6073 Err: fmt.Errorf("failed to decode response body, %w", err), 6074 Snapshot: snapshot.Bytes(), 6075 } 6076 return err 6077 } 6078 6079 errorBody.Seek(0, io.SeekStart) 6080 6081 return output 6082} 6083 6084func awsRestjson1_deserializeErrorConcurrentModificationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6085 output := &types.ConcurrentModificationException{} 6086 var buff [1024]byte 6087 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6088 6089 body := io.TeeReader(errorBody, ringBuffer) 6090 decoder := json.NewDecoder(body) 6091 decoder.UseNumber() 6092 var shape interface{} 6093 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6094 var snapshot bytes.Buffer 6095 io.Copy(&snapshot, ringBuffer) 6096 err = &smithy.DeserializationError{ 6097 Err: fmt.Errorf("failed to decode response body, %w", err), 6098 Snapshot: snapshot.Bytes(), 6099 } 6100 return err 6101 } 6102 6103 err := awsRestjson1_deserializeDocumentConcurrentModificationException(&output, shape) 6104 6105 if err != nil { 6106 var snapshot bytes.Buffer 6107 io.Copy(&snapshot, ringBuffer) 6108 err = &smithy.DeserializationError{ 6109 Err: fmt.Errorf("failed to decode response body, %w", err), 6110 Snapshot: snapshot.Bytes(), 6111 } 6112 return err 6113 } 6114 6115 errorBody.Seek(0, io.SeekStart) 6116 6117 return output 6118} 6119 6120func awsRestjson1_deserializeErrorGraphQLSchemaException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6121 output := &types.GraphQLSchemaException{} 6122 var buff [1024]byte 6123 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6124 6125 body := io.TeeReader(errorBody, ringBuffer) 6126 decoder := json.NewDecoder(body) 6127 decoder.UseNumber() 6128 var shape interface{} 6129 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6130 var snapshot bytes.Buffer 6131 io.Copy(&snapshot, ringBuffer) 6132 err = &smithy.DeserializationError{ 6133 Err: fmt.Errorf("failed to decode response body, %w", err), 6134 Snapshot: snapshot.Bytes(), 6135 } 6136 return err 6137 } 6138 6139 err := awsRestjson1_deserializeDocumentGraphQLSchemaException(&output, shape) 6140 6141 if err != nil { 6142 var snapshot bytes.Buffer 6143 io.Copy(&snapshot, ringBuffer) 6144 err = &smithy.DeserializationError{ 6145 Err: fmt.Errorf("failed to decode response body, %w", err), 6146 Snapshot: snapshot.Bytes(), 6147 } 6148 return err 6149 } 6150 6151 errorBody.Seek(0, io.SeekStart) 6152 6153 return output 6154} 6155 6156func awsRestjson1_deserializeErrorInternalFailureException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6157 output := &types.InternalFailureException{} 6158 var buff [1024]byte 6159 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6160 6161 body := io.TeeReader(errorBody, ringBuffer) 6162 decoder := json.NewDecoder(body) 6163 decoder.UseNumber() 6164 var shape interface{} 6165 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6166 var snapshot bytes.Buffer 6167 io.Copy(&snapshot, ringBuffer) 6168 err = &smithy.DeserializationError{ 6169 Err: fmt.Errorf("failed to decode response body, %w", err), 6170 Snapshot: snapshot.Bytes(), 6171 } 6172 return err 6173 } 6174 6175 err := awsRestjson1_deserializeDocumentInternalFailureException(&output, shape) 6176 6177 if err != nil { 6178 var snapshot bytes.Buffer 6179 io.Copy(&snapshot, ringBuffer) 6180 err = &smithy.DeserializationError{ 6181 Err: fmt.Errorf("failed to decode response body, %w", err), 6182 Snapshot: snapshot.Bytes(), 6183 } 6184 return err 6185 } 6186 6187 errorBody.Seek(0, io.SeekStart) 6188 6189 return output 6190} 6191 6192func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6193 output := &types.LimitExceededException{} 6194 var buff [1024]byte 6195 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6196 6197 body := io.TeeReader(errorBody, ringBuffer) 6198 decoder := json.NewDecoder(body) 6199 decoder.UseNumber() 6200 var shape interface{} 6201 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6202 var snapshot bytes.Buffer 6203 io.Copy(&snapshot, ringBuffer) 6204 err = &smithy.DeserializationError{ 6205 Err: fmt.Errorf("failed to decode response body, %w", err), 6206 Snapshot: snapshot.Bytes(), 6207 } 6208 return err 6209 } 6210 6211 err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape) 6212 6213 if err != nil { 6214 var snapshot bytes.Buffer 6215 io.Copy(&snapshot, ringBuffer) 6216 err = &smithy.DeserializationError{ 6217 Err: fmt.Errorf("failed to decode response body, %w", err), 6218 Snapshot: snapshot.Bytes(), 6219 } 6220 return err 6221 } 6222 6223 errorBody.Seek(0, io.SeekStart) 6224 6225 return output 6226} 6227 6228func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6229 output := &types.NotFoundException{} 6230 var buff [1024]byte 6231 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6232 6233 body := io.TeeReader(errorBody, ringBuffer) 6234 decoder := json.NewDecoder(body) 6235 decoder.UseNumber() 6236 var shape interface{} 6237 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6238 var snapshot bytes.Buffer 6239 io.Copy(&snapshot, ringBuffer) 6240 err = &smithy.DeserializationError{ 6241 Err: fmt.Errorf("failed to decode response body, %w", err), 6242 Snapshot: snapshot.Bytes(), 6243 } 6244 return err 6245 } 6246 6247 err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape) 6248 6249 if err != nil { 6250 var snapshot bytes.Buffer 6251 io.Copy(&snapshot, ringBuffer) 6252 err = &smithy.DeserializationError{ 6253 Err: fmt.Errorf("failed to decode response body, %w", err), 6254 Snapshot: snapshot.Bytes(), 6255 } 6256 return err 6257 } 6258 6259 errorBody.Seek(0, io.SeekStart) 6260 6261 return output 6262} 6263 6264func awsRestjson1_deserializeErrorUnauthorizedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 6265 output := &types.UnauthorizedException{} 6266 var buff [1024]byte 6267 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6268 6269 body := io.TeeReader(errorBody, ringBuffer) 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 err 6281 } 6282 6283 err := awsRestjson1_deserializeDocumentUnauthorizedException(&output, shape) 6284 6285 if err != nil { 6286 var snapshot bytes.Buffer 6287 io.Copy(&snapshot, ringBuffer) 6288 err = &smithy.DeserializationError{ 6289 Err: fmt.Errorf("failed to decode response body, %w", err), 6290 Snapshot: snapshot.Bytes(), 6291 } 6292 return err 6293 } 6294 6295 errorBody.Seek(0, io.SeekStart) 6296 6297 return output 6298} 6299 6300func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { 6301 if v == nil { 6302 return fmt.Errorf("unexpected nil of type %T", v) 6303 } 6304 if value == nil { 6305 return nil 6306 } 6307 6308 shape, ok := value.(map[string]interface{}) 6309 if !ok { 6310 return fmt.Errorf("unexpected JSON type %v", value) 6311 } 6312 6313 var sv *types.AccessDeniedException 6314 if *v == nil { 6315 sv = &types.AccessDeniedException{} 6316 } else { 6317 sv = *v 6318 } 6319 6320 for key, value := range shape { 6321 switch key { 6322 case "message": 6323 if value != nil { 6324 jtv, ok := value.(string) 6325 if !ok { 6326 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6327 } 6328 sv.Message = ptr.String(jtv) 6329 } 6330 6331 default: 6332 _, _ = key, value 6333 6334 } 6335 } 6336 *v = sv 6337 return nil 6338} 6339 6340func awsRestjson1_deserializeDocumentAdditionalAuthenticationProvider(v **types.AdditionalAuthenticationProvider, value interface{}) error { 6341 if v == nil { 6342 return fmt.Errorf("unexpected nil of type %T", v) 6343 } 6344 if value == nil { 6345 return nil 6346 } 6347 6348 shape, ok := value.(map[string]interface{}) 6349 if !ok { 6350 return fmt.Errorf("unexpected JSON type %v", value) 6351 } 6352 6353 var sv *types.AdditionalAuthenticationProvider 6354 if *v == nil { 6355 sv = &types.AdditionalAuthenticationProvider{} 6356 } else { 6357 sv = *v 6358 } 6359 6360 for key, value := range shape { 6361 switch key { 6362 case "authenticationType": 6363 if value != nil { 6364 jtv, ok := value.(string) 6365 if !ok { 6366 return fmt.Errorf("expected AuthenticationType to be of type string, got %T instead", value) 6367 } 6368 sv.AuthenticationType = types.AuthenticationType(jtv) 6369 } 6370 6371 case "lambdaAuthorizerConfig": 6372 if err := awsRestjson1_deserializeDocumentLambdaAuthorizerConfig(&sv.LambdaAuthorizerConfig, value); err != nil { 6373 return err 6374 } 6375 6376 case "openIDConnectConfig": 6377 if err := awsRestjson1_deserializeDocumentOpenIDConnectConfig(&sv.OpenIDConnectConfig, value); err != nil { 6378 return err 6379 } 6380 6381 case "userPoolConfig": 6382 if err := awsRestjson1_deserializeDocumentCognitoUserPoolConfig(&sv.UserPoolConfig, value); err != nil { 6383 return err 6384 } 6385 6386 default: 6387 _, _ = key, value 6388 6389 } 6390 } 6391 *v = sv 6392 return nil 6393} 6394 6395func awsRestjson1_deserializeDocumentAdditionalAuthenticationProviders(v *[]types.AdditionalAuthenticationProvider, value interface{}) error { 6396 if v == nil { 6397 return fmt.Errorf("unexpected nil of type %T", v) 6398 } 6399 if value == nil { 6400 return nil 6401 } 6402 6403 shape, ok := value.([]interface{}) 6404 if !ok { 6405 return fmt.Errorf("unexpected JSON type %v", value) 6406 } 6407 6408 var cv []types.AdditionalAuthenticationProvider 6409 if *v == nil { 6410 cv = []types.AdditionalAuthenticationProvider{} 6411 } else { 6412 cv = *v 6413 } 6414 6415 for _, value := range shape { 6416 var col types.AdditionalAuthenticationProvider 6417 destAddr := &col 6418 if err := awsRestjson1_deserializeDocumentAdditionalAuthenticationProvider(&destAddr, value); err != nil { 6419 return err 6420 } 6421 col = *destAddr 6422 cv = append(cv, col) 6423 6424 } 6425 *v = cv 6426 return nil 6427} 6428 6429func awsRestjson1_deserializeDocumentApiCache(v **types.ApiCache, value interface{}) error { 6430 if v == nil { 6431 return fmt.Errorf("unexpected nil of type %T", v) 6432 } 6433 if value == nil { 6434 return nil 6435 } 6436 6437 shape, ok := value.(map[string]interface{}) 6438 if !ok { 6439 return fmt.Errorf("unexpected JSON type %v", value) 6440 } 6441 6442 var sv *types.ApiCache 6443 if *v == nil { 6444 sv = &types.ApiCache{} 6445 } else { 6446 sv = *v 6447 } 6448 6449 for key, value := range shape { 6450 switch key { 6451 case "apiCachingBehavior": 6452 if value != nil { 6453 jtv, ok := value.(string) 6454 if !ok { 6455 return fmt.Errorf("expected ApiCachingBehavior to be of type string, got %T instead", value) 6456 } 6457 sv.ApiCachingBehavior = types.ApiCachingBehavior(jtv) 6458 } 6459 6460 case "atRestEncryptionEnabled": 6461 if value != nil { 6462 jtv, ok := value.(bool) 6463 if !ok { 6464 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 6465 } 6466 sv.AtRestEncryptionEnabled = jtv 6467 } 6468 6469 case "status": 6470 if value != nil { 6471 jtv, ok := value.(string) 6472 if !ok { 6473 return fmt.Errorf("expected ApiCacheStatus to be of type string, got %T instead", value) 6474 } 6475 sv.Status = types.ApiCacheStatus(jtv) 6476 } 6477 6478 case "transitEncryptionEnabled": 6479 if value != nil { 6480 jtv, ok := value.(bool) 6481 if !ok { 6482 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 6483 } 6484 sv.TransitEncryptionEnabled = jtv 6485 } 6486 6487 case "ttl": 6488 if value != nil { 6489 jtv, ok := value.(json.Number) 6490 if !ok { 6491 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 6492 } 6493 i64, err := jtv.Int64() 6494 if err != nil { 6495 return err 6496 } 6497 sv.Ttl = i64 6498 } 6499 6500 case "type": 6501 if value != nil { 6502 jtv, ok := value.(string) 6503 if !ok { 6504 return fmt.Errorf("expected ApiCacheType to be of type string, got %T instead", value) 6505 } 6506 sv.Type = types.ApiCacheType(jtv) 6507 } 6508 6509 default: 6510 _, _ = key, value 6511 6512 } 6513 } 6514 *v = sv 6515 return nil 6516} 6517 6518func awsRestjson1_deserializeDocumentApiKey(v **types.ApiKey, value interface{}) error { 6519 if v == nil { 6520 return fmt.Errorf("unexpected nil of type %T", v) 6521 } 6522 if value == nil { 6523 return nil 6524 } 6525 6526 shape, ok := value.(map[string]interface{}) 6527 if !ok { 6528 return fmt.Errorf("unexpected JSON type %v", value) 6529 } 6530 6531 var sv *types.ApiKey 6532 if *v == nil { 6533 sv = &types.ApiKey{} 6534 } else { 6535 sv = *v 6536 } 6537 6538 for key, value := range shape { 6539 switch key { 6540 case "deletes": 6541 if value != nil { 6542 jtv, ok := value.(json.Number) 6543 if !ok { 6544 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 6545 } 6546 i64, err := jtv.Int64() 6547 if err != nil { 6548 return err 6549 } 6550 sv.Deletes = i64 6551 } 6552 6553 case "description": 6554 if value != nil { 6555 jtv, ok := value.(string) 6556 if !ok { 6557 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6558 } 6559 sv.Description = ptr.String(jtv) 6560 } 6561 6562 case "expires": 6563 if value != nil { 6564 jtv, ok := value.(json.Number) 6565 if !ok { 6566 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 6567 } 6568 i64, err := jtv.Int64() 6569 if err != nil { 6570 return err 6571 } 6572 sv.Expires = i64 6573 } 6574 6575 case "id": 6576 if value != nil { 6577 jtv, ok := value.(string) 6578 if !ok { 6579 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6580 } 6581 sv.Id = ptr.String(jtv) 6582 } 6583 6584 default: 6585 _, _ = key, value 6586 6587 } 6588 } 6589 *v = sv 6590 return nil 6591} 6592 6593func awsRestjson1_deserializeDocumentApiKeyLimitExceededException(v **types.ApiKeyLimitExceededException, value interface{}) error { 6594 if v == nil { 6595 return fmt.Errorf("unexpected nil of type %T", v) 6596 } 6597 if value == nil { 6598 return nil 6599 } 6600 6601 shape, ok := value.(map[string]interface{}) 6602 if !ok { 6603 return fmt.Errorf("unexpected JSON type %v", value) 6604 } 6605 6606 var sv *types.ApiKeyLimitExceededException 6607 if *v == nil { 6608 sv = &types.ApiKeyLimitExceededException{} 6609 } else { 6610 sv = *v 6611 } 6612 6613 for key, value := range shape { 6614 switch key { 6615 case "message": 6616 if value != nil { 6617 jtv, ok := value.(string) 6618 if !ok { 6619 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6620 } 6621 sv.Message = ptr.String(jtv) 6622 } 6623 6624 default: 6625 _, _ = key, value 6626 6627 } 6628 } 6629 *v = sv 6630 return nil 6631} 6632 6633func awsRestjson1_deserializeDocumentApiKeys(v *[]types.ApiKey, value interface{}) error { 6634 if v == nil { 6635 return fmt.Errorf("unexpected nil of type %T", v) 6636 } 6637 if value == nil { 6638 return nil 6639 } 6640 6641 shape, ok := value.([]interface{}) 6642 if !ok { 6643 return fmt.Errorf("unexpected JSON type %v", value) 6644 } 6645 6646 var cv []types.ApiKey 6647 if *v == nil { 6648 cv = []types.ApiKey{} 6649 } else { 6650 cv = *v 6651 } 6652 6653 for _, value := range shape { 6654 var col types.ApiKey 6655 destAddr := &col 6656 if err := awsRestjson1_deserializeDocumentApiKey(&destAddr, value); err != nil { 6657 return err 6658 } 6659 col = *destAddr 6660 cv = append(cv, col) 6661 6662 } 6663 *v = cv 6664 return nil 6665} 6666 6667func awsRestjson1_deserializeDocumentApiKeyValidityOutOfBoundsException(v **types.ApiKeyValidityOutOfBoundsException, value interface{}) error { 6668 if v == nil { 6669 return fmt.Errorf("unexpected nil of type %T", v) 6670 } 6671 if value == nil { 6672 return nil 6673 } 6674 6675 shape, ok := value.(map[string]interface{}) 6676 if !ok { 6677 return fmt.Errorf("unexpected JSON type %v", value) 6678 } 6679 6680 var sv *types.ApiKeyValidityOutOfBoundsException 6681 if *v == nil { 6682 sv = &types.ApiKeyValidityOutOfBoundsException{} 6683 } else { 6684 sv = *v 6685 } 6686 6687 for key, value := range shape { 6688 switch key { 6689 case "message": 6690 if value != nil { 6691 jtv, ok := value.(string) 6692 if !ok { 6693 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6694 } 6695 sv.Message = ptr.String(jtv) 6696 } 6697 6698 default: 6699 _, _ = key, value 6700 6701 } 6702 } 6703 *v = sv 6704 return nil 6705} 6706 6707func awsRestjson1_deserializeDocumentApiLimitExceededException(v **types.ApiLimitExceededException, value interface{}) error { 6708 if v == nil { 6709 return fmt.Errorf("unexpected nil of type %T", v) 6710 } 6711 if value == nil { 6712 return nil 6713 } 6714 6715 shape, ok := value.(map[string]interface{}) 6716 if !ok { 6717 return fmt.Errorf("unexpected JSON type %v", value) 6718 } 6719 6720 var sv *types.ApiLimitExceededException 6721 if *v == nil { 6722 sv = &types.ApiLimitExceededException{} 6723 } else { 6724 sv = *v 6725 } 6726 6727 for key, value := range shape { 6728 switch key { 6729 case "message": 6730 if value != nil { 6731 jtv, ok := value.(string) 6732 if !ok { 6733 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6734 } 6735 sv.Message = ptr.String(jtv) 6736 } 6737 6738 default: 6739 _, _ = key, value 6740 6741 } 6742 } 6743 *v = sv 6744 return nil 6745} 6746 6747func awsRestjson1_deserializeDocumentAuthorizationConfig(v **types.AuthorizationConfig, value interface{}) error { 6748 if v == nil { 6749 return fmt.Errorf("unexpected nil of type %T", v) 6750 } 6751 if value == nil { 6752 return nil 6753 } 6754 6755 shape, ok := value.(map[string]interface{}) 6756 if !ok { 6757 return fmt.Errorf("unexpected JSON type %v", value) 6758 } 6759 6760 var sv *types.AuthorizationConfig 6761 if *v == nil { 6762 sv = &types.AuthorizationConfig{} 6763 } else { 6764 sv = *v 6765 } 6766 6767 for key, value := range shape { 6768 switch key { 6769 case "authorizationType": 6770 if value != nil { 6771 jtv, ok := value.(string) 6772 if !ok { 6773 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 6774 } 6775 sv.AuthorizationType = types.AuthorizationType(jtv) 6776 } 6777 6778 case "awsIamConfig": 6779 if err := awsRestjson1_deserializeDocumentAwsIamConfig(&sv.AwsIamConfig, value); err != nil { 6780 return err 6781 } 6782 6783 default: 6784 _, _ = key, value 6785 6786 } 6787 } 6788 *v = sv 6789 return nil 6790} 6791 6792func awsRestjson1_deserializeDocumentAwsIamConfig(v **types.AwsIamConfig, value interface{}) error { 6793 if v == nil { 6794 return fmt.Errorf("unexpected nil of type %T", v) 6795 } 6796 if value == nil { 6797 return nil 6798 } 6799 6800 shape, ok := value.(map[string]interface{}) 6801 if !ok { 6802 return fmt.Errorf("unexpected JSON type %v", value) 6803 } 6804 6805 var sv *types.AwsIamConfig 6806 if *v == nil { 6807 sv = &types.AwsIamConfig{} 6808 } else { 6809 sv = *v 6810 } 6811 6812 for key, value := range shape { 6813 switch key { 6814 case "signingRegion": 6815 if value != nil { 6816 jtv, ok := value.(string) 6817 if !ok { 6818 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6819 } 6820 sv.SigningRegion = ptr.String(jtv) 6821 } 6822 6823 case "signingServiceName": 6824 if value != nil { 6825 jtv, ok := value.(string) 6826 if !ok { 6827 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6828 } 6829 sv.SigningServiceName = ptr.String(jtv) 6830 } 6831 6832 default: 6833 _, _ = key, value 6834 6835 } 6836 } 6837 *v = sv 6838 return nil 6839} 6840 6841func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 6842 if v == nil { 6843 return fmt.Errorf("unexpected nil of type %T", v) 6844 } 6845 if value == nil { 6846 return nil 6847 } 6848 6849 shape, ok := value.(map[string]interface{}) 6850 if !ok { 6851 return fmt.Errorf("unexpected JSON type %v", value) 6852 } 6853 6854 var sv *types.BadRequestException 6855 if *v == nil { 6856 sv = &types.BadRequestException{} 6857 } else { 6858 sv = *v 6859 } 6860 6861 for key, value := range shape { 6862 switch key { 6863 case "message": 6864 if value != nil { 6865 jtv, ok := value.(string) 6866 if !ok { 6867 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 6868 } 6869 sv.Message = ptr.String(jtv) 6870 } 6871 6872 default: 6873 _, _ = key, value 6874 6875 } 6876 } 6877 *v = sv 6878 return nil 6879} 6880 6881func awsRestjson1_deserializeDocumentCachingConfig(v **types.CachingConfig, value interface{}) error { 6882 if v == nil { 6883 return fmt.Errorf("unexpected nil of type %T", v) 6884 } 6885 if value == nil { 6886 return nil 6887 } 6888 6889 shape, ok := value.(map[string]interface{}) 6890 if !ok { 6891 return fmt.Errorf("unexpected JSON type %v", value) 6892 } 6893 6894 var sv *types.CachingConfig 6895 if *v == nil { 6896 sv = &types.CachingConfig{} 6897 } else { 6898 sv = *v 6899 } 6900 6901 for key, value := range shape { 6902 switch key { 6903 case "cachingKeys": 6904 if err := awsRestjson1_deserializeDocumentCachingKeys(&sv.CachingKeys, value); err != nil { 6905 return err 6906 } 6907 6908 case "ttl": 6909 if value != nil { 6910 jtv, ok := value.(json.Number) 6911 if !ok { 6912 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 6913 } 6914 i64, err := jtv.Int64() 6915 if err != nil { 6916 return err 6917 } 6918 sv.Ttl = i64 6919 } 6920 6921 default: 6922 _, _ = key, value 6923 6924 } 6925 } 6926 *v = sv 6927 return nil 6928} 6929 6930func awsRestjson1_deserializeDocumentCachingKeys(v *[]string, value interface{}) error { 6931 if v == nil { 6932 return fmt.Errorf("unexpected nil of type %T", v) 6933 } 6934 if value == nil { 6935 return nil 6936 } 6937 6938 shape, ok := value.([]interface{}) 6939 if !ok { 6940 return fmt.Errorf("unexpected JSON type %v", value) 6941 } 6942 6943 var cv []string 6944 if *v == nil { 6945 cv = []string{} 6946 } else { 6947 cv = *v 6948 } 6949 6950 for _, value := range shape { 6951 var col string 6952 if value != nil { 6953 jtv, ok := value.(string) 6954 if !ok { 6955 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6956 } 6957 col = jtv 6958 } 6959 cv = append(cv, col) 6960 6961 } 6962 *v = cv 6963 return nil 6964} 6965 6966func awsRestjson1_deserializeDocumentCognitoUserPoolConfig(v **types.CognitoUserPoolConfig, value interface{}) error { 6967 if v == nil { 6968 return fmt.Errorf("unexpected nil of type %T", v) 6969 } 6970 if value == nil { 6971 return nil 6972 } 6973 6974 shape, ok := value.(map[string]interface{}) 6975 if !ok { 6976 return fmt.Errorf("unexpected JSON type %v", value) 6977 } 6978 6979 var sv *types.CognitoUserPoolConfig 6980 if *v == nil { 6981 sv = &types.CognitoUserPoolConfig{} 6982 } else { 6983 sv = *v 6984 } 6985 6986 for key, value := range shape { 6987 switch key { 6988 case "appIdClientRegex": 6989 if value != nil { 6990 jtv, ok := value.(string) 6991 if !ok { 6992 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6993 } 6994 sv.AppIdClientRegex = ptr.String(jtv) 6995 } 6996 6997 case "awsRegion": 6998 if value != nil { 6999 jtv, ok := value.(string) 7000 if !ok { 7001 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7002 } 7003 sv.AwsRegion = ptr.String(jtv) 7004 } 7005 7006 case "userPoolId": 7007 if value != nil { 7008 jtv, ok := value.(string) 7009 if !ok { 7010 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7011 } 7012 sv.UserPoolId = ptr.String(jtv) 7013 } 7014 7015 default: 7016 _, _ = key, value 7017 7018 } 7019 } 7020 *v = sv 7021 return nil 7022} 7023 7024func awsRestjson1_deserializeDocumentConcurrentModificationException(v **types.ConcurrentModificationException, value interface{}) error { 7025 if v == nil { 7026 return fmt.Errorf("unexpected nil of type %T", v) 7027 } 7028 if value == nil { 7029 return nil 7030 } 7031 7032 shape, ok := value.(map[string]interface{}) 7033 if !ok { 7034 return fmt.Errorf("unexpected JSON type %v", value) 7035 } 7036 7037 var sv *types.ConcurrentModificationException 7038 if *v == nil { 7039 sv = &types.ConcurrentModificationException{} 7040 } else { 7041 sv = *v 7042 } 7043 7044 for key, value := range shape { 7045 switch key { 7046 case "message": 7047 if value != nil { 7048 jtv, ok := value.(string) 7049 if !ok { 7050 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 7051 } 7052 sv.Message = ptr.String(jtv) 7053 } 7054 7055 default: 7056 _, _ = key, value 7057 7058 } 7059 } 7060 *v = sv 7061 return nil 7062} 7063 7064func awsRestjson1_deserializeDocumentDataSource(v **types.DataSource, value interface{}) error { 7065 if v == nil { 7066 return fmt.Errorf("unexpected nil of type %T", v) 7067 } 7068 if value == nil { 7069 return nil 7070 } 7071 7072 shape, ok := value.(map[string]interface{}) 7073 if !ok { 7074 return fmt.Errorf("unexpected JSON type %v", value) 7075 } 7076 7077 var sv *types.DataSource 7078 if *v == nil { 7079 sv = &types.DataSource{} 7080 } else { 7081 sv = *v 7082 } 7083 7084 for key, value := range shape { 7085 switch key { 7086 case "dataSourceArn": 7087 if value != nil { 7088 jtv, ok := value.(string) 7089 if !ok { 7090 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7091 } 7092 sv.DataSourceArn = ptr.String(jtv) 7093 } 7094 7095 case "description": 7096 if value != nil { 7097 jtv, ok := value.(string) 7098 if !ok { 7099 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7100 } 7101 sv.Description = ptr.String(jtv) 7102 } 7103 7104 case "dynamodbConfig": 7105 if err := awsRestjson1_deserializeDocumentDynamodbDataSourceConfig(&sv.DynamodbConfig, value); err != nil { 7106 return err 7107 } 7108 7109 case "elasticsearchConfig": 7110 if err := awsRestjson1_deserializeDocumentElasticsearchDataSourceConfig(&sv.ElasticsearchConfig, value); err != nil { 7111 return err 7112 } 7113 7114 case "httpConfig": 7115 if err := awsRestjson1_deserializeDocumentHttpDataSourceConfig(&sv.HttpConfig, value); err != nil { 7116 return err 7117 } 7118 7119 case "lambdaConfig": 7120 if err := awsRestjson1_deserializeDocumentLambdaDataSourceConfig(&sv.LambdaConfig, value); err != nil { 7121 return err 7122 } 7123 7124 case "name": 7125 if value != nil { 7126 jtv, ok := value.(string) 7127 if !ok { 7128 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7129 } 7130 sv.Name = ptr.String(jtv) 7131 } 7132 7133 case "relationalDatabaseConfig": 7134 if err := awsRestjson1_deserializeDocumentRelationalDatabaseDataSourceConfig(&sv.RelationalDatabaseConfig, value); err != nil { 7135 return err 7136 } 7137 7138 case "serviceRoleArn": 7139 if value != nil { 7140 jtv, ok := value.(string) 7141 if !ok { 7142 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7143 } 7144 sv.ServiceRoleArn = ptr.String(jtv) 7145 } 7146 7147 case "type": 7148 if value != nil { 7149 jtv, ok := value.(string) 7150 if !ok { 7151 return fmt.Errorf("expected DataSourceType to be of type string, got %T instead", value) 7152 } 7153 sv.Type = types.DataSourceType(jtv) 7154 } 7155 7156 default: 7157 _, _ = key, value 7158 7159 } 7160 } 7161 *v = sv 7162 return nil 7163} 7164 7165func awsRestjson1_deserializeDocumentDataSources(v *[]types.DataSource, value interface{}) error { 7166 if v == nil { 7167 return fmt.Errorf("unexpected nil of type %T", v) 7168 } 7169 if value == nil { 7170 return nil 7171 } 7172 7173 shape, ok := value.([]interface{}) 7174 if !ok { 7175 return fmt.Errorf("unexpected JSON type %v", value) 7176 } 7177 7178 var cv []types.DataSource 7179 if *v == nil { 7180 cv = []types.DataSource{} 7181 } else { 7182 cv = *v 7183 } 7184 7185 for _, value := range shape { 7186 var col types.DataSource 7187 destAddr := &col 7188 if err := awsRestjson1_deserializeDocumentDataSource(&destAddr, value); err != nil { 7189 return err 7190 } 7191 col = *destAddr 7192 cv = append(cv, col) 7193 7194 } 7195 *v = cv 7196 return nil 7197} 7198 7199func awsRestjson1_deserializeDocumentDeltaSyncConfig(v **types.DeltaSyncConfig, value interface{}) error { 7200 if v == nil { 7201 return fmt.Errorf("unexpected nil of type %T", v) 7202 } 7203 if value == nil { 7204 return nil 7205 } 7206 7207 shape, ok := value.(map[string]interface{}) 7208 if !ok { 7209 return fmt.Errorf("unexpected JSON type %v", value) 7210 } 7211 7212 var sv *types.DeltaSyncConfig 7213 if *v == nil { 7214 sv = &types.DeltaSyncConfig{} 7215 } else { 7216 sv = *v 7217 } 7218 7219 for key, value := range shape { 7220 switch key { 7221 case "baseTableTTL": 7222 if value != nil { 7223 jtv, ok := value.(json.Number) 7224 if !ok { 7225 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 7226 } 7227 i64, err := jtv.Int64() 7228 if err != nil { 7229 return err 7230 } 7231 sv.BaseTableTTL = i64 7232 } 7233 7234 case "deltaSyncTableName": 7235 if value != nil { 7236 jtv, ok := value.(string) 7237 if !ok { 7238 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7239 } 7240 sv.DeltaSyncTableName = ptr.String(jtv) 7241 } 7242 7243 case "deltaSyncTableTTL": 7244 if value != nil { 7245 jtv, ok := value.(json.Number) 7246 if !ok { 7247 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 7248 } 7249 i64, err := jtv.Int64() 7250 if err != nil { 7251 return err 7252 } 7253 sv.DeltaSyncTableTTL = i64 7254 } 7255 7256 default: 7257 _, _ = key, value 7258 7259 } 7260 } 7261 *v = sv 7262 return nil 7263} 7264 7265func awsRestjson1_deserializeDocumentDynamodbDataSourceConfig(v **types.DynamodbDataSourceConfig, value interface{}) error { 7266 if v == nil { 7267 return fmt.Errorf("unexpected nil of type %T", v) 7268 } 7269 if value == nil { 7270 return nil 7271 } 7272 7273 shape, ok := value.(map[string]interface{}) 7274 if !ok { 7275 return fmt.Errorf("unexpected JSON type %v", value) 7276 } 7277 7278 var sv *types.DynamodbDataSourceConfig 7279 if *v == nil { 7280 sv = &types.DynamodbDataSourceConfig{} 7281 } else { 7282 sv = *v 7283 } 7284 7285 for key, value := range shape { 7286 switch key { 7287 case "awsRegion": 7288 if value != nil { 7289 jtv, ok := value.(string) 7290 if !ok { 7291 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7292 } 7293 sv.AwsRegion = ptr.String(jtv) 7294 } 7295 7296 case "deltaSyncConfig": 7297 if err := awsRestjson1_deserializeDocumentDeltaSyncConfig(&sv.DeltaSyncConfig, value); err != nil { 7298 return err 7299 } 7300 7301 case "tableName": 7302 if value != nil { 7303 jtv, ok := value.(string) 7304 if !ok { 7305 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7306 } 7307 sv.TableName = ptr.String(jtv) 7308 } 7309 7310 case "useCallerCredentials": 7311 if value != nil { 7312 jtv, ok := value.(bool) 7313 if !ok { 7314 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 7315 } 7316 sv.UseCallerCredentials = jtv 7317 } 7318 7319 case "versioned": 7320 if value != nil { 7321 jtv, ok := value.(bool) 7322 if !ok { 7323 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 7324 } 7325 sv.Versioned = jtv 7326 } 7327 7328 default: 7329 _, _ = key, value 7330 7331 } 7332 } 7333 *v = sv 7334 return nil 7335} 7336 7337func awsRestjson1_deserializeDocumentElasticsearchDataSourceConfig(v **types.ElasticsearchDataSourceConfig, value interface{}) error { 7338 if v == nil { 7339 return fmt.Errorf("unexpected nil of type %T", v) 7340 } 7341 if value == nil { 7342 return nil 7343 } 7344 7345 shape, ok := value.(map[string]interface{}) 7346 if !ok { 7347 return fmt.Errorf("unexpected JSON type %v", value) 7348 } 7349 7350 var sv *types.ElasticsearchDataSourceConfig 7351 if *v == nil { 7352 sv = &types.ElasticsearchDataSourceConfig{} 7353 } else { 7354 sv = *v 7355 } 7356 7357 for key, value := range shape { 7358 switch key { 7359 case "awsRegion": 7360 if value != nil { 7361 jtv, ok := value.(string) 7362 if !ok { 7363 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7364 } 7365 sv.AwsRegion = ptr.String(jtv) 7366 } 7367 7368 case "endpoint": 7369 if value != nil { 7370 jtv, ok := value.(string) 7371 if !ok { 7372 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7373 } 7374 sv.Endpoint = ptr.String(jtv) 7375 } 7376 7377 default: 7378 _, _ = key, value 7379 7380 } 7381 } 7382 *v = sv 7383 return nil 7384} 7385 7386func awsRestjson1_deserializeDocumentFunctionConfiguration(v **types.FunctionConfiguration, value interface{}) error { 7387 if v == nil { 7388 return fmt.Errorf("unexpected nil of type %T", v) 7389 } 7390 if value == nil { 7391 return nil 7392 } 7393 7394 shape, ok := value.(map[string]interface{}) 7395 if !ok { 7396 return fmt.Errorf("unexpected JSON type %v", value) 7397 } 7398 7399 var sv *types.FunctionConfiguration 7400 if *v == nil { 7401 sv = &types.FunctionConfiguration{} 7402 } else { 7403 sv = *v 7404 } 7405 7406 for key, value := range shape { 7407 switch key { 7408 case "dataSourceName": 7409 if value != nil { 7410 jtv, ok := value.(string) 7411 if !ok { 7412 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7413 } 7414 sv.DataSourceName = ptr.String(jtv) 7415 } 7416 7417 case "description": 7418 if value != nil { 7419 jtv, ok := value.(string) 7420 if !ok { 7421 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7422 } 7423 sv.Description = ptr.String(jtv) 7424 } 7425 7426 case "functionArn": 7427 if value != nil { 7428 jtv, ok := value.(string) 7429 if !ok { 7430 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7431 } 7432 sv.FunctionArn = ptr.String(jtv) 7433 } 7434 7435 case "functionId": 7436 if value != nil { 7437 jtv, ok := value.(string) 7438 if !ok { 7439 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7440 } 7441 sv.FunctionId = ptr.String(jtv) 7442 } 7443 7444 case "functionVersion": 7445 if value != nil { 7446 jtv, ok := value.(string) 7447 if !ok { 7448 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7449 } 7450 sv.FunctionVersion = ptr.String(jtv) 7451 } 7452 7453 case "name": 7454 if value != nil { 7455 jtv, ok := value.(string) 7456 if !ok { 7457 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7458 } 7459 sv.Name = ptr.String(jtv) 7460 } 7461 7462 case "requestMappingTemplate": 7463 if value != nil { 7464 jtv, ok := value.(string) 7465 if !ok { 7466 return fmt.Errorf("expected MappingTemplate to be of type string, got %T instead", value) 7467 } 7468 sv.RequestMappingTemplate = ptr.String(jtv) 7469 } 7470 7471 case "responseMappingTemplate": 7472 if value != nil { 7473 jtv, ok := value.(string) 7474 if !ok { 7475 return fmt.Errorf("expected MappingTemplate to be of type string, got %T instead", value) 7476 } 7477 sv.ResponseMappingTemplate = ptr.String(jtv) 7478 } 7479 7480 case "syncConfig": 7481 if err := awsRestjson1_deserializeDocumentSyncConfig(&sv.SyncConfig, value); err != nil { 7482 return err 7483 } 7484 7485 default: 7486 _, _ = key, value 7487 7488 } 7489 } 7490 *v = sv 7491 return nil 7492} 7493 7494func awsRestjson1_deserializeDocumentFunctions(v *[]types.FunctionConfiguration, value interface{}) error { 7495 if v == nil { 7496 return fmt.Errorf("unexpected nil of type %T", v) 7497 } 7498 if value == nil { 7499 return nil 7500 } 7501 7502 shape, ok := value.([]interface{}) 7503 if !ok { 7504 return fmt.Errorf("unexpected JSON type %v", value) 7505 } 7506 7507 var cv []types.FunctionConfiguration 7508 if *v == nil { 7509 cv = []types.FunctionConfiguration{} 7510 } else { 7511 cv = *v 7512 } 7513 7514 for _, value := range shape { 7515 var col types.FunctionConfiguration 7516 destAddr := &col 7517 if err := awsRestjson1_deserializeDocumentFunctionConfiguration(&destAddr, value); err != nil { 7518 return err 7519 } 7520 col = *destAddr 7521 cv = append(cv, col) 7522 7523 } 7524 *v = cv 7525 return nil 7526} 7527 7528func awsRestjson1_deserializeDocumentFunctionsIds(v *[]string, 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.([]interface{}) 7537 if !ok { 7538 return fmt.Errorf("unexpected JSON type %v", value) 7539 } 7540 7541 var cv []string 7542 if *v == nil { 7543 cv = []string{} 7544 } else { 7545 cv = *v 7546 } 7547 7548 for _, value := range shape { 7549 var col string 7550 if value != nil { 7551 jtv, ok := value.(string) 7552 if !ok { 7553 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7554 } 7555 col = jtv 7556 } 7557 cv = append(cv, col) 7558 7559 } 7560 *v = cv 7561 return nil 7562} 7563 7564func awsRestjson1_deserializeDocumentGraphqlApi(v **types.GraphqlApi, value interface{}) error { 7565 if v == nil { 7566 return fmt.Errorf("unexpected nil of type %T", v) 7567 } 7568 if value == nil { 7569 return nil 7570 } 7571 7572 shape, ok := value.(map[string]interface{}) 7573 if !ok { 7574 return fmt.Errorf("unexpected JSON type %v", value) 7575 } 7576 7577 var sv *types.GraphqlApi 7578 if *v == nil { 7579 sv = &types.GraphqlApi{} 7580 } else { 7581 sv = *v 7582 } 7583 7584 for key, value := range shape { 7585 switch key { 7586 case "additionalAuthenticationProviders": 7587 if err := awsRestjson1_deserializeDocumentAdditionalAuthenticationProviders(&sv.AdditionalAuthenticationProviders, value); err != nil { 7588 return err 7589 } 7590 7591 case "apiId": 7592 if value != nil { 7593 jtv, ok := value.(string) 7594 if !ok { 7595 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7596 } 7597 sv.ApiId = ptr.String(jtv) 7598 } 7599 7600 case "arn": 7601 if value != nil { 7602 jtv, ok := value.(string) 7603 if !ok { 7604 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7605 } 7606 sv.Arn = ptr.String(jtv) 7607 } 7608 7609 case "authenticationType": 7610 if value != nil { 7611 jtv, ok := value.(string) 7612 if !ok { 7613 return fmt.Errorf("expected AuthenticationType to be of type string, got %T instead", value) 7614 } 7615 sv.AuthenticationType = types.AuthenticationType(jtv) 7616 } 7617 7618 case "lambdaAuthorizerConfig": 7619 if err := awsRestjson1_deserializeDocumentLambdaAuthorizerConfig(&sv.LambdaAuthorizerConfig, value); err != nil { 7620 return err 7621 } 7622 7623 case "logConfig": 7624 if err := awsRestjson1_deserializeDocumentLogConfig(&sv.LogConfig, value); err != nil { 7625 return err 7626 } 7627 7628 case "name": 7629 if value != nil { 7630 jtv, ok := value.(string) 7631 if !ok { 7632 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7633 } 7634 sv.Name = ptr.String(jtv) 7635 } 7636 7637 case "openIDConnectConfig": 7638 if err := awsRestjson1_deserializeDocumentOpenIDConnectConfig(&sv.OpenIDConnectConfig, value); err != nil { 7639 return err 7640 } 7641 7642 case "tags": 7643 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 7644 return err 7645 } 7646 7647 case "uris": 7648 if err := awsRestjson1_deserializeDocumentMapOfStringToString(&sv.Uris, value); err != nil { 7649 return err 7650 } 7651 7652 case "userPoolConfig": 7653 if err := awsRestjson1_deserializeDocumentUserPoolConfig(&sv.UserPoolConfig, value); err != nil { 7654 return err 7655 } 7656 7657 case "wafWebAclArn": 7658 if value != nil { 7659 jtv, ok := value.(string) 7660 if !ok { 7661 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7662 } 7663 sv.WafWebAclArn = ptr.String(jtv) 7664 } 7665 7666 case "xrayEnabled": 7667 if value != nil { 7668 jtv, ok := value.(bool) 7669 if !ok { 7670 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 7671 } 7672 sv.XrayEnabled = jtv 7673 } 7674 7675 default: 7676 _, _ = key, value 7677 7678 } 7679 } 7680 *v = sv 7681 return nil 7682} 7683 7684func awsRestjson1_deserializeDocumentGraphqlApis(v *[]types.GraphqlApi, value interface{}) error { 7685 if v == nil { 7686 return fmt.Errorf("unexpected nil of type %T", v) 7687 } 7688 if value == nil { 7689 return nil 7690 } 7691 7692 shape, ok := value.([]interface{}) 7693 if !ok { 7694 return fmt.Errorf("unexpected JSON type %v", value) 7695 } 7696 7697 var cv []types.GraphqlApi 7698 if *v == nil { 7699 cv = []types.GraphqlApi{} 7700 } else { 7701 cv = *v 7702 } 7703 7704 for _, value := range shape { 7705 var col types.GraphqlApi 7706 destAddr := &col 7707 if err := awsRestjson1_deserializeDocumentGraphqlApi(&destAddr, value); err != nil { 7708 return err 7709 } 7710 col = *destAddr 7711 cv = append(cv, col) 7712 7713 } 7714 *v = cv 7715 return nil 7716} 7717 7718func awsRestjson1_deserializeDocumentGraphQLSchemaException(v **types.GraphQLSchemaException, value interface{}) error { 7719 if v == nil { 7720 return fmt.Errorf("unexpected nil of type %T", v) 7721 } 7722 if value == nil { 7723 return nil 7724 } 7725 7726 shape, ok := value.(map[string]interface{}) 7727 if !ok { 7728 return fmt.Errorf("unexpected JSON type %v", value) 7729 } 7730 7731 var sv *types.GraphQLSchemaException 7732 if *v == nil { 7733 sv = &types.GraphQLSchemaException{} 7734 } else { 7735 sv = *v 7736 } 7737 7738 for key, value := range shape { 7739 switch key { 7740 case "message": 7741 if value != nil { 7742 jtv, ok := value.(string) 7743 if !ok { 7744 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 7745 } 7746 sv.Message = ptr.String(jtv) 7747 } 7748 7749 default: 7750 _, _ = key, value 7751 7752 } 7753 } 7754 *v = sv 7755 return nil 7756} 7757 7758func awsRestjson1_deserializeDocumentHttpDataSourceConfig(v **types.HttpDataSourceConfig, value interface{}) error { 7759 if v == nil { 7760 return fmt.Errorf("unexpected nil of type %T", v) 7761 } 7762 if value == nil { 7763 return nil 7764 } 7765 7766 shape, ok := value.(map[string]interface{}) 7767 if !ok { 7768 return fmt.Errorf("unexpected JSON type %v", value) 7769 } 7770 7771 var sv *types.HttpDataSourceConfig 7772 if *v == nil { 7773 sv = &types.HttpDataSourceConfig{} 7774 } else { 7775 sv = *v 7776 } 7777 7778 for key, value := range shape { 7779 switch key { 7780 case "authorizationConfig": 7781 if err := awsRestjson1_deserializeDocumentAuthorizationConfig(&sv.AuthorizationConfig, value); err != nil { 7782 return err 7783 } 7784 7785 case "endpoint": 7786 if value != nil { 7787 jtv, ok := value.(string) 7788 if !ok { 7789 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7790 } 7791 sv.Endpoint = ptr.String(jtv) 7792 } 7793 7794 default: 7795 _, _ = key, value 7796 7797 } 7798 } 7799 *v = sv 7800 return nil 7801} 7802 7803func awsRestjson1_deserializeDocumentInternalFailureException(v **types.InternalFailureException, value interface{}) error { 7804 if v == nil { 7805 return fmt.Errorf("unexpected nil of type %T", v) 7806 } 7807 if value == nil { 7808 return nil 7809 } 7810 7811 shape, ok := value.(map[string]interface{}) 7812 if !ok { 7813 return fmt.Errorf("unexpected JSON type %v", value) 7814 } 7815 7816 var sv *types.InternalFailureException 7817 if *v == nil { 7818 sv = &types.InternalFailureException{} 7819 } else { 7820 sv = *v 7821 } 7822 7823 for key, value := range shape { 7824 switch key { 7825 case "message": 7826 if value != nil { 7827 jtv, ok := value.(string) 7828 if !ok { 7829 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7830 } 7831 sv.Message = ptr.String(jtv) 7832 } 7833 7834 default: 7835 _, _ = key, value 7836 7837 } 7838 } 7839 *v = sv 7840 return nil 7841} 7842 7843func awsRestjson1_deserializeDocumentLambdaAuthorizerConfig(v **types.LambdaAuthorizerConfig, value interface{}) error { 7844 if v == nil { 7845 return fmt.Errorf("unexpected nil of type %T", v) 7846 } 7847 if value == nil { 7848 return nil 7849 } 7850 7851 shape, ok := value.(map[string]interface{}) 7852 if !ok { 7853 return fmt.Errorf("unexpected JSON type %v", value) 7854 } 7855 7856 var sv *types.LambdaAuthorizerConfig 7857 if *v == nil { 7858 sv = &types.LambdaAuthorizerConfig{} 7859 } else { 7860 sv = *v 7861 } 7862 7863 for key, value := range shape { 7864 switch key { 7865 case "authorizerResultTtlInSeconds": 7866 if value != nil { 7867 jtv, ok := value.(json.Number) 7868 if !ok { 7869 return fmt.Errorf("expected TTL to be json.Number, got %T instead", value) 7870 } 7871 i64, err := jtv.Int64() 7872 if err != nil { 7873 return err 7874 } 7875 sv.AuthorizerResultTtlInSeconds = int32(i64) 7876 } 7877 7878 case "authorizerUri": 7879 if value != nil { 7880 jtv, ok := value.(string) 7881 if !ok { 7882 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7883 } 7884 sv.AuthorizerUri = ptr.String(jtv) 7885 } 7886 7887 case "identityValidationExpression": 7888 if value != nil { 7889 jtv, ok := value.(string) 7890 if !ok { 7891 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7892 } 7893 sv.IdentityValidationExpression = ptr.String(jtv) 7894 } 7895 7896 default: 7897 _, _ = key, value 7898 7899 } 7900 } 7901 *v = sv 7902 return nil 7903} 7904 7905func awsRestjson1_deserializeDocumentLambdaConflictHandlerConfig(v **types.LambdaConflictHandlerConfig, value interface{}) error { 7906 if v == nil { 7907 return fmt.Errorf("unexpected nil of type %T", v) 7908 } 7909 if value == nil { 7910 return nil 7911 } 7912 7913 shape, ok := value.(map[string]interface{}) 7914 if !ok { 7915 return fmt.Errorf("unexpected JSON type %v", value) 7916 } 7917 7918 var sv *types.LambdaConflictHandlerConfig 7919 if *v == nil { 7920 sv = &types.LambdaConflictHandlerConfig{} 7921 } else { 7922 sv = *v 7923 } 7924 7925 for key, value := range shape { 7926 switch key { 7927 case "lambdaConflictHandlerArn": 7928 if value != nil { 7929 jtv, ok := value.(string) 7930 if !ok { 7931 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7932 } 7933 sv.LambdaConflictHandlerArn = ptr.String(jtv) 7934 } 7935 7936 default: 7937 _, _ = key, value 7938 7939 } 7940 } 7941 *v = sv 7942 return nil 7943} 7944 7945func awsRestjson1_deserializeDocumentLambdaDataSourceConfig(v **types.LambdaDataSourceConfig, value interface{}) error { 7946 if v == nil { 7947 return fmt.Errorf("unexpected nil of type %T", v) 7948 } 7949 if value == nil { 7950 return nil 7951 } 7952 7953 shape, ok := value.(map[string]interface{}) 7954 if !ok { 7955 return fmt.Errorf("unexpected JSON type %v", value) 7956 } 7957 7958 var sv *types.LambdaDataSourceConfig 7959 if *v == nil { 7960 sv = &types.LambdaDataSourceConfig{} 7961 } else { 7962 sv = *v 7963 } 7964 7965 for key, value := range shape { 7966 switch key { 7967 case "lambdaFunctionArn": 7968 if value != nil { 7969 jtv, ok := value.(string) 7970 if !ok { 7971 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7972 } 7973 sv.LambdaFunctionArn = ptr.String(jtv) 7974 } 7975 7976 default: 7977 _, _ = key, value 7978 7979 } 7980 } 7981 *v = sv 7982 return nil 7983} 7984 7985func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 7986 if v == nil { 7987 return fmt.Errorf("unexpected nil of type %T", v) 7988 } 7989 if value == nil { 7990 return nil 7991 } 7992 7993 shape, ok := value.(map[string]interface{}) 7994 if !ok { 7995 return fmt.Errorf("unexpected JSON type %v", value) 7996 } 7997 7998 var sv *types.LimitExceededException 7999 if *v == nil { 8000 sv = &types.LimitExceededException{} 8001 } else { 8002 sv = *v 8003 } 8004 8005 for key, value := range shape { 8006 switch key { 8007 case "message": 8008 if value != nil { 8009 jtv, ok := value.(string) 8010 if !ok { 8011 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8012 } 8013 sv.Message = ptr.String(jtv) 8014 } 8015 8016 default: 8017 _, _ = key, value 8018 8019 } 8020 } 8021 *v = sv 8022 return nil 8023} 8024 8025func awsRestjson1_deserializeDocumentLogConfig(v **types.LogConfig, value interface{}) error { 8026 if v == nil { 8027 return fmt.Errorf("unexpected nil of type %T", v) 8028 } 8029 if value == nil { 8030 return nil 8031 } 8032 8033 shape, ok := value.(map[string]interface{}) 8034 if !ok { 8035 return fmt.Errorf("unexpected JSON type %v", value) 8036 } 8037 8038 var sv *types.LogConfig 8039 if *v == nil { 8040 sv = &types.LogConfig{} 8041 } else { 8042 sv = *v 8043 } 8044 8045 for key, value := range shape { 8046 switch key { 8047 case "cloudWatchLogsRoleArn": 8048 if value != nil { 8049 jtv, ok := value.(string) 8050 if !ok { 8051 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8052 } 8053 sv.CloudWatchLogsRoleArn = ptr.String(jtv) 8054 } 8055 8056 case "excludeVerboseContent": 8057 if value != nil { 8058 jtv, ok := value.(bool) 8059 if !ok { 8060 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 8061 } 8062 sv.ExcludeVerboseContent = jtv 8063 } 8064 8065 case "fieldLogLevel": 8066 if value != nil { 8067 jtv, ok := value.(string) 8068 if !ok { 8069 return fmt.Errorf("expected FieldLogLevel to be of type string, got %T instead", value) 8070 } 8071 sv.FieldLogLevel = types.FieldLogLevel(jtv) 8072 } 8073 8074 default: 8075 _, _ = key, value 8076 8077 } 8078 } 8079 *v = sv 8080 return nil 8081} 8082 8083func awsRestjson1_deserializeDocumentMapOfStringToString(v *map[string]string, value interface{}) error { 8084 if v == nil { 8085 return fmt.Errorf("unexpected nil of type %T", v) 8086 } 8087 if value == nil { 8088 return nil 8089 } 8090 8091 shape, ok := value.(map[string]interface{}) 8092 if !ok { 8093 return fmt.Errorf("unexpected JSON type %v", value) 8094 } 8095 8096 var mv map[string]string 8097 if *v == nil { 8098 mv = map[string]string{} 8099 } else { 8100 mv = *v 8101 } 8102 8103 for key, value := range shape { 8104 var parsedVal string 8105 if value != nil { 8106 jtv, ok := value.(string) 8107 if !ok { 8108 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8109 } 8110 parsedVal = jtv 8111 } 8112 mv[key] = parsedVal 8113 8114 } 8115 *v = mv 8116 return nil 8117} 8118 8119func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 8120 if v == nil { 8121 return fmt.Errorf("unexpected nil of type %T", v) 8122 } 8123 if value == nil { 8124 return nil 8125 } 8126 8127 shape, ok := value.(map[string]interface{}) 8128 if !ok { 8129 return fmt.Errorf("unexpected JSON type %v", value) 8130 } 8131 8132 var sv *types.NotFoundException 8133 if *v == nil { 8134 sv = &types.NotFoundException{} 8135 } else { 8136 sv = *v 8137 } 8138 8139 for key, value := range shape { 8140 switch key { 8141 case "message": 8142 if value != nil { 8143 jtv, ok := value.(string) 8144 if !ok { 8145 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8146 } 8147 sv.Message = ptr.String(jtv) 8148 } 8149 8150 default: 8151 _, _ = key, value 8152 8153 } 8154 } 8155 *v = sv 8156 return nil 8157} 8158 8159func awsRestjson1_deserializeDocumentOpenIDConnectConfig(v **types.OpenIDConnectConfig, value interface{}) error { 8160 if v == nil { 8161 return fmt.Errorf("unexpected nil of type %T", v) 8162 } 8163 if value == nil { 8164 return nil 8165 } 8166 8167 shape, ok := value.(map[string]interface{}) 8168 if !ok { 8169 return fmt.Errorf("unexpected JSON type %v", value) 8170 } 8171 8172 var sv *types.OpenIDConnectConfig 8173 if *v == nil { 8174 sv = &types.OpenIDConnectConfig{} 8175 } else { 8176 sv = *v 8177 } 8178 8179 for key, value := range shape { 8180 switch key { 8181 case "authTTL": 8182 if value != nil { 8183 jtv, ok := value.(json.Number) 8184 if !ok { 8185 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 8186 } 8187 i64, err := jtv.Int64() 8188 if err != nil { 8189 return err 8190 } 8191 sv.AuthTTL = i64 8192 } 8193 8194 case "clientId": 8195 if value != nil { 8196 jtv, ok := value.(string) 8197 if !ok { 8198 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8199 } 8200 sv.ClientId = ptr.String(jtv) 8201 } 8202 8203 case "iatTTL": 8204 if value != nil { 8205 jtv, ok := value.(json.Number) 8206 if !ok { 8207 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 8208 } 8209 i64, err := jtv.Int64() 8210 if err != nil { 8211 return err 8212 } 8213 sv.IatTTL = i64 8214 } 8215 8216 case "issuer": 8217 if value != nil { 8218 jtv, ok := value.(string) 8219 if !ok { 8220 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8221 } 8222 sv.Issuer = ptr.String(jtv) 8223 } 8224 8225 default: 8226 _, _ = key, value 8227 8228 } 8229 } 8230 *v = sv 8231 return nil 8232} 8233 8234func awsRestjson1_deserializeDocumentPipelineConfig(v **types.PipelineConfig, value interface{}) error { 8235 if v == nil { 8236 return fmt.Errorf("unexpected nil of type %T", v) 8237 } 8238 if value == nil { 8239 return nil 8240 } 8241 8242 shape, ok := value.(map[string]interface{}) 8243 if !ok { 8244 return fmt.Errorf("unexpected JSON type %v", value) 8245 } 8246 8247 var sv *types.PipelineConfig 8248 if *v == nil { 8249 sv = &types.PipelineConfig{} 8250 } else { 8251 sv = *v 8252 } 8253 8254 for key, value := range shape { 8255 switch key { 8256 case "functions": 8257 if err := awsRestjson1_deserializeDocumentFunctionsIds(&sv.Functions, value); err != nil { 8258 return err 8259 } 8260 8261 default: 8262 _, _ = key, value 8263 8264 } 8265 } 8266 *v = sv 8267 return nil 8268} 8269 8270func awsRestjson1_deserializeDocumentRdsHttpEndpointConfig(v **types.RdsHttpEndpointConfig, value interface{}) error { 8271 if v == nil { 8272 return fmt.Errorf("unexpected nil of type %T", v) 8273 } 8274 if value == nil { 8275 return nil 8276 } 8277 8278 shape, ok := value.(map[string]interface{}) 8279 if !ok { 8280 return fmt.Errorf("unexpected JSON type %v", value) 8281 } 8282 8283 var sv *types.RdsHttpEndpointConfig 8284 if *v == nil { 8285 sv = &types.RdsHttpEndpointConfig{} 8286 } else { 8287 sv = *v 8288 } 8289 8290 for key, value := range shape { 8291 switch key { 8292 case "awsRegion": 8293 if value != nil { 8294 jtv, ok := value.(string) 8295 if !ok { 8296 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8297 } 8298 sv.AwsRegion = ptr.String(jtv) 8299 } 8300 8301 case "awsSecretStoreArn": 8302 if value != nil { 8303 jtv, ok := value.(string) 8304 if !ok { 8305 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8306 } 8307 sv.AwsSecretStoreArn = ptr.String(jtv) 8308 } 8309 8310 case "databaseName": 8311 if value != nil { 8312 jtv, ok := value.(string) 8313 if !ok { 8314 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8315 } 8316 sv.DatabaseName = ptr.String(jtv) 8317 } 8318 8319 case "dbClusterIdentifier": 8320 if value != nil { 8321 jtv, ok := value.(string) 8322 if !ok { 8323 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8324 } 8325 sv.DbClusterIdentifier = ptr.String(jtv) 8326 } 8327 8328 case "schema": 8329 if value != nil { 8330 jtv, ok := value.(string) 8331 if !ok { 8332 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8333 } 8334 sv.Schema = ptr.String(jtv) 8335 } 8336 8337 default: 8338 _, _ = key, value 8339 8340 } 8341 } 8342 *v = sv 8343 return nil 8344} 8345 8346func awsRestjson1_deserializeDocumentRelationalDatabaseDataSourceConfig(v **types.RelationalDatabaseDataSourceConfig, value interface{}) error { 8347 if v == nil { 8348 return fmt.Errorf("unexpected nil of type %T", v) 8349 } 8350 if value == nil { 8351 return nil 8352 } 8353 8354 shape, ok := value.(map[string]interface{}) 8355 if !ok { 8356 return fmt.Errorf("unexpected JSON type %v", value) 8357 } 8358 8359 var sv *types.RelationalDatabaseDataSourceConfig 8360 if *v == nil { 8361 sv = &types.RelationalDatabaseDataSourceConfig{} 8362 } else { 8363 sv = *v 8364 } 8365 8366 for key, value := range shape { 8367 switch key { 8368 case "rdsHttpEndpointConfig": 8369 if err := awsRestjson1_deserializeDocumentRdsHttpEndpointConfig(&sv.RdsHttpEndpointConfig, value); err != nil { 8370 return err 8371 } 8372 8373 case "relationalDatabaseSourceType": 8374 if value != nil { 8375 jtv, ok := value.(string) 8376 if !ok { 8377 return fmt.Errorf("expected RelationalDatabaseSourceType to be of type string, got %T instead", value) 8378 } 8379 sv.RelationalDatabaseSourceType = types.RelationalDatabaseSourceType(jtv) 8380 } 8381 8382 default: 8383 _, _ = key, value 8384 8385 } 8386 } 8387 *v = sv 8388 return nil 8389} 8390 8391func awsRestjson1_deserializeDocumentResolver(v **types.Resolver, value interface{}) error { 8392 if v == nil { 8393 return fmt.Errorf("unexpected nil of type %T", v) 8394 } 8395 if value == nil { 8396 return nil 8397 } 8398 8399 shape, ok := value.(map[string]interface{}) 8400 if !ok { 8401 return fmt.Errorf("unexpected JSON type %v", value) 8402 } 8403 8404 var sv *types.Resolver 8405 if *v == nil { 8406 sv = &types.Resolver{} 8407 } else { 8408 sv = *v 8409 } 8410 8411 for key, value := range shape { 8412 switch key { 8413 case "cachingConfig": 8414 if err := awsRestjson1_deserializeDocumentCachingConfig(&sv.CachingConfig, value); err != nil { 8415 return err 8416 } 8417 8418 case "dataSourceName": 8419 if value != nil { 8420 jtv, ok := value.(string) 8421 if !ok { 8422 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 8423 } 8424 sv.DataSourceName = ptr.String(jtv) 8425 } 8426 8427 case "fieldName": 8428 if value != nil { 8429 jtv, ok := value.(string) 8430 if !ok { 8431 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 8432 } 8433 sv.FieldName = ptr.String(jtv) 8434 } 8435 8436 case "kind": 8437 if value != nil { 8438 jtv, ok := value.(string) 8439 if !ok { 8440 return fmt.Errorf("expected ResolverKind to be of type string, got %T instead", value) 8441 } 8442 sv.Kind = types.ResolverKind(jtv) 8443 } 8444 8445 case "pipelineConfig": 8446 if err := awsRestjson1_deserializeDocumentPipelineConfig(&sv.PipelineConfig, value); err != nil { 8447 return err 8448 } 8449 8450 case "requestMappingTemplate": 8451 if value != nil { 8452 jtv, ok := value.(string) 8453 if !ok { 8454 return fmt.Errorf("expected MappingTemplate to be of type string, got %T instead", value) 8455 } 8456 sv.RequestMappingTemplate = ptr.String(jtv) 8457 } 8458 8459 case "resolverArn": 8460 if value != nil { 8461 jtv, ok := value.(string) 8462 if !ok { 8463 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8464 } 8465 sv.ResolverArn = ptr.String(jtv) 8466 } 8467 8468 case "responseMappingTemplate": 8469 if value != nil { 8470 jtv, ok := value.(string) 8471 if !ok { 8472 return fmt.Errorf("expected MappingTemplate to be of type string, got %T instead", value) 8473 } 8474 sv.ResponseMappingTemplate = ptr.String(jtv) 8475 } 8476 8477 case "syncConfig": 8478 if err := awsRestjson1_deserializeDocumentSyncConfig(&sv.SyncConfig, value); err != nil { 8479 return err 8480 } 8481 8482 case "typeName": 8483 if value != nil { 8484 jtv, ok := value.(string) 8485 if !ok { 8486 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 8487 } 8488 sv.TypeName = ptr.String(jtv) 8489 } 8490 8491 default: 8492 _, _ = key, value 8493 8494 } 8495 } 8496 *v = sv 8497 return nil 8498} 8499 8500func awsRestjson1_deserializeDocumentResolvers(v *[]types.Resolver, value interface{}) error { 8501 if v == nil { 8502 return fmt.Errorf("unexpected nil of type %T", v) 8503 } 8504 if value == nil { 8505 return nil 8506 } 8507 8508 shape, ok := value.([]interface{}) 8509 if !ok { 8510 return fmt.Errorf("unexpected JSON type %v", value) 8511 } 8512 8513 var cv []types.Resolver 8514 if *v == nil { 8515 cv = []types.Resolver{} 8516 } else { 8517 cv = *v 8518 } 8519 8520 for _, value := range shape { 8521 var col types.Resolver 8522 destAddr := &col 8523 if err := awsRestjson1_deserializeDocumentResolver(&destAddr, value); err != nil { 8524 return err 8525 } 8526 col = *destAddr 8527 cv = append(cv, col) 8528 8529 } 8530 *v = cv 8531 return nil 8532} 8533 8534func awsRestjson1_deserializeDocumentSyncConfig(v **types.SyncConfig, value interface{}) error { 8535 if v == nil { 8536 return fmt.Errorf("unexpected nil of type %T", v) 8537 } 8538 if value == nil { 8539 return nil 8540 } 8541 8542 shape, ok := value.(map[string]interface{}) 8543 if !ok { 8544 return fmt.Errorf("unexpected JSON type %v", value) 8545 } 8546 8547 var sv *types.SyncConfig 8548 if *v == nil { 8549 sv = &types.SyncConfig{} 8550 } else { 8551 sv = *v 8552 } 8553 8554 for key, value := range shape { 8555 switch key { 8556 case "conflictDetection": 8557 if value != nil { 8558 jtv, ok := value.(string) 8559 if !ok { 8560 return fmt.Errorf("expected ConflictDetectionType to be of type string, got %T instead", value) 8561 } 8562 sv.ConflictDetection = types.ConflictDetectionType(jtv) 8563 } 8564 8565 case "conflictHandler": 8566 if value != nil { 8567 jtv, ok := value.(string) 8568 if !ok { 8569 return fmt.Errorf("expected ConflictHandlerType to be of type string, got %T instead", value) 8570 } 8571 sv.ConflictHandler = types.ConflictHandlerType(jtv) 8572 } 8573 8574 case "lambdaConflictHandlerConfig": 8575 if err := awsRestjson1_deserializeDocumentLambdaConflictHandlerConfig(&sv.LambdaConflictHandlerConfig, value); err != nil { 8576 return err 8577 } 8578 8579 default: 8580 _, _ = key, value 8581 8582 } 8583 } 8584 *v = sv 8585 return nil 8586} 8587 8588func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { 8589 if v == nil { 8590 return fmt.Errorf("unexpected nil of type %T", v) 8591 } 8592 if value == nil { 8593 return nil 8594 } 8595 8596 shape, ok := value.(map[string]interface{}) 8597 if !ok { 8598 return fmt.Errorf("unexpected JSON type %v", value) 8599 } 8600 8601 var mv map[string]string 8602 if *v == nil { 8603 mv = map[string]string{} 8604 } else { 8605 mv = *v 8606 } 8607 8608 for key, value := range shape { 8609 var parsedVal string 8610 if value != nil { 8611 jtv, ok := value.(string) 8612 if !ok { 8613 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 8614 } 8615 parsedVal = jtv 8616 } 8617 mv[key] = parsedVal 8618 8619 } 8620 *v = mv 8621 return nil 8622} 8623 8624func awsRestjson1_deserializeDocumentType(v **types.Type, value interface{}) error { 8625 if v == nil { 8626 return fmt.Errorf("unexpected nil of type %T", v) 8627 } 8628 if value == nil { 8629 return nil 8630 } 8631 8632 shape, ok := value.(map[string]interface{}) 8633 if !ok { 8634 return fmt.Errorf("unexpected JSON type %v", value) 8635 } 8636 8637 var sv *types.Type 8638 if *v == nil { 8639 sv = &types.Type{} 8640 } else { 8641 sv = *v 8642 } 8643 8644 for key, value := range shape { 8645 switch key { 8646 case "arn": 8647 if value != nil { 8648 jtv, ok := value.(string) 8649 if !ok { 8650 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8651 } 8652 sv.Arn = ptr.String(jtv) 8653 } 8654 8655 case "definition": 8656 if value != nil { 8657 jtv, ok := value.(string) 8658 if !ok { 8659 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8660 } 8661 sv.Definition = ptr.String(jtv) 8662 } 8663 8664 case "description": 8665 if value != nil { 8666 jtv, ok := value.(string) 8667 if !ok { 8668 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8669 } 8670 sv.Description = ptr.String(jtv) 8671 } 8672 8673 case "format": 8674 if value != nil { 8675 jtv, ok := value.(string) 8676 if !ok { 8677 return fmt.Errorf("expected TypeDefinitionFormat to be of type string, got %T instead", value) 8678 } 8679 sv.Format = types.TypeDefinitionFormat(jtv) 8680 } 8681 8682 case "name": 8683 if value != nil { 8684 jtv, ok := value.(string) 8685 if !ok { 8686 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 8687 } 8688 sv.Name = ptr.String(jtv) 8689 } 8690 8691 default: 8692 _, _ = key, value 8693 8694 } 8695 } 8696 *v = sv 8697 return nil 8698} 8699 8700func awsRestjson1_deserializeDocumentTypeList(v *[]types.Type, 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.([]interface{}) 8709 if !ok { 8710 return fmt.Errorf("unexpected JSON type %v", value) 8711 } 8712 8713 var cv []types.Type 8714 if *v == nil { 8715 cv = []types.Type{} 8716 } else { 8717 cv = *v 8718 } 8719 8720 for _, value := range shape { 8721 var col types.Type 8722 destAddr := &col 8723 if err := awsRestjson1_deserializeDocumentType(&destAddr, value); err != nil { 8724 return err 8725 } 8726 col = *destAddr 8727 cv = append(cv, col) 8728 8729 } 8730 *v = cv 8731 return nil 8732} 8733 8734func awsRestjson1_deserializeDocumentUnauthorizedException(v **types.UnauthorizedException, value interface{}) error { 8735 if v == nil { 8736 return fmt.Errorf("unexpected nil of type %T", v) 8737 } 8738 if value == nil { 8739 return nil 8740 } 8741 8742 shape, ok := value.(map[string]interface{}) 8743 if !ok { 8744 return fmt.Errorf("unexpected JSON type %v", value) 8745 } 8746 8747 var sv *types.UnauthorizedException 8748 if *v == nil { 8749 sv = &types.UnauthorizedException{} 8750 } else { 8751 sv = *v 8752 } 8753 8754 for key, value := range shape { 8755 switch key { 8756 case "message": 8757 if value != nil { 8758 jtv, ok := value.(string) 8759 if !ok { 8760 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8761 } 8762 sv.Message = ptr.String(jtv) 8763 } 8764 8765 default: 8766 _, _ = key, value 8767 8768 } 8769 } 8770 *v = sv 8771 return nil 8772} 8773 8774func awsRestjson1_deserializeDocumentUserPoolConfig(v **types.UserPoolConfig, value interface{}) error { 8775 if v == nil { 8776 return fmt.Errorf("unexpected nil of type %T", v) 8777 } 8778 if value == nil { 8779 return nil 8780 } 8781 8782 shape, ok := value.(map[string]interface{}) 8783 if !ok { 8784 return fmt.Errorf("unexpected JSON type %v", value) 8785 } 8786 8787 var sv *types.UserPoolConfig 8788 if *v == nil { 8789 sv = &types.UserPoolConfig{} 8790 } else { 8791 sv = *v 8792 } 8793 8794 for key, value := range shape { 8795 switch key { 8796 case "appIdClientRegex": 8797 if value != nil { 8798 jtv, ok := value.(string) 8799 if !ok { 8800 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8801 } 8802 sv.AppIdClientRegex = ptr.String(jtv) 8803 } 8804 8805 case "awsRegion": 8806 if value != nil { 8807 jtv, ok := value.(string) 8808 if !ok { 8809 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8810 } 8811 sv.AwsRegion = ptr.String(jtv) 8812 } 8813 8814 case "defaultAction": 8815 if value != nil { 8816 jtv, ok := value.(string) 8817 if !ok { 8818 return fmt.Errorf("expected DefaultAction to be of type string, got %T instead", value) 8819 } 8820 sv.DefaultAction = types.DefaultAction(jtv) 8821 } 8822 8823 case "userPoolId": 8824 if value != nil { 8825 jtv, ok := value.(string) 8826 if !ok { 8827 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8828 } 8829 sv.UserPoolId = ptr.String(jtv) 8830 } 8831 8832 default: 8833 _, _ = key, value 8834 8835 } 8836 } 8837 *v = sv 8838 return nil 8839} 8840