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