1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package serverlessapplicationrepository 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/serverlessapplicationrepository/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_deserializeOpCreateApplication struct { 23} 24 25func (*awsRestjson1_deserializeOpCreateApplication) ID() string { 26 return "OperationDeserializer" 27} 28 29func (m *awsRestjson1_deserializeOpCreateApplication) 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_deserializeOpErrorCreateApplication(response, &metadata) 44 } 45 output := &CreateApplicationOutput{} 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_deserializeOpDocumentCreateApplicationOutput(&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_deserializeOpErrorCreateApplication(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("ConflictException", errorCode): 124 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 125 126 case strings.EqualFold("ForbiddenException", errorCode): 127 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 128 129 case strings.EqualFold("InternalServerErrorException", errorCode): 130 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 131 132 case strings.EqualFold("TooManyRequestsException", errorCode): 133 return awsRestjson1_deserializeErrorTooManyRequestsException(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_deserializeOpDocumentCreateApplicationOutput(v **CreateApplicationOutput, 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 *CreateApplicationOutput 159 if *v == nil { 160 sv = &CreateApplicationOutput{} 161 } else { 162 sv = *v 163 } 164 165 for key, value := range shape { 166 switch key { 167 case "applicationId": 168 if value != nil { 169 jtv, ok := value.(string) 170 if !ok { 171 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 172 } 173 sv.ApplicationId = ptr.String(jtv) 174 } 175 176 case "author": 177 if value != nil { 178 jtv, ok := value.(string) 179 if !ok { 180 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 181 } 182 sv.Author = ptr.String(jtv) 183 } 184 185 case "creationTime": 186 if value != nil { 187 jtv, ok := value.(string) 188 if !ok { 189 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 190 } 191 sv.CreationTime = ptr.String(jtv) 192 } 193 194 case "description": 195 if value != nil { 196 jtv, ok := value.(string) 197 if !ok { 198 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 199 } 200 sv.Description = ptr.String(jtv) 201 } 202 203 case "homePageUrl": 204 if value != nil { 205 jtv, ok := value.(string) 206 if !ok { 207 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 208 } 209 sv.HomePageUrl = ptr.String(jtv) 210 } 211 212 case "isVerifiedAuthor": 213 if value != nil { 214 jtv, ok := value.(bool) 215 if !ok { 216 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 217 } 218 sv.IsVerifiedAuthor = jtv 219 } 220 221 case "labels": 222 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Labels, value); err != nil { 223 return err 224 } 225 226 case "licenseUrl": 227 if value != nil { 228 jtv, ok := value.(string) 229 if !ok { 230 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 231 } 232 sv.LicenseUrl = ptr.String(jtv) 233 } 234 235 case "name": 236 if value != nil { 237 jtv, ok := value.(string) 238 if !ok { 239 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 240 } 241 sv.Name = ptr.String(jtv) 242 } 243 244 case "readmeUrl": 245 if value != nil { 246 jtv, ok := value.(string) 247 if !ok { 248 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 249 } 250 sv.ReadmeUrl = ptr.String(jtv) 251 } 252 253 case "spdxLicenseId": 254 if value != nil { 255 jtv, ok := value.(string) 256 if !ok { 257 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 258 } 259 sv.SpdxLicenseId = ptr.String(jtv) 260 } 261 262 case "verifiedAuthorUrl": 263 if value != nil { 264 jtv, ok := value.(string) 265 if !ok { 266 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 267 } 268 sv.VerifiedAuthorUrl = ptr.String(jtv) 269 } 270 271 case "version": 272 if err := awsRestjson1_deserializeDocumentVersion(&sv.Version, value); err != nil { 273 return err 274 } 275 276 default: 277 _, _ = key, value 278 279 } 280 } 281 *v = sv 282 return nil 283} 284 285type awsRestjson1_deserializeOpCreateApplicationVersion struct { 286} 287 288func (*awsRestjson1_deserializeOpCreateApplicationVersion) ID() string { 289 return "OperationDeserializer" 290} 291 292func (m *awsRestjson1_deserializeOpCreateApplicationVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 293 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 294) { 295 out, metadata, err = next.HandleDeserialize(ctx, in) 296 if err != nil { 297 return out, metadata, err 298 } 299 300 response, ok := out.RawResponse.(*smithyhttp.Response) 301 if !ok { 302 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 303 } 304 305 if response.StatusCode < 200 || response.StatusCode >= 300 { 306 return out, metadata, awsRestjson1_deserializeOpErrorCreateApplicationVersion(response, &metadata) 307 } 308 output := &CreateApplicationVersionOutput{} 309 out.Result = output 310 311 var buff [1024]byte 312 ringBuffer := smithyio.NewRingBuffer(buff[:]) 313 314 body := io.TeeReader(response.Body, ringBuffer) 315 316 decoder := json.NewDecoder(body) 317 decoder.UseNumber() 318 var shape interface{} 319 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 320 var snapshot bytes.Buffer 321 io.Copy(&snapshot, ringBuffer) 322 err = &smithy.DeserializationError{ 323 Err: fmt.Errorf("failed to decode response body, %w", err), 324 Snapshot: snapshot.Bytes(), 325 } 326 return out, metadata, err 327 } 328 329 err = awsRestjson1_deserializeOpDocumentCreateApplicationVersionOutput(&output, shape) 330 if err != nil { 331 var snapshot bytes.Buffer 332 io.Copy(&snapshot, ringBuffer) 333 return out, metadata, &smithy.DeserializationError{ 334 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 335 Snapshot: snapshot.Bytes(), 336 } 337 } 338 339 return out, metadata, err 340} 341 342func awsRestjson1_deserializeOpErrorCreateApplicationVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 343 var errorBuffer bytes.Buffer 344 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 345 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 346 } 347 errorBody := bytes.NewReader(errorBuffer.Bytes()) 348 349 errorCode := "UnknownError" 350 errorMessage := errorCode 351 352 code := response.Header.Get("X-Amzn-ErrorType") 353 if len(code) != 0 { 354 errorCode = restjson.SanitizeErrorCode(code) 355 } 356 357 var buff [1024]byte 358 ringBuffer := smithyio.NewRingBuffer(buff[:]) 359 360 body := io.TeeReader(errorBody, ringBuffer) 361 decoder := json.NewDecoder(body) 362 decoder.UseNumber() 363 code, message, err := restjson.GetErrorInfo(decoder) 364 if err != nil { 365 var snapshot bytes.Buffer 366 io.Copy(&snapshot, ringBuffer) 367 err = &smithy.DeserializationError{ 368 Err: fmt.Errorf("failed to decode response body, %w", err), 369 Snapshot: snapshot.Bytes(), 370 } 371 return err 372 } 373 374 errorBody.Seek(0, io.SeekStart) 375 if len(code) != 0 { 376 errorCode = restjson.SanitizeErrorCode(code) 377 } 378 if len(message) != 0 { 379 errorMessage = message 380 } 381 382 switch { 383 case strings.EqualFold("BadRequestException", errorCode): 384 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 385 386 case strings.EqualFold("ConflictException", errorCode): 387 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 388 389 case strings.EqualFold("ForbiddenException", errorCode): 390 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 391 392 case strings.EqualFold("InternalServerErrorException", errorCode): 393 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 394 395 case strings.EqualFold("TooManyRequestsException", errorCode): 396 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 397 398 default: 399 genericError := &smithy.GenericAPIError{ 400 Code: errorCode, 401 Message: errorMessage, 402 } 403 return genericError 404 405 } 406} 407 408func awsRestjson1_deserializeOpDocumentCreateApplicationVersionOutput(v **CreateApplicationVersionOutput, value interface{}) error { 409 if v == nil { 410 return fmt.Errorf("unexpected nil of type %T", v) 411 } 412 if value == nil { 413 return nil 414 } 415 416 shape, ok := value.(map[string]interface{}) 417 if !ok { 418 return fmt.Errorf("unexpected JSON type %v", value) 419 } 420 421 var sv *CreateApplicationVersionOutput 422 if *v == nil { 423 sv = &CreateApplicationVersionOutput{} 424 } else { 425 sv = *v 426 } 427 428 for key, value := range shape { 429 switch key { 430 case "applicationId": 431 if value != nil { 432 jtv, ok := value.(string) 433 if !ok { 434 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 435 } 436 sv.ApplicationId = ptr.String(jtv) 437 } 438 439 case "creationTime": 440 if value != nil { 441 jtv, ok := value.(string) 442 if !ok { 443 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 444 } 445 sv.CreationTime = ptr.String(jtv) 446 } 447 448 case "parameterDefinitions": 449 if err := awsRestjson1_deserializeDocument__listOfParameterDefinition(&sv.ParameterDefinitions, value); err != nil { 450 return err 451 } 452 453 case "requiredCapabilities": 454 if err := awsRestjson1_deserializeDocument__listOfCapability(&sv.RequiredCapabilities, value); err != nil { 455 return err 456 } 457 458 case "resourcesSupported": 459 if value != nil { 460 jtv, ok := value.(bool) 461 if !ok { 462 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 463 } 464 sv.ResourcesSupported = jtv 465 } 466 467 case "semanticVersion": 468 if value != nil { 469 jtv, ok := value.(string) 470 if !ok { 471 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 472 } 473 sv.SemanticVersion = ptr.String(jtv) 474 } 475 476 case "sourceCodeArchiveUrl": 477 if value != nil { 478 jtv, ok := value.(string) 479 if !ok { 480 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 481 } 482 sv.SourceCodeArchiveUrl = ptr.String(jtv) 483 } 484 485 case "sourceCodeUrl": 486 if value != nil { 487 jtv, ok := value.(string) 488 if !ok { 489 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 490 } 491 sv.SourceCodeUrl = ptr.String(jtv) 492 } 493 494 case "templateUrl": 495 if value != nil { 496 jtv, ok := value.(string) 497 if !ok { 498 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 499 } 500 sv.TemplateUrl = ptr.String(jtv) 501 } 502 503 default: 504 _, _ = key, value 505 506 } 507 } 508 *v = sv 509 return nil 510} 511 512type awsRestjson1_deserializeOpCreateCloudFormationChangeSet struct { 513} 514 515func (*awsRestjson1_deserializeOpCreateCloudFormationChangeSet) ID() string { 516 return "OperationDeserializer" 517} 518 519func (m *awsRestjson1_deserializeOpCreateCloudFormationChangeSet) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 520 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 521) { 522 out, metadata, err = next.HandleDeserialize(ctx, in) 523 if err != nil { 524 return out, metadata, err 525 } 526 527 response, ok := out.RawResponse.(*smithyhttp.Response) 528 if !ok { 529 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 530 } 531 532 if response.StatusCode < 200 || response.StatusCode >= 300 { 533 return out, metadata, awsRestjson1_deserializeOpErrorCreateCloudFormationChangeSet(response, &metadata) 534 } 535 output := &CreateCloudFormationChangeSetOutput{} 536 out.Result = output 537 538 var buff [1024]byte 539 ringBuffer := smithyio.NewRingBuffer(buff[:]) 540 541 body := io.TeeReader(response.Body, ringBuffer) 542 543 decoder := json.NewDecoder(body) 544 decoder.UseNumber() 545 var shape interface{} 546 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 547 var snapshot bytes.Buffer 548 io.Copy(&snapshot, ringBuffer) 549 err = &smithy.DeserializationError{ 550 Err: fmt.Errorf("failed to decode response body, %w", err), 551 Snapshot: snapshot.Bytes(), 552 } 553 return out, metadata, err 554 } 555 556 err = awsRestjson1_deserializeOpDocumentCreateCloudFormationChangeSetOutput(&output, shape) 557 if err != nil { 558 var snapshot bytes.Buffer 559 io.Copy(&snapshot, ringBuffer) 560 return out, metadata, &smithy.DeserializationError{ 561 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 562 Snapshot: snapshot.Bytes(), 563 } 564 } 565 566 return out, metadata, err 567} 568 569func awsRestjson1_deserializeOpErrorCreateCloudFormationChangeSet(response *smithyhttp.Response, metadata *middleware.Metadata) error { 570 var errorBuffer bytes.Buffer 571 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 572 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 573 } 574 errorBody := bytes.NewReader(errorBuffer.Bytes()) 575 576 errorCode := "UnknownError" 577 errorMessage := errorCode 578 579 code := response.Header.Get("X-Amzn-ErrorType") 580 if len(code) != 0 { 581 errorCode = restjson.SanitizeErrorCode(code) 582 } 583 584 var buff [1024]byte 585 ringBuffer := smithyio.NewRingBuffer(buff[:]) 586 587 body := io.TeeReader(errorBody, ringBuffer) 588 decoder := json.NewDecoder(body) 589 decoder.UseNumber() 590 code, message, err := restjson.GetErrorInfo(decoder) 591 if err != nil { 592 var snapshot bytes.Buffer 593 io.Copy(&snapshot, ringBuffer) 594 err = &smithy.DeserializationError{ 595 Err: fmt.Errorf("failed to decode response body, %w", err), 596 Snapshot: snapshot.Bytes(), 597 } 598 return err 599 } 600 601 errorBody.Seek(0, io.SeekStart) 602 if len(code) != 0 { 603 errorCode = restjson.SanitizeErrorCode(code) 604 } 605 if len(message) != 0 { 606 errorMessage = message 607 } 608 609 switch { 610 case strings.EqualFold("BadRequestException", errorCode): 611 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 612 613 case strings.EqualFold("ForbiddenException", errorCode): 614 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 615 616 case strings.EqualFold("InternalServerErrorException", errorCode): 617 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 618 619 case strings.EqualFold("TooManyRequestsException", errorCode): 620 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 621 622 default: 623 genericError := &smithy.GenericAPIError{ 624 Code: errorCode, 625 Message: errorMessage, 626 } 627 return genericError 628 629 } 630} 631 632func awsRestjson1_deserializeOpDocumentCreateCloudFormationChangeSetOutput(v **CreateCloudFormationChangeSetOutput, value interface{}) error { 633 if v == nil { 634 return fmt.Errorf("unexpected nil of type %T", v) 635 } 636 if value == nil { 637 return nil 638 } 639 640 shape, ok := value.(map[string]interface{}) 641 if !ok { 642 return fmt.Errorf("unexpected JSON type %v", value) 643 } 644 645 var sv *CreateCloudFormationChangeSetOutput 646 if *v == nil { 647 sv = &CreateCloudFormationChangeSetOutput{} 648 } else { 649 sv = *v 650 } 651 652 for key, value := range shape { 653 switch key { 654 case "applicationId": 655 if value != nil { 656 jtv, ok := value.(string) 657 if !ok { 658 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 659 } 660 sv.ApplicationId = ptr.String(jtv) 661 } 662 663 case "changeSetId": 664 if value != nil { 665 jtv, ok := value.(string) 666 if !ok { 667 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 668 } 669 sv.ChangeSetId = ptr.String(jtv) 670 } 671 672 case "semanticVersion": 673 if value != nil { 674 jtv, ok := value.(string) 675 if !ok { 676 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 677 } 678 sv.SemanticVersion = ptr.String(jtv) 679 } 680 681 case "stackId": 682 if value != nil { 683 jtv, ok := value.(string) 684 if !ok { 685 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 686 } 687 sv.StackId = ptr.String(jtv) 688 } 689 690 default: 691 _, _ = key, value 692 693 } 694 } 695 *v = sv 696 return nil 697} 698 699type awsRestjson1_deserializeOpCreateCloudFormationTemplate struct { 700} 701 702func (*awsRestjson1_deserializeOpCreateCloudFormationTemplate) ID() string { 703 return "OperationDeserializer" 704} 705 706func (m *awsRestjson1_deserializeOpCreateCloudFormationTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 707 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 708) { 709 out, metadata, err = next.HandleDeserialize(ctx, in) 710 if err != nil { 711 return out, metadata, err 712 } 713 714 response, ok := out.RawResponse.(*smithyhttp.Response) 715 if !ok { 716 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 717 } 718 719 if response.StatusCode < 200 || response.StatusCode >= 300 { 720 return out, metadata, awsRestjson1_deserializeOpErrorCreateCloudFormationTemplate(response, &metadata) 721 } 722 output := &CreateCloudFormationTemplateOutput{} 723 out.Result = output 724 725 var buff [1024]byte 726 ringBuffer := smithyio.NewRingBuffer(buff[:]) 727 728 body := io.TeeReader(response.Body, ringBuffer) 729 730 decoder := json.NewDecoder(body) 731 decoder.UseNumber() 732 var shape interface{} 733 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 734 var snapshot bytes.Buffer 735 io.Copy(&snapshot, ringBuffer) 736 err = &smithy.DeserializationError{ 737 Err: fmt.Errorf("failed to decode response body, %w", err), 738 Snapshot: snapshot.Bytes(), 739 } 740 return out, metadata, err 741 } 742 743 err = awsRestjson1_deserializeOpDocumentCreateCloudFormationTemplateOutput(&output, shape) 744 if err != nil { 745 var snapshot bytes.Buffer 746 io.Copy(&snapshot, ringBuffer) 747 return out, metadata, &smithy.DeserializationError{ 748 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 749 Snapshot: snapshot.Bytes(), 750 } 751 } 752 753 return out, metadata, err 754} 755 756func awsRestjson1_deserializeOpErrorCreateCloudFormationTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { 757 var errorBuffer bytes.Buffer 758 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 759 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 760 } 761 errorBody := bytes.NewReader(errorBuffer.Bytes()) 762 763 errorCode := "UnknownError" 764 errorMessage := errorCode 765 766 code := response.Header.Get("X-Amzn-ErrorType") 767 if len(code) != 0 { 768 errorCode = restjson.SanitizeErrorCode(code) 769 } 770 771 var buff [1024]byte 772 ringBuffer := smithyio.NewRingBuffer(buff[:]) 773 774 body := io.TeeReader(errorBody, ringBuffer) 775 decoder := json.NewDecoder(body) 776 decoder.UseNumber() 777 code, message, err := restjson.GetErrorInfo(decoder) 778 if err != nil { 779 var snapshot bytes.Buffer 780 io.Copy(&snapshot, ringBuffer) 781 err = &smithy.DeserializationError{ 782 Err: fmt.Errorf("failed to decode response body, %w", err), 783 Snapshot: snapshot.Bytes(), 784 } 785 return err 786 } 787 788 errorBody.Seek(0, io.SeekStart) 789 if len(code) != 0 { 790 errorCode = restjson.SanitizeErrorCode(code) 791 } 792 if len(message) != 0 { 793 errorMessage = message 794 } 795 796 switch { 797 case strings.EqualFold("BadRequestException", errorCode): 798 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 799 800 case strings.EqualFold("ForbiddenException", errorCode): 801 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 802 803 case strings.EqualFold("InternalServerErrorException", errorCode): 804 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 805 806 case strings.EqualFold("NotFoundException", errorCode): 807 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 808 809 case strings.EqualFold("TooManyRequestsException", errorCode): 810 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 811 812 default: 813 genericError := &smithy.GenericAPIError{ 814 Code: errorCode, 815 Message: errorMessage, 816 } 817 return genericError 818 819 } 820} 821 822func awsRestjson1_deserializeOpDocumentCreateCloudFormationTemplateOutput(v **CreateCloudFormationTemplateOutput, value interface{}) error { 823 if v == nil { 824 return fmt.Errorf("unexpected nil of type %T", v) 825 } 826 if value == nil { 827 return nil 828 } 829 830 shape, ok := value.(map[string]interface{}) 831 if !ok { 832 return fmt.Errorf("unexpected JSON type %v", value) 833 } 834 835 var sv *CreateCloudFormationTemplateOutput 836 if *v == nil { 837 sv = &CreateCloudFormationTemplateOutput{} 838 } else { 839 sv = *v 840 } 841 842 for key, value := range shape { 843 switch key { 844 case "applicationId": 845 if value != nil { 846 jtv, ok := value.(string) 847 if !ok { 848 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 849 } 850 sv.ApplicationId = ptr.String(jtv) 851 } 852 853 case "creationTime": 854 if value != nil { 855 jtv, ok := value.(string) 856 if !ok { 857 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 858 } 859 sv.CreationTime = ptr.String(jtv) 860 } 861 862 case "expirationTime": 863 if value != nil { 864 jtv, ok := value.(string) 865 if !ok { 866 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 867 } 868 sv.ExpirationTime = ptr.String(jtv) 869 } 870 871 case "semanticVersion": 872 if value != nil { 873 jtv, ok := value.(string) 874 if !ok { 875 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 876 } 877 sv.SemanticVersion = ptr.String(jtv) 878 } 879 880 case "status": 881 if value != nil { 882 jtv, ok := value.(string) 883 if !ok { 884 return fmt.Errorf("expected Status to be of type string, got %T instead", value) 885 } 886 sv.Status = types.Status(jtv) 887 } 888 889 case "templateId": 890 if value != nil { 891 jtv, ok := value.(string) 892 if !ok { 893 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 894 } 895 sv.TemplateId = ptr.String(jtv) 896 } 897 898 case "templateUrl": 899 if value != nil { 900 jtv, ok := value.(string) 901 if !ok { 902 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 903 } 904 sv.TemplateUrl = ptr.String(jtv) 905 } 906 907 default: 908 _, _ = key, value 909 910 } 911 } 912 *v = sv 913 return nil 914} 915 916type awsRestjson1_deserializeOpDeleteApplication struct { 917} 918 919func (*awsRestjson1_deserializeOpDeleteApplication) ID() string { 920 return "OperationDeserializer" 921} 922 923func (m *awsRestjson1_deserializeOpDeleteApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 924 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 925) { 926 out, metadata, err = next.HandleDeserialize(ctx, in) 927 if err != nil { 928 return out, metadata, err 929 } 930 931 response, ok := out.RawResponse.(*smithyhttp.Response) 932 if !ok { 933 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 934 } 935 936 if response.StatusCode < 200 || response.StatusCode >= 300 { 937 return out, metadata, awsRestjson1_deserializeOpErrorDeleteApplication(response, &metadata) 938 } 939 output := &DeleteApplicationOutput{} 940 out.Result = output 941 942 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 943 return out, metadata, &smithy.DeserializationError{ 944 Err: fmt.Errorf("failed to discard response body, %w", err), 945 } 946 } 947 948 return out, metadata, err 949} 950 951func awsRestjson1_deserializeOpErrorDeleteApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 952 var errorBuffer bytes.Buffer 953 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 954 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 955 } 956 errorBody := bytes.NewReader(errorBuffer.Bytes()) 957 958 errorCode := "UnknownError" 959 errorMessage := errorCode 960 961 code := response.Header.Get("X-Amzn-ErrorType") 962 if len(code) != 0 { 963 errorCode = restjson.SanitizeErrorCode(code) 964 } 965 966 var buff [1024]byte 967 ringBuffer := smithyio.NewRingBuffer(buff[:]) 968 969 body := io.TeeReader(errorBody, ringBuffer) 970 decoder := json.NewDecoder(body) 971 decoder.UseNumber() 972 code, message, err := restjson.GetErrorInfo(decoder) 973 if err != nil { 974 var snapshot bytes.Buffer 975 io.Copy(&snapshot, ringBuffer) 976 err = &smithy.DeserializationError{ 977 Err: fmt.Errorf("failed to decode response body, %w", err), 978 Snapshot: snapshot.Bytes(), 979 } 980 return err 981 } 982 983 errorBody.Seek(0, io.SeekStart) 984 if len(code) != 0 { 985 errorCode = restjson.SanitizeErrorCode(code) 986 } 987 if len(message) != 0 { 988 errorMessage = message 989 } 990 991 switch { 992 case strings.EqualFold("BadRequestException", errorCode): 993 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 994 995 case strings.EqualFold("ConflictException", errorCode): 996 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 997 998 case strings.EqualFold("ForbiddenException", errorCode): 999 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1000 1001 case strings.EqualFold("InternalServerErrorException", errorCode): 1002 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1003 1004 case strings.EqualFold("NotFoundException", errorCode): 1005 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1006 1007 case strings.EqualFold("TooManyRequestsException", errorCode): 1008 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1009 1010 default: 1011 genericError := &smithy.GenericAPIError{ 1012 Code: errorCode, 1013 Message: errorMessage, 1014 } 1015 return genericError 1016 1017 } 1018} 1019 1020type awsRestjson1_deserializeOpGetApplication struct { 1021} 1022 1023func (*awsRestjson1_deserializeOpGetApplication) ID() string { 1024 return "OperationDeserializer" 1025} 1026 1027func (m *awsRestjson1_deserializeOpGetApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1028 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1029) { 1030 out, metadata, err = next.HandleDeserialize(ctx, in) 1031 if err != nil { 1032 return out, metadata, err 1033 } 1034 1035 response, ok := out.RawResponse.(*smithyhttp.Response) 1036 if !ok { 1037 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1038 } 1039 1040 if response.StatusCode < 200 || response.StatusCode >= 300 { 1041 return out, metadata, awsRestjson1_deserializeOpErrorGetApplication(response, &metadata) 1042 } 1043 output := &GetApplicationOutput{} 1044 out.Result = output 1045 1046 var buff [1024]byte 1047 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1048 1049 body := io.TeeReader(response.Body, ringBuffer) 1050 1051 decoder := json.NewDecoder(body) 1052 decoder.UseNumber() 1053 var shape interface{} 1054 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1055 var snapshot bytes.Buffer 1056 io.Copy(&snapshot, ringBuffer) 1057 err = &smithy.DeserializationError{ 1058 Err: fmt.Errorf("failed to decode response body, %w", err), 1059 Snapshot: snapshot.Bytes(), 1060 } 1061 return out, metadata, err 1062 } 1063 1064 err = awsRestjson1_deserializeOpDocumentGetApplicationOutput(&output, shape) 1065 if err != nil { 1066 var snapshot bytes.Buffer 1067 io.Copy(&snapshot, ringBuffer) 1068 return out, metadata, &smithy.DeserializationError{ 1069 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1070 Snapshot: snapshot.Bytes(), 1071 } 1072 } 1073 1074 return out, metadata, err 1075} 1076 1077func awsRestjson1_deserializeOpErrorGetApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1078 var errorBuffer bytes.Buffer 1079 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1080 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1081 } 1082 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1083 1084 errorCode := "UnknownError" 1085 errorMessage := errorCode 1086 1087 code := response.Header.Get("X-Amzn-ErrorType") 1088 if len(code) != 0 { 1089 errorCode = restjson.SanitizeErrorCode(code) 1090 } 1091 1092 var buff [1024]byte 1093 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1094 1095 body := io.TeeReader(errorBody, ringBuffer) 1096 decoder := json.NewDecoder(body) 1097 decoder.UseNumber() 1098 code, message, err := restjson.GetErrorInfo(decoder) 1099 if err != nil { 1100 var snapshot bytes.Buffer 1101 io.Copy(&snapshot, ringBuffer) 1102 err = &smithy.DeserializationError{ 1103 Err: fmt.Errorf("failed to decode response body, %w", err), 1104 Snapshot: snapshot.Bytes(), 1105 } 1106 return err 1107 } 1108 1109 errorBody.Seek(0, io.SeekStart) 1110 if len(code) != 0 { 1111 errorCode = restjson.SanitizeErrorCode(code) 1112 } 1113 if len(message) != 0 { 1114 errorMessage = message 1115 } 1116 1117 switch { 1118 case strings.EqualFold("BadRequestException", errorCode): 1119 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1120 1121 case strings.EqualFold("ForbiddenException", errorCode): 1122 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1123 1124 case strings.EqualFold("InternalServerErrorException", errorCode): 1125 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1126 1127 case strings.EqualFold("NotFoundException", errorCode): 1128 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1129 1130 case strings.EqualFold("TooManyRequestsException", errorCode): 1131 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1132 1133 default: 1134 genericError := &smithy.GenericAPIError{ 1135 Code: errorCode, 1136 Message: errorMessage, 1137 } 1138 return genericError 1139 1140 } 1141} 1142 1143func awsRestjson1_deserializeOpDocumentGetApplicationOutput(v **GetApplicationOutput, value interface{}) error { 1144 if v == nil { 1145 return fmt.Errorf("unexpected nil of type %T", v) 1146 } 1147 if value == nil { 1148 return nil 1149 } 1150 1151 shape, ok := value.(map[string]interface{}) 1152 if !ok { 1153 return fmt.Errorf("unexpected JSON type %v", value) 1154 } 1155 1156 var sv *GetApplicationOutput 1157 if *v == nil { 1158 sv = &GetApplicationOutput{} 1159 } else { 1160 sv = *v 1161 } 1162 1163 for key, value := range shape { 1164 switch key { 1165 case "applicationId": 1166 if value != nil { 1167 jtv, ok := value.(string) 1168 if !ok { 1169 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1170 } 1171 sv.ApplicationId = ptr.String(jtv) 1172 } 1173 1174 case "author": 1175 if value != nil { 1176 jtv, ok := value.(string) 1177 if !ok { 1178 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1179 } 1180 sv.Author = ptr.String(jtv) 1181 } 1182 1183 case "creationTime": 1184 if value != nil { 1185 jtv, ok := value.(string) 1186 if !ok { 1187 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1188 } 1189 sv.CreationTime = ptr.String(jtv) 1190 } 1191 1192 case "description": 1193 if value != nil { 1194 jtv, ok := value.(string) 1195 if !ok { 1196 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1197 } 1198 sv.Description = ptr.String(jtv) 1199 } 1200 1201 case "homePageUrl": 1202 if value != nil { 1203 jtv, ok := value.(string) 1204 if !ok { 1205 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1206 } 1207 sv.HomePageUrl = ptr.String(jtv) 1208 } 1209 1210 case "isVerifiedAuthor": 1211 if value != nil { 1212 jtv, ok := value.(bool) 1213 if !ok { 1214 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 1215 } 1216 sv.IsVerifiedAuthor = jtv 1217 } 1218 1219 case "labels": 1220 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Labels, value); err != nil { 1221 return err 1222 } 1223 1224 case "licenseUrl": 1225 if value != nil { 1226 jtv, ok := value.(string) 1227 if !ok { 1228 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1229 } 1230 sv.LicenseUrl = ptr.String(jtv) 1231 } 1232 1233 case "name": 1234 if value != nil { 1235 jtv, ok := value.(string) 1236 if !ok { 1237 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1238 } 1239 sv.Name = ptr.String(jtv) 1240 } 1241 1242 case "readmeUrl": 1243 if value != nil { 1244 jtv, ok := value.(string) 1245 if !ok { 1246 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1247 } 1248 sv.ReadmeUrl = ptr.String(jtv) 1249 } 1250 1251 case "spdxLicenseId": 1252 if value != nil { 1253 jtv, ok := value.(string) 1254 if !ok { 1255 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1256 } 1257 sv.SpdxLicenseId = ptr.String(jtv) 1258 } 1259 1260 case "verifiedAuthorUrl": 1261 if value != nil { 1262 jtv, ok := value.(string) 1263 if !ok { 1264 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1265 } 1266 sv.VerifiedAuthorUrl = ptr.String(jtv) 1267 } 1268 1269 case "version": 1270 if err := awsRestjson1_deserializeDocumentVersion(&sv.Version, value); err != nil { 1271 return err 1272 } 1273 1274 default: 1275 _, _ = key, value 1276 1277 } 1278 } 1279 *v = sv 1280 return nil 1281} 1282 1283type awsRestjson1_deserializeOpGetApplicationPolicy struct { 1284} 1285 1286func (*awsRestjson1_deserializeOpGetApplicationPolicy) ID() string { 1287 return "OperationDeserializer" 1288} 1289 1290func (m *awsRestjson1_deserializeOpGetApplicationPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1291 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1292) { 1293 out, metadata, err = next.HandleDeserialize(ctx, in) 1294 if err != nil { 1295 return out, metadata, err 1296 } 1297 1298 response, ok := out.RawResponse.(*smithyhttp.Response) 1299 if !ok { 1300 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1301 } 1302 1303 if response.StatusCode < 200 || response.StatusCode >= 300 { 1304 return out, metadata, awsRestjson1_deserializeOpErrorGetApplicationPolicy(response, &metadata) 1305 } 1306 output := &GetApplicationPolicyOutput{} 1307 out.Result = output 1308 1309 var buff [1024]byte 1310 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1311 1312 body := io.TeeReader(response.Body, ringBuffer) 1313 1314 decoder := json.NewDecoder(body) 1315 decoder.UseNumber() 1316 var shape interface{} 1317 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1318 var snapshot bytes.Buffer 1319 io.Copy(&snapshot, ringBuffer) 1320 err = &smithy.DeserializationError{ 1321 Err: fmt.Errorf("failed to decode response body, %w", err), 1322 Snapshot: snapshot.Bytes(), 1323 } 1324 return out, metadata, err 1325 } 1326 1327 err = awsRestjson1_deserializeOpDocumentGetApplicationPolicyOutput(&output, shape) 1328 if err != nil { 1329 var snapshot bytes.Buffer 1330 io.Copy(&snapshot, ringBuffer) 1331 return out, metadata, &smithy.DeserializationError{ 1332 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1333 Snapshot: snapshot.Bytes(), 1334 } 1335 } 1336 1337 return out, metadata, err 1338} 1339 1340func awsRestjson1_deserializeOpErrorGetApplicationPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1341 var errorBuffer bytes.Buffer 1342 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1343 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1344 } 1345 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1346 1347 errorCode := "UnknownError" 1348 errorMessage := errorCode 1349 1350 code := response.Header.Get("X-Amzn-ErrorType") 1351 if len(code) != 0 { 1352 errorCode = restjson.SanitizeErrorCode(code) 1353 } 1354 1355 var buff [1024]byte 1356 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1357 1358 body := io.TeeReader(errorBody, ringBuffer) 1359 decoder := json.NewDecoder(body) 1360 decoder.UseNumber() 1361 code, message, err := restjson.GetErrorInfo(decoder) 1362 if err != nil { 1363 var snapshot bytes.Buffer 1364 io.Copy(&snapshot, ringBuffer) 1365 err = &smithy.DeserializationError{ 1366 Err: fmt.Errorf("failed to decode response body, %w", err), 1367 Snapshot: snapshot.Bytes(), 1368 } 1369 return err 1370 } 1371 1372 errorBody.Seek(0, io.SeekStart) 1373 if len(code) != 0 { 1374 errorCode = restjson.SanitizeErrorCode(code) 1375 } 1376 if len(message) != 0 { 1377 errorMessage = message 1378 } 1379 1380 switch { 1381 case strings.EqualFold("BadRequestException", errorCode): 1382 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1383 1384 case strings.EqualFold("ForbiddenException", errorCode): 1385 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1386 1387 case strings.EqualFold("InternalServerErrorException", errorCode): 1388 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1389 1390 case strings.EqualFold("NotFoundException", errorCode): 1391 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1392 1393 case strings.EqualFold("TooManyRequestsException", errorCode): 1394 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1395 1396 default: 1397 genericError := &smithy.GenericAPIError{ 1398 Code: errorCode, 1399 Message: errorMessage, 1400 } 1401 return genericError 1402 1403 } 1404} 1405 1406func awsRestjson1_deserializeOpDocumentGetApplicationPolicyOutput(v **GetApplicationPolicyOutput, value interface{}) error { 1407 if v == nil { 1408 return fmt.Errorf("unexpected nil of type %T", v) 1409 } 1410 if value == nil { 1411 return nil 1412 } 1413 1414 shape, ok := value.(map[string]interface{}) 1415 if !ok { 1416 return fmt.Errorf("unexpected JSON type %v", value) 1417 } 1418 1419 var sv *GetApplicationPolicyOutput 1420 if *v == nil { 1421 sv = &GetApplicationPolicyOutput{} 1422 } else { 1423 sv = *v 1424 } 1425 1426 for key, value := range shape { 1427 switch key { 1428 case "statements": 1429 if err := awsRestjson1_deserializeDocument__listOfApplicationPolicyStatement(&sv.Statements, value); err != nil { 1430 return err 1431 } 1432 1433 default: 1434 _, _ = key, value 1435 1436 } 1437 } 1438 *v = sv 1439 return nil 1440} 1441 1442type awsRestjson1_deserializeOpGetCloudFormationTemplate struct { 1443} 1444 1445func (*awsRestjson1_deserializeOpGetCloudFormationTemplate) ID() string { 1446 return "OperationDeserializer" 1447} 1448 1449func (m *awsRestjson1_deserializeOpGetCloudFormationTemplate) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1450 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1451) { 1452 out, metadata, err = next.HandleDeserialize(ctx, in) 1453 if err != nil { 1454 return out, metadata, err 1455 } 1456 1457 response, ok := out.RawResponse.(*smithyhttp.Response) 1458 if !ok { 1459 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1460 } 1461 1462 if response.StatusCode < 200 || response.StatusCode >= 300 { 1463 return out, metadata, awsRestjson1_deserializeOpErrorGetCloudFormationTemplate(response, &metadata) 1464 } 1465 output := &GetCloudFormationTemplateOutput{} 1466 out.Result = output 1467 1468 var buff [1024]byte 1469 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1470 1471 body := io.TeeReader(response.Body, ringBuffer) 1472 1473 decoder := json.NewDecoder(body) 1474 decoder.UseNumber() 1475 var shape interface{} 1476 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1477 var snapshot bytes.Buffer 1478 io.Copy(&snapshot, ringBuffer) 1479 err = &smithy.DeserializationError{ 1480 Err: fmt.Errorf("failed to decode response body, %w", err), 1481 Snapshot: snapshot.Bytes(), 1482 } 1483 return out, metadata, err 1484 } 1485 1486 err = awsRestjson1_deserializeOpDocumentGetCloudFormationTemplateOutput(&output, shape) 1487 if err != nil { 1488 var snapshot bytes.Buffer 1489 io.Copy(&snapshot, ringBuffer) 1490 return out, metadata, &smithy.DeserializationError{ 1491 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1492 Snapshot: snapshot.Bytes(), 1493 } 1494 } 1495 1496 return out, metadata, err 1497} 1498 1499func awsRestjson1_deserializeOpErrorGetCloudFormationTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1500 var errorBuffer bytes.Buffer 1501 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1502 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1503 } 1504 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1505 1506 errorCode := "UnknownError" 1507 errorMessage := errorCode 1508 1509 code := response.Header.Get("X-Amzn-ErrorType") 1510 if len(code) != 0 { 1511 errorCode = restjson.SanitizeErrorCode(code) 1512 } 1513 1514 var buff [1024]byte 1515 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1516 1517 body := io.TeeReader(errorBody, ringBuffer) 1518 decoder := json.NewDecoder(body) 1519 decoder.UseNumber() 1520 code, message, err := restjson.GetErrorInfo(decoder) 1521 if err != nil { 1522 var snapshot bytes.Buffer 1523 io.Copy(&snapshot, ringBuffer) 1524 err = &smithy.DeserializationError{ 1525 Err: fmt.Errorf("failed to decode response body, %w", err), 1526 Snapshot: snapshot.Bytes(), 1527 } 1528 return err 1529 } 1530 1531 errorBody.Seek(0, io.SeekStart) 1532 if len(code) != 0 { 1533 errorCode = restjson.SanitizeErrorCode(code) 1534 } 1535 if len(message) != 0 { 1536 errorMessage = message 1537 } 1538 1539 switch { 1540 case strings.EqualFold("BadRequestException", errorCode): 1541 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1542 1543 case strings.EqualFold("ForbiddenException", errorCode): 1544 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1545 1546 case strings.EqualFold("InternalServerErrorException", errorCode): 1547 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1548 1549 case strings.EqualFold("NotFoundException", errorCode): 1550 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1551 1552 case strings.EqualFold("TooManyRequestsException", errorCode): 1553 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1554 1555 default: 1556 genericError := &smithy.GenericAPIError{ 1557 Code: errorCode, 1558 Message: errorMessage, 1559 } 1560 return genericError 1561 1562 } 1563} 1564 1565func awsRestjson1_deserializeOpDocumentGetCloudFormationTemplateOutput(v **GetCloudFormationTemplateOutput, value interface{}) error { 1566 if v == nil { 1567 return fmt.Errorf("unexpected nil of type %T", v) 1568 } 1569 if value == nil { 1570 return nil 1571 } 1572 1573 shape, ok := value.(map[string]interface{}) 1574 if !ok { 1575 return fmt.Errorf("unexpected JSON type %v", value) 1576 } 1577 1578 var sv *GetCloudFormationTemplateOutput 1579 if *v == nil { 1580 sv = &GetCloudFormationTemplateOutput{} 1581 } else { 1582 sv = *v 1583 } 1584 1585 for key, value := range shape { 1586 switch key { 1587 case "applicationId": 1588 if value != nil { 1589 jtv, ok := value.(string) 1590 if !ok { 1591 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1592 } 1593 sv.ApplicationId = ptr.String(jtv) 1594 } 1595 1596 case "creationTime": 1597 if value != nil { 1598 jtv, ok := value.(string) 1599 if !ok { 1600 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1601 } 1602 sv.CreationTime = ptr.String(jtv) 1603 } 1604 1605 case "expirationTime": 1606 if value != nil { 1607 jtv, ok := value.(string) 1608 if !ok { 1609 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1610 } 1611 sv.ExpirationTime = ptr.String(jtv) 1612 } 1613 1614 case "semanticVersion": 1615 if value != nil { 1616 jtv, ok := value.(string) 1617 if !ok { 1618 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1619 } 1620 sv.SemanticVersion = ptr.String(jtv) 1621 } 1622 1623 case "status": 1624 if value != nil { 1625 jtv, ok := value.(string) 1626 if !ok { 1627 return fmt.Errorf("expected Status to be of type string, got %T instead", value) 1628 } 1629 sv.Status = types.Status(jtv) 1630 } 1631 1632 case "templateId": 1633 if value != nil { 1634 jtv, ok := value.(string) 1635 if !ok { 1636 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1637 } 1638 sv.TemplateId = ptr.String(jtv) 1639 } 1640 1641 case "templateUrl": 1642 if value != nil { 1643 jtv, ok := value.(string) 1644 if !ok { 1645 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1646 } 1647 sv.TemplateUrl = ptr.String(jtv) 1648 } 1649 1650 default: 1651 _, _ = key, value 1652 1653 } 1654 } 1655 *v = sv 1656 return nil 1657} 1658 1659type awsRestjson1_deserializeOpListApplicationDependencies struct { 1660} 1661 1662func (*awsRestjson1_deserializeOpListApplicationDependencies) ID() string { 1663 return "OperationDeserializer" 1664} 1665 1666func (m *awsRestjson1_deserializeOpListApplicationDependencies) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1667 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1668) { 1669 out, metadata, err = next.HandleDeserialize(ctx, in) 1670 if err != nil { 1671 return out, metadata, err 1672 } 1673 1674 response, ok := out.RawResponse.(*smithyhttp.Response) 1675 if !ok { 1676 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1677 } 1678 1679 if response.StatusCode < 200 || response.StatusCode >= 300 { 1680 return out, metadata, awsRestjson1_deserializeOpErrorListApplicationDependencies(response, &metadata) 1681 } 1682 output := &ListApplicationDependenciesOutput{} 1683 out.Result = output 1684 1685 var buff [1024]byte 1686 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1687 1688 body := io.TeeReader(response.Body, ringBuffer) 1689 1690 decoder := json.NewDecoder(body) 1691 decoder.UseNumber() 1692 var shape interface{} 1693 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1694 var snapshot bytes.Buffer 1695 io.Copy(&snapshot, ringBuffer) 1696 err = &smithy.DeserializationError{ 1697 Err: fmt.Errorf("failed to decode response body, %w", err), 1698 Snapshot: snapshot.Bytes(), 1699 } 1700 return out, metadata, err 1701 } 1702 1703 err = awsRestjson1_deserializeOpDocumentListApplicationDependenciesOutput(&output, shape) 1704 if err != nil { 1705 var snapshot bytes.Buffer 1706 io.Copy(&snapshot, ringBuffer) 1707 return out, metadata, &smithy.DeserializationError{ 1708 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1709 Snapshot: snapshot.Bytes(), 1710 } 1711 } 1712 1713 return out, metadata, err 1714} 1715 1716func awsRestjson1_deserializeOpErrorListApplicationDependencies(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1717 var errorBuffer bytes.Buffer 1718 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1719 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1720 } 1721 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1722 1723 errorCode := "UnknownError" 1724 errorMessage := errorCode 1725 1726 code := response.Header.Get("X-Amzn-ErrorType") 1727 if len(code) != 0 { 1728 errorCode = restjson.SanitizeErrorCode(code) 1729 } 1730 1731 var buff [1024]byte 1732 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1733 1734 body := io.TeeReader(errorBody, ringBuffer) 1735 decoder := json.NewDecoder(body) 1736 decoder.UseNumber() 1737 code, message, err := restjson.GetErrorInfo(decoder) 1738 if err != nil { 1739 var snapshot bytes.Buffer 1740 io.Copy(&snapshot, ringBuffer) 1741 err = &smithy.DeserializationError{ 1742 Err: fmt.Errorf("failed to decode response body, %w", err), 1743 Snapshot: snapshot.Bytes(), 1744 } 1745 return err 1746 } 1747 1748 errorBody.Seek(0, io.SeekStart) 1749 if len(code) != 0 { 1750 errorCode = restjson.SanitizeErrorCode(code) 1751 } 1752 if len(message) != 0 { 1753 errorMessage = message 1754 } 1755 1756 switch { 1757 case strings.EqualFold("BadRequestException", errorCode): 1758 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1759 1760 case strings.EqualFold("ForbiddenException", errorCode): 1761 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1762 1763 case strings.EqualFold("InternalServerErrorException", errorCode): 1764 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1765 1766 case strings.EqualFold("NotFoundException", errorCode): 1767 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1768 1769 case strings.EqualFold("TooManyRequestsException", errorCode): 1770 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 1771 1772 default: 1773 genericError := &smithy.GenericAPIError{ 1774 Code: errorCode, 1775 Message: errorMessage, 1776 } 1777 return genericError 1778 1779 } 1780} 1781 1782func awsRestjson1_deserializeOpDocumentListApplicationDependenciesOutput(v **ListApplicationDependenciesOutput, value interface{}) error { 1783 if v == nil { 1784 return fmt.Errorf("unexpected nil of type %T", v) 1785 } 1786 if value == nil { 1787 return nil 1788 } 1789 1790 shape, ok := value.(map[string]interface{}) 1791 if !ok { 1792 return fmt.Errorf("unexpected JSON type %v", value) 1793 } 1794 1795 var sv *ListApplicationDependenciesOutput 1796 if *v == nil { 1797 sv = &ListApplicationDependenciesOutput{} 1798 } else { 1799 sv = *v 1800 } 1801 1802 for key, value := range shape { 1803 switch key { 1804 case "dependencies": 1805 if err := awsRestjson1_deserializeDocument__listOfApplicationDependencySummary(&sv.Dependencies, value); err != nil { 1806 return err 1807 } 1808 1809 case "nextToken": 1810 if value != nil { 1811 jtv, ok := value.(string) 1812 if !ok { 1813 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1814 } 1815 sv.NextToken = ptr.String(jtv) 1816 } 1817 1818 default: 1819 _, _ = key, value 1820 1821 } 1822 } 1823 *v = sv 1824 return nil 1825} 1826 1827type awsRestjson1_deserializeOpListApplications struct { 1828} 1829 1830func (*awsRestjson1_deserializeOpListApplications) ID() string { 1831 return "OperationDeserializer" 1832} 1833 1834func (m *awsRestjson1_deserializeOpListApplications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1835 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1836) { 1837 out, metadata, err = next.HandleDeserialize(ctx, in) 1838 if err != nil { 1839 return out, metadata, err 1840 } 1841 1842 response, ok := out.RawResponse.(*smithyhttp.Response) 1843 if !ok { 1844 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1845 } 1846 1847 if response.StatusCode < 200 || response.StatusCode >= 300 { 1848 return out, metadata, awsRestjson1_deserializeOpErrorListApplications(response, &metadata) 1849 } 1850 output := &ListApplicationsOutput{} 1851 out.Result = output 1852 1853 var buff [1024]byte 1854 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1855 1856 body := io.TeeReader(response.Body, ringBuffer) 1857 1858 decoder := json.NewDecoder(body) 1859 decoder.UseNumber() 1860 var shape interface{} 1861 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1862 var snapshot bytes.Buffer 1863 io.Copy(&snapshot, ringBuffer) 1864 err = &smithy.DeserializationError{ 1865 Err: fmt.Errorf("failed to decode response body, %w", err), 1866 Snapshot: snapshot.Bytes(), 1867 } 1868 return out, metadata, err 1869 } 1870 1871 err = awsRestjson1_deserializeOpDocumentListApplicationsOutput(&output, shape) 1872 if err != nil { 1873 var snapshot bytes.Buffer 1874 io.Copy(&snapshot, ringBuffer) 1875 return out, metadata, &smithy.DeserializationError{ 1876 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1877 Snapshot: snapshot.Bytes(), 1878 } 1879 } 1880 1881 return out, metadata, err 1882} 1883 1884func awsRestjson1_deserializeOpErrorListApplications(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1885 var errorBuffer bytes.Buffer 1886 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1887 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1888 } 1889 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1890 1891 errorCode := "UnknownError" 1892 errorMessage := errorCode 1893 1894 code := response.Header.Get("X-Amzn-ErrorType") 1895 if len(code) != 0 { 1896 errorCode = restjson.SanitizeErrorCode(code) 1897 } 1898 1899 var buff [1024]byte 1900 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1901 1902 body := io.TeeReader(errorBody, ringBuffer) 1903 decoder := json.NewDecoder(body) 1904 decoder.UseNumber() 1905 code, message, err := restjson.GetErrorInfo(decoder) 1906 if err != nil { 1907 var snapshot bytes.Buffer 1908 io.Copy(&snapshot, ringBuffer) 1909 err = &smithy.DeserializationError{ 1910 Err: fmt.Errorf("failed to decode response body, %w", err), 1911 Snapshot: snapshot.Bytes(), 1912 } 1913 return err 1914 } 1915 1916 errorBody.Seek(0, io.SeekStart) 1917 if len(code) != 0 { 1918 errorCode = restjson.SanitizeErrorCode(code) 1919 } 1920 if len(message) != 0 { 1921 errorMessage = message 1922 } 1923 1924 switch { 1925 case strings.EqualFold("BadRequestException", errorCode): 1926 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 1927 1928 case strings.EqualFold("ForbiddenException", errorCode): 1929 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 1930 1931 case strings.EqualFold("InternalServerErrorException", errorCode): 1932 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 1933 1934 case strings.EqualFold("NotFoundException", errorCode): 1935 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 1936 1937 default: 1938 genericError := &smithy.GenericAPIError{ 1939 Code: errorCode, 1940 Message: errorMessage, 1941 } 1942 return genericError 1943 1944 } 1945} 1946 1947func awsRestjson1_deserializeOpDocumentListApplicationsOutput(v **ListApplicationsOutput, value interface{}) error { 1948 if v == nil { 1949 return fmt.Errorf("unexpected nil of type %T", v) 1950 } 1951 if value == nil { 1952 return nil 1953 } 1954 1955 shape, ok := value.(map[string]interface{}) 1956 if !ok { 1957 return fmt.Errorf("unexpected JSON type %v", value) 1958 } 1959 1960 var sv *ListApplicationsOutput 1961 if *v == nil { 1962 sv = &ListApplicationsOutput{} 1963 } else { 1964 sv = *v 1965 } 1966 1967 for key, value := range shape { 1968 switch key { 1969 case "applications": 1970 if err := awsRestjson1_deserializeDocument__listOfApplicationSummary(&sv.Applications, value); err != nil { 1971 return err 1972 } 1973 1974 case "nextToken": 1975 if value != nil { 1976 jtv, ok := value.(string) 1977 if !ok { 1978 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 1979 } 1980 sv.NextToken = ptr.String(jtv) 1981 } 1982 1983 default: 1984 _, _ = key, value 1985 1986 } 1987 } 1988 *v = sv 1989 return nil 1990} 1991 1992type awsRestjson1_deserializeOpListApplicationVersions struct { 1993} 1994 1995func (*awsRestjson1_deserializeOpListApplicationVersions) ID() string { 1996 return "OperationDeserializer" 1997} 1998 1999func (m *awsRestjson1_deserializeOpListApplicationVersions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2000 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2001) { 2002 out, metadata, err = next.HandleDeserialize(ctx, in) 2003 if err != nil { 2004 return out, metadata, err 2005 } 2006 2007 response, ok := out.RawResponse.(*smithyhttp.Response) 2008 if !ok { 2009 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2010 } 2011 2012 if response.StatusCode < 200 || response.StatusCode >= 300 { 2013 return out, metadata, awsRestjson1_deserializeOpErrorListApplicationVersions(response, &metadata) 2014 } 2015 output := &ListApplicationVersionsOutput{} 2016 out.Result = output 2017 2018 var buff [1024]byte 2019 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2020 2021 body := io.TeeReader(response.Body, ringBuffer) 2022 2023 decoder := json.NewDecoder(body) 2024 decoder.UseNumber() 2025 var shape interface{} 2026 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2027 var snapshot bytes.Buffer 2028 io.Copy(&snapshot, ringBuffer) 2029 err = &smithy.DeserializationError{ 2030 Err: fmt.Errorf("failed to decode response body, %w", err), 2031 Snapshot: snapshot.Bytes(), 2032 } 2033 return out, metadata, err 2034 } 2035 2036 err = awsRestjson1_deserializeOpDocumentListApplicationVersionsOutput(&output, shape) 2037 if err != nil { 2038 var snapshot bytes.Buffer 2039 io.Copy(&snapshot, ringBuffer) 2040 return out, metadata, &smithy.DeserializationError{ 2041 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2042 Snapshot: snapshot.Bytes(), 2043 } 2044 } 2045 2046 return out, metadata, err 2047} 2048 2049func awsRestjson1_deserializeOpErrorListApplicationVersions(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2050 var errorBuffer bytes.Buffer 2051 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2052 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2053 } 2054 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2055 2056 errorCode := "UnknownError" 2057 errorMessage := errorCode 2058 2059 code := response.Header.Get("X-Amzn-ErrorType") 2060 if len(code) != 0 { 2061 errorCode = restjson.SanitizeErrorCode(code) 2062 } 2063 2064 var buff [1024]byte 2065 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2066 2067 body := io.TeeReader(errorBody, ringBuffer) 2068 decoder := json.NewDecoder(body) 2069 decoder.UseNumber() 2070 code, message, err := restjson.GetErrorInfo(decoder) 2071 if err != nil { 2072 var snapshot bytes.Buffer 2073 io.Copy(&snapshot, ringBuffer) 2074 err = &smithy.DeserializationError{ 2075 Err: fmt.Errorf("failed to decode response body, %w", err), 2076 Snapshot: snapshot.Bytes(), 2077 } 2078 return err 2079 } 2080 2081 errorBody.Seek(0, io.SeekStart) 2082 if len(code) != 0 { 2083 errorCode = restjson.SanitizeErrorCode(code) 2084 } 2085 if len(message) != 0 { 2086 errorMessage = message 2087 } 2088 2089 switch { 2090 case strings.EqualFold("BadRequestException", errorCode): 2091 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2092 2093 case strings.EqualFold("ForbiddenException", errorCode): 2094 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2095 2096 case strings.EqualFold("InternalServerErrorException", errorCode): 2097 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2098 2099 case strings.EqualFold("NotFoundException", errorCode): 2100 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2101 2102 case strings.EqualFold("TooManyRequestsException", errorCode): 2103 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2104 2105 default: 2106 genericError := &smithy.GenericAPIError{ 2107 Code: errorCode, 2108 Message: errorMessage, 2109 } 2110 return genericError 2111 2112 } 2113} 2114 2115func awsRestjson1_deserializeOpDocumentListApplicationVersionsOutput(v **ListApplicationVersionsOutput, value interface{}) error { 2116 if v == nil { 2117 return fmt.Errorf("unexpected nil of type %T", v) 2118 } 2119 if value == nil { 2120 return nil 2121 } 2122 2123 shape, ok := value.(map[string]interface{}) 2124 if !ok { 2125 return fmt.Errorf("unexpected JSON type %v", value) 2126 } 2127 2128 var sv *ListApplicationVersionsOutput 2129 if *v == nil { 2130 sv = &ListApplicationVersionsOutput{} 2131 } else { 2132 sv = *v 2133 } 2134 2135 for key, value := range shape { 2136 switch key { 2137 case "nextToken": 2138 if value != nil { 2139 jtv, ok := value.(string) 2140 if !ok { 2141 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2142 } 2143 sv.NextToken = ptr.String(jtv) 2144 } 2145 2146 case "versions": 2147 if err := awsRestjson1_deserializeDocument__listOfVersionSummary(&sv.Versions, value); err != nil { 2148 return err 2149 } 2150 2151 default: 2152 _, _ = key, value 2153 2154 } 2155 } 2156 *v = sv 2157 return nil 2158} 2159 2160type awsRestjson1_deserializeOpPutApplicationPolicy struct { 2161} 2162 2163func (*awsRestjson1_deserializeOpPutApplicationPolicy) ID() string { 2164 return "OperationDeserializer" 2165} 2166 2167func (m *awsRestjson1_deserializeOpPutApplicationPolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2168 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2169) { 2170 out, metadata, err = next.HandleDeserialize(ctx, in) 2171 if err != nil { 2172 return out, metadata, err 2173 } 2174 2175 response, ok := out.RawResponse.(*smithyhttp.Response) 2176 if !ok { 2177 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2178 } 2179 2180 if response.StatusCode < 200 || response.StatusCode >= 300 { 2181 return out, metadata, awsRestjson1_deserializeOpErrorPutApplicationPolicy(response, &metadata) 2182 } 2183 output := &PutApplicationPolicyOutput{} 2184 out.Result = output 2185 2186 var buff [1024]byte 2187 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2188 2189 body := io.TeeReader(response.Body, ringBuffer) 2190 2191 decoder := json.NewDecoder(body) 2192 decoder.UseNumber() 2193 var shape interface{} 2194 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2195 var snapshot bytes.Buffer 2196 io.Copy(&snapshot, ringBuffer) 2197 err = &smithy.DeserializationError{ 2198 Err: fmt.Errorf("failed to decode response body, %w", err), 2199 Snapshot: snapshot.Bytes(), 2200 } 2201 return out, metadata, err 2202 } 2203 2204 err = awsRestjson1_deserializeOpDocumentPutApplicationPolicyOutput(&output, shape) 2205 if err != nil { 2206 var snapshot bytes.Buffer 2207 io.Copy(&snapshot, ringBuffer) 2208 return out, metadata, &smithy.DeserializationError{ 2209 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2210 Snapshot: snapshot.Bytes(), 2211 } 2212 } 2213 2214 return out, metadata, err 2215} 2216 2217func awsRestjson1_deserializeOpErrorPutApplicationPolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2218 var errorBuffer bytes.Buffer 2219 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2220 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2221 } 2222 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2223 2224 errorCode := "UnknownError" 2225 errorMessage := errorCode 2226 2227 code := response.Header.Get("X-Amzn-ErrorType") 2228 if len(code) != 0 { 2229 errorCode = restjson.SanitizeErrorCode(code) 2230 } 2231 2232 var buff [1024]byte 2233 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2234 2235 body := io.TeeReader(errorBody, ringBuffer) 2236 decoder := json.NewDecoder(body) 2237 decoder.UseNumber() 2238 code, message, err := restjson.GetErrorInfo(decoder) 2239 if err != nil { 2240 var snapshot bytes.Buffer 2241 io.Copy(&snapshot, ringBuffer) 2242 err = &smithy.DeserializationError{ 2243 Err: fmt.Errorf("failed to decode response body, %w", err), 2244 Snapshot: snapshot.Bytes(), 2245 } 2246 return err 2247 } 2248 2249 errorBody.Seek(0, io.SeekStart) 2250 if len(code) != 0 { 2251 errorCode = restjson.SanitizeErrorCode(code) 2252 } 2253 if len(message) != 0 { 2254 errorMessage = message 2255 } 2256 2257 switch { 2258 case strings.EqualFold("BadRequestException", errorCode): 2259 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2260 2261 case strings.EqualFold("ForbiddenException", errorCode): 2262 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2263 2264 case strings.EqualFold("InternalServerErrorException", errorCode): 2265 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2266 2267 case strings.EqualFold("NotFoundException", errorCode): 2268 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2269 2270 case strings.EqualFold("TooManyRequestsException", errorCode): 2271 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2272 2273 default: 2274 genericError := &smithy.GenericAPIError{ 2275 Code: errorCode, 2276 Message: errorMessage, 2277 } 2278 return genericError 2279 2280 } 2281} 2282 2283func awsRestjson1_deserializeOpDocumentPutApplicationPolicyOutput(v **PutApplicationPolicyOutput, value interface{}) error { 2284 if v == nil { 2285 return fmt.Errorf("unexpected nil of type %T", v) 2286 } 2287 if value == nil { 2288 return nil 2289 } 2290 2291 shape, ok := value.(map[string]interface{}) 2292 if !ok { 2293 return fmt.Errorf("unexpected JSON type %v", value) 2294 } 2295 2296 var sv *PutApplicationPolicyOutput 2297 if *v == nil { 2298 sv = &PutApplicationPolicyOutput{} 2299 } else { 2300 sv = *v 2301 } 2302 2303 for key, value := range shape { 2304 switch key { 2305 case "statements": 2306 if err := awsRestjson1_deserializeDocument__listOfApplicationPolicyStatement(&sv.Statements, value); err != nil { 2307 return err 2308 } 2309 2310 default: 2311 _, _ = key, value 2312 2313 } 2314 } 2315 *v = sv 2316 return nil 2317} 2318 2319type awsRestjson1_deserializeOpUnshareApplication struct { 2320} 2321 2322func (*awsRestjson1_deserializeOpUnshareApplication) ID() string { 2323 return "OperationDeserializer" 2324} 2325 2326func (m *awsRestjson1_deserializeOpUnshareApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2327 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2328) { 2329 out, metadata, err = next.HandleDeserialize(ctx, in) 2330 if err != nil { 2331 return out, metadata, err 2332 } 2333 2334 response, ok := out.RawResponse.(*smithyhttp.Response) 2335 if !ok { 2336 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2337 } 2338 2339 if response.StatusCode < 200 || response.StatusCode >= 300 { 2340 return out, metadata, awsRestjson1_deserializeOpErrorUnshareApplication(response, &metadata) 2341 } 2342 output := &UnshareApplicationOutput{} 2343 out.Result = output 2344 2345 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2346 return out, metadata, &smithy.DeserializationError{ 2347 Err: fmt.Errorf("failed to discard response body, %w", err), 2348 } 2349 } 2350 2351 return out, metadata, err 2352} 2353 2354func awsRestjson1_deserializeOpErrorUnshareApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2355 var errorBuffer bytes.Buffer 2356 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2357 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2358 } 2359 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2360 2361 errorCode := "UnknownError" 2362 errorMessage := errorCode 2363 2364 code := response.Header.Get("X-Amzn-ErrorType") 2365 if len(code) != 0 { 2366 errorCode = restjson.SanitizeErrorCode(code) 2367 } 2368 2369 var buff [1024]byte 2370 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2371 2372 body := io.TeeReader(errorBody, ringBuffer) 2373 decoder := json.NewDecoder(body) 2374 decoder.UseNumber() 2375 code, message, err := restjson.GetErrorInfo(decoder) 2376 if err != nil { 2377 var snapshot bytes.Buffer 2378 io.Copy(&snapshot, ringBuffer) 2379 err = &smithy.DeserializationError{ 2380 Err: fmt.Errorf("failed to decode response body, %w", err), 2381 Snapshot: snapshot.Bytes(), 2382 } 2383 return err 2384 } 2385 2386 errorBody.Seek(0, io.SeekStart) 2387 if len(code) != 0 { 2388 errorCode = restjson.SanitizeErrorCode(code) 2389 } 2390 if len(message) != 0 { 2391 errorMessage = message 2392 } 2393 2394 switch { 2395 case strings.EqualFold("BadRequestException", errorCode): 2396 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2397 2398 case strings.EqualFold("ForbiddenException", errorCode): 2399 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2400 2401 case strings.EqualFold("InternalServerErrorException", errorCode): 2402 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2403 2404 case strings.EqualFold("NotFoundException", errorCode): 2405 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2406 2407 case strings.EqualFold("TooManyRequestsException", errorCode): 2408 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2409 2410 default: 2411 genericError := &smithy.GenericAPIError{ 2412 Code: errorCode, 2413 Message: errorMessage, 2414 } 2415 return genericError 2416 2417 } 2418} 2419 2420type awsRestjson1_deserializeOpUpdateApplication struct { 2421} 2422 2423func (*awsRestjson1_deserializeOpUpdateApplication) ID() string { 2424 return "OperationDeserializer" 2425} 2426 2427func (m *awsRestjson1_deserializeOpUpdateApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2428 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2429) { 2430 out, metadata, err = next.HandleDeserialize(ctx, in) 2431 if err != nil { 2432 return out, metadata, err 2433 } 2434 2435 response, ok := out.RawResponse.(*smithyhttp.Response) 2436 if !ok { 2437 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2438 } 2439 2440 if response.StatusCode < 200 || response.StatusCode >= 300 { 2441 return out, metadata, awsRestjson1_deserializeOpErrorUpdateApplication(response, &metadata) 2442 } 2443 output := &UpdateApplicationOutput{} 2444 out.Result = output 2445 2446 var buff [1024]byte 2447 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2448 2449 body := io.TeeReader(response.Body, ringBuffer) 2450 2451 decoder := json.NewDecoder(body) 2452 decoder.UseNumber() 2453 var shape interface{} 2454 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2455 var snapshot bytes.Buffer 2456 io.Copy(&snapshot, ringBuffer) 2457 err = &smithy.DeserializationError{ 2458 Err: fmt.Errorf("failed to decode response body, %w", err), 2459 Snapshot: snapshot.Bytes(), 2460 } 2461 return out, metadata, err 2462 } 2463 2464 err = awsRestjson1_deserializeOpDocumentUpdateApplicationOutput(&output, shape) 2465 if err != nil { 2466 var snapshot bytes.Buffer 2467 io.Copy(&snapshot, ringBuffer) 2468 return out, metadata, &smithy.DeserializationError{ 2469 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2470 Snapshot: snapshot.Bytes(), 2471 } 2472 } 2473 2474 return out, metadata, err 2475} 2476 2477func awsRestjson1_deserializeOpErrorUpdateApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2478 var errorBuffer bytes.Buffer 2479 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2480 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2481 } 2482 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2483 2484 errorCode := "UnknownError" 2485 errorMessage := errorCode 2486 2487 code := response.Header.Get("X-Amzn-ErrorType") 2488 if len(code) != 0 { 2489 errorCode = restjson.SanitizeErrorCode(code) 2490 } 2491 2492 var buff [1024]byte 2493 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2494 2495 body := io.TeeReader(errorBody, ringBuffer) 2496 decoder := json.NewDecoder(body) 2497 decoder.UseNumber() 2498 code, message, err := restjson.GetErrorInfo(decoder) 2499 if err != nil { 2500 var snapshot bytes.Buffer 2501 io.Copy(&snapshot, ringBuffer) 2502 err = &smithy.DeserializationError{ 2503 Err: fmt.Errorf("failed to decode response body, %w", err), 2504 Snapshot: snapshot.Bytes(), 2505 } 2506 return err 2507 } 2508 2509 errorBody.Seek(0, io.SeekStart) 2510 if len(code) != 0 { 2511 errorCode = restjson.SanitizeErrorCode(code) 2512 } 2513 if len(message) != 0 { 2514 errorMessage = message 2515 } 2516 2517 switch { 2518 case strings.EqualFold("BadRequestException", errorCode): 2519 return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) 2520 2521 case strings.EqualFold("ConflictException", errorCode): 2522 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2523 2524 case strings.EqualFold("ForbiddenException", errorCode): 2525 return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) 2526 2527 case strings.EqualFold("InternalServerErrorException", errorCode): 2528 return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) 2529 2530 case strings.EqualFold("NotFoundException", errorCode): 2531 return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) 2532 2533 case strings.EqualFold("TooManyRequestsException", errorCode): 2534 return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) 2535 2536 default: 2537 genericError := &smithy.GenericAPIError{ 2538 Code: errorCode, 2539 Message: errorMessage, 2540 } 2541 return genericError 2542 2543 } 2544} 2545 2546func awsRestjson1_deserializeOpDocumentUpdateApplicationOutput(v **UpdateApplicationOutput, value interface{}) error { 2547 if v == nil { 2548 return fmt.Errorf("unexpected nil of type %T", v) 2549 } 2550 if value == nil { 2551 return nil 2552 } 2553 2554 shape, ok := value.(map[string]interface{}) 2555 if !ok { 2556 return fmt.Errorf("unexpected JSON type %v", value) 2557 } 2558 2559 var sv *UpdateApplicationOutput 2560 if *v == nil { 2561 sv = &UpdateApplicationOutput{} 2562 } else { 2563 sv = *v 2564 } 2565 2566 for key, value := range shape { 2567 switch key { 2568 case "applicationId": 2569 if value != nil { 2570 jtv, ok := value.(string) 2571 if !ok { 2572 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2573 } 2574 sv.ApplicationId = ptr.String(jtv) 2575 } 2576 2577 case "author": 2578 if value != nil { 2579 jtv, ok := value.(string) 2580 if !ok { 2581 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2582 } 2583 sv.Author = ptr.String(jtv) 2584 } 2585 2586 case "creationTime": 2587 if value != nil { 2588 jtv, ok := value.(string) 2589 if !ok { 2590 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2591 } 2592 sv.CreationTime = ptr.String(jtv) 2593 } 2594 2595 case "description": 2596 if value != nil { 2597 jtv, ok := value.(string) 2598 if !ok { 2599 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2600 } 2601 sv.Description = ptr.String(jtv) 2602 } 2603 2604 case "homePageUrl": 2605 if value != nil { 2606 jtv, ok := value.(string) 2607 if !ok { 2608 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2609 } 2610 sv.HomePageUrl = ptr.String(jtv) 2611 } 2612 2613 case "isVerifiedAuthor": 2614 if value != nil { 2615 jtv, ok := value.(bool) 2616 if !ok { 2617 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 2618 } 2619 sv.IsVerifiedAuthor = jtv 2620 } 2621 2622 case "labels": 2623 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Labels, value); err != nil { 2624 return err 2625 } 2626 2627 case "licenseUrl": 2628 if value != nil { 2629 jtv, ok := value.(string) 2630 if !ok { 2631 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2632 } 2633 sv.LicenseUrl = ptr.String(jtv) 2634 } 2635 2636 case "name": 2637 if value != nil { 2638 jtv, ok := value.(string) 2639 if !ok { 2640 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2641 } 2642 sv.Name = ptr.String(jtv) 2643 } 2644 2645 case "readmeUrl": 2646 if value != nil { 2647 jtv, ok := value.(string) 2648 if !ok { 2649 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2650 } 2651 sv.ReadmeUrl = ptr.String(jtv) 2652 } 2653 2654 case "spdxLicenseId": 2655 if value != nil { 2656 jtv, ok := value.(string) 2657 if !ok { 2658 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2659 } 2660 sv.SpdxLicenseId = ptr.String(jtv) 2661 } 2662 2663 case "verifiedAuthorUrl": 2664 if value != nil { 2665 jtv, ok := value.(string) 2666 if !ok { 2667 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2668 } 2669 sv.VerifiedAuthorUrl = ptr.String(jtv) 2670 } 2671 2672 case "version": 2673 if err := awsRestjson1_deserializeDocumentVersion(&sv.Version, value); err != nil { 2674 return err 2675 } 2676 2677 default: 2678 _, _ = key, value 2679 2680 } 2681 } 2682 *v = sv 2683 return nil 2684} 2685 2686func awsRestjson1_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2687 output := &types.BadRequestException{} 2688 var buff [1024]byte 2689 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2690 2691 body := io.TeeReader(errorBody, ringBuffer) 2692 decoder := json.NewDecoder(body) 2693 decoder.UseNumber() 2694 var shape interface{} 2695 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2696 var snapshot bytes.Buffer 2697 io.Copy(&snapshot, ringBuffer) 2698 err = &smithy.DeserializationError{ 2699 Err: fmt.Errorf("failed to decode response body, %w", err), 2700 Snapshot: snapshot.Bytes(), 2701 } 2702 return err 2703 } 2704 2705 err := awsRestjson1_deserializeDocumentBadRequestException(&output, shape) 2706 2707 if err != nil { 2708 var snapshot bytes.Buffer 2709 io.Copy(&snapshot, ringBuffer) 2710 err = &smithy.DeserializationError{ 2711 Err: fmt.Errorf("failed to decode response body, %w", err), 2712 Snapshot: snapshot.Bytes(), 2713 } 2714 return err 2715 } 2716 2717 errorBody.Seek(0, io.SeekStart) 2718 2719 return output 2720} 2721 2722func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2723 output := &types.ConflictException{} 2724 var buff [1024]byte 2725 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2726 2727 body := io.TeeReader(errorBody, ringBuffer) 2728 decoder := json.NewDecoder(body) 2729 decoder.UseNumber() 2730 var shape interface{} 2731 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2732 var snapshot bytes.Buffer 2733 io.Copy(&snapshot, ringBuffer) 2734 err = &smithy.DeserializationError{ 2735 Err: fmt.Errorf("failed to decode response body, %w", err), 2736 Snapshot: snapshot.Bytes(), 2737 } 2738 return err 2739 } 2740 2741 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 2742 2743 if err != nil { 2744 var snapshot bytes.Buffer 2745 io.Copy(&snapshot, ringBuffer) 2746 err = &smithy.DeserializationError{ 2747 Err: fmt.Errorf("failed to decode response body, %w", err), 2748 Snapshot: snapshot.Bytes(), 2749 } 2750 return err 2751 } 2752 2753 errorBody.Seek(0, io.SeekStart) 2754 2755 return output 2756} 2757 2758func awsRestjson1_deserializeErrorForbiddenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2759 output := &types.ForbiddenException{} 2760 var buff [1024]byte 2761 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2762 2763 body := io.TeeReader(errorBody, ringBuffer) 2764 decoder := json.NewDecoder(body) 2765 decoder.UseNumber() 2766 var shape interface{} 2767 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2768 var snapshot bytes.Buffer 2769 io.Copy(&snapshot, ringBuffer) 2770 err = &smithy.DeserializationError{ 2771 Err: fmt.Errorf("failed to decode response body, %w", err), 2772 Snapshot: snapshot.Bytes(), 2773 } 2774 return err 2775 } 2776 2777 err := awsRestjson1_deserializeDocumentForbiddenException(&output, shape) 2778 2779 if err != nil { 2780 var snapshot bytes.Buffer 2781 io.Copy(&snapshot, ringBuffer) 2782 err = &smithy.DeserializationError{ 2783 Err: fmt.Errorf("failed to decode response body, %w", err), 2784 Snapshot: snapshot.Bytes(), 2785 } 2786 return err 2787 } 2788 2789 errorBody.Seek(0, io.SeekStart) 2790 2791 return output 2792} 2793 2794func awsRestjson1_deserializeErrorInternalServerErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2795 output := &types.InternalServerErrorException{} 2796 var buff [1024]byte 2797 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2798 2799 body := io.TeeReader(errorBody, ringBuffer) 2800 decoder := json.NewDecoder(body) 2801 decoder.UseNumber() 2802 var shape interface{} 2803 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2804 var snapshot bytes.Buffer 2805 io.Copy(&snapshot, ringBuffer) 2806 err = &smithy.DeserializationError{ 2807 Err: fmt.Errorf("failed to decode response body, %w", err), 2808 Snapshot: snapshot.Bytes(), 2809 } 2810 return err 2811 } 2812 2813 err := awsRestjson1_deserializeDocumentInternalServerErrorException(&output, shape) 2814 2815 if err != nil { 2816 var snapshot bytes.Buffer 2817 io.Copy(&snapshot, ringBuffer) 2818 err = &smithy.DeserializationError{ 2819 Err: fmt.Errorf("failed to decode response body, %w", err), 2820 Snapshot: snapshot.Bytes(), 2821 } 2822 return err 2823 } 2824 2825 errorBody.Seek(0, io.SeekStart) 2826 2827 return output 2828} 2829 2830func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2831 output := &types.NotFoundException{} 2832 var buff [1024]byte 2833 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2834 2835 body := io.TeeReader(errorBody, ringBuffer) 2836 decoder := json.NewDecoder(body) 2837 decoder.UseNumber() 2838 var shape interface{} 2839 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2840 var snapshot bytes.Buffer 2841 io.Copy(&snapshot, ringBuffer) 2842 err = &smithy.DeserializationError{ 2843 Err: fmt.Errorf("failed to decode response body, %w", err), 2844 Snapshot: snapshot.Bytes(), 2845 } 2846 return err 2847 } 2848 2849 err := awsRestjson1_deserializeDocumentNotFoundException(&output, shape) 2850 2851 if err != nil { 2852 var snapshot bytes.Buffer 2853 io.Copy(&snapshot, ringBuffer) 2854 err = &smithy.DeserializationError{ 2855 Err: fmt.Errorf("failed to decode response body, %w", err), 2856 Snapshot: snapshot.Bytes(), 2857 } 2858 return err 2859 } 2860 2861 errorBody.Seek(0, io.SeekStart) 2862 2863 return output 2864} 2865 2866func awsRestjson1_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 2867 output := &types.TooManyRequestsException{} 2868 var buff [1024]byte 2869 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2870 2871 body := io.TeeReader(errorBody, ringBuffer) 2872 decoder := json.NewDecoder(body) 2873 decoder.UseNumber() 2874 var shape interface{} 2875 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2876 var snapshot bytes.Buffer 2877 io.Copy(&snapshot, ringBuffer) 2878 err = &smithy.DeserializationError{ 2879 Err: fmt.Errorf("failed to decode response body, %w", err), 2880 Snapshot: snapshot.Bytes(), 2881 } 2882 return err 2883 } 2884 2885 err := awsRestjson1_deserializeDocumentTooManyRequestsException(&output, shape) 2886 2887 if err != nil { 2888 var snapshot bytes.Buffer 2889 io.Copy(&snapshot, ringBuffer) 2890 err = &smithy.DeserializationError{ 2891 Err: fmt.Errorf("failed to decode response body, %w", err), 2892 Snapshot: snapshot.Bytes(), 2893 } 2894 return err 2895 } 2896 2897 errorBody.Seek(0, io.SeekStart) 2898 2899 return output 2900} 2901 2902func awsRestjson1_deserializeDocument__listOf__string(v *[]string, value interface{}) error { 2903 if v == nil { 2904 return fmt.Errorf("unexpected nil of type %T", v) 2905 } 2906 if value == nil { 2907 return nil 2908 } 2909 2910 shape, ok := value.([]interface{}) 2911 if !ok { 2912 return fmt.Errorf("unexpected JSON type %v", value) 2913 } 2914 2915 var cv []string 2916 if *v == nil { 2917 cv = []string{} 2918 } else { 2919 cv = *v 2920 } 2921 2922 for _, value := range shape { 2923 var col string 2924 if value != nil { 2925 jtv, ok := value.(string) 2926 if !ok { 2927 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 2928 } 2929 col = jtv 2930 } 2931 cv = append(cv, col) 2932 2933 } 2934 *v = cv 2935 return nil 2936} 2937 2938func awsRestjson1_deserializeDocument__listOfApplicationDependencySummary(v *[]types.ApplicationDependencySummary, value interface{}) error { 2939 if v == nil { 2940 return fmt.Errorf("unexpected nil of type %T", v) 2941 } 2942 if value == nil { 2943 return nil 2944 } 2945 2946 shape, ok := value.([]interface{}) 2947 if !ok { 2948 return fmt.Errorf("unexpected JSON type %v", value) 2949 } 2950 2951 var cv []types.ApplicationDependencySummary 2952 if *v == nil { 2953 cv = []types.ApplicationDependencySummary{} 2954 } else { 2955 cv = *v 2956 } 2957 2958 for _, value := range shape { 2959 var col types.ApplicationDependencySummary 2960 destAddr := &col 2961 if err := awsRestjson1_deserializeDocumentApplicationDependencySummary(&destAddr, value); err != nil { 2962 return err 2963 } 2964 col = *destAddr 2965 cv = append(cv, col) 2966 2967 } 2968 *v = cv 2969 return nil 2970} 2971 2972func awsRestjson1_deserializeDocument__listOfApplicationPolicyStatement(v *[]types.ApplicationPolicyStatement, value interface{}) error { 2973 if v == nil { 2974 return fmt.Errorf("unexpected nil of type %T", v) 2975 } 2976 if value == nil { 2977 return nil 2978 } 2979 2980 shape, ok := value.([]interface{}) 2981 if !ok { 2982 return fmt.Errorf("unexpected JSON type %v", value) 2983 } 2984 2985 var cv []types.ApplicationPolicyStatement 2986 if *v == nil { 2987 cv = []types.ApplicationPolicyStatement{} 2988 } else { 2989 cv = *v 2990 } 2991 2992 for _, value := range shape { 2993 var col types.ApplicationPolicyStatement 2994 destAddr := &col 2995 if err := awsRestjson1_deserializeDocumentApplicationPolicyStatement(&destAddr, value); err != nil { 2996 return err 2997 } 2998 col = *destAddr 2999 cv = append(cv, col) 3000 3001 } 3002 *v = cv 3003 return nil 3004} 3005 3006func awsRestjson1_deserializeDocument__listOfApplicationSummary(v *[]types.ApplicationSummary, value interface{}) error { 3007 if v == nil { 3008 return fmt.Errorf("unexpected nil of type %T", v) 3009 } 3010 if value == nil { 3011 return nil 3012 } 3013 3014 shape, ok := value.([]interface{}) 3015 if !ok { 3016 return fmt.Errorf("unexpected JSON type %v", value) 3017 } 3018 3019 var cv []types.ApplicationSummary 3020 if *v == nil { 3021 cv = []types.ApplicationSummary{} 3022 } else { 3023 cv = *v 3024 } 3025 3026 for _, value := range shape { 3027 var col types.ApplicationSummary 3028 destAddr := &col 3029 if err := awsRestjson1_deserializeDocumentApplicationSummary(&destAddr, value); err != nil { 3030 return err 3031 } 3032 col = *destAddr 3033 cv = append(cv, col) 3034 3035 } 3036 *v = cv 3037 return nil 3038} 3039 3040func awsRestjson1_deserializeDocument__listOfCapability(v *[]types.Capability, value interface{}) error { 3041 if v == nil { 3042 return fmt.Errorf("unexpected nil of type %T", v) 3043 } 3044 if value == nil { 3045 return nil 3046 } 3047 3048 shape, ok := value.([]interface{}) 3049 if !ok { 3050 return fmt.Errorf("unexpected JSON type %v", value) 3051 } 3052 3053 var cv []types.Capability 3054 if *v == nil { 3055 cv = []types.Capability{} 3056 } else { 3057 cv = *v 3058 } 3059 3060 for _, value := range shape { 3061 var col types.Capability 3062 if value != nil { 3063 jtv, ok := value.(string) 3064 if !ok { 3065 return fmt.Errorf("expected Capability to be of type string, got %T instead", value) 3066 } 3067 col = types.Capability(jtv) 3068 } 3069 cv = append(cv, col) 3070 3071 } 3072 *v = cv 3073 return nil 3074} 3075 3076func awsRestjson1_deserializeDocument__listOfParameterDefinition(v *[]types.ParameterDefinition, value interface{}) error { 3077 if v == nil { 3078 return fmt.Errorf("unexpected nil of type %T", v) 3079 } 3080 if value == nil { 3081 return nil 3082 } 3083 3084 shape, ok := value.([]interface{}) 3085 if !ok { 3086 return fmt.Errorf("unexpected JSON type %v", value) 3087 } 3088 3089 var cv []types.ParameterDefinition 3090 if *v == nil { 3091 cv = []types.ParameterDefinition{} 3092 } else { 3093 cv = *v 3094 } 3095 3096 for _, value := range shape { 3097 var col types.ParameterDefinition 3098 destAddr := &col 3099 if err := awsRestjson1_deserializeDocumentParameterDefinition(&destAddr, value); err != nil { 3100 return err 3101 } 3102 col = *destAddr 3103 cv = append(cv, col) 3104 3105 } 3106 *v = cv 3107 return nil 3108} 3109 3110func awsRestjson1_deserializeDocument__listOfVersionSummary(v *[]types.VersionSummary, value interface{}) error { 3111 if v == nil { 3112 return fmt.Errorf("unexpected nil of type %T", v) 3113 } 3114 if value == nil { 3115 return nil 3116 } 3117 3118 shape, ok := value.([]interface{}) 3119 if !ok { 3120 return fmt.Errorf("unexpected JSON type %v", value) 3121 } 3122 3123 var cv []types.VersionSummary 3124 if *v == nil { 3125 cv = []types.VersionSummary{} 3126 } else { 3127 cv = *v 3128 } 3129 3130 for _, value := range shape { 3131 var col types.VersionSummary 3132 destAddr := &col 3133 if err := awsRestjson1_deserializeDocumentVersionSummary(&destAddr, value); err != nil { 3134 return err 3135 } 3136 col = *destAddr 3137 cv = append(cv, col) 3138 3139 } 3140 *v = cv 3141 return nil 3142} 3143 3144func awsRestjson1_deserializeDocumentApplicationDependencySummary(v **types.ApplicationDependencySummary, value interface{}) error { 3145 if v == nil { 3146 return fmt.Errorf("unexpected nil of type %T", v) 3147 } 3148 if value == nil { 3149 return nil 3150 } 3151 3152 shape, ok := value.(map[string]interface{}) 3153 if !ok { 3154 return fmt.Errorf("unexpected JSON type %v", value) 3155 } 3156 3157 var sv *types.ApplicationDependencySummary 3158 if *v == nil { 3159 sv = &types.ApplicationDependencySummary{} 3160 } else { 3161 sv = *v 3162 } 3163 3164 for key, value := range shape { 3165 switch key { 3166 case "applicationId": 3167 if value != nil { 3168 jtv, ok := value.(string) 3169 if !ok { 3170 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3171 } 3172 sv.ApplicationId = ptr.String(jtv) 3173 } 3174 3175 case "semanticVersion": 3176 if value != nil { 3177 jtv, ok := value.(string) 3178 if !ok { 3179 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3180 } 3181 sv.SemanticVersion = ptr.String(jtv) 3182 } 3183 3184 default: 3185 _, _ = key, value 3186 3187 } 3188 } 3189 *v = sv 3190 return nil 3191} 3192 3193func awsRestjson1_deserializeDocumentApplicationPolicyStatement(v **types.ApplicationPolicyStatement, value interface{}) error { 3194 if v == nil { 3195 return fmt.Errorf("unexpected nil of type %T", v) 3196 } 3197 if value == nil { 3198 return nil 3199 } 3200 3201 shape, ok := value.(map[string]interface{}) 3202 if !ok { 3203 return fmt.Errorf("unexpected JSON type %v", value) 3204 } 3205 3206 var sv *types.ApplicationPolicyStatement 3207 if *v == nil { 3208 sv = &types.ApplicationPolicyStatement{} 3209 } else { 3210 sv = *v 3211 } 3212 3213 for key, value := range shape { 3214 switch key { 3215 case "actions": 3216 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Actions, value); err != nil { 3217 return err 3218 } 3219 3220 case "principalOrgIDs": 3221 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.PrincipalOrgIDs, value); err != nil { 3222 return err 3223 } 3224 3225 case "principals": 3226 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Principals, value); err != nil { 3227 return err 3228 } 3229 3230 case "statementId": 3231 if value != nil { 3232 jtv, ok := value.(string) 3233 if !ok { 3234 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3235 } 3236 sv.StatementId = ptr.String(jtv) 3237 } 3238 3239 default: 3240 _, _ = key, value 3241 3242 } 3243 } 3244 *v = sv 3245 return nil 3246} 3247 3248func awsRestjson1_deserializeDocumentApplicationSummary(v **types.ApplicationSummary, value interface{}) error { 3249 if v == nil { 3250 return fmt.Errorf("unexpected nil of type %T", v) 3251 } 3252 if value == nil { 3253 return nil 3254 } 3255 3256 shape, ok := value.(map[string]interface{}) 3257 if !ok { 3258 return fmt.Errorf("unexpected JSON type %v", value) 3259 } 3260 3261 var sv *types.ApplicationSummary 3262 if *v == nil { 3263 sv = &types.ApplicationSummary{} 3264 } else { 3265 sv = *v 3266 } 3267 3268 for key, value := range shape { 3269 switch key { 3270 case "applicationId": 3271 if value != nil { 3272 jtv, ok := value.(string) 3273 if !ok { 3274 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3275 } 3276 sv.ApplicationId = ptr.String(jtv) 3277 } 3278 3279 case "author": 3280 if value != nil { 3281 jtv, ok := value.(string) 3282 if !ok { 3283 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3284 } 3285 sv.Author = ptr.String(jtv) 3286 } 3287 3288 case "creationTime": 3289 if value != nil { 3290 jtv, ok := value.(string) 3291 if !ok { 3292 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3293 } 3294 sv.CreationTime = ptr.String(jtv) 3295 } 3296 3297 case "description": 3298 if value != nil { 3299 jtv, ok := value.(string) 3300 if !ok { 3301 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3302 } 3303 sv.Description = ptr.String(jtv) 3304 } 3305 3306 case "homePageUrl": 3307 if value != nil { 3308 jtv, ok := value.(string) 3309 if !ok { 3310 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3311 } 3312 sv.HomePageUrl = ptr.String(jtv) 3313 } 3314 3315 case "labels": 3316 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.Labels, value); err != nil { 3317 return err 3318 } 3319 3320 case "name": 3321 if value != nil { 3322 jtv, ok := value.(string) 3323 if !ok { 3324 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3325 } 3326 sv.Name = ptr.String(jtv) 3327 } 3328 3329 case "spdxLicenseId": 3330 if value != nil { 3331 jtv, ok := value.(string) 3332 if !ok { 3333 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3334 } 3335 sv.SpdxLicenseId = ptr.String(jtv) 3336 } 3337 3338 default: 3339 _, _ = key, value 3340 3341 } 3342 } 3343 *v = sv 3344 return nil 3345} 3346 3347func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { 3348 if v == nil { 3349 return fmt.Errorf("unexpected nil of type %T", v) 3350 } 3351 if value == nil { 3352 return nil 3353 } 3354 3355 shape, ok := value.(map[string]interface{}) 3356 if !ok { 3357 return fmt.Errorf("unexpected JSON type %v", value) 3358 } 3359 3360 var sv *types.BadRequestException 3361 if *v == nil { 3362 sv = &types.BadRequestException{} 3363 } else { 3364 sv = *v 3365 } 3366 3367 for key, value := range shape { 3368 switch key { 3369 case "errorCode": 3370 if value != nil { 3371 jtv, ok := value.(string) 3372 if !ok { 3373 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3374 } 3375 sv.ErrorCode_ = ptr.String(jtv) 3376 } 3377 3378 case "message": 3379 if value != nil { 3380 jtv, ok := value.(string) 3381 if !ok { 3382 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3383 } 3384 sv.Message = ptr.String(jtv) 3385 } 3386 3387 default: 3388 _, _ = key, value 3389 3390 } 3391 } 3392 *v = sv 3393 return nil 3394} 3395 3396func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 3397 if v == nil { 3398 return fmt.Errorf("unexpected nil of type %T", v) 3399 } 3400 if value == nil { 3401 return nil 3402 } 3403 3404 shape, ok := value.(map[string]interface{}) 3405 if !ok { 3406 return fmt.Errorf("unexpected JSON type %v", value) 3407 } 3408 3409 var sv *types.ConflictException 3410 if *v == nil { 3411 sv = &types.ConflictException{} 3412 } else { 3413 sv = *v 3414 } 3415 3416 for key, value := range shape { 3417 switch key { 3418 case "errorCode": 3419 if value != nil { 3420 jtv, ok := value.(string) 3421 if !ok { 3422 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3423 } 3424 sv.ErrorCode_ = ptr.String(jtv) 3425 } 3426 3427 case "message": 3428 if value != nil { 3429 jtv, ok := value.(string) 3430 if !ok { 3431 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3432 } 3433 sv.Message = ptr.String(jtv) 3434 } 3435 3436 default: 3437 _, _ = key, value 3438 3439 } 3440 } 3441 *v = sv 3442 return nil 3443} 3444 3445func awsRestjson1_deserializeDocumentForbiddenException(v **types.ForbiddenException, value interface{}) error { 3446 if v == nil { 3447 return fmt.Errorf("unexpected nil of type %T", v) 3448 } 3449 if value == nil { 3450 return nil 3451 } 3452 3453 shape, ok := value.(map[string]interface{}) 3454 if !ok { 3455 return fmt.Errorf("unexpected JSON type %v", value) 3456 } 3457 3458 var sv *types.ForbiddenException 3459 if *v == nil { 3460 sv = &types.ForbiddenException{} 3461 } else { 3462 sv = *v 3463 } 3464 3465 for key, value := range shape { 3466 switch key { 3467 case "errorCode": 3468 if value != nil { 3469 jtv, ok := value.(string) 3470 if !ok { 3471 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3472 } 3473 sv.ErrorCode_ = ptr.String(jtv) 3474 } 3475 3476 case "message": 3477 if value != nil { 3478 jtv, ok := value.(string) 3479 if !ok { 3480 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3481 } 3482 sv.Message = ptr.String(jtv) 3483 } 3484 3485 default: 3486 _, _ = key, value 3487 3488 } 3489 } 3490 *v = sv 3491 return nil 3492} 3493 3494func awsRestjson1_deserializeDocumentInternalServerErrorException(v **types.InternalServerErrorException, value interface{}) error { 3495 if v == nil { 3496 return fmt.Errorf("unexpected nil of type %T", v) 3497 } 3498 if value == nil { 3499 return nil 3500 } 3501 3502 shape, ok := value.(map[string]interface{}) 3503 if !ok { 3504 return fmt.Errorf("unexpected JSON type %v", value) 3505 } 3506 3507 var sv *types.InternalServerErrorException 3508 if *v == nil { 3509 sv = &types.InternalServerErrorException{} 3510 } else { 3511 sv = *v 3512 } 3513 3514 for key, value := range shape { 3515 switch key { 3516 case "errorCode": 3517 if value != nil { 3518 jtv, ok := value.(string) 3519 if !ok { 3520 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3521 } 3522 sv.ErrorCode_ = ptr.String(jtv) 3523 } 3524 3525 case "message": 3526 if value != nil { 3527 jtv, ok := value.(string) 3528 if !ok { 3529 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3530 } 3531 sv.Message = ptr.String(jtv) 3532 } 3533 3534 default: 3535 _, _ = key, value 3536 3537 } 3538 } 3539 *v = sv 3540 return nil 3541} 3542 3543func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundException, value interface{}) error { 3544 if v == nil { 3545 return fmt.Errorf("unexpected nil of type %T", v) 3546 } 3547 if value == nil { 3548 return nil 3549 } 3550 3551 shape, ok := value.(map[string]interface{}) 3552 if !ok { 3553 return fmt.Errorf("unexpected JSON type %v", value) 3554 } 3555 3556 var sv *types.NotFoundException 3557 if *v == nil { 3558 sv = &types.NotFoundException{} 3559 } else { 3560 sv = *v 3561 } 3562 3563 for key, value := range shape { 3564 switch key { 3565 case "errorCode": 3566 if value != nil { 3567 jtv, ok := value.(string) 3568 if !ok { 3569 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3570 } 3571 sv.ErrorCode_ = ptr.String(jtv) 3572 } 3573 3574 case "message": 3575 if value != nil { 3576 jtv, ok := value.(string) 3577 if !ok { 3578 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3579 } 3580 sv.Message = ptr.String(jtv) 3581 } 3582 3583 default: 3584 _, _ = key, value 3585 3586 } 3587 } 3588 *v = sv 3589 return nil 3590} 3591 3592func awsRestjson1_deserializeDocumentParameterDefinition(v **types.ParameterDefinition, value interface{}) error { 3593 if v == nil { 3594 return fmt.Errorf("unexpected nil of type %T", v) 3595 } 3596 if value == nil { 3597 return nil 3598 } 3599 3600 shape, ok := value.(map[string]interface{}) 3601 if !ok { 3602 return fmt.Errorf("unexpected JSON type %v", value) 3603 } 3604 3605 var sv *types.ParameterDefinition 3606 if *v == nil { 3607 sv = &types.ParameterDefinition{} 3608 } else { 3609 sv = *v 3610 } 3611 3612 for key, value := range shape { 3613 switch key { 3614 case "allowedPattern": 3615 if value != nil { 3616 jtv, ok := value.(string) 3617 if !ok { 3618 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3619 } 3620 sv.AllowedPattern = ptr.String(jtv) 3621 } 3622 3623 case "allowedValues": 3624 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.AllowedValues, value); err != nil { 3625 return err 3626 } 3627 3628 case "constraintDescription": 3629 if value != nil { 3630 jtv, ok := value.(string) 3631 if !ok { 3632 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3633 } 3634 sv.ConstraintDescription = ptr.String(jtv) 3635 } 3636 3637 case "defaultValue": 3638 if value != nil { 3639 jtv, ok := value.(string) 3640 if !ok { 3641 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3642 } 3643 sv.DefaultValue = ptr.String(jtv) 3644 } 3645 3646 case "description": 3647 if value != nil { 3648 jtv, ok := value.(string) 3649 if !ok { 3650 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3651 } 3652 sv.Description = ptr.String(jtv) 3653 } 3654 3655 case "maxLength": 3656 if value != nil { 3657 jtv, ok := value.(json.Number) 3658 if !ok { 3659 return fmt.Errorf("expected __integer to be json.Number, got %T instead", value) 3660 } 3661 i64, err := jtv.Int64() 3662 if err != nil { 3663 return err 3664 } 3665 sv.MaxLength = int32(i64) 3666 } 3667 3668 case "maxValue": 3669 if value != nil { 3670 jtv, ok := value.(json.Number) 3671 if !ok { 3672 return fmt.Errorf("expected __integer to be json.Number, got %T instead", value) 3673 } 3674 i64, err := jtv.Int64() 3675 if err != nil { 3676 return err 3677 } 3678 sv.MaxValue = int32(i64) 3679 } 3680 3681 case "minLength": 3682 if value != nil { 3683 jtv, ok := value.(json.Number) 3684 if !ok { 3685 return fmt.Errorf("expected __integer to be json.Number, got %T instead", value) 3686 } 3687 i64, err := jtv.Int64() 3688 if err != nil { 3689 return err 3690 } 3691 sv.MinLength = int32(i64) 3692 } 3693 3694 case "minValue": 3695 if value != nil { 3696 jtv, ok := value.(json.Number) 3697 if !ok { 3698 return fmt.Errorf("expected __integer to be json.Number, got %T instead", value) 3699 } 3700 i64, err := jtv.Int64() 3701 if err != nil { 3702 return err 3703 } 3704 sv.MinValue = int32(i64) 3705 } 3706 3707 case "name": 3708 if value != nil { 3709 jtv, ok := value.(string) 3710 if !ok { 3711 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3712 } 3713 sv.Name = ptr.String(jtv) 3714 } 3715 3716 case "noEcho": 3717 if value != nil { 3718 jtv, ok := value.(bool) 3719 if !ok { 3720 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 3721 } 3722 sv.NoEcho = jtv 3723 } 3724 3725 case "referencedByResources": 3726 if err := awsRestjson1_deserializeDocument__listOf__string(&sv.ReferencedByResources, value); err != nil { 3727 return err 3728 } 3729 3730 case "type": 3731 if value != nil { 3732 jtv, ok := value.(string) 3733 if !ok { 3734 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3735 } 3736 sv.Type = ptr.String(jtv) 3737 } 3738 3739 default: 3740 _, _ = key, value 3741 3742 } 3743 } 3744 *v = sv 3745 return nil 3746} 3747 3748func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { 3749 if v == nil { 3750 return fmt.Errorf("unexpected nil of type %T", v) 3751 } 3752 if value == nil { 3753 return nil 3754 } 3755 3756 shape, ok := value.(map[string]interface{}) 3757 if !ok { 3758 return fmt.Errorf("unexpected JSON type %v", value) 3759 } 3760 3761 var sv *types.TooManyRequestsException 3762 if *v == nil { 3763 sv = &types.TooManyRequestsException{} 3764 } else { 3765 sv = *v 3766 } 3767 3768 for key, value := range shape { 3769 switch key { 3770 case "errorCode": 3771 if value != nil { 3772 jtv, ok := value.(string) 3773 if !ok { 3774 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3775 } 3776 sv.ErrorCode_ = ptr.String(jtv) 3777 } 3778 3779 case "message": 3780 if value != nil { 3781 jtv, ok := value.(string) 3782 if !ok { 3783 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3784 } 3785 sv.Message = ptr.String(jtv) 3786 } 3787 3788 default: 3789 _, _ = key, value 3790 3791 } 3792 } 3793 *v = sv 3794 return nil 3795} 3796 3797func awsRestjson1_deserializeDocumentVersion(v **types.Version, value interface{}) error { 3798 if v == nil { 3799 return fmt.Errorf("unexpected nil of type %T", v) 3800 } 3801 if value == nil { 3802 return nil 3803 } 3804 3805 shape, ok := value.(map[string]interface{}) 3806 if !ok { 3807 return fmt.Errorf("unexpected JSON type %v", value) 3808 } 3809 3810 var sv *types.Version 3811 if *v == nil { 3812 sv = &types.Version{} 3813 } else { 3814 sv = *v 3815 } 3816 3817 for key, value := range shape { 3818 switch key { 3819 case "applicationId": 3820 if value != nil { 3821 jtv, ok := value.(string) 3822 if !ok { 3823 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3824 } 3825 sv.ApplicationId = ptr.String(jtv) 3826 } 3827 3828 case "creationTime": 3829 if value != nil { 3830 jtv, ok := value.(string) 3831 if !ok { 3832 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3833 } 3834 sv.CreationTime = ptr.String(jtv) 3835 } 3836 3837 case "parameterDefinitions": 3838 if err := awsRestjson1_deserializeDocument__listOfParameterDefinition(&sv.ParameterDefinitions, value); err != nil { 3839 return err 3840 } 3841 3842 case "requiredCapabilities": 3843 if err := awsRestjson1_deserializeDocument__listOfCapability(&sv.RequiredCapabilities, value); err != nil { 3844 return err 3845 } 3846 3847 case "resourcesSupported": 3848 if value != nil { 3849 jtv, ok := value.(bool) 3850 if !ok { 3851 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 3852 } 3853 sv.ResourcesSupported = jtv 3854 } 3855 3856 case "semanticVersion": 3857 if value != nil { 3858 jtv, ok := value.(string) 3859 if !ok { 3860 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3861 } 3862 sv.SemanticVersion = ptr.String(jtv) 3863 } 3864 3865 case "sourceCodeArchiveUrl": 3866 if value != nil { 3867 jtv, ok := value.(string) 3868 if !ok { 3869 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3870 } 3871 sv.SourceCodeArchiveUrl = ptr.String(jtv) 3872 } 3873 3874 case "sourceCodeUrl": 3875 if value != nil { 3876 jtv, ok := value.(string) 3877 if !ok { 3878 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3879 } 3880 sv.SourceCodeUrl = ptr.String(jtv) 3881 } 3882 3883 case "templateUrl": 3884 if value != nil { 3885 jtv, ok := value.(string) 3886 if !ok { 3887 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3888 } 3889 sv.TemplateUrl = ptr.String(jtv) 3890 } 3891 3892 default: 3893 _, _ = key, value 3894 3895 } 3896 } 3897 *v = sv 3898 return nil 3899} 3900 3901func awsRestjson1_deserializeDocumentVersionSummary(v **types.VersionSummary, value interface{}) error { 3902 if v == nil { 3903 return fmt.Errorf("unexpected nil of type %T", v) 3904 } 3905 if value == nil { 3906 return nil 3907 } 3908 3909 shape, ok := value.(map[string]interface{}) 3910 if !ok { 3911 return fmt.Errorf("unexpected JSON type %v", value) 3912 } 3913 3914 var sv *types.VersionSummary 3915 if *v == nil { 3916 sv = &types.VersionSummary{} 3917 } else { 3918 sv = *v 3919 } 3920 3921 for key, value := range shape { 3922 switch key { 3923 case "applicationId": 3924 if value != nil { 3925 jtv, ok := value.(string) 3926 if !ok { 3927 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3928 } 3929 sv.ApplicationId = ptr.String(jtv) 3930 } 3931 3932 case "creationTime": 3933 if value != nil { 3934 jtv, ok := value.(string) 3935 if !ok { 3936 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3937 } 3938 sv.CreationTime = ptr.String(jtv) 3939 } 3940 3941 case "semanticVersion": 3942 if value != nil { 3943 jtv, ok := value.(string) 3944 if !ok { 3945 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3946 } 3947 sv.SemanticVersion = ptr.String(jtv) 3948 } 3949 3950 case "sourceCodeUrl": 3951 if value != nil { 3952 jtv, ok := value.(string) 3953 if !ok { 3954 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 3955 } 3956 sv.SourceCodeUrl = ptr.String(jtv) 3957 } 3958 3959 default: 3960 _, _ = key, value 3961 3962 } 3963 } 3964 *v = sv 3965 return nil 3966} 3967