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