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 "openIDConnectConfig": 6372 if err := awsRestjson1_deserializeDocumentOpenIDConnectConfig(&sv.OpenIDConnectConfig, value); err != nil { 6373 return err 6374 } 6375 6376 case "userPoolConfig": 6377 if err := awsRestjson1_deserializeDocumentCognitoUserPoolConfig(&sv.UserPoolConfig, value); err != nil { 6378 return err 6379 } 6380 6381 default: 6382 _, _ = key, value 6383 6384 } 6385 } 6386 *v = sv 6387 return nil 6388} 6389 6390func awsRestjson1_deserializeDocumentAdditionalAuthenticationProviders(v *[]types.AdditionalAuthenticationProvider, value interface{}) error { 6391 if v == nil { 6392 return fmt.Errorf("unexpected nil of type %T", v) 6393 } 6394 if value == nil { 6395 return nil 6396 } 6397 6398 shape, ok := value.([]interface{}) 6399 if !ok { 6400 return fmt.Errorf("unexpected JSON type %v", value) 6401 } 6402 6403 var cv []types.AdditionalAuthenticationProvider 6404 if *v == nil { 6405 cv = []types.AdditionalAuthenticationProvider{} 6406 } else { 6407 cv = *v 6408 } 6409 6410 for _, value := range shape { 6411 var col types.AdditionalAuthenticationProvider 6412 destAddr := &col 6413 if err := awsRestjson1_deserializeDocumentAdditionalAuthenticationProvider(&destAddr, value); err != nil { 6414 return err 6415 } 6416 col = *destAddr 6417 cv = append(cv, col) 6418 6419 } 6420 *v = cv 6421 return nil 6422} 6423 6424func awsRestjson1_deserializeDocumentApiCache(v **types.ApiCache, value interface{}) error { 6425 if v == nil { 6426 return fmt.Errorf("unexpected nil of type %T", v) 6427 } 6428 if value == nil { 6429 return nil 6430 } 6431 6432 shape, ok := value.(map[string]interface{}) 6433 if !ok { 6434 return fmt.Errorf("unexpected JSON type %v", value) 6435 } 6436 6437 var sv *types.ApiCache 6438 if *v == nil { 6439 sv = &types.ApiCache{} 6440 } else { 6441 sv = *v 6442 } 6443 6444 for key, value := range shape { 6445 switch key { 6446 case "apiCachingBehavior": 6447 if value != nil { 6448 jtv, ok := value.(string) 6449 if !ok { 6450 return fmt.Errorf("expected ApiCachingBehavior to be of type string, got %T instead", value) 6451 } 6452 sv.ApiCachingBehavior = types.ApiCachingBehavior(jtv) 6453 } 6454 6455 case "atRestEncryptionEnabled": 6456 if value != nil { 6457 jtv, ok := value.(bool) 6458 if !ok { 6459 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 6460 } 6461 sv.AtRestEncryptionEnabled = jtv 6462 } 6463 6464 case "status": 6465 if value != nil { 6466 jtv, ok := value.(string) 6467 if !ok { 6468 return fmt.Errorf("expected ApiCacheStatus to be of type string, got %T instead", value) 6469 } 6470 sv.Status = types.ApiCacheStatus(jtv) 6471 } 6472 6473 case "transitEncryptionEnabled": 6474 if value != nil { 6475 jtv, ok := value.(bool) 6476 if !ok { 6477 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 6478 } 6479 sv.TransitEncryptionEnabled = jtv 6480 } 6481 6482 case "ttl": 6483 if value != nil { 6484 jtv, ok := value.(json.Number) 6485 if !ok { 6486 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 6487 } 6488 i64, err := jtv.Int64() 6489 if err != nil { 6490 return err 6491 } 6492 sv.Ttl = i64 6493 } 6494 6495 case "type": 6496 if value != nil { 6497 jtv, ok := value.(string) 6498 if !ok { 6499 return fmt.Errorf("expected ApiCacheType to be of type string, got %T instead", value) 6500 } 6501 sv.Type = types.ApiCacheType(jtv) 6502 } 6503 6504 default: 6505 _, _ = key, value 6506 6507 } 6508 } 6509 *v = sv 6510 return nil 6511} 6512 6513func awsRestjson1_deserializeDocumentApiKey(v **types.ApiKey, value interface{}) error { 6514 if v == nil { 6515 return fmt.Errorf("unexpected nil of type %T", v) 6516 } 6517 if value == nil { 6518 return nil 6519 } 6520 6521 shape, ok := value.(map[string]interface{}) 6522 if !ok { 6523 return fmt.Errorf("unexpected JSON type %v", value) 6524 } 6525 6526 var sv *types.ApiKey 6527 if *v == nil { 6528 sv = &types.ApiKey{} 6529 } else { 6530 sv = *v 6531 } 6532 6533 for key, value := range shape { 6534 switch key { 6535 case "deletes": 6536 if value != nil { 6537 jtv, ok := value.(json.Number) 6538 if !ok { 6539 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 6540 } 6541 i64, err := jtv.Int64() 6542 if err != nil { 6543 return err 6544 } 6545 sv.Deletes = i64 6546 } 6547 6548 case "description": 6549 if value != nil { 6550 jtv, ok := value.(string) 6551 if !ok { 6552 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6553 } 6554 sv.Description = ptr.String(jtv) 6555 } 6556 6557 case "expires": 6558 if value != nil { 6559 jtv, ok := value.(json.Number) 6560 if !ok { 6561 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 6562 } 6563 i64, err := jtv.Int64() 6564 if err != nil { 6565 return err 6566 } 6567 sv.Expires = i64 6568 } 6569 6570 case "id": 6571 if value != nil { 6572 jtv, ok := value.(string) 6573 if !ok { 6574 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6575 } 6576 sv.Id = ptr.String(jtv) 6577 } 6578 6579 default: 6580 _, _ = key, value 6581 6582 } 6583 } 6584 *v = sv 6585 return nil 6586} 6587 6588func awsRestjson1_deserializeDocumentApiKeyLimitExceededException(v **types.ApiKeyLimitExceededException, value interface{}) error { 6589 if v == nil { 6590 return fmt.Errorf("unexpected nil of type %T", v) 6591 } 6592 if value == nil { 6593 return nil 6594 } 6595 6596 shape, ok := value.(map[string]interface{}) 6597 if !ok { 6598 return fmt.Errorf("unexpected JSON type %v", value) 6599 } 6600 6601 var sv *types.ApiKeyLimitExceededException 6602 if *v == nil { 6603 sv = &types.ApiKeyLimitExceededException{} 6604 } else { 6605 sv = *v 6606 } 6607 6608 for key, value := range shape { 6609 switch key { 6610 case "message": 6611 if value != nil { 6612 jtv, ok := value.(string) 6613 if !ok { 6614 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6615 } 6616 sv.Message = ptr.String(jtv) 6617 } 6618 6619 default: 6620 _, _ = key, value 6621 6622 } 6623 } 6624 *v = sv 6625 return nil 6626} 6627 6628func awsRestjson1_deserializeDocumentApiKeys(v *[]types.ApiKey, value interface{}) error { 6629 if v == nil { 6630 return fmt.Errorf("unexpected nil of type %T", v) 6631 } 6632 if value == nil { 6633 return nil 6634 } 6635 6636 shape, ok := value.([]interface{}) 6637 if !ok { 6638 return fmt.Errorf("unexpected JSON type %v", value) 6639 } 6640 6641 var cv []types.ApiKey 6642 if *v == nil { 6643 cv = []types.ApiKey{} 6644 } else { 6645 cv = *v 6646 } 6647 6648 for _, value := range shape { 6649 var col types.ApiKey 6650 destAddr := &col 6651 if err := awsRestjson1_deserializeDocumentApiKey(&destAddr, value); err != nil { 6652 return err 6653 } 6654 col = *destAddr 6655 cv = append(cv, col) 6656 6657 } 6658 *v = cv 6659 return nil 6660} 6661 6662func awsRestjson1_deserializeDocumentApiKeyValidityOutOfBoundsException(v **types.ApiKeyValidityOutOfBoundsException, value interface{}) error { 6663 if v == nil { 6664 return fmt.Errorf("unexpected nil of type %T", v) 6665 } 6666 if value == nil { 6667 return nil 6668 } 6669 6670 shape, ok := value.(map[string]interface{}) 6671 if !ok { 6672 return fmt.Errorf("unexpected JSON type %v", value) 6673 } 6674 6675 var sv *types.ApiKeyValidityOutOfBoundsException 6676 if *v == nil { 6677 sv = &types.ApiKeyValidityOutOfBoundsException{} 6678 } else { 6679 sv = *v 6680 } 6681 6682 for key, value := range shape { 6683 switch key { 6684 case "message": 6685 if value != nil { 6686 jtv, ok := value.(string) 6687 if !ok { 6688 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6689 } 6690 sv.Message = ptr.String(jtv) 6691 } 6692 6693 default: 6694 _, _ = key, value 6695 6696 } 6697 } 6698 *v = sv 6699 return nil 6700} 6701 6702func awsRestjson1_deserializeDocumentApiLimitExceededException(v **types.ApiLimitExceededException, value interface{}) error { 6703 if v == nil { 6704 return fmt.Errorf("unexpected nil of type %T", v) 6705 } 6706 if value == nil { 6707 return nil 6708 } 6709 6710 shape, ok := value.(map[string]interface{}) 6711 if !ok { 6712 return fmt.Errorf("unexpected JSON type %v", value) 6713 } 6714 6715 var sv *types.ApiLimitExceededException 6716 if *v == nil { 6717 sv = &types.ApiLimitExceededException{} 6718 } else { 6719 sv = *v 6720 } 6721 6722 for key, value := range shape { 6723 switch key { 6724 case "message": 6725 if value != nil { 6726 jtv, ok := value.(string) 6727 if !ok { 6728 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6729 } 6730 sv.Message = ptr.String(jtv) 6731 } 6732 6733 default: 6734 _, _ = key, value 6735 6736 } 6737 } 6738 *v = sv 6739 return nil 6740} 6741 6742func awsRestjson1_deserializeDocumentAuthorizationConfig(v **types.AuthorizationConfig, value interface{}) error { 6743 if v == nil { 6744 return fmt.Errorf("unexpected nil of type %T", v) 6745 } 6746 if value == nil { 6747 return nil 6748 } 6749 6750 shape, ok := value.(map[string]interface{}) 6751 if !ok { 6752 return fmt.Errorf("unexpected JSON type %v", value) 6753 } 6754 6755 var sv *types.AuthorizationConfig 6756 if *v == nil { 6757 sv = &types.AuthorizationConfig{} 6758 } else { 6759 sv = *v 6760 } 6761 6762 for key, value := range shape { 6763 switch key { 6764 case "authorizationType": 6765 if value != nil { 6766 jtv, ok := value.(string) 6767 if !ok { 6768 return fmt.Errorf("expected AuthorizationType to be of type string, got %T instead", value) 6769 } 6770 sv.AuthorizationType = types.AuthorizationType(jtv) 6771 } 6772 6773 case "awsIamConfig": 6774 if err := awsRestjson1_deserializeDocumentAwsIamConfig(&sv.AwsIamConfig, value); err != nil { 6775 return err 6776 } 6777 6778 default: 6779 _, _ = key, value 6780 6781 } 6782 } 6783 *v = sv 6784 return nil 6785} 6786 6787func awsRestjson1_deserializeDocumentAwsIamConfig(v **types.AwsIamConfig, value interface{}) error { 6788 if v == nil { 6789 return fmt.Errorf("unexpected nil of type %T", v) 6790 } 6791 if value == nil { 6792 return nil 6793 } 6794 6795 shape, ok := value.(map[string]interface{}) 6796 if !ok { 6797 return fmt.Errorf("unexpected JSON type %v", value) 6798 } 6799 6800 var sv *types.AwsIamConfig 6801 if *v == nil { 6802 sv = &types.AwsIamConfig{} 6803 } else { 6804 sv = *v 6805 } 6806 6807 for key, value := range shape { 6808 switch key { 6809 case "signingRegion": 6810 if value != nil { 6811 jtv, ok := value.(string) 6812 if !ok { 6813 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6814 } 6815 sv.SigningRegion = ptr.String(jtv) 6816 } 6817 6818 case "signingServiceName": 6819 if value != nil { 6820 jtv, ok := value.(string) 6821 if !ok { 6822 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6823 } 6824 sv.SigningServiceName = ptr.String(jtv) 6825 } 6826 6827 default: 6828 _, _ = key, value 6829 6830 } 6831 } 6832 *v = sv 6833 return nil 6834} 6835 6836func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 6837 if v == nil { 6838 return fmt.Errorf("unexpected nil of type %T", v) 6839 } 6840 if value == nil { 6841 return nil 6842 } 6843 6844 shape, ok := value.(map[string]interface{}) 6845 if !ok { 6846 return fmt.Errorf("unexpected JSON type %v", value) 6847 } 6848 6849 var sv *types.BadRequestException 6850 if *v == nil { 6851 sv = &types.BadRequestException{} 6852 } else { 6853 sv = *v 6854 } 6855 6856 for key, value := range shape { 6857 switch key { 6858 case "message": 6859 if value != nil { 6860 jtv, ok := value.(string) 6861 if !ok { 6862 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 6863 } 6864 sv.Message = ptr.String(jtv) 6865 } 6866 6867 default: 6868 _, _ = key, value 6869 6870 } 6871 } 6872 *v = sv 6873 return nil 6874} 6875 6876func awsRestjson1_deserializeDocumentCachingConfig(v **types.CachingConfig, value interface{}) error { 6877 if v == nil { 6878 return fmt.Errorf("unexpected nil of type %T", v) 6879 } 6880 if value == nil { 6881 return nil 6882 } 6883 6884 shape, ok := value.(map[string]interface{}) 6885 if !ok { 6886 return fmt.Errorf("unexpected JSON type %v", value) 6887 } 6888 6889 var sv *types.CachingConfig 6890 if *v == nil { 6891 sv = &types.CachingConfig{} 6892 } else { 6893 sv = *v 6894 } 6895 6896 for key, value := range shape { 6897 switch key { 6898 case "cachingKeys": 6899 if err := awsRestjson1_deserializeDocumentCachingKeys(&sv.CachingKeys, value); err != nil { 6900 return err 6901 } 6902 6903 case "ttl": 6904 if value != nil { 6905 jtv, ok := value.(json.Number) 6906 if !ok { 6907 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 6908 } 6909 i64, err := jtv.Int64() 6910 if err != nil { 6911 return err 6912 } 6913 sv.Ttl = i64 6914 } 6915 6916 default: 6917 _, _ = key, value 6918 6919 } 6920 } 6921 *v = sv 6922 return nil 6923} 6924 6925func awsRestjson1_deserializeDocumentCachingKeys(v *[]string, value interface{}) error { 6926 if v == nil { 6927 return fmt.Errorf("unexpected nil of type %T", v) 6928 } 6929 if value == nil { 6930 return nil 6931 } 6932 6933 shape, ok := value.([]interface{}) 6934 if !ok { 6935 return fmt.Errorf("unexpected JSON type %v", value) 6936 } 6937 6938 var cv []string 6939 if *v == nil { 6940 cv = []string{} 6941 } else { 6942 cv = *v 6943 } 6944 6945 for _, value := range shape { 6946 var col string 6947 if value != nil { 6948 jtv, ok := value.(string) 6949 if !ok { 6950 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6951 } 6952 col = jtv 6953 } 6954 cv = append(cv, col) 6955 6956 } 6957 *v = cv 6958 return nil 6959} 6960 6961func awsRestjson1_deserializeDocumentCognitoUserPoolConfig(v **types.CognitoUserPoolConfig, value interface{}) error { 6962 if v == nil { 6963 return fmt.Errorf("unexpected nil of type %T", v) 6964 } 6965 if value == nil { 6966 return nil 6967 } 6968 6969 shape, ok := value.(map[string]interface{}) 6970 if !ok { 6971 return fmt.Errorf("unexpected JSON type %v", value) 6972 } 6973 6974 var sv *types.CognitoUserPoolConfig 6975 if *v == nil { 6976 sv = &types.CognitoUserPoolConfig{} 6977 } else { 6978 sv = *v 6979 } 6980 6981 for key, value := range shape { 6982 switch key { 6983 case "appIdClientRegex": 6984 if value != nil { 6985 jtv, ok := value.(string) 6986 if !ok { 6987 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6988 } 6989 sv.AppIdClientRegex = ptr.String(jtv) 6990 } 6991 6992 case "awsRegion": 6993 if value != nil { 6994 jtv, ok := value.(string) 6995 if !ok { 6996 return fmt.Errorf("expected String to be of type string, got %T instead", value) 6997 } 6998 sv.AwsRegion = ptr.String(jtv) 6999 } 7000 7001 case "userPoolId": 7002 if value != nil { 7003 jtv, ok := value.(string) 7004 if !ok { 7005 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7006 } 7007 sv.UserPoolId = ptr.String(jtv) 7008 } 7009 7010 default: 7011 _, _ = key, value 7012 7013 } 7014 } 7015 *v = sv 7016 return nil 7017} 7018 7019func awsRestjson1_deserializeDocumentConcurrentModificationException(v **types.ConcurrentModificationException, value interface{}) error { 7020 if v == nil { 7021 return fmt.Errorf("unexpected nil of type %T", v) 7022 } 7023 if value == nil { 7024 return nil 7025 } 7026 7027 shape, ok := value.(map[string]interface{}) 7028 if !ok { 7029 return fmt.Errorf("unexpected JSON type %v", value) 7030 } 7031 7032 var sv *types.ConcurrentModificationException 7033 if *v == nil { 7034 sv = &types.ConcurrentModificationException{} 7035 } else { 7036 sv = *v 7037 } 7038 7039 for key, value := range shape { 7040 switch key { 7041 case "message": 7042 if value != nil { 7043 jtv, ok := value.(string) 7044 if !ok { 7045 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 7046 } 7047 sv.Message = ptr.String(jtv) 7048 } 7049 7050 default: 7051 _, _ = key, value 7052 7053 } 7054 } 7055 *v = sv 7056 return nil 7057} 7058 7059func awsRestjson1_deserializeDocumentDataSource(v **types.DataSource, value interface{}) error { 7060 if v == nil { 7061 return fmt.Errorf("unexpected nil of type %T", v) 7062 } 7063 if value == nil { 7064 return nil 7065 } 7066 7067 shape, ok := value.(map[string]interface{}) 7068 if !ok { 7069 return fmt.Errorf("unexpected JSON type %v", value) 7070 } 7071 7072 var sv *types.DataSource 7073 if *v == nil { 7074 sv = &types.DataSource{} 7075 } else { 7076 sv = *v 7077 } 7078 7079 for key, value := range shape { 7080 switch key { 7081 case "dataSourceArn": 7082 if value != nil { 7083 jtv, ok := value.(string) 7084 if !ok { 7085 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7086 } 7087 sv.DataSourceArn = ptr.String(jtv) 7088 } 7089 7090 case "description": 7091 if value != nil { 7092 jtv, ok := value.(string) 7093 if !ok { 7094 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7095 } 7096 sv.Description = ptr.String(jtv) 7097 } 7098 7099 case "dynamodbConfig": 7100 if err := awsRestjson1_deserializeDocumentDynamodbDataSourceConfig(&sv.DynamodbConfig, value); err != nil { 7101 return err 7102 } 7103 7104 case "elasticsearchConfig": 7105 if err := awsRestjson1_deserializeDocumentElasticsearchDataSourceConfig(&sv.ElasticsearchConfig, value); err != nil { 7106 return err 7107 } 7108 7109 case "httpConfig": 7110 if err := awsRestjson1_deserializeDocumentHttpDataSourceConfig(&sv.HttpConfig, value); err != nil { 7111 return err 7112 } 7113 7114 case "lambdaConfig": 7115 if err := awsRestjson1_deserializeDocumentLambdaDataSourceConfig(&sv.LambdaConfig, value); err != nil { 7116 return err 7117 } 7118 7119 case "name": 7120 if value != nil { 7121 jtv, ok := value.(string) 7122 if !ok { 7123 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7124 } 7125 sv.Name = ptr.String(jtv) 7126 } 7127 7128 case "relationalDatabaseConfig": 7129 if err := awsRestjson1_deserializeDocumentRelationalDatabaseDataSourceConfig(&sv.RelationalDatabaseConfig, value); err != nil { 7130 return err 7131 } 7132 7133 case "serviceRoleArn": 7134 if value != nil { 7135 jtv, ok := value.(string) 7136 if !ok { 7137 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7138 } 7139 sv.ServiceRoleArn = ptr.String(jtv) 7140 } 7141 7142 case "type": 7143 if value != nil { 7144 jtv, ok := value.(string) 7145 if !ok { 7146 return fmt.Errorf("expected DataSourceType to be of type string, got %T instead", value) 7147 } 7148 sv.Type = types.DataSourceType(jtv) 7149 } 7150 7151 default: 7152 _, _ = key, value 7153 7154 } 7155 } 7156 *v = sv 7157 return nil 7158} 7159 7160func awsRestjson1_deserializeDocumentDataSources(v *[]types.DataSource, value interface{}) error { 7161 if v == nil { 7162 return fmt.Errorf("unexpected nil of type %T", v) 7163 } 7164 if value == nil { 7165 return nil 7166 } 7167 7168 shape, ok := value.([]interface{}) 7169 if !ok { 7170 return fmt.Errorf("unexpected JSON type %v", value) 7171 } 7172 7173 var cv []types.DataSource 7174 if *v == nil { 7175 cv = []types.DataSource{} 7176 } else { 7177 cv = *v 7178 } 7179 7180 for _, value := range shape { 7181 var col types.DataSource 7182 destAddr := &col 7183 if err := awsRestjson1_deserializeDocumentDataSource(&destAddr, value); err != nil { 7184 return err 7185 } 7186 col = *destAddr 7187 cv = append(cv, col) 7188 7189 } 7190 *v = cv 7191 return nil 7192} 7193 7194func awsRestjson1_deserializeDocumentDeltaSyncConfig(v **types.DeltaSyncConfig, value interface{}) error { 7195 if v == nil { 7196 return fmt.Errorf("unexpected nil of type %T", v) 7197 } 7198 if value == nil { 7199 return nil 7200 } 7201 7202 shape, ok := value.(map[string]interface{}) 7203 if !ok { 7204 return fmt.Errorf("unexpected JSON type %v", value) 7205 } 7206 7207 var sv *types.DeltaSyncConfig 7208 if *v == nil { 7209 sv = &types.DeltaSyncConfig{} 7210 } else { 7211 sv = *v 7212 } 7213 7214 for key, value := range shape { 7215 switch key { 7216 case "baseTableTTL": 7217 if value != nil { 7218 jtv, ok := value.(json.Number) 7219 if !ok { 7220 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 7221 } 7222 i64, err := jtv.Int64() 7223 if err != nil { 7224 return err 7225 } 7226 sv.BaseTableTTL = i64 7227 } 7228 7229 case "deltaSyncTableName": 7230 if value != nil { 7231 jtv, ok := value.(string) 7232 if !ok { 7233 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7234 } 7235 sv.DeltaSyncTableName = ptr.String(jtv) 7236 } 7237 7238 case "deltaSyncTableTTL": 7239 if value != nil { 7240 jtv, ok := value.(json.Number) 7241 if !ok { 7242 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 7243 } 7244 i64, err := jtv.Int64() 7245 if err != nil { 7246 return err 7247 } 7248 sv.DeltaSyncTableTTL = i64 7249 } 7250 7251 default: 7252 _, _ = key, value 7253 7254 } 7255 } 7256 *v = sv 7257 return nil 7258} 7259 7260func awsRestjson1_deserializeDocumentDynamodbDataSourceConfig(v **types.DynamodbDataSourceConfig, value interface{}) error { 7261 if v == nil { 7262 return fmt.Errorf("unexpected nil of type %T", v) 7263 } 7264 if value == nil { 7265 return nil 7266 } 7267 7268 shape, ok := value.(map[string]interface{}) 7269 if !ok { 7270 return fmt.Errorf("unexpected JSON type %v", value) 7271 } 7272 7273 var sv *types.DynamodbDataSourceConfig 7274 if *v == nil { 7275 sv = &types.DynamodbDataSourceConfig{} 7276 } else { 7277 sv = *v 7278 } 7279 7280 for key, value := range shape { 7281 switch key { 7282 case "awsRegion": 7283 if value != nil { 7284 jtv, ok := value.(string) 7285 if !ok { 7286 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7287 } 7288 sv.AwsRegion = ptr.String(jtv) 7289 } 7290 7291 case "deltaSyncConfig": 7292 if err := awsRestjson1_deserializeDocumentDeltaSyncConfig(&sv.DeltaSyncConfig, value); err != nil { 7293 return err 7294 } 7295 7296 case "tableName": 7297 if value != nil { 7298 jtv, ok := value.(string) 7299 if !ok { 7300 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7301 } 7302 sv.TableName = ptr.String(jtv) 7303 } 7304 7305 case "useCallerCredentials": 7306 if value != nil { 7307 jtv, ok := value.(bool) 7308 if !ok { 7309 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 7310 } 7311 sv.UseCallerCredentials = jtv 7312 } 7313 7314 case "versioned": 7315 if value != nil { 7316 jtv, ok := value.(bool) 7317 if !ok { 7318 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 7319 } 7320 sv.Versioned = jtv 7321 } 7322 7323 default: 7324 _, _ = key, value 7325 7326 } 7327 } 7328 *v = sv 7329 return nil 7330} 7331 7332func awsRestjson1_deserializeDocumentElasticsearchDataSourceConfig(v **types.ElasticsearchDataSourceConfig, value interface{}) error { 7333 if v == nil { 7334 return fmt.Errorf("unexpected nil of type %T", v) 7335 } 7336 if value == nil { 7337 return nil 7338 } 7339 7340 shape, ok := value.(map[string]interface{}) 7341 if !ok { 7342 return fmt.Errorf("unexpected JSON type %v", value) 7343 } 7344 7345 var sv *types.ElasticsearchDataSourceConfig 7346 if *v == nil { 7347 sv = &types.ElasticsearchDataSourceConfig{} 7348 } else { 7349 sv = *v 7350 } 7351 7352 for key, value := range shape { 7353 switch key { 7354 case "awsRegion": 7355 if value != nil { 7356 jtv, ok := value.(string) 7357 if !ok { 7358 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7359 } 7360 sv.AwsRegion = ptr.String(jtv) 7361 } 7362 7363 case "endpoint": 7364 if value != nil { 7365 jtv, ok := value.(string) 7366 if !ok { 7367 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7368 } 7369 sv.Endpoint = ptr.String(jtv) 7370 } 7371 7372 default: 7373 _, _ = key, value 7374 7375 } 7376 } 7377 *v = sv 7378 return nil 7379} 7380 7381func awsRestjson1_deserializeDocumentFunctionConfiguration(v **types.FunctionConfiguration, value interface{}) error { 7382 if v == nil { 7383 return fmt.Errorf("unexpected nil of type %T", v) 7384 } 7385 if value == nil { 7386 return nil 7387 } 7388 7389 shape, ok := value.(map[string]interface{}) 7390 if !ok { 7391 return fmt.Errorf("unexpected JSON type %v", value) 7392 } 7393 7394 var sv *types.FunctionConfiguration 7395 if *v == nil { 7396 sv = &types.FunctionConfiguration{} 7397 } else { 7398 sv = *v 7399 } 7400 7401 for key, value := range shape { 7402 switch key { 7403 case "dataSourceName": 7404 if value != nil { 7405 jtv, ok := value.(string) 7406 if !ok { 7407 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7408 } 7409 sv.DataSourceName = ptr.String(jtv) 7410 } 7411 7412 case "description": 7413 if value != nil { 7414 jtv, ok := value.(string) 7415 if !ok { 7416 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7417 } 7418 sv.Description = ptr.String(jtv) 7419 } 7420 7421 case "functionArn": 7422 if value != nil { 7423 jtv, ok := value.(string) 7424 if !ok { 7425 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7426 } 7427 sv.FunctionArn = ptr.String(jtv) 7428 } 7429 7430 case "functionId": 7431 if value != nil { 7432 jtv, ok := value.(string) 7433 if !ok { 7434 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7435 } 7436 sv.FunctionId = ptr.String(jtv) 7437 } 7438 7439 case "functionVersion": 7440 if value != nil { 7441 jtv, ok := value.(string) 7442 if !ok { 7443 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7444 } 7445 sv.FunctionVersion = ptr.String(jtv) 7446 } 7447 7448 case "name": 7449 if value != nil { 7450 jtv, ok := value.(string) 7451 if !ok { 7452 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7453 } 7454 sv.Name = ptr.String(jtv) 7455 } 7456 7457 case "requestMappingTemplate": 7458 if value != nil { 7459 jtv, ok := value.(string) 7460 if !ok { 7461 return fmt.Errorf("expected MappingTemplate to be of type string, got %T instead", value) 7462 } 7463 sv.RequestMappingTemplate = ptr.String(jtv) 7464 } 7465 7466 case "responseMappingTemplate": 7467 if value != nil { 7468 jtv, ok := value.(string) 7469 if !ok { 7470 return fmt.Errorf("expected MappingTemplate to be of type string, got %T instead", value) 7471 } 7472 sv.ResponseMappingTemplate = ptr.String(jtv) 7473 } 7474 7475 default: 7476 _, _ = key, value 7477 7478 } 7479 } 7480 *v = sv 7481 return nil 7482} 7483 7484func awsRestjson1_deserializeDocumentFunctions(v *[]types.FunctionConfiguration, value interface{}) error { 7485 if v == nil { 7486 return fmt.Errorf("unexpected nil of type %T", v) 7487 } 7488 if value == nil { 7489 return nil 7490 } 7491 7492 shape, ok := value.([]interface{}) 7493 if !ok { 7494 return fmt.Errorf("unexpected JSON type %v", value) 7495 } 7496 7497 var cv []types.FunctionConfiguration 7498 if *v == nil { 7499 cv = []types.FunctionConfiguration{} 7500 } else { 7501 cv = *v 7502 } 7503 7504 for _, value := range shape { 7505 var col types.FunctionConfiguration 7506 destAddr := &col 7507 if err := awsRestjson1_deserializeDocumentFunctionConfiguration(&destAddr, value); err != nil { 7508 return err 7509 } 7510 col = *destAddr 7511 cv = append(cv, col) 7512 7513 } 7514 *v = cv 7515 return nil 7516} 7517 7518func awsRestjson1_deserializeDocumentFunctionsIds(v *[]string, value interface{}) error { 7519 if v == nil { 7520 return fmt.Errorf("unexpected nil of type %T", v) 7521 } 7522 if value == nil { 7523 return nil 7524 } 7525 7526 shape, ok := value.([]interface{}) 7527 if !ok { 7528 return fmt.Errorf("unexpected JSON type %v", value) 7529 } 7530 7531 var cv []string 7532 if *v == nil { 7533 cv = []string{} 7534 } else { 7535 cv = *v 7536 } 7537 7538 for _, value := range shape { 7539 var col string 7540 if value != nil { 7541 jtv, ok := value.(string) 7542 if !ok { 7543 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7544 } 7545 col = jtv 7546 } 7547 cv = append(cv, col) 7548 7549 } 7550 *v = cv 7551 return nil 7552} 7553 7554func awsRestjson1_deserializeDocumentGraphqlApi(v **types.GraphqlApi, value interface{}) error { 7555 if v == nil { 7556 return fmt.Errorf("unexpected nil of type %T", v) 7557 } 7558 if value == nil { 7559 return nil 7560 } 7561 7562 shape, ok := value.(map[string]interface{}) 7563 if !ok { 7564 return fmt.Errorf("unexpected JSON type %v", value) 7565 } 7566 7567 var sv *types.GraphqlApi 7568 if *v == nil { 7569 sv = &types.GraphqlApi{} 7570 } else { 7571 sv = *v 7572 } 7573 7574 for key, value := range shape { 7575 switch key { 7576 case "additionalAuthenticationProviders": 7577 if err := awsRestjson1_deserializeDocumentAdditionalAuthenticationProviders(&sv.AdditionalAuthenticationProviders, value); err != nil { 7578 return err 7579 } 7580 7581 case "apiId": 7582 if value != nil { 7583 jtv, ok := value.(string) 7584 if !ok { 7585 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7586 } 7587 sv.ApiId = ptr.String(jtv) 7588 } 7589 7590 case "arn": 7591 if value != nil { 7592 jtv, ok := value.(string) 7593 if !ok { 7594 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7595 } 7596 sv.Arn = ptr.String(jtv) 7597 } 7598 7599 case "authenticationType": 7600 if value != nil { 7601 jtv, ok := value.(string) 7602 if !ok { 7603 return fmt.Errorf("expected AuthenticationType to be of type string, got %T instead", value) 7604 } 7605 sv.AuthenticationType = types.AuthenticationType(jtv) 7606 } 7607 7608 case "logConfig": 7609 if err := awsRestjson1_deserializeDocumentLogConfig(&sv.LogConfig, value); err != nil { 7610 return err 7611 } 7612 7613 case "name": 7614 if value != nil { 7615 jtv, ok := value.(string) 7616 if !ok { 7617 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 7618 } 7619 sv.Name = ptr.String(jtv) 7620 } 7621 7622 case "openIDConnectConfig": 7623 if err := awsRestjson1_deserializeDocumentOpenIDConnectConfig(&sv.OpenIDConnectConfig, value); err != nil { 7624 return err 7625 } 7626 7627 case "tags": 7628 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 7629 return err 7630 } 7631 7632 case "uris": 7633 if err := awsRestjson1_deserializeDocumentMapOfStringToString(&sv.Uris, value); err != nil { 7634 return err 7635 } 7636 7637 case "userPoolConfig": 7638 if err := awsRestjson1_deserializeDocumentUserPoolConfig(&sv.UserPoolConfig, value); err != nil { 7639 return err 7640 } 7641 7642 case "wafWebAclArn": 7643 if value != nil { 7644 jtv, ok := value.(string) 7645 if !ok { 7646 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7647 } 7648 sv.WafWebAclArn = ptr.String(jtv) 7649 } 7650 7651 case "xrayEnabled": 7652 if value != nil { 7653 jtv, ok := value.(bool) 7654 if !ok { 7655 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 7656 } 7657 sv.XrayEnabled = jtv 7658 } 7659 7660 default: 7661 _, _ = key, value 7662 7663 } 7664 } 7665 *v = sv 7666 return nil 7667} 7668 7669func awsRestjson1_deserializeDocumentGraphqlApis(v *[]types.GraphqlApi, value interface{}) error { 7670 if v == nil { 7671 return fmt.Errorf("unexpected nil of type %T", v) 7672 } 7673 if value == nil { 7674 return nil 7675 } 7676 7677 shape, ok := value.([]interface{}) 7678 if !ok { 7679 return fmt.Errorf("unexpected JSON type %v", value) 7680 } 7681 7682 var cv []types.GraphqlApi 7683 if *v == nil { 7684 cv = []types.GraphqlApi{} 7685 } else { 7686 cv = *v 7687 } 7688 7689 for _, value := range shape { 7690 var col types.GraphqlApi 7691 destAddr := &col 7692 if err := awsRestjson1_deserializeDocumentGraphqlApi(&destAddr, value); err != nil { 7693 return err 7694 } 7695 col = *destAddr 7696 cv = append(cv, col) 7697 7698 } 7699 *v = cv 7700 return nil 7701} 7702 7703func awsRestjson1_deserializeDocumentGraphQLSchemaException(v **types.GraphQLSchemaException, value interface{}) error { 7704 if v == nil { 7705 return fmt.Errorf("unexpected nil of type %T", v) 7706 } 7707 if value == nil { 7708 return nil 7709 } 7710 7711 shape, ok := value.(map[string]interface{}) 7712 if !ok { 7713 return fmt.Errorf("unexpected JSON type %v", value) 7714 } 7715 7716 var sv *types.GraphQLSchemaException 7717 if *v == nil { 7718 sv = &types.GraphQLSchemaException{} 7719 } else { 7720 sv = *v 7721 } 7722 7723 for key, value := range shape { 7724 switch key { 7725 case "message": 7726 if value != nil { 7727 jtv, ok := value.(string) 7728 if !ok { 7729 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 7730 } 7731 sv.Message = ptr.String(jtv) 7732 } 7733 7734 default: 7735 _, _ = key, value 7736 7737 } 7738 } 7739 *v = sv 7740 return nil 7741} 7742 7743func awsRestjson1_deserializeDocumentHttpDataSourceConfig(v **types.HttpDataSourceConfig, value interface{}) error { 7744 if v == nil { 7745 return fmt.Errorf("unexpected nil of type %T", v) 7746 } 7747 if value == nil { 7748 return nil 7749 } 7750 7751 shape, ok := value.(map[string]interface{}) 7752 if !ok { 7753 return fmt.Errorf("unexpected JSON type %v", value) 7754 } 7755 7756 var sv *types.HttpDataSourceConfig 7757 if *v == nil { 7758 sv = &types.HttpDataSourceConfig{} 7759 } else { 7760 sv = *v 7761 } 7762 7763 for key, value := range shape { 7764 switch key { 7765 case "authorizationConfig": 7766 if err := awsRestjson1_deserializeDocumentAuthorizationConfig(&sv.AuthorizationConfig, value); err != nil { 7767 return err 7768 } 7769 7770 case "endpoint": 7771 if value != nil { 7772 jtv, ok := value.(string) 7773 if !ok { 7774 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7775 } 7776 sv.Endpoint = ptr.String(jtv) 7777 } 7778 7779 default: 7780 _, _ = key, value 7781 7782 } 7783 } 7784 *v = sv 7785 return nil 7786} 7787 7788func awsRestjson1_deserializeDocumentInternalFailureException(v **types.InternalFailureException, value interface{}) error { 7789 if v == nil { 7790 return fmt.Errorf("unexpected nil of type %T", v) 7791 } 7792 if value == nil { 7793 return nil 7794 } 7795 7796 shape, ok := value.(map[string]interface{}) 7797 if !ok { 7798 return fmt.Errorf("unexpected JSON type %v", value) 7799 } 7800 7801 var sv *types.InternalFailureException 7802 if *v == nil { 7803 sv = &types.InternalFailureException{} 7804 } else { 7805 sv = *v 7806 } 7807 7808 for key, value := range shape { 7809 switch key { 7810 case "message": 7811 if value != nil { 7812 jtv, ok := value.(string) 7813 if !ok { 7814 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7815 } 7816 sv.Message = ptr.String(jtv) 7817 } 7818 7819 default: 7820 _, _ = key, value 7821 7822 } 7823 } 7824 *v = sv 7825 return nil 7826} 7827 7828func awsRestjson1_deserializeDocumentLambdaConflictHandlerConfig(v **types.LambdaConflictHandlerConfig, value interface{}) error { 7829 if v == nil { 7830 return fmt.Errorf("unexpected nil of type %T", v) 7831 } 7832 if value == nil { 7833 return nil 7834 } 7835 7836 shape, ok := value.(map[string]interface{}) 7837 if !ok { 7838 return fmt.Errorf("unexpected JSON type %v", value) 7839 } 7840 7841 var sv *types.LambdaConflictHandlerConfig 7842 if *v == nil { 7843 sv = &types.LambdaConflictHandlerConfig{} 7844 } else { 7845 sv = *v 7846 } 7847 7848 for key, value := range shape { 7849 switch key { 7850 case "lambdaConflictHandlerArn": 7851 if value != nil { 7852 jtv, ok := value.(string) 7853 if !ok { 7854 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7855 } 7856 sv.LambdaConflictHandlerArn = ptr.String(jtv) 7857 } 7858 7859 default: 7860 _, _ = key, value 7861 7862 } 7863 } 7864 *v = sv 7865 return nil 7866} 7867 7868func awsRestjson1_deserializeDocumentLambdaDataSourceConfig(v **types.LambdaDataSourceConfig, value interface{}) error { 7869 if v == nil { 7870 return fmt.Errorf("unexpected nil of type %T", v) 7871 } 7872 if value == nil { 7873 return nil 7874 } 7875 7876 shape, ok := value.(map[string]interface{}) 7877 if !ok { 7878 return fmt.Errorf("unexpected JSON type %v", value) 7879 } 7880 7881 var sv *types.LambdaDataSourceConfig 7882 if *v == nil { 7883 sv = &types.LambdaDataSourceConfig{} 7884 } else { 7885 sv = *v 7886 } 7887 7888 for key, value := range shape { 7889 switch key { 7890 case "lambdaFunctionArn": 7891 if value != nil { 7892 jtv, ok := value.(string) 7893 if !ok { 7894 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7895 } 7896 sv.LambdaFunctionArn = ptr.String(jtv) 7897 } 7898 7899 default: 7900 _, _ = key, value 7901 7902 } 7903 } 7904 *v = sv 7905 return nil 7906} 7907 7908func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 7909 if v == nil { 7910 return fmt.Errorf("unexpected nil of type %T", v) 7911 } 7912 if value == nil { 7913 return nil 7914 } 7915 7916 shape, ok := value.(map[string]interface{}) 7917 if !ok { 7918 return fmt.Errorf("unexpected JSON type %v", value) 7919 } 7920 7921 var sv *types.LimitExceededException 7922 if *v == nil { 7923 sv = &types.LimitExceededException{} 7924 } else { 7925 sv = *v 7926 } 7927 7928 for key, value := range shape { 7929 switch key { 7930 case "message": 7931 if value != nil { 7932 jtv, ok := value.(string) 7933 if !ok { 7934 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7935 } 7936 sv.Message = ptr.String(jtv) 7937 } 7938 7939 default: 7940 _, _ = key, value 7941 7942 } 7943 } 7944 *v = sv 7945 return nil 7946} 7947 7948func awsRestjson1_deserializeDocumentLogConfig(v **types.LogConfig, value interface{}) error { 7949 if v == nil { 7950 return fmt.Errorf("unexpected nil of type %T", v) 7951 } 7952 if value == nil { 7953 return nil 7954 } 7955 7956 shape, ok := value.(map[string]interface{}) 7957 if !ok { 7958 return fmt.Errorf("unexpected JSON type %v", value) 7959 } 7960 7961 var sv *types.LogConfig 7962 if *v == nil { 7963 sv = &types.LogConfig{} 7964 } else { 7965 sv = *v 7966 } 7967 7968 for key, value := range shape { 7969 switch key { 7970 case "cloudWatchLogsRoleArn": 7971 if value != nil { 7972 jtv, ok := value.(string) 7973 if !ok { 7974 return fmt.Errorf("expected String to be of type string, got %T instead", value) 7975 } 7976 sv.CloudWatchLogsRoleArn = ptr.String(jtv) 7977 } 7978 7979 case "excludeVerboseContent": 7980 if value != nil { 7981 jtv, ok := value.(bool) 7982 if !ok { 7983 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 7984 } 7985 sv.ExcludeVerboseContent = jtv 7986 } 7987 7988 case "fieldLogLevel": 7989 if value != nil { 7990 jtv, ok := value.(string) 7991 if !ok { 7992 return fmt.Errorf("expected FieldLogLevel to be of type string, got %T instead", value) 7993 } 7994 sv.FieldLogLevel = types.FieldLogLevel(jtv) 7995 } 7996 7997 default: 7998 _, _ = key, value 7999 8000 } 8001 } 8002 *v = sv 8003 return nil 8004} 8005 8006func awsRestjson1_deserializeDocumentMapOfStringToString(v *map[string]string, value interface{}) error { 8007 if v == nil { 8008 return fmt.Errorf("unexpected nil of type %T", v) 8009 } 8010 if value == nil { 8011 return nil 8012 } 8013 8014 shape, ok := value.(map[string]interface{}) 8015 if !ok { 8016 return fmt.Errorf("unexpected JSON type %v", value) 8017 } 8018 8019 var mv map[string]string 8020 if *v == nil { 8021 mv = map[string]string{} 8022 } else { 8023 mv = *v 8024 } 8025 8026 for key, value := range shape { 8027 var parsedVal string 8028 if value != nil { 8029 jtv, ok := value.(string) 8030 if !ok { 8031 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8032 } 8033 parsedVal = jtv 8034 } 8035 mv[key] = parsedVal 8036 8037 } 8038 *v = mv 8039 return nil 8040} 8041 8042func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 8043 if v == nil { 8044 return fmt.Errorf("unexpected nil of type %T", v) 8045 } 8046 if value == nil { 8047 return nil 8048 } 8049 8050 shape, ok := value.(map[string]interface{}) 8051 if !ok { 8052 return fmt.Errorf("unexpected JSON type %v", value) 8053 } 8054 8055 var sv *types.NotFoundException 8056 if *v == nil { 8057 sv = &types.NotFoundException{} 8058 } else { 8059 sv = *v 8060 } 8061 8062 for key, value := range shape { 8063 switch key { 8064 case "message": 8065 if value != nil { 8066 jtv, ok := value.(string) 8067 if !ok { 8068 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8069 } 8070 sv.Message = ptr.String(jtv) 8071 } 8072 8073 default: 8074 _, _ = key, value 8075 8076 } 8077 } 8078 *v = sv 8079 return nil 8080} 8081 8082func awsRestjson1_deserializeDocumentOpenIDConnectConfig(v **types.OpenIDConnectConfig, value interface{}) error { 8083 if v == nil { 8084 return fmt.Errorf("unexpected nil of type %T", v) 8085 } 8086 if value == nil { 8087 return nil 8088 } 8089 8090 shape, ok := value.(map[string]interface{}) 8091 if !ok { 8092 return fmt.Errorf("unexpected JSON type %v", value) 8093 } 8094 8095 var sv *types.OpenIDConnectConfig 8096 if *v == nil { 8097 sv = &types.OpenIDConnectConfig{} 8098 } else { 8099 sv = *v 8100 } 8101 8102 for key, value := range shape { 8103 switch key { 8104 case "authTTL": 8105 if value != nil { 8106 jtv, ok := value.(json.Number) 8107 if !ok { 8108 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 8109 } 8110 i64, err := jtv.Int64() 8111 if err != nil { 8112 return err 8113 } 8114 sv.AuthTTL = i64 8115 } 8116 8117 case "clientId": 8118 if value != nil { 8119 jtv, ok := value.(string) 8120 if !ok { 8121 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8122 } 8123 sv.ClientId = ptr.String(jtv) 8124 } 8125 8126 case "iatTTL": 8127 if value != nil { 8128 jtv, ok := value.(json.Number) 8129 if !ok { 8130 return fmt.Errorf("expected Long to be json.Number, got %T instead", value) 8131 } 8132 i64, err := jtv.Int64() 8133 if err != nil { 8134 return err 8135 } 8136 sv.IatTTL = i64 8137 } 8138 8139 case "issuer": 8140 if value != nil { 8141 jtv, ok := value.(string) 8142 if !ok { 8143 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8144 } 8145 sv.Issuer = ptr.String(jtv) 8146 } 8147 8148 default: 8149 _, _ = key, value 8150 8151 } 8152 } 8153 *v = sv 8154 return nil 8155} 8156 8157func awsRestjson1_deserializeDocumentPipelineConfig(v **types.PipelineConfig, value interface{}) error { 8158 if v == nil { 8159 return fmt.Errorf("unexpected nil of type %T", v) 8160 } 8161 if value == nil { 8162 return nil 8163 } 8164 8165 shape, ok := value.(map[string]interface{}) 8166 if !ok { 8167 return fmt.Errorf("unexpected JSON type %v", value) 8168 } 8169 8170 var sv *types.PipelineConfig 8171 if *v == nil { 8172 sv = &types.PipelineConfig{} 8173 } else { 8174 sv = *v 8175 } 8176 8177 for key, value := range shape { 8178 switch key { 8179 case "functions": 8180 if err := awsRestjson1_deserializeDocumentFunctionsIds(&sv.Functions, value); err != nil { 8181 return err 8182 } 8183 8184 default: 8185 _, _ = key, value 8186 8187 } 8188 } 8189 *v = sv 8190 return nil 8191} 8192 8193func awsRestjson1_deserializeDocumentRdsHttpEndpointConfig(v **types.RdsHttpEndpointConfig, value interface{}) error { 8194 if v == nil { 8195 return fmt.Errorf("unexpected nil of type %T", v) 8196 } 8197 if value == nil { 8198 return nil 8199 } 8200 8201 shape, ok := value.(map[string]interface{}) 8202 if !ok { 8203 return fmt.Errorf("unexpected JSON type %v", value) 8204 } 8205 8206 var sv *types.RdsHttpEndpointConfig 8207 if *v == nil { 8208 sv = &types.RdsHttpEndpointConfig{} 8209 } else { 8210 sv = *v 8211 } 8212 8213 for key, value := range shape { 8214 switch key { 8215 case "awsRegion": 8216 if value != nil { 8217 jtv, ok := value.(string) 8218 if !ok { 8219 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8220 } 8221 sv.AwsRegion = ptr.String(jtv) 8222 } 8223 8224 case "awsSecretStoreArn": 8225 if value != nil { 8226 jtv, ok := value.(string) 8227 if !ok { 8228 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8229 } 8230 sv.AwsSecretStoreArn = ptr.String(jtv) 8231 } 8232 8233 case "databaseName": 8234 if value != nil { 8235 jtv, ok := value.(string) 8236 if !ok { 8237 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8238 } 8239 sv.DatabaseName = ptr.String(jtv) 8240 } 8241 8242 case "dbClusterIdentifier": 8243 if value != nil { 8244 jtv, ok := value.(string) 8245 if !ok { 8246 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8247 } 8248 sv.DbClusterIdentifier = ptr.String(jtv) 8249 } 8250 8251 case "schema": 8252 if value != nil { 8253 jtv, ok := value.(string) 8254 if !ok { 8255 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8256 } 8257 sv.Schema = ptr.String(jtv) 8258 } 8259 8260 default: 8261 _, _ = key, value 8262 8263 } 8264 } 8265 *v = sv 8266 return nil 8267} 8268 8269func awsRestjson1_deserializeDocumentRelationalDatabaseDataSourceConfig(v **types.RelationalDatabaseDataSourceConfig, value interface{}) error { 8270 if v == nil { 8271 return fmt.Errorf("unexpected nil of type %T", v) 8272 } 8273 if value == nil { 8274 return nil 8275 } 8276 8277 shape, ok := value.(map[string]interface{}) 8278 if !ok { 8279 return fmt.Errorf("unexpected JSON type %v", value) 8280 } 8281 8282 var sv *types.RelationalDatabaseDataSourceConfig 8283 if *v == nil { 8284 sv = &types.RelationalDatabaseDataSourceConfig{} 8285 } else { 8286 sv = *v 8287 } 8288 8289 for key, value := range shape { 8290 switch key { 8291 case "rdsHttpEndpointConfig": 8292 if err := awsRestjson1_deserializeDocumentRdsHttpEndpointConfig(&sv.RdsHttpEndpointConfig, value); err != nil { 8293 return err 8294 } 8295 8296 case "relationalDatabaseSourceType": 8297 if value != nil { 8298 jtv, ok := value.(string) 8299 if !ok { 8300 return fmt.Errorf("expected RelationalDatabaseSourceType to be of type string, got %T instead", value) 8301 } 8302 sv.RelationalDatabaseSourceType = types.RelationalDatabaseSourceType(jtv) 8303 } 8304 8305 default: 8306 _, _ = key, value 8307 8308 } 8309 } 8310 *v = sv 8311 return nil 8312} 8313 8314func awsRestjson1_deserializeDocumentResolver(v **types.Resolver, value interface{}) error { 8315 if v == nil { 8316 return fmt.Errorf("unexpected nil of type %T", v) 8317 } 8318 if value == nil { 8319 return nil 8320 } 8321 8322 shape, ok := value.(map[string]interface{}) 8323 if !ok { 8324 return fmt.Errorf("unexpected JSON type %v", value) 8325 } 8326 8327 var sv *types.Resolver 8328 if *v == nil { 8329 sv = &types.Resolver{} 8330 } else { 8331 sv = *v 8332 } 8333 8334 for key, value := range shape { 8335 switch key { 8336 case "cachingConfig": 8337 if err := awsRestjson1_deserializeDocumentCachingConfig(&sv.CachingConfig, value); err != nil { 8338 return err 8339 } 8340 8341 case "dataSourceName": 8342 if value != nil { 8343 jtv, ok := value.(string) 8344 if !ok { 8345 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 8346 } 8347 sv.DataSourceName = ptr.String(jtv) 8348 } 8349 8350 case "fieldName": 8351 if value != nil { 8352 jtv, ok := value.(string) 8353 if !ok { 8354 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 8355 } 8356 sv.FieldName = ptr.String(jtv) 8357 } 8358 8359 case "kind": 8360 if value != nil { 8361 jtv, ok := value.(string) 8362 if !ok { 8363 return fmt.Errorf("expected ResolverKind to be of type string, got %T instead", value) 8364 } 8365 sv.Kind = types.ResolverKind(jtv) 8366 } 8367 8368 case "pipelineConfig": 8369 if err := awsRestjson1_deserializeDocumentPipelineConfig(&sv.PipelineConfig, value); err != nil { 8370 return err 8371 } 8372 8373 case "requestMappingTemplate": 8374 if value != nil { 8375 jtv, ok := value.(string) 8376 if !ok { 8377 return fmt.Errorf("expected MappingTemplate to be of type string, got %T instead", value) 8378 } 8379 sv.RequestMappingTemplate = ptr.String(jtv) 8380 } 8381 8382 case "resolverArn": 8383 if value != nil { 8384 jtv, ok := value.(string) 8385 if !ok { 8386 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8387 } 8388 sv.ResolverArn = ptr.String(jtv) 8389 } 8390 8391 case "responseMappingTemplate": 8392 if value != nil { 8393 jtv, ok := value.(string) 8394 if !ok { 8395 return fmt.Errorf("expected MappingTemplate to be of type string, got %T instead", value) 8396 } 8397 sv.ResponseMappingTemplate = ptr.String(jtv) 8398 } 8399 8400 case "syncConfig": 8401 if err := awsRestjson1_deserializeDocumentSyncConfig(&sv.SyncConfig, value); err != nil { 8402 return err 8403 } 8404 8405 case "typeName": 8406 if value != nil { 8407 jtv, ok := value.(string) 8408 if !ok { 8409 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 8410 } 8411 sv.TypeName = ptr.String(jtv) 8412 } 8413 8414 default: 8415 _, _ = key, value 8416 8417 } 8418 } 8419 *v = sv 8420 return nil 8421} 8422 8423func awsRestjson1_deserializeDocumentResolvers(v *[]types.Resolver, value interface{}) error { 8424 if v == nil { 8425 return fmt.Errorf("unexpected nil of type %T", v) 8426 } 8427 if value == nil { 8428 return nil 8429 } 8430 8431 shape, ok := value.([]interface{}) 8432 if !ok { 8433 return fmt.Errorf("unexpected JSON type %v", value) 8434 } 8435 8436 var cv []types.Resolver 8437 if *v == nil { 8438 cv = []types.Resolver{} 8439 } else { 8440 cv = *v 8441 } 8442 8443 for _, value := range shape { 8444 var col types.Resolver 8445 destAddr := &col 8446 if err := awsRestjson1_deserializeDocumentResolver(&destAddr, value); err != nil { 8447 return err 8448 } 8449 col = *destAddr 8450 cv = append(cv, col) 8451 8452 } 8453 *v = cv 8454 return nil 8455} 8456 8457func awsRestjson1_deserializeDocumentSyncConfig(v **types.SyncConfig, value interface{}) error { 8458 if v == nil { 8459 return fmt.Errorf("unexpected nil of type %T", v) 8460 } 8461 if value == nil { 8462 return nil 8463 } 8464 8465 shape, ok := value.(map[string]interface{}) 8466 if !ok { 8467 return fmt.Errorf("unexpected JSON type %v", value) 8468 } 8469 8470 var sv *types.SyncConfig 8471 if *v == nil { 8472 sv = &types.SyncConfig{} 8473 } else { 8474 sv = *v 8475 } 8476 8477 for key, value := range shape { 8478 switch key { 8479 case "conflictDetection": 8480 if value != nil { 8481 jtv, ok := value.(string) 8482 if !ok { 8483 return fmt.Errorf("expected ConflictDetectionType to be of type string, got %T instead", value) 8484 } 8485 sv.ConflictDetection = types.ConflictDetectionType(jtv) 8486 } 8487 8488 case "conflictHandler": 8489 if value != nil { 8490 jtv, ok := value.(string) 8491 if !ok { 8492 return fmt.Errorf("expected ConflictHandlerType to be of type string, got %T instead", value) 8493 } 8494 sv.ConflictHandler = types.ConflictHandlerType(jtv) 8495 } 8496 8497 case "lambdaConflictHandlerConfig": 8498 if err := awsRestjson1_deserializeDocumentLambdaConflictHandlerConfig(&sv.LambdaConflictHandlerConfig, value); err != nil { 8499 return err 8500 } 8501 8502 default: 8503 _, _ = key, value 8504 8505 } 8506 } 8507 *v = sv 8508 return nil 8509} 8510 8511func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { 8512 if v == nil { 8513 return fmt.Errorf("unexpected nil of type %T", v) 8514 } 8515 if value == nil { 8516 return nil 8517 } 8518 8519 shape, ok := value.(map[string]interface{}) 8520 if !ok { 8521 return fmt.Errorf("unexpected JSON type %v", value) 8522 } 8523 8524 var mv map[string]string 8525 if *v == nil { 8526 mv = map[string]string{} 8527 } else { 8528 mv = *v 8529 } 8530 8531 for key, value := range shape { 8532 var parsedVal string 8533 if value != nil { 8534 jtv, ok := value.(string) 8535 if !ok { 8536 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 8537 } 8538 parsedVal = jtv 8539 } 8540 mv[key] = parsedVal 8541 8542 } 8543 *v = mv 8544 return nil 8545} 8546 8547func awsRestjson1_deserializeDocumentType(v **types.Type, value interface{}) error { 8548 if v == nil { 8549 return fmt.Errorf("unexpected nil of type %T", v) 8550 } 8551 if value == nil { 8552 return nil 8553 } 8554 8555 shape, ok := value.(map[string]interface{}) 8556 if !ok { 8557 return fmt.Errorf("unexpected JSON type %v", value) 8558 } 8559 8560 var sv *types.Type 8561 if *v == nil { 8562 sv = &types.Type{} 8563 } else { 8564 sv = *v 8565 } 8566 8567 for key, value := range shape { 8568 switch key { 8569 case "arn": 8570 if value != nil { 8571 jtv, ok := value.(string) 8572 if !ok { 8573 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8574 } 8575 sv.Arn = ptr.String(jtv) 8576 } 8577 8578 case "definition": 8579 if value != nil { 8580 jtv, ok := value.(string) 8581 if !ok { 8582 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8583 } 8584 sv.Definition = ptr.String(jtv) 8585 } 8586 8587 case "description": 8588 if value != nil { 8589 jtv, ok := value.(string) 8590 if !ok { 8591 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8592 } 8593 sv.Description = ptr.String(jtv) 8594 } 8595 8596 case "format": 8597 if value != nil { 8598 jtv, ok := value.(string) 8599 if !ok { 8600 return fmt.Errorf("expected TypeDefinitionFormat to be of type string, got %T instead", value) 8601 } 8602 sv.Format = types.TypeDefinitionFormat(jtv) 8603 } 8604 8605 case "name": 8606 if value != nil { 8607 jtv, ok := value.(string) 8608 if !ok { 8609 return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) 8610 } 8611 sv.Name = ptr.String(jtv) 8612 } 8613 8614 default: 8615 _, _ = key, value 8616 8617 } 8618 } 8619 *v = sv 8620 return nil 8621} 8622 8623func awsRestjson1_deserializeDocumentTypeList(v *[]types.Type, value interface{}) error { 8624 if v == nil { 8625 return fmt.Errorf("unexpected nil of type %T", v) 8626 } 8627 if value == nil { 8628 return nil 8629 } 8630 8631 shape, ok := value.([]interface{}) 8632 if !ok { 8633 return fmt.Errorf("unexpected JSON type %v", value) 8634 } 8635 8636 var cv []types.Type 8637 if *v == nil { 8638 cv = []types.Type{} 8639 } else { 8640 cv = *v 8641 } 8642 8643 for _, value := range shape { 8644 var col types.Type 8645 destAddr := &col 8646 if err := awsRestjson1_deserializeDocumentType(&destAddr, value); err != nil { 8647 return err 8648 } 8649 col = *destAddr 8650 cv = append(cv, col) 8651 8652 } 8653 *v = cv 8654 return nil 8655} 8656 8657func awsRestjson1_deserializeDocumentUnauthorizedException(v **types.UnauthorizedException, value interface{}) error { 8658 if v == nil { 8659 return fmt.Errorf("unexpected nil of type %T", v) 8660 } 8661 if value == nil { 8662 return nil 8663 } 8664 8665 shape, ok := value.(map[string]interface{}) 8666 if !ok { 8667 return fmt.Errorf("unexpected JSON type %v", value) 8668 } 8669 8670 var sv *types.UnauthorizedException 8671 if *v == nil { 8672 sv = &types.UnauthorizedException{} 8673 } else { 8674 sv = *v 8675 } 8676 8677 for key, value := range shape { 8678 switch key { 8679 case "message": 8680 if value != nil { 8681 jtv, ok := value.(string) 8682 if !ok { 8683 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8684 } 8685 sv.Message = ptr.String(jtv) 8686 } 8687 8688 default: 8689 _, _ = key, value 8690 8691 } 8692 } 8693 *v = sv 8694 return nil 8695} 8696 8697func awsRestjson1_deserializeDocumentUserPoolConfig(v **types.UserPoolConfig, value interface{}) error { 8698 if v == nil { 8699 return fmt.Errorf("unexpected nil of type %T", v) 8700 } 8701 if value == nil { 8702 return nil 8703 } 8704 8705 shape, ok := value.(map[string]interface{}) 8706 if !ok { 8707 return fmt.Errorf("unexpected JSON type %v", value) 8708 } 8709 8710 var sv *types.UserPoolConfig 8711 if *v == nil { 8712 sv = &types.UserPoolConfig{} 8713 } else { 8714 sv = *v 8715 } 8716 8717 for key, value := range shape { 8718 switch key { 8719 case "appIdClientRegex": 8720 if value != nil { 8721 jtv, ok := value.(string) 8722 if !ok { 8723 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8724 } 8725 sv.AppIdClientRegex = ptr.String(jtv) 8726 } 8727 8728 case "awsRegion": 8729 if value != nil { 8730 jtv, ok := value.(string) 8731 if !ok { 8732 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8733 } 8734 sv.AwsRegion = ptr.String(jtv) 8735 } 8736 8737 case "defaultAction": 8738 if value != nil { 8739 jtv, ok := value.(string) 8740 if !ok { 8741 return fmt.Errorf("expected DefaultAction to be of type string, got %T instead", value) 8742 } 8743 sv.DefaultAction = types.DefaultAction(jtv) 8744 } 8745 8746 case "userPoolId": 8747 if value != nil { 8748 jtv, ok := value.(string) 8749 if !ok { 8750 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8751 } 8752 sv.UserPoolId = ptr.String(jtv) 8753 } 8754 8755 default: 8756 _, _ = key, value 8757 8758 } 8759 } 8760 *v = sv 8761 return nil 8762} 8763