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