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