1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package iotfleethub 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/iotfleethub/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 "strings" 19) 20 21type awsRestjson1_deserializeOpCreateApplication struct { 22} 23 24func (*awsRestjson1_deserializeOpCreateApplication) ID() string { 25 return "OperationDeserializer" 26} 27 28func (m *awsRestjson1_deserializeOpCreateApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 29 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 30) { 31 out, metadata, err = next.HandleDeserialize(ctx, in) 32 if err != nil { 33 return out, metadata, err 34 } 35 36 response, ok := out.RawResponse.(*smithyhttp.Response) 37 if !ok { 38 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 39 } 40 41 if response.StatusCode < 200 || response.StatusCode >= 300 { 42 return out, metadata, awsRestjson1_deserializeOpErrorCreateApplication(response, &metadata) 43 } 44 output := &CreateApplicationOutput{} 45 out.Result = output 46 47 var buff [1024]byte 48 ringBuffer := smithyio.NewRingBuffer(buff[:]) 49 50 body := io.TeeReader(response.Body, ringBuffer) 51 52 decoder := json.NewDecoder(body) 53 decoder.UseNumber() 54 var shape interface{} 55 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 56 var snapshot bytes.Buffer 57 io.Copy(&snapshot, ringBuffer) 58 err = &smithy.DeserializationError{ 59 Err: fmt.Errorf("failed to decode response body, %w", err), 60 Snapshot: snapshot.Bytes(), 61 } 62 return out, metadata, err 63 } 64 65 err = awsRestjson1_deserializeOpDocumentCreateApplicationOutput(&output, shape) 66 if err != nil { 67 var snapshot bytes.Buffer 68 io.Copy(&snapshot, ringBuffer) 69 return out, metadata, &smithy.DeserializationError{ 70 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 71 Snapshot: snapshot.Bytes(), 72 } 73 } 74 75 return out, metadata, err 76} 77 78func awsRestjson1_deserializeOpErrorCreateApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 79 var errorBuffer bytes.Buffer 80 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 81 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 82 } 83 errorBody := bytes.NewReader(errorBuffer.Bytes()) 84 85 errorCode := "UnknownError" 86 errorMessage := errorCode 87 88 code := response.Header.Get("X-Amzn-ErrorType") 89 if len(code) != 0 { 90 errorCode = restjson.SanitizeErrorCode(code) 91 } 92 93 var buff [1024]byte 94 ringBuffer := smithyio.NewRingBuffer(buff[:]) 95 96 body := io.TeeReader(errorBody, ringBuffer) 97 decoder := json.NewDecoder(body) 98 decoder.UseNumber() 99 code, message, err := restjson.GetErrorInfo(decoder) 100 if err != nil { 101 var snapshot bytes.Buffer 102 io.Copy(&snapshot, ringBuffer) 103 err = &smithy.DeserializationError{ 104 Err: fmt.Errorf("failed to decode response body, %w", err), 105 Snapshot: snapshot.Bytes(), 106 } 107 return err 108 } 109 110 errorBody.Seek(0, io.SeekStart) 111 if len(code) != 0 { 112 errorCode = restjson.SanitizeErrorCode(code) 113 } 114 if len(message) != 0 { 115 errorMessage = message 116 } 117 118 switch { 119 case strings.EqualFold("InternalFailureException", errorCode): 120 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 121 122 case strings.EqualFold("InvalidRequestException", errorCode): 123 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 124 125 case strings.EqualFold("LimitExceededException", errorCode): 126 return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) 127 128 case strings.EqualFold("ThrottlingException", errorCode): 129 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 130 131 default: 132 genericError := &smithy.GenericAPIError{ 133 Code: errorCode, 134 Message: errorMessage, 135 } 136 return genericError 137 138 } 139} 140 141func awsRestjson1_deserializeOpDocumentCreateApplicationOutput(v **CreateApplicationOutput, value interface{}) error { 142 if v == nil { 143 return fmt.Errorf("unexpected nil of type %T", v) 144 } 145 if value == nil { 146 return nil 147 } 148 149 shape, ok := value.(map[string]interface{}) 150 if !ok { 151 return fmt.Errorf("unexpected JSON type %v", value) 152 } 153 154 var sv *CreateApplicationOutput 155 if *v == nil { 156 sv = &CreateApplicationOutput{} 157 } else { 158 sv = *v 159 } 160 161 for key, value := range shape { 162 switch key { 163 case "applicationArn": 164 if value != nil { 165 jtv, ok := value.(string) 166 if !ok { 167 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 168 } 169 sv.ApplicationArn = ptr.String(jtv) 170 } 171 172 case "applicationId": 173 if value != nil { 174 jtv, ok := value.(string) 175 if !ok { 176 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 177 } 178 sv.ApplicationId = ptr.String(jtv) 179 } 180 181 default: 182 _, _ = key, value 183 184 } 185 } 186 *v = sv 187 return nil 188} 189 190type awsRestjson1_deserializeOpDeleteApplication struct { 191} 192 193func (*awsRestjson1_deserializeOpDeleteApplication) ID() string { 194 return "OperationDeserializer" 195} 196 197func (m *awsRestjson1_deserializeOpDeleteApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 198 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 199) { 200 out, metadata, err = next.HandleDeserialize(ctx, in) 201 if err != nil { 202 return out, metadata, err 203 } 204 205 response, ok := out.RawResponse.(*smithyhttp.Response) 206 if !ok { 207 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 208 } 209 210 if response.StatusCode < 200 || response.StatusCode >= 300 { 211 return out, metadata, awsRestjson1_deserializeOpErrorDeleteApplication(response, &metadata) 212 } 213 output := &DeleteApplicationOutput{} 214 out.Result = output 215 216 return out, metadata, err 217} 218 219func awsRestjson1_deserializeOpErrorDeleteApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 220 var errorBuffer bytes.Buffer 221 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 222 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 223 } 224 errorBody := bytes.NewReader(errorBuffer.Bytes()) 225 226 errorCode := "UnknownError" 227 errorMessage := errorCode 228 229 code := response.Header.Get("X-Amzn-ErrorType") 230 if len(code) != 0 { 231 errorCode = restjson.SanitizeErrorCode(code) 232 } 233 234 var buff [1024]byte 235 ringBuffer := smithyio.NewRingBuffer(buff[:]) 236 237 body := io.TeeReader(errorBody, ringBuffer) 238 decoder := json.NewDecoder(body) 239 decoder.UseNumber() 240 code, message, err := restjson.GetErrorInfo(decoder) 241 if err != nil { 242 var snapshot bytes.Buffer 243 io.Copy(&snapshot, ringBuffer) 244 err = &smithy.DeserializationError{ 245 Err: fmt.Errorf("failed to decode response body, %w", err), 246 Snapshot: snapshot.Bytes(), 247 } 248 return err 249 } 250 251 errorBody.Seek(0, io.SeekStart) 252 if len(code) != 0 { 253 errorCode = restjson.SanitizeErrorCode(code) 254 } 255 if len(message) != 0 { 256 errorMessage = message 257 } 258 259 switch { 260 case strings.EqualFold("InternalFailureException", errorCode): 261 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 262 263 case strings.EqualFold("InvalidRequestException", errorCode): 264 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 265 266 case strings.EqualFold("ResourceNotFoundException", errorCode): 267 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 268 269 case strings.EqualFold("ThrottlingException", errorCode): 270 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 271 272 default: 273 genericError := &smithy.GenericAPIError{ 274 Code: errorCode, 275 Message: errorMessage, 276 } 277 return genericError 278 279 } 280} 281 282type awsRestjson1_deserializeOpDescribeApplication struct { 283} 284 285func (*awsRestjson1_deserializeOpDescribeApplication) ID() string { 286 return "OperationDeserializer" 287} 288 289func (m *awsRestjson1_deserializeOpDescribeApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 290 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 291) { 292 out, metadata, err = next.HandleDeserialize(ctx, in) 293 if err != nil { 294 return out, metadata, err 295 } 296 297 response, ok := out.RawResponse.(*smithyhttp.Response) 298 if !ok { 299 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 300 } 301 302 if response.StatusCode < 200 || response.StatusCode >= 300 { 303 return out, metadata, awsRestjson1_deserializeOpErrorDescribeApplication(response, &metadata) 304 } 305 output := &DescribeApplicationOutput{} 306 out.Result = output 307 308 var buff [1024]byte 309 ringBuffer := smithyio.NewRingBuffer(buff[:]) 310 311 body := io.TeeReader(response.Body, ringBuffer) 312 313 decoder := json.NewDecoder(body) 314 decoder.UseNumber() 315 var shape interface{} 316 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 317 var snapshot bytes.Buffer 318 io.Copy(&snapshot, ringBuffer) 319 err = &smithy.DeserializationError{ 320 Err: fmt.Errorf("failed to decode response body, %w", err), 321 Snapshot: snapshot.Bytes(), 322 } 323 return out, metadata, err 324 } 325 326 err = awsRestjson1_deserializeOpDocumentDescribeApplicationOutput(&output, shape) 327 if err != nil { 328 var snapshot bytes.Buffer 329 io.Copy(&snapshot, ringBuffer) 330 return out, metadata, &smithy.DeserializationError{ 331 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 332 Snapshot: snapshot.Bytes(), 333 } 334 } 335 336 return out, metadata, err 337} 338 339func awsRestjson1_deserializeOpErrorDescribeApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 340 var errorBuffer bytes.Buffer 341 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 342 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 343 } 344 errorBody := bytes.NewReader(errorBuffer.Bytes()) 345 346 errorCode := "UnknownError" 347 errorMessage := errorCode 348 349 code := response.Header.Get("X-Amzn-ErrorType") 350 if len(code) != 0 { 351 errorCode = restjson.SanitizeErrorCode(code) 352 } 353 354 var buff [1024]byte 355 ringBuffer := smithyio.NewRingBuffer(buff[:]) 356 357 body := io.TeeReader(errorBody, ringBuffer) 358 decoder := json.NewDecoder(body) 359 decoder.UseNumber() 360 code, message, err := restjson.GetErrorInfo(decoder) 361 if err != nil { 362 var snapshot bytes.Buffer 363 io.Copy(&snapshot, ringBuffer) 364 err = &smithy.DeserializationError{ 365 Err: fmt.Errorf("failed to decode response body, %w", err), 366 Snapshot: snapshot.Bytes(), 367 } 368 return err 369 } 370 371 errorBody.Seek(0, io.SeekStart) 372 if len(code) != 0 { 373 errorCode = restjson.SanitizeErrorCode(code) 374 } 375 if len(message) != 0 { 376 errorMessage = message 377 } 378 379 switch { 380 case strings.EqualFold("InternalFailureException", errorCode): 381 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 382 383 case strings.EqualFold("InvalidRequestException", errorCode): 384 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 385 386 case strings.EqualFold("ResourceNotFoundException", errorCode): 387 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 388 389 case strings.EqualFold("ThrottlingException", errorCode): 390 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 391 392 default: 393 genericError := &smithy.GenericAPIError{ 394 Code: errorCode, 395 Message: errorMessage, 396 } 397 return genericError 398 399 } 400} 401 402func awsRestjson1_deserializeOpDocumentDescribeApplicationOutput(v **DescribeApplicationOutput, value interface{}) error { 403 if v == nil { 404 return fmt.Errorf("unexpected nil of type %T", v) 405 } 406 if value == nil { 407 return nil 408 } 409 410 shape, ok := value.(map[string]interface{}) 411 if !ok { 412 return fmt.Errorf("unexpected JSON type %v", value) 413 } 414 415 var sv *DescribeApplicationOutput 416 if *v == nil { 417 sv = &DescribeApplicationOutput{} 418 } else { 419 sv = *v 420 } 421 422 for key, value := range shape { 423 switch key { 424 case "applicationArn": 425 if value != nil { 426 jtv, ok := value.(string) 427 if !ok { 428 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 429 } 430 sv.ApplicationArn = ptr.String(jtv) 431 } 432 433 case "applicationCreationDate": 434 if value != nil { 435 jtv, ok := value.(json.Number) 436 if !ok { 437 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 438 } 439 i64, err := jtv.Int64() 440 if err != nil { 441 return err 442 } 443 sv.ApplicationCreationDate = i64 444 } 445 446 case "applicationDescription": 447 if value != nil { 448 jtv, ok := value.(string) 449 if !ok { 450 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 451 } 452 sv.ApplicationDescription = ptr.String(jtv) 453 } 454 455 case "applicationId": 456 if value != nil { 457 jtv, ok := value.(string) 458 if !ok { 459 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 460 } 461 sv.ApplicationId = ptr.String(jtv) 462 } 463 464 case "applicationLastUpdateDate": 465 if value != nil { 466 jtv, ok := value.(json.Number) 467 if !ok { 468 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 469 } 470 i64, err := jtv.Int64() 471 if err != nil { 472 return err 473 } 474 sv.ApplicationLastUpdateDate = i64 475 } 476 477 case "applicationName": 478 if value != nil { 479 jtv, ok := value.(string) 480 if !ok { 481 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 482 } 483 sv.ApplicationName = ptr.String(jtv) 484 } 485 486 case "applicationState": 487 if value != nil { 488 jtv, ok := value.(string) 489 if !ok { 490 return fmt.Errorf("expected ApplicationState to be of type string, got %T instead", value) 491 } 492 sv.ApplicationState = types.ApplicationState(jtv) 493 } 494 495 case "applicationUrl": 496 if value != nil { 497 jtv, ok := value.(string) 498 if !ok { 499 return fmt.Errorf("expected Url to be of type string, got %T instead", value) 500 } 501 sv.ApplicationUrl = ptr.String(jtv) 502 } 503 504 case "errorMessage": 505 if value != nil { 506 jtv, ok := value.(string) 507 if !ok { 508 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 509 } 510 sv.ErrorMessage = ptr.String(jtv) 511 } 512 513 case "roleArn": 514 if value != nil { 515 jtv, ok := value.(string) 516 if !ok { 517 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 518 } 519 sv.RoleArn = ptr.String(jtv) 520 } 521 522 case "ssoClientId": 523 if value != nil { 524 jtv, ok := value.(string) 525 if !ok { 526 return fmt.Errorf("expected SsoClientId to be of type string, got %T instead", value) 527 } 528 sv.SsoClientId = ptr.String(jtv) 529 } 530 531 case "tags": 532 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 533 return err 534 } 535 536 default: 537 _, _ = key, value 538 539 } 540 } 541 *v = sv 542 return nil 543} 544 545type awsRestjson1_deserializeOpListApplications struct { 546} 547 548func (*awsRestjson1_deserializeOpListApplications) ID() string { 549 return "OperationDeserializer" 550} 551 552func (m *awsRestjson1_deserializeOpListApplications) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 553 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 554) { 555 out, metadata, err = next.HandleDeserialize(ctx, in) 556 if err != nil { 557 return out, metadata, err 558 } 559 560 response, ok := out.RawResponse.(*smithyhttp.Response) 561 if !ok { 562 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 563 } 564 565 if response.StatusCode < 200 || response.StatusCode >= 300 { 566 return out, metadata, awsRestjson1_deserializeOpErrorListApplications(response, &metadata) 567 } 568 output := &ListApplicationsOutput{} 569 out.Result = output 570 571 var buff [1024]byte 572 ringBuffer := smithyio.NewRingBuffer(buff[:]) 573 574 body := io.TeeReader(response.Body, ringBuffer) 575 576 decoder := json.NewDecoder(body) 577 decoder.UseNumber() 578 var shape interface{} 579 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 580 var snapshot bytes.Buffer 581 io.Copy(&snapshot, ringBuffer) 582 err = &smithy.DeserializationError{ 583 Err: fmt.Errorf("failed to decode response body, %w", err), 584 Snapshot: snapshot.Bytes(), 585 } 586 return out, metadata, err 587 } 588 589 err = awsRestjson1_deserializeOpDocumentListApplicationsOutput(&output, shape) 590 if err != nil { 591 var snapshot bytes.Buffer 592 io.Copy(&snapshot, ringBuffer) 593 return out, metadata, &smithy.DeserializationError{ 594 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 595 Snapshot: snapshot.Bytes(), 596 } 597 } 598 599 return out, metadata, err 600} 601 602func awsRestjson1_deserializeOpErrorListApplications(response *smithyhttp.Response, metadata *middleware.Metadata) error { 603 var errorBuffer bytes.Buffer 604 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 605 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 606 } 607 errorBody := bytes.NewReader(errorBuffer.Bytes()) 608 609 errorCode := "UnknownError" 610 errorMessage := errorCode 611 612 code := response.Header.Get("X-Amzn-ErrorType") 613 if len(code) != 0 { 614 errorCode = restjson.SanitizeErrorCode(code) 615 } 616 617 var buff [1024]byte 618 ringBuffer := smithyio.NewRingBuffer(buff[:]) 619 620 body := io.TeeReader(errorBody, ringBuffer) 621 decoder := json.NewDecoder(body) 622 decoder.UseNumber() 623 code, message, err := restjson.GetErrorInfo(decoder) 624 if err != nil { 625 var snapshot bytes.Buffer 626 io.Copy(&snapshot, ringBuffer) 627 err = &smithy.DeserializationError{ 628 Err: fmt.Errorf("failed to decode response body, %w", err), 629 Snapshot: snapshot.Bytes(), 630 } 631 return err 632 } 633 634 errorBody.Seek(0, io.SeekStart) 635 if len(code) != 0 { 636 errorCode = restjson.SanitizeErrorCode(code) 637 } 638 if len(message) != 0 { 639 errorMessage = message 640 } 641 642 switch { 643 case strings.EqualFold("InternalFailureException", errorCode): 644 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 645 646 case strings.EqualFold("InvalidRequestException", errorCode): 647 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 648 649 case strings.EqualFold("ThrottlingException", errorCode): 650 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 651 652 default: 653 genericError := &smithy.GenericAPIError{ 654 Code: errorCode, 655 Message: errorMessage, 656 } 657 return genericError 658 659 } 660} 661 662func awsRestjson1_deserializeOpDocumentListApplicationsOutput(v **ListApplicationsOutput, value interface{}) error { 663 if v == nil { 664 return fmt.Errorf("unexpected nil of type %T", v) 665 } 666 if value == nil { 667 return nil 668 } 669 670 shape, ok := value.(map[string]interface{}) 671 if !ok { 672 return fmt.Errorf("unexpected JSON type %v", value) 673 } 674 675 var sv *ListApplicationsOutput 676 if *v == nil { 677 sv = &ListApplicationsOutput{} 678 } else { 679 sv = *v 680 } 681 682 for key, value := range shape { 683 switch key { 684 case "applicationSummaries": 685 if err := awsRestjson1_deserializeDocumentApplicationSummaries(&sv.ApplicationSummaries, value); err != nil { 686 return err 687 } 688 689 case "nextToken": 690 if value != nil { 691 jtv, ok := value.(string) 692 if !ok { 693 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 694 } 695 sv.NextToken = ptr.String(jtv) 696 } 697 698 default: 699 _, _ = key, value 700 701 } 702 } 703 *v = sv 704 return nil 705} 706 707type awsRestjson1_deserializeOpListTagsForResource struct { 708} 709 710func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { 711 return "OperationDeserializer" 712} 713 714func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 715 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 716) { 717 out, metadata, err = next.HandleDeserialize(ctx, in) 718 if err != nil { 719 return out, metadata, err 720 } 721 722 response, ok := out.RawResponse.(*smithyhttp.Response) 723 if !ok { 724 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 725 } 726 727 if response.StatusCode < 200 || response.StatusCode >= 300 { 728 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) 729 } 730 output := &ListTagsForResourceOutput{} 731 out.Result = output 732 733 var buff [1024]byte 734 ringBuffer := smithyio.NewRingBuffer(buff[:]) 735 736 body := io.TeeReader(response.Body, ringBuffer) 737 738 decoder := json.NewDecoder(body) 739 decoder.UseNumber() 740 var shape interface{} 741 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 742 var snapshot bytes.Buffer 743 io.Copy(&snapshot, ringBuffer) 744 err = &smithy.DeserializationError{ 745 Err: fmt.Errorf("failed to decode response body, %w", err), 746 Snapshot: snapshot.Bytes(), 747 } 748 return out, metadata, err 749 } 750 751 err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 752 if err != nil { 753 var snapshot bytes.Buffer 754 io.Copy(&snapshot, ringBuffer) 755 return out, metadata, &smithy.DeserializationError{ 756 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 757 Snapshot: snapshot.Bytes(), 758 } 759 } 760 761 return out, metadata, err 762} 763 764func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 765 var errorBuffer bytes.Buffer 766 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 767 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 768 } 769 errorBody := bytes.NewReader(errorBuffer.Bytes()) 770 771 errorCode := "UnknownError" 772 errorMessage := errorCode 773 774 code := response.Header.Get("X-Amzn-ErrorType") 775 if len(code) != 0 { 776 errorCode = restjson.SanitizeErrorCode(code) 777 } 778 779 var buff [1024]byte 780 ringBuffer := smithyio.NewRingBuffer(buff[:]) 781 782 body := io.TeeReader(errorBody, ringBuffer) 783 decoder := json.NewDecoder(body) 784 decoder.UseNumber() 785 code, message, err := restjson.GetErrorInfo(decoder) 786 if err != nil { 787 var snapshot bytes.Buffer 788 io.Copy(&snapshot, ringBuffer) 789 err = &smithy.DeserializationError{ 790 Err: fmt.Errorf("failed to decode response body, %w", err), 791 Snapshot: snapshot.Bytes(), 792 } 793 return err 794 } 795 796 errorBody.Seek(0, io.SeekStart) 797 if len(code) != 0 { 798 errorCode = restjson.SanitizeErrorCode(code) 799 } 800 if len(message) != 0 { 801 errorMessage = message 802 } 803 804 switch { 805 case strings.EqualFold("InternalFailureException", errorCode): 806 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 807 808 case strings.EqualFold("InvalidRequestException", errorCode): 809 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 810 811 case strings.EqualFold("ResourceNotFoundException", errorCode): 812 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 813 814 default: 815 genericError := &smithy.GenericAPIError{ 816 Code: errorCode, 817 Message: errorMessage, 818 } 819 return genericError 820 821 } 822} 823 824func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 825 if v == nil { 826 return fmt.Errorf("unexpected nil of type %T", v) 827 } 828 if value == nil { 829 return nil 830 } 831 832 shape, ok := value.(map[string]interface{}) 833 if !ok { 834 return fmt.Errorf("unexpected JSON type %v", value) 835 } 836 837 var sv *ListTagsForResourceOutput 838 if *v == nil { 839 sv = &ListTagsForResourceOutput{} 840 } else { 841 sv = *v 842 } 843 844 for key, value := range shape { 845 switch key { 846 case "tags": 847 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 848 return err 849 } 850 851 default: 852 _, _ = key, value 853 854 } 855 } 856 *v = sv 857 return nil 858} 859 860type awsRestjson1_deserializeOpTagResource struct { 861} 862 863func (*awsRestjson1_deserializeOpTagResource) ID() string { 864 return "OperationDeserializer" 865} 866 867func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 868 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 869) { 870 out, metadata, err = next.HandleDeserialize(ctx, in) 871 if err != nil { 872 return out, metadata, err 873 } 874 875 response, ok := out.RawResponse.(*smithyhttp.Response) 876 if !ok { 877 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 878 } 879 880 if response.StatusCode < 200 || response.StatusCode >= 300 { 881 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 882 } 883 output := &TagResourceOutput{} 884 out.Result = output 885 886 return out, metadata, err 887} 888 889func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 890 var errorBuffer bytes.Buffer 891 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 892 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 893 } 894 errorBody := bytes.NewReader(errorBuffer.Bytes()) 895 896 errorCode := "UnknownError" 897 errorMessage := errorCode 898 899 code := response.Header.Get("X-Amzn-ErrorType") 900 if len(code) != 0 { 901 errorCode = restjson.SanitizeErrorCode(code) 902 } 903 904 var buff [1024]byte 905 ringBuffer := smithyio.NewRingBuffer(buff[:]) 906 907 body := io.TeeReader(errorBody, ringBuffer) 908 decoder := json.NewDecoder(body) 909 decoder.UseNumber() 910 code, message, err := restjson.GetErrorInfo(decoder) 911 if err != nil { 912 var snapshot bytes.Buffer 913 io.Copy(&snapshot, ringBuffer) 914 err = &smithy.DeserializationError{ 915 Err: fmt.Errorf("failed to decode response body, %w", err), 916 Snapshot: snapshot.Bytes(), 917 } 918 return err 919 } 920 921 errorBody.Seek(0, io.SeekStart) 922 if len(code) != 0 { 923 errorCode = restjson.SanitizeErrorCode(code) 924 } 925 if len(message) != 0 { 926 errorMessage = message 927 } 928 929 switch { 930 case strings.EqualFold("InternalFailureException", errorCode): 931 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 932 933 case strings.EqualFold("InvalidRequestException", errorCode): 934 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 935 936 case strings.EqualFold("ResourceNotFoundException", errorCode): 937 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 938 939 default: 940 genericError := &smithy.GenericAPIError{ 941 Code: errorCode, 942 Message: errorMessage, 943 } 944 return genericError 945 946 } 947} 948 949type awsRestjson1_deserializeOpUntagResource struct { 950} 951 952func (*awsRestjson1_deserializeOpUntagResource) ID() string { 953 return "OperationDeserializer" 954} 955 956func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 957 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 958) { 959 out, metadata, err = next.HandleDeserialize(ctx, in) 960 if err != nil { 961 return out, metadata, err 962 } 963 964 response, ok := out.RawResponse.(*smithyhttp.Response) 965 if !ok { 966 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 967 } 968 969 if response.StatusCode < 200 || response.StatusCode >= 300 { 970 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 971 } 972 output := &UntagResourceOutput{} 973 out.Result = output 974 975 return out, metadata, err 976} 977 978func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 979 var errorBuffer bytes.Buffer 980 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 981 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 982 } 983 errorBody := bytes.NewReader(errorBuffer.Bytes()) 984 985 errorCode := "UnknownError" 986 errorMessage := errorCode 987 988 code := response.Header.Get("X-Amzn-ErrorType") 989 if len(code) != 0 { 990 errorCode = restjson.SanitizeErrorCode(code) 991 } 992 993 var buff [1024]byte 994 ringBuffer := smithyio.NewRingBuffer(buff[:]) 995 996 body := io.TeeReader(errorBody, ringBuffer) 997 decoder := json.NewDecoder(body) 998 decoder.UseNumber() 999 code, message, err := restjson.GetErrorInfo(decoder) 1000 if err != nil { 1001 var snapshot bytes.Buffer 1002 io.Copy(&snapshot, ringBuffer) 1003 err = &smithy.DeserializationError{ 1004 Err: fmt.Errorf("failed to decode response body, %w", err), 1005 Snapshot: snapshot.Bytes(), 1006 } 1007 return err 1008 } 1009 1010 errorBody.Seek(0, io.SeekStart) 1011 if len(code) != 0 { 1012 errorCode = restjson.SanitizeErrorCode(code) 1013 } 1014 if len(message) != 0 { 1015 errorMessage = message 1016 } 1017 1018 switch { 1019 case strings.EqualFold("InternalFailureException", errorCode): 1020 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1021 1022 case strings.EqualFold("InvalidRequestException", errorCode): 1023 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 1024 1025 case strings.EqualFold("ResourceNotFoundException", errorCode): 1026 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1027 1028 default: 1029 genericError := &smithy.GenericAPIError{ 1030 Code: errorCode, 1031 Message: errorMessage, 1032 } 1033 return genericError 1034 1035 } 1036} 1037 1038type awsRestjson1_deserializeOpUpdateApplication struct { 1039} 1040 1041func (*awsRestjson1_deserializeOpUpdateApplication) ID() string { 1042 return "OperationDeserializer" 1043} 1044 1045func (m *awsRestjson1_deserializeOpUpdateApplication) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1046 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1047) { 1048 out, metadata, err = next.HandleDeserialize(ctx, in) 1049 if err != nil { 1050 return out, metadata, err 1051 } 1052 1053 response, ok := out.RawResponse.(*smithyhttp.Response) 1054 if !ok { 1055 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1056 } 1057 1058 if response.StatusCode < 200 || response.StatusCode >= 300 { 1059 return out, metadata, awsRestjson1_deserializeOpErrorUpdateApplication(response, &metadata) 1060 } 1061 output := &UpdateApplicationOutput{} 1062 out.Result = output 1063 1064 return out, metadata, err 1065} 1066 1067func awsRestjson1_deserializeOpErrorUpdateApplication(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1068 var errorBuffer bytes.Buffer 1069 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1070 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1071 } 1072 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1073 1074 errorCode := "UnknownError" 1075 errorMessage := errorCode 1076 1077 code := response.Header.Get("X-Amzn-ErrorType") 1078 if len(code) != 0 { 1079 errorCode = restjson.SanitizeErrorCode(code) 1080 } 1081 1082 var buff [1024]byte 1083 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1084 1085 body := io.TeeReader(errorBody, ringBuffer) 1086 decoder := json.NewDecoder(body) 1087 decoder.UseNumber() 1088 code, message, err := restjson.GetErrorInfo(decoder) 1089 if err != nil { 1090 var snapshot bytes.Buffer 1091 io.Copy(&snapshot, ringBuffer) 1092 err = &smithy.DeserializationError{ 1093 Err: fmt.Errorf("failed to decode response body, %w", err), 1094 Snapshot: snapshot.Bytes(), 1095 } 1096 return err 1097 } 1098 1099 errorBody.Seek(0, io.SeekStart) 1100 if len(code) != 0 { 1101 errorCode = restjson.SanitizeErrorCode(code) 1102 } 1103 if len(message) != 0 { 1104 errorMessage = message 1105 } 1106 1107 switch { 1108 case strings.EqualFold("ConflictException", errorCode): 1109 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1110 1111 case strings.EqualFold("InternalFailureException", errorCode): 1112 return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) 1113 1114 case strings.EqualFold("InvalidRequestException", errorCode): 1115 return awsRestjson1_deserializeErrorInvalidRequestException(response, errorBody) 1116 1117 case strings.EqualFold("ResourceNotFoundException", errorCode): 1118 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1119 1120 case strings.EqualFold("ThrottlingException", errorCode): 1121 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1122 1123 default: 1124 genericError := &smithy.GenericAPIError{ 1125 Code: errorCode, 1126 Message: errorMessage, 1127 } 1128 return genericError 1129 1130 } 1131} 1132 1133func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 1134 output := &types.ConflictException{} 1135 var buff [1024]byte 1136 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1137 1138 body := io.TeeReader(errorBody, ringBuffer) 1139 decoder := json.NewDecoder(body) 1140 decoder.UseNumber() 1141 var shape interface{} 1142 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1143 var snapshot bytes.Buffer 1144 io.Copy(&snapshot, ringBuffer) 1145 err = &smithy.DeserializationError{ 1146 Err: fmt.Errorf("failed to decode response body, %w", err), 1147 Snapshot: snapshot.Bytes(), 1148 } 1149 return err 1150 } 1151 1152 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 1153 1154 if err != nil { 1155 var snapshot bytes.Buffer 1156 io.Copy(&snapshot, ringBuffer) 1157 err = &smithy.DeserializationError{ 1158 Err: fmt.Errorf("failed to decode response body, %w", err), 1159 Snapshot: snapshot.Bytes(), 1160 } 1161 return err 1162 } 1163 1164 errorBody.Seek(0, io.SeekStart) 1165 1166 return output 1167} 1168 1169func awsRestjson1_deserializeErrorInternalFailureException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 1170 output := &types.InternalFailureException{} 1171 var buff [1024]byte 1172 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1173 1174 body := io.TeeReader(errorBody, ringBuffer) 1175 decoder := json.NewDecoder(body) 1176 decoder.UseNumber() 1177 var shape interface{} 1178 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1179 var snapshot bytes.Buffer 1180 io.Copy(&snapshot, ringBuffer) 1181 err = &smithy.DeserializationError{ 1182 Err: fmt.Errorf("failed to decode response body, %w", err), 1183 Snapshot: snapshot.Bytes(), 1184 } 1185 return err 1186 } 1187 1188 err := awsRestjson1_deserializeDocumentInternalFailureException(&output, shape) 1189 1190 if err != nil { 1191 var snapshot bytes.Buffer 1192 io.Copy(&snapshot, ringBuffer) 1193 err = &smithy.DeserializationError{ 1194 Err: fmt.Errorf("failed to decode response body, %w", err), 1195 Snapshot: snapshot.Bytes(), 1196 } 1197 return err 1198 } 1199 1200 errorBody.Seek(0, io.SeekStart) 1201 1202 return output 1203} 1204 1205func awsRestjson1_deserializeErrorInvalidRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 1206 output := &types.InvalidRequestException{} 1207 var buff [1024]byte 1208 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1209 1210 body := io.TeeReader(errorBody, ringBuffer) 1211 decoder := json.NewDecoder(body) 1212 decoder.UseNumber() 1213 var shape interface{} 1214 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1215 var snapshot bytes.Buffer 1216 io.Copy(&snapshot, ringBuffer) 1217 err = &smithy.DeserializationError{ 1218 Err: fmt.Errorf("failed to decode response body, %w", err), 1219 Snapshot: snapshot.Bytes(), 1220 } 1221 return err 1222 } 1223 1224 err := awsRestjson1_deserializeDocumentInvalidRequestException(&output, shape) 1225 1226 if err != nil { 1227 var snapshot bytes.Buffer 1228 io.Copy(&snapshot, ringBuffer) 1229 err = &smithy.DeserializationError{ 1230 Err: fmt.Errorf("failed to decode response body, %w", err), 1231 Snapshot: snapshot.Bytes(), 1232 } 1233 return err 1234 } 1235 1236 errorBody.Seek(0, io.SeekStart) 1237 1238 return output 1239} 1240 1241func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 1242 output := &types.LimitExceededException{} 1243 var buff [1024]byte 1244 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1245 1246 body := io.TeeReader(errorBody, ringBuffer) 1247 decoder := json.NewDecoder(body) 1248 decoder.UseNumber() 1249 var shape interface{} 1250 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1251 var snapshot bytes.Buffer 1252 io.Copy(&snapshot, ringBuffer) 1253 err = &smithy.DeserializationError{ 1254 Err: fmt.Errorf("failed to decode response body, %w", err), 1255 Snapshot: snapshot.Bytes(), 1256 } 1257 return err 1258 } 1259 1260 err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape) 1261 1262 if err != nil { 1263 var snapshot bytes.Buffer 1264 io.Copy(&snapshot, ringBuffer) 1265 err = &smithy.DeserializationError{ 1266 Err: fmt.Errorf("failed to decode response body, %w", err), 1267 Snapshot: snapshot.Bytes(), 1268 } 1269 return err 1270 } 1271 1272 errorBody.Seek(0, io.SeekStart) 1273 1274 return output 1275} 1276 1277func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 1278 output := &types.ResourceNotFoundException{} 1279 var buff [1024]byte 1280 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1281 1282 body := io.TeeReader(errorBody, ringBuffer) 1283 decoder := json.NewDecoder(body) 1284 decoder.UseNumber() 1285 var shape interface{} 1286 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1287 var snapshot bytes.Buffer 1288 io.Copy(&snapshot, ringBuffer) 1289 err = &smithy.DeserializationError{ 1290 Err: fmt.Errorf("failed to decode response body, %w", err), 1291 Snapshot: snapshot.Bytes(), 1292 } 1293 return err 1294 } 1295 1296 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 1297 1298 if err != nil { 1299 var snapshot bytes.Buffer 1300 io.Copy(&snapshot, ringBuffer) 1301 err = &smithy.DeserializationError{ 1302 Err: fmt.Errorf("failed to decode response body, %w", err), 1303 Snapshot: snapshot.Bytes(), 1304 } 1305 return err 1306 } 1307 1308 errorBody.Seek(0, io.SeekStart) 1309 1310 return output 1311} 1312 1313func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 1314 output := &types.ThrottlingException{} 1315 var buff [1024]byte 1316 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1317 1318 body := io.TeeReader(errorBody, ringBuffer) 1319 decoder := json.NewDecoder(body) 1320 decoder.UseNumber() 1321 var shape interface{} 1322 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1323 var snapshot bytes.Buffer 1324 io.Copy(&snapshot, ringBuffer) 1325 err = &smithy.DeserializationError{ 1326 Err: fmt.Errorf("failed to decode response body, %w", err), 1327 Snapshot: snapshot.Bytes(), 1328 } 1329 return err 1330 } 1331 1332 err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) 1333 1334 if err != nil { 1335 var snapshot bytes.Buffer 1336 io.Copy(&snapshot, ringBuffer) 1337 err = &smithy.DeserializationError{ 1338 Err: fmt.Errorf("failed to decode response body, %w", err), 1339 Snapshot: snapshot.Bytes(), 1340 } 1341 return err 1342 } 1343 1344 errorBody.Seek(0, io.SeekStart) 1345 1346 return output 1347} 1348 1349func awsRestjson1_deserializeDocumentApplicationSummaries(v *[]types.ApplicationSummary, value interface{}) error { 1350 if v == nil { 1351 return fmt.Errorf("unexpected nil of type %T", v) 1352 } 1353 if value == nil { 1354 return nil 1355 } 1356 1357 shape, ok := value.([]interface{}) 1358 if !ok { 1359 return fmt.Errorf("unexpected JSON type %v", value) 1360 } 1361 1362 var cv []types.ApplicationSummary 1363 if *v == nil { 1364 cv = []types.ApplicationSummary{} 1365 } else { 1366 cv = *v 1367 } 1368 1369 for _, value := range shape { 1370 var col types.ApplicationSummary 1371 destAddr := &col 1372 if err := awsRestjson1_deserializeDocumentApplicationSummary(&destAddr, value); err != nil { 1373 return err 1374 } 1375 col = *destAddr 1376 cv = append(cv, col) 1377 1378 } 1379 *v = cv 1380 return nil 1381} 1382 1383func awsRestjson1_deserializeDocumentApplicationSummary(v **types.ApplicationSummary, value interface{}) error { 1384 if v == nil { 1385 return fmt.Errorf("unexpected nil of type %T", v) 1386 } 1387 if value == nil { 1388 return nil 1389 } 1390 1391 shape, ok := value.(map[string]interface{}) 1392 if !ok { 1393 return fmt.Errorf("unexpected JSON type %v", value) 1394 } 1395 1396 var sv *types.ApplicationSummary 1397 if *v == nil { 1398 sv = &types.ApplicationSummary{} 1399 } else { 1400 sv = *v 1401 } 1402 1403 for key, value := range shape { 1404 switch key { 1405 case "applicationCreationDate": 1406 if value != nil { 1407 jtv, ok := value.(json.Number) 1408 if !ok { 1409 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 1410 } 1411 i64, err := jtv.Int64() 1412 if err != nil { 1413 return err 1414 } 1415 sv.ApplicationCreationDate = i64 1416 } 1417 1418 case "applicationDescription": 1419 if value != nil { 1420 jtv, ok := value.(string) 1421 if !ok { 1422 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 1423 } 1424 sv.ApplicationDescription = ptr.String(jtv) 1425 } 1426 1427 case "applicationId": 1428 if value != nil { 1429 jtv, ok := value.(string) 1430 if !ok { 1431 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1432 } 1433 sv.ApplicationId = ptr.String(jtv) 1434 } 1435 1436 case "applicationLastUpdateDate": 1437 if value != nil { 1438 jtv, ok := value.(json.Number) 1439 if !ok { 1440 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 1441 } 1442 i64, err := jtv.Int64() 1443 if err != nil { 1444 return err 1445 } 1446 sv.ApplicationLastUpdateDate = i64 1447 } 1448 1449 case "applicationName": 1450 if value != nil { 1451 jtv, ok := value.(string) 1452 if !ok { 1453 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1454 } 1455 sv.ApplicationName = ptr.String(jtv) 1456 } 1457 1458 case "applicationState": 1459 if value != nil { 1460 jtv, ok := value.(string) 1461 if !ok { 1462 return fmt.Errorf("expected ApplicationState to be of type string, got %T instead", value) 1463 } 1464 sv.ApplicationState = types.ApplicationState(jtv) 1465 } 1466 1467 case "applicationUrl": 1468 if value != nil { 1469 jtv, ok := value.(string) 1470 if !ok { 1471 return fmt.Errorf("expected Url to be of type string, got %T instead", value) 1472 } 1473 sv.ApplicationUrl = ptr.String(jtv) 1474 } 1475 1476 default: 1477 _, _ = key, value 1478 1479 } 1480 } 1481 *v = sv 1482 return nil 1483} 1484 1485func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 1486 if v == nil { 1487 return fmt.Errorf("unexpected nil of type %T", v) 1488 } 1489 if value == nil { 1490 return nil 1491 } 1492 1493 shape, ok := value.(map[string]interface{}) 1494 if !ok { 1495 return fmt.Errorf("unexpected JSON type %v", value) 1496 } 1497 1498 var sv *types.ConflictException 1499 if *v == nil { 1500 sv = &types.ConflictException{} 1501 } else { 1502 sv = *v 1503 } 1504 1505 for key, value := range shape { 1506 switch key { 1507 case "message": 1508 if value != nil { 1509 jtv, ok := value.(string) 1510 if !ok { 1511 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1512 } 1513 sv.Message = ptr.String(jtv) 1514 } 1515 1516 default: 1517 _, _ = key, value 1518 1519 } 1520 } 1521 *v = sv 1522 return nil 1523} 1524 1525func awsRestjson1_deserializeDocumentInternalFailureException(v **types.InternalFailureException, value interface{}) error { 1526 if v == nil { 1527 return fmt.Errorf("unexpected nil of type %T", v) 1528 } 1529 if value == nil { 1530 return nil 1531 } 1532 1533 shape, ok := value.(map[string]interface{}) 1534 if !ok { 1535 return fmt.Errorf("unexpected JSON type %v", value) 1536 } 1537 1538 var sv *types.InternalFailureException 1539 if *v == nil { 1540 sv = &types.InternalFailureException{} 1541 } else { 1542 sv = *v 1543 } 1544 1545 for key, value := range shape { 1546 switch key { 1547 case "message": 1548 if value != nil { 1549 jtv, ok := value.(string) 1550 if !ok { 1551 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1552 } 1553 sv.Message = ptr.String(jtv) 1554 } 1555 1556 default: 1557 _, _ = key, value 1558 1559 } 1560 } 1561 *v = sv 1562 return nil 1563} 1564 1565func awsRestjson1_deserializeDocumentInvalidRequestException(v **types.InvalidRequestException, 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 *types.InvalidRequestException 1579 if *v == nil { 1580 sv = &types.InvalidRequestException{} 1581 } else { 1582 sv = *v 1583 } 1584 1585 for key, value := range shape { 1586 switch key { 1587 case "message": 1588 if value != nil { 1589 jtv, ok := value.(string) 1590 if !ok { 1591 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1592 } 1593 sv.Message = ptr.String(jtv) 1594 } 1595 1596 default: 1597 _, _ = key, value 1598 1599 } 1600 } 1601 *v = sv 1602 return nil 1603} 1604 1605func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 1606 if v == nil { 1607 return fmt.Errorf("unexpected nil of type %T", v) 1608 } 1609 if value == nil { 1610 return nil 1611 } 1612 1613 shape, ok := value.(map[string]interface{}) 1614 if !ok { 1615 return fmt.Errorf("unexpected JSON type %v", value) 1616 } 1617 1618 var sv *types.LimitExceededException 1619 if *v == nil { 1620 sv = &types.LimitExceededException{} 1621 } else { 1622 sv = *v 1623 } 1624 1625 for key, value := range shape { 1626 switch key { 1627 case "message": 1628 if value != nil { 1629 jtv, ok := value.(string) 1630 if !ok { 1631 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1632 } 1633 sv.Message = ptr.String(jtv) 1634 } 1635 1636 default: 1637 _, _ = key, value 1638 1639 } 1640 } 1641 *v = sv 1642 return nil 1643} 1644 1645func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 1646 if v == nil { 1647 return fmt.Errorf("unexpected nil of type %T", v) 1648 } 1649 if value == nil { 1650 return nil 1651 } 1652 1653 shape, ok := value.(map[string]interface{}) 1654 if !ok { 1655 return fmt.Errorf("unexpected JSON type %v", value) 1656 } 1657 1658 var sv *types.ResourceNotFoundException 1659 if *v == nil { 1660 sv = &types.ResourceNotFoundException{} 1661 } else { 1662 sv = *v 1663 } 1664 1665 for key, value := range shape { 1666 switch key { 1667 case "message": 1668 if value != nil { 1669 jtv, ok := value.(string) 1670 if !ok { 1671 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1672 } 1673 sv.Message = ptr.String(jtv) 1674 } 1675 1676 default: 1677 _, _ = key, value 1678 1679 } 1680 } 1681 *v = sv 1682 return nil 1683} 1684 1685func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { 1686 if v == nil { 1687 return fmt.Errorf("unexpected nil of type %T", v) 1688 } 1689 if value == nil { 1690 return nil 1691 } 1692 1693 shape, ok := value.(map[string]interface{}) 1694 if !ok { 1695 return fmt.Errorf("unexpected JSON type %v", value) 1696 } 1697 1698 var mv map[string]string 1699 if *v == nil { 1700 mv = map[string]string{} 1701 } else { 1702 mv = *v 1703 } 1704 1705 for key, value := range shape { 1706 var parsedVal string 1707 if value != nil { 1708 jtv, ok := value.(string) 1709 if !ok { 1710 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 1711 } 1712 parsedVal = jtv 1713 } 1714 mv[key] = parsedVal 1715 1716 } 1717 *v = mv 1718 return nil 1719} 1720 1721func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { 1722 if v == nil { 1723 return fmt.Errorf("unexpected nil of type %T", v) 1724 } 1725 if value == nil { 1726 return nil 1727 } 1728 1729 shape, ok := value.(map[string]interface{}) 1730 if !ok { 1731 return fmt.Errorf("unexpected JSON type %v", value) 1732 } 1733 1734 var sv *types.ThrottlingException 1735 if *v == nil { 1736 sv = &types.ThrottlingException{} 1737 } else { 1738 sv = *v 1739 } 1740 1741 for key, value := range shape { 1742 switch key { 1743 case "message": 1744 if value != nil { 1745 jtv, ok := value.(string) 1746 if !ok { 1747 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1748 } 1749 sv.Message = ptr.String(jtv) 1750 } 1751 1752 default: 1753 _, _ = key, value 1754 1755 } 1756 } 1757 *v = sv 1758 return nil 1759} 1760