1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package dataexchange 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/dataexchange/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithytime "github.com/aws/smithy-go/time" 17 smithyhttp "github.com/aws/smithy-go/transport/http" 18 "io" 19 "io/ioutil" 20 "strings" 21) 22 23type awsRestjson1_deserializeOpCancelJob struct { 24} 25 26func (*awsRestjson1_deserializeOpCancelJob) ID() string { 27 return "OperationDeserializer" 28} 29 30func (m *awsRestjson1_deserializeOpCancelJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 31 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 32) { 33 out, metadata, err = next.HandleDeserialize(ctx, in) 34 if err != nil { 35 return out, metadata, err 36 } 37 38 response, ok := out.RawResponse.(*smithyhttp.Response) 39 if !ok { 40 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 41 } 42 43 if response.StatusCode < 200 || response.StatusCode >= 300 { 44 return out, metadata, awsRestjson1_deserializeOpErrorCancelJob(response, &metadata) 45 } 46 output := &CancelJobOutput{} 47 out.Result = output 48 49 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 50 return out, metadata, &smithy.DeserializationError{ 51 Err: fmt.Errorf("failed to discard response body, %w", err), 52 } 53 } 54 55 return out, metadata, err 56} 57 58func awsRestjson1_deserializeOpErrorCancelJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 59 var errorBuffer bytes.Buffer 60 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 61 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 62 } 63 errorBody := bytes.NewReader(errorBuffer.Bytes()) 64 65 errorCode := "UnknownError" 66 errorMessage := errorCode 67 68 code := response.Header.Get("X-Amzn-ErrorType") 69 if len(code) != 0 { 70 errorCode = restjson.SanitizeErrorCode(code) 71 } 72 73 var buff [1024]byte 74 ringBuffer := smithyio.NewRingBuffer(buff[:]) 75 76 body := io.TeeReader(errorBody, ringBuffer) 77 decoder := json.NewDecoder(body) 78 decoder.UseNumber() 79 code, message, err := restjson.GetErrorInfo(decoder) 80 if err != nil { 81 var snapshot bytes.Buffer 82 io.Copy(&snapshot, ringBuffer) 83 err = &smithy.DeserializationError{ 84 Err: fmt.Errorf("failed to decode response body, %w", err), 85 Snapshot: snapshot.Bytes(), 86 } 87 return err 88 } 89 90 errorBody.Seek(0, io.SeekStart) 91 if len(code) != 0 { 92 errorCode = restjson.SanitizeErrorCode(code) 93 } 94 if len(message) != 0 { 95 errorMessage = message 96 } 97 98 switch { 99 case strings.EqualFold("ConflictException", errorCode): 100 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 101 102 case strings.EqualFold("InternalServerException", errorCode): 103 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 104 105 case strings.EqualFold("ResourceNotFoundException", errorCode): 106 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 107 108 case strings.EqualFold("ThrottlingException", errorCode): 109 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 110 111 case strings.EqualFold("ValidationException", errorCode): 112 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 113 114 default: 115 genericError := &smithy.GenericAPIError{ 116 Code: errorCode, 117 Message: errorMessage, 118 } 119 return genericError 120 121 } 122} 123 124type awsRestjson1_deserializeOpCreateDataSet struct { 125} 126 127func (*awsRestjson1_deserializeOpCreateDataSet) ID() string { 128 return "OperationDeserializer" 129} 130 131func (m *awsRestjson1_deserializeOpCreateDataSet) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 132 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 133) { 134 out, metadata, err = next.HandleDeserialize(ctx, in) 135 if err != nil { 136 return out, metadata, err 137 } 138 139 response, ok := out.RawResponse.(*smithyhttp.Response) 140 if !ok { 141 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 142 } 143 144 if response.StatusCode < 200 || response.StatusCode >= 300 { 145 return out, metadata, awsRestjson1_deserializeOpErrorCreateDataSet(response, &metadata) 146 } 147 output := &CreateDataSetOutput{} 148 out.Result = output 149 150 var buff [1024]byte 151 ringBuffer := smithyio.NewRingBuffer(buff[:]) 152 153 body := io.TeeReader(response.Body, ringBuffer) 154 155 decoder := json.NewDecoder(body) 156 decoder.UseNumber() 157 var shape interface{} 158 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 159 var snapshot bytes.Buffer 160 io.Copy(&snapshot, ringBuffer) 161 err = &smithy.DeserializationError{ 162 Err: fmt.Errorf("failed to decode response body, %w", err), 163 Snapshot: snapshot.Bytes(), 164 } 165 return out, metadata, err 166 } 167 168 err = awsRestjson1_deserializeOpDocumentCreateDataSetOutput(&output, shape) 169 if err != nil { 170 var snapshot bytes.Buffer 171 io.Copy(&snapshot, ringBuffer) 172 return out, metadata, &smithy.DeserializationError{ 173 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 174 Snapshot: snapshot.Bytes(), 175 } 176 } 177 178 return out, metadata, err 179} 180 181func awsRestjson1_deserializeOpErrorCreateDataSet(response *smithyhttp.Response, metadata *middleware.Metadata) error { 182 var errorBuffer bytes.Buffer 183 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 184 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 185 } 186 errorBody := bytes.NewReader(errorBuffer.Bytes()) 187 188 errorCode := "UnknownError" 189 errorMessage := errorCode 190 191 code := response.Header.Get("X-Amzn-ErrorType") 192 if len(code) != 0 { 193 errorCode = restjson.SanitizeErrorCode(code) 194 } 195 196 var buff [1024]byte 197 ringBuffer := smithyio.NewRingBuffer(buff[:]) 198 199 body := io.TeeReader(errorBody, ringBuffer) 200 decoder := json.NewDecoder(body) 201 decoder.UseNumber() 202 code, message, err := restjson.GetErrorInfo(decoder) 203 if err != nil { 204 var snapshot bytes.Buffer 205 io.Copy(&snapshot, ringBuffer) 206 err = &smithy.DeserializationError{ 207 Err: fmt.Errorf("failed to decode response body, %w", err), 208 Snapshot: snapshot.Bytes(), 209 } 210 return err 211 } 212 213 errorBody.Seek(0, io.SeekStart) 214 if len(code) != 0 { 215 errorCode = restjson.SanitizeErrorCode(code) 216 } 217 if len(message) != 0 { 218 errorMessage = message 219 } 220 221 switch { 222 case strings.EqualFold("AccessDeniedException", errorCode): 223 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 224 225 case strings.EqualFold("InternalServerException", errorCode): 226 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 227 228 case strings.EqualFold("ServiceLimitExceededException", errorCode): 229 return awsRestjson1_deserializeErrorServiceLimitExceededException(response, errorBody) 230 231 case strings.EqualFold("ThrottlingException", errorCode): 232 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 233 234 case strings.EqualFold("ValidationException", errorCode): 235 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 236 237 default: 238 genericError := &smithy.GenericAPIError{ 239 Code: errorCode, 240 Message: errorMessage, 241 } 242 return genericError 243 244 } 245} 246 247func awsRestjson1_deserializeOpDocumentCreateDataSetOutput(v **CreateDataSetOutput, value interface{}) error { 248 if v == nil { 249 return fmt.Errorf("unexpected nil of type %T", v) 250 } 251 if value == nil { 252 return nil 253 } 254 255 shape, ok := value.(map[string]interface{}) 256 if !ok { 257 return fmt.Errorf("unexpected JSON type %v", value) 258 } 259 260 var sv *CreateDataSetOutput 261 if *v == nil { 262 sv = &CreateDataSetOutput{} 263 } else { 264 sv = *v 265 } 266 267 for key, value := range shape { 268 switch key { 269 case "Arn": 270 if value != nil { 271 jtv, ok := value.(string) 272 if !ok { 273 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 274 } 275 sv.Arn = ptr.String(jtv) 276 } 277 278 case "AssetType": 279 if value != nil { 280 jtv, ok := value.(string) 281 if !ok { 282 return fmt.Errorf("expected AssetType to be of type string, got %T instead", value) 283 } 284 sv.AssetType = types.AssetType(jtv) 285 } 286 287 case "CreatedAt": 288 if value != nil { 289 jtv, ok := value.(string) 290 if !ok { 291 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 292 } 293 t, err := smithytime.ParseDateTime(jtv) 294 if err != nil { 295 return err 296 } 297 sv.CreatedAt = ptr.Time(t) 298 } 299 300 case "Description": 301 if value != nil { 302 jtv, ok := value.(string) 303 if !ok { 304 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 305 } 306 sv.Description = ptr.String(jtv) 307 } 308 309 case "Id": 310 if value != nil { 311 jtv, ok := value.(string) 312 if !ok { 313 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 314 } 315 sv.Id = ptr.String(jtv) 316 } 317 318 case "Name": 319 if value != nil { 320 jtv, ok := value.(string) 321 if !ok { 322 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 323 } 324 sv.Name = ptr.String(jtv) 325 } 326 327 case "Origin": 328 if value != nil { 329 jtv, ok := value.(string) 330 if !ok { 331 return fmt.Errorf("expected Origin to be of type string, got %T instead", value) 332 } 333 sv.Origin = types.Origin(jtv) 334 } 335 336 case "OriginDetails": 337 if err := awsRestjson1_deserializeDocumentOriginDetails(&sv.OriginDetails, value); err != nil { 338 return err 339 } 340 341 case "SourceId": 342 if value != nil { 343 jtv, ok := value.(string) 344 if !ok { 345 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 346 } 347 sv.SourceId = ptr.String(jtv) 348 } 349 350 case "Tags": 351 if err := awsRestjson1_deserializeDocumentMapOf__string(&sv.Tags, value); err != nil { 352 return err 353 } 354 355 case "UpdatedAt": 356 if value != nil { 357 jtv, ok := value.(string) 358 if !ok { 359 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 360 } 361 t, err := smithytime.ParseDateTime(jtv) 362 if err != nil { 363 return err 364 } 365 sv.UpdatedAt = ptr.Time(t) 366 } 367 368 default: 369 _, _ = key, value 370 371 } 372 } 373 *v = sv 374 return nil 375} 376 377type awsRestjson1_deserializeOpCreateJob struct { 378} 379 380func (*awsRestjson1_deserializeOpCreateJob) ID() string { 381 return "OperationDeserializer" 382} 383 384func (m *awsRestjson1_deserializeOpCreateJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 385 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 386) { 387 out, metadata, err = next.HandleDeserialize(ctx, in) 388 if err != nil { 389 return out, metadata, err 390 } 391 392 response, ok := out.RawResponse.(*smithyhttp.Response) 393 if !ok { 394 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 395 } 396 397 if response.StatusCode < 200 || response.StatusCode >= 300 { 398 return out, metadata, awsRestjson1_deserializeOpErrorCreateJob(response, &metadata) 399 } 400 output := &CreateJobOutput{} 401 out.Result = output 402 403 var buff [1024]byte 404 ringBuffer := smithyio.NewRingBuffer(buff[:]) 405 406 body := io.TeeReader(response.Body, ringBuffer) 407 408 decoder := json.NewDecoder(body) 409 decoder.UseNumber() 410 var shape interface{} 411 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 412 var snapshot bytes.Buffer 413 io.Copy(&snapshot, ringBuffer) 414 err = &smithy.DeserializationError{ 415 Err: fmt.Errorf("failed to decode response body, %w", err), 416 Snapshot: snapshot.Bytes(), 417 } 418 return out, metadata, err 419 } 420 421 err = awsRestjson1_deserializeOpDocumentCreateJobOutput(&output, shape) 422 if err != nil { 423 var snapshot bytes.Buffer 424 io.Copy(&snapshot, ringBuffer) 425 return out, metadata, &smithy.DeserializationError{ 426 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 427 Snapshot: snapshot.Bytes(), 428 } 429 } 430 431 return out, metadata, err 432} 433 434func awsRestjson1_deserializeOpErrorCreateJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 435 var errorBuffer bytes.Buffer 436 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 437 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 438 } 439 errorBody := bytes.NewReader(errorBuffer.Bytes()) 440 441 errorCode := "UnknownError" 442 errorMessage := errorCode 443 444 code := response.Header.Get("X-Amzn-ErrorType") 445 if len(code) != 0 { 446 errorCode = restjson.SanitizeErrorCode(code) 447 } 448 449 var buff [1024]byte 450 ringBuffer := smithyio.NewRingBuffer(buff[:]) 451 452 body := io.TeeReader(errorBody, ringBuffer) 453 decoder := json.NewDecoder(body) 454 decoder.UseNumber() 455 code, message, err := restjson.GetErrorInfo(decoder) 456 if err != nil { 457 var snapshot bytes.Buffer 458 io.Copy(&snapshot, ringBuffer) 459 err = &smithy.DeserializationError{ 460 Err: fmt.Errorf("failed to decode response body, %w", err), 461 Snapshot: snapshot.Bytes(), 462 } 463 return err 464 } 465 466 errorBody.Seek(0, io.SeekStart) 467 if len(code) != 0 { 468 errorCode = restjson.SanitizeErrorCode(code) 469 } 470 if len(message) != 0 { 471 errorMessage = message 472 } 473 474 switch { 475 case strings.EqualFold("AccessDeniedException", errorCode): 476 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 477 478 case strings.EqualFold("InternalServerException", errorCode): 479 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 480 481 case strings.EqualFold("ResourceNotFoundException", errorCode): 482 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 483 484 case strings.EqualFold("ThrottlingException", errorCode): 485 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 486 487 case strings.EqualFold("ValidationException", errorCode): 488 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 489 490 default: 491 genericError := &smithy.GenericAPIError{ 492 Code: errorCode, 493 Message: errorMessage, 494 } 495 return genericError 496 497 } 498} 499 500func awsRestjson1_deserializeOpDocumentCreateJobOutput(v **CreateJobOutput, value interface{}) error { 501 if v == nil { 502 return fmt.Errorf("unexpected nil of type %T", v) 503 } 504 if value == nil { 505 return nil 506 } 507 508 shape, ok := value.(map[string]interface{}) 509 if !ok { 510 return fmt.Errorf("unexpected JSON type %v", value) 511 } 512 513 var sv *CreateJobOutput 514 if *v == nil { 515 sv = &CreateJobOutput{} 516 } else { 517 sv = *v 518 } 519 520 for key, value := range shape { 521 switch key { 522 case "Arn": 523 if value != nil { 524 jtv, ok := value.(string) 525 if !ok { 526 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 527 } 528 sv.Arn = ptr.String(jtv) 529 } 530 531 case "CreatedAt": 532 if value != nil { 533 jtv, ok := value.(string) 534 if !ok { 535 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 536 } 537 t, err := smithytime.ParseDateTime(jtv) 538 if err != nil { 539 return err 540 } 541 sv.CreatedAt = ptr.Time(t) 542 } 543 544 case "Details": 545 if err := awsRestjson1_deserializeDocumentResponseDetails(&sv.Details, value); err != nil { 546 return err 547 } 548 549 case "Errors": 550 if err := awsRestjson1_deserializeDocumentListOfJobError(&sv.Errors, value); err != nil { 551 return err 552 } 553 554 case "Id": 555 if value != nil { 556 jtv, ok := value.(string) 557 if !ok { 558 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 559 } 560 sv.Id = ptr.String(jtv) 561 } 562 563 case "State": 564 if value != nil { 565 jtv, ok := value.(string) 566 if !ok { 567 return fmt.Errorf("expected State to be of type string, got %T instead", value) 568 } 569 sv.State = types.State(jtv) 570 } 571 572 case "Type": 573 if value != nil { 574 jtv, ok := value.(string) 575 if !ok { 576 return fmt.Errorf("expected Type to be of type string, got %T instead", value) 577 } 578 sv.Type = types.Type(jtv) 579 } 580 581 case "UpdatedAt": 582 if value != nil { 583 jtv, ok := value.(string) 584 if !ok { 585 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 586 } 587 t, err := smithytime.ParseDateTime(jtv) 588 if err != nil { 589 return err 590 } 591 sv.UpdatedAt = ptr.Time(t) 592 } 593 594 default: 595 _, _ = key, value 596 597 } 598 } 599 *v = sv 600 return nil 601} 602 603type awsRestjson1_deserializeOpCreateRevision struct { 604} 605 606func (*awsRestjson1_deserializeOpCreateRevision) ID() string { 607 return "OperationDeserializer" 608} 609 610func (m *awsRestjson1_deserializeOpCreateRevision) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 611 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 612) { 613 out, metadata, err = next.HandleDeserialize(ctx, in) 614 if err != nil { 615 return out, metadata, err 616 } 617 618 response, ok := out.RawResponse.(*smithyhttp.Response) 619 if !ok { 620 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 621 } 622 623 if response.StatusCode < 200 || response.StatusCode >= 300 { 624 return out, metadata, awsRestjson1_deserializeOpErrorCreateRevision(response, &metadata) 625 } 626 output := &CreateRevisionOutput{} 627 out.Result = output 628 629 var buff [1024]byte 630 ringBuffer := smithyio.NewRingBuffer(buff[:]) 631 632 body := io.TeeReader(response.Body, ringBuffer) 633 634 decoder := json.NewDecoder(body) 635 decoder.UseNumber() 636 var shape interface{} 637 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 638 var snapshot bytes.Buffer 639 io.Copy(&snapshot, ringBuffer) 640 err = &smithy.DeserializationError{ 641 Err: fmt.Errorf("failed to decode response body, %w", err), 642 Snapshot: snapshot.Bytes(), 643 } 644 return out, metadata, err 645 } 646 647 err = awsRestjson1_deserializeOpDocumentCreateRevisionOutput(&output, shape) 648 if err != nil { 649 var snapshot bytes.Buffer 650 io.Copy(&snapshot, ringBuffer) 651 return out, metadata, &smithy.DeserializationError{ 652 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 653 Snapshot: snapshot.Bytes(), 654 } 655 } 656 657 return out, metadata, err 658} 659 660func awsRestjson1_deserializeOpErrorCreateRevision(response *smithyhttp.Response, metadata *middleware.Metadata) error { 661 var errorBuffer bytes.Buffer 662 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 663 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 664 } 665 errorBody := bytes.NewReader(errorBuffer.Bytes()) 666 667 errorCode := "UnknownError" 668 errorMessage := errorCode 669 670 code := response.Header.Get("X-Amzn-ErrorType") 671 if len(code) != 0 { 672 errorCode = restjson.SanitizeErrorCode(code) 673 } 674 675 var buff [1024]byte 676 ringBuffer := smithyio.NewRingBuffer(buff[:]) 677 678 body := io.TeeReader(errorBody, ringBuffer) 679 decoder := json.NewDecoder(body) 680 decoder.UseNumber() 681 code, message, err := restjson.GetErrorInfo(decoder) 682 if err != nil { 683 var snapshot bytes.Buffer 684 io.Copy(&snapshot, ringBuffer) 685 err = &smithy.DeserializationError{ 686 Err: fmt.Errorf("failed to decode response body, %w", err), 687 Snapshot: snapshot.Bytes(), 688 } 689 return err 690 } 691 692 errorBody.Seek(0, io.SeekStart) 693 if len(code) != 0 { 694 errorCode = restjson.SanitizeErrorCode(code) 695 } 696 if len(message) != 0 { 697 errorMessage = message 698 } 699 700 switch { 701 case strings.EqualFold("AccessDeniedException", errorCode): 702 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 703 704 case strings.EqualFold("InternalServerException", errorCode): 705 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 706 707 case strings.EqualFold("ResourceNotFoundException", errorCode): 708 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 709 710 case strings.EqualFold("ThrottlingException", errorCode): 711 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 712 713 case strings.EqualFold("ValidationException", errorCode): 714 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 715 716 default: 717 genericError := &smithy.GenericAPIError{ 718 Code: errorCode, 719 Message: errorMessage, 720 } 721 return genericError 722 723 } 724} 725 726func awsRestjson1_deserializeOpDocumentCreateRevisionOutput(v **CreateRevisionOutput, value interface{}) error { 727 if v == nil { 728 return fmt.Errorf("unexpected nil of type %T", v) 729 } 730 if value == nil { 731 return nil 732 } 733 734 shape, ok := value.(map[string]interface{}) 735 if !ok { 736 return fmt.Errorf("unexpected JSON type %v", value) 737 } 738 739 var sv *CreateRevisionOutput 740 if *v == nil { 741 sv = &CreateRevisionOutput{} 742 } else { 743 sv = *v 744 } 745 746 for key, value := range shape { 747 switch key { 748 case "Arn": 749 if value != nil { 750 jtv, ok := value.(string) 751 if !ok { 752 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 753 } 754 sv.Arn = ptr.String(jtv) 755 } 756 757 case "Comment": 758 if value != nil { 759 jtv, ok := value.(string) 760 if !ok { 761 return fmt.Errorf("expected __stringMin0Max16384 to be of type string, got %T instead", value) 762 } 763 sv.Comment = ptr.String(jtv) 764 } 765 766 case "CreatedAt": 767 if value != nil { 768 jtv, ok := value.(string) 769 if !ok { 770 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 771 } 772 t, err := smithytime.ParseDateTime(jtv) 773 if err != nil { 774 return err 775 } 776 sv.CreatedAt = ptr.Time(t) 777 } 778 779 case "DataSetId": 780 if value != nil { 781 jtv, ok := value.(string) 782 if !ok { 783 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 784 } 785 sv.DataSetId = ptr.String(jtv) 786 } 787 788 case "Finalized": 789 if value != nil { 790 jtv, ok := value.(bool) 791 if !ok { 792 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 793 } 794 sv.Finalized = jtv 795 } 796 797 case "Id": 798 if value != nil { 799 jtv, ok := value.(string) 800 if !ok { 801 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 802 } 803 sv.Id = ptr.String(jtv) 804 } 805 806 case "SourceId": 807 if value != nil { 808 jtv, ok := value.(string) 809 if !ok { 810 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 811 } 812 sv.SourceId = ptr.String(jtv) 813 } 814 815 case "Tags": 816 if err := awsRestjson1_deserializeDocumentMapOf__string(&sv.Tags, value); err != nil { 817 return err 818 } 819 820 case "UpdatedAt": 821 if value != nil { 822 jtv, ok := value.(string) 823 if !ok { 824 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 825 } 826 t, err := smithytime.ParseDateTime(jtv) 827 if err != nil { 828 return err 829 } 830 sv.UpdatedAt = ptr.Time(t) 831 } 832 833 default: 834 _, _ = key, value 835 836 } 837 } 838 *v = sv 839 return nil 840} 841 842type awsRestjson1_deserializeOpDeleteAsset struct { 843} 844 845func (*awsRestjson1_deserializeOpDeleteAsset) ID() string { 846 return "OperationDeserializer" 847} 848 849func (m *awsRestjson1_deserializeOpDeleteAsset) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 850 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 851) { 852 out, metadata, err = next.HandleDeserialize(ctx, in) 853 if err != nil { 854 return out, metadata, err 855 } 856 857 response, ok := out.RawResponse.(*smithyhttp.Response) 858 if !ok { 859 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 860 } 861 862 if response.StatusCode < 200 || response.StatusCode >= 300 { 863 return out, metadata, awsRestjson1_deserializeOpErrorDeleteAsset(response, &metadata) 864 } 865 output := &DeleteAssetOutput{} 866 out.Result = output 867 868 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 869 return out, metadata, &smithy.DeserializationError{ 870 Err: fmt.Errorf("failed to discard response body, %w", err), 871 } 872 } 873 874 return out, metadata, err 875} 876 877func awsRestjson1_deserializeOpErrorDeleteAsset(response *smithyhttp.Response, metadata *middleware.Metadata) error { 878 var errorBuffer bytes.Buffer 879 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 880 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 881 } 882 errorBody := bytes.NewReader(errorBuffer.Bytes()) 883 884 errorCode := "UnknownError" 885 errorMessage := errorCode 886 887 code := response.Header.Get("X-Amzn-ErrorType") 888 if len(code) != 0 { 889 errorCode = restjson.SanitizeErrorCode(code) 890 } 891 892 var buff [1024]byte 893 ringBuffer := smithyio.NewRingBuffer(buff[:]) 894 895 body := io.TeeReader(errorBody, ringBuffer) 896 decoder := json.NewDecoder(body) 897 decoder.UseNumber() 898 code, message, err := restjson.GetErrorInfo(decoder) 899 if err != nil { 900 var snapshot bytes.Buffer 901 io.Copy(&snapshot, ringBuffer) 902 err = &smithy.DeserializationError{ 903 Err: fmt.Errorf("failed to decode response body, %w", err), 904 Snapshot: snapshot.Bytes(), 905 } 906 return err 907 } 908 909 errorBody.Seek(0, io.SeekStart) 910 if len(code) != 0 { 911 errorCode = restjson.SanitizeErrorCode(code) 912 } 913 if len(message) != 0 { 914 errorMessage = message 915 } 916 917 switch { 918 case strings.EqualFold("AccessDeniedException", errorCode): 919 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 920 921 case strings.EqualFold("ConflictException", errorCode): 922 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 923 924 case strings.EqualFold("InternalServerException", errorCode): 925 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 926 927 case strings.EqualFold("ResourceNotFoundException", errorCode): 928 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 929 930 case strings.EqualFold("ThrottlingException", errorCode): 931 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 932 933 case strings.EqualFold("ValidationException", errorCode): 934 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 935 936 default: 937 genericError := &smithy.GenericAPIError{ 938 Code: errorCode, 939 Message: errorMessage, 940 } 941 return genericError 942 943 } 944} 945 946type awsRestjson1_deserializeOpDeleteDataSet struct { 947} 948 949func (*awsRestjson1_deserializeOpDeleteDataSet) ID() string { 950 return "OperationDeserializer" 951} 952 953func (m *awsRestjson1_deserializeOpDeleteDataSet) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 954 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 955) { 956 out, metadata, err = next.HandleDeserialize(ctx, in) 957 if err != nil { 958 return out, metadata, err 959 } 960 961 response, ok := out.RawResponse.(*smithyhttp.Response) 962 if !ok { 963 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 964 } 965 966 if response.StatusCode < 200 || response.StatusCode >= 300 { 967 return out, metadata, awsRestjson1_deserializeOpErrorDeleteDataSet(response, &metadata) 968 } 969 output := &DeleteDataSetOutput{} 970 out.Result = output 971 972 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 973 return out, metadata, &smithy.DeserializationError{ 974 Err: fmt.Errorf("failed to discard response body, %w", err), 975 } 976 } 977 978 return out, metadata, err 979} 980 981func awsRestjson1_deserializeOpErrorDeleteDataSet(response *smithyhttp.Response, metadata *middleware.Metadata) error { 982 var errorBuffer bytes.Buffer 983 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 984 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 985 } 986 errorBody := bytes.NewReader(errorBuffer.Bytes()) 987 988 errorCode := "UnknownError" 989 errorMessage := errorCode 990 991 code := response.Header.Get("X-Amzn-ErrorType") 992 if len(code) != 0 { 993 errorCode = restjson.SanitizeErrorCode(code) 994 } 995 996 var buff [1024]byte 997 ringBuffer := smithyio.NewRingBuffer(buff[:]) 998 999 body := io.TeeReader(errorBody, ringBuffer) 1000 decoder := json.NewDecoder(body) 1001 decoder.UseNumber() 1002 code, message, err := restjson.GetErrorInfo(decoder) 1003 if err != nil { 1004 var snapshot bytes.Buffer 1005 io.Copy(&snapshot, ringBuffer) 1006 err = &smithy.DeserializationError{ 1007 Err: fmt.Errorf("failed to decode response body, %w", err), 1008 Snapshot: snapshot.Bytes(), 1009 } 1010 return err 1011 } 1012 1013 errorBody.Seek(0, io.SeekStart) 1014 if len(code) != 0 { 1015 errorCode = restjson.SanitizeErrorCode(code) 1016 } 1017 if len(message) != 0 { 1018 errorMessage = message 1019 } 1020 1021 switch { 1022 case strings.EqualFold("AccessDeniedException", errorCode): 1023 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1024 1025 case strings.EqualFold("ConflictException", errorCode): 1026 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1027 1028 case strings.EqualFold("InternalServerException", errorCode): 1029 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1030 1031 case strings.EqualFold("ResourceNotFoundException", errorCode): 1032 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1033 1034 case strings.EqualFold("ThrottlingException", errorCode): 1035 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1036 1037 case strings.EqualFold("ValidationException", errorCode): 1038 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1039 1040 default: 1041 genericError := &smithy.GenericAPIError{ 1042 Code: errorCode, 1043 Message: errorMessage, 1044 } 1045 return genericError 1046 1047 } 1048} 1049 1050type awsRestjson1_deserializeOpDeleteRevision struct { 1051} 1052 1053func (*awsRestjson1_deserializeOpDeleteRevision) ID() string { 1054 return "OperationDeserializer" 1055} 1056 1057func (m *awsRestjson1_deserializeOpDeleteRevision) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1058 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1059) { 1060 out, metadata, err = next.HandleDeserialize(ctx, in) 1061 if err != nil { 1062 return out, metadata, err 1063 } 1064 1065 response, ok := out.RawResponse.(*smithyhttp.Response) 1066 if !ok { 1067 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1068 } 1069 1070 if response.StatusCode < 200 || response.StatusCode >= 300 { 1071 return out, metadata, awsRestjson1_deserializeOpErrorDeleteRevision(response, &metadata) 1072 } 1073 output := &DeleteRevisionOutput{} 1074 out.Result = output 1075 1076 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 1077 return out, metadata, &smithy.DeserializationError{ 1078 Err: fmt.Errorf("failed to discard response body, %w", err), 1079 } 1080 } 1081 1082 return out, metadata, err 1083} 1084 1085func awsRestjson1_deserializeOpErrorDeleteRevision(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1086 var errorBuffer bytes.Buffer 1087 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1088 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1089 } 1090 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1091 1092 errorCode := "UnknownError" 1093 errorMessage := errorCode 1094 1095 code := response.Header.Get("X-Amzn-ErrorType") 1096 if len(code) != 0 { 1097 errorCode = restjson.SanitizeErrorCode(code) 1098 } 1099 1100 var buff [1024]byte 1101 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1102 1103 body := io.TeeReader(errorBody, ringBuffer) 1104 decoder := json.NewDecoder(body) 1105 decoder.UseNumber() 1106 code, message, err := restjson.GetErrorInfo(decoder) 1107 if err != nil { 1108 var snapshot bytes.Buffer 1109 io.Copy(&snapshot, ringBuffer) 1110 err = &smithy.DeserializationError{ 1111 Err: fmt.Errorf("failed to decode response body, %w", err), 1112 Snapshot: snapshot.Bytes(), 1113 } 1114 return err 1115 } 1116 1117 errorBody.Seek(0, io.SeekStart) 1118 if len(code) != 0 { 1119 errorCode = restjson.SanitizeErrorCode(code) 1120 } 1121 if len(message) != 0 { 1122 errorMessage = message 1123 } 1124 1125 switch { 1126 case strings.EqualFold("AccessDeniedException", errorCode): 1127 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1128 1129 case strings.EqualFold("ConflictException", errorCode): 1130 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1131 1132 case strings.EqualFold("InternalServerException", errorCode): 1133 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1134 1135 case strings.EqualFold("ResourceNotFoundException", errorCode): 1136 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1137 1138 case strings.EqualFold("ThrottlingException", errorCode): 1139 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1140 1141 case strings.EqualFold("ValidationException", errorCode): 1142 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1143 1144 default: 1145 genericError := &smithy.GenericAPIError{ 1146 Code: errorCode, 1147 Message: errorMessage, 1148 } 1149 return genericError 1150 1151 } 1152} 1153 1154type awsRestjson1_deserializeOpGetAsset struct { 1155} 1156 1157func (*awsRestjson1_deserializeOpGetAsset) ID() string { 1158 return "OperationDeserializer" 1159} 1160 1161func (m *awsRestjson1_deserializeOpGetAsset) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1162 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1163) { 1164 out, metadata, err = next.HandleDeserialize(ctx, in) 1165 if err != nil { 1166 return out, metadata, err 1167 } 1168 1169 response, ok := out.RawResponse.(*smithyhttp.Response) 1170 if !ok { 1171 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1172 } 1173 1174 if response.StatusCode < 200 || response.StatusCode >= 300 { 1175 return out, metadata, awsRestjson1_deserializeOpErrorGetAsset(response, &metadata) 1176 } 1177 output := &GetAssetOutput{} 1178 out.Result = output 1179 1180 var buff [1024]byte 1181 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1182 1183 body := io.TeeReader(response.Body, ringBuffer) 1184 1185 decoder := json.NewDecoder(body) 1186 decoder.UseNumber() 1187 var shape interface{} 1188 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1189 var snapshot bytes.Buffer 1190 io.Copy(&snapshot, ringBuffer) 1191 err = &smithy.DeserializationError{ 1192 Err: fmt.Errorf("failed to decode response body, %w", err), 1193 Snapshot: snapshot.Bytes(), 1194 } 1195 return out, metadata, err 1196 } 1197 1198 err = awsRestjson1_deserializeOpDocumentGetAssetOutput(&output, shape) 1199 if err != nil { 1200 var snapshot bytes.Buffer 1201 io.Copy(&snapshot, ringBuffer) 1202 return out, metadata, &smithy.DeserializationError{ 1203 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1204 Snapshot: snapshot.Bytes(), 1205 } 1206 } 1207 1208 return out, metadata, err 1209} 1210 1211func awsRestjson1_deserializeOpErrorGetAsset(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1212 var errorBuffer bytes.Buffer 1213 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1214 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1215 } 1216 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1217 1218 errorCode := "UnknownError" 1219 errorMessage := errorCode 1220 1221 code := response.Header.Get("X-Amzn-ErrorType") 1222 if len(code) != 0 { 1223 errorCode = restjson.SanitizeErrorCode(code) 1224 } 1225 1226 var buff [1024]byte 1227 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1228 1229 body := io.TeeReader(errorBody, ringBuffer) 1230 decoder := json.NewDecoder(body) 1231 decoder.UseNumber() 1232 code, message, err := restjson.GetErrorInfo(decoder) 1233 if err != nil { 1234 var snapshot bytes.Buffer 1235 io.Copy(&snapshot, ringBuffer) 1236 err = &smithy.DeserializationError{ 1237 Err: fmt.Errorf("failed to decode response body, %w", err), 1238 Snapshot: snapshot.Bytes(), 1239 } 1240 return err 1241 } 1242 1243 errorBody.Seek(0, io.SeekStart) 1244 if len(code) != 0 { 1245 errorCode = restjson.SanitizeErrorCode(code) 1246 } 1247 if len(message) != 0 { 1248 errorMessage = message 1249 } 1250 1251 switch { 1252 case strings.EqualFold("InternalServerException", errorCode): 1253 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1254 1255 case strings.EqualFold("ResourceNotFoundException", errorCode): 1256 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1257 1258 case strings.EqualFold("ThrottlingException", errorCode): 1259 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1260 1261 case strings.EqualFold("ValidationException", errorCode): 1262 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1263 1264 default: 1265 genericError := &smithy.GenericAPIError{ 1266 Code: errorCode, 1267 Message: errorMessage, 1268 } 1269 return genericError 1270 1271 } 1272} 1273 1274func awsRestjson1_deserializeOpDocumentGetAssetOutput(v **GetAssetOutput, value interface{}) error { 1275 if v == nil { 1276 return fmt.Errorf("unexpected nil of type %T", v) 1277 } 1278 if value == nil { 1279 return nil 1280 } 1281 1282 shape, ok := value.(map[string]interface{}) 1283 if !ok { 1284 return fmt.Errorf("unexpected JSON type %v", value) 1285 } 1286 1287 var sv *GetAssetOutput 1288 if *v == nil { 1289 sv = &GetAssetOutput{} 1290 } else { 1291 sv = *v 1292 } 1293 1294 for key, value := range shape { 1295 switch key { 1296 case "Arn": 1297 if value != nil { 1298 jtv, ok := value.(string) 1299 if !ok { 1300 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1301 } 1302 sv.Arn = ptr.String(jtv) 1303 } 1304 1305 case "AssetDetails": 1306 if err := awsRestjson1_deserializeDocumentAssetDetails(&sv.AssetDetails, value); err != nil { 1307 return err 1308 } 1309 1310 case "AssetType": 1311 if value != nil { 1312 jtv, ok := value.(string) 1313 if !ok { 1314 return fmt.Errorf("expected AssetType to be of type string, got %T instead", value) 1315 } 1316 sv.AssetType = types.AssetType(jtv) 1317 } 1318 1319 case "CreatedAt": 1320 if value != nil { 1321 jtv, ok := value.(string) 1322 if !ok { 1323 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1324 } 1325 t, err := smithytime.ParseDateTime(jtv) 1326 if err != nil { 1327 return err 1328 } 1329 sv.CreatedAt = ptr.Time(t) 1330 } 1331 1332 case "DataSetId": 1333 if value != nil { 1334 jtv, ok := value.(string) 1335 if !ok { 1336 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1337 } 1338 sv.DataSetId = ptr.String(jtv) 1339 } 1340 1341 case "Id": 1342 if value != nil { 1343 jtv, ok := value.(string) 1344 if !ok { 1345 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1346 } 1347 sv.Id = ptr.String(jtv) 1348 } 1349 1350 case "Name": 1351 if value != nil { 1352 jtv, ok := value.(string) 1353 if !ok { 1354 return fmt.Errorf("expected AssetName to be of type string, got %T instead", value) 1355 } 1356 sv.Name = ptr.String(jtv) 1357 } 1358 1359 case "RevisionId": 1360 if value != nil { 1361 jtv, ok := value.(string) 1362 if !ok { 1363 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1364 } 1365 sv.RevisionId = ptr.String(jtv) 1366 } 1367 1368 case "SourceId": 1369 if value != nil { 1370 jtv, ok := value.(string) 1371 if !ok { 1372 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1373 } 1374 sv.SourceId = ptr.String(jtv) 1375 } 1376 1377 case "UpdatedAt": 1378 if value != nil { 1379 jtv, ok := value.(string) 1380 if !ok { 1381 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1382 } 1383 t, err := smithytime.ParseDateTime(jtv) 1384 if err != nil { 1385 return err 1386 } 1387 sv.UpdatedAt = ptr.Time(t) 1388 } 1389 1390 default: 1391 _, _ = key, value 1392 1393 } 1394 } 1395 *v = sv 1396 return nil 1397} 1398 1399type awsRestjson1_deserializeOpGetDataSet struct { 1400} 1401 1402func (*awsRestjson1_deserializeOpGetDataSet) ID() string { 1403 return "OperationDeserializer" 1404} 1405 1406func (m *awsRestjson1_deserializeOpGetDataSet) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1407 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1408) { 1409 out, metadata, err = next.HandleDeserialize(ctx, in) 1410 if err != nil { 1411 return out, metadata, err 1412 } 1413 1414 response, ok := out.RawResponse.(*smithyhttp.Response) 1415 if !ok { 1416 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1417 } 1418 1419 if response.StatusCode < 200 || response.StatusCode >= 300 { 1420 return out, metadata, awsRestjson1_deserializeOpErrorGetDataSet(response, &metadata) 1421 } 1422 output := &GetDataSetOutput{} 1423 out.Result = output 1424 1425 var buff [1024]byte 1426 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1427 1428 body := io.TeeReader(response.Body, ringBuffer) 1429 1430 decoder := json.NewDecoder(body) 1431 decoder.UseNumber() 1432 var shape interface{} 1433 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1434 var snapshot bytes.Buffer 1435 io.Copy(&snapshot, ringBuffer) 1436 err = &smithy.DeserializationError{ 1437 Err: fmt.Errorf("failed to decode response body, %w", err), 1438 Snapshot: snapshot.Bytes(), 1439 } 1440 return out, metadata, err 1441 } 1442 1443 err = awsRestjson1_deserializeOpDocumentGetDataSetOutput(&output, shape) 1444 if err != nil { 1445 var snapshot bytes.Buffer 1446 io.Copy(&snapshot, ringBuffer) 1447 return out, metadata, &smithy.DeserializationError{ 1448 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1449 Snapshot: snapshot.Bytes(), 1450 } 1451 } 1452 1453 return out, metadata, err 1454} 1455 1456func awsRestjson1_deserializeOpErrorGetDataSet(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1457 var errorBuffer bytes.Buffer 1458 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1459 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1460 } 1461 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1462 1463 errorCode := "UnknownError" 1464 errorMessage := errorCode 1465 1466 code := response.Header.Get("X-Amzn-ErrorType") 1467 if len(code) != 0 { 1468 errorCode = restjson.SanitizeErrorCode(code) 1469 } 1470 1471 var buff [1024]byte 1472 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1473 1474 body := io.TeeReader(errorBody, ringBuffer) 1475 decoder := json.NewDecoder(body) 1476 decoder.UseNumber() 1477 code, message, err := restjson.GetErrorInfo(decoder) 1478 if err != nil { 1479 var snapshot bytes.Buffer 1480 io.Copy(&snapshot, ringBuffer) 1481 err = &smithy.DeserializationError{ 1482 Err: fmt.Errorf("failed to decode response body, %w", err), 1483 Snapshot: snapshot.Bytes(), 1484 } 1485 return err 1486 } 1487 1488 errorBody.Seek(0, io.SeekStart) 1489 if len(code) != 0 { 1490 errorCode = restjson.SanitizeErrorCode(code) 1491 } 1492 if len(message) != 0 { 1493 errorMessage = message 1494 } 1495 1496 switch { 1497 case strings.EqualFold("InternalServerException", errorCode): 1498 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1499 1500 case strings.EqualFold("ResourceNotFoundException", errorCode): 1501 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1502 1503 case strings.EqualFold("ThrottlingException", errorCode): 1504 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1505 1506 case strings.EqualFold("ValidationException", errorCode): 1507 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1508 1509 default: 1510 genericError := &smithy.GenericAPIError{ 1511 Code: errorCode, 1512 Message: errorMessage, 1513 } 1514 return genericError 1515 1516 } 1517} 1518 1519func awsRestjson1_deserializeOpDocumentGetDataSetOutput(v **GetDataSetOutput, value interface{}) error { 1520 if v == nil { 1521 return fmt.Errorf("unexpected nil of type %T", v) 1522 } 1523 if value == nil { 1524 return nil 1525 } 1526 1527 shape, ok := value.(map[string]interface{}) 1528 if !ok { 1529 return fmt.Errorf("unexpected JSON type %v", value) 1530 } 1531 1532 var sv *GetDataSetOutput 1533 if *v == nil { 1534 sv = &GetDataSetOutput{} 1535 } else { 1536 sv = *v 1537 } 1538 1539 for key, value := range shape { 1540 switch key { 1541 case "Arn": 1542 if value != nil { 1543 jtv, ok := value.(string) 1544 if !ok { 1545 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1546 } 1547 sv.Arn = ptr.String(jtv) 1548 } 1549 1550 case "AssetType": 1551 if value != nil { 1552 jtv, ok := value.(string) 1553 if !ok { 1554 return fmt.Errorf("expected AssetType to be of type string, got %T instead", value) 1555 } 1556 sv.AssetType = types.AssetType(jtv) 1557 } 1558 1559 case "CreatedAt": 1560 if value != nil { 1561 jtv, ok := value.(string) 1562 if !ok { 1563 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1564 } 1565 t, err := smithytime.ParseDateTime(jtv) 1566 if err != nil { 1567 return err 1568 } 1569 sv.CreatedAt = ptr.Time(t) 1570 } 1571 1572 case "Description": 1573 if value != nil { 1574 jtv, ok := value.(string) 1575 if !ok { 1576 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 1577 } 1578 sv.Description = ptr.String(jtv) 1579 } 1580 1581 case "Id": 1582 if value != nil { 1583 jtv, ok := value.(string) 1584 if !ok { 1585 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1586 } 1587 sv.Id = ptr.String(jtv) 1588 } 1589 1590 case "Name": 1591 if value != nil { 1592 jtv, ok := value.(string) 1593 if !ok { 1594 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1595 } 1596 sv.Name = ptr.String(jtv) 1597 } 1598 1599 case "Origin": 1600 if value != nil { 1601 jtv, ok := value.(string) 1602 if !ok { 1603 return fmt.Errorf("expected Origin to be of type string, got %T instead", value) 1604 } 1605 sv.Origin = types.Origin(jtv) 1606 } 1607 1608 case "OriginDetails": 1609 if err := awsRestjson1_deserializeDocumentOriginDetails(&sv.OriginDetails, value); err != nil { 1610 return err 1611 } 1612 1613 case "SourceId": 1614 if value != nil { 1615 jtv, ok := value.(string) 1616 if !ok { 1617 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1618 } 1619 sv.SourceId = ptr.String(jtv) 1620 } 1621 1622 case "Tags": 1623 if err := awsRestjson1_deserializeDocumentMapOf__string(&sv.Tags, value); err != nil { 1624 return err 1625 } 1626 1627 case "UpdatedAt": 1628 if value != nil { 1629 jtv, ok := value.(string) 1630 if !ok { 1631 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1632 } 1633 t, err := smithytime.ParseDateTime(jtv) 1634 if err != nil { 1635 return err 1636 } 1637 sv.UpdatedAt = ptr.Time(t) 1638 } 1639 1640 default: 1641 _, _ = key, value 1642 1643 } 1644 } 1645 *v = sv 1646 return nil 1647} 1648 1649type awsRestjson1_deserializeOpGetJob struct { 1650} 1651 1652func (*awsRestjson1_deserializeOpGetJob) ID() string { 1653 return "OperationDeserializer" 1654} 1655 1656func (m *awsRestjson1_deserializeOpGetJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1657 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1658) { 1659 out, metadata, err = next.HandleDeserialize(ctx, in) 1660 if err != nil { 1661 return out, metadata, err 1662 } 1663 1664 response, ok := out.RawResponse.(*smithyhttp.Response) 1665 if !ok { 1666 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1667 } 1668 1669 if response.StatusCode < 200 || response.StatusCode >= 300 { 1670 return out, metadata, awsRestjson1_deserializeOpErrorGetJob(response, &metadata) 1671 } 1672 output := &GetJobOutput{} 1673 out.Result = output 1674 1675 var buff [1024]byte 1676 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1677 1678 body := io.TeeReader(response.Body, ringBuffer) 1679 1680 decoder := json.NewDecoder(body) 1681 decoder.UseNumber() 1682 var shape interface{} 1683 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1684 var snapshot bytes.Buffer 1685 io.Copy(&snapshot, ringBuffer) 1686 err = &smithy.DeserializationError{ 1687 Err: fmt.Errorf("failed to decode response body, %w", err), 1688 Snapshot: snapshot.Bytes(), 1689 } 1690 return out, metadata, err 1691 } 1692 1693 err = awsRestjson1_deserializeOpDocumentGetJobOutput(&output, shape) 1694 if err != nil { 1695 var snapshot bytes.Buffer 1696 io.Copy(&snapshot, ringBuffer) 1697 return out, metadata, &smithy.DeserializationError{ 1698 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1699 Snapshot: snapshot.Bytes(), 1700 } 1701 } 1702 1703 return out, metadata, err 1704} 1705 1706func awsRestjson1_deserializeOpErrorGetJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1707 var errorBuffer bytes.Buffer 1708 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1709 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1710 } 1711 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1712 1713 errorCode := "UnknownError" 1714 errorMessage := errorCode 1715 1716 code := response.Header.Get("X-Amzn-ErrorType") 1717 if len(code) != 0 { 1718 errorCode = restjson.SanitizeErrorCode(code) 1719 } 1720 1721 var buff [1024]byte 1722 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1723 1724 body := io.TeeReader(errorBody, ringBuffer) 1725 decoder := json.NewDecoder(body) 1726 decoder.UseNumber() 1727 code, message, err := restjson.GetErrorInfo(decoder) 1728 if err != nil { 1729 var snapshot bytes.Buffer 1730 io.Copy(&snapshot, ringBuffer) 1731 err = &smithy.DeserializationError{ 1732 Err: fmt.Errorf("failed to decode response body, %w", err), 1733 Snapshot: snapshot.Bytes(), 1734 } 1735 return err 1736 } 1737 1738 errorBody.Seek(0, io.SeekStart) 1739 if len(code) != 0 { 1740 errorCode = restjson.SanitizeErrorCode(code) 1741 } 1742 if len(message) != 0 { 1743 errorMessage = message 1744 } 1745 1746 switch { 1747 case strings.EqualFold("InternalServerException", errorCode): 1748 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1749 1750 case strings.EqualFold("ResourceNotFoundException", errorCode): 1751 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1752 1753 case strings.EqualFold("ThrottlingException", errorCode): 1754 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1755 1756 case strings.EqualFold("ValidationException", errorCode): 1757 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1758 1759 default: 1760 genericError := &smithy.GenericAPIError{ 1761 Code: errorCode, 1762 Message: errorMessage, 1763 } 1764 return genericError 1765 1766 } 1767} 1768 1769func awsRestjson1_deserializeOpDocumentGetJobOutput(v **GetJobOutput, value interface{}) error { 1770 if v == nil { 1771 return fmt.Errorf("unexpected nil of type %T", v) 1772 } 1773 if value == nil { 1774 return nil 1775 } 1776 1777 shape, ok := value.(map[string]interface{}) 1778 if !ok { 1779 return fmt.Errorf("unexpected JSON type %v", value) 1780 } 1781 1782 var sv *GetJobOutput 1783 if *v == nil { 1784 sv = &GetJobOutput{} 1785 } else { 1786 sv = *v 1787 } 1788 1789 for key, value := range shape { 1790 switch key { 1791 case "Arn": 1792 if value != nil { 1793 jtv, ok := value.(string) 1794 if !ok { 1795 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 1796 } 1797 sv.Arn = ptr.String(jtv) 1798 } 1799 1800 case "CreatedAt": 1801 if value != nil { 1802 jtv, ok := value.(string) 1803 if !ok { 1804 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1805 } 1806 t, err := smithytime.ParseDateTime(jtv) 1807 if err != nil { 1808 return err 1809 } 1810 sv.CreatedAt = ptr.Time(t) 1811 } 1812 1813 case "Details": 1814 if err := awsRestjson1_deserializeDocumentResponseDetails(&sv.Details, value); err != nil { 1815 return err 1816 } 1817 1818 case "Errors": 1819 if err := awsRestjson1_deserializeDocumentListOfJobError(&sv.Errors, value); err != nil { 1820 return err 1821 } 1822 1823 case "Id": 1824 if value != nil { 1825 jtv, ok := value.(string) 1826 if !ok { 1827 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1828 } 1829 sv.Id = ptr.String(jtv) 1830 } 1831 1832 case "State": 1833 if value != nil { 1834 jtv, ok := value.(string) 1835 if !ok { 1836 return fmt.Errorf("expected State to be of type string, got %T instead", value) 1837 } 1838 sv.State = types.State(jtv) 1839 } 1840 1841 case "Type": 1842 if value != nil { 1843 jtv, ok := value.(string) 1844 if !ok { 1845 return fmt.Errorf("expected Type to be of type string, got %T instead", value) 1846 } 1847 sv.Type = types.Type(jtv) 1848 } 1849 1850 case "UpdatedAt": 1851 if value != nil { 1852 jtv, ok := value.(string) 1853 if !ok { 1854 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 1855 } 1856 t, err := smithytime.ParseDateTime(jtv) 1857 if err != nil { 1858 return err 1859 } 1860 sv.UpdatedAt = ptr.Time(t) 1861 } 1862 1863 default: 1864 _, _ = key, value 1865 1866 } 1867 } 1868 *v = sv 1869 return nil 1870} 1871 1872type awsRestjson1_deserializeOpGetRevision struct { 1873} 1874 1875func (*awsRestjson1_deserializeOpGetRevision) ID() string { 1876 return "OperationDeserializer" 1877} 1878 1879func (m *awsRestjson1_deserializeOpGetRevision) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1880 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1881) { 1882 out, metadata, err = next.HandleDeserialize(ctx, in) 1883 if err != nil { 1884 return out, metadata, err 1885 } 1886 1887 response, ok := out.RawResponse.(*smithyhttp.Response) 1888 if !ok { 1889 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1890 } 1891 1892 if response.StatusCode < 200 || response.StatusCode >= 300 { 1893 return out, metadata, awsRestjson1_deserializeOpErrorGetRevision(response, &metadata) 1894 } 1895 output := &GetRevisionOutput{} 1896 out.Result = output 1897 1898 var buff [1024]byte 1899 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1900 1901 body := io.TeeReader(response.Body, ringBuffer) 1902 1903 decoder := json.NewDecoder(body) 1904 decoder.UseNumber() 1905 var shape interface{} 1906 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 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 out, metadata, err 1914 } 1915 1916 err = awsRestjson1_deserializeOpDocumentGetRevisionOutput(&output, shape) 1917 if err != nil { 1918 var snapshot bytes.Buffer 1919 io.Copy(&snapshot, ringBuffer) 1920 return out, metadata, &smithy.DeserializationError{ 1921 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1922 Snapshot: snapshot.Bytes(), 1923 } 1924 } 1925 1926 return out, metadata, err 1927} 1928 1929func awsRestjson1_deserializeOpErrorGetRevision(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1930 var errorBuffer bytes.Buffer 1931 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1932 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1933 } 1934 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1935 1936 errorCode := "UnknownError" 1937 errorMessage := errorCode 1938 1939 code := response.Header.Get("X-Amzn-ErrorType") 1940 if len(code) != 0 { 1941 errorCode = restjson.SanitizeErrorCode(code) 1942 } 1943 1944 var buff [1024]byte 1945 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1946 1947 body := io.TeeReader(errorBody, ringBuffer) 1948 decoder := json.NewDecoder(body) 1949 decoder.UseNumber() 1950 code, message, err := restjson.GetErrorInfo(decoder) 1951 if err != nil { 1952 var snapshot bytes.Buffer 1953 io.Copy(&snapshot, ringBuffer) 1954 err = &smithy.DeserializationError{ 1955 Err: fmt.Errorf("failed to decode response body, %w", err), 1956 Snapshot: snapshot.Bytes(), 1957 } 1958 return err 1959 } 1960 1961 errorBody.Seek(0, io.SeekStart) 1962 if len(code) != 0 { 1963 errorCode = restjson.SanitizeErrorCode(code) 1964 } 1965 if len(message) != 0 { 1966 errorMessage = message 1967 } 1968 1969 switch { 1970 case strings.EqualFold("InternalServerException", errorCode): 1971 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1972 1973 case strings.EqualFold("ResourceNotFoundException", errorCode): 1974 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1975 1976 case strings.EqualFold("ThrottlingException", errorCode): 1977 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1978 1979 case strings.EqualFold("ValidationException", errorCode): 1980 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1981 1982 default: 1983 genericError := &smithy.GenericAPIError{ 1984 Code: errorCode, 1985 Message: errorMessage, 1986 } 1987 return genericError 1988 1989 } 1990} 1991 1992func awsRestjson1_deserializeOpDocumentGetRevisionOutput(v **GetRevisionOutput, value interface{}) error { 1993 if v == nil { 1994 return fmt.Errorf("unexpected nil of type %T", v) 1995 } 1996 if value == nil { 1997 return nil 1998 } 1999 2000 shape, ok := value.(map[string]interface{}) 2001 if !ok { 2002 return fmt.Errorf("unexpected JSON type %v", value) 2003 } 2004 2005 var sv *GetRevisionOutput 2006 if *v == nil { 2007 sv = &GetRevisionOutput{} 2008 } else { 2009 sv = *v 2010 } 2011 2012 for key, value := range shape { 2013 switch key { 2014 case "Arn": 2015 if value != nil { 2016 jtv, ok := value.(string) 2017 if !ok { 2018 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 2019 } 2020 sv.Arn = ptr.String(jtv) 2021 } 2022 2023 case "Comment": 2024 if value != nil { 2025 jtv, ok := value.(string) 2026 if !ok { 2027 return fmt.Errorf("expected __stringMin0Max16384 to be of type string, got %T instead", value) 2028 } 2029 sv.Comment = ptr.String(jtv) 2030 } 2031 2032 case "CreatedAt": 2033 if value != nil { 2034 jtv, ok := value.(string) 2035 if !ok { 2036 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2037 } 2038 t, err := smithytime.ParseDateTime(jtv) 2039 if err != nil { 2040 return err 2041 } 2042 sv.CreatedAt = ptr.Time(t) 2043 } 2044 2045 case "DataSetId": 2046 if value != nil { 2047 jtv, ok := value.(string) 2048 if !ok { 2049 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2050 } 2051 sv.DataSetId = ptr.String(jtv) 2052 } 2053 2054 case "Finalized": 2055 if value != nil { 2056 jtv, ok := value.(bool) 2057 if !ok { 2058 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 2059 } 2060 sv.Finalized = jtv 2061 } 2062 2063 case "Id": 2064 if value != nil { 2065 jtv, ok := value.(string) 2066 if !ok { 2067 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2068 } 2069 sv.Id = ptr.String(jtv) 2070 } 2071 2072 case "SourceId": 2073 if value != nil { 2074 jtv, ok := value.(string) 2075 if !ok { 2076 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2077 } 2078 sv.SourceId = ptr.String(jtv) 2079 } 2080 2081 case "Tags": 2082 if err := awsRestjson1_deserializeDocumentMapOf__string(&sv.Tags, value); err != nil { 2083 return err 2084 } 2085 2086 case "UpdatedAt": 2087 if value != nil { 2088 jtv, ok := value.(string) 2089 if !ok { 2090 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 2091 } 2092 t, err := smithytime.ParseDateTime(jtv) 2093 if err != nil { 2094 return err 2095 } 2096 sv.UpdatedAt = ptr.Time(t) 2097 } 2098 2099 default: 2100 _, _ = key, value 2101 2102 } 2103 } 2104 *v = sv 2105 return nil 2106} 2107 2108type awsRestjson1_deserializeOpListDataSetRevisions struct { 2109} 2110 2111func (*awsRestjson1_deserializeOpListDataSetRevisions) ID() string { 2112 return "OperationDeserializer" 2113} 2114 2115func (m *awsRestjson1_deserializeOpListDataSetRevisions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2116 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2117) { 2118 out, metadata, err = next.HandleDeserialize(ctx, in) 2119 if err != nil { 2120 return out, metadata, err 2121 } 2122 2123 response, ok := out.RawResponse.(*smithyhttp.Response) 2124 if !ok { 2125 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2126 } 2127 2128 if response.StatusCode < 200 || response.StatusCode >= 300 { 2129 return out, metadata, awsRestjson1_deserializeOpErrorListDataSetRevisions(response, &metadata) 2130 } 2131 output := &ListDataSetRevisionsOutput{} 2132 out.Result = output 2133 2134 var buff [1024]byte 2135 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2136 2137 body := io.TeeReader(response.Body, ringBuffer) 2138 2139 decoder := json.NewDecoder(body) 2140 decoder.UseNumber() 2141 var shape interface{} 2142 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2143 var snapshot bytes.Buffer 2144 io.Copy(&snapshot, ringBuffer) 2145 err = &smithy.DeserializationError{ 2146 Err: fmt.Errorf("failed to decode response body, %w", err), 2147 Snapshot: snapshot.Bytes(), 2148 } 2149 return out, metadata, err 2150 } 2151 2152 err = awsRestjson1_deserializeOpDocumentListDataSetRevisionsOutput(&output, shape) 2153 if err != nil { 2154 var snapshot bytes.Buffer 2155 io.Copy(&snapshot, ringBuffer) 2156 return out, metadata, &smithy.DeserializationError{ 2157 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2158 Snapshot: snapshot.Bytes(), 2159 } 2160 } 2161 2162 return out, metadata, err 2163} 2164 2165func awsRestjson1_deserializeOpErrorListDataSetRevisions(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2166 var errorBuffer bytes.Buffer 2167 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2168 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2169 } 2170 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2171 2172 errorCode := "UnknownError" 2173 errorMessage := errorCode 2174 2175 code := response.Header.Get("X-Amzn-ErrorType") 2176 if len(code) != 0 { 2177 errorCode = restjson.SanitizeErrorCode(code) 2178 } 2179 2180 var buff [1024]byte 2181 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2182 2183 body := io.TeeReader(errorBody, ringBuffer) 2184 decoder := json.NewDecoder(body) 2185 decoder.UseNumber() 2186 code, message, err := restjson.GetErrorInfo(decoder) 2187 if err != nil { 2188 var snapshot bytes.Buffer 2189 io.Copy(&snapshot, ringBuffer) 2190 err = &smithy.DeserializationError{ 2191 Err: fmt.Errorf("failed to decode response body, %w", err), 2192 Snapshot: snapshot.Bytes(), 2193 } 2194 return err 2195 } 2196 2197 errorBody.Seek(0, io.SeekStart) 2198 if len(code) != 0 { 2199 errorCode = restjson.SanitizeErrorCode(code) 2200 } 2201 if len(message) != 0 { 2202 errorMessage = message 2203 } 2204 2205 switch { 2206 case strings.EqualFold("InternalServerException", errorCode): 2207 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2208 2209 case strings.EqualFold("ResourceNotFoundException", errorCode): 2210 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2211 2212 case strings.EqualFold("ThrottlingException", errorCode): 2213 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2214 2215 case strings.EqualFold("ValidationException", errorCode): 2216 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2217 2218 default: 2219 genericError := &smithy.GenericAPIError{ 2220 Code: errorCode, 2221 Message: errorMessage, 2222 } 2223 return genericError 2224 2225 } 2226} 2227 2228func awsRestjson1_deserializeOpDocumentListDataSetRevisionsOutput(v **ListDataSetRevisionsOutput, value interface{}) error { 2229 if v == nil { 2230 return fmt.Errorf("unexpected nil of type %T", v) 2231 } 2232 if value == nil { 2233 return nil 2234 } 2235 2236 shape, ok := value.(map[string]interface{}) 2237 if !ok { 2238 return fmt.Errorf("unexpected JSON type %v", value) 2239 } 2240 2241 var sv *ListDataSetRevisionsOutput 2242 if *v == nil { 2243 sv = &ListDataSetRevisionsOutput{} 2244 } else { 2245 sv = *v 2246 } 2247 2248 for key, value := range shape { 2249 switch key { 2250 case "NextToken": 2251 if value != nil { 2252 jtv, ok := value.(string) 2253 if !ok { 2254 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 2255 } 2256 sv.NextToken = ptr.String(jtv) 2257 } 2258 2259 case "Revisions": 2260 if err := awsRestjson1_deserializeDocumentListOfRevisionEntry(&sv.Revisions, value); err != nil { 2261 return err 2262 } 2263 2264 default: 2265 _, _ = key, value 2266 2267 } 2268 } 2269 *v = sv 2270 return nil 2271} 2272 2273type awsRestjson1_deserializeOpListDataSets struct { 2274} 2275 2276func (*awsRestjson1_deserializeOpListDataSets) ID() string { 2277 return "OperationDeserializer" 2278} 2279 2280func (m *awsRestjson1_deserializeOpListDataSets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2281 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2282) { 2283 out, metadata, err = next.HandleDeserialize(ctx, in) 2284 if err != nil { 2285 return out, metadata, err 2286 } 2287 2288 response, ok := out.RawResponse.(*smithyhttp.Response) 2289 if !ok { 2290 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2291 } 2292 2293 if response.StatusCode < 200 || response.StatusCode >= 300 { 2294 return out, metadata, awsRestjson1_deserializeOpErrorListDataSets(response, &metadata) 2295 } 2296 output := &ListDataSetsOutput{} 2297 out.Result = output 2298 2299 var buff [1024]byte 2300 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2301 2302 body := io.TeeReader(response.Body, ringBuffer) 2303 2304 decoder := json.NewDecoder(body) 2305 decoder.UseNumber() 2306 var shape interface{} 2307 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2308 var snapshot bytes.Buffer 2309 io.Copy(&snapshot, ringBuffer) 2310 err = &smithy.DeserializationError{ 2311 Err: fmt.Errorf("failed to decode response body, %w", err), 2312 Snapshot: snapshot.Bytes(), 2313 } 2314 return out, metadata, err 2315 } 2316 2317 err = awsRestjson1_deserializeOpDocumentListDataSetsOutput(&output, shape) 2318 if err != nil { 2319 var snapshot bytes.Buffer 2320 io.Copy(&snapshot, ringBuffer) 2321 return out, metadata, &smithy.DeserializationError{ 2322 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2323 Snapshot: snapshot.Bytes(), 2324 } 2325 } 2326 2327 return out, metadata, err 2328} 2329 2330func awsRestjson1_deserializeOpErrorListDataSets(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2331 var errorBuffer bytes.Buffer 2332 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2333 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2334 } 2335 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2336 2337 errorCode := "UnknownError" 2338 errorMessage := errorCode 2339 2340 code := response.Header.Get("X-Amzn-ErrorType") 2341 if len(code) != 0 { 2342 errorCode = restjson.SanitizeErrorCode(code) 2343 } 2344 2345 var buff [1024]byte 2346 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2347 2348 body := io.TeeReader(errorBody, ringBuffer) 2349 decoder := json.NewDecoder(body) 2350 decoder.UseNumber() 2351 code, message, err := restjson.GetErrorInfo(decoder) 2352 if err != nil { 2353 var snapshot bytes.Buffer 2354 io.Copy(&snapshot, ringBuffer) 2355 err = &smithy.DeserializationError{ 2356 Err: fmt.Errorf("failed to decode response body, %w", err), 2357 Snapshot: snapshot.Bytes(), 2358 } 2359 return err 2360 } 2361 2362 errorBody.Seek(0, io.SeekStart) 2363 if len(code) != 0 { 2364 errorCode = restjson.SanitizeErrorCode(code) 2365 } 2366 if len(message) != 0 { 2367 errorMessage = message 2368 } 2369 2370 switch { 2371 case strings.EqualFold("InternalServerException", errorCode): 2372 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2373 2374 case strings.EqualFold("ResourceNotFoundException", errorCode): 2375 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2376 2377 case strings.EqualFold("ThrottlingException", errorCode): 2378 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2379 2380 case strings.EqualFold("ValidationException", errorCode): 2381 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2382 2383 default: 2384 genericError := &smithy.GenericAPIError{ 2385 Code: errorCode, 2386 Message: errorMessage, 2387 } 2388 return genericError 2389 2390 } 2391} 2392 2393func awsRestjson1_deserializeOpDocumentListDataSetsOutput(v **ListDataSetsOutput, value interface{}) error { 2394 if v == nil { 2395 return fmt.Errorf("unexpected nil of type %T", v) 2396 } 2397 if value == nil { 2398 return nil 2399 } 2400 2401 shape, ok := value.(map[string]interface{}) 2402 if !ok { 2403 return fmt.Errorf("unexpected JSON type %v", value) 2404 } 2405 2406 var sv *ListDataSetsOutput 2407 if *v == nil { 2408 sv = &ListDataSetsOutput{} 2409 } else { 2410 sv = *v 2411 } 2412 2413 for key, value := range shape { 2414 switch key { 2415 case "DataSets": 2416 if err := awsRestjson1_deserializeDocumentListOfDataSetEntry(&sv.DataSets, value); err != nil { 2417 return err 2418 } 2419 2420 case "NextToken": 2421 if value != nil { 2422 jtv, ok := value.(string) 2423 if !ok { 2424 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 2425 } 2426 sv.NextToken = ptr.String(jtv) 2427 } 2428 2429 default: 2430 _, _ = key, value 2431 2432 } 2433 } 2434 *v = sv 2435 return nil 2436} 2437 2438type awsRestjson1_deserializeOpListJobs struct { 2439} 2440 2441func (*awsRestjson1_deserializeOpListJobs) ID() string { 2442 return "OperationDeserializer" 2443} 2444 2445func (m *awsRestjson1_deserializeOpListJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2446 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2447) { 2448 out, metadata, err = next.HandleDeserialize(ctx, in) 2449 if err != nil { 2450 return out, metadata, err 2451 } 2452 2453 response, ok := out.RawResponse.(*smithyhttp.Response) 2454 if !ok { 2455 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2456 } 2457 2458 if response.StatusCode < 200 || response.StatusCode >= 300 { 2459 return out, metadata, awsRestjson1_deserializeOpErrorListJobs(response, &metadata) 2460 } 2461 output := &ListJobsOutput{} 2462 out.Result = output 2463 2464 var buff [1024]byte 2465 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2466 2467 body := io.TeeReader(response.Body, ringBuffer) 2468 2469 decoder := json.NewDecoder(body) 2470 decoder.UseNumber() 2471 var shape interface{} 2472 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2473 var snapshot bytes.Buffer 2474 io.Copy(&snapshot, ringBuffer) 2475 err = &smithy.DeserializationError{ 2476 Err: fmt.Errorf("failed to decode response body, %w", err), 2477 Snapshot: snapshot.Bytes(), 2478 } 2479 return out, metadata, err 2480 } 2481 2482 err = awsRestjson1_deserializeOpDocumentListJobsOutput(&output, shape) 2483 if err != nil { 2484 var snapshot bytes.Buffer 2485 io.Copy(&snapshot, ringBuffer) 2486 return out, metadata, &smithy.DeserializationError{ 2487 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2488 Snapshot: snapshot.Bytes(), 2489 } 2490 } 2491 2492 return out, metadata, err 2493} 2494 2495func awsRestjson1_deserializeOpErrorListJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2496 var errorBuffer bytes.Buffer 2497 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2498 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2499 } 2500 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2501 2502 errorCode := "UnknownError" 2503 errorMessage := errorCode 2504 2505 code := response.Header.Get("X-Amzn-ErrorType") 2506 if len(code) != 0 { 2507 errorCode = restjson.SanitizeErrorCode(code) 2508 } 2509 2510 var buff [1024]byte 2511 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2512 2513 body := io.TeeReader(errorBody, ringBuffer) 2514 decoder := json.NewDecoder(body) 2515 decoder.UseNumber() 2516 code, message, err := restjson.GetErrorInfo(decoder) 2517 if err != nil { 2518 var snapshot bytes.Buffer 2519 io.Copy(&snapshot, ringBuffer) 2520 err = &smithy.DeserializationError{ 2521 Err: fmt.Errorf("failed to decode response body, %w", err), 2522 Snapshot: snapshot.Bytes(), 2523 } 2524 return err 2525 } 2526 2527 errorBody.Seek(0, io.SeekStart) 2528 if len(code) != 0 { 2529 errorCode = restjson.SanitizeErrorCode(code) 2530 } 2531 if len(message) != 0 { 2532 errorMessage = message 2533 } 2534 2535 switch { 2536 case strings.EqualFold("InternalServerException", errorCode): 2537 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2538 2539 case strings.EqualFold("ResourceNotFoundException", errorCode): 2540 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2541 2542 case strings.EqualFold("ThrottlingException", errorCode): 2543 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2544 2545 case strings.EqualFold("ValidationException", errorCode): 2546 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2547 2548 default: 2549 genericError := &smithy.GenericAPIError{ 2550 Code: errorCode, 2551 Message: errorMessage, 2552 } 2553 return genericError 2554 2555 } 2556} 2557 2558func awsRestjson1_deserializeOpDocumentListJobsOutput(v **ListJobsOutput, value interface{}) error { 2559 if v == nil { 2560 return fmt.Errorf("unexpected nil of type %T", v) 2561 } 2562 if value == nil { 2563 return nil 2564 } 2565 2566 shape, ok := value.(map[string]interface{}) 2567 if !ok { 2568 return fmt.Errorf("unexpected JSON type %v", value) 2569 } 2570 2571 var sv *ListJobsOutput 2572 if *v == nil { 2573 sv = &ListJobsOutput{} 2574 } else { 2575 sv = *v 2576 } 2577 2578 for key, value := range shape { 2579 switch key { 2580 case "Jobs": 2581 if err := awsRestjson1_deserializeDocumentListOfJobEntry(&sv.Jobs, value); err != nil { 2582 return err 2583 } 2584 2585 case "NextToken": 2586 if value != nil { 2587 jtv, ok := value.(string) 2588 if !ok { 2589 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 2590 } 2591 sv.NextToken = ptr.String(jtv) 2592 } 2593 2594 default: 2595 _, _ = key, value 2596 2597 } 2598 } 2599 *v = sv 2600 return nil 2601} 2602 2603type awsRestjson1_deserializeOpListRevisionAssets struct { 2604} 2605 2606func (*awsRestjson1_deserializeOpListRevisionAssets) ID() string { 2607 return "OperationDeserializer" 2608} 2609 2610func (m *awsRestjson1_deserializeOpListRevisionAssets) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2611 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2612) { 2613 out, metadata, err = next.HandleDeserialize(ctx, in) 2614 if err != nil { 2615 return out, metadata, err 2616 } 2617 2618 response, ok := out.RawResponse.(*smithyhttp.Response) 2619 if !ok { 2620 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2621 } 2622 2623 if response.StatusCode < 200 || response.StatusCode >= 300 { 2624 return out, metadata, awsRestjson1_deserializeOpErrorListRevisionAssets(response, &metadata) 2625 } 2626 output := &ListRevisionAssetsOutput{} 2627 out.Result = output 2628 2629 var buff [1024]byte 2630 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2631 2632 body := io.TeeReader(response.Body, ringBuffer) 2633 2634 decoder := json.NewDecoder(body) 2635 decoder.UseNumber() 2636 var shape interface{} 2637 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2638 var snapshot bytes.Buffer 2639 io.Copy(&snapshot, ringBuffer) 2640 err = &smithy.DeserializationError{ 2641 Err: fmt.Errorf("failed to decode response body, %w", err), 2642 Snapshot: snapshot.Bytes(), 2643 } 2644 return out, metadata, err 2645 } 2646 2647 err = awsRestjson1_deserializeOpDocumentListRevisionAssetsOutput(&output, shape) 2648 if err != nil { 2649 var snapshot bytes.Buffer 2650 io.Copy(&snapshot, ringBuffer) 2651 return out, metadata, &smithy.DeserializationError{ 2652 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2653 Snapshot: snapshot.Bytes(), 2654 } 2655 } 2656 2657 return out, metadata, err 2658} 2659 2660func awsRestjson1_deserializeOpErrorListRevisionAssets(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2661 var errorBuffer bytes.Buffer 2662 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2663 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2664 } 2665 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2666 2667 errorCode := "UnknownError" 2668 errorMessage := errorCode 2669 2670 code := response.Header.Get("X-Amzn-ErrorType") 2671 if len(code) != 0 { 2672 errorCode = restjson.SanitizeErrorCode(code) 2673 } 2674 2675 var buff [1024]byte 2676 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2677 2678 body := io.TeeReader(errorBody, ringBuffer) 2679 decoder := json.NewDecoder(body) 2680 decoder.UseNumber() 2681 code, message, err := restjson.GetErrorInfo(decoder) 2682 if err != nil { 2683 var snapshot bytes.Buffer 2684 io.Copy(&snapshot, ringBuffer) 2685 err = &smithy.DeserializationError{ 2686 Err: fmt.Errorf("failed to decode response body, %w", err), 2687 Snapshot: snapshot.Bytes(), 2688 } 2689 return err 2690 } 2691 2692 errorBody.Seek(0, io.SeekStart) 2693 if len(code) != 0 { 2694 errorCode = restjson.SanitizeErrorCode(code) 2695 } 2696 if len(message) != 0 { 2697 errorMessage = message 2698 } 2699 2700 switch { 2701 case strings.EqualFold("InternalServerException", errorCode): 2702 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2703 2704 case strings.EqualFold("ResourceNotFoundException", errorCode): 2705 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2706 2707 case strings.EqualFold("ThrottlingException", errorCode): 2708 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2709 2710 case strings.EqualFold("ValidationException", errorCode): 2711 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2712 2713 default: 2714 genericError := &smithy.GenericAPIError{ 2715 Code: errorCode, 2716 Message: errorMessage, 2717 } 2718 return genericError 2719 2720 } 2721} 2722 2723func awsRestjson1_deserializeOpDocumentListRevisionAssetsOutput(v **ListRevisionAssetsOutput, value interface{}) error { 2724 if v == nil { 2725 return fmt.Errorf("unexpected nil of type %T", v) 2726 } 2727 if value == nil { 2728 return nil 2729 } 2730 2731 shape, ok := value.(map[string]interface{}) 2732 if !ok { 2733 return fmt.Errorf("unexpected JSON type %v", value) 2734 } 2735 2736 var sv *ListRevisionAssetsOutput 2737 if *v == nil { 2738 sv = &ListRevisionAssetsOutput{} 2739 } else { 2740 sv = *v 2741 } 2742 2743 for key, value := range shape { 2744 switch key { 2745 case "Assets": 2746 if err := awsRestjson1_deserializeDocumentListOfAssetEntry(&sv.Assets, value); err != nil { 2747 return err 2748 } 2749 2750 case "NextToken": 2751 if value != nil { 2752 jtv, ok := value.(string) 2753 if !ok { 2754 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 2755 } 2756 sv.NextToken = ptr.String(jtv) 2757 } 2758 2759 default: 2760 _, _ = key, value 2761 2762 } 2763 } 2764 *v = sv 2765 return nil 2766} 2767 2768type awsRestjson1_deserializeOpListTagsForResource struct { 2769} 2770 2771func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { 2772 return "OperationDeserializer" 2773} 2774 2775func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2776 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2777) { 2778 out, metadata, err = next.HandleDeserialize(ctx, in) 2779 if err != nil { 2780 return out, metadata, err 2781 } 2782 2783 response, ok := out.RawResponse.(*smithyhttp.Response) 2784 if !ok { 2785 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2786 } 2787 2788 if response.StatusCode < 200 || response.StatusCode >= 300 { 2789 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) 2790 } 2791 output := &ListTagsForResourceOutput{} 2792 out.Result = output 2793 2794 var buff [1024]byte 2795 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2796 2797 body := io.TeeReader(response.Body, ringBuffer) 2798 2799 decoder := json.NewDecoder(body) 2800 decoder.UseNumber() 2801 var shape interface{} 2802 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2803 var snapshot bytes.Buffer 2804 io.Copy(&snapshot, ringBuffer) 2805 err = &smithy.DeserializationError{ 2806 Err: fmt.Errorf("failed to decode response body, %w", err), 2807 Snapshot: snapshot.Bytes(), 2808 } 2809 return out, metadata, err 2810 } 2811 2812 err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 2813 if err != nil { 2814 var snapshot bytes.Buffer 2815 io.Copy(&snapshot, ringBuffer) 2816 return out, metadata, &smithy.DeserializationError{ 2817 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2818 Snapshot: snapshot.Bytes(), 2819 } 2820 } 2821 2822 return out, metadata, err 2823} 2824 2825func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2826 var errorBuffer bytes.Buffer 2827 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2828 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2829 } 2830 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2831 2832 errorCode := "UnknownError" 2833 errorMessage := errorCode 2834 2835 code := response.Header.Get("X-Amzn-ErrorType") 2836 if len(code) != 0 { 2837 errorCode = restjson.SanitizeErrorCode(code) 2838 } 2839 2840 var buff [1024]byte 2841 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2842 2843 body := io.TeeReader(errorBody, ringBuffer) 2844 decoder := json.NewDecoder(body) 2845 decoder.UseNumber() 2846 code, message, err := restjson.GetErrorInfo(decoder) 2847 if err != nil { 2848 var snapshot bytes.Buffer 2849 io.Copy(&snapshot, ringBuffer) 2850 err = &smithy.DeserializationError{ 2851 Err: fmt.Errorf("failed to decode response body, %w", err), 2852 Snapshot: snapshot.Bytes(), 2853 } 2854 return err 2855 } 2856 2857 errorBody.Seek(0, io.SeekStart) 2858 if len(code) != 0 { 2859 errorCode = restjson.SanitizeErrorCode(code) 2860 } 2861 if len(message) != 0 { 2862 errorMessage = message 2863 } 2864 2865 switch { 2866 default: 2867 genericError := &smithy.GenericAPIError{ 2868 Code: errorCode, 2869 Message: errorMessage, 2870 } 2871 return genericError 2872 2873 } 2874} 2875 2876func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 2877 if v == nil { 2878 return fmt.Errorf("unexpected nil of type %T", v) 2879 } 2880 if value == nil { 2881 return nil 2882 } 2883 2884 shape, ok := value.(map[string]interface{}) 2885 if !ok { 2886 return fmt.Errorf("unexpected JSON type %v", value) 2887 } 2888 2889 var sv *ListTagsForResourceOutput 2890 if *v == nil { 2891 sv = &ListTagsForResourceOutput{} 2892 } else { 2893 sv = *v 2894 } 2895 2896 for key, value := range shape { 2897 switch key { 2898 case "tags": 2899 if err := awsRestjson1_deserializeDocumentMapOf__string(&sv.Tags, value); err != nil { 2900 return err 2901 } 2902 2903 default: 2904 _, _ = key, value 2905 2906 } 2907 } 2908 *v = sv 2909 return nil 2910} 2911 2912type awsRestjson1_deserializeOpStartJob struct { 2913} 2914 2915func (*awsRestjson1_deserializeOpStartJob) ID() string { 2916 return "OperationDeserializer" 2917} 2918 2919func (m *awsRestjson1_deserializeOpStartJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2920 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2921) { 2922 out, metadata, err = next.HandleDeserialize(ctx, in) 2923 if err != nil { 2924 return out, metadata, err 2925 } 2926 2927 response, ok := out.RawResponse.(*smithyhttp.Response) 2928 if !ok { 2929 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2930 } 2931 2932 if response.StatusCode < 200 || response.StatusCode >= 300 { 2933 return out, metadata, awsRestjson1_deserializeOpErrorStartJob(response, &metadata) 2934 } 2935 output := &StartJobOutput{} 2936 out.Result = output 2937 2938 return out, metadata, err 2939} 2940 2941func awsRestjson1_deserializeOpErrorStartJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2942 var errorBuffer bytes.Buffer 2943 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2944 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2945 } 2946 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2947 2948 errorCode := "UnknownError" 2949 errorMessage := errorCode 2950 2951 code := response.Header.Get("X-Amzn-ErrorType") 2952 if len(code) != 0 { 2953 errorCode = restjson.SanitizeErrorCode(code) 2954 } 2955 2956 var buff [1024]byte 2957 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2958 2959 body := io.TeeReader(errorBody, ringBuffer) 2960 decoder := json.NewDecoder(body) 2961 decoder.UseNumber() 2962 code, message, err := restjson.GetErrorInfo(decoder) 2963 if err != nil { 2964 var snapshot bytes.Buffer 2965 io.Copy(&snapshot, ringBuffer) 2966 err = &smithy.DeserializationError{ 2967 Err: fmt.Errorf("failed to decode response body, %w", err), 2968 Snapshot: snapshot.Bytes(), 2969 } 2970 return err 2971 } 2972 2973 errorBody.Seek(0, io.SeekStart) 2974 if len(code) != 0 { 2975 errorCode = restjson.SanitizeErrorCode(code) 2976 } 2977 if len(message) != 0 { 2978 errorMessage = message 2979 } 2980 2981 switch { 2982 case strings.EqualFold("AccessDeniedException", errorCode): 2983 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2984 2985 case strings.EqualFold("ConflictException", errorCode): 2986 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2987 2988 case strings.EqualFold("InternalServerException", errorCode): 2989 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2990 2991 case strings.EqualFold("ResourceNotFoundException", errorCode): 2992 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2993 2994 case strings.EqualFold("ThrottlingException", errorCode): 2995 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2996 2997 case strings.EqualFold("ValidationException", errorCode): 2998 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2999 3000 default: 3001 genericError := &smithy.GenericAPIError{ 3002 Code: errorCode, 3003 Message: errorMessage, 3004 } 3005 return genericError 3006 3007 } 3008} 3009 3010type awsRestjson1_deserializeOpTagResource struct { 3011} 3012 3013func (*awsRestjson1_deserializeOpTagResource) ID() string { 3014 return "OperationDeserializer" 3015} 3016 3017func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3018 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3019) { 3020 out, metadata, err = next.HandleDeserialize(ctx, in) 3021 if err != nil { 3022 return out, metadata, err 3023 } 3024 3025 response, ok := out.RawResponse.(*smithyhttp.Response) 3026 if !ok { 3027 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3028 } 3029 3030 if response.StatusCode < 200 || response.StatusCode >= 300 { 3031 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 3032 } 3033 output := &TagResourceOutput{} 3034 out.Result = output 3035 3036 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3037 return out, metadata, &smithy.DeserializationError{ 3038 Err: fmt.Errorf("failed to discard response body, %w", err), 3039 } 3040 } 3041 3042 return out, metadata, err 3043} 3044 3045func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3046 var errorBuffer bytes.Buffer 3047 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3048 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3049 } 3050 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3051 3052 errorCode := "UnknownError" 3053 errorMessage := errorCode 3054 3055 code := response.Header.Get("X-Amzn-ErrorType") 3056 if len(code) != 0 { 3057 errorCode = restjson.SanitizeErrorCode(code) 3058 } 3059 3060 var buff [1024]byte 3061 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3062 3063 body := io.TeeReader(errorBody, ringBuffer) 3064 decoder := json.NewDecoder(body) 3065 decoder.UseNumber() 3066 code, message, err := restjson.GetErrorInfo(decoder) 3067 if err != nil { 3068 var snapshot bytes.Buffer 3069 io.Copy(&snapshot, ringBuffer) 3070 err = &smithy.DeserializationError{ 3071 Err: fmt.Errorf("failed to decode response body, %w", err), 3072 Snapshot: snapshot.Bytes(), 3073 } 3074 return err 3075 } 3076 3077 errorBody.Seek(0, io.SeekStart) 3078 if len(code) != 0 { 3079 errorCode = restjson.SanitizeErrorCode(code) 3080 } 3081 if len(message) != 0 { 3082 errorMessage = message 3083 } 3084 3085 switch { 3086 default: 3087 genericError := &smithy.GenericAPIError{ 3088 Code: errorCode, 3089 Message: errorMessage, 3090 } 3091 return genericError 3092 3093 } 3094} 3095 3096type awsRestjson1_deserializeOpUntagResource struct { 3097} 3098 3099func (*awsRestjson1_deserializeOpUntagResource) ID() string { 3100 return "OperationDeserializer" 3101} 3102 3103func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3104 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3105) { 3106 out, metadata, err = next.HandleDeserialize(ctx, in) 3107 if err != nil { 3108 return out, metadata, err 3109 } 3110 3111 response, ok := out.RawResponse.(*smithyhttp.Response) 3112 if !ok { 3113 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3114 } 3115 3116 if response.StatusCode < 200 || response.StatusCode >= 300 { 3117 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 3118 } 3119 output := &UntagResourceOutput{} 3120 out.Result = output 3121 3122 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3123 return out, metadata, &smithy.DeserializationError{ 3124 Err: fmt.Errorf("failed to discard response body, %w", err), 3125 } 3126 } 3127 3128 return out, metadata, err 3129} 3130 3131func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3132 var errorBuffer bytes.Buffer 3133 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3134 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3135 } 3136 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3137 3138 errorCode := "UnknownError" 3139 errorMessage := errorCode 3140 3141 code := response.Header.Get("X-Amzn-ErrorType") 3142 if len(code) != 0 { 3143 errorCode = restjson.SanitizeErrorCode(code) 3144 } 3145 3146 var buff [1024]byte 3147 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3148 3149 body := io.TeeReader(errorBody, ringBuffer) 3150 decoder := json.NewDecoder(body) 3151 decoder.UseNumber() 3152 code, message, err := restjson.GetErrorInfo(decoder) 3153 if err != nil { 3154 var snapshot bytes.Buffer 3155 io.Copy(&snapshot, ringBuffer) 3156 err = &smithy.DeserializationError{ 3157 Err: fmt.Errorf("failed to decode response body, %w", err), 3158 Snapshot: snapshot.Bytes(), 3159 } 3160 return err 3161 } 3162 3163 errorBody.Seek(0, io.SeekStart) 3164 if len(code) != 0 { 3165 errorCode = restjson.SanitizeErrorCode(code) 3166 } 3167 if len(message) != 0 { 3168 errorMessage = message 3169 } 3170 3171 switch { 3172 default: 3173 genericError := &smithy.GenericAPIError{ 3174 Code: errorCode, 3175 Message: errorMessage, 3176 } 3177 return genericError 3178 3179 } 3180} 3181 3182type awsRestjson1_deserializeOpUpdateAsset struct { 3183} 3184 3185func (*awsRestjson1_deserializeOpUpdateAsset) ID() string { 3186 return "OperationDeserializer" 3187} 3188 3189func (m *awsRestjson1_deserializeOpUpdateAsset) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3190 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3191) { 3192 out, metadata, err = next.HandleDeserialize(ctx, in) 3193 if err != nil { 3194 return out, metadata, err 3195 } 3196 3197 response, ok := out.RawResponse.(*smithyhttp.Response) 3198 if !ok { 3199 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3200 } 3201 3202 if response.StatusCode < 200 || response.StatusCode >= 300 { 3203 return out, metadata, awsRestjson1_deserializeOpErrorUpdateAsset(response, &metadata) 3204 } 3205 output := &UpdateAssetOutput{} 3206 out.Result = output 3207 3208 var buff [1024]byte 3209 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3210 3211 body := io.TeeReader(response.Body, ringBuffer) 3212 3213 decoder := json.NewDecoder(body) 3214 decoder.UseNumber() 3215 var shape interface{} 3216 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3217 var snapshot bytes.Buffer 3218 io.Copy(&snapshot, ringBuffer) 3219 err = &smithy.DeserializationError{ 3220 Err: fmt.Errorf("failed to decode response body, %w", err), 3221 Snapshot: snapshot.Bytes(), 3222 } 3223 return out, metadata, err 3224 } 3225 3226 err = awsRestjson1_deserializeOpDocumentUpdateAssetOutput(&output, shape) 3227 if err != nil { 3228 var snapshot bytes.Buffer 3229 io.Copy(&snapshot, ringBuffer) 3230 return out, metadata, &smithy.DeserializationError{ 3231 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3232 Snapshot: snapshot.Bytes(), 3233 } 3234 } 3235 3236 return out, metadata, err 3237} 3238 3239func awsRestjson1_deserializeOpErrorUpdateAsset(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3240 var errorBuffer bytes.Buffer 3241 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3242 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3243 } 3244 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3245 3246 errorCode := "UnknownError" 3247 errorMessage := errorCode 3248 3249 code := response.Header.Get("X-Amzn-ErrorType") 3250 if len(code) != 0 { 3251 errorCode = restjson.SanitizeErrorCode(code) 3252 } 3253 3254 var buff [1024]byte 3255 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3256 3257 body := io.TeeReader(errorBody, ringBuffer) 3258 decoder := json.NewDecoder(body) 3259 decoder.UseNumber() 3260 code, message, err := restjson.GetErrorInfo(decoder) 3261 if err != nil { 3262 var snapshot bytes.Buffer 3263 io.Copy(&snapshot, ringBuffer) 3264 err = &smithy.DeserializationError{ 3265 Err: fmt.Errorf("failed to decode response body, %w", err), 3266 Snapshot: snapshot.Bytes(), 3267 } 3268 return err 3269 } 3270 3271 errorBody.Seek(0, io.SeekStart) 3272 if len(code) != 0 { 3273 errorCode = restjson.SanitizeErrorCode(code) 3274 } 3275 if len(message) != 0 { 3276 errorMessage = message 3277 } 3278 3279 switch { 3280 case strings.EqualFold("AccessDeniedException", errorCode): 3281 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3282 3283 case strings.EqualFold("ConflictException", errorCode): 3284 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 3285 3286 case strings.EqualFold("InternalServerException", errorCode): 3287 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3288 3289 case strings.EqualFold("ResourceNotFoundException", errorCode): 3290 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3291 3292 case strings.EqualFold("ThrottlingException", errorCode): 3293 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3294 3295 case strings.EqualFold("ValidationException", errorCode): 3296 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3297 3298 default: 3299 genericError := &smithy.GenericAPIError{ 3300 Code: errorCode, 3301 Message: errorMessage, 3302 } 3303 return genericError 3304 3305 } 3306} 3307 3308func awsRestjson1_deserializeOpDocumentUpdateAssetOutput(v **UpdateAssetOutput, value interface{}) error { 3309 if v == nil { 3310 return fmt.Errorf("unexpected nil of type %T", v) 3311 } 3312 if value == nil { 3313 return nil 3314 } 3315 3316 shape, ok := value.(map[string]interface{}) 3317 if !ok { 3318 return fmt.Errorf("unexpected JSON type %v", value) 3319 } 3320 3321 var sv *UpdateAssetOutput 3322 if *v == nil { 3323 sv = &UpdateAssetOutput{} 3324 } else { 3325 sv = *v 3326 } 3327 3328 for key, value := range shape { 3329 switch key { 3330 case "Arn": 3331 if value != nil { 3332 jtv, ok := value.(string) 3333 if !ok { 3334 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 3335 } 3336 sv.Arn = ptr.String(jtv) 3337 } 3338 3339 case "AssetDetails": 3340 if err := awsRestjson1_deserializeDocumentAssetDetails(&sv.AssetDetails, value); err != nil { 3341 return err 3342 } 3343 3344 case "AssetType": 3345 if value != nil { 3346 jtv, ok := value.(string) 3347 if !ok { 3348 return fmt.Errorf("expected AssetType to be of type string, got %T instead", value) 3349 } 3350 sv.AssetType = types.AssetType(jtv) 3351 } 3352 3353 case "CreatedAt": 3354 if value != nil { 3355 jtv, ok := value.(string) 3356 if !ok { 3357 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3358 } 3359 t, err := smithytime.ParseDateTime(jtv) 3360 if err != nil { 3361 return err 3362 } 3363 sv.CreatedAt = ptr.Time(t) 3364 } 3365 3366 case "DataSetId": 3367 if value != nil { 3368 jtv, ok := value.(string) 3369 if !ok { 3370 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3371 } 3372 sv.DataSetId = ptr.String(jtv) 3373 } 3374 3375 case "Id": 3376 if value != nil { 3377 jtv, ok := value.(string) 3378 if !ok { 3379 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3380 } 3381 sv.Id = ptr.String(jtv) 3382 } 3383 3384 case "Name": 3385 if value != nil { 3386 jtv, ok := value.(string) 3387 if !ok { 3388 return fmt.Errorf("expected AssetName to be of type string, got %T instead", value) 3389 } 3390 sv.Name = ptr.String(jtv) 3391 } 3392 3393 case "RevisionId": 3394 if value != nil { 3395 jtv, ok := value.(string) 3396 if !ok { 3397 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3398 } 3399 sv.RevisionId = ptr.String(jtv) 3400 } 3401 3402 case "SourceId": 3403 if value != nil { 3404 jtv, ok := value.(string) 3405 if !ok { 3406 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3407 } 3408 sv.SourceId = ptr.String(jtv) 3409 } 3410 3411 case "UpdatedAt": 3412 if value != nil { 3413 jtv, ok := value.(string) 3414 if !ok { 3415 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3416 } 3417 t, err := smithytime.ParseDateTime(jtv) 3418 if err != nil { 3419 return err 3420 } 3421 sv.UpdatedAt = ptr.Time(t) 3422 } 3423 3424 default: 3425 _, _ = key, value 3426 3427 } 3428 } 3429 *v = sv 3430 return nil 3431} 3432 3433type awsRestjson1_deserializeOpUpdateDataSet struct { 3434} 3435 3436func (*awsRestjson1_deserializeOpUpdateDataSet) ID() string { 3437 return "OperationDeserializer" 3438} 3439 3440func (m *awsRestjson1_deserializeOpUpdateDataSet) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3441 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3442) { 3443 out, metadata, err = next.HandleDeserialize(ctx, in) 3444 if err != nil { 3445 return out, metadata, err 3446 } 3447 3448 response, ok := out.RawResponse.(*smithyhttp.Response) 3449 if !ok { 3450 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3451 } 3452 3453 if response.StatusCode < 200 || response.StatusCode >= 300 { 3454 return out, metadata, awsRestjson1_deserializeOpErrorUpdateDataSet(response, &metadata) 3455 } 3456 output := &UpdateDataSetOutput{} 3457 out.Result = output 3458 3459 var buff [1024]byte 3460 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3461 3462 body := io.TeeReader(response.Body, ringBuffer) 3463 3464 decoder := json.NewDecoder(body) 3465 decoder.UseNumber() 3466 var shape interface{} 3467 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3468 var snapshot bytes.Buffer 3469 io.Copy(&snapshot, ringBuffer) 3470 err = &smithy.DeserializationError{ 3471 Err: fmt.Errorf("failed to decode response body, %w", err), 3472 Snapshot: snapshot.Bytes(), 3473 } 3474 return out, metadata, err 3475 } 3476 3477 err = awsRestjson1_deserializeOpDocumentUpdateDataSetOutput(&output, shape) 3478 if err != nil { 3479 var snapshot bytes.Buffer 3480 io.Copy(&snapshot, ringBuffer) 3481 return out, metadata, &smithy.DeserializationError{ 3482 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3483 Snapshot: snapshot.Bytes(), 3484 } 3485 } 3486 3487 return out, metadata, err 3488} 3489 3490func awsRestjson1_deserializeOpErrorUpdateDataSet(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3491 var errorBuffer bytes.Buffer 3492 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3493 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3494 } 3495 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3496 3497 errorCode := "UnknownError" 3498 errorMessage := errorCode 3499 3500 code := response.Header.Get("X-Amzn-ErrorType") 3501 if len(code) != 0 { 3502 errorCode = restjson.SanitizeErrorCode(code) 3503 } 3504 3505 var buff [1024]byte 3506 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3507 3508 body := io.TeeReader(errorBody, ringBuffer) 3509 decoder := json.NewDecoder(body) 3510 decoder.UseNumber() 3511 code, message, err := restjson.GetErrorInfo(decoder) 3512 if err != nil { 3513 var snapshot bytes.Buffer 3514 io.Copy(&snapshot, ringBuffer) 3515 err = &smithy.DeserializationError{ 3516 Err: fmt.Errorf("failed to decode response body, %w", err), 3517 Snapshot: snapshot.Bytes(), 3518 } 3519 return err 3520 } 3521 3522 errorBody.Seek(0, io.SeekStart) 3523 if len(code) != 0 { 3524 errorCode = restjson.SanitizeErrorCode(code) 3525 } 3526 if len(message) != 0 { 3527 errorMessage = message 3528 } 3529 3530 switch { 3531 case strings.EqualFold("AccessDeniedException", errorCode): 3532 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3533 3534 case strings.EqualFold("InternalServerException", errorCode): 3535 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3536 3537 case strings.EqualFold("ResourceNotFoundException", errorCode): 3538 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3539 3540 case strings.EqualFold("ThrottlingException", errorCode): 3541 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3542 3543 case strings.EqualFold("ValidationException", errorCode): 3544 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3545 3546 default: 3547 genericError := &smithy.GenericAPIError{ 3548 Code: errorCode, 3549 Message: errorMessage, 3550 } 3551 return genericError 3552 3553 } 3554} 3555 3556func awsRestjson1_deserializeOpDocumentUpdateDataSetOutput(v **UpdateDataSetOutput, value interface{}) error { 3557 if v == nil { 3558 return fmt.Errorf("unexpected nil of type %T", v) 3559 } 3560 if value == nil { 3561 return nil 3562 } 3563 3564 shape, ok := value.(map[string]interface{}) 3565 if !ok { 3566 return fmt.Errorf("unexpected JSON type %v", value) 3567 } 3568 3569 var sv *UpdateDataSetOutput 3570 if *v == nil { 3571 sv = &UpdateDataSetOutput{} 3572 } else { 3573 sv = *v 3574 } 3575 3576 for key, value := range shape { 3577 switch key { 3578 case "Arn": 3579 if value != nil { 3580 jtv, ok := value.(string) 3581 if !ok { 3582 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 3583 } 3584 sv.Arn = ptr.String(jtv) 3585 } 3586 3587 case "AssetType": 3588 if value != nil { 3589 jtv, ok := value.(string) 3590 if !ok { 3591 return fmt.Errorf("expected AssetType to be of type string, got %T instead", value) 3592 } 3593 sv.AssetType = types.AssetType(jtv) 3594 } 3595 3596 case "CreatedAt": 3597 if value != nil { 3598 jtv, ok := value.(string) 3599 if !ok { 3600 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3601 } 3602 t, err := smithytime.ParseDateTime(jtv) 3603 if err != nil { 3604 return err 3605 } 3606 sv.CreatedAt = ptr.Time(t) 3607 } 3608 3609 case "Description": 3610 if value != nil { 3611 jtv, ok := value.(string) 3612 if !ok { 3613 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 3614 } 3615 sv.Description = ptr.String(jtv) 3616 } 3617 3618 case "Id": 3619 if value != nil { 3620 jtv, ok := value.(string) 3621 if !ok { 3622 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3623 } 3624 sv.Id = ptr.String(jtv) 3625 } 3626 3627 case "Name": 3628 if value != nil { 3629 jtv, ok := value.(string) 3630 if !ok { 3631 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 3632 } 3633 sv.Name = ptr.String(jtv) 3634 } 3635 3636 case "Origin": 3637 if value != nil { 3638 jtv, ok := value.(string) 3639 if !ok { 3640 return fmt.Errorf("expected Origin to be of type string, got %T instead", value) 3641 } 3642 sv.Origin = types.Origin(jtv) 3643 } 3644 3645 case "OriginDetails": 3646 if err := awsRestjson1_deserializeDocumentOriginDetails(&sv.OriginDetails, value); err != nil { 3647 return err 3648 } 3649 3650 case "SourceId": 3651 if value != nil { 3652 jtv, ok := value.(string) 3653 if !ok { 3654 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3655 } 3656 sv.SourceId = ptr.String(jtv) 3657 } 3658 3659 case "UpdatedAt": 3660 if value != nil { 3661 jtv, ok := value.(string) 3662 if !ok { 3663 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3664 } 3665 t, err := smithytime.ParseDateTime(jtv) 3666 if err != nil { 3667 return err 3668 } 3669 sv.UpdatedAt = ptr.Time(t) 3670 } 3671 3672 default: 3673 _, _ = key, value 3674 3675 } 3676 } 3677 *v = sv 3678 return nil 3679} 3680 3681type awsRestjson1_deserializeOpUpdateRevision struct { 3682} 3683 3684func (*awsRestjson1_deserializeOpUpdateRevision) ID() string { 3685 return "OperationDeserializer" 3686} 3687 3688func (m *awsRestjson1_deserializeOpUpdateRevision) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3689 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3690) { 3691 out, metadata, err = next.HandleDeserialize(ctx, in) 3692 if err != nil { 3693 return out, metadata, err 3694 } 3695 3696 response, ok := out.RawResponse.(*smithyhttp.Response) 3697 if !ok { 3698 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3699 } 3700 3701 if response.StatusCode < 200 || response.StatusCode >= 300 { 3702 return out, metadata, awsRestjson1_deserializeOpErrorUpdateRevision(response, &metadata) 3703 } 3704 output := &UpdateRevisionOutput{} 3705 out.Result = output 3706 3707 var buff [1024]byte 3708 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3709 3710 body := io.TeeReader(response.Body, ringBuffer) 3711 3712 decoder := json.NewDecoder(body) 3713 decoder.UseNumber() 3714 var shape interface{} 3715 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3716 var snapshot bytes.Buffer 3717 io.Copy(&snapshot, ringBuffer) 3718 err = &smithy.DeserializationError{ 3719 Err: fmt.Errorf("failed to decode response body, %w", err), 3720 Snapshot: snapshot.Bytes(), 3721 } 3722 return out, metadata, err 3723 } 3724 3725 err = awsRestjson1_deserializeOpDocumentUpdateRevisionOutput(&output, shape) 3726 if err != nil { 3727 var snapshot bytes.Buffer 3728 io.Copy(&snapshot, ringBuffer) 3729 return out, metadata, &smithy.DeserializationError{ 3730 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3731 Snapshot: snapshot.Bytes(), 3732 } 3733 } 3734 3735 return out, metadata, err 3736} 3737 3738func awsRestjson1_deserializeOpErrorUpdateRevision(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3739 var errorBuffer bytes.Buffer 3740 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3741 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3742 } 3743 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3744 3745 errorCode := "UnknownError" 3746 errorMessage := errorCode 3747 3748 code := response.Header.Get("X-Amzn-ErrorType") 3749 if len(code) != 0 { 3750 errorCode = restjson.SanitizeErrorCode(code) 3751 } 3752 3753 var buff [1024]byte 3754 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3755 3756 body := io.TeeReader(errorBody, ringBuffer) 3757 decoder := json.NewDecoder(body) 3758 decoder.UseNumber() 3759 code, message, err := restjson.GetErrorInfo(decoder) 3760 if err != nil { 3761 var snapshot bytes.Buffer 3762 io.Copy(&snapshot, ringBuffer) 3763 err = &smithy.DeserializationError{ 3764 Err: fmt.Errorf("failed to decode response body, %w", err), 3765 Snapshot: snapshot.Bytes(), 3766 } 3767 return err 3768 } 3769 3770 errorBody.Seek(0, io.SeekStart) 3771 if len(code) != 0 { 3772 errorCode = restjson.SanitizeErrorCode(code) 3773 } 3774 if len(message) != 0 { 3775 errorMessage = message 3776 } 3777 3778 switch { 3779 case strings.EqualFold("AccessDeniedException", errorCode): 3780 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3781 3782 case strings.EqualFold("ConflictException", errorCode): 3783 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 3784 3785 case strings.EqualFold("InternalServerException", errorCode): 3786 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3787 3788 case strings.EqualFold("ResourceNotFoundException", errorCode): 3789 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3790 3791 case strings.EqualFold("ThrottlingException", errorCode): 3792 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3793 3794 case strings.EqualFold("ValidationException", errorCode): 3795 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3796 3797 default: 3798 genericError := &smithy.GenericAPIError{ 3799 Code: errorCode, 3800 Message: errorMessage, 3801 } 3802 return genericError 3803 3804 } 3805} 3806 3807func awsRestjson1_deserializeOpDocumentUpdateRevisionOutput(v **UpdateRevisionOutput, value interface{}) error { 3808 if v == nil { 3809 return fmt.Errorf("unexpected nil of type %T", v) 3810 } 3811 if value == nil { 3812 return nil 3813 } 3814 3815 shape, ok := value.(map[string]interface{}) 3816 if !ok { 3817 return fmt.Errorf("unexpected JSON type %v", value) 3818 } 3819 3820 var sv *UpdateRevisionOutput 3821 if *v == nil { 3822 sv = &UpdateRevisionOutput{} 3823 } else { 3824 sv = *v 3825 } 3826 3827 for key, value := range shape { 3828 switch key { 3829 case "Arn": 3830 if value != nil { 3831 jtv, ok := value.(string) 3832 if !ok { 3833 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 3834 } 3835 sv.Arn = ptr.String(jtv) 3836 } 3837 3838 case "Comment": 3839 if value != nil { 3840 jtv, ok := value.(string) 3841 if !ok { 3842 return fmt.Errorf("expected __stringMin0Max16384 to be of type string, got %T instead", value) 3843 } 3844 sv.Comment = ptr.String(jtv) 3845 } 3846 3847 case "CreatedAt": 3848 if value != nil { 3849 jtv, ok := value.(string) 3850 if !ok { 3851 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3852 } 3853 t, err := smithytime.ParseDateTime(jtv) 3854 if err != nil { 3855 return err 3856 } 3857 sv.CreatedAt = ptr.Time(t) 3858 } 3859 3860 case "DataSetId": 3861 if value != nil { 3862 jtv, ok := value.(string) 3863 if !ok { 3864 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3865 } 3866 sv.DataSetId = ptr.String(jtv) 3867 } 3868 3869 case "Finalized": 3870 if value != nil { 3871 jtv, ok := value.(bool) 3872 if !ok { 3873 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 3874 } 3875 sv.Finalized = jtv 3876 } 3877 3878 case "Id": 3879 if value != nil { 3880 jtv, ok := value.(string) 3881 if !ok { 3882 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3883 } 3884 sv.Id = ptr.String(jtv) 3885 } 3886 3887 case "SourceId": 3888 if value != nil { 3889 jtv, ok := value.(string) 3890 if !ok { 3891 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3892 } 3893 sv.SourceId = ptr.String(jtv) 3894 } 3895 3896 case "UpdatedAt": 3897 if value != nil { 3898 jtv, ok := value.(string) 3899 if !ok { 3900 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 3901 } 3902 t, err := smithytime.ParseDateTime(jtv) 3903 if err != nil { 3904 return err 3905 } 3906 sv.UpdatedAt = ptr.Time(t) 3907 } 3908 3909 default: 3910 _, _ = key, value 3911 3912 } 3913 } 3914 *v = sv 3915 return nil 3916} 3917 3918func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3919 output := &types.AccessDeniedException{} 3920 var buff [1024]byte 3921 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3922 3923 body := io.TeeReader(errorBody, ringBuffer) 3924 decoder := json.NewDecoder(body) 3925 decoder.UseNumber() 3926 var shape interface{} 3927 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3928 var snapshot bytes.Buffer 3929 io.Copy(&snapshot, ringBuffer) 3930 err = &smithy.DeserializationError{ 3931 Err: fmt.Errorf("failed to decode response body, %w", err), 3932 Snapshot: snapshot.Bytes(), 3933 } 3934 return err 3935 } 3936 3937 err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) 3938 3939 if err != nil { 3940 var snapshot bytes.Buffer 3941 io.Copy(&snapshot, ringBuffer) 3942 err = &smithy.DeserializationError{ 3943 Err: fmt.Errorf("failed to decode response body, %w", err), 3944 Snapshot: snapshot.Bytes(), 3945 } 3946 return err 3947 } 3948 3949 errorBody.Seek(0, io.SeekStart) 3950 3951 return output 3952} 3953 3954func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3955 output := &types.ConflictException{} 3956 var buff [1024]byte 3957 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3958 3959 body := io.TeeReader(errorBody, ringBuffer) 3960 decoder := json.NewDecoder(body) 3961 decoder.UseNumber() 3962 var shape interface{} 3963 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3964 var snapshot bytes.Buffer 3965 io.Copy(&snapshot, ringBuffer) 3966 err = &smithy.DeserializationError{ 3967 Err: fmt.Errorf("failed to decode response body, %w", err), 3968 Snapshot: snapshot.Bytes(), 3969 } 3970 return err 3971 } 3972 3973 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 3974 3975 if err != nil { 3976 var snapshot bytes.Buffer 3977 io.Copy(&snapshot, ringBuffer) 3978 err = &smithy.DeserializationError{ 3979 Err: fmt.Errorf("failed to decode response body, %w", err), 3980 Snapshot: snapshot.Bytes(), 3981 } 3982 return err 3983 } 3984 3985 errorBody.Seek(0, io.SeekStart) 3986 3987 return output 3988} 3989 3990func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3991 output := &types.InternalServerException{} 3992 var buff [1024]byte 3993 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3994 3995 body := io.TeeReader(errorBody, ringBuffer) 3996 decoder := json.NewDecoder(body) 3997 decoder.UseNumber() 3998 var shape interface{} 3999 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4000 var snapshot bytes.Buffer 4001 io.Copy(&snapshot, ringBuffer) 4002 err = &smithy.DeserializationError{ 4003 Err: fmt.Errorf("failed to decode response body, %w", err), 4004 Snapshot: snapshot.Bytes(), 4005 } 4006 return err 4007 } 4008 4009 err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) 4010 4011 if err != nil { 4012 var snapshot bytes.Buffer 4013 io.Copy(&snapshot, ringBuffer) 4014 err = &smithy.DeserializationError{ 4015 Err: fmt.Errorf("failed to decode response body, %w", err), 4016 Snapshot: snapshot.Bytes(), 4017 } 4018 return err 4019 } 4020 4021 errorBody.Seek(0, io.SeekStart) 4022 4023 return output 4024} 4025 4026func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4027 output := &types.ResourceNotFoundException{} 4028 var buff [1024]byte 4029 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4030 4031 body := io.TeeReader(errorBody, ringBuffer) 4032 decoder := json.NewDecoder(body) 4033 decoder.UseNumber() 4034 var shape interface{} 4035 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4036 var snapshot bytes.Buffer 4037 io.Copy(&snapshot, ringBuffer) 4038 err = &smithy.DeserializationError{ 4039 Err: fmt.Errorf("failed to decode response body, %w", err), 4040 Snapshot: snapshot.Bytes(), 4041 } 4042 return err 4043 } 4044 4045 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 4046 4047 if err != nil { 4048 var snapshot bytes.Buffer 4049 io.Copy(&snapshot, ringBuffer) 4050 err = &smithy.DeserializationError{ 4051 Err: fmt.Errorf("failed to decode response body, %w", err), 4052 Snapshot: snapshot.Bytes(), 4053 } 4054 return err 4055 } 4056 4057 errorBody.Seek(0, io.SeekStart) 4058 4059 return output 4060} 4061 4062func awsRestjson1_deserializeErrorServiceLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4063 output := &types.ServiceLimitExceededException{} 4064 var buff [1024]byte 4065 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4066 4067 body := io.TeeReader(errorBody, ringBuffer) 4068 decoder := json.NewDecoder(body) 4069 decoder.UseNumber() 4070 var shape interface{} 4071 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4072 var snapshot bytes.Buffer 4073 io.Copy(&snapshot, ringBuffer) 4074 err = &smithy.DeserializationError{ 4075 Err: fmt.Errorf("failed to decode response body, %w", err), 4076 Snapshot: snapshot.Bytes(), 4077 } 4078 return err 4079 } 4080 4081 err := awsRestjson1_deserializeDocumentServiceLimitExceededException(&output, shape) 4082 4083 if err != nil { 4084 var snapshot bytes.Buffer 4085 io.Copy(&snapshot, ringBuffer) 4086 err = &smithy.DeserializationError{ 4087 Err: fmt.Errorf("failed to decode response body, %w", err), 4088 Snapshot: snapshot.Bytes(), 4089 } 4090 return err 4091 } 4092 4093 errorBody.Seek(0, io.SeekStart) 4094 4095 return output 4096} 4097 4098func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4099 output := &types.ThrottlingException{} 4100 var buff [1024]byte 4101 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4102 4103 body := io.TeeReader(errorBody, ringBuffer) 4104 decoder := json.NewDecoder(body) 4105 decoder.UseNumber() 4106 var shape interface{} 4107 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4108 var snapshot bytes.Buffer 4109 io.Copy(&snapshot, ringBuffer) 4110 err = &smithy.DeserializationError{ 4111 Err: fmt.Errorf("failed to decode response body, %w", err), 4112 Snapshot: snapshot.Bytes(), 4113 } 4114 return err 4115 } 4116 4117 err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) 4118 4119 if err != nil { 4120 var snapshot bytes.Buffer 4121 io.Copy(&snapshot, ringBuffer) 4122 err = &smithy.DeserializationError{ 4123 Err: fmt.Errorf("failed to decode response body, %w", err), 4124 Snapshot: snapshot.Bytes(), 4125 } 4126 return err 4127 } 4128 4129 errorBody.Seek(0, io.SeekStart) 4130 4131 return output 4132} 4133 4134func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 4135 output := &types.ValidationException{} 4136 var buff [1024]byte 4137 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4138 4139 body := io.TeeReader(errorBody, ringBuffer) 4140 decoder := json.NewDecoder(body) 4141 decoder.UseNumber() 4142 var shape interface{} 4143 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4144 var snapshot bytes.Buffer 4145 io.Copy(&snapshot, ringBuffer) 4146 err = &smithy.DeserializationError{ 4147 Err: fmt.Errorf("failed to decode response body, %w", err), 4148 Snapshot: snapshot.Bytes(), 4149 } 4150 return err 4151 } 4152 4153 err := awsRestjson1_deserializeDocumentValidationException(&output, shape) 4154 4155 if err != nil { 4156 var snapshot bytes.Buffer 4157 io.Copy(&snapshot, ringBuffer) 4158 err = &smithy.DeserializationError{ 4159 Err: fmt.Errorf("failed to decode response body, %w", err), 4160 Snapshot: snapshot.Bytes(), 4161 } 4162 return err 4163 } 4164 4165 errorBody.Seek(0, io.SeekStart) 4166 4167 return output 4168} 4169 4170func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { 4171 if v == nil { 4172 return fmt.Errorf("unexpected nil of type %T", v) 4173 } 4174 if value == nil { 4175 return nil 4176 } 4177 4178 shape, ok := value.(map[string]interface{}) 4179 if !ok { 4180 return fmt.Errorf("unexpected JSON type %v", value) 4181 } 4182 4183 var sv *types.AccessDeniedException 4184 if *v == nil { 4185 sv = &types.AccessDeniedException{} 4186 } else { 4187 sv = *v 4188 } 4189 4190 for key, value := range shape { 4191 switch key { 4192 case "Message": 4193 if value != nil { 4194 jtv, ok := value.(string) 4195 if !ok { 4196 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4197 } 4198 sv.Message = ptr.String(jtv) 4199 } 4200 4201 default: 4202 _, _ = key, value 4203 4204 } 4205 } 4206 *v = sv 4207 return nil 4208} 4209 4210func awsRestjson1_deserializeDocumentAssetDestinationEntry(v **types.AssetDestinationEntry, value interface{}) error { 4211 if v == nil { 4212 return fmt.Errorf("unexpected nil of type %T", v) 4213 } 4214 if value == nil { 4215 return nil 4216 } 4217 4218 shape, ok := value.(map[string]interface{}) 4219 if !ok { 4220 return fmt.Errorf("unexpected JSON type %v", value) 4221 } 4222 4223 var sv *types.AssetDestinationEntry 4224 if *v == nil { 4225 sv = &types.AssetDestinationEntry{} 4226 } else { 4227 sv = *v 4228 } 4229 4230 for key, value := range shape { 4231 switch key { 4232 case "AssetId": 4233 if value != nil { 4234 jtv, ok := value.(string) 4235 if !ok { 4236 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4237 } 4238 sv.AssetId = ptr.String(jtv) 4239 } 4240 4241 case "Bucket": 4242 if value != nil { 4243 jtv, ok := value.(string) 4244 if !ok { 4245 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4246 } 4247 sv.Bucket = ptr.String(jtv) 4248 } 4249 4250 case "Key": 4251 if value != nil { 4252 jtv, ok := value.(string) 4253 if !ok { 4254 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4255 } 4256 sv.Key = ptr.String(jtv) 4257 } 4258 4259 default: 4260 _, _ = key, value 4261 4262 } 4263 } 4264 *v = sv 4265 return nil 4266} 4267 4268func awsRestjson1_deserializeDocumentAssetDetails(v **types.AssetDetails, value interface{}) error { 4269 if v == nil { 4270 return fmt.Errorf("unexpected nil of type %T", v) 4271 } 4272 if value == nil { 4273 return nil 4274 } 4275 4276 shape, ok := value.(map[string]interface{}) 4277 if !ok { 4278 return fmt.Errorf("unexpected JSON type %v", value) 4279 } 4280 4281 var sv *types.AssetDetails 4282 if *v == nil { 4283 sv = &types.AssetDetails{} 4284 } else { 4285 sv = *v 4286 } 4287 4288 for key, value := range shape { 4289 switch key { 4290 case "S3SnapshotAsset": 4291 if err := awsRestjson1_deserializeDocumentS3SnapshotAsset(&sv.S3SnapshotAsset, value); err != nil { 4292 return err 4293 } 4294 4295 default: 4296 _, _ = key, value 4297 4298 } 4299 } 4300 *v = sv 4301 return nil 4302} 4303 4304func awsRestjson1_deserializeDocumentAssetEntry(v **types.AssetEntry, value interface{}) error { 4305 if v == nil { 4306 return fmt.Errorf("unexpected nil of type %T", v) 4307 } 4308 if value == nil { 4309 return nil 4310 } 4311 4312 shape, ok := value.(map[string]interface{}) 4313 if !ok { 4314 return fmt.Errorf("unexpected JSON type %v", value) 4315 } 4316 4317 var sv *types.AssetEntry 4318 if *v == nil { 4319 sv = &types.AssetEntry{} 4320 } else { 4321 sv = *v 4322 } 4323 4324 for key, value := range shape { 4325 switch key { 4326 case "Arn": 4327 if value != nil { 4328 jtv, ok := value.(string) 4329 if !ok { 4330 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4331 } 4332 sv.Arn = ptr.String(jtv) 4333 } 4334 4335 case "AssetDetails": 4336 if err := awsRestjson1_deserializeDocumentAssetDetails(&sv.AssetDetails, value); err != nil { 4337 return err 4338 } 4339 4340 case "AssetType": 4341 if value != nil { 4342 jtv, ok := value.(string) 4343 if !ok { 4344 return fmt.Errorf("expected AssetType to be of type string, got %T instead", value) 4345 } 4346 sv.AssetType = types.AssetType(jtv) 4347 } 4348 4349 case "CreatedAt": 4350 if value != nil { 4351 jtv, ok := value.(string) 4352 if !ok { 4353 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 4354 } 4355 t, err := smithytime.ParseDateTime(jtv) 4356 if err != nil { 4357 return err 4358 } 4359 sv.CreatedAt = ptr.Time(t) 4360 } 4361 4362 case "DataSetId": 4363 if value != nil { 4364 jtv, ok := value.(string) 4365 if !ok { 4366 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4367 } 4368 sv.DataSetId = ptr.String(jtv) 4369 } 4370 4371 case "Id": 4372 if value != nil { 4373 jtv, ok := value.(string) 4374 if !ok { 4375 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4376 } 4377 sv.Id = ptr.String(jtv) 4378 } 4379 4380 case "Name": 4381 if value != nil { 4382 jtv, ok := value.(string) 4383 if !ok { 4384 return fmt.Errorf("expected AssetName to be of type string, got %T instead", value) 4385 } 4386 sv.Name = ptr.String(jtv) 4387 } 4388 4389 case "RevisionId": 4390 if value != nil { 4391 jtv, ok := value.(string) 4392 if !ok { 4393 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4394 } 4395 sv.RevisionId = ptr.String(jtv) 4396 } 4397 4398 case "SourceId": 4399 if value != nil { 4400 jtv, ok := value.(string) 4401 if !ok { 4402 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4403 } 4404 sv.SourceId = ptr.String(jtv) 4405 } 4406 4407 case "UpdatedAt": 4408 if value != nil { 4409 jtv, ok := value.(string) 4410 if !ok { 4411 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 4412 } 4413 t, err := smithytime.ParseDateTime(jtv) 4414 if err != nil { 4415 return err 4416 } 4417 sv.UpdatedAt = ptr.Time(t) 4418 } 4419 4420 default: 4421 _, _ = key, value 4422 4423 } 4424 } 4425 *v = sv 4426 return nil 4427} 4428 4429func awsRestjson1_deserializeDocumentAssetSourceEntry(v **types.AssetSourceEntry, value interface{}) error { 4430 if v == nil { 4431 return fmt.Errorf("unexpected nil of type %T", v) 4432 } 4433 if value == nil { 4434 return nil 4435 } 4436 4437 shape, ok := value.(map[string]interface{}) 4438 if !ok { 4439 return fmt.Errorf("unexpected JSON type %v", value) 4440 } 4441 4442 var sv *types.AssetSourceEntry 4443 if *v == nil { 4444 sv = &types.AssetSourceEntry{} 4445 } else { 4446 sv = *v 4447 } 4448 4449 for key, value := range shape { 4450 switch key { 4451 case "Bucket": 4452 if value != nil { 4453 jtv, ok := value.(string) 4454 if !ok { 4455 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4456 } 4457 sv.Bucket = ptr.String(jtv) 4458 } 4459 4460 case "Key": 4461 if value != nil { 4462 jtv, ok := value.(string) 4463 if !ok { 4464 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4465 } 4466 sv.Key = ptr.String(jtv) 4467 } 4468 4469 default: 4470 _, _ = key, value 4471 4472 } 4473 } 4474 *v = sv 4475 return nil 4476} 4477 4478func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 4479 if v == nil { 4480 return fmt.Errorf("unexpected nil of type %T", v) 4481 } 4482 if value == nil { 4483 return nil 4484 } 4485 4486 shape, ok := value.(map[string]interface{}) 4487 if !ok { 4488 return fmt.Errorf("unexpected JSON type %v", value) 4489 } 4490 4491 var sv *types.ConflictException 4492 if *v == nil { 4493 sv = &types.ConflictException{} 4494 } else { 4495 sv = *v 4496 } 4497 4498 for key, value := range shape { 4499 switch key { 4500 case "Message": 4501 if value != nil { 4502 jtv, ok := value.(string) 4503 if !ok { 4504 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4505 } 4506 sv.Message = ptr.String(jtv) 4507 } 4508 4509 case "ResourceId": 4510 if value != nil { 4511 jtv, ok := value.(string) 4512 if !ok { 4513 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4514 } 4515 sv.ResourceId = ptr.String(jtv) 4516 } 4517 4518 case "ResourceType": 4519 if value != nil { 4520 jtv, ok := value.(string) 4521 if !ok { 4522 return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value) 4523 } 4524 sv.ResourceType = types.ResourceType(jtv) 4525 } 4526 4527 default: 4528 _, _ = key, value 4529 4530 } 4531 } 4532 *v = sv 4533 return nil 4534} 4535 4536func awsRestjson1_deserializeDocumentDataSetEntry(v **types.DataSetEntry, value interface{}) error { 4537 if v == nil { 4538 return fmt.Errorf("unexpected nil of type %T", v) 4539 } 4540 if value == nil { 4541 return nil 4542 } 4543 4544 shape, ok := value.(map[string]interface{}) 4545 if !ok { 4546 return fmt.Errorf("unexpected JSON type %v", value) 4547 } 4548 4549 var sv *types.DataSetEntry 4550 if *v == nil { 4551 sv = &types.DataSetEntry{} 4552 } else { 4553 sv = *v 4554 } 4555 4556 for key, value := range shape { 4557 switch key { 4558 case "Arn": 4559 if value != nil { 4560 jtv, ok := value.(string) 4561 if !ok { 4562 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 4563 } 4564 sv.Arn = ptr.String(jtv) 4565 } 4566 4567 case "AssetType": 4568 if value != nil { 4569 jtv, ok := value.(string) 4570 if !ok { 4571 return fmt.Errorf("expected AssetType to be of type string, got %T instead", value) 4572 } 4573 sv.AssetType = types.AssetType(jtv) 4574 } 4575 4576 case "CreatedAt": 4577 if value != nil { 4578 jtv, ok := value.(string) 4579 if !ok { 4580 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 4581 } 4582 t, err := smithytime.ParseDateTime(jtv) 4583 if err != nil { 4584 return err 4585 } 4586 sv.CreatedAt = ptr.Time(t) 4587 } 4588 4589 case "Description": 4590 if value != nil { 4591 jtv, ok := value.(string) 4592 if !ok { 4593 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 4594 } 4595 sv.Description = ptr.String(jtv) 4596 } 4597 4598 case "Id": 4599 if value != nil { 4600 jtv, ok := value.(string) 4601 if !ok { 4602 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4603 } 4604 sv.Id = ptr.String(jtv) 4605 } 4606 4607 case "Name": 4608 if value != nil { 4609 jtv, ok := value.(string) 4610 if !ok { 4611 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4612 } 4613 sv.Name = ptr.String(jtv) 4614 } 4615 4616 case "Origin": 4617 if value != nil { 4618 jtv, ok := value.(string) 4619 if !ok { 4620 return fmt.Errorf("expected Origin to be of type string, got %T instead", value) 4621 } 4622 sv.Origin = types.Origin(jtv) 4623 } 4624 4625 case "OriginDetails": 4626 if err := awsRestjson1_deserializeDocumentOriginDetails(&sv.OriginDetails, value); err != nil { 4627 return err 4628 } 4629 4630 case "SourceId": 4631 if value != nil { 4632 jtv, ok := value.(string) 4633 if !ok { 4634 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4635 } 4636 sv.SourceId = ptr.String(jtv) 4637 } 4638 4639 case "UpdatedAt": 4640 if value != nil { 4641 jtv, ok := value.(string) 4642 if !ok { 4643 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 4644 } 4645 t, err := smithytime.ParseDateTime(jtv) 4646 if err != nil { 4647 return err 4648 } 4649 sv.UpdatedAt = ptr.Time(t) 4650 } 4651 4652 default: 4653 _, _ = key, value 4654 4655 } 4656 } 4657 *v = sv 4658 return nil 4659} 4660 4661func awsRestjson1_deserializeDocumentDetails(v **types.Details, value interface{}) error { 4662 if v == nil { 4663 return fmt.Errorf("unexpected nil of type %T", v) 4664 } 4665 if value == nil { 4666 return nil 4667 } 4668 4669 shape, ok := value.(map[string]interface{}) 4670 if !ok { 4671 return fmt.Errorf("unexpected JSON type %v", value) 4672 } 4673 4674 var sv *types.Details 4675 if *v == nil { 4676 sv = &types.Details{} 4677 } else { 4678 sv = *v 4679 } 4680 4681 for key, value := range shape { 4682 switch key { 4683 case "ImportAssetFromSignedUrlJobErrorDetails": 4684 if err := awsRestjson1_deserializeDocumentImportAssetFromSignedUrlJobErrorDetails(&sv.ImportAssetFromSignedUrlJobErrorDetails, value); err != nil { 4685 return err 4686 } 4687 4688 case "ImportAssetsFromS3JobErrorDetails": 4689 if err := awsRestjson1_deserializeDocumentListOfAssetSourceEntry(&sv.ImportAssetsFromS3JobErrorDetails, value); err != nil { 4690 return err 4691 } 4692 4693 default: 4694 _, _ = key, value 4695 4696 } 4697 } 4698 *v = sv 4699 return nil 4700} 4701 4702func awsRestjson1_deserializeDocumentExportAssetsToS3ResponseDetails(v **types.ExportAssetsToS3ResponseDetails, value interface{}) error { 4703 if v == nil { 4704 return fmt.Errorf("unexpected nil of type %T", v) 4705 } 4706 if value == nil { 4707 return nil 4708 } 4709 4710 shape, ok := value.(map[string]interface{}) 4711 if !ok { 4712 return fmt.Errorf("unexpected JSON type %v", value) 4713 } 4714 4715 var sv *types.ExportAssetsToS3ResponseDetails 4716 if *v == nil { 4717 sv = &types.ExportAssetsToS3ResponseDetails{} 4718 } else { 4719 sv = *v 4720 } 4721 4722 for key, value := range shape { 4723 switch key { 4724 case "AssetDestinations": 4725 if err := awsRestjson1_deserializeDocumentListOfAssetDestinationEntry(&sv.AssetDestinations, value); err != nil { 4726 return err 4727 } 4728 4729 case "DataSetId": 4730 if value != nil { 4731 jtv, ok := value.(string) 4732 if !ok { 4733 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4734 } 4735 sv.DataSetId = ptr.String(jtv) 4736 } 4737 4738 case "Encryption": 4739 if err := awsRestjson1_deserializeDocumentExportServerSideEncryption(&sv.Encryption, value); err != nil { 4740 return err 4741 } 4742 4743 case "RevisionId": 4744 if value != nil { 4745 jtv, ok := value.(string) 4746 if !ok { 4747 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4748 } 4749 sv.RevisionId = ptr.String(jtv) 4750 } 4751 4752 default: 4753 _, _ = key, value 4754 4755 } 4756 } 4757 *v = sv 4758 return nil 4759} 4760 4761func awsRestjson1_deserializeDocumentExportAssetToSignedUrlResponseDetails(v **types.ExportAssetToSignedUrlResponseDetails, value interface{}) error { 4762 if v == nil { 4763 return fmt.Errorf("unexpected nil of type %T", v) 4764 } 4765 if value == nil { 4766 return nil 4767 } 4768 4769 shape, ok := value.(map[string]interface{}) 4770 if !ok { 4771 return fmt.Errorf("unexpected JSON type %v", value) 4772 } 4773 4774 var sv *types.ExportAssetToSignedUrlResponseDetails 4775 if *v == nil { 4776 sv = &types.ExportAssetToSignedUrlResponseDetails{} 4777 } else { 4778 sv = *v 4779 } 4780 4781 for key, value := range shape { 4782 switch key { 4783 case "AssetId": 4784 if value != nil { 4785 jtv, ok := value.(string) 4786 if !ok { 4787 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4788 } 4789 sv.AssetId = ptr.String(jtv) 4790 } 4791 4792 case "DataSetId": 4793 if value != nil { 4794 jtv, ok := value.(string) 4795 if !ok { 4796 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4797 } 4798 sv.DataSetId = ptr.String(jtv) 4799 } 4800 4801 case "RevisionId": 4802 if value != nil { 4803 jtv, ok := value.(string) 4804 if !ok { 4805 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4806 } 4807 sv.RevisionId = ptr.String(jtv) 4808 } 4809 4810 case "SignedUrl": 4811 if value != nil { 4812 jtv, ok := value.(string) 4813 if !ok { 4814 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4815 } 4816 sv.SignedUrl = ptr.String(jtv) 4817 } 4818 4819 case "SignedUrlExpiresAt": 4820 if value != nil { 4821 jtv, ok := value.(string) 4822 if !ok { 4823 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 4824 } 4825 t, err := smithytime.ParseDateTime(jtv) 4826 if err != nil { 4827 return err 4828 } 4829 sv.SignedUrlExpiresAt = ptr.Time(t) 4830 } 4831 4832 default: 4833 _, _ = key, value 4834 4835 } 4836 } 4837 *v = sv 4838 return nil 4839} 4840 4841func awsRestjson1_deserializeDocumentExportServerSideEncryption(v **types.ExportServerSideEncryption, value interface{}) error { 4842 if v == nil { 4843 return fmt.Errorf("unexpected nil of type %T", v) 4844 } 4845 if value == nil { 4846 return nil 4847 } 4848 4849 shape, ok := value.(map[string]interface{}) 4850 if !ok { 4851 return fmt.Errorf("unexpected JSON type %v", value) 4852 } 4853 4854 var sv *types.ExportServerSideEncryption 4855 if *v == nil { 4856 sv = &types.ExportServerSideEncryption{} 4857 } else { 4858 sv = *v 4859 } 4860 4861 for key, value := range shape { 4862 switch key { 4863 case "KmsKeyArn": 4864 if value != nil { 4865 jtv, ok := value.(string) 4866 if !ok { 4867 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4868 } 4869 sv.KmsKeyArn = ptr.String(jtv) 4870 } 4871 4872 case "Type": 4873 if value != nil { 4874 jtv, ok := value.(string) 4875 if !ok { 4876 return fmt.Errorf("expected ServerSideEncryptionTypes to be of type string, got %T instead", value) 4877 } 4878 sv.Type = types.ServerSideEncryptionTypes(jtv) 4879 } 4880 4881 default: 4882 _, _ = key, value 4883 4884 } 4885 } 4886 *v = sv 4887 return nil 4888} 4889 4890func awsRestjson1_deserializeDocumentImportAssetFromSignedUrlJobErrorDetails(v **types.ImportAssetFromSignedUrlJobErrorDetails, value interface{}) error { 4891 if v == nil { 4892 return fmt.Errorf("unexpected nil of type %T", v) 4893 } 4894 if value == nil { 4895 return nil 4896 } 4897 4898 shape, ok := value.(map[string]interface{}) 4899 if !ok { 4900 return fmt.Errorf("unexpected JSON type %v", value) 4901 } 4902 4903 var sv *types.ImportAssetFromSignedUrlJobErrorDetails 4904 if *v == nil { 4905 sv = &types.ImportAssetFromSignedUrlJobErrorDetails{} 4906 } else { 4907 sv = *v 4908 } 4909 4910 for key, value := range shape { 4911 switch key { 4912 case "AssetName": 4913 if value != nil { 4914 jtv, ok := value.(string) 4915 if !ok { 4916 return fmt.Errorf("expected AssetName to be of type string, got %T instead", value) 4917 } 4918 sv.AssetName = ptr.String(jtv) 4919 } 4920 4921 default: 4922 _, _ = key, value 4923 4924 } 4925 } 4926 *v = sv 4927 return nil 4928} 4929 4930func awsRestjson1_deserializeDocumentImportAssetFromSignedUrlResponseDetails(v **types.ImportAssetFromSignedUrlResponseDetails, value interface{}) error { 4931 if v == nil { 4932 return fmt.Errorf("unexpected nil of type %T", v) 4933 } 4934 if value == nil { 4935 return nil 4936 } 4937 4938 shape, ok := value.(map[string]interface{}) 4939 if !ok { 4940 return fmt.Errorf("unexpected JSON type %v", value) 4941 } 4942 4943 var sv *types.ImportAssetFromSignedUrlResponseDetails 4944 if *v == nil { 4945 sv = &types.ImportAssetFromSignedUrlResponseDetails{} 4946 } else { 4947 sv = *v 4948 } 4949 4950 for key, value := range shape { 4951 switch key { 4952 case "AssetName": 4953 if value != nil { 4954 jtv, ok := value.(string) 4955 if !ok { 4956 return fmt.Errorf("expected AssetName to be of type string, got %T instead", value) 4957 } 4958 sv.AssetName = ptr.String(jtv) 4959 } 4960 4961 case "DataSetId": 4962 if value != nil { 4963 jtv, ok := value.(string) 4964 if !ok { 4965 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4966 } 4967 sv.DataSetId = ptr.String(jtv) 4968 } 4969 4970 case "Md5Hash": 4971 if value != nil { 4972 jtv, ok := value.(string) 4973 if !ok { 4974 return fmt.Errorf("expected __stringMin24Max24PatternAZaZ094AZaZ092AZaZ093 to be of type string, got %T instead", value) 4975 } 4976 sv.Md5Hash = ptr.String(jtv) 4977 } 4978 4979 case "RevisionId": 4980 if value != nil { 4981 jtv, ok := value.(string) 4982 if !ok { 4983 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4984 } 4985 sv.RevisionId = ptr.String(jtv) 4986 } 4987 4988 case "SignedUrl": 4989 if value != nil { 4990 jtv, ok := value.(string) 4991 if !ok { 4992 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 4993 } 4994 sv.SignedUrl = ptr.String(jtv) 4995 } 4996 4997 case "SignedUrlExpiresAt": 4998 if value != nil { 4999 jtv, ok := value.(string) 5000 if !ok { 5001 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 5002 } 5003 t, err := smithytime.ParseDateTime(jtv) 5004 if err != nil { 5005 return err 5006 } 5007 sv.SignedUrlExpiresAt = ptr.Time(t) 5008 } 5009 5010 default: 5011 _, _ = key, value 5012 5013 } 5014 } 5015 *v = sv 5016 return nil 5017} 5018 5019func awsRestjson1_deserializeDocumentImportAssetsFromS3ResponseDetails(v **types.ImportAssetsFromS3ResponseDetails, value interface{}) error { 5020 if v == nil { 5021 return fmt.Errorf("unexpected nil of type %T", v) 5022 } 5023 if value == nil { 5024 return nil 5025 } 5026 5027 shape, ok := value.(map[string]interface{}) 5028 if !ok { 5029 return fmt.Errorf("unexpected JSON type %v", value) 5030 } 5031 5032 var sv *types.ImportAssetsFromS3ResponseDetails 5033 if *v == nil { 5034 sv = &types.ImportAssetsFromS3ResponseDetails{} 5035 } else { 5036 sv = *v 5037 } 5038 5039 for key, value := range shape { 5040 switch key { 5041 case "AssetSources": 5042 if err := awsRestjson1_deserializeDocumentListOfAssetSourceEntry(&sv.AssetSources, value); err != nil { 5043 return err 5044 } 5045 5046 case "DataSetId": 5047 if value != nil { 5048 jtv, ok := value.(string) 5049 if !ok { 5050 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5051 } 5052 sv.DataSetId = ptr.String(jtv) 5053 } 5054 5055 case "RevisionId": 5056 if value != nil { 5057 jtv, ok := value.(string) 5058 if !ok { 5059 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5060 } 5061 sv.RevisionId = ptr.String(jtv) 5062 } 5063 5064 default: 5065 _, _ = key, value 5066 5067 } 5068 } 5069 *v = sv 5070 return nil 5071} 5072 5073func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { 5074 if v == nil { 5075 return fmt.Errorf("unexpected nil of type %T", v) 5076 } 5077 if value == nil { 5078 return nil 5079 } 5080 5081 shape, ok := value.(map[string]interface{}) 5082 if !ok { 5083 return fmt.Errorf("unexpected JSON type %v", value) 5084 } 5085 5086 var sv *types.InternalServerException 5087 if *v == nil { 5088 sv = &types.InternalServerException{} 5089 } else { 5090 sv = *v 5091 } 5092 5093 for key, value := range shape { 5094 switch key { 5095 case "Message": 5096 if value != nil { 5097 jtv, ok := value.(string) 5098 if !ok { 5099 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5100 } 5101 sv.Message = ptr.String(jtv) 5102 } 5103 5104 default: 5105 _, _ = key, value 5106 5107 } 5108 } 5109 *v = sv 5110 return nil 5111} 5112 5113func awsRestjson1_deserializeDocumentJobEntry(v **types.JobEntry, value interface{}) error { 5114 if v == nil { 5115 return fmt.Errorf("unexpected nil of type %T", v) 5116 } 5117 if value == nil { 5118 return nil 5119 } 5120 5121 shape, ok := value.(map[string]interface{}) 5122 if !ok { 5123 return fmt.Errorf("unexpected JSON type %v", value) 5124 } 5125 5126 var sv *types.JobEntry 5127 if *v == nil { 5128 sv = &types.JobEntry{} 5129 } else { 5130 sv = *v 5131 } 5132 5133 for key, value := range shape { 5134 switch key { 5135 case "Arn": 5136 if value != nil { 5137 jtv, ok := value.(string) 5138 if !ok { 5139 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5140 } 5141 sv.Arn = ptr.String(jtv) 5142 } 5143 5144 case "CreatedAt": 5145 if value != nil { 5146 jtv, ok := value.(string) 5147 if !ok { 5148 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 5149 } 5150 t, err := smithytime.ParseDateTime(jtv) 5151 if err != nil { 5152 return err 5153 } 5154 sv.CreatedAt = ptr.Time(t) 5155 } 5156 5157 case "Details": 5158 if err := awsRestjson1_deserializeDocumentResponseDetails(&sv.Details, value); err != nil { 5159 return err 5160 } 5161 5162 case "Errors": 5163 if err := awsRestjson1_deserializeDocumentListOfJobError(&sv.Errors, value); err != nil { 5164 return err 5165 } 5166 5167 case "Id": 5168 if value != nil { 5169 jtv, ok := value.(string) 5170 if !ok { 5171 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5172 } 5173 sv.Id = ptr.String(jtv) 5174 } 5175 5176 case "State": 5177 if value != nil { 5178 jtv, ok := value.(string) 5179 if !ok { 5180 return fmt.Errorf("expected State to be of type string, got %T instead", value) 5181 } 5182 sv.State = types.State(jtv) 5183 } 5184 5185 case "Type": 5186 if value != nil { 5187 jtv, ok := value.(string) 5188 if !ok { 5189 return fmt.Errorf("expected Type to be of type string, got %T instead", value) 5190 } 5191 sv.Type = types.Type(jtv) 5192 } 5193 5194 case "UpdatedAt": 5195 if value != nil { 5196 jtv, ok := value.(string) 5197 if !ok { 5198 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 5199 } 5200 t, err := smithytime.ParseDateTime(jtv) 5201 if err != nil { 5202 return err 5203 } 5204 sv.UpdatedAt = ptr.Time(t) 5205 } 5206 5207 default: 5208 _, _ = key, value 5209 5210 } 5211 } 5212 *v = sv 5213 return nil 5214} 5215 5216func awsRestjson1_deserializeDocumentJobError(v **types.JobError, value interface{}) error { 5217 if v == nil { 5218 return fmt.Errorf("unexpected nil of type %T", v) 5219 } 5220 if value == nil { 5221 return nil 5222 } 5223 5224 shape, ok := value.(map[string]interface{}) 5225 if !ok { 5226 return fmt.Errorf("unexpected JSON type %v", value) 5227 } 5228 5229 var sv *types.JobError 5230 if *v == nil { 5231 sv = &types.JobError{} 5232 } else { 5233 sv = *v 5234 } 5235 5236 for key, value := range shape { 5237 switch key { 5238 case "Code": 5239 if value != nil { 5240 jtv, ok := value.(string) 5241 if !ok { 5242 return fmt.Errorf("expected Code to be of type string, got %T instead", value) 5243 } 5244 sv.Code = types.Code(jtv) 5245 } 5246 5247 case "Details": 5248 if err := awsRestjson1_deserializeDocumentDetails(&sv.Details, value); err != nil { 5249 return err 5250 } 5251 5252 case "LimitName": 5253 if value != nil { 5254 jtv, ok := value.(string) 5255 if !ok { 5256 return fmt.Errorf("expected JobErrorLimitName to be of type string, got %T instead", value) 5257 } 5258 sv.LimitName = types.JobErrorLimitName(jtv) 5259 } 5260 5261 case "LimitValue": 5262 if value != nil { 5263 jtv, ok := value.(json.Number) 5264 if !ok { 5265 return fmt.Errorf("expected __double to be json.Number, got %T instead", value) 5266 } 5267 f64, err := jtv.Float64() 5268 if err != nil { 5269 return err 5270 } 5271 sv.LimitValue = f64 5272 } 5273 5274 case "Message": 5275 if value != nil { 5276 jtv, ok := value.(string) 5277 if !ok { 5278 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5279 } 5280 sv.Message = ptr.String(jtv) 5281 } 5282 5283 case "ResourceId": 5284 if value != nil { 5285 jtv, ok := value.(string) 5286 if !ok { 5287 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5288 } 5289 sv.ResourceId = ptr.String(jtv) 5290 } 5291 5292 case "ResourceType": 5293 if value != nil { 5294 jtv, ok := value.(string) 5295 if !ok { 5296 return fmt.Errorf("expected JobErrorResourceTypes to be of type string, got %T instead", value) 5297 } 5298 sv.ResourceType = types.JobErrorResourceTypes(jtv) 5299 } 5300 5301 default: 5302 _, _ = key, value 5303 5304 } 5305 } 5306 *v = sv 5307 return nil 5308} 5309 5310func awsRestjson1_deserializeDocumentListOfAssetDestinationEntry(v *[]types.AssetDestinationEntry, value interface{}) error { 5311 if v == nil { 5312 return fmt.Errorf("unexpected nil of type %T", v) 5313 } 5314 if value == nil { 5315 return nil 5316 } 5317 5318 shape, ok := value.([]interface{}) 5319 if !ok { 5320 return fmt.Errorf("unexpected JSON type %v", value) 5321 } 5322 5323 var cv []types.AssetDestinationEntry 5324 if *v == nil { 5325 cv = []types.AssetDestinationEntry{} 5326 } else { 5327 cv = *v 5328 } 5329 5330 for _, value := range shape { 5331 var col types.AssetDestinationEntry 5332 destAddr := &col 5333 if err := awsRestjson1_deserializeDocumentAssetDestinationEntry(&destAddr, value); err != nil { 5334 return err 5335 } 5336 col = *destAddr 5337 cv = append(cv, col) 5338 5339 } 5340 *v = cv 5341 return nil 5342} 5343 5344func awsRestjson1_deserializeDocumentListOfAssetEntry(v *[]types.AssetEntry, value interface{}) error { 5345 if v == nil { 5346 return fmt.Errorf("unexpected nil of type %T", v) 5347 } 5348 if value == nil { 5349 return nil 5350 } 5351 5352 shape, ok := value.([]interface{}) 5353 if !ok { 5354 return fmt.Errorf("unexpected JSON type %v", value) 5355 } 5356 5357 var cv []types.AssetEntry 5358 if *v == nil { 5359 cv = []types.AssetEntry{} 5360 } else { 5361 cv = *v 5362 } 5363 5364 for _, value := range shape { 5365 var col types.AssetEntry 5366 destAddr := &col 5367 if err := awsRestjson1_deserializeDocumentAssetEntry(&destAddr, value); err != nil { 5368 return err 5369 } 5370 col = *destAddr 5371 cv = append(cv, col) 5372 5373 } 5374 *v = cv 5375 return nil 5376} 5377 5378func awsRestjson1_deserializeDocumentListOfAssetSourceEntry(v *[]types.AssetSourceEntry, value interface{}) error { 5379 if v == nil { 5380 return fmt.Errorf("unexpected nil of type %T", v) 5381 } 5382 if value == nil { 5383 return nil 5384 } 5385 5386 shape, ok := value.([]interface{}) 5387 if !ok { 5388 return fmt.Errorf("unexpected JSON type %v", value) 5389 } 5390 5391 var cv []types.AssetSourceEntry 5392 if *v == nil { 5393 cv = []types.AssetSourceEntry{} 5394 } else { 5395 cv = *v 5396 } 5397 5398 for _, value := range shape { 5399 var col types.AssetSourceEntry 5400 destAddr := &col 5401 if err := awsRestjson1_deserializeDocumentAssetSourceEntry(&destAddr, value); err != nil { 5402 return err 5403 } 5404 col = *destAddr 5405 cv = append(cv, col) 5406 5407 } 5408 *v = cv 5409 return nil 5410} 5411 5412func awsRestjson1_deserializeDocumentListOfDataSetEntry(v *[]types.DataSetEntry, value interface{}) error { 5413 if v == nil { 5414 return fmt.Errorf("unexpected nil of type %T", v) 5415 } 5416 if value == nil { 5417 return nil 5418 } 5419 5420 shape, ok := value.([]interface{}) 5421 if !ok { 5422 return fmt.Errorf("unexpected JSON type %v", value) 5423 } 5424 5425 var cv []types.DataSetEntry 5426 if *v == nil { 5427 cv = []types.DataSetEntry{} 5428 } else { 5429 cv = *v 5430 } 5431 5432 for _, value := range shape { 5433 var col types.DataSetEntry 5434 destAddr := &col 5435 if err := awsRestjson1_deserializeDocumentDataSetEntry(&destAddr, value); err != nil { 5436 return err 5437 } 5438 col = *destAddr 5439 cv = append(cv, col) 5440 5441 } 5442 *v = cv 5443 return nil 5444} 5445 5446func awsRestjson1_deserializeDocumentListOfJobEntry(v *[]types.JobEntry, value interface{}) error { 5447 if v == nil { 5448 return fmt.Errorf("unexpected nil of type %T", v) 5449 } 5450 if value == nil { 5451 return nil 5452 } 5453 5454 shape, ok := value.([]interface{}) 5455 if !ok { 5456 return fmt.Errorf("unexpected JSON type %v", value) 5457 } 5458 5459 var cv []types.JobEntry 5460 if *v == nil { 5461 cv = []types.JobEntry{} 5462 } else { 5463 cv = *v 5464 } 5465 5466 for _, value := range shape { 5467 var col types.JobEntry 5468 destAddr := &col 5469 if err := awsRestjson1_deserializeDocumentJobEntry(&destAddr, value); err != nil { 5470 return err 5471 } 5472 col = *destAddr 5473 cv = append(cv, col) 5474 5475 } 5476 *v = cv 5477 return nil 5478} 5479 5480func awsRestjson1_deserializeDocumentListOfJobError(v *[]types.JobError, value interface{}) error { 5481 if v == nil { 5482 return fmt.Errorf("unexpected nil of type %T", v) 5483 } 5484 if value == nil { 5485 return nil 5486 } 5487 5488 shape, ok := value.([]interface{}) 5489 if !ok { 5490 return fmt.Errorf("unexpected JSON type %v", value) 5491 } 5492 5493 var cv []types.JobError 5494 if *v == nil { 5495 cv = []types.JobError{} 5496 } else { 5497 cv = *v 5498 } 5499 5500 for _, value := range shape { 5501 var col types.JobError 5502 destAddr := &col 5503 if err := awsRestjson1_deserializeDocumentJobError(&destAddr, value); err != nil { 5504 return err 5505 } 5506 col = *destAddr 5507 cv = append(cv, col) 5508 5509 } 5510 *v = cv 5511 return nil 5512} 5513 5514func awsRestjson1_deserializeDocumentListOfRevisionEntry(v *[]types.RevisionEntry, value interface{}) error { 5515 if v == nil { 5516 return fmt.Errorf("unexpected nil of type %T", v) 5517 } 5518 if value == nil { 5519 return nil 5520 } 5521 5522 shape, ok := value.([]interface{}) 5523 if !ok { 5524 return fmt.Errorf("unexpected JSON type %v", value) 5525 } 5526 5527 var cv []types.RevisionEntry 5528 if *v == nil { 5529 cv = []types.RevisionEntry{} 5530 } else { 5531 cv = *v 5532 } 5533 5534 for _, value := range shape { 5535 var col types.RevisionEntry 5536 destAddr := &col 5537 if err := awsRestjson1_deserializeDocumentRevisionEntry(&destAddr, value); err != nil { 5538 return err 5539 } 5540 col = *destAddr 5541 cv = append(cv, col) 5542 5543 } 5544 *v = cv 5545 return nil 5546} 5547 5548func awsRestjson1_deserializeDocumentMapOf__string(v *map[string]string, value interface{}) error { 5549 if v == nil { 5550 return fmt.Errorf("unexpected nil of type %T", v) 5551 } 5552 if value == nil { 5553 return nil 5554 } 5555 5556 shape, ok := value.(map[string]interface{}) 5557 if !ok { 5558 return fmt.Errorf("unexpected JSON type %v", value) 5559 } 5560 5561 var mv map[string]string 5562 if *v == nil { 5563 mv = map[string]string{} 5564 } else { 5565 mv = *v 5566 } 5567 5568 for key, value := range shape { 5569 var parsedVal string 5570 if value != nil { 5571 jtv, ok := value.(string) 5572 if !ok { 5573 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5574 } 5575 parsedVal = jtv 5576 } 5577 mv[key] = parsedVal 5578 5579 } 5580 *v = mv 5581 return nil 5582} 5583 5584func awsRestjson1_deserializeDocumentOriginDetails(v **types.OriginDetails, value interface{}) error { 5585 if v == nil { 5586 return fmt.Errorf("unexpected nil of type %T", v) 5587 } 5588 if value == nil { 5589 return nil 5590 } 5591 5592 shape, ok := value.(map[string]interface{}) 5593 if !ok { 5594 return fmt.Errorf("unexpected JSON type %v", value) 5595 } 5596 5597 var sv *types.OriginDetails 5598 if *v == nil { 5599 sv = &types.OriginDetails{} 5600 } else { 5601 sv = *v 5602 } 5603 5604 for key, value := range shape { 5605 switch key { 5606 case "ProductId": 5607 if value != nil { 5608 jtv, ok := value.(string) 5609 if !ok { 5610 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5611 } 5612 sv.ProductId = ptr.String(jtv) 5613 } 5614 5615 default: 5616 _, _ = key, value 5617 5618 } 5619 } 5620 *v = sv 5621 return nil 5622} 5623 5624func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 5625 if v == nil { 5626 return fmt.Errorf("unexpected nil of type %T", v) 5627 } 5628 if value == nil { 5629 return nil 5630 } 5631 5632 shape, ok := value.(map[string]interface{}) 5633 if !ok { 5634 return fmt.Errorf("unexpected JSON type %v", value) 5635 } 5636 5637 var sv *types.ResourceNotFoundException 5638 if *v == nil { 5639 sv = &types.ResourceNotFoundException{} 5640 } else { 5641 sv = *v 5642 } 5643 5644 for key, value := range shape { 5645 switch key { 5646 case "Message": 5647 if value != nil { 5648 jtv, ok := value.(string) 5649 if !ok { 5650 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5651 } 5652 sv.Message = ptr.String(jtv) 5653 } 5654 5655 case "ResourceId": 5656 if value != nil { 5657 jtv, ok := value.(string) 5658 if !ok { 5659 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5660 } 5661 sv.ResourceId = ptr.String(jtv) 5662 } 5663 5664 case "ResourceType": 5665 if value != nil { 5666 jtv, ok := value.(string) 5667 if !ok { 5668 return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value) 5669 } 5670 sv.ResourceType = types.ResourceType(jtv) 5671 } 5672 5673 default: 5674 _, _ = key, value 5675 5676 } 5677 } 5678 *v = sv 5679 return nil 5680} 5681 5682func awsRestjson1_deserializeDocumentResponseDetails(v **types.ResponseDetails, value interface{}) error { 5683 if v == nil { 5684 return fmt.Errorf("unexpected nil of type %T", v) 5685 } 5686 if value == nil { 5687 return nil 5688 } 5689 5690 shape, ok := value.(map[string]interface{}) 5691 if !ok { 5692 return fmt.Errorf("unexpected JSON type %v", value) 5693 } 5694 5695 var sv *types.ResponseDetails 5696 if *v == nil { 5697 sv = &types.ResponseDetails{} 5698 } else { 5699 sv = *v 5700 } 5701 5702 for key, value := range shape { 5703 switch key { 5704 case "ExportAssetsToS3": 5705 if err := awsRestjson1_deserializeDocumentExportAssetsToS3ResponseDetails(&sv.ExportAssetsToS3, value); err != nil { 5706 return err 5707 } 5708 5709 case "ExportAssetToSignedUrl": 5710 if err := awsRestjson1_deserializeDocumentExportAssetToSignedUrlResponseDetails(&sv.ExportAssetToSignedUrl, value); err != nil { 5711 return err 5712 } 5713 5714 case "ImportAssetFromSignedUrl": 5715 if err := awsRestjson1_deserializeDocumentImportAssetFromSignedUrlResponseDetails(&sv.ImportAssetFromSignedUrl, value); err != nil { 5716 return err 5717 } 5718 5719 case "ImportAssetsFromS3": 5720 if err := awsRestjson1_deserializeDocumentImportAssetsFromS3ResponseDetails(&sv.ImportAssetsFromS3, value); err != nil { 5721 return err 5722 } 5723 5724 default: 5725 _, _ = key, value 5726 5727 } 5728 } 5729 *v = sv 5730 return nil 5731} 5732 5733func awsRestjson1_deserializeDocumentRevisionEntry(v **types.RevisionEntry, value interface{}) error { 5734 if v == nil { 5735 return fmt.Errorf("unexpected nil of type %T", v) 5736 } 5737 if value == nil { 5738 return nil 5739 } 5740 5741 shape, ok := value.(map[string]interface{}) 5742 if !ok { 5743 return fmt.Errorf("unexpected JSON type %v", value) 5744 } 5745 5746 var sv *types.RevisionEntry 5747 if *v == nil { 5748 sv = &types.RevisionEntry{} 5749 } else { 5750 sv = *v 5751 } 5752 5753 for key, value := range shape { 5754 switch key { 5755 case "Arn": 5756 if value != nil { 5757 jtv, ok := value.(string) 5758 if !ok { 5759 return fmt.Errorf("expected Arn to be of type string, got %T instead", value) 5760 } 5761 sv.Arn = ptr.String(jtv) 5762 } 5763 5764 case "Comment": 5765 if value != nil { 5766 jtv, ok := value.(string) 5767 if !ok { 5768 return fmt.Errorf("expected __stringMin0Max16384 to be of type string, got %T instead", value) 5769 } 5770 sv.Comment = ptr.String(jtv) 5771 } 5772 5773 case "CreatedAt": 5774 if value != nil { 5775 jtv, ok := value.(string) 5776 if !ok { 5777 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 5778 } 5779 t, err := smithytime.ParseDateTime(jtv) 5780 if err != nil { 5781 return err 5782 } 5783 sv.CreatedAt = ptr.Time(t) 5784 } 5785 5786 case "DataSetId": 5787 if value != nil { 5788 jtv, ok := value.(string) 5789 if !ok { 5790 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5791 } 5792 sv.DataSetId = ptr.String(jtv) 5793 } 5794 5795 case "Finalized": 5796 if value != nil { 5797 jtv, ok := value.(bool) 5798 if !ok { 5799 return fmt.Errorf("expected __boolean to be of type *bool, got %T instead", value) 5800 } 5801 sv.Finalized = jtv 5802 } 5803 5804 case "Id": 5805 if value != nil { 5806 jtv, ok := value.(string) 5807 if !ok { 5808 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5809 } 5810 sv.Id = ptr.String(jtv) 5811 } 5812 5813 case "SourceId": 5814 if value != nil { 5815 jtv, ok := value.(string) 5816 if !ok { 5817 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5818 } 5819 sv.SourceId = ptr.String(jtv) 5820 } 5821 5822 case "UpdatedAt": 5823 if value != nil { 5824 jtv, ok := value.(string) 5825 if !ok { 5826 return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) 5827 } 5828 t, err := smithytime.ParseDateTime(jtv) 5829 if err != nil { 5830 return err 5831 } 5832 sv.UpdatedAt = ptr.Time(t) 5833 } 5834 5835 default: 5836 _, _ = key, value 5837 5838 } 5839 } 5840 *v = sv 5841 return nil 5842} 5843 5844func awsRestjson1_deserializeDocumentS3SnapshotAsset(v **types.S3SnapshotAsset, value interface{}) error { 5845 if v == nil { 5846 return fmt.Errorf("unexpected nil of type %T", v) 5847 } 5848 if value == nil { 5849 return nil 5850 } 5851 5852 shape, ok := value.(map[string]interface{}) 5853 if !ok { 5854 return fmt.Errorf("unexpected JSON type %v", value) 5855 } 5856 5857 var sv *types.S3SnapshotAsset 5858 if *v == nil { 5859 sv = &types.S3SnapshotAsset{} 5860 } else { 5861 sv = *v 5862 } 5863 5864 for key, value := range shape { 5865 switch key { 5866 case "Size": 5867 if value != nil { 5868 jtv, ok := value.(json.Number) 5869 if !ok { 5870 return fmt.Errorf("expected __doubleMin0 to be json.Number, got %T instead", value) 5871 } 5872 f64, err := jtv.Float64() 5873 if err != nil { 5874 return err 5875 } 5876 sv.Size = f64 5877 } 5878 5879 default: 5880 _, _ = key, value 5881 5882 } 5883 } 5884 *v = sv 5885 return nil 5886} 5887 5888func awsRestjson1_deserializeDocumentServiceLimitExceededException(v **types.ServiceLimitExceededException, value interface{}) error { 5889 if v == nil { 5890 return fmt.Errorf("unexpected nil of type %T", v) 5891 } 5892 if value == nil { 5893 return nil 5894 } 5895 5896 shape, ok := value.(map[string]interface{}) 5897 if !ok { 5898 return fmt.Errorf("unexpected JSON type %v", value) 5899 } 5900 5901 var sv *types.ServiceLimitExceededException 5902 if *v == nil { 5903 sv = &types.ServiceLimitExceededException{} 5904 } else { 5905 sv = *v 5906 } 5907 5908 for key, value := range shape { 5909 switch key { 5910 case "LimitName": 5911 if value != nil { 5912 jtv, ok := value.(string) 5913 if !ok { 5914 return fmt.Errorf("expected LimitName to be of type string, got %T instead", value) 5915 } 5916 sv.LimitName = types.LimitName(jtv) 5917 } 5918 5919 case "LimitValue": 5920 if value != nil { 5921 jtv, ok := value.(json.Number) 5922 if !ok { 5923 return fmt.Errorf("expected __double to be json.Number, got %T instead", value) 5924 } 5925 f64, err := jtv.Float64() 5926 if err != nil { 5927 return err 5928 } 5929 sv.LimitValue = f64 5930 } 5931 5932 case "Message": 5933 if value != nil { 5934 jtv, ok := value.(string) 5935 if !ok { 5936 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5937 } 5938 sv.Message = ptr.String(jtv) 5939 } 5940 5941 default: 5942 _, _ = key, value 5943 5944 } 5945 } 5946 *v = sv 5947 return nil 5948} 5949 5950func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { 5951 if v == nil { 5952 return fmt.Errorf("unexpected nil of type %T", v) 5953 } 5954 if value == nil { 5955 return nil 5956 } 5957 5958 shape, ok := value.(map[string]interface{}) 5959 if !ok { 5960 return fmt.Errorf("unexpected JSON type %v", value) 5961 } 5962 5963 var sv *types.ThrottlingException 5964 if *v == nil { 5965 sv = &types.ThrottlingException{} 5966 } else { 5967 sv = *v 5968 } 5969 5970 for key, value := range shape { 5971 switch key { 5972 case "Message": 5973 if value != nil { 5974 jtv, ok := value.(string) 5975 if !ok { 5976 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 5977 } 5978 sv.Message = ptr.String(jtv) 5979 } 5980 5981 default: 5982 _, _ = key, value 5983 5984 } 5985 } 5986 *v = sv 5987 return nil 5988} 5989 5990func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { 5991 if v == nil { 5992 return fmt.Errorf("unexpected nil of type %T", v) 5993 } 5994 if value == nil { 5995 return nil 5996 } 5997 5998 shape, ok := value.(map[string]interface{}) 5999 if !ok { 6000 return fmt.Errorf("unexpected JSON type %v", value) 6001 } 6002 6003 var sv *types.ValidationException 6004 if *v == nil { 6005 sv = &types.ValidationException{} 6006 } else { 6007 sv = *v 6008 } 6009 6010 for key, value := range shape { 6011 switch key { 6012 case "Message": 6013 if value != nil { 6014 jtv, ok := value.(string) 6015 if !ok { 6016 return fmt.Errorf("expected __string to be of type string, got %T instead", value) 6017 } 6018 sv.Message = ptr.String(jtv) 6019 } 6020 6021 default: 6022 _, _ = key, value 6023 6024 } 6025 } 6026 *v = sv 6027 return nil 6028} 6029