1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package comprehend 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/comprehend/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_deserializeOpBatchDetectDominantLanguage struct { 24} 25 26func (*awsAwsjson11_deserializeOpBatchDetectDominantLanguage) ID() string { 27 return "OperationDeserializer" 28} 29 30func (m *awsAwsjson11_deserializeOpBatchDetectDominantLanguage) 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_deserializeOpErrorBatchDetectDominantLanguage(response, &metadata) 45 } 46 output := &BatchDetectDominantLanguageOutput{} 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_deserializeOpDocumentBatchDetectDominantLanguageOutput(&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_deserializeOpErrorBatchDetectDominantLanguage(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("BatchSizeLimitExceededException", errorCode): 122 return awsAwsjson11_deserializeErrorBatchSizeLimitExceededException(response, errorBody) 123 124 case strings.EqualFold("InternalServerException", errorCode): 125 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 126 127 case strings.EqualFold("InvalidRequestException", errorCode): 128 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 129 130 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 131 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(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_deserializeOpBatchDetectEntities struct { 144} 145 146func (*awsAwsjson11_deserializeOpBatchDetectEntities) ID() string { 147 return "OperationDeserializer" 148} 149 150func (m *awsAwsjson11_deserializeOpBatchDetectEntities) 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_deserializeOpErrorBatchDetectEntities(response, &metadata) 165 } 166 output := &BatchDetectEntitiesOutput{} 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_deserializeOpDocumentBatchDetectEntitiesOutput(&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_deserializeOpErrorBatchDetectEntities(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("BatchSizeLimitExceededException", errorCode): 242 return awsAwsjson11_deserializeErrorBatchSizeLimitExceededException(response, errorBody) 243 244 case strings.EqualFold("InternalServerException", errorCode): 245 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 246 247 case strings.EqualFold("InvalidRequestException", errorCode): 248 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 249 250 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 251 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 252 253 case strings.EqualFold("UnsupportedLanguageException", errorCode): 254 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 255 256 default: 257 genericError := &smithy.GenericAPIError{ 258 Code: errorCode, 259 Message: errorMessage, 260 } 261 return genericError 262 263 } 264} 265 266type awsAwsjson11_deserializeOpBatchDetectKeyPhrases struct { 267} 268 269func (*awsAwsjson11_deserializeOpBatchDetectKeyPhrases) ID() string { 270 return "OperationDeserializer" 271} 272 273func (m *awsAwsjson11_deserializeOpBatchDetectKeyPhrases) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 274 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 275) { 276 out, metadata, err = next.HandleDeserialize(ctx, in) 277 if err != nil { 278 return out, metadata, err 279 } 280 281 response, ok := out.RawResponse.(*smithyhttp.Response) 282 if !ok { 283 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 284 } 285 286 if response.StatusCode < 200 || response.StatusCode >= 300 { 287 return out, metadata, awsAwsjson11_deserializeOpErrorBatchDetectKeyPhrases(response, &metadata) 288 } 289 output := &BatchDetectKeyPhrasesOutput{} 290 out.Result = output 291 292 var buff [1024]byte 293 ringBuffer := smithyio.NewRingBuffer(buff[:]) 294 295 body := io.TeeReader(response.Body, ringBuffer) 296 decoder := json.NewDecoder(body) 297 decoder.UseNumber() 298 var shape interface{} 299 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 300 var snapshot bytes.Buffer 301 io.Copy(&snapshot, ringBuffer) 302 err = &smithy.DeserializationError{ 303 Err: fmt.Errorf("failed to decode response body, %w", err), 304 Snapshot: snapshot.Bytes(), 305 } 306 return out, metadata, err 307 } 308 309 err = awsAwsjson11_deserializeOpDocumentBatchDetectKeyPhrasesOutput(&output, shape) 310 if err != nil { 311 var snapshot bytes.Buffer 312 io.Copy(&snapshot, ringBuffer) 313 err = &smithy.DeserializationError{ 314 Err: fmt.Errorf("failed to decode response body, %w", err), 315 Snapshot: snapshot.Bytes(), 316 } 317 return out, metadata, err 318 } 319 320 return out, metadata, err 321} 322 323func awsAwsjson11_deserializeOpErrorBatchDetectKeyPhrases(response *smithyhttp.Response, metadata *middleware.Metadata) error { 324 var errorBuffer bytes.Buffer 325 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 326 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 327 } 328 errorBody := bytes.NewReader(errorBuffer.Bytes()) 329 330 errorCode := "UnknownError" 331 errorMessage := errorCode 332 333 code := response.Header.Get("X-Amzn-ErrorType") 334 if len(code) != 0 { 335 errorCode = restjson.SanitizeErrorCode(code) 336 } 337 338 var buff [1024]byte 339 ringBuffer := smithyio.NewRingBuffer(buff[:]) 340 341 body := io.TeeReader(errorBody, ringBuffer) 342 decoder := json.NewDecoder(body) 343 decoder.UseNumber() 344 code, message, err := restjson.GetErrorInfo(decoder) 345 if err != nil { 346 var snapshot bytes.Buffer 347 io.Copy(&snapshot, ringBuffer) 348 err = &smithy.DeserializationError{ 349 Err: fmt.Errorf("failed to decode response body, %w", err), 350 Snapshot: snapshot.Bytes(), 351 } 352 return err 353 } 354 355 errorBody.Seek(0, io.SeekStart) 356 if len(code) != 0 { 357 errorCode = restjson.SanitizeErrorCode(code) 358 } 359 if len(message) != 0 { 360 errorMessage = message 361 } 362 363 switch { 364 case strings.EqualFold("BatchSizeLimitExceededException", errorCode): 365 return awsAwsjson11_deserializeErrorBatchSizeLimitExceededException(response, errorBody) 366 367 case strings.EqualFold("InternalServerException", errorCode): 368 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 369 370 case strings.EqualFold("InvalidRequestException", errorCode): 371 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 372 373 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 374 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 375 376 case strings.EqualFold("UnsupportedLanguageException", errorCode): 377 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 378 379 default: 380 genericError := &smithy.GenericAPIError{ 381 Code: errorCode, 382 Message: errorMessage, 383 } 384 return genericError 385 386 } 387} 388 389type awsAwsjson11_deserializeOpBatchDetectSentiment struct { 390} 391 392func (*awsAwsjson11_deserializeOpBatchDetectSentiment) ID() string { 393 return "OperationDeserializer" 394} 395 396func (m *awsAwsjson11_deserializeOpBatchDetectSentiment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 397 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 398) { 399 out, metadata, err = next.HandleDeserialize(ctx, in) 400 if err != nil { 401 return out, metadata, err 402 } 403 404 response, ok := out.RawResponse.(*smithyhttp.Response) 405 if !ok { 406 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 407 } 408 409 if response.StatusCode < 200 || response.StatusCode >= 300 { 410 return out, metadata, awsAwsjson11_deserializeOpErrorBatchDetectSentiment(response, &metadata) 411 } 412 output := &BatchDetectSentimentOutput{} 413 out.Result = output 414 415 var buff [1024]byte 416 ringBuffer := smithyio.NewRingBuffer(buff[:]) 417 418 body := io.TeeReader(response.Body, ringBuffer) 419 decoder := json.NewDecoder(body) 420 decoder.UseNumber() 421 var shape interface{} 422 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 423 var snapshot bytes.Buffer 424 io.Copy(&snapshot, ringBuffer) 425 err = &smithy.DeserializationError{ 426 Err: fmt.Errorf("failed to decode response body, %w", err), 427 Snapshot: snapshot.Bytes(), 428 } 429 return out, metadata, err 430 } 431 432 err = awsAwsjson11_deserializeOpDocumentBatchDetectSentimentOutput(&output, shape) 433 if err != nil { 434 var snapshot bytes.Buffer 435 io.Copy(&snapshot, ringBuffer) 436 err = &smithy.DeserializationError{ 437 Err: fmt.Errorf("failed to decode response body, %w", err), 438 Snapshot: snapshot.Bytes(), 439 } 440 return out, metadata, err 441 } 442 443 return out, metadata, err 444} 445 446func awsAwsjson11_deserializeOpErrorBatchDetectSentiment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 447 var errorBuffer bytes.Buffer 448 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 449 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 450 } 451 errorBody := bytes.NewReader(errorBuffer.Bytes()) 452 453 errorCode := "UnknownError" 454 errorMessage := errorCode 455 456 code := response.Header.Get("X-Amzn-ErrorType") 457 if len(code) != 0 { 458 errorCode = restjson.SanitizeErrorCode(code) 459 } 460 461 var buff [1024]byte 462 ringBuffer := smithyio.NewRingBuffer(buff[:]) 463 464 body := io.TeeReader(errorBody, ringBuffer) 465 decoder := json.NewDecoder(body) 466 decoder.UseNumber() 467 code, message, err := restjson.GetErrorInfo(decoder) 468 if err != nil { 469 var snapshot bytes.Buffer 470 io.Copy(&snapshot, ringBuffer) 471 err = &smithy.DeserializationError{ 472 Err: fmt.Errorf("failed to decode response body, %w", err), 473 Snapshot: snapshot.Bytes(), 474 } 475 return err 476 } 477 478 errorBody.Seek(0, io.SeekStart) 479 if len(code) != 0 { 480 errorCode = restjson.SanitizeErrorCode(code) 481 } 482 if len(message) != 0 { 483 errorMessage = message 484 } 485 486 switch { 487 case strings.EqualFold("BatchSizeLimitExceededException", errorCode): 488 return awsAwsjson11_deserializeErrorBatchSizeLimitExceededException(response, errorBody) 489 490 case strings.EqualFold("InternalServerException", errorCode): 491 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 492 493 case strings.EqualFold("InvalidRequestException", errorCode): 494 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 495 496 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 497 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 498 499 case strings.EqualFold("UnsupportedLanguageException", errorCode): 500 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 501 502 default: 503 genericError := &smithy.GenericAPIError{ 504 Code: errorCode, 505 Message: errorMessage, 506 } 507 return genericError 508 509 } 510} 511 512type awsAwsjson11_deserializeOpBatchDetectSyntax struct { 513} 514 515func (*awsAwsjson11_deserializeOpBatchDetectSyntax) ID() string { 516 return "OperationDeserializer" 517} 518 519func (m *awsAwsjson11_deserializeOpBatchDetectSyntax) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 520 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 521) { 522 out, metadata, err = next.HandleDeserialize(ctx, in) 523 if err != nil { 524 return out, metadata, err 525 } 526 527 response, ok := out.RawResponse.(*smithyhttp.Response) 528 if !ok { 529 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 530 } 531 532 if response.StatusCode < 200 || response.StatusCode >= 300 { 533 return out, metadata, awsAwsjson11_deserializeOpErrorBatchDetectSyntax(response, &metadata) 534 } 535 output := &BatchDetectSyntaxOutput{} 536 out.Result = output 537 538 var buff [1024]byte 539 ringBuffer := smithyio.NewRingBuffer(buff[:]) 540 541 body := io.TeeReader(response.Body, ringBuffer) 542 decoder := json.NewDecoder(body) 543 decoder.UseNumber() 544 var shape interface{} 545 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 546 var snapshot bytes.Buffer 547 io.Copy(&snapshot, ringBuffer) 548 err = &smithy.DeserializationError{ 549 Err: fmt.Errorf("failed to decode response body, %w", err), 550 Snapshot: snapshot.Bytes(), 551 } 552 return out, metadata, err 553 } 554 555 err = awsAwsjson11_deserializeOpDocumentBatchDetectSyntaxOutput(&output, shape) 556 if err != nil { 557 var snapshot bytes.Buffer 558 io.Copy(&snapshot, ringBuffer) 559 err = &smithy.DeserializationError{ 560 Err: fmt.Errorf("failed to decode response body, %w", err), 561 Snapshot: snapshot.Bytes(), 562 } 563 return out, metadata, err 564 } 565 566 return out, metadata, err 567} 568 569func awsAwsjson11_deserializeOpErrorBatchDetectSyntax(response *smithyhttp.Response, metadata *middleware.Metadata) error { 570 var errorBuffer bytes.Buffer 571 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 572 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 573 } 574 errorBody := bytes.NewReader(errorBuffer.Bytes()) 575 576 errorCode := "UnknownError" 577 errorMessage := errorCode 578 579 code := response.Header.Get("X-Amzn-ErrorType") 580 if len(code) != 0 { 581 errorCode = restjson.SanitizeErrorCode(code) 582 } 583 584 var buff [1024]byte 585 ringBuffer := smithyio.NewRingBuffer(buff[:]) 586 587 body := io.TeeReader(errorBody, ringBuffer) 588 decoder := json.NewDecoder(body) 589 decoder.UseNumber() 590 code, message, err := restjson.GetErrorInfo(decoder) 591 if err != nil { 592 var snapshot bytes.Buffer 593 io.Copy(&snapshot, ringBuffer) 594 err = &smithy.DeserializationError{ 595 Err: fmt.Errorf("failed to decode response body, %w", err), 596 Snapshot: snapshot.Bytes(), 597 } 598 return err 599 } 600 601 errorBody.Seek(0, io.SeekStart) 602 if len(code) != 0 { 603 errorCode = restjson.SanitizeErrorCode(code) 604 } 605 if len(message) != 0 { 606 errorMessage = message 607 } 608 609 switch { 610 case strings.EqualFold("BatchSizeLimitExceededException", errorCode): 611 return awsAwsjson11_deserializeErrorBatchSizeLimitExceededException(response, errorBody) 612 613 case strings.EqualFold("InternalServerException", errorCode): 614 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 615 616 case strings.EqualFold("InvalidRequestException", errorCode): 617 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 618 619 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 620 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 621 622 case strings.EqualFold("UnsupportedLanguageException", errorCode): 623 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 624 625 default: 626 genericError := &smithy.GenericAPIError{ 627 Code: errorCode, 628 Message: errorMessage, 629 } 630 return genericError 631 632 } 633} 634 635type awsAwsjson11_deserializeOpClassifyDocument struct { 636} 637 638func (*awsAwsjson11_deserializeOpClassifyDocument) ID() string { 639 return "OperationDeserializer" 640} 641 642func (m *awsAwsjson11_deserializeOpClassifyDocument) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 643 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 644) { 645 out, metadata, err = next.HandleDeserialize(ctx, in) 646 if err != nil { 647 return out, metadata, err 648 } 649 650 response, ok := out.RawResponse.(*smithyhttp.Response) 651 if !ok { 652 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 653 } 654 655 if response.StatusCode < 200 || response.StatusCode >= 300 { 656 return out, metadata, awsAwsjson11_deserializeOpErrorClassifyDocument(response, &metadata) 657 } 658 output := &ClassifyDocumentOutput{} 659 out.Result = output 660 661 var buff [1024]byte 662 ringBuffer := smithyio.NewRingBuffer(buff[:]) 663 664 body := io.TeeReader(response.Body, ringBuffer) 665 decoder := json.NewDecoder(body) 666 decoder.UseNumber() 667 var shape interface{} 668 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 669 var snapshot bytes.Buffer 670 io.Copy(&snapshot, ringBuffer) 671 err = &smithy.DeserializationError{ 672 Err: fmt.Errorf("failed to decode response body, %w", err), 673 Snapshot: snapshot.Bytes(), 674 } 675 return out, metadata, err 676 } 677 678 err = awsAwsjson11_deserializeOpDocumentClassifyDocumentOutput(&output, shape) 679 if err != nil { 680 var snapshot bytes.Buffer 681 io.Copy(&snapshot, ringBuffer) 682 err = &smithy.DeserializationError{ 683 Err: fmt.Errorf("failed to decode response body, %w", err), 684 Snapshot: snapshot.Bytes(), 685 } 686 return out, metadata, err 687 } 688 689 return out, metadata, err 690} 691 692func awsAwsjson11_deserializeOpErrorClassifyDocument(response *smithyhttp.Response, metadata *middleware.Metadata) error { 693 var errorBuffer bytes.Buffer 694 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 695 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 696 } 697 errorBody := bytes.NewReader(errorBuffer.Bytes()) 698 699 errorCode := "UnknownError" 700 errorMessage := errorCode 701 702 code := response.Header.Get("X-Amzn-ErrorType") 703 if len(code) != 0 { 704 errorCode = restjson.SanitizeErrorCode(code) 705 } 706 707 var buff [1024]byte 708 ringBuffer := smithyio.NewRingBuffer(buff[:]) 709 710 body := io.TeeReader(errorBody, ringBuffer) 711 decoder := json.NewDecoder(body) 712 decoder.UseNumber() 713 code, message, err := restjson.GetErrorInfo(decoder) 714 if err != nil { 715 var snapshot bytes.Buffer 716 io.Copy(&snapshot, ringBuffer) 717 err = &smithy.DeserializationError{ 718 Err: fmt.Errorf("failed to decode response body, %w", err), 719 Snapshot: snapshot.Bytes(), 720 } 721 return err 722 } 723 724 errorBody.Seek(0, io.SeekStart) 725 if len(code) != 0 { 726 errorCode = restjson.SanitizeErrorCode(code) 727 } 728 if len(message) != 0 { 729 errorMessage = message 730 } 731 732 switch { 733 case strings.EqualFold("InternalServerException", errorCode): 734 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 735 736 case strings.EqualFold("InvalidRequestException", errorCode): 737 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 738 739 case strings.EqualFold("ResourceUnavailableException", errorCode): 740 return awsAwsjson11_deserializeErrorResourceUnavailableException(response, errorBody) 741 742 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 743 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(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_deserializeOpContainsPiiEntities struct { 756} 757 758func (*awsAwsjson11_deserializeOpContainsPiiEntities) ID() string { 759 return "OperationDeserializer" 760} 761 762func (m *awsAwsjson11_deserializeOpContainsPiiEntities) 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_deserializeOpErrorContainsPiiEntities(response, &metadata) 777 } 778 output := &ContainsPiiEntitiesOutput{} 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_deserializeOpDocumentContainsPiiEntitiesOutput(&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_deserializeOpErrorContainsPiiEntities(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("InvalidRequestException", errorCode): 857 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 858 859 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 860 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 861 862 case strings.EqualFold("UnsupportedLanguageException", errorCode): 863 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 864 865 default: 866 genericError := &smithy.GenericAPIError{ 867 Code: errorCode, 868 Message: errorMessage, 869 } 870 return genericError 871 872 } 873} 874 875type awsAwsjson11_deserializeOpCreateDocumentClassifier struct { 876} 877 878func (*awsAwsjson11_deserializeOpCreateDocumentClassifier) ID() string { 879 return "OperationDeserializer" 880} 881 882func (m *awsAwsjson11_deserializeOpCreateDocumentClassifier) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 883 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 884) { 885 out, metadata, err = next.HandleDeserialize(ctx, in) 886 if err != nil { 887 return out, metadata, err 888 } 889 890 response, ok := out.RawResponse.(*smithyhttp.Response) 891 if !ok { 892 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 893 } 894 895 if response.StatusCode < 200 || response.StatusCode >= 300 { 896 return out, metadata, awsAwsjson11_deserializeOpErrorCreateDocumentClassifier(response, &metadata) 897 } 898 output := &CreateDocumentClassifierOutput{} 899 out.Result = output 900 901 var buff [1024]byte 902 ringBuffer := smithyio.NewRingBuffer(buff[:]) 903 904 body := io.TeeReader(response.Body, ringBuffer) 905 decoder := json.NewDecoder(body) 906 decoder.UseNumber() 907 var shape interface{} 908 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 909 var snapshot bytes.Buffer 910 io.Copy(&snapshot, ringBuffer) 911 err = &smithy.DeserializationError{ 912 Err: fmt.Errorf("failed to decode response body, %w", err), 913 Snapshot: snapshot.Bytes(), 914 } 915 return out, metadata, err 916 } 917 918 err = awsAwsjson11_deserializeOpDocumentCreateDocumentClassifierOutput(&output, shape) 919 if err != nil { 920 var snapshot bytes.Buffer 921 io.Copy(&snapshot, ringBuffer) 922 err = &smithy.DeserializationError{ 923 Err: fmt.Errorf("failed to decode response body, %w", err), 924 Snapshot: snapshot.Bytes(), 925 } 926 return out, metadata, err 927 } 928 929 return out, metadata, err 930} 931 932func awsAwsjson11_deserializeOpErrorCreateDocumentClassifier(response *smithyhttp.Response, metadata *middleware.Metadata) error { 933 var errorBuffer bytes.Buffer 934 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 935 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 936 } 937 errorBody := bytes.NewReader(errorBuffer.Bytes()) 938 939 errorCode := "UnknownError" 940 errorMessage := errorCode 941 942 code := response.Header.Get("X-Amzn-ErrorType") 943 if len(code) != 0 { 944 errorCode = restjson.SanitizeErrorCode(code) 945 } 946 947 var buff [1024]byte 948 ringBuffer := smithyio.NewRingBuffer(buff[:]) 949 950 body := io.TeeReader(errorBody, ringBuffer) 951 decoder := json.NewDecoder(body) 952 decoder.UseNumber() 953 code, message, err := restjson.GetErrorInfo(decoder) 954 if err != nil { 955 var snapshot bytes.Buffer 956 io.Copy(&snapshot, ringBuffer) 957 err = &smithy.DeserializationError{ 958 Err: fmt.Errorf("failed to decode response body, %w", err), 959 Snapshot: snapshot.Bytes(), 960 } 961 return err 962 } 963 964 errorBody.Seek(0, io.SeekStart) 965 if len(code) != 0 { 966 errorCode = restjson.SanitizeErrorCode(code) 967 } 968 if len(message) != 0 { 969 errorMessage = message 970 } 971 972 switch { 973 case strings.EqualFold("InternalServerException", errorCode): 974 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 975 976 case strings.EqualFold("InvalidRequestException", errorCode): 977 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 978 979 case strings.EqualFold("KmsKeyValidationException", errorCode): 980 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 981 982 case strings.EqualFold("ResourceInUseException", errorCode): 983 return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) 984 985 case strings.EqualFold("ResourceLimitExceededException", errorCode): 986 return awsAwsjson11_deserializeErrorResourceLimitExceededException(response, errorBody) 987 988 case strings.EqualFold("TooManyRequestsException", errorCode): 989 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 990 991 case strings.EqualFold("TooManyTagsException", errorCode): 992 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 993 994 case strings.EqualFold("UnsupportedLanguageException", errorCode): 995 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(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_deserializeOpCreateEndpoint struct { 1008} 1009 1010func (*awsAwsjson11_deserializeOpCreateEndpoint) ID() string { 1011 return "OperationDeserializer" 1012} 1013 1014func (m *awsAwsjson11_deserializeOpCreateEndpoint) 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_deserializeOpErrorCreateEndpoint(response, &metadata) 1029 } 1030 output := &CreateEndpointOutput{} 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_deserializeOpDocumentCreateEndpointOutput(&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_deserializeOpErrorCreateEndpoint(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("InvalidRequestException", errorCode): 1109 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 1110 1111 case strings.EqualFold("ResourceInUseException", errorCode): 1112 return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) 1113 1114 case strings.EqualFold("ResourceLimitExceededException", errorCode): 1115 return awsAwsjson11_deserializeErrorResourceLimitExceededException(response, errorBody) 1116 1117 case strings.EqualFold("ResourceNotFoundException", errorCode): 1118 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 1119 1120 case strings.EqualFold("ResourceUnavailableException", errorCode): 1121 return awsAwsjson11_deserializeErrorResourceUnavailableException(response, errorBody) 1122 1123 case strings.EqualFold("TooManyRequestsException", errorCode): 1124 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 1125 1126 case strings.EqualFold("TooManyTagsException", errorCode): 1127 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 1128 1129 default: 1130 genericError := &smithy.GenericAPIError{ 1131 Code: errorCode, 1132 Message: errorMessage, 1133 } 1134 return genericError 1135 1136 } 1137} 1138 1139type awsAwsjson11_deserializeOpCreateEntityRecognizer struct { 1140} 1141 1142func (*awsAwsjson11_deserializeOpCreateEntityRecognizer) ID() string { 1143 return "OperationDeserializer" 1144} 1145 1146func (m *awsAwsjson11_deserializeOpCreateEntityRecognizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1147 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1148) { 1149 out, metadata, err = next.HandleDeserialize(ctx, in) 1150 if err != nil { 1151 return out, metadata, err 1152 } 1153 1154 response, ok := out.RawResponse.(*smithyhttp.Response) 1155 if !ok { 1156 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1157 } 1158 1159 if response.StatusCode < 200 || response.StatusCode >= 300 { 1160 return out, metadata, awsAwsjson11_deserializeOpErrorCreateEntityRecognizer(response, &metadata) 1161 } 1162 output := &CreateEntityRecognizerOutput{} 1163 out.Result = output 1164 1165 var buff [1024]byte 1166 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1167 1168 body := io.TeeReader(response.Body, ringBuffer) 1169 decoder := json.NewDecoder(body) 1170 decoder.UseNumber() 1171 var shape interface{} 1172 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1173 var snapshot bytes.Buffer 1174 io.Copy(&snapshot, ringBuffer) 1175 err = &smithy.DeserializationError{ 1176 Err: fmt.Errorf("failed to decode response body, %w", err), 1177 Snapshot: snapshot.Bytes(), 1178 } 1179 return out, metadata, err 1180 } 1181 1182 err = awsAwsjson11_deserializeOpDocumentCreateEntityRecognizerOutput(&output, shape) 1183 if err != nil { 1184 var snapshot bytes.Buffer 1185 io.Copy(&snapshot, ringBuffer) 1186 err = &smithy.DeserializationError{ 1187 Err: fmt.Errorf("failed to decode response body, %w", err), 1188 Snapshot: snapshot.Bytes(), 1189 } 1190 return out, metadata, err 1191 } 1192 1193 return out, metadata, err 1194} 1195 1196func awsAwsjson11_deserializeOpErrorCreateEntityRecognizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1197 var errorBuffer bytes.Buffer 1198 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1199 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1200 } 1201 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1202 1203 errorCode := "UnknownError" 1204 errorMessage := errorCode 1205 1206 code := response.Header.Get("X-Amzn-ErrorType") 1207 if len(code) != 0 { 1208 errorCode = restjson.SanitizeErrorCode(code) 1209 } 1210 1211 var buff [1024]byte 1212 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1213 1214 body := io.TeeReader(errorBody, ringBuffer) 1215 decoder := json.NewDecoder(body) 1216 decoder.UseNumber() 1217 code, message, err := restjson.GetErrorInfo(decoder) 1218 if err != nil { 1219 var snapshot bytes.Buffer 1220 io.Copy(&snapshot, ringBuffer) 1221 err = &smithy.DeserializationError{ 1222 Err: fmt.Errorf("failed to decode response body, %w", err), 1223 Snapshot: snapshot.Bytes(), 1224 } 1225 return err 1226 } 1227 1228 errorBody.Seek(0, io.SeekStart) 1229 if len(code) != 0 { 1230 errorCode = restjson.SanitizeErrorCode(code) 1231 } 1232 if len(message) != 0 { 1233 errorMessage = message 1234 } 1235 1236 switch { 1237 case strings.EqualFold("InternalServerException", errorCode): 1238 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 1239 1240 case strings.EqualFold("InvalidRequestException", errorCode): 1241 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 1242 1243 case strings.EqualFold("KmsKeyValidationException", errorCode): 1244 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 1245 1246 case strings.EqualFold("ResourceInUseException", errorCode): 1247 return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) 1248 1249 case strings.EqualFold("ResourceLimitExceededException", errorCode): 1250 return awsAwsjson11_deserializeErrorResourceLimitExceededException(response, errorBody) 1251 1252 case strings.EqualFold("TooManyRequestsException", errorCode): 1253 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 1254 1255 case strings.EqualFold("TooManyTagsException", errorCode): 1256 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 1257 1258 case strings.EqualFold("UnsupportedLanguageException", errorCode): 1259 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 1260 1261 default: 1262 genericError := &smithy.GenericAPIError{ 1263 Code: errorCode, 1264 Message: errorMessage, 1265 } 1266 return genericError 1267 1268 } 1269} 1270 1271type awsAwsjson11_deserializeOpDeleteDocumentClassifier struct { 1272} 1273 1274func (*awsAwsjson11_deserializeOpDeleteDocumentClassifier) ID() string { 1275 return "OperationDeserializer" 1276} 1277 1278func (m *awsAwsjson11_deserializeOpDeleteDocumentClassifier) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1279 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1280) { 1281 out, metadata, err = next.HandleDeserialize(ctx, in) 1282 if err != nil { 1283 return out, metadata, err 1284 } 1285 1286 response, ok := out.RawResponse.(*smithyhttp.Response) 1287 if !ok { 1288 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1289 } 1290 1291 if response.StatusCode < 200 || response.StatusCode >= 300 { 1292 return out, metadata, awsAwsjson11_deserializeOpErrorDeleteDocumentClassifier(response, &metadata) 1293 } 1294 output := &DeleteDocumentClassifierOutput{} 1295 out.Result = output 1296 1297 var buff [1024]byte 1298 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1299 1300 body := io.TeeReader(response.Body, ringBuffer) 1301 decoder := json.NewDecoder(body) 1302 decoder.UseNumber() 1303 var shape interface{} 1304 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1305 var snapshot bytes.Buffer 1306 io.Copy(&snapshot, ringBuffer) 1307 err = &smithy.DeserializationError{ 1308 Err: fmt.Errorf("failed to decode response body, %w", err), 1309 Snapshot: snapshot.Bytes(), 1310 } 1311 return out, metadata, err 1312 } 1313 1314 err = awsAwsjson11_deserializeOpDocumentDeleteDocumentClassifierOutput(&output, shape) 1315 if err != nil { 1316 var snapshot bytes.Buffer 1317 io.Copy(&snapshot, ringBuffer) 1318 err = &smithy.DeserializationError{ 1319 Err: fmt.Errorf("failed to decode response body, %w", err), 1320 Snapshot: snapshot.Bytes(), 1321 } 1322 return out, metadata, err 1323 } 1324 1325 return out, metadata, err 1326} 1327 1328func awsAwsjson11_deserializeOpErrorDeleteDocumentClassifier(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1329 var errorBuffer bytes.Buffer 1330 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1331 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1332 } 1333 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1334 1335 errorCode := "UnknownError" 1336 errorMessage := errorCode 1337 1338 code := response.Header.Get("X-Amzn-ErrorType") 1339 if len(code) != 0 { 1340 errorCode = restjson.SanitizeErrorCode(code) 1341 } 1342 1343 var buff [1024]byte 1344 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1345 1346 body := io.TeeReader(errorBody, ringBuffer) 1347 decoder := json.NewDecoder(body) 1348 decoder.UseNumber() 1349 code, message, err := restjson.GetErrorInfo(decoder) 1350 if err != nil { 1351 var snapshot bytes.Buffer 1352 io.Copy(&snapshot, ringBuffer) 1353 err = &smithy.DeserializationError{ 1354 Err: fmt.Errorf("failed to decode response body, %w", err), 1355 Snapshot: snapshot.Bytes(), 1356 } 1357 return err 1358 } 1359 1360 errorBody.Seek(0, io.SeekStart) 1361 if len(code) != 0 { 1362 errorCode = restjson.SanitizeErrorCode(code) 1363 } 1364 if len(message) != 0 { 1365 errorMessage = message 1366 } 1367 1368 switch { 1369 case strings.EqualFold("InternalServerException", errorCode): 1370 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 1371 1372 case strings.EqualFold("InvalidRequestException", errorCode): 1373 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 1374 1375 case strings.EqualFold("ResourceInUseException", errorCode): 1376 return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) 1377 1378 case strings.EqualFold("ResourceNotFoundException", errorCode): 1379 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 1380 1381 case strings.EqualFold("ResourceUnavailableException", errorCode): 1382 return awsAwsjson11_deserializeErrorResourceUnavailableException(response, errorBody) 1383 1384 case strings.EqualFold("TooManyRequestsException", errorCode): 1385 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 1386 1387 default: 1388 genericError := &smithy.GenericAPIError{ 1389 Code: errorCode, 1390 Message: errorMessage, 1391 } 1392 return genericError 1393 1394 } 1395} 1396 1397type awsAwsjson11_deserializeOpDeleteEndpoint struct { 1398} 1399 1400func (*awsAwsjson11_deserializeOpDeleteEndpoint) ID() string { 1401 return "OperationDeserializer" 1402} 1403 1404func (m *awsAwsjson11_deserializeOpDeleteEndpoint) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1405 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1406) { 1407 out, metadata, err = next.HandleDeserialize(ctx, in) 1408 if err != nil { 1409 return out, metadata, err 1410 } 1411 1412 response, ok := out.RawResponse.(*smithyhttp.Response) 1413 if !ok { 1414 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1415 } 1416 1417 if response.StatusCode < 200 || response.StatusCode >= 300 { 1418 return out, metadata, awsAwsjson11_deserializeOpErrorDeleteEndpoint(response, &metadata) 1419 } 1420 output := &DeleteEndpointOutput{} 1421 out.Result = output 1422 1423 var buff [1024]byte 1424 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1425 1426 body := io.TeeReader(response.Body, ringBuffer) 1427 decoder := json.NewDecoder(body) 1428 decoder.UseNumber() 1429 var shape interface{} 1430 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1431 var snapshot bytes.Buffer 1432 io.Copy(&snapshot, ringBuffer) 1433 err = &smithy.DeserializationError{ 1434 Err: fmt.Errorf("failed to decode response body, %w", err), 1435 Snapshot: snapshot.Bytes(), 1436 } 1437 return out, metadata, err 1438 } 1439 1440 err = awsAwsjson11_deserializeOpDocumentDeleteEndpointOutput(&output, shape) 1441 if err != nil { 1442 var snapshot bytes.Buffer 1443 io.Copy(&snapshot, ringBuffer) 1444 err = &smithy.DeserializationError{ 1445 Err: fmt.Errorf("failed to decode response body, %w", err), 1446 Snapshot: snapshot.Bytes(), 1447 } 1448 return out, metadata, err 1449 } 1450 1451 return out, metadata, err 1452} 1453 1454func awsAwsjson11_deserializeOpErrorDeleteEndpoint(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1455 var errorBuffer bytes.Buffer 1456 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1457 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1458 } 1459 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1460 1461 errorCode := "UnknownError" 1462 errorMessage := errorCode 1463 1464 code := response.Header.Get("X-Amzn-ErrorType") 1465 if len(code) != 0 { 1466 errorCode = restjson.SanitizeErrorCode(code) 1467 } 1468 1469 var buff [1024]byte 1470 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1471 1472 body := io.TeeReader(errorBody, ringBuffer) 1473 decoder := json.NewDecoder(body) 1474 decoder.UseNumber() 1475 code, message, err := restjson.GetErrorInfo(decoder) 1476 if err != nil { 1477 var snapshot bytes.Buffer 1478 io.Copy(&snapshot, ringBuffer) 1479 err = &smithy.DeserializationError{ 1480 Err: fmt.Errorf("failed to decode response body, %w", err), 1481 Snapshot: snapshot.Bytes(), 1482 } 1483 return err 1484 } 1485 1486 errorBody.Seek(0, io.SeekStart) 1487 if len(code) != 0 { 1488 errorCode = restjson.SanitizeErrorCode(code) 1489 } 1490 if len(message) != 0 { 1491 errorMessage = message 1492 } 1493 1494 switch { 1495 case strings.EqualFold("InternalServerException", errorCode): 1496 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 1497 1498 case strings.EqualFold("InvalidRequestException", errorCode): 1499 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 1500 1501 case strings.EqualFold("ResourceInUseException", errorCode): 1502 return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) 1503 1504 case strings.EqualFold("ResourceNotFoundException", errorCode): 1505 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 1506 1507 case strings.EqualFold("TooManyRequestsException", errorCode): 1508 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 1509 1510 default: 1511 genericError := &smithy.GenericAPIError{ 1512 Code: errorCode, 1513 Message: errorMessage, 1514 } 1515 return genericError 1516 1517 } 1518} 1519 1520type awsAwsjson11_deserializeOpDeleteEntityRecognizer struct { 1521} 1522 1523func (*awsAwsjson11_deserializeOpDeleteEntityRecognizer) ID() string { 1524 return "OperationDeserializer" 1525} 1526 1527func (m *awsAwsjson11_deserializeOpDeleteEntityRecognizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1528 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1529) { 1530 out, metadata, err = next.HandleDeserialize(ctx, in) 1531 if err != nil { 1532 return out, metadata, err 1533 } 1534 1535 response, ok := out.RawResponse.(*smithyhttp.Response) 1536 if !ok { 1537 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1538 } 1539 1540 if response.StatusCode < 200 || response.StatusCode >= 300 { 1541 return out, metadata, awsAwsjson11_deserializeOpErrorDeleteEntityRecognizer(response, &metadata) 1542 } 1543 output := &DeleteEntityRecognizerOutput{} 1544 out.Result = output 1545 1546 var buff [1024]byte 1547 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1548 1549 body := io.TeeReader(response.Body, ringBuffer) 1550 decoder := json.NewDecoder(body) 1551 decoder.UseNumber() 1552 var shape interface{} 1553 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1554 var snapshot bytes.Buffer 1555 io.Copy(&snapshot, ringBuffer) 1556 err = &smithy.DeserializationError{ 1557 Err: fmt.Errorf("failed to decode response body, %w", err), 1558 Snapshot: snapshot.Bytes(), 1559 } 1560 return out, metadata, err 1561 } 1562 1563 err = awsAwsjson11_deserializeOpDocumentDeleteEntityRecognizerOutput(&output, shape) 1564 if err != nil { 1565 var snapshot bytes.Buffer 1566 io.Copy(&snapshot, ringBuffer) 1567 err = &smithy.DeserializationError{ 1568 Err: fmt.Errorf("failed to decode response body, %w", err), 1569 Snapshot: snapshot.Bytes(), 1570 } 1571 return out, metadata, err 1572 } 1573 1574 return out, metadata, err 1575} 1576 1577func awsAwsjson11_deserializeOpErrorDeleteEntityRecognizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1578 var errorBuffer bytes.Buffer 1579 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1580 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1581 } 1582 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1583 1584 errorCode := "UnknownError" 1585 errorMessage := errorCode 1586 1587 code := response.Header.Get("X-Amzn-ErrorType") 1588 if len(code) != 0 { 1589 errorCode = restjson.SanitizeErrorCode(code) 1590 } 1591 1592 var buff [1024]byte 1593 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1594 1595 body := io.TeeReader(errorBody, ringBuffer) 1596 decoder := json.NewDecoder(body) 1597 decoder.UseNumber() 1598 code, message, err := restjson.GetErrorInfo(decoder) 1599 if err != nil { 1600 var snapshot bytes.Buffer 1601 io.Copy(&snapshot, ringBuffer) 1602 err = &smithy.DeserializationError{ 1603 Err: fmt.Errorf("failed to decode response body, %w", err), 1604 Snapshot: snapshot.Bytes(), 1605 } 1606 return err 1607 } 1608 1609 errorBody.Seek(0, io.SeekStart) 1610 if len(code) != 0 { 1611 errorCode = restjson.SanitizeErrorCode(code) 1612 } 1613 if len(message) != 0 { 1614 errorMessage = message 1615 } 1616 1617 switch { 1618 case strings.EqualFold("InternalServerException", errorCode): 1619 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 1620 1621 case strings.EqualFold("InvalidRequestException", errorCode): 1622 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 1623 1624 case strings.EqualFold("ResourceInUseException", errorCode): 1625 return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) 1626 1627 case strings.EqualFold("ResourceNotFoundException", errorCode): 1628 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 1629 1630 case strings.EqualFold("ResourceUnavailableException", errorCode): 1631 return awsAwsjson11_deserializeErrorResourceUnavailableException(response, errorBody) 1632 1633 case strings.EqualFold("TooManyRequestsException", errorCode): 1634 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 1635 1636 default: 1637 genericError := &smithy.GenericAPIError{ 1638 Code: errorCode, 1639 Message: errorMessage, 1640 } 1641 return genericError 1642 1643 } 1644} 1645 1646type awsAwsjson11_deserializeOpDescribeDocumentClassificationJob struct { 1647} 1648 1649func (*awsAwsjson11_deserializeOpDescribeDocumentClassificationJob) ID() string { 1650 return "OperationDeserializer" 1651} 1652 1653func (m *awsAwsjson11_deserializeOpDescribeDocumentClassificationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1654 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1655) { 1656 out, metadata, err = next.HandleDeserialize(ctx, in) 1657 if err != nil { 1658 return out, metadata, err 1659 } 1660 1661 response, ok := out.RawResponse.(*smithyhttp.Response) 1662 if !ok { 1663 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1664 } 1665 1666 if response.StatusCode < 200 || response.StatusCode >= 300 { 1667 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeDocumentClassificationJob(response, &metadata) 1668 } 1669 output := &DescribeDocumentClassificationJobOutput{} 1670 out.Result = output 1671 1672 var buff [1024]byte 1673 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1674 1675 body := io.TeeReader(response.Body, ringBuffer) 1676 decoder := json.NewDecoder(body) 1677 decoder.UseNumber() 1678 var shape interface{} 1679 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1680 var snapshot bytes.Buffer 1681 io.Copy(&snapshot, ringBuffer) 1682 err = &smithy.DeserializationError{ 1683 Err: fmt.Errorf("failed to decode response body, %w", err), 1684 Snapshot: snapshot.Bytes(), 1685 } 1686 return out, metadata, err 1687 } 1688 1689 err = awsAwsjson11_deserializeOpDocumentDescribeDocumentClassificationJobOutput(&output, shape) 1690 if err != nil { 1691 var snapshot bytes.Buffer 1692 io.Copy(&snapshot, ringBuffer) 1693 err = &smithy.DeserializationError{ 1694 Err: fmt.Errorf("failed to decode response body, %w", err), 1695 Snapshot: snapshot.Bytes(), 1696 } 1697 return out, metadata, err 1698 } 1699 1700 return out, metadata, err 1701} 1702 1703func awsAwsjson11_deserializeOpErrorDescribeDocumentClassificationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1704 var errorBuffer bytes.Buffer 1705 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1706 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1707 } 1708 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1709 1710 errorCode := "UnknownError" 1711 errorMessage := errorCode 1712 1713 code := response.Header.Get("X-Amzn-ErrorType") 1714 if len(code) != 0 { 1715 errorCode = restjson.SanitizeErrorCode(code) 1716 } 1717 1718 var buff [1024]byte 1719 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1720 1721 body := io.TeeReader(errorBody, ringBuffer) 1722 decoder := json.NewDecoder(body) 1723 decoder.UseNumber() 1724 code, message, err := restjson.GetErrorInfo(decoder) 1725 if err != nil { 1726 var snapshot bytes.Buffer 1727 io.Copy(&snapshot, ringBuffer) 1728 err = &smithy.DeserializationError{ 1729 Err: fmt.Errorf("failed to decode response body, %w", err), 1730 Snapshot: snapshot.Bytes(), 1731 } 1732 return err 1733 } 1734 1735 errorBody.Seek(0, io.SeekStart) 1736 if len(code) != 0 { 1737 errorCode = restjson.SanitizeErrorCode(code) 1738 } 1739 if len(message) != 0 { 1740 errorMessage = message 1741 } 1742 1743 switch { 1744 case strings.EqualFold("InternalServerException", errorCode): 1745 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 1746 1747 case strings.EqualFold("InvalidRequestException", errorCode): 1748 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 1749 1750 case strings.EqualFold("JobNotFoundException", errorCode): 1751 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 1752 1753 case strings.EqualFold("TooManyRequestsException", errorCode): 1754 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 1755 1756 default: 1757 genericError := &smithy.GenericAPIError{ 1758 Code: errorCode, 1759 Message: errorMessage, 1760 } 1761 return genericError 1762 1763 } 1764} 1765 1766type awsAwsjson11_deserializeOpDescribeDocumentClassifier struct { 1767} 1768 1769func (*awsAwsjson11_deserializeOpDescribeDocumentClassifier) ID() string { 1770 return "OperationDeserializer" 1771} 1772 1773func (m *awsAwsjson11_deserializeOpDescribeDocumentClassifier) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1774 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1775) { 1776 out, metadata, err = next.HandleDeserialize(ctx, in) 1777 if err != nil { 1778 return out, metadata, err 1779 } 1780 1781 response, ok := out.RawResponse.(*smithyhttp.Response) 1782 if !ok { 1783 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1784 } 1785 1786 if response.StatusCode < 200 || response.StatusCode >= 300 { 1787 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeDocumentClassifier(response, &metadata) 1788 } 1789 output := &DescribeDocumentClassifierOutput{} 1790 out.Result = output 1791 1792 var buff [1024]byte 1793 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1794 1795 body := io.TeeReader(response.Body, ringBuffer) 1796 decoder := json.NewDecoder(body) 1797 decoder.UseNumber() 1798 var shape interface{} 1799 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1800 var snapshot bytes.Buffer 1801 io.Copy(&snapshot, ringBuffer) 1802 err = &smithy.DeserializationError{ 1803 Err: fmt.Errorf("failed to decode response body, %w", err), 1804 Snapshot: snapshot.Bytes(), 1805 } 1806 return out, metadata, err 1807 } 1808 1809 err = awsAwsjson11_deserializeOpDocumentDescribeDocumentClassifierOutput(&output, shape) 1810 if err != nil { 1811 var snapshot bytes.Buffer 1812 io.Copy(&snapshot, ringBuffer) 1813 err = &smithy.DeserializationError{ 1814 Err: fmt.Errorf("failed to decode response body, %w", err), 1815 Snapshot: snapshot.Bytes(), 1816 } 1817 return out, metadata, err 1818 } 1819 1820 return out, metadata, err 1821} 1822 1823func awsAwsjson11_deserializeOpErrorDescribeDocumentClassifier(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1824 var errorBuffer bytes.Buffer 1825 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1826 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1827 } 1828 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1829 1830 errorCode := "UnknownError" 1831 errorMessage := errorCode 1832 1833 code := response.Header.Get("X-Amzn-ErrorType") 1834 if len(code) != 0 { 1835 errorCode = restjson.SanitizeErrorCode(code) 1836 } 1837 1838 var buff [1024]byte 1839 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1840 1841 body := io.TeeReader(errorBody, ringBuffer) 1842 decoder := json.NewDecoder(body) 1843 decoder.UseNumber() 1844 code, message, err := restjson.GetErrorInfo(decoder) 1845 if err != nil { 1846 var snapshot bytes.Buffer 1847 io.Copy(&snapshot, ringBuffer) 1848 err = &smithy.DeserializationError{ 1849 Err: fmt.Errorf("failed to decode response body, %w", err), 1850 Snapshot: snapshot.Bytes(), 1851 } 1852 return err 1853 } 1854 1855 errorBody.Seek(0, io.SeekStart) 1856 if len(code) != 0 { 1857 errorCode = restjson.SanitizeErrorCode(code) 1858 } 1859 if len(message) != 0 { 1860 errorMessage = message 1861 } 1862 1863 switch { 1864 case strings.EqualFold("InternalServerException", errorCode): 1865 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 1866 1867 case strings.EqualFold("InvalidRequestException", errorCode): 1868 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 1869 1870 case strings.EqualFold("ResourceNotFoundException", errorCode): 1871 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 1872 1873 case strings.EqualFold("TooManyRequestsException", errorCode): 1874 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 1875 1876 default: 1877 genericError := &smithy.GenericAPIError{ 1878 Code: errorCode, 1879 Message: errorMessage, 1880 } 1881 return genericError 1882 1883 } 1884} 1885 1886type awsAwsjson11_deserializeOpDescribeDominantLanguageDetectionJob struct { 1887} 1888 1889func (*awsAwsjson11_deserializeOpDescribeDominantLanguageDetectionJob) ID() string { 1890 return "OperationDeserializer" 1891} 1892 1893func (m *awsAwsjson11_deserializeOpDescribeDominantLanguageDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1894 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1895) { 1896 out, metadata, err = next.HandleDeserialize(ctx, in) 1897 if err != nil { 1898 return out, metadata, err 1899 } 1900 1901 response, ok := out.RawResponse.(*smithyhttp.Response) 1902 if !ok { 1903 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1904 } 1905 1906 if response.StatusCode < 200 || response.StatusCode >= 300 { 1907 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeDominantLanguageDetectionJob(response, &metadata) 1908 } 1909 output := &DescribeDominantLanguageDetectionJobOutput{} 1910 out.Result = output 1911 1912 var buff [1024]byte 1913 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1914 1915 body := io.TeeReader(response.Body, ringBuffer) 1916 decoder := json.NewDecoder(body) 1917 decoder.UseNumber() 1918 var shape interface{} 1919 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1920 var snapshot bytes.Buffer 1921 io.Copy(&snapshot, ringBuffer) 1922 err = &smithy.DeserializationError{ 1923 Err: fmt.Errorf("failed to decode response body, %w", err), 1924 Snapshot: snapshot.Bytes(), 1925 } 1926 return out, metadata, err 1927 } 1928 1929 err = awsAwsjson11_deserializeOpDocumentDescribeDominantLanguageDetectionJobOutput(&output, shape) 1930 if err != nil { 1931 var snapshot bytes.Buffer 1932 io.Copy(&snapshot, ringBuffer) 1933 err = &smithy.DeserializationError{ 1934 Err: fmt.Errorf("failed to decode response body, %w", err), 1935 Snapshot: snapshot.Bytes(), 1936 } 1937 return out, metadata, err 1938 } 1939 1940 return out, metadata, err 1941} 1942 1943func awsAwsjson11_deserializeOpErrorDescribeDominantLanguageDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1944 var errorBuffer bytes.Buffer 1945 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1946 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1947 } 1948 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1949 1950 errorCode := "UnknownError" 1951 errorMessage := errorCode 1952 1953 code := response.Header.Get("X-Amzn-ErrorType") 1954 if len(code) != 0 { 1955 errorCode = restjson.SanitizeErrorCode(code) 1956 } 1957 1958 var buff [1024]byte 1959 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1960 1961 body := io.TeeReader(errorBody, ringBuffer) 1962 decoder := json.NewDecoder(body) 1963 decoder.UseNumber() 1964 code, message, err := restjson.GetErrorInfo(decoder) 1965 if err != nil { 1966 var snapshot bytes.Buffer 1967 io.Copy(&snapshot, ringBuffer) 1968 err = &smithy.DeserializationError{ 1969 Err: fmt.Errorf("failed to decode response body, %w", err), 1970 Snapshot: snapshot.Bytes(), 1971 } 1972 return err 1973 } 1974 1975 errorBody.Seek(0, io.SeekStart) 1976 if len(code) != 0 { 1977 errorCode = restjson.SanitizeErrorCode(code) 1978 } 1979 if len(message) != 0 { 1980 errorMessage = message 1981 } 1982 1983 switch { 1984 case strings.EqualFold("InternalServerException", errorCode): 1985 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 1986 1987 case strings.EqualFold("InvalidRequestException", errorCode): 1988 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 1989 1990 case strings.EqualFold("JobNotFoundException", errorCode): 1991 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 1992 1993 case strings.EqualFold("TooManyRequestsException", errorCode): 1994 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 1995 1996 default: 1997 genericError := &smithy.GenericAPIError{ 1998 Code: errorCode, 1999 Message: errorMessage, 2000 } 2001 return genericError 2002 2003 } 2004} 2005 2006type awsAwsjson11_deserializeOpDescribeEndpoint struct { 2007} 2008 2009func (*awsAwsjson11_deserializeOpDescribeEndpoint) ID() string { 2010 return "OperationDeserializer" 2011} 2012 2013func (m *awsAwsjson11_deserializeOpDescribeEndpoint) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2014 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2015) { 2016 out, metadata, err = next.HandleDeserialize(ctx, in) 2017 if err != nil { 2018 return out, metadata, err 2019 } 2020 2021 response, ok := out.RawResponse.(*smithyhttp.Response) 2022 if !ok { 2023 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2024 } 2025 2026 if response.StatusCode < 200 || response.StatusCode >= 300 { 2027 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeEndpoint(response, &metadata) 2028 } 2029 output := &DescribeEndpointOutput{} 2030 out.Result = output 2031 2032 var buff [1024]byte 2033 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2034 2035 body := io.TeeReader(response.Body, ringBuffer) 2036 decoder := json.NewDecoder(body) 2037 decoder.UseNumber() 2038 var shape interface{} 2039 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2040 var snapshot bytes.Buffer 2041 io.Copy(&snapshot, ringBuffer) 2042 err = &smithy.DeserializationError{ 2043 Err: fmt.Errorf("failed to decode response body, %w", err), 2044 Snapshot: snapshot.Bytes(), 2045 } 2046 return out, metadata, err 2047 } 2048 2049 err = awsAwsjson11_deserializeOpDocumentDescribeEndpointOutput(&output, shape) 2050 if err != nil { 2051 var snapshot bytes.Buffer 2052 io.Copy(&snapshot, ringBuffer) 2053 err = &smithy.DeserializationError{ 2054 Err: fmt.Errorf("failed to decode response body, %w", err), 2055 Snapshot: snapshot.Bytes(), 2056 } 2057 return out, metadata, err 2058 } 2059 2060 return out, metadata, err 2061} 2062 2063func awsAwsjson11_deserializeOpErrorDescribeEndpoint(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2064 var errorBuffer bytes.Buffer 2065 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2066 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2067 } 2068 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2069 2070 errorCode := "UnknownError" 2071 errorMessage := errorCode 2072 2073 code := response.Header.Get("X-Amzn-ErrorType") 2074 if len(code) != 0 { 2075 errorCode = restjson.SanitizeErrorCode(code) 2076 } 2077 2078 var buff [1024]byte 2079 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2080 2081 body := io.TeeReader(errorBody, ringBuffer) 2082 decoder := json.NewDecoder(body) 2083 decoder.UseNumber() 2084 code, message, err := restjson.GetErrorInfo(decoder) 2085 if err != nil { 2086 var snapshot bytes.Buffer 2087 io.Copy(&snapshot, ringBuffer) 2088 err = &smithy.DeserializationError{ 2089 Err: fmt.Errorf("failed to decode response body, %w", err), 2090 Snapshot: snapshot.Bytes(), 2091 } 2092 return err 2093 } 2094 2095 errorBody.Seek(0, io.SeekStart) 2096 if len(code) != 0 { 2097 errorCode = restjson.SanitizeErrorCode(code) 2098 } 2099 if len(message) != 0 { 2100 errorMessage = message 2101 } 2102 2103 switch { 2104 case strings.EqualFold("InternalServerException", errorCode): 2105 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 2106 2107 case strings.EqualFold("InvalidRequestException", errorCode): 2108 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 2109 2110 case strings.EqualFold("ResourceNotFoundException", errorCode): 2111 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 2112 2113 case strings.EqualFold("TooManyRequestsException", errorCode): 2114 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 2115 2116 default: 2117 genericError := &smithy.GenericAPIError{ 2118 Code: errorCode, 2119 Message: errorMessage, 2120 } 2121 return genericError 2122 2123 } 2124} 2125 2126type awsAwsjson11_deserializeOpDescribeEntitiesDetectionJob struct { 2127} 2128 2129func (*awsAwsjson11_deserializeOpDescribeEntitiesDetectionJob) ID() string { 2130 return "OperationDeserializer" 2131} 2132 2133func (m *awsAwsjson11_deserializeOpDescribeEntitiesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2134 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2135) { 2136 out, metadata, err = next.HandleDeserialize(ctx, in) 2137 if err != nil { 2138 return out, metadata, err 2139 } 2140 2141 response, ok := out.RawResponse.(*smithyhttp.Response) 2142 if !ok { 2143 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2144 } 2145 2146 if response.StatusCode < 200 || response.StatusCode >= 300 { 2147 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeEntitiesDetectionJob(response, &metadata) 2148 } 2149 output := &DescribeEntitiesDetectionJobOutput{} 2150 out.Result = output 2151 2152 var buff [1024]byte 2153 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2154 2155 body := io.TeeReader(response.Body, ringBuffer) 2156 decoder := json.NewDecoder(body) 2157 decoder.UseNumber() 2158 var shape interface{} 2159 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2160 var snapshot bytes.Buffer 2161 io.Copy(&snapshot, ringBuffer) 2162 err = &smithy.DeserializationError{ 2163 Err: fmt.Errorf("failed to decode response body, %w", err), 2164 Snapshot: snapshot.Bytes(), 2165 } 2166 return out, metadata, err 2167 } 2168 2169 err = awsAwsjson11_deserializeOpDocumentDescribeEntitiesDetectionJobOutput(&output, shape) 2170 if err != nil { 2171 var snapshot bytes.Buffer 2172 io.Copy(&snapshot, ringBuffer) 2173 err = &smithy.DeserializationError{ 2174 Err: fmt.Errorf("failed to decode response body, %w", err), 2175 Snapshot: snapshot.Bytes(), 2176 } 2177 return out, metadata, err 2178 } 2179 2180 return out, metadata, err 2181} 2182 2183func awsAwsjson11_deserializeOpErrorDescribeEntitiesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2184 var errorBuffer bytes.Buffer 2185 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2186 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2187 } 2188 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2189 2190 errorCode := "UnknownError" 2191 errorMessage := errorCode 2192 2193 code := response.Header.Get("X-Amzn-ErrorType") 2194 if len(code) != 0 { 2195 errorCode = restjson.SanitizeErrorCode(code) 2196 } 2197 2198 var buff [1024]byte 2199 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2200 2201 body := io.TeeReader(errorBody, ringBuffer) 2202 decoder := json.NewDecoder(body) 2203 decoder.UseNumber() 2204 code, message, err := restjson.GetErrorInfo(decoder) 2205 if err != nil { 2206 var snapshot bytes.Buffer 2207 io.Copy(&snapshot, ringBuffer) 2208 err = &smithy.DeserializationError{ 2209 Err: fmt.Errorf("failed to decode response body, %w", err), 2210 Snapshot: snapshot.Bytes(), 2211 } 2212 return err 2213 } 2214 2215 errorBody.Seek(0, io.SeekStart) 2216 if len(code) != 0 { 2217 errorCode = restjson.SanitizeErrorCode(code) 2218 } 2219 if len(message) != 0 { 2220 errorMessage = message 2221 } 2222 2223 switch { 2224 case strings.EqualFold("InternalServerException", errorCode): 2225 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 2226 2227 case strings.EqualFold("InvalidRequestException", errorCode): 2228 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 2229 2230 case strings.EqualFold("JobNotFoundException", errorCode): 2231 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 2232 2233 case strings.EqualFold("TooManyRequestsException", errorCode): 2234 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 2235 2236 default: 2237 genericError := &smithy.GenericAPIError{ 2238 Code: errorCode, 2239 Message: errorMessage, 2240 } 2241 return genericError 2242 2243 } 2244} 2245 2246type awsAwsjson11_deserializeOpDescribeEntityRecognizer struct { 2247} 2248 2249func (*awsAwsjson11_deserializeOpDescribeEntityRecognizer) ID() string { 2250 return "OperationDeserializer" 2251} 2252 2253func (m *awsAwsjson11_deserializeOpDescribeEntityRecognizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2254 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2255) { 2256 out, metadata, err = next.HandleDeserialize(ctx, in) 2257 if err != nil { 2258 return out, metadata, err 2259 } 2260 2261 response, ok := out.RawResponse.(*smithyhttp.Response) 2262 if !ok { 2263 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2264 } 2265 2266 if response.StatusCode < 200 || response.StatusCode >= 300 { 2267 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeEntityRecognizer(response, &metadata) 2268 } 2269 output := &DescribeEntityRecognizerOutput{} 2270 out.Result = output 2271 2272 var buff [1024]byte 2273 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2274 2275 body := io.TeeReader(response.Body, ringBuffer) 2276 decoder := json.NewDecoder(body) 2277 decoder.UseNumber() 2278 var shape interface{} 2279 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2280 var snapshot bytes.Buffer 2281 io.Copy(&snapshot, ringBuffer) 2282 err = &smithy.DeserializationError{ 2283 Err: fmt.Errorf("failed to decode response body, %w", err), 2284 Snapshot: snapshot.Bytes(), 2285 } 2286 return out, metadata, err 2287 } 2288 2289 err = awsAwsjson11_deserializeOpDocumentDescribeEntityRecognizerOutput(&output, shape) 2290 if err != nil { 2291 var snapshot bytes.Buffer 2292 io.Copy(&snapshot, ringBuffer) 2293 err = &smithy.DeserializationError{ 2294 Err: fmt.Errorf("failed to decode response body, %w", err), 2295 Snapshot: snapshot.Bytes(), 2296 } 2297 return out, metadata, err 2298 } 2299 2300 return out, metadata, err 2301} 2302 2303func awsAwsjson11_deserializeOpErrorDescribeEntityRecognizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2304 var errorBuffer bytes.Buffer 2305 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2306 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2307 } 2308 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2309 2310 errorCode := "UnknownError" 2311 errorMessage := errorCode 2312 2313 code := response.Header.Get("X-Amzn-ErrorType") 2314 if len(code) != 0 { 2315 errorCode = restjson.SanitizeErrorCode(code) 2316 } 2317 2318 var buff [1024]byte 2319 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2320 2321 body := io.TeeReader(errorBody, ringBuffer) 2322 decoder := json.NewDecoder(body) 2323 decoder.UseNumber() 2324 code, message, err := restjson.GetErrorInfo(decoder) 2325 if err != nil { 2326 var snapshot bytes.Buffer 2327 io.Copy(&snapshot, ringBuffer) 2328 err = &smithy.DeserializationError{ 2329 Err: fmt.Errorf("failed to decode response body, %w", err), 2330 Snapshot: snapshot.Bytes(), 2331 } 2332 return err 2333 } 2334 2335 errorBody.Seek(0, io.SeekStart) 2336 if len(code) != 0 { 2337 errorCode = restjson.SanitizeErrorCode(code) 2338 } 2339 if len(message) != 0 { 2340 errorMessage = message 2341 } 2342 2343 switch { 2344 case strings.EqualFold("InternalServerException", errorCode): 2345 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 2346 2347 case strings.EqualFold("InvalidRequestException", errorCode): 2348 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 2349 2350 case strings.EqualFold("ResourceNotFoundException", errorCode): 2351 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 2352 2353 case strings.EqualFold("TooManyRequestsException", errorCode): 2354 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 2355 2356 default: 2357 genericError := &smithy.GenericAPIError{ 2358 Code: errorCode, 2359 Message: errorMessage, 2360 } 2361 return genericError 2362 2363 } 2364} 2365 2366type awsAwsjson11_deserializeOpDescribeEventsDetectionJob struct { 2367} 2368 2369func (*awsAwsjson11_deserializeOpDescribeEventsDetectionJob) ID() string { 2370 return "OperationDeserializer" 2371} 2372 2373func (m *awsAwsjson11_deserializeOpDescribeEventsDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2374 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2375) { 2376 out, metadata, err = next.HandleDeserialize(ctx, in) 2377 if err != nil { 2378 return out, metadata, err 2379 } 2380 2381 response, ok := out.RawResponse.(*smithyhttp.Response) 2382 if !ok { 2383 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2384 } 2385 2386 if response.StatusCode < 200 || response.StatusCode >= 300 { 2387 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeEventsDetectionJob(response, &metadata) 2388 } 2389 output := &DescribeEventsDetectionJobOutput{} 2390 out.Result = output 2391 2392 var buff [1024]byte 2393 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2394 2395 body := io.TeeReader(response.Body, ringBuffer) 2396 decoder := json.NewDecoder(body) 2397 decoder.UseNumber() 2398 var shape interface{} 2399 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2400 var snapshot bytes.Buffer 2401 io.Copy(&snapshot, ringBuffer) 2402 err = &smithy.DeserializationError{ 2403 Err: fmt.Errorf("failed to decode response body, %w", err), 2404 Snapshot: snapshot.Bytes(), 2405 } 2406 return out, metadata, err 2407 } 2408 2409 err = awsAwsjson11_deserializeOpDocumentDescribeEventsDetectionJobOutput(&output, shape) 2410 if err != nil { 2411 var snapshot bytes.Buffer 2412 io.Copy(&snapshot, ringBuffer) 2413 err = &smithy.DeserializationError{ 2414 Err: fmt.Errorf("failed to decode response body, %w", err), 2415 Snapshot: snapshot.Bytes(), 2416 } 2417 return out, metadata, err 2418 } 2419 2420 return out, metadata, err 2421} 2422 2423func awsAwsjson11_deserializeOpErrorDescribeEventsDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2424 var errorBuffer bytes.Buffer 2425 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2426 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2427 } 2428 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2429 2430 errorCode := "UnknownError" 2431 errorMessage := errorCode 2432 2433 code := response.Header.Get("X-Amzn-ErrorType") 2434 if len(code) != 0 { 2435 errorCode = restjson.SanitizeErrorCode(code) 2436 } 2437 2438 var buff [1024]byte 2439 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2440 2441 body := io.TeeReader(errorBody, ringBuffer) 2442 decoder := json.NewDecoder(body) 2443 decoder.UseNumber() 2444 code, message, err := restjson.GetErrorInfo(decoder) 2445 if err != nil { 2446 var snapshot bytes.Buffer 2447 io.Copy(&snapshot, ringBuffer) 2448 err = &smithy.DeserializationError{ 2449 Err: fmt.Errorf("failed to decode response body, %w", err), 2450 Snapshot: snapshot.Bytes(), 2451 } 2452 return err 2453 } 2454 2455 errorBody.Seek(0, io.SeekStart) 2456 if len(code) != 0 { 2457 errorCode = restjson.SanitizeErrorCode(code) 2458 } 2459 if len(message) != 0 { 2460 errorMessage = message 2461 } 2462 2463 switch { 2464 case strings.EqualFold("InternalServerException", errorCode): 2465 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 2466 2467 case strings.EqualFold("InvalidRequestException", errorCode): 2468 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 2469 2470 case strings.EqualFold("JobNotFoundException", errorCode): 2471 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 2472 2473 case strings.EqualFold("TooManyRequestsException", errorCode): 2474 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 2475 2476 default: 2477 genericError := &smithy.GenericAPIError{ 2478 Code: errorCode, 2479 Message: errorMessage, 2480 } 2481 return genericError 2482 2483 } 2484} 2485 2486type awsAwsjson11_deserializeOpDescribeKeyPhrasesDetectionJob struct { 2487} 2488 2489func (*awsAwsjson11_deserializeOpDescribeKeyPhrasesDetectionJob) ID() string { 2490 return "OperationDeserializer" 2491} 2492 2493func (m *awsAwsjson11_deserializeOpDescribeKeyPhrasesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2494 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2495) { 2496 out, metadata, err = next.HandleDeserialize(ctx, in) 2497 if err != nil { 2498 return out, metadata, err 2499 } 2500 2501 response, ok := out.RawResponse.(*smithyhttp.Response) 2502 if !ok { 2503 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2504 } 2505 2506 if response.StatusCode < 200 || response.StatusCode >= 300 { 2507 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeKeyPhrasesDetectionJob(response, &metadata) 2508 } 2509 output := &DescribeKeyPhrasesDetectionJobOutput{} 2510 out.Result = output 2511 2512 var buff [1024]byte 2513 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2514 2515 body := io.TeeReader(response.Body, ringBuffer) 2516 decoder := json.NewDecoder(body) 2517 decoder.UseNumber() 2518 var shape interface{} 2519 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2520 var snapshot bytes.Buffer 2521 io.Copy(&snapshot, ringBuffer) 2522 err = &smithy.DeserializationError{ 2523 Err: fmt.Errorf("failed to decode response body, %w", err), 2524 Snapshot: snapshot.Bytes(), 2525 } 2526 return out, metadata, err 2527 } 2528 2529 err = awsAwsjson11_deserializeOpDocumentDescribeKeyPhrasesDetectionJobOutput(&output, shape) 2530 if err != nil { 2531 var snapshot bytes.Buffer 2532 io.Copy(&snapshot, ringBuffer) 2533 err = &smithy.DeserializationError{ 2534 Err: fmt.Errorf("failed to decode response body, %w", err), 2535 Snapshot: snapshot.Bytes(), 2536 } 2537 return out, metadata, err 2538 } 2539 2540 return out, metadata, err 2541} 2542 2543func awsAwsjson11_deserializeOpErrorDescribeKeyPhrasesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2544 var errorBuffer bytes.Buffer 2545 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2546 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2547 } 2548 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2549 2550 errorCode := "UnknownError" 2551 errorMessage := errorCode 2552 2553 code := response.Header.Get("X-Amzn-ErrorType") 2554 if len(code) != 0 { 2555 errorCode = restjson.SanitizeErrorCode(code) 2556 } 2557 2558 var buff [1024]byte 2559 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2560 2561 body := io.TeeReader(errorBody, ringBuffer) 2562 decoder := json.NewDecoder(body) 2563 decoder.UseNumber() 2564 code, message, err := restjson.GetErrorInfo(decoder) 2565 if err != nil { 2566 var snapshot bytes.Buffer 2567 io.Copy(&snapshot, ringBuffer) 2568 err = &smithy.DeserializationError{ 2569 Err: fmt.Errorf("failed to decode response body, %w", err), 2570 Snapshot: snapshot.Bytes(), 2571 } 2572 return err 2573 } 2574 2575 errorBody.Seek(0, io.SeekStart) 2576 if len(code) != 0 { 2577 errorCode = restjson.SanitizeErrorCode(code) 2578 } 2579 if len(message) != 0 { 2580 errorMessage = message 2581 } 2582 2583 switch { 2584 case strings.EqualFold("InternalServerException", errorCode): 2585 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 2586 2587 case strings.EqualFold("InvalidRequestException", errorCode): 2588 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 2589 2590 case strings.EqualFold("JobNotFoundException", errorCode): 2591 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 2592 2593 case strings.EqualFold("TooManyRequestsException", errorCode): 2594 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 2595 2596 default: 2597 genericError := &smithy.GenericAPIError{ 2598 Code: errorCode, 2599 Message: errorMessage, 2600 } 2601 return genericError 2602 2603 } 2604} 2605 2606type awsAwsjson11_deserializeOpDescribePiiEntitiesDetectionJob struct { 2607} 2608 2609func (*awsAwsjson11_deserializeOpDescribePiiEntitiesDetectionJob) ID() string { 2610 return "OperationDeserializer" 2611} 2612 2613func (m *awsAwsjson11_deserializeOpDescribePiiEntitiesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2614 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2615) { 2616 out, metadata, err = next.HandleDeserialize(ctx, in) 2617 if err != nil { 2618 return out, metadata, err 2619 } 2620 2621 response, ok := out.RawResponse.(*smithyhttp.Response) 2622 if !ok { 2623 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2624 } 2625 2626 if response.StatusCode < 200 || response.StatusCode >= 300 { 2627 return out, metadata, awsAwsjson11_deserializeOpErrorDescribePiiEntitiesDetectionJob(response, &metadata) 2628 } 2629 output := &DescribePiiEntitiesDetectionJobOutput{} 2630 out.Result = output 2631 2632 var buff [1024]byte 2633 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2634 2635 body := io.TeeReader(response.Body, 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 out, metadata, err 2647 } 2648 2649 err = awsAwsjson11_deserializeOpDocumentDescribePiiEntitiesDetectionJobOutput(&output, shape) 2650 if err != nil { 2651 var snapshot bytes.Buffer 2652 io.Copy(&snapshot, ringBuffer) 2653 err = &smithy.DeserializationError{ 2654 Err: fmt.Errorf("failed to decode response body, %w", err), 2655 Snapshot: snapshot.Bytes(), 2656 } 2657 return out, metadata, err 2658 } 2659 2660 return out, metadata, err 2661} 2662 2663func awsAwsjson11_deserializeOpErrorDescribePiiEntitiesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2664 var errorBuffer bytes.Buffer 2665 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2666 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2667 } 2668 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2669 2670 errorCode := "UnknownError" 2671 errorMessage := errorCode 2672 2673 code := response.Header.Get("X-Amzn-ErrorType") 2674 if len(code) != 0 { 2675 errorCode = restjson.SanitizeErrorCode(code) 2676 } 2677 2678 var buff [1024]byte 2679 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2680 2681 body := io.TeeReader(errorBody, ringBuffer) 2682 decoder := json.NewDecoder(body) 2683 decoder.UseNumber() 2684 code, message, err := restjson.GetErrorInfo(decoder) 2685 if err != nil { 2686 var snapshot bytes.Buffer 2687 io.Copy(&snapshot, ringBuffer) 2688 err = &smithy.DeserializationError{ 2689 Err: fmt.Errorf("failed to decode response body, %w", err), 2690 Snapshot: snapshot.Bytes(), 2691 } 2692 return err 2693 } 2694 2695 errorBody.Seek(0, io.SeekStart) 2696 if len(code) != 0 { 2697 errorCode = restjson.SanitizeErrorCode(code) 2698 } 2699 if len(message) != 0 { 2700 errorMessage = message 2701 } 2702 2703 switch { 2704 case strings.EqualFold("InternalServerException", errorCode): 2705 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 2706 2707 case strings.EqualFold("InvalidRequestException", errorCode): 2708 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 2709 2710 case strings.EqualFold("JobNotFoundException", errorCode): 2711 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 2712 2713 case strings.EqualFold("TooManyRequestsException", errorCode): 2714 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 2715 2716 default: 2717 genericError := &smithy.GenericAPIError{ 2718 Code: errorCode, 2719 Message: errorMessage, 2720 } 2721 return genericError 2722 2723 } 2724} 2725 2726type awsAwsjson11_deserializeOpDescribeSentimentDetectionJob struct { 2727} 2728 2729func (*awsAwsjson11_deserializeOpDescribeSentimentDetectionJob) ID() string { 2730 return "OperationDeserializer" 2731} 2732 2733func (m *awsAwsjson11_deserializeOpDescribeSentimentDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2734 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2735) { 2736 out, metadata, err = next.HandleDeserialize(ctx, in) 2737 if err != nil { 2738 return out, metadata, err 2739 } 2740 2741 response, ok := out.RawResponse.(*smithyhttp.Response) 2742 if !ok { 2743 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2744 } 2745 2746 if response.StatusCode < 200 || response.StatusCode >= 300 { 2747 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeSentimentDetectionJob(response, &metadata) 2748 } 2749 output := &DescribeSentimentDetectionJobOutput{} 2750 out.Result = output 2751 2752 var buff [1024]byte 2753 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2754 2755 body := io.TeeReader(response.Body, ringBuffer) 2756 decoder := json.NewDecoder(body) 2757 decoder.UseNumber() 2758 var shape interface{} 2759 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2760 var snapshot bytes.Buffer 2761 io.Copy(&snapshot, ringBuffer) 2762 err = &smithy.DeserializationError{ 2763 Err: fmt.Errorf("failed to decode response body, %w", err), 2764 Snapshot: snapshot.Bytes(), 2765 } 2766 return out, metadata, err 2767 } 2768 2769 err = awsAwsjson11_deserializeOpDocumentDescribeSentimentDetectionJobOutput(&output, shape) 2770 if err != nil { 2771 var snapshot bytes.Buffer 2772 io.Copy(&snapshot, ringBuffer) 2773 err = &smithy.DeserializationError{ 2774 Err: fmt.Errorf("failed to decode response body, %w", err), 2775 Snapshot: snapshot.Bytes(), 2776 } 2777 return out, metadata, err 2778 } 2779 2780 return out, metadata, err 2781} 2782 2783func awsAwsjson11_deserializeOpErrorDescribeSentimentDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2784 var errorBuffer bytes.Buffer 2785 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2786 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2787 } 2788 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2789 2790 errorCode := "UnknownError" 2791 errorMessage := errorCode 2792 2793 code := response.Header.Get("X-Amzn-ErrorType") 2794 if len(code) != 0 { 2795 errorCode = restjson.SanitizeErrorCode(code) 2796 } 2797 2798 var buff [1024]byte 2799 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2800 2801 body := io.TeeReader(errorBody, ringBuffer) 2802 decoder := json.NewDecoder(body) 2803 decoder.UseNumber() 2804 code, message, err := restjson.GetErrorInfo(decoder) 2805 if err != nil { 2806 var snapshot bytes.Buffer 2807 io.Copy(&snapshot, ringBuffer) 2808 err = &smithy.DeserializationError{ 2809 Err: fmt.Errorf("failed to decode response body, %w", err), 2810 Snapshot: snapshot.Bytes(), 2811 } 2812 return err 2813 } 2814 2815 errorBody.Seek(0, io.SeekStart) 2816 if len(code) != 0 { 2817 errorCode = restjson.SanitizeErrorCode(code) 2818 } 2819 if len(message) != 0 { 2820 errorMessage = message 2821 } 2822 2823 switch { 2824 case strings.EqualFold("InternalServerException", errorCode): 2825 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 2826 2827 case strings.EqualFold("InvalidRequestException", errorCode): 2828 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 2829 2830 case strings.EqualFold("JobNotFoundException", errorCode): 2831 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 2832 2833 case strings.EqualFold("TooManyRequestsException", errorCode): 2834 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 2835 2836 default: 2837 genericError := &smithy.GenericAPIError{ 2838 Code: errorCode, 2839 Message: errorMessage, 2840 } 2841 return genericError 2842 2843 } 2844} 2845 2846type awsAwsjson11_deserializeOpDescribeTopicsDetectionJob struct { 2847} 2848 2849func (*awsAwsjson11_deserializeOpDescribeTopicsDetectionJob) ID() string { 2850 return "OperationDeserializer" 2851} 2852 2853func (m *awsAwsjson11_deserializeOpDescribeTopicsDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2854 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2855) { 2856 out, metadata, err = next.HandleDeserialize(ctx, in) 2857 if err != nil { 2858 return out, metadata, err 2859 } 2860 2861 response, ok := out.RawResponse.(*smithyhttp.Response) 2862 if !ok { 2863 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2864 } 2865 2866 if response.StatusCode < 200 || response.StatusCode >= 300 { 2867 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeTopicsDetectionJob(response, &metadata) 2868 } 2869 output := &DescribeTopicsDetectionJobOutput{} 2870 out.Result = output 2871 2872 var buff [1024]byte 2873 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2874 2875 body := io.TeeReader(response.Body, ringBuffer) 2876 decoder := json.NewDecoder(body) 2877 decoder.UseNumber() 2878 var shape interface{} 2879 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2880 var snapshot bytes.Buffer 2881 io.Copy(&snapshot, ringBuffer) 2882 err = &smithy.DeserializationError{ 2883 Err: fmt.Errorf("failed to decode response body, %w", err), 2884 Snapshot: snapshot.Bytes(), 2885 } 2886 return out, metadata, err 2887 } 2888 2889 err = awsAwsjson11_deserializeOpDocumentDescribeTopicsDetectionJobOutput(&output, shape) 2890 if err != nil { 2891 var snapshot bytes.Buffer 2892 io.Copy(&snapshot, ringBuffer) 2893 err = &smithy.DeserializationError{ 2894 Err: fmt.Errorf("failed to decode response body, %w", err), 2895 Snapshot: snapshot.Bytes(), 2896 } 2897 return out, metadata, err 2898 } 2899 2900 return out, metadata, err 2901} 2902 2903func awsAwsjson11_deserializeOpErrorDescribeTopicsDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2904 var errorBuffer bytes.Buffer 2905 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2906 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2907 } 2908 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2909 2910 errorCode := "UnknownError" 2911 errorMessage := errorCode 2912 2913 code := response.Header.Get("X-Amzn-ErrorType") 2914 if len(code) != 0 { 2915 errorCode = restjson.SanitizeErrorCode(code) 2916 } 2917 2918 var buff [1024]byte 2919 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2920 2921 body := io.TeeReader(errorBody, ringBuffer) 2922 decoder := json.NewDecoder(body) 2923 decoder.UseNumber() 2924 code, message, err := restjson.GetErrorInfo(decoder) 2925 if err != nil { 2926 var snapshot bytes.Buffer 2927 io.Copy(&snapshot, ringBuffer) 2928 err = &smithy.DeserializationError{ 2929 Err: fmt.Errorf("failed to decode response body, %w", err), 2930 Snapshot: snapshot.Bytes(), 2931 } 2932 return err 2933 } 2934 2935 errorBody.Seek(0, io.SeekStart) 2936 if len(code) != 0 { 2937 errorCode = restjson.SanitizeErrorCode(code) 2938 } 2939 if len(message) != 0 { 2940 errorMessage = message 2941 } 2942 2943 switch { 2944 case strings.EqualFold("InternalServerException", errorCode): 2945 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 2946 2947 case strings.EqualFold("InvalidRequestException", errorCode): 2948 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 2949 2950 case strings.EqualFold("JobNotFoundException", errorCode): 2951 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 2952 2953 case strings.EqualFold("TooManyRequestsException", errorCode): 2954 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 2955 2956 default: 2957 genericError := &smithy.GenericAPIError{ 2958 Code: errorCode, 2959 Message: errorMessage, 2960 } 2961 return genericError 2962 2963 } 2964} 2965 2966type awsAwsjson11_deserializeOpDetectDominantLanguage struct { 2967} 2968 2969func (*awsAwsjson11_deserializeOpDetectDominantLanguage) ID() string { 2970 return "OperationDeserializer" 2971} 2972 2973func (m *awsAwsjson11_deserializeOpDetectDominantLanguage) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2974 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2975) { 2976 out, metadata, err = next.HandleDeserialize(ctx, in) 2977 if err != nil { 2978 return out, metadata, err 2979 } 2980 2981 response, ok := out.RawResponse.(*smithyhttp.Response) 2982 if !ok { 2983 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2984 } 2985 2986 if response.StatusCode < 200 || response.StatusCode >= 300 { 2987 return out, metadata, awsAwsjson11_deserializeOpErrorDetectDominantLanguage(response, &metadata) 2988 } 2989 output := &DetectDominantLanguageOutput{} 2990 out.Result = output 2991 2992 var buff [1024]byte 2993 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2994 2995 body := io.TeeReader(response.Body, ringBuffer) 2996 decoder := json.NewDecoder(body) 2997 decoder.UseNumber() 2998 var shape interface{} 2999 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3000 var snapshot bytes.Buffer 3001 io.Copy(&snapshot, ringBuffer) 3002 err = &smithy.DeserializationError{ 3003 Err: fmt.Errorf("failed to decode response body, %w", err), 3004 Snapshot: snapshot.Bytes(), 3005 } 3006 return out, metadata, err 3007 } 3008 3009 err = awsAwsjson11_deserializeOpDocumentDetectDominantLanguageOutput(&output, shape) 3010 if err != nil { 3011 var snapshot bytes.Buffer 3012 io.Copy(&snapshot, ringBuffer) 3013 err = &smithy.DeserializationError{ 3014 Err: fmt.Errorf("failed to decode response body, %w", err), 3015 Snapshot: snapshot.Bytes(), 3016 } 3017 return out, metadata, err 3018 } 3019 3020 return out, metadata, err 3021} 3022 3023func awsAwsjson11_deserializeOpErrorDetectDominantLanguage(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3024 var errorBuffer bytes.Buffer 3025 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3026 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3027 } 3028 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3029 3030 errorCode := "UnknownError" 3031 errorMessage := errorCode 3032 3033 code := response.Header.Get("X-Amzn-ErrorType") 3034 if len(code) != 0 { 3035 errorCode = restjson.SanitizeErrorCode(code) 3036 } 3037 3038 var buff [1024]byte 3039 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3040 3041 body := io.TeeReader(errorBody, ringBuffer) 3042 decoder := json.NewDecoder(body) 3043 decoder.UseNumber() 3044 code, message, err := restjson.GetErrorInfo(decoder) 3045 if err != nil { 3046 var snapshot bytes.Buffer 3047 io.Copy(&snapshot, ringBuffer) 3048 err = &smithy.DeserializationError{ 3049 Err: fmt.Errorf("failed to decode response body, %w", err), 3050 Snapshot: snapshot.Bytes(), 3051 } 3052 return err 3053 } 3054 3055 errorBody.Seek(0, io.SeekStart) 3056 if len(code) != 0 { 3057 errorCode = restjson.SanitizeErrorCode(code) 3058 } 3059 if len(message) != 0 { 3060 errorMessage = message 3061 } 3062 3063 switch { 3064 case strings.EqualFold("InternalServerException", errorCode): 3065 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 3066 3067 case strings.EqualFold("InvalidRequestException", errorCode): 3068 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 3069 3070 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 3071 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 3072 3073 default: 3074 genericError := &smithy.GenericAPIError{ 3075 Code: errorCode, 3076 Message: errorMessage, 3077 } 3078 return genericError 3079 3080 } 3081} 3082 3083type awsAwsjson11_deserializeOpDetectEntities struct { 3084} 3085 3086func (*awsAwsjson11_deserializeOpDetectEntities) ID() string { 3087 return "OperationDeserializer" 3088} 3089 3090func (m *awsAwsjson11_deserializeOpDetectEntities) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3091 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3092) { 3093 out, metadata, err = next.HandleDeserialize(ctx, in) 3094 if err != nil { 3095 return out, metadata, err 3096 } 3097 3098 response, ok := out.RawResponse.(*smithyhttp.Response) 3099 if !ok { 3100 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3101 } 3102 3103 if response.StatusCode < 200 || response.StatusCode >= 300 { 3104 return out, metadata, awsAwsjson11_deserializeOpErrorDetectEntities(response, &metadata) 3105 } 3106 output := &DetectEntitiesOutput{} 3107 out.Result = output 3108 3109 var buff [1024]byte 3110 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3111 3112 body := io.TeeReader(response.Body, ringBuffer) 3113 decoder := json.NewDecoder(body) 3114 decoder.UseNumber() 3115 var shape interface{} 3116 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3117 var snapshot bytes.Buffer 3118 io.Copy(&snapshot, ringBuffer) 3119 err = &smithy.DeserializationError{ 3120 Err: fmt.Errorf("failed to decode response body, %w", err), 3121 Snapshot: snapshot.Bytes(), 3122 } 3123 return out, metadata, err 3124 } 3125 3126 err = awsAwsjson11_deserializeOpDocumentDetectEntitiesOutput(&output, shape) 3127 if err != nil { 3128 var snapshot bytes.Buffer 3129 io.Copy(&snapshot, ringBuffer) 3130 err = &smithy.DeserializationError{ 3131 Err: fmt.Errorf("failed to decode response body, %w", err), 3132 Snapshot: snapshot.Bytes(), 3133 } 3134 return out, metadata, err 3135 } 3136 3137 return out, metadata, err 3138} 3139 3140func awsAwsjson11_deserializeOpErrorDetectEntities(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3141 var errorBuffer bytes.Buffer 3142 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3143 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3144 } 3145 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3146 3147 errorCode := "UnknownError" 3148 errorMessage := errorCode 3149 3150 code := response.Header.Get("X-Amzn-ErrorType") 3151 if len(code) != 0 { 3152 errorCode = restjson.SanitizeErrorCode(code) 3153 } 3154 3155 var buff [1024]byte 3156 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3157 3158 body := io.TeeReader(errorBody, ringBuffer) 3159 decoder := json.NewDecoder(body) 3160 decoder.UseNumber() 3161 code, message, err := restjson.GetErrorInfo(decoder) 3162 if err != nil { 3163 var snapshot bytes.Buffer 3164 io.Copy(&snapshot, ringBuffer) 3165 err = &smithy.DeserializationError{ 3166 Err: fmt.Errorf("failed to decode response body, %w", err), 3167 Snapshot: snapshot.Bytes(), 3168 } 3169 return err 3170 } 3171 3172 errorBody.Seek(0, io.SeekStart) 3173 if len(code) != 0 { 3174 errorCode = restjson.SanitizeErrorCode(code) 3175 } 3176 if len(message) != 0 { 3177 errorMessage = message 3178 } 3179 3180 switch { 3181 case strings.EqualFold("InternalServerException", errorCode): 3182 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 3183 3184 case strings.EqualFold("InvalidRequestException", errorCode): 3185 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 3186 3187 case strings.EqualFold("ResourceUnavailableException", errorCode): 3188 return awsAwsjson11_deserializeErrorResourceUnavailableException(response, errorBody) 3189 3190 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 3191 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 3192 3193 case strings.EqualFold("UnsupportedLanguageException", errorCode): 3194 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 3195 3196 default: 3197 genericError := &smithy.GenericAPIError{ 3198 Code: errorCode, 3199 Message: errorMessage, 3200 } 3201 return genericError 3202 3203 } 3204} 3205 3206type awsAwsjson11_deserializeOpDetectKeyPhrases struct { 3207} 3208 3209func (*awsAwsjson11_deserializeOpDetectKeyPhrases) ID() string { 3210 return "OperationDeserializer" 3211} 3212 3213func (m *awsAwsjson11_deserializeOpDetectKeyPhrases) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3214 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3215) { 3216 out, metadata, err = next.HandleDeserialize(ctx, in) 3217 if err != nil { 3218 return out, metadata, err 3219 } 3220 3221 response, ok := out.RawResponse.(*smithyhttp.Response) 3222 if !ok { 3223 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3224 } 3225 3226 if response.StatusCode < 200 || response.StatusCode >= 300 { 3227 return out, metadata, awsAwsjson11_deserializeOpErrorDetectKeyPhrases(response, &metadata) 3228 } 3229 output := &DetectKeyPhrasesOutput{} 3230 out.Result = output 3231 3232 var buff [1024]byte 3233 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3234 3235 body := io.TeeReader(response.Body, ringBuffer) 3236 decoder := json.NewDecoder(body) 3237 decoder.UseNumber() 3238 var shape interface{} 3239 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3240 var snapshot bytes.Buffer 3241 io.Copy(&snapshot, ringBuffer) 3242 err = &smithy.DeserializationError{ 3243 Err: fmt.Errorf("failed to decode response body, %w", err), 3244 Snapshot: snapshot.Bytes(), 3245 } 3246 return out, metadata, err 3247 } 3248 3249 err = awsAwsjson11_deserializeOpDocumentDetectKeyPhrasesOutput(&output, shape) 3250 if err != nil { 3251 var snapshot bytes.Buffer 3252 io.Copy(&snapshot, ringBuffer) 3253 err = &smithy.DeserializationError{ 3254 Err: fmt.Errorf("failed to decode response body, %w", err), 3255 Snapshot: snapshot.Bytes(), 3256 } 3257 return out, metadata, err 3258 } 3259 3260 return out, metadata, err 3261} 3262 3263func awsAwsjson11_deserializeOpErrorDetectKeyPhrases(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3264 var errorBuffer bytes.Buffer 3265 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3266 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3267 } 3268 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3269 3270 errorCode := "UnknownError" 3271 errorMessage := errorCode 3272 3273 code := response.Header.Get("X-Amzn-ErrorType") 3274 if len(code) != 0 { 3275 errorCode = restjson.SanitizeErrorCode(code) 3276 } 3277 3278 var buff [1024]byte 3279 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3280 3281 body := io.TeeReader(errorBody, ringBuffer) 3282 decoder := json.NewDecoder(body) 3283 decoder.UseNumber() 3284 code, message, err := restjson.GetErrorInfo(decoder) 3285 if err != nil { 3286 var snapshot bytes.Buffer 3287 io.Copy(&snapshot, ringBuffer) 3288 err = &smithy.DeserializationError{ 3289 Err: fmt.Errorf("failed to decode response body, %w", err), 3290 Snapshot: snapshot.Bytes(), 3291 } 3292 return err 3293 } 3294 3295 errorBody.Seek(0, io.SeekStart) 3296 if len(code) != 0 { 3297 errorCode = restjson.SanitizeErrorCode(code) 3298 } 3299 if len(message) != 0 { 3300 errorMessage = message 3301 } 3302 3303 switch { 3304 case strings.EqualFold("InternalServerException", errorCode): 3305 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 3306 3307 case strings.EqualFold("InvalidRequestException", errorCode): 3308 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 3309 3310 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 3311 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 3312 3313 case strings.EqualFold("UnsupportedLanguageException", errorCode): 3314 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 3315 3316 default: 3317 genericError := &smithy.GenericAPIError{ 3318 Code: errorCode, 3319 Message: errorMessage, 3320 } 3321 return genericError 3322 3323 } 3324} 3325 3326type awsAwsjson11_deserializeOpDetectPiiEntities struct { 3327} 3328 3329func (*awsAwsjson11_deserializeOpDetectPiiEntities) ID() string { 3330 return "OperationDeserializer" 3331} 3332 3333func (m *awsAwsjson11_deserializeOpDetectPiiEntities) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3334 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3335) { 3336 out, metadata, err = next.HandleDeserialize(ctx, in) 3337 if err != nil { 3338 return out, metadata, err 3339 } 3340 3341 response, ok := out.RawResponse.(*smithyhttp.Response) 3342 if !ok { 3343 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3344 } 3345 3346 if response.StatusCode < 200 || response.StatusCode >= 300 { 3347 return out, metadata, awsAwsjson11_deserializeOpErrorDetectPiiEntities(response, &metadata) 3348 } 3349 output := &DetectPiiEntitiesOutput{} 3350 out.Result = output 3351 3352 var buff [1024]byte 3353 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3354 3355 body := io.TeeReader(response.Body, ringBuffer) 3356 decoder := json.NewDecoder(body) 3357 decoder.UseNumber() 3358 var shape interface{} 3359 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3360 var snapshot bytes.Buffer 3361 io.Copy(&snapshot, ringBuffer) 3362 err = &smithy.DeserializationError{ 3363 Err: fmt.Errorf("failed to decode response body, %w", err), 3364 Snapshot: snapshot.Bytes(), 3365 } 3366 return out, metadata, err 3367 } 3368 3369 err = awsAwsjson11_deserializeOpDocumentDetectPiiEntitiesOutput(&output, shape) 3370 if err != nil { 3371 var snapshot bytes.Buffer 3372 io.Copy(&snapshot, ringBuffer) 3373 err = &smithy.DeserializationError{ 3374 Err: fmt.Errorf("failed to decode response body, %w", err), 3375 Snapshot: snapshot.Bytes(), 3376 } 3377 return out, metadata, err 3378 } 3379 3380 return out, metadata, err 3381} 3382 3383func awsAwsjson11_deserializeOpErrorDetectPiiEntities(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3384 var errorBuffer bytes.Buffer 3385 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3386 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3387 } 3388 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3389 3390 errorCode := "UnknownError" 3391 errorMessage := errorCode 3392 3393 code := response.Header.Get("X-Amzn-ErrorType") 3394 if len(code) != 0 { 3395 errorCode = restjson.SanitizeErrorCode(code) 3396 } 3397 3398 var buff [1024]byte 3399 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3400 3401 body := io.TeeReader(errorBody, ringBuffer) 3402 decoder := json.NewDecoder(body) 3403 decoder.UseNumber() 3404 code, message, err := restjson.GetErrorInfo(decoder) 3405 if err != nil { 3406 var snapshot bytes.Buffer 3407 io.Copy(&snapshot, ringBuffer) 3408 err = &smithy.DeserializationError{ 3409 Err: fmt.Errorf("failed to decode response body, %w", err), 3410 Snapshot: snapshot.Bytes(), 3411 } 3412 return err 3413 } 3414 3415 errorBody.Seek(0, io.SeekStart) 3416 if len(code) != 0 { 3417 errorCode = restjson.SanitizeErrorCode(code) 3418 } 3419 if len(message) != 0 { 3420 errorMessage = message 3421 } 3422 3423 switch { 3424 case strings.EqualFold("InternalServerException", errorCode): 3425 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 3426 3427 case strings.EqualFold("InvalidRequestException", errorCode): 3428 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 3429 3430 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 3431 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 3432 3433 case strings.EqualFold("UnsupportedLanguageException", errorCode): 3434 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 3435 3436 default: 3437 genericError := &smithy.GenericAPIError{ 3438 Code: errorCode, 3439 Message: errorMessage, 3440 } 3441 return genericError 3442 3443 } 3444} 3445 3446type awsAwsjson11_deserializeOpDetectSentiment struct { 3447} 3448 3449func (*awsAwsjson11_deserializeOpDetectSentiment) ID() string { 3450 return "OperationDeserializer" 3451} 3452 3453func (m *awsAwsjson11_deserializeOpDetectSentiment) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3454 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3455) { 3456 out, metadata, err = next.HandleDeserialize(ctx, in) 3457 if err != nil { 3458 return out, metadata, err 3459 } 3460 3461 response, ok := out.RawResponse.(*smithyhttp.Response) 3462 if !ok { 3463 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3464 } 3465 3466 if response.StatusCode < 200 || response.StatusCode >= 300 { 3467 return out, metadata, awsAwsjson11_deserializeOpErrorDetectSentiment(response, &metadata) 3468 } 3469 output := &DetectSentimentOutput{} 3470 out.Result = output 3471 3472 var buff [1024]byte 3473 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3474 3475 body := io.TeeReader(response.Body, ringBuffer) 3476 decoder := json.NewDecoder(body) 3477 decoder.UseNumber() 3478 var shape interface{} 3479 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3480 var snapshot bytes.Buffer 3481 io.Copy(&snapshot, ringBuffer) 3482 err = &smithy.DeserializationError{ 3483 Err: fmt.Errorf("failed to decode response body, %w", err), 3484 Snapshot: snapshot.Bytes(), 3485 } 3486 return out, metadata, err 3487 } 3488 3489 err = awsAwsjson11_deserializeOpDocumentDetectSentimentOutput(&output, shape) 3490 if err != nil { 3491 var snapshot bytes.Buffer 3492 io.Copy(&snapshot, ringBuffer) 3493 err = &smithy.DeserializationError{ 3494 Err: fmt.Errorf("failed to decode response body, %w", err), 3495 Snapshot: snapshot.Bytes(), 3496 } 3497 return out, metadata, err 3498 } 3499 3500 return out, metadata, err 3501} 3502 3503func awsAwsjson11_deserializeOpErrorDetectSentiment(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3504 var errorBuffer bytes.Buffer 3505 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3506 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3507 } 3508 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3509 3510 errorCode := "UnknownError" 3511 errorMessage := errorCode 3512 3513 code := response.Header.Get("X-Amzn-ErrorType") 3514 if len(code) != 0 { 3515 errorCode = restjson.SanitizeErrorCode(code) 3516 } 3517 3518 var buff [1024]byte 3519 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3520 3521 body := io.TeeReader(errorBody, ringBuffer) 3522 decoder := json.NewDecoder(body) 3523 decoder.UseNumber() 3524 code, message, err := restjson.GetErrorInfo(decoder) 3525 if err != nil { 3526 var snapshot bytes.Buffer 3527 io.Copy(&snapshot, ringBuffer) 3528 err = &smithy.DeserializationError{ 3529 Err: fmt.Errorf("failed to decode response body, %w", err), 3530 Snapshot: snapshot.Bytes(), 3531 } 3532 return err 3533 } 3534 3535 errorBody.Seek(0, io.SeekStart) 3536 if len(code) != 0 { 3537 errorCode = restjson.SanitizeErrorCode(code) 3538 } 3539 if len(message) != 0 { 3540 errorMessage = message 3541 } 3542 3543 switch { 3544 case strings.EqualFold("InternalServerException", errorCode): 3545 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 3546 3547 case strings.EqualFold("InvalidRequestException", errorCode): 3548 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 3549 3550 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 3551 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 3552 3553 case strings.EqualFold("UnsupportedLanguageException", errorCode): 3554 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 3555 3556 default: 3557 genericError := &smithy.GenericAPIError{ 3558 Code: errorCode, 3559 Message: errorMessage, 3560 } 3561 return genericError 3562 3563 } 3564} 3565 3566type awsAwsjson11_deserializeOpDetectSyntax struct { 3567} 3568 3569func (*awsAwsjson11_deserializeOpDetectSyntax) ID() string { 3570 return "OperationDeserializer" 3571} 3572 3573func (m *awsAwsjson11_deserializeOpDetectSyntax) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3574 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3575) { 3576 out, metadata, err = next.HandleDeserialize(ctx, in) 3577 if err != nil { 3578 return out, metadata, err 3579 } 3580 3581 response, ok := out.RawResponse.(*smithyhttp.Response) 3582 if !ok { 3583 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3584 } 3585 3586 if response.StatusCode < 200 || response.StatusCode >= 300 { 3587 return out, metadata, awsAwsjson11_deserializeOpErrorDetectSyntax(response, &metadata) 3588 } 3589 output := &DetectSyntaxOutput{} 3590 out.Result = output 3591 3592 var buff [1024]byte 3593 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3594 3595 body := io.TeeReader(response.Body, ringBuffer) 3596 decoder := json.NewDecoder(body) 3597 decoder.UseNumber() 3598 var shape interface{} 3599 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3600 var snapshot bytes.Buffer 3601 io.Copy(&snapshot, ringBuffer) 3602 err = &smithy.DeserializationError{ 3603 Err: fmt.Errorf("failed to decode response body, %w", err), 3604 Snapshot: snapshot.Bytes(), 3605 } 3606 return out, metadata, err 3607 } 3608 3609 err = awsAwsjson11_deserializeOpDocumentDetectSyntaxOutput(&output, shape) 3610 if err != nil { 3611 var snapshot bytes.Buffer 3612 io.Copy(&snapshot, ringBuffer) 3613 err = &smithy.DeserializationError{ 3614 Err: fmt.Errorf("failed to decode response body, %w", err), 3615 Snapshot: snapshot.Bytes(), 3616 } 3617 return out, metadata, err 3618 } 3619 3620 return out, metadata, err 3621} 3622 3623func awsAwsjson11_deserializeOpErrorDetectSyntax(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3624 var errorBuffer bytes.Buffer 3625 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3626 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3627 } 3628 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3629 3630 errorCode := "UnknownError" 3631 errorMessage := errorCode 3632 3633 code := response.Header.Get("X-Amzn-ErrorType") 3634 if len(code) != 0 { 3635 errorCode = restjson.SanitizeErrorCode(code) 3636 } 3637 3638 var buff [1024]byte 3639 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3640 3641 body := io.TeeReader(errorBody, ringBuffer) 3642 decoder := json.NewDecoder(body) 3643 decoder.UseNumber() 3644 code, message, err := restjson.GetErrorInfo(decoder) 3645 if err != nil { 3646 var snapshot bytes.Buffer 3647 io.Copy(&snapshot, ringBuffer) 3648 err = &smithy.DeserializationError{ 3649 Err: fmt.Errorf("failed to decode response body, %w", err), 3650 Snapshot: snapshot.Bytes(), 3651 } 3652 return err 3653 } 3654 3655 errorBody.Seek(0, io.SeekStart) 3656 if len(code) != 0 { 3657 errorCode = restjson.SanitizeErrorCode(code) 3658 } 3659 if len(message) != 0 { 3660 errorMessage = message 3661 } 3662 3663 switch { 3664 case strings.EqualFold("InternalServerException", errorCode): 3665 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 3666 3667 case strings.EqualFold("InvalidRequestException", errorCode): 3668 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 3669 3670 case strings.EqualFold("TextSizeLimitExceededException", errorCode): 3671 return awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response, errorBody) 3672 3673 case strings.EqualFold("UnsupportedLanguageException", errorCode): 3674 return awsAwsjson11_deserializeErrorUnsupportedLanguageException(response, errorBody) 3675 3676 default: 3677 genericError := &smithy.GenericAPIError{ 3678 Code: errorCode, 3679 Message: errorMessage, 3680 } 3681 return genericError 3682 3683 } 3684} 3685 3686type awsAwsjson11_deserializeOpListDocumentClassificationJobs struct { 3687} 3688 3689func (*awsAwsjson11_deserializeOpListDocumentClassificationJobs) ID() string { 3690 return "OperationDeserializer" 3691} 3692 3693func (m *awsAwsjson11_deserializeOpListDocumentClassificationJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3694 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3695) { 3696 out, metadata, err = next.HandleDeserialize(ctx, in) 3697 if err != nil { 3698 return out, metadata, err 3699 } 3700 3701 response, ok := out.RawResponse.(*smithyhttp.Response) 3702 if !ok { 3703 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3704 } 3705 3706 if response.StatusCode < 200 || response.StatusCode >= 300 { 3707 return out, metadata, awsAwsjson11_deserializeOpErrorListDocumentClassificationJobs(response, &metadata) 3708 } 3709 output := &ListDocumentClassificationJobsOutput{} 3710 out.Result = output 3711 3712 var buff [1024]byte 3713 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3714 3715 body := io.TeeReader(response.Body, ringBuffer) 3716 decoder := json.NewDecoder(body) 3717 decoder.UseNumber() 3718 var shape interface{} 3719 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3720 var snapshot bytes.Buffer 3721 io.Copy(&snapshot, ringBuffer) 3722 err = &smithy.DeserializationError{ 3723 Err: fmt.Errorf("failed to decode response body, %w", err), 3724 Snapshot: snapshot.Bytes(), 3725 } 3726 return out, metadata, err 3727 } 3728 3729 err = awsAwsjson11_deserializeOpDocumentListDocumentClassificationJobsOutput(&output, shape) 3730 if err != nil { 3731 var snapshot bytes.Buffer 3732 io.Copy(&snapshot, ringBuffer) 3733 err = &smithy.DeserializationError{ 3734 Err: fmt.Errorf("failed to decode response body, %w", err), 3735 Snapshot: snapshot.Bytes(), 3736 } 3737 return out, metadata, err 3738 } 3739 3740 return out, metadata, err 3741} 3742 3743func awsAwsjson11_deserializeOpErrorListDocumentClassificationJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3744 var errorBuffer bytes.Buffer 3745 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3746 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3747 } 3748 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3749 3750 errorCode := "UnknownError" 3751 errorMessage := errorCode 3752 3753 code := response.Header.Get("X-Amzn-ErrorType") 3754 if len(code) != 0 { 3755 errorCode = restjson.SanitizeErrorCode(code) 3756 } 3757 3758 var buff [1024]byte 3759 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3760 3761 body := io.TeeReader(errorBody, ringBuffer) 3762 decoder := json.NewDecoder(body) 3763 decoder.UseNumber() 3764 code, message, err := restjson.GetErrorInfo(decoder) 3765 if err != nil { 3766 var snapshot bytes.Buffer 3767 io.Copy(&snapshot, ringBuffer) 3768 err = &smithy.DeserializationError{ 3769 Err: fmt.Errorf("failed to decode response body, %w", err), 3770 Snapshot: snapshot.Bytes(), 3771 } 3772 return err 3773 } 3774 3775 errorBody.Seek(0, io.SeekStart) 3776 if len(code) != 0 { 3777 errorCode = restjson.SanitizeErrorCode(code) 3778 } 3779 if len(message) != 0 { 3780 errorMessage = message 3781 } 3782 3783 switch { 3784 case strings.EqualFold("InternalServerException", errorCode): 3785 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 3786 3787 case strings.EqualFold("InvalidFilterException", errorCode): 3788 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 3789 3790 case strings.EqualFold("InvalidRequestException", errorCode): 3791 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 3792 3793 case strings.EqualFold("TooManyRequestsException", errorCode): 3794 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 3795 3796 default: 3797 genericError := &smithy.GenericAPIError{ 3798 Code: errorCode, 3799 Message: errorMessage, 3800 } 3801 return genericError 3802 3803 } 3804} 3805 3806type awsAwsjson11_deserializeOpListDocumentClassifiers struct { 3807} 3808 3809func (*awsAwsjson11_deserializeOpListDocumentClassifiers) ID() string { 3810 return "OperationDeserializer" 3811} 3812 3813func (m *awsAwsjson11_deserializeOpListDocumentClassifiers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3814 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3815) { 3816 out, metadata, err = next.HandleDeserialize(ctx, in) 3817 if err != nil { 3818 return out, metadata, err 3819 } 3820 3821 response, ok := out.RawResponse.(*smithyhttp.Response) 3822 if !ok { 3823 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3824 } 3825 3826 if response.StatusCode < 200 || response.StatusCode >= 300 { 3827 return out, metadata, awsAwsjson11_deserializeOpErrorListDocumentClassifiers(response, &metadata) 3828 } 3829 output := &ListDocumentClassifiersOutput{} 3830 out.Result = output 3831 3832 var buff [1024]byte 3833 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3834 3835 body := io.TeeReader(response.Body, ringBuffer) 3836 decoder := json.NewDecoder(body) 3837 decoder.UseNumber() 3838 var shape interface{} 3839 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3840 var snapshot bytes.Buffer 3841 io.Copy(&snapshot, ringBuffer) 3842 err = &smithy.DeserializationError{ 3843 Err: fmt.Errorf("failed to decode response body, %w", err), 3844 Snapshot: snapshot.Bytes(), 3845 } 3846 return out, metadata, err 3847 } 3848 3849 err = awsAwsjson11_deserializeOpDocumentListDocumentClassifiersOutput(&output, shape) 3850 if err != nil { 3851 var snapshot bytes.Buffer 3852 io.Copy(&snapshot, ringBuffer) 3853 err = &smithy.DeserializationError{ 3854 Err: fmt.Errorf("failed to decode response body, %w", err), 3855 Snapshot: snapshot.Bytes(), 3856 } 3857 return out, metadata, err 3858 } 3859 3860 return out, metadata, err 3861} 3862 3863func awsAwsjson11_deserializeOpErrorListDocumentClassifiers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3864 var errorBuffer bytes.Buffer 3865 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3866 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3867 } 3868 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3869 3870 errorCode := "UnknownError" 3871 errorMessage := errorCode 3872 3873 code := response.Header.Get("X-Amzn-ErrorType") 3874 if len(code) != 0 { 3875 errorCode = restjson.SanitizeErrorCode(code) 3876 } 3877 3878 var buff [1024]byte 3879 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3880 3881 body := io.TeeReader(errorBody, ringBuffer) 3882 decoder := json.NewDecoder(body) 3883 decoder.UseNumber() 3884 code, message, err := restjson.GetErrorInfo(decoder) 3885 if err != nil { 3886 var snapshot bytes.Buffer 3887 io.Copy(&snapshot, ringBuffer) 3888 err = &smithy.DeserializationError{ 3889 Err: fmt.Errorf("failed to decode response body, %w", err), 3890 Snapshot: snapshot.Bytes(), 3891 } 3892 return err 3893 } 3894 3895 errorBody.Seek(0, io.SeekStart) 3896 if len(code) != 0 { 3897 errorCode = restjson.SanitizeErrorCode(code) 3898 } 3899 if len(message) != 0 { 3900 errorMessage = message 3901 } 3902 3903 switch { 3904 case strings.EqualFold("InternalServerException", errorCode): 3905 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 3906 3907 case strings.EqualFold("InvalidFilterException", errorCode): 3908 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 3909 3910 case strings.EqualFold("InvalidRequestException", errorCode): 3911 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 3912 3913 case strings.EqualFold("TooManyRequestsException", errorCode): 3914 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 3915 3916 default: 3917 genericError := &smithy.GenericAPIError{ 3918 Code: errorCode, 3919 Message: errorMessage, 3920 } 3921 return genericError 3922 3923 } 3924} 3925 3926type awsAwsjson11_deserializeOpListDominantLanguageDetectionJobs struct { 3927} 3928 3929func (*awsAwsjson11_deserializeOpListDominantLanguageDetectionJobs) ID() string { 3930 return "OperationDeserializer" 3931} 3932 3933func (m *awsAwsjson11_deserializeOpListDominantLanguageDetectionJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3934 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3935) { 3936 out, metadata, err = next.HandleDeserialize(ctx, in) 3937 if err != nil { 3938 return out, metadata, err 3939 } 3940 3941 response, ok := out.RawResponse.(*smithyhttp.Response) 3942 if !ok { 3943 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3944 } 3945 3946 if response.StatusCode < 200 || response.StatusCode >= 300 { 3947 return out, metadata, awsAwsjson11_deserializeOpErrorListDominantLanguageDetectionJobs(response, &metadata) 3948 } 3949 output := &ListDominantLanguageDetectionJobsOutput{} 3950 out.Result = output 3951 3952 var buff [1024]byte 3953 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3954 3955 body := io.TeeReader(response.Body, ringBuffer) 3956 decoder := json.NewDecoder(body) 3957 decoder.UseNumber() 3958 var shape interface{} 3959 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3960 var snapshot bytes.Buffer 3961 io.Copy(&snapshot, ringBuffer) 3962 err = &smithy.DeserializationError{ 3963 Err: fmt.Errorf("failed to decode response body, %w", err), 3964 Snapshot: snapshot.Bytes(), 3965 } 3966 return out, metadata, err 3967 } 3968 3969 err = awsAwsjson11_deserializeOpDocumentListDominantLanguageDetectionJobsOutput(&output, shape) 3970 if err != nil { 3971 var snapshot bytes.Buffer 3972 io.Copy(&snapshot, ringBuffer) 3973 err = &smithy.DeserializationError{ 3974 Err: fmt.Errorf("failed to decode response body, %w", err), 3975 Snapshot: snapshot.Bytes(), 3976 } 3977 return out, metadata, err 3978 } 3979 3980 return out, metadata, err 3981} 3982 3983func awsAwsjson11_deserializeOpErrorListDominantLanguageDetectionJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3984 var errorBuffer bytes.Buffer 3985 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3986 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3987 } 3988 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3989 3990 errorCode := "UnknownError" 3991 errorMessage := errorCode 3992 3993 code := response.Header.Get("X-Amzn-ErrorType") 3994 if len(code) != 0 { 3995 errorCode = restjson.SanitizeErrorCode(code) 3996 } 3997 3998 var buff [1024]byte 3999 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4000 4001 body := io.TeeReader(errorBody, ringBuffer) 4002 decoder := json.NewDecoder(body) 4003 decoder.UseNumber() 4004 code, message, err := restjson.GetErrorInfo(decoder) 4005 if err != nil { 4006 var snapshot bytes.Buffer 4007 io.Copy(&snapshot, ringBuffer) 4008 err = &smithy.DeserializationError{ 4009 Err: fmt.Errorf("failed to decode response body, %w", err), 4010 Snapshot: snapshot.Bytes(), 4011 } 4012 return err 4013 } 4014 4015 errorBody.Seek(0, io.SeekStart) 4016 if len(code) != 0 { 4017 errorCode = restjson.SanitizeErrorCode(code) 4018 } 4019 if len(message) != 0 { 4020 errorMessage = message 4021 } 4022 4023 switch { 4024 case strings.EqualFold("InternalServerException", errorCode): 4025 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4026 4027 case strings.EqualFold("InvalidFilterException", errorCode): 4028 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 4029 4030 case strings.EqualFold("InvalidRequestException", errorCode): 4031 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4032 4033 case strings.EqualFold("TooManyRequestsException", errorCode): 4034 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 4035 4036 default: 4037 genericError := &smithy.GenericAPIError{ 4038 Code: errorCode, 4039 Message: errorMessage, 4040 } 4041 return genericError 4042 4043 } 4044} 4045 4046type awsAwsjson11_deserializeOpListEndpoints struct { 4047} 4048 4049func (*awsAwsjson11_deserializeOpListEndpoints) ID() string { 4050 return "OperationDeserializer" 4051} 4052 4053func (m *awsAwsjson11_deserializeOpListEndpoints) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4054 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4055) { 4056 out, metadata, err = next.HandleDeserialize(ctx, in) 4057 if err != nil { 4058 return out, metadata, err 4059 } 4060 4061 response, ok := out.RawResponse.(*smithyhttp.Response) 4062 if !ok { 4063 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4064 } 4065 4066 if response.StatusCode < 200 || response.StatusCode >= 300 { 4067 return out, metadata, awsAwsjson11_deserializeOpErrorListEndpoints(response, &metadata) 4068 } 4069 output := &ListEndpointsOutput{} 4070 out.Result = output 4071 4072 var buff [1024]byte 4073 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4074 4075 body := io.TeeReader(response.Body, ringBuffer) 4076 decoder := json.NewDecoder(body) 4077 decoder.UseNumber() 4078 var shape interface{} 4079 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4080 var snapshot bytes.Buffer 4081 io.Copy(&snapshot, ringBuffer) 4082 err = &smithy.DeserializationError{ 4083 Err: fmt.Errorf("failed to decode response body, %w", err), 4084 Snapshot: snapshot.Bytes(), 4085 } 4086 return out, metadata, err 4087 } 4088 4089 err = awsAwsjson11_deserializeOpDocumentListEndpointsOutput(&output, shape) 4090 if err != nil { 4091 var snapshot bytes.Buffer 4092 io.Copy(&snapshot, ringBuffer) 4093 err = &smithy.DeserializationError{ 4094 Err: fmt.Errorf("failed to decode response body, %w", err), 4095 Snapshot: snapshot.Bytes(), 4096 } 4097 return out, metadata, err 4098 } 4099 4100 return out, metadata, err 4101} 4102 4103func awsAwsjson11_deserializeOpErrorListEndpoints(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4104 var errorBuffer bytes.Buffer 4105 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4106 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4107 } 4108 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4109 4110 errorCode := "UnknownError" 4111 errorMessage := errorCode 4112 4113 code := response.Header.Get("X-Amzn-ErrorType") 4114 if len(code) != 0 { 4115 errorCode = restjson.SanitizeErrorCode(code) 4116 } 4117 4118 var buff [1024]byte 4119 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4120 4121 body := io.TeeReader(errorBody, ringBuffer) 4122 decoder := json.NewDecoder(body) 4123 decoder.UseNumber() 4124 code, message, err := restjson.GetErrorInfo(decoder) 4125 if err != nil { 4126 var snapshot bytes.Buffer 4127 io.Copy(&snapshot, ringBuffer) 4128 err = &smithy.DeserializationError{ 4129 Err: fmt.Errorf("failed to decode response body, %w", err), 4130 Snapshot: snapshot.Bytes(), 4131 } 4132 return err 4133 } 4134 4135 errorBody.Seek(0, io.SeekStart) 4136 if len(code) != 0 { 4137 errorCode = restjson.SanitizeErrorCode(code) 4138 } 4139 if len(message) != 0 { 4140 errorMessage = message 4141 } 4142 4143 switch { 4144 case strings.EqualFold("InternalServerException", errorCode): 4145 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4146 4147 case strings.EqualFold("InvalidRequestException", errorCode): 4148 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4149 4150 case strings.EqualFold("TooManyRequestsException", errorCode): 4151 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 4152 4153 default: 4154 genericError := &smithy.GenericAPIError{ 4155 Code: errorCode, 4156 Message: errorMessage, 4157 } 4158 return genericError 4159 4160 } 4161} 4162 4163type awsAwsjson11_deserializeOpListEntitiesDetectionJobs struct { 4164} 4165 4166func (*awsAwsjson11_deserializeOpListEntitiesDetectionJobs) ID() string { 4167 return "OperationDeserializer" 4168} 4169 4170func (m *awsAwsjson11_deserializeOpListEntitiesDetectionJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4171 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4172) { 4173 out, metadata, err = next.HandleDeserialize(ctx, in) 4174 if err != nil { 4175 return out, metadata, err 4176 } 4177 4178 response, ok := out.RawResponse.(*smithyhttp.Response) 4179 if !ok { 4180 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4181 } 4182 4183 if response.StatusCode < 200 || response.StatusCode >= 300 { 4184 return out, metadata, awsAwsjson11_deserializeOpErrorListEntitiesDetectionJobs(response, &metadata) 4185 } 4186 output := &ListEntitiesDetectionJobsOutput{} 4187 out.Result = output 4188 4189 var buff [1024]byte 4190 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4191 4192 body := io.TeeReader(response.Body, ringBuffer) 4193 decoder := json.NewDecoder(body) 4194 decoder.UseNumber() 4195 var shape interface{} 4196 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4197 var snapshot bytes.Buffer 4198 io.Copy(&snapshot, ringBuffer) 4199 err = &smithy.DeserializationError{ 4200 Err: fmt.Errorf("failed to decode response body, %w", err), 4201 Snapshot: snapshot.Bytes(), 4202 } 4203 return out, metadata, err 4204 } 4205 4206 err = awsAwsjson11_deserializeOpDocumentListEntitiesDetectionJobsOutput(&output, shape) 4207 if err != nil { 4208 var snapshot bytes.Buffer 4209 io.Copy(&snapshot, ringBuffer) 4210 err = &smithy.DeserializationError{ 4211 Err: fmt.Errorf("failed to decode response body, %w", err), 4212 Snapshot: snapshot.Bytes(), 4213 } 4214 return out, metadata, err 4215 } 4216 4217 return out, metadata, err 4218} 4219 4220func awsAwsjson11_deserializeOpErrorListEntitiesDetectionJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4221 var errorBuffer bytes.Buffer 4222 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4223 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4224 } 4225 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4226 4227 errorCode := "UnknownError" 4228 errorMessage := errorCode 4229 4230 code := response.Header.Get("X-Amzn-ErrorType") 4231 if len(code) != 0 { 4232 errorCode = restjson.SanitizeErrorCode(code) 4233 } 4234 4235 var buff [1024]byte 4236 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4237 4238 body := io.TeeReader(errorBody, ringBuffer) 4239 decoder := json.NewDecoder(body) 4240 decoder.UseNumber() 4241 code, message, err := restjson.GetErrorInfo(decoder) 4242 if err != nil { 4243 var snapshot bytes.Buffer 4244 io.Copy(&snapshot, ringBuffer) 4245 err = &smithy.DeserializationError{ 4246 Err: fmt.Errorf("failed to decode response body, %w", err), 4247 Snapshot: snapshot.Bytes(), 4248 } 4249 return err 4250 } 4251 4252 errorBody.Seek(0, io.SeekStart) 4253 if len(code) != 0 { 4254 errorCode = restjson.SanitizeErrorCode(code) 4255 } 4256 if len(message) != 0 { 4257 errorMessage = message 4258 } 4259 4260 switch { 4261 case strings.EqualFold("InternalServerException", errorCode): 4262 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4263 4264 case strings.EqualFold("InvalidFilterException", errorCode): 4265 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 4266 4267 case strings.EqualFold("InvalidRequestException", errorCode): 4268 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4269 4270 case strings.EqualFold("TooManyRequestsException", errorCode): 4271 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 4272 4273 default: 4274 genericError := &smithy.GenericAPIError{ 4275 Code: errorCode, 4276 Message: errorMessage, 4277 } 4278 return genericError 4279 4280 } 4281} 4282 4283type awsAwsjson11_deserializeOpListEntityRecognizers struct { 4284} 4285 4286func (*awsAwsjson11_deserializeOpListEntityRecognizers) ID() string { 4287 return "OperationDeserializer" 4288} 4289 4290func (m *awsAwsjson11_deserializeOpListEntityRecognizers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4291 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4292) { 4293 out, metadata, err = next.HandleDeserialize(ctx, in) 4294 if err != nil { 4295 return out, metadata, err 4296 } 4297 4298 response, ok := out.RawResponse.(*smithyhttp.Response) 4299 if !ok { 4300 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4301 } 4302 4303 if response.StatusCode < 200 || response.StatusCode >= 300 { 4304 return out, metadata, awsAwsjson11_deserializeOpErrorListEntityRecognizers(response, &metadata) 4305 } 4306 output := &ListEntityRecognizersOutput{} 4307 out.Result = output 4308 4309 var buff [1024]byte 4310 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4311 4312 body := io.TeeReader(response.Body, ringBuffer) 4313 decoder := json.NewDecoder(body) 4314 decoder.UseNumber() 4315 var shape interface{} 4316 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4317 var snapshot bytes.Buffer 4318 io.Copy(&snapshot, ringBuffer) 4319 err = &smithy.DeserializationError{ 4320 Err: fmt.Errorf("failed to decode response body, %w", err), 4321 Snapshot: snapshot.Bytes(), 4322 } 4323 return out, metadata, err 4324 } 4325 4326 err = awsAwsjson11_deserializeOpDocumentListEntityRecognizersOutput(&output, shape) 4327 if err != nil { 4328 var snapshot bytes.Buffer 4329 io.Copy(&snapshot, ringBuffer) 4330 err = &smithy.DeserializationError{ 4331 Err: fmt.Errorf("failed to decode response body, %w", err), 4332 Snapshot: snapshot.Bytes(), 4333 } 4334 return out, metadata, err 4335 } 4336 4337 return out, metadata, err 4338} 4339 4340func awsAwsjson11_deserializeOpErrorListEntityRecognizers(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4341 var errorBuffer bytes.Buffer 4342 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4343 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4344 } 4345 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4346 4347 errorCode := "UnknownError" 4348 errorMessage := errorCode 4349 4350 code := response.Header.Get("X-Amzn-ErrorType") 4351 if len(code) != 0 { 4352 errorCode = restjson.SanitizeErrorCode(code) 4353 } 4354 4355 var buff [1024]byte 4356 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4357 4358 body := io.TeeReader(errorBody, ringBuffer) 4359 decoder := json.NewDecoder(body) 4360 decoder.UseNumber() 4361 code, message, err := restjson.GetErrorInfo(decoder) 4362 if err != nil { 4363 var snapshot bytes.Buffer 4364 io.Copy(&snapshot, ringBuffer) 4365 err = &smithy.DeserializationError{ 4366 Err: fmt.Errorf("failed to decode response body, %w", err), 4367 Snapshot: snapshot.Bytes(), 4368 } 4369 return err 4370 } 4371 4372 errorBody.Seek(0, io.SeekStart) 4373 if len(code) != 0 { 4374 errorCode = restjson.SanitizeErrorCode(code) 4375 } 4376 if len(message) != 0 { 4377 errorMessage = message 4378 } 4379 4380 switch { 4381 case strings.EqualFold("InternalServerException", errorCode): 4382 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4383 4384 case strings.EqualFold("InvalidFilterException", errorCode): 4385 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 4386 4387 case strings.EqualFold("InvalidRequestException", errorCode): 4388 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4389 4390 case strings.EqualFold("TooManyRequestsException", errorCode): 4391 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 4392 4393 default: 4394 genericError := &smithy.GenericAPIError{ 4395 Code: errorCode, 4396 Message: errorMessage, 4397 } 4398 return genericError 4399 4400 } 4401} 4402 4403type awsAwsjson11_deserializeOpListEventsDetectionJobs struct { 4404} 4405 4406func (*awsAwsjson11_deserializeOpListEventsDetectionJobs) ID() string { 4407 return "OperationDeserializer" 4408} 4409 4410func (m *awsAwsjson11_deserializeOpListEventsDetectionJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4411 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4412) { 4413 out, metadata, err = next.HandleDeserialize(ctx, in) 4414 if err != nil { 4415 return out, metadata, err 4416 } 4417 4418 response, ok := out.RawResponse.(*smithyhttp.Response) 4419 if !ok { 4420 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4421 } 4422 4423 if response.StatusCode < 200 || response.StatusCode >= 300 { 4424 return out, metadata, awsAwsjson11_deserializeOpErrorListEventsDetectionJobs(response, &metadata) 4425 } 4426 output := &ListEventsDetectionJobsOutput{} 4427 out.Result = output 4428 4429 var buff [1024]byte 4430 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4431 4432 body := io.TeeReader(response.Body, ringBuffer) 4433 decoder := json.NewDecoder(body) 4434 decoder.UseNumber() 4435 var shape interface{} 4436 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4437 var snapshot bytes.Buffer 4438 io.Copy(&snapshot, ringBuffer) 4439 err = &smithy.DeserializationError{ 4440 Err: fmt.Errorf("failed to decode response body, %w", err), 4441 Snapshot: snapshot.Bytes(), 4442 } 4443 return out, metadata, err 4444 } 4445 4446 err = awsAwsjson11_deserializeOpDocumentListEventsDetectionJobsOutput(&output, shape) 4447 if err != nil { 4448 var snapshot bytes.Buffer 4449 io.Copy(&snapshot, ringBuffer) 4450 err = &smithy.DeserializationError{ 4451 Err: fmt.Errorf("failed to decode response body, %w", err), 4452 Snapshot: snapshot.Bytes(), 4453 } 4454 return out, metadata, err 4455 } 4456 4457 return out, metadata, err 4458} 4459 4460func awsAwsjson11_deserializeOpErrorListEventsDetectionJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4461 var errorBuffer bytes.Buffer 4462 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4463 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4464 } 4465 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4466 4467 errorCode := "UnknownError" 4468 errorMessage := errorCode 4469 4470 code := response.Header.Get("X-Amzn-ErrorType") 4471 if len(code) != 0 { 4472 errorCode = restjson.SanitizeErrorCode(code) 4473 } 4474 4475 var buff [1024]byte 4476 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4477 4478 body := io.TeeReader(errorBody, ringBuffer) 4479 decoder := json.NewDecoder(body) 4480 decoder.UseNumber() 4481 code, message, err := restjson.GetErrorInfo(decoder) 4482 if err != nil { 4483 var snapshot bytes.Buffer 4484 io.Copy(&snapshot, ringBuffer) 4485 err = &smithy.DeserializationError{ 4486 Err: fmt.Errorf("failed to decode response body, %w", err), 4487 Snapshot: snapshot.Bytes(), 4488 } 4489 return err 4490 } 4491 4492 errorBody.Seek(0, io.SeekStart) 4493 if len(code) != 0 { 4494 errorCode = restjson.SanitizeErrorCode(code) 4495 } 4496 if len(message) != 0 { 4497 errorMessage = message 4498 } 4499 4500 switch { 4501 case strings.EqualFold("InternalServerException", errorCode): 4502 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4503 4504 case strings.EqualFold("InvalidFilterException", errorCode): 4505 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 4506 4507 case strings.EqualFold("InvalidRequestException", errorCode): 4508 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4509 4510 case strings.EqualFold("TooManyRequestsException", errorCode): 4511 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 4512 4513 default: 4514 genericError := &smithy.GenericAPIError{ 4515 Code: errorCode, 4516 Message: errorMessage, 4517 } 4518 return genericError 4519 4520 } 4521} 4522 4523type awsAwsjson11_deserializeOpListKeyPhrasesDetectionJobs struct { 4524} 4525 4526func (*awsAwsjson11_deserializeOpListKeyPhrasesDetectionJobs) ID() string { 4527 return "OperationDeserializer" 4528} 4529 4530func (m *awsAwsjson11_deserializeOpListKeyPhrasesDetectionJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4531 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4532) { 4533 out, metadata, err = next.HandleDeserialize(ctx, in) 4534 if err != nil { 4535 return out, metadata, err 4536 } 4537 4538 response, ok := out.RawResponse.(*smithyhttp.Response) 4539 if !ok { 4540 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4541 } 4542 4543 if response.StatusCode < 200 || response.StatusCode >= 300 { 4544 return out, metadata, awsAwsjson11_deserializeOpErrorListKeyPhrasesDetectionJobs(response, &metadata) 4545 } 4546 output := &ListKeyPhrasesDetectionJobsOutput{} 4547 out.Result = output 4548 4549 var buff [1024]byte 4550 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4551 4552 body := io.TeeReader(response.Body, ringBuffer) 4553 decoder := json.NewDecoder(body) 4554 decoder.UseNumber() 4555 var shape interface{} 4556 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4557 var snapshot bytes.Buffer 4558 io.Copy(&snapshot, ringBuffer) 4559 err = &smithy.DeserializationError{ 4560 Err: fmt.Errorf("failed to decode response body, %w", err), 4561 Snapshot: snapshot.Bytes(), 4562 } 4563 return out, metadata, err 4564 } 4565 4566 err = awsAwsjson11_deserializeOpDocumentListKeyPhrasesDetectionJobsOutput(&output, shape) 4567 if err != nil { 4568 var snapshot bytes.Buffer 4569 io.Copy(&snapshot, ringBuffer) 4570 err = &smithy.DeserializationError{ 4571 Err: fmt.Errorf("failed to decode response body, %w", err), 4572 Snapshot: snapshot.Bytes(), 4573 } 4574 return out, metadata, err 4575 } 4576 4577 return out, metadata, err 4578} 4579 4580func awsAwsjson11_deserializeOpErrorListKeyPhrasesDetectionJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4581 var errorBuffer bytes.Buffer 4582 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4583 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4584 } 4585 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4586 4587 errorCode := "UnknownError" 4588 errorMessage := errorCode 4589 4590 code := response.Header.Get("X-Amzn-ErrorType") 4591 if len(code) != 0 { 4592 errorCode = restjson.SanitizeErrorCode(code) 4593 } 4594 4595 var buff [1024]byte 4596 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4597 4598 body := io.TeeReader(errorBody, ringBuffer) 4599 decoder := json.NewDecoder(body) 4600 decoder.UseNumber() 4601 code, message, err := restjson.GetErrorInfo(decoder) 4602 if err != nil { 4603 var snapshot bytes.Buffer 4604 io.Copy(&snapshot, ringBuffer) 4605 err = &smithy.DeserializationError{ 4606 Err: fmt.Errorf("failed to decode response body, %w", err), 4607 Snapshot: snapshot.Bytes(), 4608 } 4609 return err 4610 } 4611 4612 errorBody.Seek(0, io.SeekStart) 4613 if len(code) != 0 { 4614 errorCode = restjson.SanitizeErrorCode(code) 4615 } 4616 if len(message) != 0 { 4617 errorMessage = message 4618 } 4619 4620 switch { 4621 case strings.EqualFold("InternalServerException", errorCode): 4622 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4623 4624 case strings.EqualFold("InvalidFilterException", errorCode): 4625 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 4626 4627 case strings.EqualFold("InvalidRequestException", errorCode): 4628 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4629 4630 case strings.EqualFold("TooManyRequestsException", errorCode): 4631 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 4632 4633 default: 4634 genericError := &smithy.GenericAPIError{ 4635 Code: errorCode, 4636 Message: errorMessage, 4637 } 4638 return genericError 4639 4640 } 4641} 4642 4643type awsAwsjson11_deserializeOpListPiiEntitiesDetectionJobs struct { 4644} 4645 4646func (*awsAwsjson11_deserializeOpListPiiEntitiesDetectionJobs) ID() string { 4647 return "OperationDeserializer" 4648} 4649 4650func (m *awsAwsjson11_deserializeOpListPiiEntitiesDetectionJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4651 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4652) { 4653 out, metadata, err = next.HandleDeserialize(ctx, in) 4654 if err != nil { 4655 return out, metadata, err 4656 } 4657 4658 response, ok := out.RawResponse.(*smithyhttp.Response) 4659 if !ok { 4660 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4661 } 4662 4663 if response.StatusCode < 200 || response.StatusCode >= 300 { 4664 return out, metadata, awsAwsjson11_deserializeOpErrorListPiiEntitiesDetectionJobs(response, &metadata) 4665 } 4666 output := &ListPiiEntitiesDetectionJobsOutput{} 4667 out.Result = output 4668 4669 var buff [1024]byte 4670 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4671 4672 body := io.TeeReader(response.Body, ringBuffer) 4673 decoder := json.NewDecoder(body) 4674 decoder.UseNumber() 4675 var shape interface{} 4676 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4677 var snapshot bytes.Buffer 4678 io.Copy(&snapshot, ringBuffer) 4679 err = &smithy.DeserializationError{ 4680 Err: fmt.Errorf("failed to decode response body, %w", err), 4681 Snapshot: snapshot.Bytes(), 4682 } 4683 return out, metadata, err 4684 } 4685 4686 err = awsAwsjson11_deserializeOpDocumentListPiiEntitiesDetectionJobsOutput(&output, shape) 4687 if err != nil { 4688 var snapshot bytes.Buffer 4689 io.Copy(&snapshot, ringBuffer) 4690 err = &smithy.DeserializationError{ 4691 Err: fmt.Errorf("failed to decode response body, %w", err), 4692 Snapshot: snapshot.Bytes(), 4693 } 4694 return out, metadata, err 4695 } 4696 4697 return out, metadata, err 4698} 4699 4700func awsAwsjson11_deserializeOpErrorListPiiEntitiesDetectionJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4701 var errorBuffer bytes.Buffer 4702 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4703 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4704 } 4705 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4706 4707 errorCode := "UnknownError" 4708 errorMessage := errorCode 4709 4710 code := response.Header.Get("X-Amzn-ErrorType") 4711 if len(code) != 0 { 4712 errorCode = restjson.SanitizeErrorCode(code) 4713 } 4714 4715 var buff [1024]byte 4716 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4717 4718 body := io.TeeReader(errorBody, ringBuffer) 4719 decoder := json.NewDecoder(body) 4720 decoder.UseNumber() 4721 code, message, err := restjson.GetErrorInfo(decoder) 4722 if err != nil { 4723 var snapshot bytes.Buffer 4724 io.Copy(&snapshot, ringBuffer) 4725 err = &smithy.DeserializationError{ 4726 Err: fmt.Errorf("failed to decode response body, %w", err), 4727 Snapshot: snapshot.Bytes(), 4728 } 4729 return err 4730 } 4731 4732 errorBody.Seek(0, io.SeekStart) 4733 if len(code) != 0 { 4734 errorCode = restjson.SanitizeErrorCode(code) 4735 } 4736 if len(message) != 0 { 4737 errorMessage = message 4738 } 4739 4740 switch { 4741 case strings.EqualFold("InternalServerException", errorCode): 4742 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4743 4744 case strings.EqualFold("InvalidFilterException", errorCode): 4745 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 4746 4747 case strings.EqualFold("InvalidRequestException", errorCode): 4748 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4749 4750 case strings.EqualFold("TooManyRequestsException", errorCode): 4751 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 4752 4753 default: 4754 genericError := &smithy.GenericAPIError{ 4755 Code: errorCode, 4756 Message: errorMessage, 4757 } 4758 return genericError 4759 4760 } 4761} 4762 4763type awsAwsjson11_deserializeOpListSentimentDetectionJobs struct { 4764} 4765 4766func (*awsAwsjson11_deserializeOpListSentimentDetectionJobs) ID() string { 4767 return "OperationDeserializer" 4768} 4769 4770func (m *awsAwsjson11_deserializeOpListSentimentDetectionJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4771 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4772) { 4773 out, metadata, err = next.HandleDeserialize(ctx, in) 4774 if err != nil { 4775 return out, metadata, err 4776 } 4777 4778 response, ok := out.RawResponse.(*smithyhttp.Response) 4779 if !ok { 4780 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4781 } 4782 4783 if response.StatusCode < 200 || response.StatusCode >= 300 { 4784 return out, metadata, awsAwsjson11_deserializeOpErrorListSentimentDetectionJobs(response, &metadata) 4785 } 4786 output := &ListSentimentDetectionJobsOutput{} 4787 out.Result = output 4788 4789 var buff [1024]byte 4790 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4791 4792 body := io.TeeReader(response.Body, ringBuffer) 4793 decoder := json.NewDecoder(body) 4794 decoder.UseNumber() 4795 var shape interface{} 4796 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4797 var snapshot bytes.Buffer 4798 io.Copy(&snapshot, ringBuffer) 4799 err = &smithy.DeserializationError{ 4800 Err: fmt.Errorf("failed to decode response body, %w", err), 4801 Snapshot: snapshot.Bytes(), 4802 } 4803 return out, metadata, err 4804 } 4805 4806 err = awsAwsjson11_deserializeOpDocumentListSentimentDetectionJobsOutput(&output, shape) 4807 if err != nil { 4808 var snapshot bytes.Buffer 4809 io.Copy(&snapshot, ringBuffer) 4810 err = &smithy.DeserializationError{ 4811 Err: fmt.Errorf("failed to decode response body, %w", err), 4812 Snapshot: snapshot.Bytes(), 4813 } 4814 return out, metadata, err 4815 } 4816 4817 return out, metadata, err 4818} 4819 4820func awsAwsjson11_deserializeOpErrorListSentimentDetectionJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4821 var errorBuffer bytes.Buffer 4822 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4823 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4824 } 4825 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4826 4827 errorCode := "UnknownError" 4828 errorMessage := errorCode 4829 4830 code := response.Header.Get("X-Amzn-ErrorType") 4831 if len(code) != 0 { 4832 errorCode = restjson.SanitizeErrorCode(code) 4833 } 4834 4835 var buff [1024]byte 4836 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4837 4838 body := io.TeeReader(errorBody, ringBuffer) 4839 decoder := json.NewDecoder(body) 4840 decoder.UseNumber() 4841 code, message, err := restjson.GetErrorInfo(decoder) 4842 if err != nil { 4843 var snapshot bytes.Buffer 4844 io.Copy(&snapshot, ringBuffer) 4845 err = &smithy.DeserializationError{ 4846 Err: fmt.Errorf("failed to decode response body, %w", err), 4847 Snapshot: snapshot.Bytes(), 4848 } 4849 return err 4850 } 4851 4852 errorBody.Seek(0, io.SeekStart) 4853 if len(code) != 0 { 4854 errorCode = restjson.SanitizeErrorCode(code) 4855 } 4856 if len(message) != 0 { 4857 errorMessage = message 4858 } 4859 4860 switch { 4861 case strings.EqualFold("InternalServerException", errorCode): 4862 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4863 4864 case strings.EqualFold("InvalidFilterException", errorCode): 4865 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 4866 4867 case strings.EqualFold("InvalidRequestException", errorCode): 4868 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4869 4870 case strings.EqualFold("TooManyRequestsException", errorCode): 4871 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 4872 4873 default: 4874 genericError := &smithy.GenericAPIError{ 4875 Code: errorCode, 4876 Message: errorMessage, 4877 } 4878 return genericError 4879 4880 } 4881} 4882 4883type awsAwsjson11_deserializeOpListTagsForResource struct { 4884} 4885 4886func (*awsAwsjson11_deserializeOpListTagsForResource) ID() string { 4887 return "OperationDeserializer" 4888} 4889 4890func (m *awsAwsjson11_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4891 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4892) { 4893 out, metadata, err = next.HandleDeserialize(ctx, in) 4894 if err != nil { 4895 return out, metadata, err 4896 } 4897 4898 response, ok := out.RawResponse.(*smithyhttp.Response) 4899 if !ok { 4900 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4901 } 4902 4903 if response.StatusCode < 200 || response.StatusCode >= 300 { 4904 return out, metadata, awsAwsjson11_deserializeOpErrorListTagsForResource(response, &metadata) 4905 } 4906 output := &ListTagsForResourceOutput{} 4907 out.Result = output 4908 4909 var buff [1024]byte 4910 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4911 4912 body := io.TeeReader(response.Body, ringBuffer) 4913 decoder := json.NewDecoder(body) 4914 decoder.UseNumber() 4915 var shape interface{} 4916 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4917 var snapshot bytes.Buffer 4918 io.Copy(&snapshot, ringBuffer) 4919 err = &smithy.DeserializationError{ 4920 Err: fmt.Errorf("failed to decode response body, %w", err), 4921 Snapshot: snapshot.Bytes(), 4922 } 4923 return out, metadata, err 4924 } 4925 4926 err = awsAwsjson11_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 4927 if err != nil { 4928 var snapshot bytes.Buffer 4929 io.Copy(&snapshot, ringBuffer) 4930 err = &smithy.DeserializationError{ 4931 Err: fmt.Errorf("failed to decode response body, %w", err), 4932 Snapshot: snapshot.Bytes(), 4933 } 4934 return out, metadata, err 4935 } 4936 4937 return out, metadata, err 4938} 4939 4940func awsAwsjson11_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4941 var errorBuffer bytes.Buffer 4942 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4943 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4944 } 4945 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4946 4947 errorCode := "UnknownError" 4948 errorMessage := errorCode 4949 4950 code := response.Header.Get("X-Amzn-ErrorType") 4951 if len(code) != 0 { 4952 errorCode = restjson.SanitizeErrorCode(code) 4953 } 4954 4955 var buff [1024]byte 4956 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4957 4958 body := io.TeeReader(errorBody, ringBuffer) 4959 decoder := json.NewDecoder(body) 4960 decoder.UseNumber() 4961 code, message, err := restjson.GetErrorInfo(decoder) 4962 if err != nil { 4963 var snapshot bytes.Buffer 4964 io.Copy(&snapshot, ringBuffer) 4965 err = &smithy.DeserializationError{ 4966 Err: fmt.Errorf("failed to decode response body, %w", err), 4967 Snapshot: snapshot.Bytes(), 4968 } 4969 return err 4970 } 4971 4972 errorBody.Seek(0, io.SeekStart) 4973 if len(code) != 0 { 4974 errorCode = restjson.SanitizeErrorCode(code) 4975 } 4976 if len(message) != 0 { 4977 errorMessage = message 4978 } 4979 4980 switch { 4981 case strings.EqualFold("InternalServerException", errorCode): 4982 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 4983 4984 case strings.EqualFold("InvalidRequestException", errorCode): 4985 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 4986 4987 case strings.EqualFold("ResourceNotFoundException", errorCode): 4988 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 4989 4990 default: 4991 genericError := &smithy.GenericAPIError{ 4992 Code: errorCode, 4993 Message: errorMessage, 4994 } 4995 return genericError 4996 4997 } 4998} 4999 5000type awsAwsjson11_deserializeOpListTopicsDetectionJobs struct { 5001} 5002 5003func (*awsAwsjson11_deserializeOpListTopicsDetectionJobs) ID() string { 5004 return "OperationDeserializer" 5005} 5006 5007func (m *awsAwsjson11_deserializeOpListTopicsDetectionJobs) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5008 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5009) { 5010 out, metadata, err = next.HandleDeserialize(ctx, in) 5011 if err != nil { 5012 return out, metadata, err 5013 } 5014 5015 response, ok := out.RawResponse.(*smithyhttp.Response) 5016 if !ok { 5017 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5018 } 5019 5020 if response.StatusCode < 200 || response.StatusCode >= 300 { 5021 return out, metadata, awsAwsjson11_deserializeOpErrorListTopicsDetectionJobs(response, &metadata) 5022 } 5023 output := &ListTopicsDetectionJobsOutput{} 5024 out.Result = output 5025 5026 var buff [1024]byte 5027 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5028 5029 body := io.TeeReader(response.Body, ringBuffer) 5030 decoder := json.NewDecoder(body) 5031 decoder.UseNumber() 5032 var shape interface{} 5033 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5034 var snapshot bytes.Buffer 5035 io.Copy(&snapshot, ringBuffer) 5036 err = &smithy.DeserializationError{ 5037 Err: fmt.Errorf("failed to decode response body, %w", err), 5038 Snapshot: snapshot.Bytes(), 5039 } 5040 return out, metadata, err 5041 } 5042 5043 err = awsAwsjson11_deserializeOpDocumentListTopicsDetectionJobsOutput(&output, shape) 5044 if err != nil { 5045 var snapshot bytes.Buffer 5046 io.Copy(&snapshot, ringBuffer) 5047 err = &smithy.DeserializationError{ 5048 Err: fmt.Errorf("failed to decode response body, %w", err), 5049 Snapshot: snapshot.Bytes(), 5050 } 5051 return out, metadata, err 5052 } 5053 5054 return out, metadata, err 5055} 5056 5057func awsAwsjson11_deserializeOpErrorListTopicsDetectionJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5058 var errorBuffer bytes.Buffer 5059 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5060 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5061 } 5062 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5063 5064 errorCode := "UnknownError" 5065 errorMessage := errorCode 5066 5067 code := response.Header.Get("X-Amzn-ErrorType") 5068 if len(code) != 0 { 5069 errorCode = restjson.SanitizeErrorCode(code) 5070 } 5071 5072 var buff [1024]byte 5073 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5074 5075 body := io.TeeReader(errorBody, ringBuffer) 5076 decoder := json.NewDecoder(body) 5077 decoder.UseNumber() 5078 code, message, err := restjson.GetErrorInfo(decoder) 5079 if err != nil { 5080 var snapshot bytes.Buffer 5081 io.Copy(&snapshot, ringBuffer) 5082 err = &smithy.DeserializationError{ 5083 Err: fmt.Errorf("failed to decode response body, %w", err), 5084 Snapshot: snapshot.Bytes(), 5085 } 5086 return err 5087 } 5088 5089 errorBody.Seek(0, io.SeekStart) 5090 if len(code) != 0 { 5091 errorCode = restjson.SanitizeErrorCode(code) 5092 } 5093 if len(message) != 0 { 5094 errorMessage = message 5095 } 5096 5097 switch { 5098 case strings.EqualFold("InternalServerException", errorCode): 5099 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 5100 5101 case strings.EqualFold("InvalidFilterException", errorCode): 5102 return awsAwsjson11_deserializeErrorInvalidFilterException(response, errorBody) 5103 5104 case strings.EqualFold("InvalidRequestException", errorCode): 5105 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 5106 5107 case strings.EqualFold("TooManyRequestsException", errorCode): 5108 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 5109 5110 default: 5111 genericError := &smithy.GenericAPIError{ 5112 Code: errorCode, 5113 Message: errorMessage, 5114 } 5115 return genericError 5116 5117 } 5118} 5119 5120type awsAwsjson11_deserializeOpStartDocumentClassificationJob struct { 5121} 5122 5123func (*awsAwsjson11_deserializeOpStartDocumentClassificationJob) ID() string { 5124 return "OperationDeserializer" 5125} 5126 5127func (m *awsAwsjson11_deserializeOpStartDocumentClassificationJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5128 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5129) { 5130 out, metadata, err = next.HandleDeserialize(ctx, in) 5131 if err != nil { 5132 return out, metadata, err 5133 } 5134 5135 response, ok := out.RawResponse.(*smithyhttp.Response) 5136 if !ok { 5137 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5138 } 5139 5140 if response.StatusCode < 200 || response.StatusCode >= 300 { 5141 return out, metadata, awsAwsjson11_deserializeOpErrorStartDocumentClassificationJob(response, &metadata) 5142 } 5143 output := &StartDocumentClassificationJobOutput{} 5144 out.Result = output 5145 5146 var buff [1024]byte 5147 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5148 5149 body := io.TeeReader(response.Body, ringBuffer) 5150 decoder := json.NewDecoder(body) 5151 decoder.UseNumber() 5152 var shape interface{} 5153 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5154 var snapshot bytes.Buffer 5155 io.Copy(&snapshot, ringBuffer) 5156 err = &smithy.DeserializationError{ 5157 Err: fmt.Errorf("failed to decode response body, %w", err), 5158 Snapshot: snapshot.Bytes(), 5159 } 5160 return out, metadata, err 5161 } 5162 5163 err = awsAwsjson11_deserializeOpDocumentStartDocumentClassificationJobOutput(&output, shape) 5164 if err != nil { 5165 var snapshot bytes.Buffer 5166 io.Copy(&snapshot, ringBuffer) 5167 err = &smithy.DeserializationError{ 5168 Err: fmt.Errorf("failed to decode response body, %w", err), 5169 Snapshot: snapshot.Bytes(), 5170 } 5171 return out, metadata, err 5172 } 5173 5174 return out, metadata, err 5175} 5176 5177func awsAwsjson11_deserializeOpErrorStartDocumentClassificationJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5178 var errorBuffer bytes.Buffer 5179 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5180 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5181 } 5182 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5183 5184 errorCode := "UnknownError" 5185 errorMessage := errorCode 5186 5187 code := response.Header.Get("X-Amzn-ErrorType") 5188 if len(code) != 0 { 5189 errorCode = restjson.SanitizeErrorCode(code) 5190 } 5191 5192 var buff [1024]byte 5193 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5194 5195 body := io.TeeReader(errorBody, ringBuffer) 5196 decoder := json.NewDecoder(body) 5197 decoder.UseNumber() 5198 code, message, err := restjson.GetErrorInfo(decoder) 5199 if err != nil { 5200 var snapshot bytes.Buffer 5201 io.Copy(&snapshot, ringBuffer) 5202 err = &smithy.DeserializationError{ 5203 Err: fmt.Errorf("failed to decode response body, %w", err), 5204 Snapshot: snapshot.Bytes(), 5205 } 5206 return err 5207 } 5208 5209 errorBody.Seek(0, io.SeekStart) 5210 if len(code) != 0 { 5211 errorCode = restjson.SanitizeErrorCode(code) 5212 } 5213 if len(message) != 0 { 5214 errorMessage = message 5215 } 5216 5217 switch { 5218 case strings.EqualFold("InternalServerException", errorCode): 5219 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 5220 5221 case strings.EqualFold("InvalidRequestException", errorCode): 5222 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 5223 5224 case strings.EqualFold("KmsKeyValidationException", errorCode): 5225 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 5226 5227 case strings.EqualFold("ResourceNotFoundException", errorCode): 5228 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 5229 5230 case strings.EqualFold("ResourceUnavailableException", errorCode): 5231 return awsAwsjson11_deserializeErrorResourceUnavailableException(response, errorBody) 5232 5233 case strings.EqualFold("TooManyRequestsException", errorCode): 5234 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 5235 5236 case strings.EqualFold("TooManyTagsException", errorCode): 5237 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 5238 5239 default: 5240 genericError := &smithy.GenericAPIError{ 5241 Code: errorCode, 5242 Message: errorMessage, 5243 } 5244 return genericError 5245 5246 } 5247} 5248 5249type awsAwsjson11_deserializeOpStartDominantLanguageDetectionJob struct { 5250} 5251 5252func (*awsAwsjson11_deserializeOpStartDominantLanguageDetectionJob) ID() string { 5253 return "OperationDeserializer" 5254} 5255 5256func (m *awsAwsjson11_deserializeOpStartDominantLanguageDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5257 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5258) { 5259 out, metadata, err = next.HandleDeserialize(ctx, in) 5260 if err != nil { 5261 return out, metadata, err 5262 } 5263 5264 response, ok := out.RawResponse.(*smithyhttp.Response) 5265 if !ok { 5266 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5267 } 5268 5269 if response.StatusCode < 200 || response.StatusCode >= 300 { 5270 return out, metadata, awsAwsjson11_deserializeOpErrorStartDominantLanguageDetectionJob(response, &metadata) 5271 } 5272 output := &StartDominantLanguageDetectionJobOutput{} 5273 out.Result = output 5274 5275 var buff [1024]byte 5276 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5277 5278 body := io.TeeReader(response.Body, ringBuffer) 5279 decoder := json.NewDecoder(body) 5280 decoder.UseNumber() 5281 var shape interface{} 5282 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5283 var snapshot bytes.Buffer 5284 io.Copy(&snapshot, ringBuffer) 5285 err = &smithy.DeserializationError{ 5286 Err: fmt.Errorf("failed to decode response body, %w", err), 5287 Snapshot: snapshot.Bytes(), 5288 } 5289 return out, metadata, err 5290 } 5291 5292 err = awsAwsjson11_deserializeOpDocumentStartDominantLanguageDetectionJobOutput(&output, shape) 5293 if err != nil { 5294 var snapshot bytes.Buffer 5295 io.Copy(&snapshot, ringBuffer) 5296 err = &smithy.DeserializationError{ 5297 Err: fmt.Errorf("failed to decode response body, %w", err), 5298 Snapshot: snapshot.Bytes(), 5299 } 5300 return out, metadata, err 5301 } 5302 5303 return out, metadata, err 5304} 5305 5306func awsAwsjson11_deserializeOpErrorStartDominantLanguageDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5307 var errorBuffer bytes.Buffer 5308 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5309 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5310 } 5311 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5312 5313 errorCode := "UnknownError" 5314 errorMessage := errorCode 5315 5316 code := response.Header.Get("X-Amzn-ErrorType") 5317 if len(code) != 0 { 5318 errorCode = restjson.SanitizeErrorCode(code) 5319 } 5320 5321 var buff [1024]byte 5322 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5323 5324 body := io.TeeReader(errorBody, ringBuffer) 5325 decoder := json.NewDecoder(body) 5326 decoder.UseNumber() 5327 code, message, err := restjson.GetErrorInfo(decoder) 5328 if err != nil { 5329 var snapshot bytes.Buffer 5330 io.Copy(&snapshot, ringBuffer) 5331 err = &smithy.DeserializationError{ 5332 Err: fmt.Errorf("failed to decode response body, %w", err), 5333 Snapshot: snapshot.Bytes(), 5334 } 5335 return err 5336 } 5337 5338 errorBody.Seek(0, io.SeekStart) 5339 if len(code) != 0 { 5340 errorCode = restjson.SanitizeErrorCode(code) 5341 } 5342 if len(message) != 0 { 5343 errorMessage = message 5344 } 5345 5346 switch { 5347 case strings.EqualFold("InternalServerException", errorCode): 5348 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 5349 5350 case strings.EqualFold("InvalidRequestException", errorCode): 5351 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 5352 5353 case strings.EqualFold("KmsKeyValidationException", errorCode): 5354 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 5355 5356 case strings.EqualFold("TooManyRequestsException", errorCode): 5357 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 5358 5359 case strings.EqualFold("TooManyTagsException", errorCode): 5360 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 5361 5362 default: 5363 genericError := &smithy.GenericAPIError{ 5364 Code: errorCode, 5365 Message: errorMessage, 5366 } 5367 return genericError 5368 5369 } 5370} 5371 5372type awsAwsjson11_deserializeOpStartEntitiesDetectionJob struct { 5373} 5374 5375func (*awsAwsjson11_deserializeOpStartEntitiesDetectionJob) ID() string { 5376 return "OperationDeserializer" 5377} 5378 5379func (m *awsAwsjson11_deserializeOpStartEntitiesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5380 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5381) { 5382 out, metadata, err = next.HandleDeserialize(ctx, in) 5383 if err != nil { 5384 return out, metadata, err 5385 } 5386 5387 response, ok := out.RawResponse.(*smithyhttp.Response) 5388 if !ok { 5389 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5390 } 5391 5392 if response.StatusCode < 200 || response.StatusCode >= 300 { 5393 return out, metadata, awsAwsjson11_deserializeOpErrorStartEntitiesDetectionJob(response, &metadata) 5394 } 5395 output := &StartEntitiesDetectionJobOutput{} 5396 out.Result = output 5397 5398 var buff [1024]byte 5399 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5400 5401 body := io.TeeReader(response.Body, ringBuffer) 5402 decoder := json.NewDecoder(body) 5403 decoder.UseNumber() 5404 var shape interface{} 5405 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5406 var snapshot bytes.Buffer 5407 io.Copy(&snapshot, ringBuffer) 5408 err = &smithy.DeserializationError{ 5409 Err: fmt.Errorf("failed to decode response body, %w", err), 5410 Snapshot: snapshot.Bytes(), 5411 } 5412 return out, metadata, err 5413 } 5414 5415 err = awsAwsjson11_deserializeOpDocumentStartEntitiesDetectionJobOutput(&output, shape) 5416 if err != nil { 5417 var snapshot bytes.Buffer 5418 io.Copy(&snapshot, ringBuffer) 5419 err = &smithy.DeserializationError{ 5420 Err: fmt.Errorf("failed to decode response body, %w", err), 5421 Snapshot: snapshot.Bytes(), 5422 } 5423 return out, metadata, err 5424 } 5425 5426 return out, metadata, err 5427} 5428 5429func awsAwsjson11_deserializeOpErrorStartEntitiesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5430 var errorBuffer bytes.Buffer 5431 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5432 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5433 } 5434 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5435 5436 errorCode := "UnknownError" 5437 errorMessage := errorCode 5438 5439 code := response.Header.Get("X-Amzn-ErrorType") 5440 if len(code) != 0 { 5441 errorCode = restjson.SanitizeErrorCode(code) 5442 } 5443 5444 var buff [1024]byte 5445 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5446 5447 body := io.TeeReader(errorBody, ringBuffer) 5448 decoder := json.NewDecoder(body) 5449 decoder.UseNumber() 5450 code, message, err := restjson.GetErrorInfo(decoder) 5451 if err != nil { 5452 var snapshot bytes.Buffer 5453 io.Copy(&snapshot, ringBuffer) 5454 err = &smithy.DeserializationError{ 5455 Err: fmt.Errorf("failed to decode response body, %w", err), 5456 Snapshot: snapshot.Bytes(), 5457 } 5458 return err 5459 } 5460 5461 errorBody.Seek(0, io.SeekStart) 5462 if len(code) != 0 { 5463 errorCode = restjson.SanitizeErrorCode(code) 5464 } 5465 if len(message) != 0 { 5466 errorMessage = message 5467 } 5468 5469 switch { 5470 case strings.EqualFold("InternalServerException", errorCode): 5471 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 5472 5473 case strings.EqualFold("InvalidRequestException", errorCode): 5474 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 5475 5476 case strings.EqualFold("KmsKeyValidationException", errorCode): 5477 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 5478 5479 case strings.EqualFold("ResourceNotFoundException", errorCode): 5480 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 5481 5482 case strings.EqualFold("ResourceUnavailableException", errorCode): 5483 return awsAwsjson11_deserializeErrorResourceUnavailableException(response, errorBody) 5484 5485 case strings.EqualFold("TooManyRequestsException", errorCode): 5486 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 5487 5488 case strings.EqualFold("TooManyTagsException", errorCode): 5489 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 5490 5491 default: 5492 genericError := &smithy.GenericAPIError{ 5493 Code: errorCode, 5494 Message: errorMessage, 5495 } 5496 return genericError 5497 5498 } 5499} 5500 5501type awsAwsjson11_deserializeOpStartEventsDetectionJob struct { 5502} 5503 5504func (*awsAwsjson11_deserializeOpStartEventsDetectionJob) ID() string { 5505 return "OperationDeserializer" 5506} 5507 5508func (m *awsAwsjson11_deserializeOpStartEventsDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5509 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5510) { 5511 out, metadata, err = next.HandleDeserialize(ctx, in) 5512 if err != nil { 5513 return out, metadata, err 5514 } 5515 5516 response, ok := out.RawResponse.(*smithyhttp.Response) 5517 if !ok { 5518 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5519 } 5520 5521 if response.StatusCode < 200 || response.StatusCode >= 300 { 5522 return out, metadata, awsAwsjson11_deserializeOpErrorStartEventsDetectionJob(response, &metadata) 5523 } 5524 output := &StartEventsDetectionJobOutput{} 5525 out.Result = output 5526 5527 var buff [1024]byte 5528 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5529 5530 body := io.TeeReader(response.Body, ringBuffer) 5531 decoder := json.NewDecoder(body) 5532 decoder.UseNumber() 5533 var shape interface{} 5534 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5535 var snapshot bytes.Buffer 5536 io.Copy(&snapshot, ringBuffer) 5537 err = &smithy.DeserializationError{ 5538 Err: fmt.Errorf("failed to decode response body, %w", err), 5539 Snapshot: snapshot.Bytes(), 5540 } 5541 return out, metadata, err 5542 } 5543 5544 err = awsAwsjson11_deserializeOpDocumentStartEventsDetectionJobOutput(&output, shape) 5545 if err != nil { 5546 var snapshot bytes.Buffer 5547 io.Copy(&snapshot, ringBuffer) 5548 err = &smithy.DeserializationError{ 5549 Err: fmt.Errorf("failed to decode response body, %w", err), 5550 Snapshot: snapshot.Bytes(), 5551 } 5552 return out, metadata, err 5553 } 5554 5555 return out, metadata, err 5556} 5557 5558func awsAwsjson11_deserializeOpErrorStartEventsDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5559 var errorBuffer bytes.Buffer 5560 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5561 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5562 } 5563 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5564 5565 errorCode := "UnknownError" 5566 errorMessage := errorCode 5567 5568 code := response.Header.Get("X-Amzn-ErrorType") 5569 if len(code) != 0 { 5570 errorCode = restjson.SanitizeErrorCode(code) 5571 } 5572 5573 var buff [1024]byte 5574 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5575 5576 body := io.TeeReader(errorBody, ringBuffer) 5577 decoder := json.NewDecoder(body) 5578 decoder.UseNumber() 5579 code, message, err := restjson.GetErrorInfo(decoder) 5580 if err != nil { 5581 var snapshot bytes.Buffer 5582 io.Copy(&snapshot, ringBuffer) 5583 err = &smithy.DeserializationError{ 5584 Err: fmt.Errorf("failed to decode response body, %w", err), 5585 Snapshot: snapshot.Bytes(), 5586 } 5587 return err 5588 } 5589 5590 errorBody.Seek(0, io.SeekStart) 5591 if len(code) != 0 { 5592 errorCode = restjson.SanitizeErrorCode(code) 5593 } 5594 if len(message) != 0 { 5595 errorMessage = message 5596 } 5597 5598 switch { 5599 case strings.EqualFold("InternalServerException", errorCode): 5600 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 5601 5602 case strings.EqualFold("InvalidRequestException", errorCode): 5603 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 5604 5605 case strings.EqualFold("KmsKeyValidationException", errorCode): 5606 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 5607 5608 case strings.EqualFold("TooManyRequestsException", errorCode): 5609 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 5610 5611 case strings.EqualFold("TooManyTagsException", errorCode): 5612 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 5613 5614 default: 5615 genericError := &smithy.GenericAPIError{ 5616 Code: errorCode, 5617 Message: errorMessage, 5618 } 5619 return genericError 5620 5621 } 5622} 5623 5624type awsAwsjson11_deserializeOpStartKeyPhrasesDetectionJob struct { 5625} 5626 5627func (*awsAwsjson11_deserializeOpStartKeyPhrasesDetectionJob) ID() string { 5628 return "OperationDeserializer" 5629} 5630 5631func (m *awsAwsjson11_deserializeOpStartKeyPhrasesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5632 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5633) { 5634 out, metadata, err = next.HandleDeserialize(ctx, in) 5635 if err != nil { 5636 return out, metadata, err 5637 } 5638 5639 response, ok := out.RawResponse.(*smithyhttp.Response) 5640 if !ok { 5641 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5642 } 5643 5644 if response.StatusCode < 200 || response.StatusCode >= 300 { 5645 return out, metadata, awsAwsjson11_deserializeOpErrorStartKeyPhrasesDetectionJob(response, &metadata) 5646 } 5647 output := &StartKeyPhrasesDetectionJobOutput{} 5648 out.Result = output 5649 5650 var buff [1024]byte 5651 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5652 5653 body := io.TeeReader(response.Body, ringBuffer) 5654 decoder := json.NewDecoder(body) 5655 decoder.UseNumber() 5656 var shape interface{} 5657 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5658 var snapshot bytes.Buffer 5659 io.Copy(&snapshot, ringBuffer) 5660 err = &smithy.DeserializationError{ 5661 Err: fmt.Errorf("failed to decode response body, %w", err), 5662 Snapshot: snapshot.Bytes(), 5663 } 5664 return out, metadata, err 5665 } 5666 5667 err = awsAwsjson11_deserializeOpDocumentStartKeyPhrasesDetectionJobOutput(&output, shape) 5668 if err != nil { 5669 var snapshot bytes.Buffer 5670 io.Copy(&snapshot, ringBuffer) 5671 err = &smithy.DeserializationError{ 5672 Err: fmt.Errorf("failed to decode response body, %w", err), 5673 Snapshot: snapshot.Bytes(), 5674 } 5675 return out, metadata, err 5676 } 5677 5678 return out, metadata, err 5679} 5680 5681func awsAwsjson11_deserializeOpErrorStartKeyPhrasesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5682 var errorBuffer bytes.Buffer 5683 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5684 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5685 } 5686 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5687 5688 errorCode := "UnknownError" 5689 errorMessage := errorCode 5690 5691 code := response.Header.Get("X-Amzn-ErrorType") 5692 if len(code) != 0 { 5693 errorCode = restjson.SanitizeErrorCode(code) 5694 } 5695 5696 var buff [1024]byte 5697 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5698 5699 body := io.TeeReader(errorBody, ringBuffer) 5700 decoder := json.NewDecoder(body) 5701 decoder.UseNumber() 5702 code, message, err := restjson.GetErrorInfo(decoder) 5703 if err != nil { 5704 var snapshot bytes.Buffer 5705 io.Copy(&snapshot, ringBuffer) 5706 err = &smithy.DeserializationError{ 5707 Err: fmt.Errorf("failed to decode response body, %w", err), 5708 Snapshot: snapshot.Bytes(), 5709 } 5710 return err 5711 } 5712 5713 errorBody.Seek(0, io.SeekStart) 5714 if len(code) != 0 { 5715 errorCode = restjson.SanitizeErrorCode(code) 5716 } 5717 if len(message) != 0 { 5718 errorMessage = message 5719 } 5720 5721 switch { 5722 case strings.EqualFold("InternalServerException", errorCode): 5723 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 5724 5725 case strings.EqualFold("InvalidRequestException", errorCode): 5726 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 5727 5728 case strings.EqualFold("KmsKeyValidationException", errorCode): 5729 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 5730 5731 case strings.EqualFold("TooManyRequestsException", errorCode): 5732 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 5733 5734 case strings.EqualFold("TooManyTagsException", errorCode): 5735 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 5736 5737 default: 5738 genericError := &smithy.GenericAPIError{ 5739 Code: errorCode, 5740 Message: errorMessage, 5741 } 5742 return genericError 5743 5744 } 5745} 5746 5747type awsAwsjson11_deserializeOpStartPiiEntitiesDetectionJob struct { 5748} 5749 5750func (*awsAwsjson11_deserializeOpStartPiiEntitiesDetectionJob) ID() string { 5751 return "OperationDeserializer" 5752} 5753 5754func (m *awsAwsjson11_deserializeOpStartPiiEntitiesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5755 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5756) { 5757 out, metadata, err = next.HandleDeserialize(ctx, in) 5758 if err != nil { 5759 return out, metadata, err 5760 } 5761 5762 response, ok := out.RawResponse.(*smithyhttp.Response) 5763 if !ok { 5764 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5765 } 5766 5767 if response.StatusCode < 200 || response.StatusCode >= 300 { 5768 return out, metadata, awsAwsjson11_deserializeOpErrorStartPiiEntitiesDetectionJob(response, &metadata) 5769 } 5770 output := &StartPiiEntitiesDetectionJobOutput{} 5771 out.Result = output 5772 5773 var buff [1024]byte 5774 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5775 5776 body := io.TeeReader(response.Body, ringBuffer) 5777 decoder := json.NewDecoder(body) 5778 decoder.UseNumber() 5779 var shape interface{} 5780 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5781 var snapshot bytes.Buffer 5782 io.Copy(&snapshot, ringBuffer) 5783 err = &smithy.DeserializationError{ 5784 Err: fmt.Errorf("failed to decode response body, %w", err), 5785 Snapshot: snapshot.Bytes(), 5786 } 5787 return out, metadata, err 5788 } 5789 5790 err = awsAwsjson11_deserializeOpDocumentStartPiiEntitiesDetectionJobOutput(&output, shape) 5791 if err != nil { 5792 var snapshot bytes.Buffer 5793 io.Copy(&snapshot, ringBuffer) 5794 err = &smithy.DeserializationError{ 5795 Err: fmt.Errorf("failed to decode response body, %w", err), 5796 Snapshot: snapshot.Bytes(), 5797 } 5798 return out, metadata, err 5799 } 5800 5801 return out, metadata, err 5802} 5803 5804func awsAwsjson11_deserializeOpErrorStartPiiEntitiesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5805 var errorBuffer bytes.Buffer 5806 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5807 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5808 } 5809 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5810 5811 errorCode := "UnknownError" 5812 errorMessage := errorCode 5813 5814 code := response.Header.Get("X-Amzn-ErrorType") 5815 if len(code) != 0 { 5816 errorCode = restjson.SanitizeErrorCode(code) 5817 } 5818 5819 var buff [1024]byte 5820 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5821 5822 body := io.TeeReader(errorBody, ringBuffer) 5823 decoder := json.NewDecoder(body) 5824 decoder.UseNumber() 5825 code, message, err := restjson.GetErrorInfo(decoder) 5826 if err != nil { 5827 var snapshot bytes.Buffer 5828 io.Copy(&snapshot, ringBuffer) 5829 err = &smithy.DeserializationError{ 5830 Err: fmt.Errorf("failed to decode response body, %w", err), 5831 Snapshot: snapshot.Bytes(), 5832 } 5833 return err 5834 } 5835 5836 errorBody.Seek(0, io.SeekStart) 5837 if len(code) != 0 { 5838 errorCode = restjson.SanitizeErrorCode(code) 5839 } 5840 if len(message) != 0 { 5841 errorMessage = message 5842 } 5843 5844 switch { 5845 case strings.EqualFold("InternalServerException", errorCode): 5846 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 5847 5848 case strings.EqualFold("InvalidRequestException", errorCode): 5849 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 5850 5851 case strings.EqualFold("KmsKeyValidationException", errorCode): 5852 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 5853 5854 case strings.EqualFold("TooManyRequestsException", errorCode): 5855 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 5856 5857 case strings.EqualFold("TooManyTagsException", errorCode): 5858 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 5859 5860 default: 5861 genericError := &smithy.GenericAPIError{ 5862 Code: errorCode, 5863 Message: errorMessage, 5864 } 5865 return genericError 5866 5867 } 5868} 5869 5870type awsAwsjson11_deserializeOpStartSentimentDetectionJob struct { 5871} 5872 5873func (*awsAwsjson11_deserializeOpStartSentimentDetectionJob) ID() string { 5874 return "OperationDeserializer" 5875} 5876 5877func (m *awsAwsjson11_deserializeOpStartSentimentDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5878 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5879) { 5880 out, metadata, err = next.HandleDeserialize(ctx, in) 5881 if err != nil { 5882 return out, metadata, err 5883 } 5884 5885 response, ok := out.RawResponse.(*smithyhttp.Response) 5886 if !ok { 5887 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5888 } 5889 5890 if response.StatusCode < 200 || response.StatusCode >= 300 { 5891 return out, metadata, awsAwsjson11_deserializeOpErrorStartSentimentDetectionJob(response, &metadata) 5892 } 5893 output := &StartSentimentDetectionJobOutput{} 5894 out.Result = output 5895 5896 var buff [1024]byte 5897 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5898 5899 body := io.TeeReader(response.Body, ringBuffer) 5900 decoder := json.NewDecoder(body) 5901 decoder.UseNumber() 5902 var shape interface{} 5903 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5904 var snapshot bytes.Buffer 5905 io.Copy(&snapshot, ringBuffer) 5906 err = &smithy.DeserializationError{ 5907 Err: fmt.Errorf("failed to decode response body, %w", err), 5908 Snapshot: snapshot.Bytes(), 5909 } 5910 return out, metadata, err 5911 } 5912 5913 err = awsAwsjson11_deserializeOpDocumentStartSentimentDetectionJobOutput(&output, shape) 5914 if err != nil { 5915 var snapshot bytes.Buffer 5916 io.Copy(&snapshot, ringBuffer) 5917 err = &smithy.DeserializationError{ 5918 Err: fmt.Errorf("failed to decode response body, %w", err), 5919 Snapshot: snapshot.Bytes(), 5920 } 5921 return out, metadata, err 5922 } 5923 5924 return out, metadata, err 5925} 5926 5927func awsAwsjson11_deserializeOpErrorStartSentimentDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5928 var errorBuffer bytes.Buffer 5929 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5930 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5931 } 5932 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5933 5934 errorCode := "UnknownError" 5935 errorMessage := errorCode 5936 5937 code := response.Header.Get("X-Amzn-ErrorType") 5938 if len(code) != 0 { 5939 errorCode = restjson.SanitizeErrorCode(code) 5940 } 5941 5942 var buff [1024]byte 5943 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5944 5945 body := io.TeeReader(errorBody, ringBuffer) 5946 decoder := json.NewDecoder(body) 5947 decoder.UseNumber() 5948 code, message, err := restjson.GetErrorInfo(decoder) 5949 if err != nil { 5950 var snapshot bytes.Buffer 5951 io.Copy(&snapshot, ringBuffer) 5952 err = &smithy.DeserializationError{ 5953 Err: fmt.Errorf("failed to decode response body, %w", err), 5954 Snapshot: snapshot.Bytes(), 5955 } 5956 return err 5957 } 5958 5959 errorBody.Seek(0, io.SeekStart) 5960 if len(code) != 0 { 5961 errorCode = restjson.SanitizeErrorCode(code) 5962 } 5963 if len(message) != 0 { 5964 errorMessage = message 5965 } 5966 5967 switch { 5968 case strings.EqualFold("InternalServerException", errorCode): 5969 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 5970 5971 case strings.EqualFold("InvalidRequestException", errorCode): 5972 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 5973 5974 case strings.EqualFold("KmsKeyValidationException", errorCode): 5975 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 5976 5977 case strings.EqualFold("TooManyRequestsException", errorCode): 5978 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 5979 5980 case strings.EqualFold("TooManyTagsException", errorCode): 5981 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 5982 5983 default: 5984 genericError := &smithy.GenericAPIError{ 5985 Code: errorCode, 5986 Message: errorMessage, 5987 } 5988 return genericError 5989 5990 } 5991} 5992 5993type awsAwsjson11_deserializeOpStartTopicsDetectionJob struct { 5994} 5995 5996func (*awsAwsjson11_deserializeOpStartTopicsDetectionJob) ID() string { 5997 return "OperationDeserializer" 5998} 5999 6000func (m *awsAwsjson11_deserializeOpStartTopicsDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6001 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6002) { 6003 out, metadata, err = next.HandleDeserialize(ctx, in) 6004 if err != nil { 6005 return out, metadata, err 6006 } 6007 6008 response, ok := out.RawResponse.(*smithyhttp.Response) 6009 if !ok { 6010 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6011 } 6012 6013 if response.StatusCode < 200 || response.StatusCode >= 300 { 6014 return out, metadata, awsAwsjson11_deserializeOpErrorStartTopicsDetectionJob(response, &metadata) 6015 } 6016 output := &StartTopicsDetectionJobOutput{} 6017 out.Result = output 6018 6019 var buff [1024]byte 6020 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6021 6022 body := io.TeeReader(response.Body, ringBuffer) 6023 decoder := json.NewDecoder(body) 6024 decoder.UseNumber() 6025 var shape interface{} 6026 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6027 var snapshot bytes.Buffer 6028 io.Copy(&snapshot, ringBuffer) 6029 err = &smithy.DeserializationError{ 6030 Err: fmt.Errorf("failed to decode response body, %w", err), 6031 Snapshot: snapshot.Bytes(), 6032 } 6033 return out, metadata, err 6034 } 6035 6036 err = awsAwsjson11_deserializeOpDocumentStartTopicsDetectionJobOutput(&output, shape) 6037 if err != nil { 6038 var snapshot bytes.Buffer 6039 io.Copy(&snapshot, ringBuffer) 6040 err = &smithy.DeserializationError{ 6041 Err: fmt.Errorf("failed to decode response body, %w", err), 6042 Snapshot: snapshot.Bytes(), 6043 } 6044 return out, metadata, err 6045 } 6046 6047 return out, metadata, err 6048} 6049 6050func awsAwsjson11_deserializeOpErrorStartTopicsDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6051 var errorBuffer bytes.Buffer 6052 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6053 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6054 } 6055 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6056 6057 errorCode := "UnknownError" 6058 errorMessage := errorCode 6059 6060 code := response.Header.Get("X-Amzn-ErrorType") 6061 if len(code) != 0 { 6062 errorCode = restjson.SanitizeErrorCode(code) 6063 } 6064 6065 var buff [1024]byte 6066 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6067 6068 body := io.TeeReader(errorBody, ringBuffer) 6069 decoder := json.NewDecoder(body) 6070 decoder.UseNumber() 6071 code, message, err := restjson.GetErrorInfo(decoder) 6072 if err != nil { 6073 var snapshot bytes.Buffer 6074 io.Copy(&snapshot, ringBuffer) 6075 err = &smithy.DeserializationError{ 6076 Err: fmt.Errorf("failed to decode response body, %w", err), 6077 Snapshot: snapshot.Bytes(), 6078 } 6079 return err 6080 } 6081 6082 errorBody.Seek(0, io.SeekStart) 6083 if len(code) != 0 { 6084 errorCode = restjson.SanitizeErrorCode(code) 6085 } 6086 if len(message) != 0 { 6087 errorMessage = message 6088 } 6089 6090 switch { 6091 case strings.EqualFold("InternalServerException", errorCode): 6092 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 6093 6094 case strings.EqualFold("InvalidRequestException", errorCode): 6095 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 6096 6097 case strings.EqualFold("KmsKeyValidationException", errorCode): 6098 return awsAwsjson11_deserializeErrorKmsKeyValidationException(response, errorBody) 6099 6100 case strings.EqualFold("TooManyRequestsException", errorCode): 6101 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 6102 6103 case strings.EqualFold("TooManyTagsException", errorCode): 6104 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 6105 6106 default: 6107 genericError := &smithy.GenericAPIError{ 6108 Code: errorCode, 6109 Message: errorMessage, 6110 } 6111 return genericError 6112 6113 } 6114} 6115 6116type awsAwsjson11_deserializeOpStopDominantLanguageDetectionJob struct { 6117} 6118 6119func (*awsAwsjson11_deserializeOpStopDominantLanguageDetectionJob) ID() string { 6120 return "OperationDeserializer" 6121} 6122 6123func (m *awsAwsjson11_deserializeOpStopDominantLanguageDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6124 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6125) { 6126 out, metadata, err = next.HandleDeserialize(ctx, in) 6127 if err != nil { 6128 return out, metadata, err 6129 } 6130 6131 response, ok := out.RawResponse.(*smithyhttp.Response) 6132 if !ok { 6133 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6134 } 6135 6136 if response.StatusCode < 200 || response.StatusCode >= 300 { 6137 return out, metadata, awsAwsjson11_deserializeOpErrorStopDominantLanguageDetectionJob(response, &metadata) 6138 } 6139 output := &StopDominantLanguageDetectionJobOutput{} 6140 out.Result = output 6141 6142 var buff [1024]byte 6143 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6144 6145 body := io.TeeReader(response.Body, ringBuffer) 6146 decoder := json.NewDecoder(body) 6147 decoder.UseNumber() 6148 var shape interface{} 6149 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6150 var snapshot bytes.Buffer 6151 io.Copy(&snapshot, ringBuffer) 6152 err = &smithy.DeserializationError{ 6153 Err: fmt.Errorf("failed to decode response body, %w", err), 6154 Snapshot: snapshot.Bytes(), 6155 } 6156 return out, metadata, err 6157 } 6158 6159 err = awsAwsjson11_deserializeOpDocumentStopDominantLanguageDetectionJobOutput(&output, shape) 6160 if err != nil { 6161 var snapshot bytes.Buffer 6162 io.Copy(&snapshot, ringBuffer) 6163 err = &smithy.DeserializationError{ 6164 Err: fmt.Errorf("failed to decode response body, %w", err), 6165 Snapshot: snapshot.Bytes(), 6166 } 6167 return out, metadata, err 6168 } 6169 6170 return out, metadata, err 6171} 6172 6173func awsAwsjson11_deserializeOpErrorStopDominantLanguageDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6174 var errorBuffer bytes.Buffer 6175 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6176 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6177 } 6178 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6179 6180 errorCode := "UnknownError" 6181 errorMessage := errorCode 6182 6183 code := response.Header.Get("X-Amzn-ErrorType") 6184 if len(code) != 0 { 6185 errorCode = restjson.SanitizeErrorCode(code) 6186 } 6187 6188 var buff [1024]byte 6189 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6190 6191 body := io.TeeReader(errorBody, ringBuffer) 6192 decoder := json.NewDecoder(body) 6193 decoder.UseNumber() 6194 code, message, err := restjson.GetErrorInfo(decoder) 6195 if err != nil { 6196 var snapshot bytes.Buffer 6197 io.Copy(&snapshot, ringBuffer) 6198 err = &smithy.DeserializationError{ 6199 Err: fmt.Errorf("failed to decode response body, %w", err), 6200 Snapshot: snapshot.Bytes(), 6201 } 6202 return err 6203 } 6204 6205 errorBody.Seek(0, io.SeekStart) 6206 if len(code) != 0 { 6207 errorCode = restjson.SanitizeErrorCode(code) 6208 } 6209 if len(message) != 0 { 6210 errorMessage = message 6211 } 6212 6213 switch { 6214 case strings.EqualFold("InternalServerException", errorCode): 6215 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 6216 6217 case strings.EqualFold("InvalidRequestException", errorCode): 6218 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 6219 6220 case strings.EqualFold("JobNotFoundException", errorCode): 6221 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 6222 6223 default: 6224 genericError := &smithy.GenericAPIError{ 6225 Code: errorCode, 6226 Message: errorMessage, 6227 } 6228 return genericError 6229 6230 } 6231} 6232 6233type awsAwsjson11_deserializeOpStopEntitiesDetectionJob struct { 6234} 6235 6236func (*awsAwsjson11_deserializeOpStopEntitiesDetectionJob) ID() string { 6237 return "OperationDeserializer" 6238} 6239 6240func (m *awsAwsjson11_deserializeOpStopEntitiesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6241 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6242) { 6243 out, metadata, err = next.HandleDeserialize(ctx, in) 6244 if err != nil { 6245 return out, metadata, err 6246 } 6247 6248 response, ok := out.RawResponse.(*smithyhttp.Response) 6249 if !ok { 6250 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6251 } 6252 6253 if response.StatusCode < 200 || response.StatusCode >= 300 { 6254 return out, metadata, awsAwsjson11_deserializeOpErrorStopEntitiesDetectionJob(response, &metadata) 6255 } 6256 output := &StopEntitiesDetectionJobOutput{} 6257 out.Result = output 6258 6259 var buff [1024]byte 6260 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6261 6262 body := io.TeeReader(response.Body, ringBuffer) 6263 decoder := json.NewDecoder(body) 6264 decoder.UseNumber() 6265 var shape interface{} 6266 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6267 var snapshot bytes.Buffer 6268 io.Copy(&snapshot, ringBuffer) 6269 err = &smithy.DeserializationError{ 6270 Err: fmt.Errorf("failed to decode response body, %w", err), 6271 Snapshot: snapshot.Bytes(), 6272 } 6273 return out, metadata, err 6274 } 6275 6276 err = awsAwsjson11_deserializeOpDocumentStopEntitiesDetectionJobOutput(&output, shape) 6277 if err != nil { 6278 var snapshot bytes.Buffer 6279 io.Copy(&snapshot, ringBuffer) 6280 err = &smithy.DeserializationError{ 6281 Err: fmt.Errorf("failed to decode response body, %w", err), 6282 Snapshot: snapshot.Bytes(), 6283 } 6284 return out, metadata, err 6285 } 6286 6287 return out, metadata, err 6288} 6289 6290func awsAwsjson11_deserializeOpErrorStopEntitiesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6291 var errorBuffer bytes.Buffer 6292 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6293 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6294 } 6295 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6296 6297 errorCode := "UnknownError" 6298 errorMessage := errorCode 6299 6300 code := response.Header.Get("X-Amzn-ErrorType") 6301 if len(code) != 0 { 6302 errorCode = restjson.SanitizeErrorCode(code) 6303 } 6304 6305 var buff [1024]byte 6306 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6307 6308 body := io.TeeReader(errorBody, ringBuffer) 6309 decoder := json.NewDecoder(body) 6310 decoder.UseNumber() 6311 code, message, err := restjson.GetErrorInfo(decoder) 6312 if err != nil { 6313 var snapshot bytes.Buffer 6314 io.Copy(&snapshot, ringBuffer) 6315 err = &smithy.DeserializationError{ 6316 Err: fmt.Errorf("failed to decode response body, %w", err), 6317 Snapshot: snapshot.Bytes(), 6318 } 6319 return err 6320 } 6321 6322 errorBody.Seek(0, io.SeekStart) 6323 if len(code) != 0 { 6324 errorCode = restjson.SanitizeErrorCode(code) 6325 } 6326 if len(message) != 0 { 6327 errorMessage = message 6328 } 6329 6330 switch { 6331 case strings.EqualFold("InternalServerException", errorCode): 6332 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 6333 6334 case strings.EqualFold("InvalidRequestException", errorCode): 6335 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 6336 6337 case strings.EqualFold("JobNotFoundException", errorCode): 6338 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 6339 6340 default: 6341 genericError := &smithy.GenericAPIError{ 6342 Code: errorCode, 6343 Message: errorMessage, 6344 } 6345 return genericError 6346 6347 } 6348} 6349 6350type awsAwsjson11_deserializeOpStopEventsDetectionJob struct { 6351} 6352 6353func (*awsAwsjson11_deserializeOpStopEventsDetectionJob) ID() string { 6354 return "OperationDeserializer" 6355} 6356 6357func (m *awsAwsjson11_deserializeOpStopEventsDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6358 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6359) { 6360 out, metadata, err = next.HandleDeserialize(ctx, in) 6361 if err != nil { 6362 return out, metadata, err 6363 } 6364 6365 response, ok := out.RawResponse.(*smithyhttp.Response) 6366 if !ok { 6367 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6368 } 6369 6370 if response.StatusCode < 200 || response.StatusCode >= 300 { 6371 return out, metadata, awsAwsjson11_deserializeOpErrorStopEventsDetectionJob(response, &metadata) 6372 } 6373 output := &StopEventsDetectionJobOutput{} 6374 out.Result = output 6375 6376 var buff [1024]byte 6377 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6378 6379 body := io.TeeReader(response.Body, ringBuffer) 6380 decoder := json.NewDecoder(body) 6381 decoder.UseNumber() 6382 var shape interface{} 6383 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6384 var snapshot bytes.Buffer 6385 io.Copy(&snapshot, ringBuffer) 6386 err = &smithy.DeserializationError{ 6387 Err: fmt.Errorf("failed to decode response body, %w", err), 6388 Snapshot: snapshot.Bytes(), 6389 } 6390 return out, metadata, err 6391 } 6392 6393 err = awsAwsjson11_deserializeOpDocumentStopEventsDetectionJobOutput(&output, shape) 6394 if err != nil { 6395 var snapshot bytes.Buffer 6396 io.Copy(&snapshot, ringBuffer) 6397 err = &smithy.DeserializationError{ 6398 Err: fmt.Errorf("failed to decode response body, %w", err), 6399 Snapshot: snapshot.Bytes(), 6400 } 6401 return out, metadata, err 6402 } 6403 6404 return out, metadata, err 6405} 6406 6407func awsAwsjson11_deserializeOpErrorStopEventsDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6408 var errorBuffer bytes.Buffer 6409 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6410 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6411 } 6412 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6413 6414 errorCode := "UnknownError" 6415 errorMessage := errorCode 6416 6417 code := response.Header.Get("X-Amzn-ErrorType") 6418 if len(code) != 0 { 6419 errorCode = restjson.SanitizeErrorCode(code) 6420 } 6421 6422 var buff [1024]byte 6423 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6424 6425 body := io.TeeReader(errorBody, ringBuffer) 6426 decoder := json.NewDecoder(body) 6427 decoder.UseNumber() 6428 code, message, err := restjson.GetErrorInfo(decoder) 6429 if err != nil { 6430 var snapshot bytes.Buffer 6431 io.Copy(&snapshot, ringBuffer) 6432 err = &smithy.DeserializationError{ 6433 Err: fmt.Errorf("failed to decode response body, %w", err), 6434 Snapshot: snapshot.Bytes(), 6435 } 6436 return err 6437 } 6438 6439 errorBody.Seek(0, io.SeekStart) 6440 if len(code) != 0 { 6441 errorCode = restjson.SanitizeErrorCode(code) 6442 } 6443 if len(message) != 0 { 6444 errorMessage = message 6445 } 6446 6447 switch { 6448 case strings.EqualFold("InternalServerException", errorCode): 6449 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 6450 6451 case strings.EqualFold("InvalidRequestException", errorCode): 6452 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 6453 6454 case strings.EqualFold("JobNotFoundException", errorCode): 6455 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 6456 6457 default: 6458 genericError := &smithy.GenericAPIError{ 6459 Code: errorCode, 6460 Message: errorMessage, 6461 } 6462 return genericError 6463 6464 } 6465} 6466 6467type awsAwsjson11_deserializeOpStopKeyPhrasesDetectionJob struct { 6468} 6469 6470func (*awsAwsjson11_deserializeOpStopKeyPhrasesDetectionJob) ID() string { 6471 return "OperationDeserializer" 6472} 6473 6474func (m *awsAwsjson11_deserializeOpStopKeyPhrasesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6475 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6476) { 6477 out, metadata, err = next.HandleDeserialize(ctx, in) 6478 if err != nil { 6479 return out, metadata, err 6480 } 6481 6482 response, ok := out.RawResponse.(*smithyhttp.Response) 6483 if !ok { 6484 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6485 } 6486 6487 if response.StatusCode < 200 || response.StatusCode >= 300 { 6488 return out, metadata, awsAwsjson11_deserializeOpErrorStopKeyPhrasesDetectionJob(response, &metadata) 6489 } 6490 output := &StopKeyPhrasesDetectionJobOutput{} 6491 out.Result = output 6492 6493 var buff [1024]byte 6494 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6495 6496 body := io.TeeReader(response.Body, ringBuffer) 6497 decoder := json.NewDecoder(body) 6498 decoder.UseNumber() 6499 var shape interface{} 6500 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6501 var snapshot bytes.Buffer 6502 io.Copy(&snapshot, ringBuffer) 6503 err = &smithy.DeserializationError{ 6504 Err: fmt.Errorf("failed to decode response body, %w", err), 6505 Snapshot: snapshot.Bytes(), 6506 } 6507 return out, metadata, err 6508 } 6509 6510 err = awsAwsjson11_deserializeOpDocumentStopKeyPhrasesDetectionJobOutput(&output, shape) 6511 if err != nil { 6512 var snapshot bytes.Buffer 6513 io.Copy(&snapshot, ringBuffer) 6514 err = &smithy.DeserializationError{ 6515 Err: fmt.Errorf("failed to decode response body, %w", err), 6516 Snapshot: snapshot.Bytes(), 6517 } 6518 return out, metadata, err 6519 } 6520 6521 return out, metadata, err 6522} 6523 6524func awsAwsjson11_deserializeOpErrorStopKeyPhrasesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6525 var errorBuffer bytes.Buffer 6526 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6527 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6528 } 6529 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6530 6531 errorCode := "UnknownError" 6532 errorMessage := errorCode 6533 6534 code := response.Header.Get("X-Amzn-ErrorType") 6535 if len(code) != 0 { 6536 errorCode = restjson.SanitizeErrorCode(code) 6537 } 6538 6539 var buff [1024]byte 6540 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6541 6542 body := io.TeeReader(errorBody, ringBuffer) 6543 decoder := json.NewDecoder(body) 6544 decoder.UseNumber() 6545 code, message, err := restjson.GetErrorInfo(decoder) 6546 if err != nil { 6547 var snapshot bytes.Buffer 6548 io.Copy(&snapshot, ringBuffer) 6549 err = &smithy.DeserializationError{ 6550 Err: fmt.Errorf("failed to decode response body, %w", err), 6551 Snapshot: snapshot.Bytes(), 6552 } 6553 return err 6554 } 6555 6556 errorBody.Seek(0, io.SeekStart) 6557 if len(code) != 0 { 6558 errorCode = restjson.SanitizeErrorCode(code) 6559 } 6560 if len(message) != 0 { 6561 errorMessage = message 6562 } 6563 6564 switch { 6565 case strings.EqualFold("InternalServerException", errorCode): 6566 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 6567 6568 case strings.EqualFold("InvalidRequestException", errorCode): 6569 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 6570 6571 case strings.EqualFold("JobNotFoundException", errorCode): 6572 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 6573 6574 default: 6575 genericError := &smithy.GenericAPIError{ 6576 Code: errorCode, 6577 Message: errorMessage, 6578 } 6579 return genericError 6580 6581 } 6582} 6583 6584type awsAwsjson11_deserializeOpStopPiiEntitiesDetectionJob struct { 6585} 6586 6587func (*awsAwsjson11_deserializeOpStopPiiEntitiesDetectionJob) ID() string { 6588 return "OperationDeserializer" 6589} 6590 6591func (m *awsAwsjson11_deserializeOpStopPiiEntitiesDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6592 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6593) { 6594 out, metadata, err = next.HandleDeserialize(ctx, in) 6595 if err != nil { 6596 return out, metadata, err 6597 } 6598 6599 response, ok := out.RawResponse.(*smithyhttp.Response) 6600 if !ok { 6601 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6602 } 6603 6604 if response.StatusCode < 200 || response.StatusCode >= 300 { 6605 return out, metadata, awsAwsjson11_deserializeOpErrorStopPiiEntitiesDetectionJob(response, &metadata) 6606 } 6607 output := &StopPiiEntitiesDetectionJobOutput{} 6608 out.Result = output 6609 6610 var buff [1024]byte 6611 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6612 6613 body := io.TeeReader(response.Body, ringBuffer) 6614 decoder := json.NewDecoder(body) 6615 decoder.UseNumber() 6616 var shape interface{} 6617 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6618 var snapshot bytes.Buffer 6619 io.Copy(&snapshot, ringBuffer) 6620 err = &smithy.DeserializationError{ 6621 Err: fmt.Errorf("failed to decode response body, %w", err), 6622 Snapshot: snapshot.Bytes(), 6623 } 6624 return out, metadata, err 6625 } 6626 6627 err = awsAwsjson11_deserializeOpDocumentStopPiiEntitiesDetectionJobOutput(&output, shape) 6628 if err != nil { 6629 var snapshot bytes.Buffer 6630 io.Copy(&snapshot, ringBuffer) 6631 err = &smithy.DeserializationError{ 6632 Err: fmt.Errorf("failed to decode response body, %w", err), 6633 Snapshot: snapshot.Bytes(), 6634 } 6635 return out, metadata, err 6636 } 6637 6638 return out, metadata, err 6639} 6640 6641func awsAwsjson11_deserializeOpErrorStopPiiEntitiesDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6642 var errorBuffer bytes.Buffer 6643 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6644 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6645 } 6646 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6647 6648 errorCode := "UnknownError" 6649 errorMessage := errorCode 6650 6651 code := response.Header.Get("X-Amzn-ErrorType") 6652 if len(code) != 0 { 6653 errorCode = restjson.SanitizeErrorCode(code) 6654 } 6655 6656 var buff [1024]byte 6657 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6658 6659 body := io.TeeReader(errorBody, ringBuffer) 6660 decoder := json.NewDecoder(body) 6661 decoder.UseNumber() 6662 code, message, err := restjson.GetErrorInfo(decoder) 6663 if err != nil { 6664 var snapshot bytes.Buffer 6665 io.Copy(&snapshot, ringBuffer) 6666 err = &smithy.DeserializationError{ 6667 Err: fmt.Errorf("failed to decode response body, %w", err), 6668 Snapshot: snapshot.Bytes(), 6669 } 6670 return err 6671 } 6672 6673 errorBody.Seek(0, io.SeekStart) 6674 if len(code) != 0 { 6675 errorCode = restjson.SanitizeErrorCode(code) 6676 } 6677 if len(message) != 0 { 6678 errorMessage = message 6679 } 6680 6681 switch { 6682 case strings.EqualFold("InternalServerException", errorCode): 6683 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 6684 6685 case strings.EqualFold("InvalidRequestException", errorCode): 6686 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 6687 6688 case strings.EqualFold("JobNotFoundException", errorCode): 6689 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 6690 6691 default: 6692 genericError := &smithy.GenericAPIError{ 6693 Code: errorCode, 6694 Message: errorMessage, 6695 } 6696 return genericError 6697 6698 } 6699} 6700 6701type awsAwsjson11_deserializeOpStopSentimentDetectionJob struct { 6702} 6703 6704func (*awsAwsjson11_deserializeOpStopSentimentDetectionJob) ID() string { 6705 return "OperationDeserializer" 6706} 6707 6708func (m *awsAwsjson11_deserializeOpStopSentimentDetectionJob) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6709 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6710) { 6711 out, metadata, err = next.HandleDeserialize(ctx, in) 6712 if err != nil { 6713 return out, metadata, err 6714 } 6715 6716 response, ok := out.RawResponse.(*smithyhttp.Response) 6717 if !ok { 6718 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6719 } 6720 6721 if response.StatusCode < 200 || response.StatusCode >= 300 { 6722 return out, metadata, awsAwsjson11_deserializeOpErrorStopSentimentDetectionJob(response, &metadata) 6723 } 6724 output := &StopSentimentDetectionJobOutput{} 6725 out.Result = output 6726 6727 var buff [1024]byte 6728 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6729 6730 body := io.TeeReader(response.Body, ringBuffer) 6731 decoder := json.NewDecoder(body) 6732 decoder.UseNumber() 6733 var shape interface{} 6734 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6735 var snapshot bytes.Buffer 6736 io.Copy(&snapshot, ringBuffer) 6737 err = &smithy.DeserializationError{ 6738 Err: fmt.Errorf("failed to decode response body, %w", err), 6739 Snapshot: snapshot.Bytes(), 6740 } 6741 return out, metadata, err 6742 } 6743 6744 err = awsAwsjson11_deserializeOpDocumentStopSentimentDetectionJobOutput(&output, shape) 6745 if err != nil { 6746 var snapshot bytes.Buffer 6747 io.Copy(&snapshot, ringBuffer) 6748 err = &smithy.DeserializationError{ 6749 Err: fmt.Errorf("failed to decode response body, %w", err), 6750 Snapshot: snapshot.Bytes(), 6751 } 6752 return out, metadata, err 6753 } 6754 6755 return out, metadata, err 6756} 6757 6758func awsAwsjson11_deserializeOpErrorStopSentimentDetectionJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6759 var errorBuffer bytes.Buffer 6760 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6761 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6762 } 6763 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6764 6765 errorCode := "UnknownError" 6766 errorMessage := errorCode 6767 6768 code := response.Header.Get("X-Amzn-ErrorType") 6769 if len(code) != 0 { 6770 errorCode = restjson.SanitizeErrorCode(code) 6771 } 6772 6773 var buff [1024]byte 6774 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6775 6776 body := io.TeeReader(errorBody, ringBuffer) 6777 decoder := json.NewDecoder(body) 6778 decoder.UseNumber() 6779 code, message, err := restjson.GetErrorInfo(decoder) 6780 if err != nil { 6781 var snapshot bytes.Buffer 6782 io.Copy(&snapshot, ringBuffer) 6783 err = &smithy.DeserializationError{ 6784 Err: fmt.Errorf("failed to decode response body, %w", err), 6785 Snapshot: snapshot.Bytes(), 6786 } 6787 return err 6788 } 6789 6790 errorBody.Seek(0, io.SeekStart) 6791 if len(code) != 0 { 6792 errorCode = restjson.SanitizeErrorCode(code) 6793 } 6794 if len(message) != 0 { 6795 errorMessage = message 6796 } 6797 6798 switch { 6799 case strings.EqualFold("InternalServerException", errorCode): 6800 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 6801 6802 case strings.EqualFold("InvalidRequestException", errorCode): 6803 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 6804 6805 case strings.EqualFold("JobNotFoundException", errorCode): 6806 return awsAwsjson11_deserializeErrorJobNotFoundException(response, errorBody) 6807 6808 default: 6809 genericError := &smithy.GenericAPIError{ 6810 Code: errorCode, 6811 Message: errorMessage, 6812 } 6813 return genericError 6814 6815 } 6816} 6817 6818type awsAwsjson11_deserializeOpStopTrainingDocumentClassifier struct { 6819} 6820 6821func (*awsAwsjson11_deserializeOpStopTrainingDocumentClassifier) ID() string { 6822 return "OperationDeserializer" 6823} 6824 6825func (m *awsAwsjson11_deserializeOpStopTrainingDocumentClassifier) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6826 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6827) { 6828 out, metadata, err = next.HandleDeserialize(ctx, in) 6829 if err != nil { 6830 return out, metadata, err 6831 } 6832 6833 response, ok := out.RawResponse.(*smithyhttp.Response) 6834 if !ok { 6835 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6836 } 6837 6838 if response.StatusCode < 200 || response.StatusCode >= 300 { 6839 return out, metadata, awsAwsjson11_deserializeOpErrorStopTrainingDocumentClassifier(response, &metadata) 6840 } 6841 output := &StopTrainingDocumentClassifierOutput{} 6842 out.Result = output 6843 6844 var buff [1024]byte 6845 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6846 6847 body := io.TeeReader(response.Body, ringBuffer) 6848 decoder := json.NewDecoder(body) 6849 decoder.UseNumber() 6850 var shape interface{} 6851 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6852 var snapshot bytes.Buffer 6853 io.Copy(&snapshot, ringBuffer) 6854 err = &smithy.DeserializationError{ 6855 Err: fmt.Errorf("failed to decode response body, %w", err), 6856 Snapshot: snapshot.Bytes(), 6857 } 6858 return out, metadata, err 6859 } 6860 6861 err = awsAwsjson11_deserializeOpDocumentStopTrainingDocumentClassifierOutput(&output, shape) 6862 if err != nil { 6863 var snapshot bytes.Buffer 6864 io.Copy(&snapshot, ringBuffer) 6865 err = &smithy.DeserializationError{ 6866 Err: fmt.Errorf("failed to decode response body, %w", err), 6867 Snapshot: snapshot.Bytes(), 6868 } 6869 return out, metadata, err 6870 } 6871 6872 return out, metadata, err 6873} 6874 6875func awsAwsjson11_deserializeOpErrorStopTrainingDocumentClassifier(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6876 var errorBuffer bytes.Buffer 6877 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6878 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6879 } 6880 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6881 6882 errorCode := "UnknownError" 6883 errorMessage := errorCode 6884 6885 code := response.Header.Get("X-Amzn-ErrorType") 6886 if len(code) != 0 { 6887 errorCode = restjson.SanitizeErrorCode(code) 6888 } 6889 6890 var buff [1024]byte 6891 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6892 6893 body := io.TeeReader(errorBody, ringBuffer) 6894 decoder := json.NewDecoder(body) 6895 decoder.UseNumber() 6896 code, message, err := restjson.GetErrorInfo(decoder) 6897 if err != nil { 6898 var snapshot bytes.Buffer 6899 io.Copy(&snapshot, ringBuffer) 6900 err = &smithy.DeserializationError{ 6901 Err: fmt.Errorf("failed to decode response body, %w", err), 6902 Snapshot: snapshot.Bytes(), 6903 } 6904 return err 6905 } 6906 6907 errorBody.Seek(0, io.SeekStart) 6908 if len(code) != 0 { 6909 errorCode = restjson.SanitizeErrorCode(code) 6910 } 6911 if len(message) != 0 { 6912 errorMessage = message 6913 } 6914 6915 switch { 6916 case strings.EqualFold("InternalServerException", errorCode): 6917 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 6918 6919 case strings.EqualFold("InvalidRequestException", errorCode): 6920 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 6921 6922 case strings.EqualFold("ResourceNotFoundException", errorCode): 6923 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 6924 6925 case strings.EqualFold("TooManyRequestsException", errorCode): 6926 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 6927 6928 default: 6929 genericError := &smithy.GenericAPIError{ 6930 Code: errorCode, 6931 Message: errorMessage, 6932 } 6933 return genericError 6934 6935 } 6936} 6937 6938type awsAwsjson11_deserializeOpStopTrainingEntityRecognizer struct { 6939} 6940 6941func (*awsAwsjson11_deserializeOpStopTrainingEntityRecognizer) ID() string { 6942 return "OperationDeserializer" 6943} 6944 6945func (m *awsAwsjson11_deserializeOpStopTrainingEntityRecognizer) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6946 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6947) { 6948 out, metadata, err = next.HandleDeserialize(ctx, in) 6949 if err != nil { 6950 return out, metadata, err 6951 } 6952 6953 response, ok := out.RawResponse.(*smithyhttp.Response) 6954 if !ok { 6955 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6956 } 6957 6958 if response.StatusCode < 200 || response.StatusCode >= 300 { 6959 return out, metadata, awsAwsjson11_deserializeOpErrorStopTrainingEntityRecognizer(response, &metadata) 6960 } 6961 output := &StopTrainingEntityRecognizerOutput{} 6962 out.Result = output 6963 6964 var buff [1024]byte 6965 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6966 6967 body := io.TeeReader(response.Body, ringBuffer) 6968 decoder := json.NewDecoder(body) 6969 decoder.UseNumber() 6970 var shape interface{} 6971 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6972 var snapshot bytes.Buffer 6973 io.Copy(&snapshot, ringBuffer) 6974 err = &smithy.DeserializationError{ 6975 Err: fmt.Errorf("failed to decode response body, %w", err), 6976 Snapshot: snapshot.Bytes(), 6977 } 6978 return out, metadata, err 6979 } 6980 6981 err = awsAwsjson11_deserializeOpDocumentStopTrainingEntityRecognizerOutput(&output, shape) 6982 if err != nil { 6983 var snapshot bytes.Buffer 6984 io.Copy(&snapshot, ringBuffer) 6985 err = &smithy.DeserializationError{ 6986 Err: fmt.Errorf("failed to decode response body, %w", err), 6987 Snapshot: snapshot.Bytes(), 6988 } 6989 return out, metadata, err 6990 } 6991 6992 return out, metadata, err 6993} 6994 6995func awsAwsjson11_deserializeOpErrorStopTrainingEntityRecognizer(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6996 var errorBuffer bytes.Buffer 6997 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6998 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6999 } 7000 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7001 7002 errorCode := "UnknownError" 7003 errorMessage := errorCode 7004 7005 code := response.Header.Get("X-Amzn-ErrorType") 7006 if len(code) != 0 { 7007 errorCode = restjson.SanitizeErrorCode(code) 7008 } 7009 7010 var buff [1024]byte 7011 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7012 7013 body := io.TeeReader(errorBody, ringBuffer) 7014 decoder := json.NewDecoder(body) 7015 decoder.UseNumber() 7016 code, message, err := restjson.GetErrorInfo(decoder) 7017 if err != nil { 7018 var snapshot bytes.Buffer 7019 io.Copy(&snapshot, ringBuffer) 7020 err = &smithy.DeserializationError{ 7021 Err: fmt.Errorf("failed to decode response body, %w", err), 7022 Snapshot: snapshot.Bytes(), 7023 } 7024 return err 7025 } 7026 7027 errorBody.Seek(0, io.SeekStart) 7028 if len(code) != 0 { 7029 errorCode = restjson.SanitizeErrorCode(code) 7030 } 7031 if len(message) != 0 { 7032 errorMessage = message 7033 } 7034 7035 switch { 7036 case strings.EqualFold("InternalServerException", errorCode): 7037 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 7038 7039 case strings.EqualFold("InvalidRequestException", errorCode): 7040 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 7041 7042 case strings.EqualFold("ResourceNotFoundException", errorCode): 7043 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 7044 7045 case strings.EqualFold("TooManyRequestsException", errorCode): 7046 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 7047 7048 default: 7049 genericError := &smithy.GenericAPIError{ 7050 Code: errorCode, 7051 Message: errorMessage, 7052 } 7053 return genericError 7054 7055 } 7056} 7057 7058type awsAwsjson11_deserializeOpTagResource struct { 7059} 7060 7061func (*awsAwsjson11_deserializeOpTagResource) ID() string { 7062 return "OperationDeserializer" 7063} 7064 7065func (m *awsAwsjson11_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7066 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7067) { 7068 out, metadata, err = next.HandleDeserialize(ctx, in) 7069 if err != nil { 7070 return out, metadata, err 7071 } 7072 7073 response, ok := out.RawResponse.(*smithyhttp.Response) 7074 if !ok { 7075 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7076 } 7077 7078 if response.StatusCode < 200 || response.StatusCode >= 300 { 7079 return out, metadata, awsAwsjson11_deserializeOpErrorTagResource(response, &metadata) 7080 } 7081 output := &TagResourceOutput{} 7082 out.Result = output 7083 7084 var buff [1024]byte 7085 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7086 7087 body := io.TeeReader(response.Body, ringBuffer) 7088 decoder := json.NewDecoder(body) 7089 decoder.UseNumber() 7090 var shape interface{} 7091 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7092 var snapshot bytes.Buffer 7093 io.Copy(&snapshot, ringBuffer) 7094 err = &smithy.DeserializationError{ 7095 Err: fmt.Errorf("failed to decode response body, %w", err), 7096 Snapshot: snapshot.Bytes(), 7097 } 7098 return out, metadata, err 7099 } 7100 7101 err = awsAwsjson11_deserializeOpDocumentTagResourceOutput(&output, shape) 7102 if err != nil { 7103 var snapshot bytes.Buffer 7104 io.Copy(&snapshot, ringBuffer) 7105 err = &smithy.DeserializationError{ 7106 Err: fmt.Errorf("failed to decode response body, %w", err), 7107 Snapshot: snapshot.Bytes(), 7108 } 7109 return out, metadata, err 7110 } 7111 7112 return out, metadata, err 7113} 7114 7115func awsAwsjson11_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7116 var errorBuffer bytes.Buffer 7117 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7118 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7119 } 7120 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7121 7122 errorCode := "UnknownError" 7123 errorMessage := errorCode 7124 7125 code := response.Header.Get("X-Amzn-ErrorType") 7126 if len(code) != 0 { 7127 errorCode = restjson.SanitizeErrorCode(code) 7128 } 7129 7130 var buff [1024]byte 7131 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7132 7133 body := io.TeeReader(errorBody, ringBuffer) 7134 decoder := json.NewDecoder(body) 7135 decoder.UseNumber() 7136 code, message, err := restjson.GetErrorInfo(decoder) 7137 if err != nil { 7138 var snapshot bytes.Buffer 7139 io.Copy(&snapshot, ringBuffer) 7140 err = &smithy.DeserializationError{ 7141 Err: fmt.Errorf("failed to decode response body, %w", err), 7142 Snapshot: snapshot.Bytes(), 7143 } 7144 return err 7145 } 7146 7147 errorBody.Seek(0, io.SeekStart) 7148 if len(code) != 0 { 7149 errorCode = restjson.SanitizeErrorCode(code) 7150 } 7151 if len(message) != 0 { 7152 errorMessage = message 7153 } 7154 7155 switch { 7156 case strings.EqualFold("ConcurrentModificationException", errorCode): 7157 return awsAwsjson11_deserializeErrorConcurrentModificationException(response, errorBody) 7158 7159 case strings.EqualFold("InternalServerException", errorCode): 7160 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 7161 7162 case strings.EqualFold("InvalidRequestException", errorCode): 7163 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 7164 7165 case strings.EqualFold("ResourceNotFoundException", errorCode): 7166 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 7167 7168 case strings.EqualFold("TooManyTagsException", errorCode): 7169 return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody) 7170 7171 default: 7172 genericError := &smithy.GenericAPIError{ 7173 Code: errorCode, 7174 Message: errorMessage, 7175 } 7176 return genericError 7177 7178 } 7179} 7180 7181type awsAwsjson11_deserializeOpUntagResource struct { 7182} 7183 7184func (*awsAwsjson11_deserializeOpUntagResource) ID() string { 7185 return "OperationDeserializer" 7186} 7187 7188func (m *awsAwsjson11_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7189 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7190) { 7191 out, metadata, err = next.HandleDeserialize(ctx, in) 7192 if err != nil { 7193 return out, metadata, err 7194 } 7195 7196 response, ok := out.RawResponse.(*smithyhttp.Response) 7197 if !ok { 7198 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7199 } 7200 7201 if response.StatusCode < 200 || response.StatusCode >= 300 { 7202 return out, metadata, awsAwsjson11_deserializeOpErrorUntagResource(response, &metadata) 7203 } 7204 output := &UntagResourceOutput{} 7205 out.Result = output 7206 7207 var buff [1024]byte 7208 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7209 7210 body := io.TeeReader(response.Body, ringBuffer) 7211 decoder := json.NewDecoder(body) 7212 decoder.UseNumber() 7213 var shape interface{} 7214 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7215 var snapshot bytes.Buffer 7216 io.Copy(&snapshot, ringBuffer) 7217 err = &smithy.DeserializationError{ 7218 Err: fmt.Errorf("failed to decode response body, %w", err), 7219 Snapshot: snapshot.Bytes(), 7220 } 7221 return out, metadata, err 7222 } 7223 7224 err = awsAwsjson11_deserializeOpDocumentUntagResourceOutput(&output, shape) 7225 if err != nil { 7226 var snapshot bytes.Buffer 7227 io.Copy(&snapshot, ringBuffer) 7228 err = &smithy.DeserializationError{ 7229 Err: fmt.Errorf("failed to decode response body, %w", err), 7230 Snapshot: snapshot.Bytes(), 7231 } 7232 return out, metadata, err 7233 } 7234 7235 return out, metadata, err 7236} 7237 7238func awsAwsjson11_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7239 var errorBuffer bytes.Buffer 7240 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7241 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7242 } 7243 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7244 7245 errorCode := "UnknownError" 7246 errorMessage := errorCode 7247 7248 code := response.Header.Get("X-Amzn-ErrorType") 7249 if len(code) != 0 { 7250 errorCode = restjson.SanitizeErrorCode(code) 7251 } 7252 7253 var buff [1024]byte 7254 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7255 7256 body := io.TeeReader(errorBody, ringBuffer) 7257 decoder := json.NewDecoder(body) 7258 decoder.UseNumber() 7259 code, message, err := restjson.GetErrorInfo(decoder) 7260 if err != nil { 7261 var snapshot bytes.Buffer 7262 io.Copy(&snapshot, ringBuffer) 7263 err = &smithy.DeserializationError{ 7264 Err: fmt.Errorf("failed to decode response body, %w", err), 7265 Snapshot: snapshot.Bytes(), 7266 } 7267 return err 7268 } 7269 7270 errorBody.Seek(0, io.SeekStart) 7271 if len(code) != 0 { 7272 errorCode = restjson.SanitizeErrorCode(code) 7273 } 7274 if len(message) != 0 { 7275 errorMessage = message 7276 } 7277 7278 switch { 7279 case strings.EqualFold("ConcurrentModificationException", errorCode): 7280 return awsAwsjson11_deserializeErrorConcurrentModificationException(response, errorBody) 7281 7282 case strings.EqualFold("InternalServerException", errorCode): 7283 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 7284 7285 case strings.EqualFold("InvalidRequestException", errorCode): 7286 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 7287 7288 case strings.EqualFold("ResourceNotFoundException", errorCode): 7289 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 7290 7291 case strings.EqualFold("TooManyTagKeysException", errorCode): 7292 return awsAwsjson11_deserializeErrorTooManyTagKeysException(response, errorBody) 7293 7294 default: 7295 genericError := &smithy.GenericAPIError{ 7296 Code: errorCode, 7297 Message: errorMessage, 7298 } 7299 return genericError 7300 7301 } 7302} 7303 7304type awsAwsjson11_deserializeOpUpdateEndpoint struct { 7305} 7306 7307func (*awsAwsjson11_deserializeOpUpdateEndpoint) ID() string { 7308 return "OperationDeserializer" 7309} 7310 7311func (m *awsAwsjson11_deserializeOpUpdateEndpoint) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7312 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7313) { 7314 out, metadata, err = next.HandleDeserialize(ctx, in) 7315 if err != nil { 7316 return out, metadata, err 7317 } 7318 7319 response, ok := out.RawResponse.(*smithyhttp.Response) 7320 if !ok { 7321 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7322 } 7323 7324 if response.StatusCode < 200 || response.StatusCode >= 300 { 7325 return out, metadata, awsAwsjson11_deserializeOpErrorUpdateEndpoint(response, &metadata) 7326 } 7327 output := &UpdateEndpointOutput{} 7328 out.Result = output 7329 7330 var buff [1024]byte 7331 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7332 7333 body := io.TeeReader(response.Body, ringBuffer) 7334 decoder := json.NewDecoder(body) 7335 decoder.UseNumber() 7336 var shape interface{} 7337 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7338 var snapshot bytes.Buffer 7339 io.Copy(&snapshot, ringBuffer) 7340 err = &smithy.DeserializationError{ 7341 Err: fmt.Errorf("failed to decode response body, %w", err), 7342 Snapshot: snapshot.Bytes(), 7343 } 7344 return out, metadata, err 7345 } 7346 7347 err = awsAwsjson11_deserializeOpDocumentUpdateEndpointOutput(&output, shape) 7348 if err != nil { 7349 var snapshot bytes.Buffer 7350 io.Copy(&snapshot, ringBuffer) 7351 err = &smithy.DeserializationError{ 7352 Err: fmt.Errorf("failed to decode response body, %w", err), 7353 Snapshot: snapshot.Bytes(), 7354 } 7355 return out, metadata, err 7356 } 7357 7358 return out, metadata, err 7359} 7360 7361func awsAwsjson11_deserializeOpErrorUpdateEndpoint(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7362 var errorBuffer bytes.Buffer 7363 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7364 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7365 } 7366 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7367 7368 errorCode := "UnknownError" 7369 errorMessage := errorCode 7370 7371 code := response.Header.Get("X-Amzn-ErrorType") 7372 if len(code) != 0 { 7373 errorCode = restjson.SanitizeErrorCode(code) 7374 } 7375 7376 var buff [1024]byte 7377 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7378 7379 body := io.TeeReader(errorBody, ringBuffer) 7380 decoder := json.NewDecoder(body) 7381 decoder.UseNumber() 7382 code, message, err := restjson.GetErrorInfo(decoder) 7383 if err != nil { 7384 var snapshot bytes.Buffer 7385 io.Copy(&snapshot, ringBuffer) 7386 err = &smithy.DeserializationError{ 7387 Err: fmt.Errorf("failed to decode response body, %w", err), 7388 Snapshot: snapshot.Bytes(), 7389 } 7390 return err 7391 } 7392 7393 errorBody.Seek(0, io.SeekStart) 7394 if len(code) != 0 { 7395 errorCode = restjson.SanitizeErrorCode(code) 7396 } 7397 if len(message) != 0 { 7398 errorMessage = message 7399 } 7400 7401 switch { 7402 case strings.EqualFold("InternalServerException", errorCode): 7403 return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody) 7404 7405 case strings.EqualFold("InvalidRequestException", errorCode): 7406 return awsAwsjson11_deserializeErrorInvalidRequestException(response, errorBody) 7407 7408 case strings.EqualFold("ResourceInUseException", errorCode): 7409 return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) 7410 7411 case strings.EqualFold("ResourceLimitExceededException", errorCode): 7412 return awsAwsjson11_deserializeErrorResourceLimitExceededException(response, errorBody) 7413 7414 case strings.EqualFold("ResourceNotFoundException", errorCode): 7415 return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) 7416 7417 case strings.EqualFold("ResourceUnavailableException", errorCode): 7418 return awsAwsjson11_deserializeErrorResourceUnavailableException(response, errorBody) 7419 7420 case strings.EqualFold("TooManyRequestsException", errorCode): 7421 return awsAwsjson11_deserializeErrorTooManyRequestsException(response, errorBody) 7422 7423 default: 7424 genericError := &smithy.GenericAPIError{ 7425 Code: errorCode, 7426 Message: errorMessage, 7427 } 7428 return genericError 7429 7430 } 7431} 7432 7433func awsAwsjson11_deserializeErrorBatchSizeLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7434 var buff [1024]byte 7435 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7436 7437 body := io.TeeReader(errorBody, ringBuffer) 7438 decoder := json.NewDecoder(body) 7439 decoder.UseNumber() 7440 var shape interface{} 7441 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7442 var snapshot bytes.Buffer 7443 io.Copy(&snapshot, ringBuffer) 7444 err = &smithy.DeserializationError{ 7445 Err: fmt.Errorf("failed to decode response body, %w", err), 7446 Snapshot: snapshot.Bytes(), 7447 } 7448 return err 7449 } 7450 7451 output := &types.BatchSizeLimitExceededException{} 7452 err := awsAwsjson11_deserializeDocumentBatchSizeLimitExceededException(&output, shape) 7453 7454 if err != nil { 7455 var snapshot bytes.Buffer 7456 io.Copy(&snapshot, ringBuffer) 7457 err = &smithy.DeserializationError{ 7458 Err: fmt.Errorf("failed to decode response body, %w", err), 7459 Snapshot: snapshot.Bytes(), 7460 } 7461 return err 7462 } 7463 7464 errorBody.Seek(0, io.SeekStart) 7465 return output 7466} 7467 7468func awsAwsjson11_deserializeErrorConcurrentModificationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7469 var buff [1024]byte 7470 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7471 7472 body := io.TeeReader(errorBody, ringBuffer) 7473 decoder := json.NewDecoder(body) 7474 decoder.UseNumber() 7475 var shape interface{} 7476 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7477 var snapshot bytes.Buffer 7478 io.Copy(&snapshot, ringBuffer) 7479 err = &smithy.DeserializationError{ 7480 Err: fmt.Errorf("failed to decode response body, %w", err), 7481 Snapshot: snapshot.Bytes(), 7482 } 7483 return err 7484 } 7485 7486 output := &types.ConcurrentModificationException{} 7487 err := awsAwsjson11_deserializeDocumentConcurrentModificationException(&output, shape) 7488 7489 if err != nil { 7490 var snapshot bytes.Buffer 7491 io.Copy(&snapshot, ringBuffer) 7492 err = &smithy.DeserializationError{ 7493 Err: fmt.Errorf("failed to decode response body, %w", err), 7494 Snapshot: snapshot.Bytes(), 7495 } 7496 return err 7497 } 7498 7499 errorBody.Seek(0, io.SeekStart) 7500 return output 7501} 7502 7503func awsAwsjson11_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7504 var buff [1024]byte 7505 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7506 7507 body := io.TeeReader(errorBody, ringBuffer) 7508 decoder := json.NewDecoder(body) 7509 decoder.UseNumber() 7510 var shape interface{} 7511 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7512 var snapshot bytes.Buffer 7513 io.Copy(&snapshot, ringBuffer) 7514 err = &smithy.DeserializationError{ 7515 Err: fmt.Errorf("failed to decode response body, %w", err), 7516 Snapshot: snapshot.Bytes(), 7517 } 7518 return err 7519 } 7520 7521 output := &types.InternalServerException{} 7522 err := awsAwsjson11_deserializeDocumentInternalServerException(&output, shape) 7523 7524 if err != nil { 7525 var snapshot bytes.Buffer 7526 io.Copy(&snapshot, ringBuffer) 7527 err = &smithy.DeserializationError{ 7528 Err: fmt.Errorf("failed to decode response body, %w", err), 7529 Snapshot: snapshot.Bytes(), 7530 } 7531 return err 7532 } 7533 7534 errorBody.Seek(0, io.SeekStart) 7535 return output 7536} 7537 7538func awsAwsjson11_deserializeErrorInvalidFilterException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7539 var buff [1024]byte 7540 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7541 7542 body := io.TeeReader(errorBody, ringBuffer) 7543 decoder := json.NewDecoder(body) 7544 decoder.UseNumber() 7545 var shape interface{} 7546 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7547 var snapshot bytes.Buffer 7548 io.Copy(&snapshot, ringBuffer) 7549 err = &smithy.DeserializationError{ 7550 Err: fmt.Errorf("failed to decode response body, %w", err), 7551 Snapshot: snapshot.Bytes(), 7552 } 7553 return err 7554 } 7555 7556 output := &types.InvalidFilterException{} 7557 err := awsAwsjson11_deserializeDocumentInvalidFilterException(&output, shape) 7558 7559 if err != nil { 7560 var snapshot bytes.Buffer 7561 io.Copy(&snapshot, ringBuffer) 7562 err = &smithy.DeserializationError{ 7563 Err: fmt.Errorf("failed to decode response body, %w", err), 7564 Snapshot: snapshot.Bytes(), 7565 } 7566 return err 7567 } 7568 7569 errorBody.Seek(0, io.SeekStart) 7570 return output 7571} 7572 7573func awsAwsjson11_deserializeErrorInvalidRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7574 var buff [1024]byte 7575 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7576 7577 body := io.TeeReader(errorBody, ringBuffer) 7578 decoder := json.NewDecoder(body) 7579 decoder.UseNumber() 7580 var shape interface{} 7581 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7582 var snapshot bytes.Buffer 7583 io.Copy(&snapshot, ringBuffer) 7584 err = &smithy.DeserializationError{ 7585 Err: fmt.Errorf("failed to decode response body, %w", err), 7586 Snapshot: snapshot.Bytes(), 7587 } 7588 return err 7589 } 7590 7591 output := &types.InvalidRequestException{} 7592 err := awsAwsjson11_deserializeDocumentInvalidRequestException(&output, shape) 7593 7594 if err != nil { 7595 var snapshot bytes.Buffer 7596 io.Copy(&snapshot, ringBuffer) 7597 err = &smithy.DeserializationError{ 7598 Err: fmt.Errorf("failed to decode response body, %w", err), 7599 Snapshot: snapshot.Bytes(), 7600 } 7601 return err 7602 } 7603 7604 errorBody.Seek(0, io.SeekStart) 7605 return output 7606} 7607 7608func awsAwsjson11_deserializeErrorJobNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7609 var buff [1024]byte 7610 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7611 7612 body := io.TeeReader(errorBody, ringBuffer) 7613 decoder := json.NewDecoder(body) 7614 decoder.UseNumber() 7615 var shape interface{} 7616 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7617 var snapshot bytes.Buffer 7618 io.Copy(&snapshot, ringBuffer) 7619 err = &smithy.DeserializationError{ 7620 Err: fmt.Errorf("failed to decode response body, %w", err), 7621 Snapshot: snapshot.Bytes(), 7622 } 7623 return err 7624 } 7625 7626 output := &types.JobNotFoundException{} 7627 err := awsAwsjson11_deserializeDocumentJobNotFoundException(&output, shape) 7628 7629 if err != nil { 7630 var snapshot bytes.Buffer 7631 io.Copy(&snapshot, ringBuffer) 7632 err = &smithy.DeserializationError{ 7633 Err: fmt.Errorf("failed to decode response body, %w", err), 7634 Snapshot: snapshot.Bytes(), 7635 } 7636 return err 7637 } 7638 7639 errorBody.Seek(0, io.SeekStart) 7640 return output 7641} 7642 7643func awsAwsjson11_deserializeErrorKmsKeyValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7644 var buff [1024]byte 7645 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7646 7647 body := io.TeeReader(errorBody, ringBuffer) 7648 decoder := json.NewDecoder(body) 7649 decoder.UseNumber() 7650 var shape interface{} 7651 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7652 var snapshot bytes.Buffer 7653 io.Copy(&snapshot, ringBuffer) 7654 err = &smithy.DeserializationError{ 7655 Err: fmt.Errorf("failed to decode response body, %w", err), 7656 Snapshot: snapshot.Bytes(), 7657 } 7658 return err 7659 } 7660 7661 output := &types.KmsKeyValidationException{} 7662 err := awsAwsjson11_deserializeDocumentKmsKeyValidationException(&output, shape) 7663 7664 if err != nil { 7665 var snapshot bytes.Buffer 7666 io.Copy(&snapshot, ringBuffer) 7667 err = &smithy.DeserializationError{ 7668 Err: fmt.Errorf("failed to decode response body, %w", err), 7669 Snapshot: snapshot.Bytes(), 7670 } 7671 return err 7672 } 7673 7674 errorBody.Seek(0, io.SeekStart) 7675 return output 7676} 7677 7678func awsAwsjson11_deserializeErrorResourceInUseException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7679 var buff [1024]byte 7680 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7681 7682 body := io.TeeReader(errorBody, ringBuffer) 7683 decoder := json.NewDecoder(body) 7684 decoder.UseNumber() 7685 var shape interface{} 7686 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7687 var snapshot bytes.Buffer 7688 io.Copy(&snapshot, ringBuffer) 7689 err = &smithy.DeserializationError{ 7690 Err: fmt.Errorf("failed to decode response body, %w", err), 7691 Snapshot: snapshot.Bytes(), 7692 } 7693 return err 7694 } 7695 7696 output := &types.ResourceInUseException{} 7697 err := awsAwsjson11_deserializeDocumentResourceInUseException(&output, shape) 7698 7699 if err != nil { 7700 var snapshot bytes.Buffer 7701 io.Copy(&snapshot, ringBuffer) 7702 err = &smithy.DeserializationError{ 7703 Err: fmt.Errorf("failed to decode response body, %w", err), 7704 Snapshot: snapshot.Bytes(), 7705 } 7706 return err 7707 } 7708 7709 errorBody.Seek(0, io.SeekStart) 7710 return output 7711} 7712 7713func awsAwsjson11_deserializeErrorResourceLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7714 var buff [1024]byte 7715 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7716 7717 body := io.TeeReader(errorBody, ringBuffer) 7718 decoder := json.NewDecoder(body) 7719 decoder.UseNumber() 7720 var shape interface{} 7721 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7722 var snapshot bytes.Buffer 7723 io.Copy(&snapshot, ringBuffer) 7724 err = &smithy.DeserializationError{ 7725 Err: fmt.Errorf("failed to decode response body, %w", err), 7726 Snapshot: snapshot.Bytes(), 7727 } 7728 return err 7729 } 7730 7731 output := &types.ResourceLimitExceededException{} 7732 err := awsAwsjson11_deserializeDocumentResourceLimitExceededException(&output, shape) 7733 7734 if err != nil { 7735 var snapshot bytes.Buffer 7736 io.Copy(&snapshot, ringBuffer) 7737 err = &smithy.DeserializationError{ 7738 Err: fmt.Errorf("failed to decode response body, %w", err), 7739 Snapshot: snapshot.Bytes(), 7740 } 7741 return err 7742 } 7743 7744 errorBody.Seek(0, io.SeekStart) 7745 return output 7746} 7747 7748func awsAwsjson11_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7749 var buff [1024]byte 7750 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7751 7752 body := io.TeeReader(errorBody, ringBuffer) 7753 decoder := json.NewDecoder(body) 7754 decoder.UseNumber() 7755 var shape interface{} 7756 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7757 var snapshot bytes.Buffer 7758 io.Copy(&snapshot, ringBuffer) 7759 err = &smithy.DeserializationError{ 7760 Err: fmt.Errorf("failed to decode response body, %w", err), 7761 Snapshot: snapshot.Bytes(), 7762 } 7763 return err 7764 } 7765 7766 output := &types.ResourceNotFoundException{} 7767 err := awsAwsjson11_deserializeDocumentResourceNotFoundException(&output, shape) 7768 7769 if err != nil { 7770 var snapshot bytes.Buffer 7771 io.Copy(&snapshot, ringBuffer) 7772 err = &smithy.DeserializationError{ 7773 Err: fmt.Errorf("failed to decode response body, %w", err), 7774 Snapshot: snapshot.Bytes(), 7775 } 7776 return err 7777 } 7778 7779 errorBody.Seek(0, io.SeekStart) 7780 return output 7781} 7782 7783func awsAwsjson11_deserializeErrorResourceUnavailableException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7784 var buff [1024]byte 7785 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7786 7787 body := io.TeeReader(errorBody, ringBuffer) 7788 decoder := json.NewDecoder(body) 7789 decoder.UseNumber() 7790 var shape interface{} 7791 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7792 var snapshot bytes.Buffer 7793 io.Copy(&snapshot, ringBuffer) 7794 err = &smithy.DeserializationError{ 7795 Err: fmt.Errorf("failed to decode response body, %w", err), 7796 Snapshot: snapshot.Bytes(), 7797 } 7798 return err 7799 } 7800 7801 output := &types.ResourceUnavailableException{} 7802 err := awsAwsjson11_deserializeDocumentResourceUnavailableException(&output, shape) 7803 7804 if err != nil { 7805 var snapshot bytes.Buffer 7806 io.Copy(&snapshot, ringBuffer) 7807 err = &smithy.DeserializationError{ 7808 Err: fmt.Errorf("failed to decode response body, %w", err), 7809 Snapshot: snapshot.Bytes(), 7810 } 7811 return err 7812 } 7813 7814 errorBody.Seek(0, io.SeekStart) 7815 return output 7816} 7817 7818func awsAwsjson11_deserializeErrorTextSizeLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7819 var buff [1024]byte 7820 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7821 7822 body := io.TeeReader(errorBody, ringBuffer) 7823 decoder := json.NewDecoder(body) 7824 decoder.UseNumber() 7825 var shape interface{} 7826 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7827 var snapshot bytes.Buffer 7828 io.Copy(&snapshot, ringBuffer) 7829 err = &smithy.DeserializationError{ 7830 Err: fmt.Errorf("failed to decode response body, %w", err), 7831 Snapshot: snapshot.Bytes(), 7832 } 7833 return err 7834 } 7835 7836 output := &types.TextSizeLimitExceededException{} 7837 err := awsAwsjson11_deserializeDocumentTextSizeLimitExceededException(&output, shape) 7838 7839 if err != nil { 7840 var snapshot bytes.Buffer 7841 io.Copy(&snapshot, ringBuffer) 7842 err = &smithy.DeserializationError{ 7843 Err: fmt.Errorf("failed to decode response body, %w", err), 7844 Snapshot: snapshot.Bytes(), 7845 } 7846 return err 7847 } 7848 7849 errorBody.Seek(0, io.SeekStart) 7850 return output 7851} 7852 7853func awsAwsjson11_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7854 var buff [1024]byte 7855 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7856 7857 body := io.TeeReader(errorBody, ringBuffer) 7858 decoder := json.NewDecoder(body) 7859 decoder.UseNumber() 7860 var shape interface{} 7861 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7862 var snapshot bytes.Buffer 7863 io.Copy(&snapshot, ringBuffer) 7864 err = &smithy.DeserializationError{ 7865 Err: fmt.Errorf("failed to decode response body, %w", err), 7866 Snapshot: snapshot.Bytes(), 7867 } 7868 return err 7869 } 7870 7871 output := &types.TooManyRequestsException{} 7872 err := awsAwsjson11_deserializeDocumentTooManyRequestsException(&output, shape) 7873 7874 if err != nil { 7875 var snapshot bytes.Buffer 7876 io.Copy(&snapshot, ringBuffer) 7877 err = &smithy.DeserializationError{ 7878 Err: fmt.Errorf("failed to decode response body, %w", err), 7879 Snapshot: snapshot.Bytes(), 7880 } 7881 return err 7882 } 7883 7884 errorBody.Seek(0, io.SeekStart) 7885 return output 7886} 7887 7888func awsAwsjson11_deserializeErrorTooManyTagKeysException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7889 var buff [1024]byte 7890 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7891 7892 body := io.TeeReader(errorBody, ringBuffer) 7893 decoder := json.NewDecoder(body) 7894 decoder.UseNumber() 7895 var shape interface{} 7896 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7897 var snapshot bytes.Buffer 7898 io.Copy(&snapshot, ringBuffer) 7899 err = &smithy.DeserializationError{ 7900 Err: fmt.Errorf("failed to decode response body, %w", err), 7901 Snapshot: snapshot.Bytes(), 7902 } 7903 return err 7904 } 7905 7906 output := &types.TooManyTagKeysException{} 7907 err := awsAwsjson11_deserializeDocumentTooManyTagKeysException(&output, shape) 7908 7909 if err != nil { 7910 var snapshot bytes.Buffer 7911 io.Copy(&snapshot, ringBuffer) 7912 err = &smithy.DeserializationError{ 7913 Err: fmt.Errorf("failed to decode response body, %w", err), 7914 Snapshot: snapshot.Bytes(), 7915 } 7916 return err 7917 } 7918 7919 errorBody.Seek(0, io.SeekStart) 7920 return output 7921} 7922 7923func awsAwsjson11_deserializeErrorTooManyTagsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7924 var buff [1024]byte 7925 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7926 7927 body := io.TeeReader(errorBody, ringBuffer) 7928 decoder := json.NewDecoder(body) 7929 decoder.UseNumber() 7930 var shape interface{} 7931 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7932 var snapshot bytes.Buffer 7933 io.Copy(&snapshot, ringBuffer) 7934 err = &smithy.DeserializationError{ 7935 Err: fmt.Errorf("failed to decode response body, %w", err), 7936 Snapshot: snapshot.Bytes(), 7937 } 7938 return err 7939 } 7940 7941 output := &types.TooManyTagsException{} 7942 err := awsAwsjson11_deserializeDocumentTooManyTagsException(&output, shape) 7943 7944 if err != nil { 7945 var snapshot bytes.Buffer 7946 io.Copy(&snapshot, ringBuffer) 7947 err = &smithy.DeserializationError{ 7948 Err: fmt.Errorf("failed to decode response body, %w", err), 7949 Snapshot: snapshot.Bytes(), 7950 } 7951 return err 7952 } 7953 7954 errorBody.Seek(0, io.SeekStart) 7955 return output 7956} 7957 7958func awsAwsjson11_deserializeErrorUnsupportedLanguageException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 7959 var buff [1024]byte 7960 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7961 7962 body := io.TeeReader(errorBody, ringBuffer) 7963 decoder := json.NewDecoder(body) 7964 decoder.UseNumber() 7965 var shape interface{} 7966 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7967 var snapshot bytes.Buffer 7968 io.Copy(&snapshot, ringBuffer) 7969 err = &smithy.DeserializationError{ 7970 Err: fmt.Errorf("failed to decode response body, %w", err), 7971 Snapshot: snapshot.Bytes(), 7972 } 7973 return err 7974 } 7975 7976 output := &types.UnsupportedLanguageException{} 7977 err := awsAwsjson11_deserializeDocumentUnsupportedLanguageException(&output, shape) 7978 7979 if err != nil { 7980 var snapshot bytes.Buffer 7981 io.Copy(&snapshot, ringBuffer) 7982 err = &smithy.DeserializationError{ 7983 Err: fmt.Errorf("failed to decode response body, %w", err), 7984 Snapshot: snapshot.Bytes(), 7985 } 7986 return err 7987 } 7988 7989 errorBody.Seek(0, io.SeekStart) 7990 return output 7991} 7992 7993func awsAwsjson11_deserializeDocumentAttributeNamesList(v *[]string, value interface{}) error { 7994 if v == nil { 7995 return fmt.Errorf("unexpected nil of type %T", v) 7996 } 7997 if value == nil { 7998 return nil 7999 } 8000 8001 shape, ok := value.([]interface{}) 8002 if !ok { 8003 return fmt.Errorf("unexpected JSON type %v", value) 8004 } 8005 8006 var cv []string 8007 if *v == nil { 8008 cv = []string{} 8009 } else { 8010 cv = *v 8011 } 8012 8013 for _, value := range shape { 8014 var col string 8015 if value != nil { 8016 jtv, ok := value.(string) 8017 if !ok { 8018 return fmt.Errorf("expected AttributeNamesListItem to be of type string, got %T instead", value) 8019 } 8020 col = jtv 8021 } 8022 cv = append(cv, col) 8023 8024 } 8025 *v = cv 8026 return nil 8027} 8028 8029func awsAwsjson11_deserializeDocumentAugmentedManifestsListItem(v **types.AugmentedManifestsListItem, value interface{}) error { 8030 if v == nil { 8031 return fmt.Errorf("unexpected nil of type %T", v) 8032 } 8033 if value == nil { 8034 return nil 8035 } 8036 8037 shape, ok := value.(map[string]interface{}) 8038 if !ok { 8039 return fmt.Errorf("unexpected JSON type %v", value) 8040 } 8041 8042 var sv *types.AugmentedManifestsListItem 8043 if *v == nil { 8044 sv = &types.AugmentedManifestsListItem{} 8045 } else { 8046 sv = *v 8047 } 8048 8049 for key, value := range shape { 8050 switch key { 8051 case "AnnotationDataS3Uri": 8052 if value != nil { 8053 jtv, ok := value.(string) 8054 if !ok { 8055 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 8056 } 8057 sv.AnnotationDataS3Uri = ptr.String(jtv) 8058 } 8059 8060 case "AttributeNames": 8061 if err := awsAwsjson11_deserializeDocumentAttributeNamesList(&sv.AttributeNames, value); err != nil { 8062 return err 8063 } 8064 8065 case "DocumentType": 8066 if value != nil { 8067 jtv, ok := value.(string) 8068 if !ok { 8069 return fmt.Errorf("expected AugmentedManifestsDocumentTypeFormat to be of type string, got %T instead", value) 8070 } 8071 sv.DocumentType = types.AugmentedManifestsDocumentTypeFormat(jtv) 8072 } 8073 8074 case "S3Uri": 8075 if value != nil { 8076 jtv, ok := value.(string) 8077 if !ok { 8078 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 8079 } 8080 sv.S3Uri = ptr.String(jtv) 8081 } 8082 8083 case "SourceDocumentsS3Uri": 8084 if value != nil { 8085 jtv, ok := value.(string) 8086 if !ok { 8087 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 8088 } 8089 sv.SourceDocumentsS3Uri = ptr.String(jtv) 8090 } 8091 8092 default: 8093 _, _ = key, value 8094 8095 } 8096 } 8097 *v = sv 8098 return nil 8099} 8100 8101func awsAwsjson11_deserializeDocumentBatchDetectDominantLanguageItemResult(v **types.BatchDetectDominantLanguageItemResult, value interface{}) error { 8102 if v == nil { 8103 return fmt.Errorf("unexpected nil of type %T", v) 8104 } 8105 if value == nil { 8106 return nil 8107 } 8108 8109 shape, ok := value.(map[string]interface{}) 8110 if !ok { 8111 return fmt.Errorf("unexpected JSON type %v", value) 8112 } 8113 8114 var sv *types.BatchDetectDominantLanguageItemResult 8115 if *v == nil { 8116 sv = &types.BatchDetectDominantLanguageItemResult{} 8117 } else { 8118 sv = *v 8119 } 8120 8121 for key, value := range shape { 8122 switch key { 8123 case "Index": 8124 if value != nil { 8125 jtv, ok := value.(json.Number) 8126 if !ok { 8127 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8128 } 8129 i64, err := jtv.Int64() 8130 if err != nil { 8131 return err 8132 } 8133 sv.Index = ptr.Int32(int32(i64)) 8134 } 8135 8136 case "Languages": 8137 if err := awsAwsjson11_deserializeDocumentListOfDominantLanguages(&sv.Languages, value); err != nil { 8138 return err 8139 } 8140 8141 default: 8142 _, _ = key, value 8143 8144 } 8145 } 8146 *v = sv 8147 return nil 8148} 8149 8150func awsAwsjson11_deserializeDocumentBatchDetectEntitiesItemResult(v **types.BatchDetectEntitiesItemResult, value interface{}) error { 8151 if v == nil { 8152 return fmt.Errorf("unexpected nil of type %T", v) 8153 } 8154 if value == nil { 8155 return nil 8156 } 8157 8158 shape, ok := value.(map[string]interface{}) 8159 if !ok { 8160 return fmt.Errorf("unexpected JSON type %v", value) 8161 } 8162 8163 var sv *types.BatchDetectEntitiesItemResult 8164 if *v == nil { 8165 sv = &types.BatchDetectEntitiesItemResult{} 8166 } else { 8167 sv = *v 8168 } 8169 8170 for key, value := range shape { 8171 switch key { 8172 case "Entities": 8173 if err := awsAwsjson11_deserializeDocumentListOfEntities(&sv.Entities, value); err != nil { 8174 return err 8175 } 8176 8177 case "Index": 8178 if value != nil { 8179 jtv, ok := value.(json.Number) 8180 if !ok { 8181 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8182 } 8183 i64, err := jtv.Int64() 8184 if err != nil { 8185 return err 8186 } 8187 sv.Index = ptr.Int32(int32(i64)) 8188 } 8189 8190 default: 8191 _, _ = key, value 8192 8193 } 8194 } 8195 *v = sv 8196 return nil 8197} 8198 8199func awsAwsjson11_deserializeDocumentBatchDetectKeyPhrasesItemResult(v **types.BatchDetectKeyPhrasesItemResult, value interface{}) error { 8200 if v == nil { 8201 return fmt.Errorf("unexpected nil of type %T", v) 8202 } 8203 if value == nil { 8204 return nil 8205 } 8206 8207 shape, ok := value.(map[string]interface{}) 8208 if !ok { 8209 return fmt.Errorf("unexpected JSON type %v", value) 8210 } 8211 8212 var sv *types.BatchDetectKeyPhrasesItemResult 8213 if *v == nil { 8214 sv = &types.BatchDetectKeyPhrasesItemResult{} 8215 } else { 8216 sv = *v 8217 } 8218 8219 for key, value := range shape { 8220 switch key { 8221 case "Index": 8222 if value != nil { 8223 jtv, ok := value.(json.Number) 8224 if !ok { 8225 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8226 } 8227 i64, err := jtv.Int64() 8228 if err != nil { 8229 return err 8230 } 8231 sv.Index = ptr.Int32(int32(i64)) 8232 } 8233 8234 case "KeyPhrases": 8235 if err := awsAwsjson11_deserializeDocumentListOfKeyPhrases(&sv.KeyPhrases, value); err != nil { 8236 return err 8237 } 8238 8239 default: 8240 _, _ = key, value 8241 8242 } 8243 } 8244 *v = sv 8245 return nil 8246} 8247 8248func awsAwsjson11_deserializeDocumentBatchDetectSentimentItemResult(v **types.BatchDetectSentimentItemResult, value interface{}) error { 8249 if v == nil { 8250 return fmt.Errorf("unexpected nil of type %T", v) 8251 } 8252 if value == nil { 8253 return nil 8254 } 8255 8256 shape, ok := value.(map[string]interface{}) 8257 if !ok { 8258 return fmt.Errorf("unexpected JSON type %v", value) 8259 } 8260 8261 var sv *types.BatchDetectSentimentItemResult 8262 if *v == nil { 8263 sv = &types.BatchDetectSentimentItemResult{} 8264 } else { 8265 sv = *v 8266 } 8267 8268 for key, value := range shape { 8269 switch key { 8270 case "Index": 8271 if value != nil { 8272 jtv, ok := value.(json.Number) 8273 if !ok { 8274 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8275 } 8276 i64, err := jtv.Int64() 8277 if err != nil { 8278 return err 8279 } 8280 sv.Index = ptr.Int32(int32(i64)) 8281 } 8282 8283 case "Sentiment": 8284 if value != nil { 8285 jtv, ok := value.(string) 8286 if !ok { 8287 return fmt.Errorf("expected SentimentType to be of type string, got %T instead", value) 8288 } 8289 sv.Sentiment = types.SentimentType(jtv) 8290 } 8291 8292 case "SentimentScore": 8293 if err := awsAwsjson11_deserializeDocumentSentimentScore(&sv.SentimentScore, value); err != nil { 8294 return err 8295 } 8296 8297 default: 8298 _, _ = key, value 8299 8300 } 8301 } 8302 *v = sv 8303 return nil 8304} 8305 8306func awsAwsjson11_deserializeDocumentBatchDetectSyntaxItemResult(v **types.BatchDetectSyntaxItemResult, value interface{}) error { 8307 if v == nil { 8308 return fmt.Errorf("unexpected nil of type %T", v) 8309 } 8310 if value == nil { 8311 return nil 8312 } 8313 8314 shape, ok := value.(map[string]interface{}) 8315 if !ok { 8316 return fmt.Errorf("unexpected JSON type %v", value) 8317 } 8318 8319 var sv *types.BatchDetectSyntaxItemResult 8320 if *v == nil { 8321 sv = &types.BatchDetectSyntaxItemResult{} 8322 } else { 8323 sv = *v 8324 } 8325 8326 for key, value := range shape { 8327 switch key { 8328 case "Index": 8329 if value != nil { 8330 jtv, ok := value.(json.Number) 8331 if !ok { 8332 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8333 } 8334 i64, err := jtv.Int64() 8335 if err != nil { 8336 return err 8337 } 8338 sv.Index = ptr.Int32(int32(i64)) 8339 } 8340 8341 case "SyntaxTokens": 8342 if err := awsAwsjson11_deserializeDocumentListOfSyntaxTokens(&sv.SyntaxTokens, value); err != nil { 8343 return err 8344 } 8345 8346 default: 8347 _, _ = key, value 8348 8349 } 8350 } 8351 *v = sv 8352 return nil 8353} 8354 8355func awsAwsjson11_deserializeDocumentBatchItemError(v **types.BatchItemError, value interface{}) error { 8356 if v == nil { 8357 return fmt.Errorf("unexpected nil of type %T", v) 8358 } 8359 if value == nil { 8360 return nil 8361 } 8362 8363 shape, ok := value.(map[string]interface{}) 8364 if !ok { 8365 return fmt.Errorf("unexpected JSON type %v", value) 8366 } 8367 8368 var sv *types.BatchItemError 8369 if *v == nil { 8370 sv = &types.BatchItemError{} 8371 } else { 8372 sv = *v 8373 } 8374 8375 for key, value := range shape { 8376 switch key { 8377 case "ErrorCode": 8378 if value != nil { 8379 jtv, ok := value.(string) 8380 if !ok { 8381 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8382 } 8383 sv.ErrorCode = ptr.String(jtv) 8384 } 8385 8386 case "ErrorMessage": 8387 if value != nil { 8388 jtv, ok := value.(string) 8389 if !ok { 8390 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8391 } 8392 sv.ErrorMessage = ptr.String(jtv) 8393 } 8394 8395 case "Index": 8396 if value != nil { 8397 jtv, ok := value.(json.Number) 8398 if !ok { 8399 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8400 } 8401 i64, err := jtv.Int64() 8402 if err != nil { 8403 return err 8404 } 8405 sv.Index = ptr.Int32(int32(i64)) 8406 } 8407 8408 default: 8409 _, _ = key, value 8410 8411 } 8412 } 8413 *v = sv 8414 return nil 8415} 8416 8417func awsAwsjson11_deserializeDocumentBatchItemErrorList(v *[]types.BatchItemError, value interface{}) error { 8418 if v == nil { 8419 return fmt.Errorf("unexpected nil of type %T", v) 8420 } 8421 if value == nil { 8422 return nil 8423 } 8424 8425 shape, ok := value.([]interface{}) 8426 if !ok { 8427 return fmt.Errorf("unexpected JSON type %v", value) 8428 } 8429 8430 var cv []types.BatchItemError 8431 if *v == nil { 8432 cv = []types.BatchItemError{} 8433 } else { 8434 cv = *v 8435 } 8436 8437 for _, value := range shape { 8438 var col types.BatchItemError 8439 destAddr := &col 8440 if err := awsAwsjson11_deserializeDocumentBatchItemError(&destAddr, value); err != nil { 8441 return err 8442 } 8443 col = *destAddr 8444 cv = append(cv, col) 8445 8446 } 8447 *v = cv 8448 return nil 8449} 8450 8451func awsAwsjson11_deserializeDocumentBatchSizeLimitExceededException(v **types.BatchSizeLimitExceededException, value interface{}) error { 8452 if v == nil { 8453 return fmt.Errorf("unexpected nil of type %T", v) 8454 } 8455 if value == nil { 8456 return nil 8457 } 8458 8459 shape, ok := value.(map[string]interface{}) 8460 if !ok { 8461 return fmt.Errorf("unexpected JSON type %v", value) 8462 } 8463 8464 var sv *types.BatchSizeLimitExceededException 8465 if *v == nil { 8466 sv = &types.BatchSizeLimitExceededException{} 8467 } else { 8468 sv = *v 8469 } 8470 8471 for key, value := range shape { 8472 switch key { 8473 case "Message": 8474 if value != nil { 8475 jtv, ok := value.(string) 8476 if !ok { 8477 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8478 } 8479 sv.Message = ptr.String(jtv) 8480 } 8481 8482 default: 8483 _, _ = key, value 8484 8485 } 8486 } 8487 *v = sv 8488 return nil 8489} 8490 8491func awsAwsjson11_deserializeDocumentClassifierEvaluationMetrics(v **types.ClassifierEvaluationMetrics, value interface{}) error { 8492 if v == nil { 8493 return fmt.Errorf("unexpected nil of type %T", v) 8494 } 8495 if value == nil { 8496 return nil 8497 } 8498 8499 shape, ok := value.(map[string]interface{}) 8500 if !ok { 8501 return fmt.Errorf("unexpected JSON type %v", value) 8502 } 8503 8504 var sv *types.ClassifierEvaluationMetrics 8505 if *v == nil { 8506 sv = &types.ClassifierEvaluationMetrics{} 8507 } else { 8508 sv = *v 8509 } 8510 8511 for key, value := range shape { 8512 switch key { 8513 case "Accuracy": 8514 if value != nil { 8515 switch jtv := value.(type) { 8516 case json.Number: 8517 f64, err := jtv.Float64() 8518 if err != nil { 8519 return err 8520 } 8521 sv.Accuracy = ptr.Float64(f64) 8522 8523 case string: 8524 var f64 float64 8525 switch { 8526 case strings.EqualFold(jtv, "NaN"): 8527 f64 = math.NaN() 8528 8529 case strings.EqualFold(jtv, "Infinity"): 8530 f64 = math.Inf(1) 8531 8532 case strings.EqualFold(jtv, "-Infinity"): 8533 f64 = math.Inf(-1) 8534 8535 default: 8536 return fmt.Errorf("unknown JSON number value: %s", jtv) 8537 8538 } 8539 sv.Accuracy = ptr.Float64(f64) 8540 8541 default: 8542 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 8543 8544 } 8545 } 8546 8547 case "F1Score": 8548 if value != nil { 8549 switch jtv := value.(type) { 8550 case json.Number: 8551 f64, err := jtv.Float64() 8552 if err != nil { 8553 return err 8554 } 8555 sv.F1Score = ptr.Float64(f64) 8556 8557 case string: 8558 var f64 float64 8559 switch { 8560 case strings.EqualFold(jtv, "NaN"): 8561 f64 = math.NaN() 8562 8563 case strings.EqualFold(jtv, "Infinity"): 8564 f64 = math.Inf(1) 8565 8566 case strings.EqualFold(jtv, "-Infinity"): 8567 f64 = math.Inf(-1) 8568 8569 default: 8570 return fmt.Errorf("unknown JSON number value: %s", jtv) 8571 8572 } 8573 sv.F1Score = ptr.Float64(f64) 8574 8575 default: 8576 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 8577 8578 } 8579 } 8580 8581 case "HammingLoss": 8582 if value != nil { 8583 switch jtv := value.(type) { 8584 case json.Number: 8585 f64, err := jtv.Float64() 8586 if err != nil { 8587 return err 8588 } 8589 sv.HammingLoss = ptr.Float64(f64) 8590 8591 case string: 8592 var f64 float64 8593 switch { 8594 case strings.EqualFold(jtv, "NaN"): 8595 f64 = math.NaN() 8596 8597 case strings.EqualFold(jtv, "Infinity"): 8598 f64 = math.Inf(1) 8599 8600 case strings.EqualFold(jtv, "-Infinity"): 8601 f64 = math.Inf(-1) 8602 8603 default: 8604 return fmt.Errorf("unknown JSON number value: %s", jtv) 8605 8606 } 8607 sv.HammingLoss = ptr.Float64(f64) 8608 8609 default: 8610 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 8611 8612 } 8613 } 8614 8615 case "MicroF1Score": 8616 if value != nil { 8617 switch jtv := value.(type) { 8618 case json.Number: 8619 f64, err := jtv.Float64() 8620 if err != nil { 8621 return err 8622 } 8623 sv.MicroF1Score = ptr.Float64(f64) 8624 8625 case string: 8626 var f64 float64 8627 switch { 8628 case strings.EqualFold(jtv, "NaN"): 8629 f64 = math.NaN() 8630 8631 case strings.EqualFold(jtv, "Infinity"): 8632 f64 = math.Inf(1) 8633 8634 case strings.EqualFold(jtv, "-Infinity"): 8635 f64 = math.Inf(-1) 8636 8637 default: 8638 return fmt.Errorf("unknown JSON number value: %s", jtv) 8639 8640 } 8641 sv.MicroF1Score = ptr.Float64(f64) 8642 8643 default: 8644 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 8645 8646 } 8647 } 8648 8649 case "MicroPrecision": 8650 if value != nil { 8651 switch jtv := value.(type) { 8652 case json.Number: 8653 f64, err := jtv.Float64() 8654 if err != nil { 8655 return err 8656 } 8657 sv.MicroPrecision = ptr.Float64(f64) 8658 8659 case string: 8660 var f64 float64 8661 switch { 8662 case strings.EqualFold(jtv, "NaN"): 8663 f64 = math.NaN() 8664 8665 case strings.EqualFold(jtv, "Infinity"): 8666 f64 = math.Inf(1) 8667 8668 case strings.EqualFold(jtv, "-Infinity"): 8669 f64 = math.Inf(-1) 8670 8671 default: 8672 return fmt.Errorf("unknown JSON number value: %s", jtv) 8673 8674 } 8675 sv.MicroPrecision = ptr.Float64(f64) 8676 8677 default: 8678 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 8679 8680 } 8681 } 8682 8683 case "MicroRecall": 8684 if value != nil { 8685 switch jtv := value.(type) { 8686 case json.Number: 8687 f64, err := jtv.Float64() 8688 if err != nil { 8689 return err 8690 } 8691 sv.MicroRecall = ptr.Float64(f64) 8692 8693 case string: 8694 var f64 float64 8695 switch { 8696 case strings.EqualFold(jtv, "NaN"): 8697 f64 = math.NaN() 8698 8699 case strings.EqualFold(jtv, "Infinity"): 8700 f64 = math.Inf(1) 8701 8702 case strings.EqualFold(jtv, "-Infinity"): 8703 f64 = math.Inf(-1) 8704 8705 default: 8706 return fmt.Errorf("unknown JSON number value: %s", jtv) 8707 8708 } 8709 sv.MicroRecall = ptr.Float64(f64) 8710 8711 default: 8712 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 8713 8714 } 8715 } 8716 8717 case "Precision": 8718 if value != nil { 8719 switch jtv := value.(type) { 8720 case json.Number: 8721 f64, err := jtv.Float64() 8722 if err != nil { 8723 return err 8724 } 8725 sv.Precision = ptr.Float64(f64) 8726 8727 case string: 8728 var f64 float64 8729 switch { 8730 case strings.EqualFold(jtv, "NaN"): 8731 f64 = math.NaN() 8732 8733 case strings.EqualFold(jtv, "Infinity"): 8734 f64 = math.Inf(1) 8735 8736 case strings.EqualFold(jtv, "-Infinity"): 8737 f64 = math.Inf(-1) 8738 8739 default: 8740 return fmt.Errorf("unknown JSON number value: %s", jtv) 8741 8742 } 8743 sv.Precision = ptr.Float64(f64) 8744 8745 default: 8746 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 8747 8748 } 8749 } 8750 8751 case "Recall": 8752 if value != nil { 8753 switch jtv := value.(type) { 8754 case json.Number: 8755 f64, err := jtv.Float64() 8756 if err != nil { 8757 return err 8758 } 8759 sv.Recall = ptr.Float64(f64) 8760 8761 case string: 8762 var f64 float64 8763 switch { 8764 case strings.EqualFold(jtv, "NaN"): 8765 f64 = math.NaN() 8766 8767 case strings.EqualFold(jtv, "Infinity"): 8768 f64 = math.Inf(1) 8769 8770 case strings.EqualFold(jtv, "-Infinity"): 8771 f64 = math.Inf(-1) 8772 8773 default: 8774 return fmt.Errorf("unknown JSON number value: %s", jtv) 8775 8776 } 8777 sv.Recall = ptr.Float64(f64) 8778 8779 default: 8780 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 8781 8782 } 8783 } 8784 8785 default: 8786 _, _ = key, value 8787 8788 } 8789 } 8790 *v = sv 8791 return nil 8792} 8793 8794func awsAwsjson11_deserializeDocumentClassifierMetadata(v **types.ClassifierMetadata, value interface{}) error { 8795 if v == nil { 8796 return fmt.Errorf("unexpected nil of type %T", v) 8797 } 8798 if value == nil { 8799 return nil 8800 } 8801 8802 shape, ok := value.(map[string]interface{}) 8803 if !ok { 8804 return fmt.Errorf("unexpected JSON type %v", value) 8805 } 8806 8807 var sv *types.ClassifierMetadata 8808 if *v == nil { 8809 sv = &types.ClassifierMetadata{} 8810 } else { 8811 sv = *v 8812 } 8813 8814 for key, value := range shape { 8815 switch key { 8816 case "EvaluationMetrics": 8817 if err := awsAwsjson11_deserializeDocumentClassifierEvaluationMetrics(&sv.EvaluationMetrics, value); err != nil { 8818 return err 8819 } 8820 8821 case "NumberOfLabels": 8822 if value != nil { 8823 jtv, ok := value.(json.Number) 8824 if !ok { 8825 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8826 } 8827 i64, err := jtv.Int64() 8828 if err != nil { 8829 return err 8830 } 8831 sv.NumberOfLabels = ptr.Int32(int32(i64)) 8832 } 8833 8834 case "NumberOfTestDocuments": 8835 if value != nil { 8836 jtv, ok := value.(json.Number) 8837 if !ok { 8838 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8839 } 8840 i64, err := jtv.Int64() 8841 if err != nil { 8842 return err 8843 } 8844 sv.NumberOfTestDocuments = ptr.Int32(int32(i64)) 8845 } 8846 8847 case "NumberOfTrainedDocuments": 8848 if value != nil { 8849 jtv, ok := value.(json.Number) 8850 if !ok { 8851 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 8852 } 8853 i64, err := jtv.Int64() 8854 if err != nil { 8855 return err 8856 } 8857 sv.NumberOfTrainedDocuments = ptr.Int32(int32(i64)) 8858 } 8859 8860 default: 8861 _, _ = key, value 8862 8863 } 8864 } 8865 *v = sv 8866 return nil 8867} 8868 8869func awsAwsjson11_deserializeDocumentConcurrentModificationException(v **types.ConcurrentModificationException, value interface{}) error { 8870 if v == nil { 8871 return fmt.Errorf("unexpected nil of type %T", v) 8872 } 8873 if value == nil { 8874 return nil 8875 } 8876 8877 shape, ok := value.(map[string]interface{}) 8878 if !ok { 8879 return fmt.Errorf("unexpected JSON type %v", value) 8880 } 8881 8882 var sv *types.ConcurrentModificationException 8883 if *v == nil { 8884 sv = &types.ConcurrentModificationException{} 8885 } else { 8886 sv = *v 8887 } 8888 8889 for key, value := range shape { 8890 switch key { 8891 case "Message": 8892 if value != nil { 8893 jtv, ok := value.(string) 8894 if !ok { 8895 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8896 } 8897 sv.Message = ptr.String(jtv) 8898 } 8899 8900 default: 8901 _, _ = key, value 8902 8903 } 8904 } 8905 *v = sv 8906 return nil 8907} 8908 8909func awsAwsjson11_deserializeDocumentDocumentClass(v **types.DocumentClass, value interface{}) error { 8910 if v == nil { 8911 return fmt.Errorf("unexpected nil of type %T", v) 8912 } 8913 if value == nil { 8914 return nil 8915 } 8916 8917 shape, ok := value.(map[string]interface{}) 8918 if !ok { 8919 return fmt.Errorf("unexpected JSON type %v", value) 8920 } 8921 8922 var sv *types.DocumentClass 8923 if *v == nil { 8924 sv = &types.DocumentClass{} 8925 } else { 8926 sv = *v 8927 } 8928 8929 for key, value := range shape { 8930 switch key { 8931 case "Name": 8932 if value != nil { 8933 jtv, ok := value.(string) 8934 if !ok { 8935 return fmt.Errorf("expected String to be of type string, got %T instead", value) 8936 } 8937 sv.Name = ptr.String(jtv) 8938 } 8939 8940 case "Score": 8941 if value != nil { 8942 switch jtv := value.(type) { 8943 case json.Number: 8944 f64, err := jtv.Float64() 8945 if err != nil { 8946 return err 8947 } 8948 sv.Score = ptr.Float32(float32(f64)) 8949 8950 case string: 8951 var f64 float64 8952 switch { 8953 case strings.EqualFold(jtv, "NaN"): 8954 f64 = math.NaN() 8955 8956 case strings.EqualFold(jtv, "Infinity"): 8957 f64 = math.Inf(1) 8958 8959 case strings.EqualFold(jtv, "-Infinity"): 8960 f64 = math.Inf(-1) 8961 8962 default: 8963 return fmt.Errorf("unknown JSON number value: %s", jtv) 8964 8965 } 8966 sv.Score = ptr.Float32(float32(f64)) 8967 8968 default: 8969 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 8970 8971 } 8972 } 8973 8974 default: 8975 _, _ = key, value 8976 8977 } 8978 } 8979 *v = sv 8980 return nil 8981} 8982 8983func awsAwsjson11_deserializeDocumentDocumentClassificationJobProperties(v **types.DocumentClassificationJobProperties, value interface{}) error { 8984 if v == nil { 8985 return fmt.Errorf("unexpected nil of type %T", v) 8986 } 8987 if value == nil { 8988 return nil 8989 } 8990 8991 shape, ok := value.(map[string]interface{}) 8992 if !ok { 8993 return fmt.Errorf("unexpected JSON type %v", value) 8994 } 8995 8996 var sv *types.DocumentClassificationJobProperties 8997 if *v == nil { 8998 sv = &types.DocumentClassificationJobProperties{} 8999 } else { 9000 sv = *v 9001 } 9002 9003 for key, value := range shape { 9004 switch key { 9005 case "DataAccessRoleArn": 9006 if value != nil { 9007 jtv, ok := value.(string) 9008 if !ok { 9009 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 9010 } 9011 sv.DataAccessRoleArn = ptr.String(jtv) 9012 } 9013 9014 case "DocumentClassifierArn": 9015 if value != nil { 9016 jtv, ok := value.(string) 9017 if !ok { 9018 return fmt.Errorf("expected DocumentClassifierArn to be of type string, got %T instead", value) 9019 } 9020 sv.DocumentClassifierArn = ptr.String(jtv) 9021 } 9022 9023 case "EndTime": 9024 if value != nil { 9025 switch jtv := value.(type) { 9026 case json.Number: 9027 f64, err := jtv.Float64() 9028 if err != nil { 9029 return err 9030 } 9031 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9032 9033 default: 9034 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9035 9036 } 9037 } 9038 9039 case "InputDataConfig": 9040 if err := awsAwsjson11_deserializeDocumentInputDataConfig(&sv.InputDataConfig, value); err != nil { 9041 return err 9042 } 9043 9044 case "JobArn": 9045 if value != nil { 9046 jtv, ok := value.(string) 9047 if !ok { 9048 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 9049 } 9050 sv.JobArn = ptr.String(jtv) 9051 } 9052 9053 case "JobId": 9054 if value != nil { 9055 jtv, ok := value.(string) 9056 if !ok { 9057 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 9058 } 9059 sv.JobId = ptr.String(jtv) 9060 } 9061 9062 case "JobName": 9063 if value != nil { 9064 jtv, ok := value.(string) 9065 if !ok { 9066 return fmt.Errorf("expected JobName to be of type string, got %T instead", value) 9067 } 9068 sv.JobName = ptr.String(jtv) 9069 } 9070 9071 case "JobStatus": 9072 if value != nil { 9073 jtv, ok := value.(string) 9074 if !ok { 9075 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 9076 } 9077 sv.JobStatus = types.JobStatus(jtv) 9078 } 9079 9080 case "Message": 9081 if value != nil { 9082 jtv, ok := value.(string) 9083 if !ok { 9084 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 9085 } 9086 sv.Message = ptr.String(jtv) 9087 } 9088 9089 case "OutputDataConfig": 9090 if err := awsAwsjson11_deserializeDocumentOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 9091 return err 9092 } 9093 9094 case "SubmitTime": 9095 if value != nil { 9096 switch jtv := value.(type) { 9097 case json.Number: 9098 f64, err := jtv.Float64() 9099 if err != nil { 9100 return err 9101 } 9102 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9103 9104 default: 9105 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9106 9107 } 9108 } 9109 9110 case "VolumeKmsKeyId": 9111 if value != nil { 9112 jtv, ok := value.(string) 9113 if !ok { 9114 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 9115 } 9116 sv.VolumeKmsKeyId = ptr.String(jtv) 9117 } 9118 9119 case "VpcConfig": 9120 if err := awsAwsjson11_deserializeDocumentVpcConfig(&sv.VpcConfig, value); err != nil { 9121 return err 9122 } 9123 9124 default: 9125 _, _ = key, value 9126 9127 } 9128 } 9129 *v = sv 9130 return nil 9131} 9132 9133func awsAwsjson11_deserializeDocumentDocumentClassificationJobPropertiesList(v *[]types.DocumentClassificationJobProperties, value interface{}) error { 9134 if v == nil { 9135 return fmt.Errorf("unexpected nil of type %T", v) 9136 } 9137 if value == nil { 9138 return nil 9139 } 9140 9141 shape, ok := value.([]interface{}) 9142 if !ok { 9143 return fmt.Errorf("unexpected JSON type %v", value) 9144 } 9145 9146 var cv []types.DocumentClassificationJobProperties 9147 if *v == nil { 9148 cv = []types.DocumentClassificationJobProperties{} 9149 } else { 9150 cv = *v 9151 } 9152 9153 for _, value := range shape { 9154 var col types.DocumentClassificationJobProperties 9155 destAddr := &col 9156 if err := awsAwsjson11_deserializeDocumentDocumentClassificationJobProperties(&destAddr, value); err != nil { 9157 return err 9158 } 9159 col = *destAddr 9160 cv = append(cv, col) 9161 9162 } 9163 *v = cv 9164 return nil 9165} 9166 9167func awsAwsjson11_deserializeDocumentDocumentClassifierAugmentedManifestsList(v *[]types.AugmentedManifestsListItem, value interface{}) error { 9168 if v == nil { 9169 return fmt.Errorf("unexpected nil of type %T", v) 9170 } 9171 if value == nil { 9172 return nil 9173 } 9174 9175 shape, ok := value.([]interface{}) 9176 if !ok { 9177 return fmt.Errorf("unexpected JSON type %v", value) 9178 } 9179 9180 var cv []types.AugmentedManifestsListItem 9181 if *v == nil { 9182 cv = []types.AugmentedManifestsListItem{} 9183 } else { 9184 cv = *v 9185 } 9186 9187 for _, value := range shape { 9188 var col types.AugmentedManifestsListItem 9189 destAddr := &col 9190 if err := awsAwsjson11_deserializeDocumentAugmentedManifestsListItem(&destAddr, value); err != nil { 9191 return err 9192 } 9193 col = *destAddr 9194 cv = append(cv, col) 9195 9196 } 9197 *v = cv 9198 return nil 9199} 9200 9201func awsAwsjson11_deserializeDocumentDocumentClassifierInputDataConfig(v **types.DocumentClassifierInputDataConfig, value interface{}) error { 9202 if v == nil { 9203 return fmt.Errorf("unexpected nil of type %T", v) 9204 } 9205 if value == nil { 9206 return nil 9207 } 9208 9209 shape, ok := value.(map[string]interface{}) 9210 if !ok { 9211 return fmt.Errorf("unexpected JSON type %v", value) 9212 } 9213 9214 var sv *types.DocumentClassifierInputDataConfig 9215 if *v == nil { 9216 sv = &types.DocumentClassifierInputDataConfig{} 9217 } else { 9218 sv = *v 9219 } 9220 9221 for key, value := range shape { 9222 switch key { 9223 case "AugmentedManifests": 9224 if err := awsAwsjson11_deserializeDocumentDocumentClassifierAugmentedManifestsList(&sv.AugmentedManifests, value); err != nil { 9225 return err 9226 } 9227 9228 case "DataFormat": 9229 if value != nil { 9230 jtv, ok := value.(string) 9231 if !ok { 9232 return fmt.Errorf("expected DocumentClassifierDataFormat to be of type string, got %T instead", value) 9233 } 9234 sv.DataFormat = types.DocumentClassifierDataFormat(jtv) 9235 } 9236 9237 case "LabelDelimiter": 9238 if value != nil { 9239 jtv, ok := value.(string) 9240 if !ok { 9241 return fmt.Errorf("expected LabelDelimiter to be of type string, got %T instead", value) 9242 } 9243 sv.LabelDelimiter = ptr.String(jtv) 9244 } 9245 9246 case "S3Uri": 9247 if value != nil { 9248 jtv, ok := value.(string) 9249 if !ok { 9250 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 9251 } 9252 sv.S3Uri = ptr.String(jtv) 9253 } 9254 9255 default: 9256 _, _ = key, value 9257 9258 } 9259 } 9260 *v = sv 9261 return nil 9262} 9263 9264func awsAwsjson11_deserializeDocumentDocumentClassifierOutputDataConfig(v **types.DocumentClassifierOutputDataConfig, value interface{}) error { 9265 if v == nil { 9266 return fmt.Errorf("unexpected nil of type %T", v) 9267 } 9268 if value == nil { 9269 return nil 9270 } 9271 9272 shape, ok := value.(map[string]interface{}) 9273 if !ok { 9274 return fmt.Errorf("unexpected JSON type %v", value) 9275 } 9276 9277 var sv *types.DocumentClassifierOutputDataConfig 9278 if *v == nil { 9279 sv = &types.DocumentClassifierOutputDataConfig{} 9280 } else { 9281 sv = *v 9282 } 9283 9284 for key, value := range shape { 9285 switch key { 9286 case "KmsKeyId": 9287 if value != nil { 9288 jtv, ok := value.(string) 9289 if !ok { 9290 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 9291 } 9292 sv.KmsKeyId = ptr.String(jtv) 9293 } 9294 9295 case "S3Uri": 9296 if value != nil { 9297 jtv, ok := value.(string) 9298 if !ok { 9299 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 9300 } 9301 sv.S3Uri = ptr.String(jtv) 9302 } 9303 9304 default: 9305 _, _ = key, value 9306 9307 } 9308 } 9309 *v = sv 9310 return nil 9311} 9312 9313func awsAwsjson11_deserializeDocumentDocumentClassifierProperties(v **types.DocumentClassifierProperties, value interface{}) error { 9314 if v == nil { 9315 return fmt.Errorf("unexpected nil of type %T", v) 9316 } 9317 if value == nil { 9318 return nil 9319 } 9320 9321 shape, ok := value.(map[string]interface{}) 9322 if !ok { 9323 return fmt.Errorf("unexpected JSON type %v", value) 9324 } 9325 9326 var sv *types.DocumentClassifierProperties 9327 if *v == nil { 9328 sv = &types.DocumentClassifierProperties{} 9329 } else { 9330 sv = *v 9331 } 9332 9333 for key, value := range shape { 9334 switch key { 9335 case "ClassifierMetadata": 9336 if err := awsAwsjson11_deserializeDocumentClassifierMetadata(&sv.ClassifierMetadata, value); err != nil { 9337 return err 9338 } 9339 9340 case "DataAccessRoleArn": 9341 if value != nil { 9342 jtv, ok := value.(string) 9343 if !ok { 9344 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 9345 } 9346 sv.DataAccessRoleArn = ptr.String(jtv) 9347 } 9348 9349 case "DocumentClassifierArn": 9350 if value != nil { 9351 jtv, ok := value.(string) 9352 if !ok { 9353 return fmt.Errorf("expected DocumentClassifierArn to be of type string, got %T instead", value) 9354 } 9355 sv.DocumentClassifierArn = ptr.String(jtv) 9356 } 9357 9358 case "EndTime": 9359 if value != nil { 9360 switch jtv := value.(type) { 9361 case json.Number: 9362 f64, err := jtv.Float64() 9363 if err != nil { 9364 return err 9365 } 9366 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9367 9368 default: 9369 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9370 9371 } 9372 } 9373 9374 case "InputDataConfig": 9375 if err := awsAwsjson11_deserializeDocumentDocumentClassifierInputDataConfig(&sv.InputDataConfig, value); err != nil { 9376 return err 9377 } 9378 9379 case "LanguageCode": 9380 if value != nil { 9381 jtv, ok := value.(string) 9382 if !ok { 9383 return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) 9384 } 9385 sv.LanguageCode = types.LanguageCode(jtv) 9386 } 9387 9388 case "Message": 9389 if value != nil { 9390 jtv, ok := value.(string) 9391 if !ok { 9392 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 9393 } 9394 sv.Message = ptr.String(jtv) 9395 } 9396 9397 case "Mode": 9398 if value != nil { 9399 jtv, ok := value.(string) 9400 if !ok { 9401 return fmt.Errorf("expected DocumentClassifierMode to be of type string, got %T instead", value) 9402 } 9403 sv.Mode = types.DocumentClassifierMode(jtv) 9404 } 9405 9406 case "ModelKmsKeyId": 9407 if value != nil { 9408 jtv, ok := value.(string) 9409 if !ok { 9410 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 9411 } 9412 sv.ModelKmsKeyId = ptr.String(jtv) 9413 } 9414 9415 case "OutputDataConfig": 9416 if err := awsAwsjson11_deserializeDocumentDocumentClassifierOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 9417 return err 9418 } 9419 9420 case "Status": 9421 if value != nil { 9422 jtv, ok := value.(string) 9423 if !ok { 9424 return fmt.Errorf("expected ModelStatus to be of type string, got %T instead", value) 9425 } 9426 sv.Status = types.ModelStatus(jtv) 9427 } 9428 9429 case "SubmitTime": 9430 if value != nil { 9431 switch jtv := value.(type) { 9432 case json.Number: 9433 f64, err := jtv.Float64() 9434 if err != nil { 9435 return err 9436 } 9437 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9438 9439 default: 9440 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9441 9442 } 9443 } 9444 9445 case "TrainingEndTime": 9446 if value != nil { 9447 switch jtv := value.(type) { 9448 case json.Number: 9449 f64, err := jtv.Float64() 9450 if err != nil { 9451 return err 9452 } 9453 sv.TrainingEndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9454 9455 default: 9456 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9457 9458 } 9459 } 9460 9461 case "TrainingStartTime": 9462 if value != nil { 9463 switch jtv := value.(type) { 9464 case json.Number: 9465 f64, err := jtv.Float64() 9466 if err != nil { 9467 return err 9468 } 9469 sv.TrainingStartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9470 9471 default: 9472 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9473 9474 } 9475 } 9476 9477 case "VolumeKmsKeyId": 9478 if value != nil { 9479 jtv, ok := value.(string) 9480 if !ok { 9481 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 9482 } 9483 sv.VolumeKmsKeyId = ptr.String(jtv) 9484 } 9485 9486 case "VpcConfig": 9487 if err := awsAwsjson11_deserializeDocumentVpcConfig(&sv.VpcConfig, value); err != nil { 9488 return err 9489 } 9490 9491 default: 9492 _, _ = key, value 9493 9494 } 9495 } 9496 *v = sv 9497 return nil 9498} 9499 9500func awsAwsjson11_deserializeDocumentDocumentClassifierPropertiesList(v *[]types.DocumentClassifierProperties, value interface{}) error { 9501 if v == nil { 9502 return fmt.Errorf("unexpected nil of type %T", v) 9503 } 9504 if value == nil { 9505 return nil 9506 } 9507 9508 shape, ok := value.([]interface{}) 9509 if !ok { 9510 return fmt.Errorf("unexpected JSON type %v", value) 9511 } 9512 9513 var cv []types.DocumentClassifierProperties 9514 if *v == nil { 9515 cv = []types.DocumentClassifierProperties{} 9516 } else { 9517 cv = *v 9518 } 9519 9520 for _, value := range shape { 9521 var col types.DocumentClassifierProperties 9522 destAddr := &col 9523 if err := awsAwsjson11_deserializeDocumentDocumentClassifierProperties(&destAddr, value); err != nil { 9524 return err 9525 } 9526 col = *destAddr 9527 cv = append(cv, col) 9528 9529 } 9530 *v = cv 9531 return nil 9532} 9533 9534func awsAwsjson11_deserializeDocumentDocumentLabel(v **types.DocumentLabel, value interface{}) error { 9535 if v == nil { 9536 return fmt.Errorf("unexpected nil of type %T", v) 9537 } 9538 if value == nil { 9539 return nil 9540 } 9541 9542 shape, ok := value.(map[string]interface{}) 9543 if !ok { 9544 return fmt.Errorf("unexpected JSON type %v", value) 9545 } 9546 9547 var sv *types.DocumentLabel 9548 if *v == nil { 9549 sv = &types.DocumentLabel{} 9550 } else { 9551 sv = *v 9552 } 9553 9554 for key, value := range shape { 9555 switch key { 9556 case "Name": 9557 if value != nil { 9558 jtv, ok := value.(string) 9559 if !ok { 9560 return fmt.Errorf("expected String to be of type string, got %T instead", value) 9561 } 9562 sv.Name = ptr.String(jtv) 9563 } 9564 9565 case "Score": 9566 if value != nil { 9567 switch jtv := value.(type) { 9568 case json.Number: 9569 f64, err := jtv.Float64() 9570 if err != nil { 9571 return err 9572 } 9573 sv.Score = ptr.Float32(float32(f64)) 9574 9575 case string: 9576 var f64 float64 9577 switch { 9578 case strings.EqualFold(jtv, "NaN"): 9579 f64 = math.NaN() 9580 9581 case strings.EqualFold(jtv, "Infinity"): 9582 f64 = math.Inf(1) 9583 9584 case strings.EqualFold(jtv, "-Infinity"): 9585 f64 = math.Inf(-1) 9586 9587 default: 9588 return fmt.Errorf("unknown JSON number value: %s", jtv) 9589 9590 } 9591 sv.Score = ptr.Float32(float32(f64)) 9592 9593 default: 9594 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 9595 9596 } 9597 } 9598 9599 default: 9600 _, _ = key, value 9601 9602 } 9603 } 9604 *v = sv 9605 return nil 9606} 9607 9608func awsAwsjson11_deserializeDocumentDocumentReaderConfig(v **types.DocumentReaderConfig, value interface{}) error { 9609 if v == nil { 9610 return fmt.Errorf("unexpected nil of type %T", v) 9611 } 9612 if value == nil { 9613 return nil 9614 } 9615 9616 shape, ok := value.(map[string]interface{}) 9617 if !ok { 9618 return fmt.Errorf("unexpected JSON type %v", value) 9619 } 9620 9621 var sv *types.DocumentReaderConfig 9622 if *v == nil { 9623 sv = &types.DocumentReaderConfig{} 9624 } else { 9625 sv = *v 9626 } 9627 9628 for key, value := range shape { 9629 switch key { 9630 case "DocumentReadAction": 9631 if value != nil { 9632 jtv, ok := value.(string) 9633 if !ok { 9634 return fmt.Errorf("expected DocumentReadAction to be of type string, got %T instead", value) 9635 } 9636 sv.DocumentReadAction = types.DocumentReadAction(jtv) 9637 } 9638 9639 case "DocumentReadMode": 9640 if value != nil { 9641 jtv, ok := value.(string) 9642 if !ok { 9643 return fmt.Errorf("expected DocumentReadMode to be of type string, got %T instead", value) 9644 } 9645 sv.DocumentReadMode = types.DocumentReadMode(jtv) 9646 } 9647 9648 case "FeatureTypes": 9649 if err := awsAwsjson11_deserializeDocumentListOfDocumentReadFeatureTypes(&sv.FeatureTypes, value); err != nil { 9650 return err 9651 } 9652 9653 default: 9654 _, _ = key, value 9655 9656 } 9657 } 9658 *v = sv 9659 return nil 9660} 9661 9662func awsAwsjson11_deserializeDocumentDominantLanguage(v **types.DominantLanguage, value interface{}) error { 9663 if v == nil { 9664 return fmt.Errorf("unexpected nil of type %T", v) 9665 } 9666 if value == nil { 9667 return nil 9668 } 9669 9670 shape, ok := value.(map[string]interface{}) 9671 if !ok { 9672 return fmt.Errorf("unexpected JSON type %v", value) 9673 } 9674 9675 var sv *types.DominantLanguage 9676 if *v == nil { 9677 sv = &types.DominantLanguage{} 9678 } else { 9679 sv = *v 9680 } 9681 9682 for key, value := range shape { 9683 switch key { 9684 case "LanguageCode": 9685 if value != nil { 9686 jtv, ok := value.(string) 9687 if !ok { 9688 return fmt.Errorf("expected String to be of type string, got %T instead", value) 9689 } 9690 sv.LanguageCode = ptr.String(jtv) 9691 } 9692 9693 case "Score": 9694 if value != nil { 9695 switch jtv := value.(type) { 9696 case json.Number: 9697 f64, err := jtv.Float64() 9698 if err != nil { 9699 return err 9700 } 9701 sv.Score = ptr.Float32(float32(f64)) 9702 9703 case string: 9704 var f64 float64 9705 switch { 9706 case strings.EqualFold(jtv, "NaN"): 9707 f64 = math.NaN() 9708 9709 case strings.EqualFold(jtv, "Infinity"): 9710 f64 = math.Inf(1) 9711 9712 case strings.EqualFold(jtv, "-Infinity"): 9713 f64 = math.Inf(-1) 9714 9715 default: 9716 return fmt.Errorf("unknown JSON number value: %s", jtv) 9717 9718 } 9719 sv.Score = ptr.Float32(float32(f64)) 9720 9721 default: 9722 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 9723 9724 } 9725 } 9726 9727 default: 9728 _, _ = key, value 9729 9730 } 9731 } 9732 *v = sv 9733 return nil 9734} 9735 9736func awsAwsjson11_deserializeDocumentDominantLanguageDetectionJobProperties(v **types.DominantLanguageDetectionJobProperties, value interface{}) error { 9737 if v == nil { 9738 return fmt.Errorf("unexpected nil of type %T", v) 9739 } 9740 if value == nil { 9741 return nil 9742 } 9743 9744 shape, ok := value.(map[string]interface{}) 9745 if !ok { 9746 return fmt.Errorf("unexpected JSON type %v", value) 9747 } 9748 9749 var sv *types.DominantLanguageDetectionJobProperties 9750 if *v == nil { 9751 sv = &types.DominantLanguageDetectionJobProperties{} 9752 } else { 9753 sv = *v 9754 } 9755 9756 for key, value := range shape { 9757 switch key { 9758 case "DataAccessRoleArn": 9759 if value != nil { 9760 jtv, ok := value.(string) 9761 if !ok { 9762 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 9763 } 9764 sv.DataAccessRoleArn = ptr.String(jtv) 9765 } 9766 9767 case "EndTime": 9768 if value != nil { 9769 switch jtv := value.(type) { 9770 case json.Number: 9771 f64, err := jtv.Float64() 9772 if err != nil { 9773 return err 9774 } 9775 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9776 9777 default: 9778 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9779 9780 } 9781 } 9782 9783 case "InputDataConfig": 9784 if err := awsAwsjson11_deserializeDocumentInputDataConfig(&sv.InputDataConfig, value); err != nil { 9785 return err 9786 } 9787 9788 case "JobArn": 9789 if value != nil { 9790 jtv, ok := value.(string) 9791 if !ok { 9792 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 9793 } 9794 sv.JobArn = ptr.String(jtv) 9795 } 9796 9797 case "JobId": 9798 if value != nil { 9799 jtv, ok := value.(string) 9800 if !ok { 9801 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 9802 } 9803 sv.JobId = ptr.String(jtv) 9804 } 9805 9806 case "JobName": 9807 if value != nil { 9808 jtv, ok := value.(string) 9809 if !ok { 9810 return fmt.Errorf("expected JobName to be of type string, got %T instead", value) 9811 } 9812 sv.JobName = ptr.String(jtv) 9813 } 9814 9815 case "JobStatus": 9816 if value != nil { 9817 jtv, ok := value.(string) 9818 if !ok { 9819 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 9820 } 9821 sv.JobStatus = types.JobStatus(jtv) 9822 } 9823 9824 case "Message": 9825 if value != nil { 9826 jtv, ok := value.(string) 9827 if !ok { 9828 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 9829 } 9830 sv.Message = ptr.String(jtv) 9831 } 9832 9833 case "OutputDataConfig": 9834 if err := awsAwsjson11_deserializeDocumentOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 9835 return err 9836 } 9837 9838 case "SubmitTime": 9839 if value != nil { 9840 switch jtv := value.(type) { 9841 case json.Number: 9842 f64, err := jtv.Float64() 9843 if err != nil { 9844 return err 9845 } 9846 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9847 9848 default: 9849 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9850 9851 } 9852 } 9853 9854 case "VolumeKmsKeyId": 9855 if value != nil { 9856 jtv, ok := value.(string) 9857 if !ok { 9858 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 9859 } 9860 sv.VolumeKmsKeyId = ptr.String(jtv) 9861 } 9862 9863 case "VpcConfig": 9864 if err := awsAwsjson11_deserializeDocumentVpcConfig(&sv.VpcConfig, value); err != nil { 9865 return err 9866 } 9867 9868 default: 9869 _, _ = key, value 9870 9871 } 9872 } 9873 *v = sv 9874 return nil 9875} 9876 9877func awsAwsjson11_deserializeDocumentDominantLanguageDetectionJobPropertiesList(v *[]types.DominantLanguageDetectionJobProperties, value interface{}) error { 9878 if v == nil { 9879 return fmt.Errorf("unexpected nil of type %T", v) 9880 } 9881 if value == nil { 9882 return nil 9883 } 9884 9885 shape, ok := value.([]interface{}) 9886 if !ok { 9887 return fmt.Errorf("unexpected JSON type %v", value) 9888 } 9889 9890 var cv []types.DominantLanguageDetectionJobProperties 9891 if *v == nil { 9892 cv = []types.DominantLanguageDetectionJobProperties{} 9893 } else { 9894 cv = *v 9895 } 9896 9897 for _, value := range shape { 9898 var col types.DominantLanguageDetectionJobProperties 9899 destAddr := &col 9900 if err := awsAwsjson11_deserializeDocumentDominantLanguageDetectionJobProperties(&destAddr, value); err != nil { 9901 return err 9902 } 9903 col = *destAddr 9904 cv = append(cv, col) 9905 9906 } 9907 *v = cv 9908 return nil 9909} 9910 9911func awsAwsjson11_deserializeDocumentEndpointProperties(v **types.EndpointProperties, value interface{}) error { 9912 if v == nil { 9913 return fmt.Errorf("unexpected nil of type %T", v) 9914 } 9915 if value == nil { 9916 return nil 9917 } 9918 9919 shape, ok := value.(map[string]interface{}) 9920 if !ok { 9921 return fmt.Errorf("unexpected JSON type %v", value) 9922 } 9923 9924 var sv *types.EndpointProperties 9925 if *v == nil { 9926 sv = &types.EndpointProperties{} 9927 } else { 9928 sv = *v 9929 } 9930 9931 for key, value := range shape { 9932 switch key { 9933 case "CreationTime": 9934 if value != nil { 9935 switch jtv := value.(type) { 9936 case json.Number: 9937 f64, err := jtv.Float64() 9938 if err != nil { 9939 return err 9940 } 9941 sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9942 9943 default: 9944 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9945 9946 } 9947 } 9948 9949 case "CurrentInferenceUnits": 9950 if value != nil { 9951 jtv, ok := value.(json.Number) 9952 if !ok { 9953 return fmt.Errorf("expected InferenceUnitsInteger to be json.Number, got %T instead", value) 9954 } 9955 i64, err := jtv.Int64() 9956 if err != nil { 9957 return err 9958 } 9959 sv.CurrentInferenceUnits = ptr.Int32(int32(i64)) 9960 } 9961 9962 case "DataAccessRoleArn": 9963 if value != nil { 9964 jtv, ok := value.(string) 9965 if !ok { 9966 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 9967 } 9968 sv.DataAccessRoleArn = ptr.String(jtv) 9969 } 9970 9971 case "DesiredInferenceUnits": 9972 if value != nil { 9973 jtv, ok := value.(json.Number) 9974 if !ok { 9975 return fmt.Errorf("expected InferenceUnitsInteger to be json.Number, got %T instead", value) 9976 } 9977 i64, err := jtv.Int64() 9978 if err != nil { 9979 return err 9980 } 9981 sv.DesiredInferenceUnits = ptr.Int32(int32(i64)) 9982 } 9983 9984 case "EndpointArn": 9985 if value != nil { 9986 jtv, ok := value.(string) 9987 if !ok { 9988 return fmt.Errorf("expected ComprehendEndpointArn to be of type string, got %T instead", value) 9989 } 9990 sv.EndpointArn = ptr.String(jtv) 9991 } 9992 9993 case "LastModifiedTime": 9994 if value != nil { 9995 switch jtv := value.(type) { 9996 case json.Number: 9997 f64, err := jtv.Float64() 9998 if err != nil { 9999 return err 10000 } 10001 sv.LastModifiedTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10002 10003 default: 10004 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10005 10006 } 10007 } 10008 10009 case "Message": 10010 if value != nil { 10011 jtv, ok := value.(string) 10012 if !ok { 10013 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 10014 } 10015 sv.Message = ptr.String(jtv) 10016 } 10017 10018 case "ModelArn": 10019 if value != nil { 10020 jtv, ok := value.(string) 10021 if !ok { 10022 return fmt.Errorf("expected ComprehendModelArn to be of type string, got %T instead", value) 10023 } 10024 sv.ModelArn = ptr.String(jtv) 10025 } 10026 10027 case "Status": 10028 if value != nil { 10029 jtv, ok := value.(string) 10030 if !ok { 10031 return fmt.Errorf("expected EndpointStatus to be of type string, got %T instead", value) 10032 } 10033 sv.Status = types.EndpointStatus(jtv) 10034 } 10035 10036 default: 10037 _, _ = key, value 10038 10039 } 10040 } 10041 *v = sv 10042 return nil 10043} 10044 10045func awsAwsjson11_deserializeDocumentEndpointPropertiesList(v *[]types.EndpointProperties, value interface{}) error { 10046 if v == nil { 10047 return fmt.Errorf("unexpected nil of type %T", v) 10048 } 10049 if value == nil { 10050 return nil 10051 } 10052 10053 shape, ok := value.([]interface{}) 10054 if !ok { 10055 return fmt.Errorf("unexpected JSON type %v", value) 10056 } 10057 10058 var cv []types.EndpointProperties 10059 if *v == nil { 10060 cv = []types.EndpointProperties{} 10061 } else { 10062 cv = *v 10063 } 10064 10065 for _, value := range shape { 10066 var col types.EndpointProperties 10067 destAddr := &col 10068 if err := awsAwsjson11_deserializeDocumentEndpointProperties(&destAddr, value); err != nil { 10069 return err 10070 } 10071 col = *destAddr 10072 cv = append(cv, col) 10073 10074 } 10075 *v = cv 10076 return nil 10077} 10078 10079func awsAwsjson11_deserializeDocumentEntitiesDetectionJobProperties(v **types.EntitiesDetectionJobProperties, value interface{}) error { 10080 if v == nil { 10081 return fmt.Errorf("unexpected nil of type %T", v) 10082 } 10083 if value == nil { 10084 return nil 10085 } 10086 10087 shape, ok := value.(map[string]interface{}) 10088 if !ok { 10089 return fmt.Errorf("unexpected JSON type %v", value) 10090 } 10091 10092 var sv *types.EntitiesDetectionJobProperties 10093 if *v == nil { 10094 sv = &types.EntitiesDetectionJobProperties{} 10095 } else { 10096 sv = *v 10097 } 10098 10099 for key, value := range shape { 10100 switch key { 10101 case "DataAccessRoleArn": 10102 if value != nil { 10103 jtv, ok := value.(string) 10104 if !ok { 10105 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 10106 } 10107 sv.DataAccessRoleArn = ptr.String(jtv) 10108 } 10109 10110 case "EndTime": 10111 if value != nil { 10112 switch jtv := value.(type) { 10113 case json.Number: 10114 f64, err := jtv.Float64() 10115 if err != nil { 10116 return err 10117 } 10118 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10119 10120 default: 10121 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10122 10123 } 10124 } 10125 10126 case "EntityRecognizerArn": 10127 if value != nil { 10128 jtv, ok := value.(string) 10129 if !ok { 10130 return fmt.Errorf("expected EntityRecognizerArn to be of type string, got %T instead", value) 10131 } 10132 sv.EntityRecognizerArn = ptr.String(jtv) 10133 } 10134 10135 case "InputDataConfig": 10136 if err := awsAwsjson11_deserializeDocumentInputDataConfig(&sv.InputDataConfig, value); err != nil { 10137 return err 10138 } 10139 10140 case "JobArn": 10141 if value != nil { 10142 jtv, ok := value.(string) 10143 if !ok { 10144 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 10145 } 10146 sv.JobArn = ptr.String(jtv) 10147 } 10148 10149 case "JobId": 10150 if value != nil { 10151 jtv, ok := value.(string) 10152 if !ok { 10153 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 10154 } 10155 sv.JobId = ptr.String(jtv) 10156 } 10157 10158 case "JobName": 10159 if value != nil { 10160 jtv, ok := value.(string) 10161 if !ok { 10162 return fmt.Errorf("expected JobName to be of type string, got %T instead", value) 10163 } 10164 sv.JobName = ptr.String(jtv) 10165 } 10166 10167 case "JobStatus": 10168 if value != nil { 10169 jtv, ok := value.(string) 10170 if !ok { 10171 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 10172 } 10173 sv.JobStatus = types.JobStatus(jtv) 10174 } 10175 10176 case "LanguageCode": 10177 if value != nil { 10178 jtv, ok := value.(string) 10179 if !ok { 10180 return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) 10181 } 10182 sv.LanguageCode = types.LanguageCode(jtv) 10183 } 10184 10185 case "Message": 10186 if value != nil { 10187 jtv, ok := value.(string) 10188 if !ok { 10189 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 10190 } 10191 sv.Message = ptr.String(jtv) 10192 } 10193 10194 case "OutputDataConfig": 10195 if err := awsAwsjson11_deserializeDocumentOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 10196 return err 10197 } 10198 10199 case "SubmitTime": 10200 if value != nil { 10201 switch jtv := value.(type) { 10202 case json.Number: 10203 f64, err := jtv.Float64() 10204 if err != nil { 10205 return err 10206 } 10207 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10208 10209 default: 10210 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10211 10212 } 10213 } 10214 10215 case "VolumeKmsKeyId": 10216 if value != nil { 10217 jtv, ok := value.(string) 10218 if !ok { 10219 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 10220 } 10221 sv.VolumeKmsKeyId = ptr.String(jtv) 10222 } 10223 10224 case "VpcConfig": 10225 if err := awsAwsjson11_deserializeDocumentVpcConfig(&sv.VpcConfig, value); err != nil { 10226 return err 10227 } 10228 10229 default: 10230 _, _ = key, value 10231 10232 } 10233 } 10234 *v = sv 10235 return nil 10236} 10237 10238func awsAwsjson11_deserializeDocumentEntitiesDetectionJobPropertiesList(v *[]types.EntitiesDetectionJobProperties, value interface{}) error { 10239 if v == nil { 10240 return fmt.Errorf("unexpected nil of type %T", v) 10241 } 10242 if value == nil { 10243 return nil 10244 } 10245 10246 shape, ok := value.([]interface{}) 10247 if !ok { 10248 return fmt.Errorf("unexpected JSON type %v", value) 10249 } 10250 10251 var cv []types.EntitiesDetectionJobProperties 10252 if *v == nil { 10253 cv = []types.EntitiesDetectionJobProperties{} 10254 } else { 10255 cv = *v 10256 } 10257 10258 for _, value := range shape { 10259 var col types.EntitiesDetectionJobProperties 10260 destAddr := &col 10261 if err := awsAwsjson11_deserializeDocumentEntitiesDetectionJobProperties(&destAddr, value); err != nil { 10262 return err 10263 } 10264 col = *destAddr 10265 cv = append(cv, col) 10266 10267 } 10268 *v = cv 10269 return nil 10270} 10271 10272func awsAwsjson11_deserializeDocumentEntity(v **types.Entity, value interface{}) error { 10273 if v == nil { 10274 return fmt.Errorf("unexpected nil of type %T", v) 10275 } 10276 if value == nil { 10277 return nil 10278 } 10279 10280 shape, ok := value.(map[string]interface{}) 10281 if !ok { 10282 return fmt.Errorf("unexpected JSON type %v", value) 10283 } 10284 10285 var sv *types.Entity 10286 if *v == nil { 10287 sv = &types.Entity{} 10288 } else { 10289 sv = *v 10290 } 10291 10292 for key, value := range shape { 10293 switch key { 10294 case "BeginOffset": 10295 if value != nil { 10296 jtv, ok := value.(json.Number) 10297 if !ok { 10298 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 10299 } 10300 i64, err := jtv.Int64() 10301 if err != nil { 10302 return err 10303 } 10304 sv.BeginOffset = ptr.Int32(int32(i64)) 10305 } 10306 10307 case "EndOffset": 10308 if value != nil { 10309 jtv, ok := value.(json.Number) 10310 if !ok { 10311 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 10312 } 10313 i64, err := jtv.Int64() 10314 if err != nil { 10315 return err 10316 } 10317 sv.EndOffset = ptr.Int32(int32(i64)) 10318 } 10319 10320 case "Score": 10321 if value != nil { 10322 switch jtv := value.(type) { 10323 case json.Number: 10324 f64, err := jtv.Float64() 10325 if err != nil { 10326 return err 10327 } 10328 sv.Score = ptr.Float32(float32(f64)) 10329 10330 case string: 10331 var f64 float64 10332 switch { 10333 case strings.EqualFold(jtv, "NaN"): 10334 f64 = math.NaN() 10335 10336 case strings.EqualFold(jtv, "Infinity"): 10337 f64 = math.Inf(1) 10338 10339 case strings.EqualFold(jtv, "-Infinity"): 10340 f64 = math.Inf(-1) 10341 10342 default: 10343 return fmt.Errorf("unknown JSON number value: %s", jtv) 10344 10345 } 10346 sv.Score = ptr.Float32(float32(f64)) 10347 10348 default: 10349 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 10350 10351 } 10352 } 10353 10354 case "Text": 10355 if value != nil { 10356 jtv, ok := value.(string) 10357 if !ok { 10358 return fmt.Errorf("expected String to be of type string, got %T instead", value) 10359 } 10360 sv.Text = ptr.String(jtv) 10361 } 10362 10363 case "Type": 10364 if value != nil { 10365 jtv, ok := value.(string) 10366 if !ok { 10367 return fmt.Errorf("expected EntityType to be of type string, got %T instead", value) 10368 } 10369 sv.Type = types.EntityType(jtv) 10370 } 10371 10372 default: 10373 _, _ = key, value 10374 10375 } 10376 } 10377 *v = sv 10378 return nil 10379} 10380 10381func awsAwsjson11_deserializeDocumentEntityLabel(v **types.EntityLabel, value interface{}) error { 10382 if v == nil { 10383 return fmt.Errorf("unexpected nil of type %T", v) 10384 } 10385 if value == nil { 10386 return nil 10387 } 10388 10389 shape, ok := value.(map[string]interface{}) 10390 if !ok { 10391 return fmt.Errorf("unexpected JSON type %v", value) 10392 } 10393 10394 var sv *types.EntityLabel 10395 if *v == nil { 10396 sv = &types.EntityLabel{} 10397 } else { 10398 sv = *v 10399 } 10400 10401 for key, value := range shape { 10402 switch key { 10403 case "Name": 10404 if value != nil { 10405 jtv, ok := value.(string) 10406 if !ok { 10407 return fmt.Errorf("expected PiiEntityType to be of type string, got %T instead", value) 10408 } 10409 sv.Name = types.PiiEntityType(jtv) 10410 } 10411 10412 case "Score": 10413 if value != nil { 10414 switch jtv := value.(type) { 10415 case json.Number: 10416 f64, err := jtv.Float64() 10417 if err != nil { 10418 return err 10419 } 10420 sv.Score = ptr.Float32(float32(f64)) 10421 10422 case string: 10423 var f64 float64 10424 switch { 10425 case strings.EqualFold(jtv, "NaN"): 10426 f64 = math.NaN() 10427 10428 case strings.EqualFold(jtv, "Infinity"): 10429 f64 = math.Inf(1) 10430 10431 case strings.EqualFold(jtv, "-Infinity"): 10432 f64 = math.Inf(-1) 10433 10434 default: 10435 return fmt.Errorf("unknown JSON number value: %s", jtv) 10436 10437 } 10438 sv.Score = ptr.Float32(float32(f64)) 10439 10440 default: 10441 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 10442 10443 } 10444 } 10445 10446 default: 10447 _, _ = key, value 10448 10449 } 10450 } 10451 *v = sv 10452 return nil 10453} 10454 10455func awsAwsjson11_deserializeDocumentEntityRecognizerAnnotations(v **types.EntityRecognizerAnnotations, value interface{}) error { 10456 if v == nil { 10457 return fmt.Errorf("unexpected nil of type %T", v) 10458 } 10459 if value == nil { 10460 return nil 10461 } 10462 10463 shape, ok := value.(map[string]interface{}) 10464 if !ok { 10465 return fmt.Errorf("unexpected JSON type %v", value) 10466 } 10467 10468 var sv *types.EntityRecognizerAnnotations 10469 if *v == nil { 10470 sv = &types.EntityRecognizerAnnotations{} 10471 } else { 10472 sv = *v 10473 } 10474 10475 for key, value := range shape { 10476 switch key { 10477 case "S3Uri": 10478 if value != nil { 10479 jtv, ok := value.(string) 10480 if !ok { 10481 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 10482 } 10483 sv.S3Uri = ptr.String(jtv) 10484 } 10485 10486 default: 10487 _, _ = key, value 10488 10489 } 10490 } 10491 *v = sv 10492 return nil 10493} 10494 10495func awsAwsjson11_deserializeDocumentEntityRecognizerAugmentedManifestsList(v *[]types.AugmentedManifestsListItem, value interface{}) error { 10496 if v == nil { 10497 return fmt.Errorf("unexpected nil of type %T", v) 10498 } 10499 if value == nil { 10500 return nil 10501 } 10502 10503 shape, ok := value.([]interface{}) 10504 if !ok { 10505 return fmt.Errorf("unexpected JSON type %v", value) 10506 } 10507 10508 var cv []types.AugmentedManifestsListItem 10509 if *v == nil { 10510 cv = []types.AugmentedManifestsListItem{} 10511 } else { 10512 cv = *v 10513 } 10514 10515 for _, value := range shape { 10516 var col types.AugmentedManifestsListItem 10517 destAddr := &col 10518 if err := awsAwsjson11_deserializeDocumentAugmentedManifestsListItem(&destAddr, value); err != nil { 10519 return err 10520 } 10521 col = *destAddr 10522 cv = append(cv, col) 10523 10524 } 10525 *v = cv 10526 return nil 10527} 10528 10529func awsAwsjson11_deserializeDocumentEntityRecognizerDocuments(v **types.EntityRecognizerDocuments, value interface{}) error { 10530 if v == nil { 10531 return fmt.Errorf("unexpected nil of type %T", v) 10532 } 10533 if value == nil { 10534 return nil 10535 } 10536 10537 shape, ok := value.(map[string]interface{}) 10538 if !ok { 10539 return fmt.Errorf("unexpected JSON type %v", value) 10540 } 10541 10542 var sv *types.EntityRecognizerDocuments 10543 if *v == nil { 10544 sv = &types.EntityRecognizerDocuments{} 10545 } else { 10546 sv = *v 10547 } 10548 10549 for key, value := range shape { 10550 switch key { 10551 case "S3Uri": 10552 if value != nil { 10553 jtv, ok := value.(string) 10554 if !ok { 10555 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 10556 } 10557 sv.S3Uri = ptr.String(jtv) 10558 } 10559 10560 default: 10561 _, _ = key, value 10562 10563 } 10564 } 10565 *v = sv 10566 return nil 10567} 10568 10569func awsAwsjson11_deserializeDocumentEntityRecognizerEntityList(v **types.EntityRecognizerEntityList, value interface{}) error { 10570 if v == nil { 10571 return fmt.Errorf("unexpected nil of type %T", v) 10572 } 10573 if value == nil { 10574 return nil 10575 } 10576 10577 shape, ok := value.(map[string]interface{}) 10578 if !ok { 10579 return fmt.Errorf("unexpected JSON type %v", value) 10580 } 10581 10582 var sv *types.EntityRecognizerEntityList 10583 if *v == nil { 10584 sv = &types.EntityRecognizerEntityList{} 10585 } else { 10586 sv = *v 10587 } 10588 10589 for key, value := range shape { 10590 switch key { 10591 case "S3Uri": 10592 if value != nil { 10593 jtv, ok := value.(string) 10594 if !ok { 10595 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 10596 } 10597 sv.S3Uri = ptr.String(jtv) 10598 } 10599 10600 default: 10601 _, _ = key, value 10602 10603 } 10604 } 10605 *v = sv 10606 return nil 10607} 10608 10609func awsAwsjson11_deserializeDocumentEntityRecognizerEvaluationMetrics(v **types.EntityRecognizerEvaluationMetrics, value interface{}) error { 10610 if v == nil { 10611 return fmt.Errorf("unexpected nil of type %T", v) 10612 } 10613 if value == nil { 10614 return nil 10615 } 10616 10617 shape, ok := value.(map[string]interface{}) 10618 if !ok { 10619 return fmt.Errorf("unexpected JSON type %v", value) 10620 } 10621 10622 var sv *types.EntityRecognizerEvaluationMetrics 10623 if *v == nil { 10624 sv = &types.EntityRecognizerEvaluationMetrics{} 10625 } else { 10626 sv = *v 10627 } 10628 10629 for key, value := range shape { 10630 switch key { 10631 case "F1Score": 10632 if value != nil { 10633 switch jtv := value.(type) { 10634 case json.Number: 10635 f64, err := jtv.Float64() 10636 if err != nil { 10637 return err 10638 } 10639 sv.F1Score = ptr.Float64(f64) 10640 10641 case string: 10642 var f64 float64 10643 switch { 10644 case strings.EqualFold(jtv, "NaN"): 10645 f64 = math.NaN() 10646 10647 case strings.EqualFold(jtv, "Infinity"): 10648 f64 = math.Inf(1) 10649 10650 case strings.EqualFold(jtv, "-Infinity"): 10651 f64 = math.Inf(-1) 10652 10653 default: 10654 return fmt.Errorf("unknown JSON number value: %s", jtv) 10655 10656 } 10657 sv.F1Score = ptr.Float64(f64) 10658 10659 default: 10660 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 10661 10662 } 10663 } 10664 10665 case "Precision": 10666 if value != nil { 10667 switch jtv := value.(type) { 10668 case json.Number: 10669 f64, err := jtv.Float64() 10670 if err != nil { 10671 return err 10672 } 10673 sv.Precision = ptr.Float64(f64) 10674 10675 case string: 10676 var f64 float64 10677 switch { 10678 case strings.EqualFold(jtv, "NaN"): 10679 f64 = math.NaN() 10680 10681 case strings.EqualFold(jtv, "Infinity"): 10682 f64 = math.Inf(1) 10683 10684 case strings.EqualFold(jtv, "-Infinity"): 10685 f64 = math.Inf(-1) 10686 10687 default: 10688 return fmt.Errorf("unknown JSON number value: %s", jtv) 10689 10690 } 10691 sv.Precision = ptr.Float64(f64) 10692 10693 default: 10694 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 10695 10696 } 10697 } 10698 10699 case "Recall": 10700 if value != nil { 10701 switch jtv := value.(type) { 10702 case json.Number: 10703 f64, err := jtv.Float64() 10704 if err != nil { 10705 return err 10706 } 10707 sv.Recall = ptr.Float64(f64) 10708 10709 case string: 10710 var f64 float64 10711 switch { 10712 case strings.EqualFold(jtv, "NaN"): 10713 f64 = math.NaN() 10714 10715 case strings.EqualFold(jtv, "Infinity"): 10716 f64 = math.Inf(1) 10717 10718 case strings.EqualFold(jtv, "-Infinity"): 10719 f64 = math.Inf(-1) 10720 10721 default: 10722 return fmt.Errorf("unknown JSON number value: %s", jtv) 10723 10724 } 10725 sv.Recall = ptr.Float64(f64) 10726 10727 default: 10728 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 10729 10730 } 10731 } 10732 10733 default: 10734 _, _ = key, value 10735 10736 } 10737 } 10738 *v = sv 10739 return nil 10740} 10741 10742func awsAwsjson11_deserializeDocumentEntityRecognizerInputDataConfig(v **types.EntityRecognizerInputDataConfig, value interface{}) error { 10743 if v == nil { 10744 return fmt.Errorf("unexpected nil of type %T", v) 10745 } 10746 if value == nil { 10747 return nil 10748 } 10749 10750 shape, ok := value.(map[string]interface{}) 10751 if !ok { 10752 return fmt.Errorf("unexpected JSON type %v", value) 10753 } 10754 10755 var sv *types.EntityRecognizerInputDataConfig 10756 if *v == nil { 10757 sv = &types.EntityRecognizerInputDataConfig{} 10758 } else { 10759 sv = *v 10760 } 10761 10762 for key, value := range shape { 10763 switch key { 10764 case "Annotations": 10765 if err := awsAwsjson11_deserializeDocumentEntityRecognizerAnnotations(&sv.Annotations, value); err != nil { 10766 return err 10767 } 10768 10769 case "AugmentedManifests": 10770 if err := awsAwsjson11_deserializeDocumentEntityRecognizerAugmentedManifestsList(&sv.AugmentedManifests, value); err != nil { 10771 return err 10772 } 10773 10774 case "DataFormat": 10775 if value != nil { 10776 jtv, ok := value.(string) 10777 if !ok { 10778 return fmt.Errorf("expected EntityRecognizerDataFormat to be of type string, got %T instead", value) 10779 } 10780 sv.DataFormat = types.EntityRecognizerDataFormat(jtv) 10781 } 10782 10783 case "Documents": 10784 if err := awsAwsjson11_deserializeDocumentEntityRecognizerDocuments(&sv.Documents, value); err != nil { 10785 return err 10786 } 10787 10788 case "EntityList": 10789 if err := awsAwsjson11_deserializeDocumentEntityRecognizerEntityList(&sv.EntityList, value); err != nil { 10790 return err 10791 } 10792 10793 case "EntityTypes": 10794 if err := awsAwsjson11_deserializeDocumentEntityTypesList(&sv.EntityTypes, value); err != nil { 10795 return err 10796 } 10797 10798 default: 10799 _, _ = key, value 10800 10801 } 10802 } 10803 *v = sv 10804 return nil 10805} 10806 10807func awsAwsjson11_deserializeDocumentEntityRecognizerMetadata(v **types.EntityRecognizerMetadata, value interface{}) error { 10808 if v == nil { 10809 return fmt.Errorf("unexpected nil of type %T", v) 10810 } 10811 if value == nil { 10812 return nil 10813 } 10814 10815 shape, ok := value.(map[string]interface{}) 10816 if !ok { 10817 return fmt.Errorf("unexpected JSON type %v", value) 10818 } 10819 10820 var sv *types.EntityRecognizerMetadata 10821 if *v == nil { 10822 sv = &types.EntityRecognizerMetadata{} 10823 } else { 10824 sv = *v 10825 } 10826 10827 for key, value := range shape { 10828 switch key { 10829 case "EntityTypes": 10830 if err := awsAwsjson11_deserializeDocumentEntityRecognizerMetadataEntityTypesList(&sv.EntityTypes, value); err != nil { 10831 return err 10832 } 10833 10834 case "EvaluationMetrics": 10835 if err := awsAwsjson11_deserializeDocumentEntityRecognizerEvaluationMetrics(&sv.EvaluationMetrics, value); err != nil { 10836 return err 10837 } 10838 10839 case "NumberOfTestDocuments": 10840 if value != nil { 10841 jtv, ok := value.(json.Number) 10842 if !ok { 10843 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 10844 } 10845 i64, err := jtv.Int64() 10846 if err != nil { 10847 return err 10848 } 10849 sv.NumberOfTestDocuments = ptr.Int32(int32(i64)) 10850 } 10851 10852 case "NumberOfTrainedDocuments": 10853 if value != nil { 10854 jtv, ok := value.(json.Number) 10855 if !ok { 10856 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 10857 } 10858 i64, err := jtv.Int64() 10859 if err != nil { 10860 return err 10861 } 10862 sv.NumberOfTrainedDocuments = ptr.Int32(int32(i64)) 10863 } 10864 10865 default: 10866 _, _ = key, value 10867 10868 } 10869 } 10870 *v = sv 10871 return nil 10872} 10873 10874func awsAwsjson11_deserializeDocumentEntityRecognizerMetadataEntityTypesList(v *[]types.EntityRecognizerMetadataEntityTypesListItem, value interface{}) error { 10875 if v == nil { 10876 return fmt.Errorf("unexpected nil of type %T", v) 10877 } 10878 if value == nil { 10879 return nil 10880 } 10881 10882 shape, ok := value.([]interface{}) 10883 if !ok { 10884 return fmt.Errorf("unexpected JSON type %v", value) 10885 } 10886 10887 var cv []types.EntityRecognizerMetadataEntityTypesListItem 10888 if *v == nil { 10889 cv = []types.EntityRecognizerMetadataEntityTypesListItem{} 10890 } else { 10891 cv = *v 10892 } 10893 10894 for _, value := range shape { 10895 var col types.EntityRecognizerMetadataEntityTypesListItem 10896 destAddr := &col 10897 if err := awsAwsjson11_deserializeDocumentEntityRecognizerMetadataEntityTypesListItem(&destAddr, value); err != nil { 10898 return err 10899 } 10900 col = *destAddr 10901 cv = append(cv, col) 10902 10903 } 10904 *v = cv 10905 return nil 10906} 10907 10908func awsAwsjson11_deserializeDocumentEntityRecognizerMetadataEntityTypesListItem(v **types.EntityRecognizerMetadataEntityTypesListItem, value interface{}) error { 10909 if v == nil { 10910 return fmt.Errorf("unexpected nil of type %T", v) 10911 } 10912 if value == nil { 10913 return nil 10914 } 10915 10916 shape, ok := value.(map[string]interface{}) 10917 if !ok { 10918 return fmt.Errorf("unexpected JSON type %v", value) 10919 } 10920 10921 var sv *types.EntityRecognizerMetadataEntityTypesListItem 10922 if *v == nil { 10923 sv = &types.EntityRecognizerMetadataEntityTypesListItem{} 10924 } else { 10925 sv = *v 10926 } 10927 10928 for key, value := range shape { 10929 switch key { 10930 case "EvaluationMetrics": 10931 if err := awsAwsjson11_deserializeDocumentEntityTypesEvaluationMetrics(&sv.EvaluationMetrics, value); err != nil { 10932 return err 10933 } 10934 10935 case "NumberOfTrainMentions": 10936 if value != nil { 10937 jtv, ok := value.(json.Number) 10938 if !ok { 10939 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 10940 } 10941 i64, err := jtv.Int64() 10942 if err != nil { 10943 return err 10944 } 10945 sv.NumberOfTrainMentions = ptr.Int32(int32(i64)) 10946 } 10947 10948 case "Type": 10949 if value != nil { 10950 jtv, ok := value.(string) 10951 if !ok { 10952 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 10953 } 10954 sv.Type = ptr.String(jtv) 10955 } 10956 10957 default: 10958 _, _ = key, value 10959 10960 } 10961 } 10962 *v = sv 10963 return nil 10964} 10965 10966func awsAwsjson11_deserializeDocumentEntityRecognizerProperties(v **types.EntityRecognizerProperties, value interface{}) error { 10967 if v == nil { 10968 return fmt.Errorf("unexpected nil of type %T", v) 10969 } 10970 if value == nil { 10971 return nil 10972 } 10973 10974 shape, ok := value.(map[string]interface{}) 10975 if !ok { 10976 return fmt.Errorf("unexpected JSON type %v", value) 10977 } 10978 10979 var sv *types.EntityRecognizerProperties 10980 if *v == nil { 10981 sv = &types.EntityRecognizerProperties{} 10982 } else { 10983 sv = *v 10984 } 10985 10986 for key, value := range shape { 10987 switch key { 10988 case "DataAccessRoleArn": 10989 if value != nil { 10990 jtv, ok := value.(string) 10991 if !ok { 10992 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 10993 } 10994 sv.DataAccessRoleArn = ptr.String(jtv) 10995 } 10996 10997 case "EndTime": 10998 if value != nil { 10999 switch jtv := value.(type) { 11000 case json.Number: 11001 f64, err := jtv.Float64() 11002 if err != nil { 11003 return err 11004 } 11005 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11006 11007 default: 11008 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11009 11010 } 11011 } 11012 11013 case "EntityRecognizerArn": 11014 if value != nil { 11015 jtv, ok := value.(string) 11016 if !ok { 11017 return fmt.Errorf("expected EntityRecognizerArn to be of type string, got %T instead", value) 11018 } 11019 sv.EntityRecognizerArn = ptr.String(jtv) 11020 } 11021 11022 case "InputDataConfig": 11023 if err := awsAwsjson11_deserializeDocumentEntityRecognizerInputDataConfig(&sv.InputDataConfig, value); err != nil { 11024 return err 11025 } 11026 11027 case "LanguageCode": 11028 if value != nil { 11029 jtv, ok := value.(string) 11030 if !ok { 11031 return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) 11032 } 11033 sv.LanguageCode = types.LanguageCode(jtv) 11034 } 11035 11036 case "Message": 11037 if value != nil { 11038 jtv, ok := value.(string) 11039 if !ok { 11040 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 11041 } 11042 sv.Message = ptr.String(jtv) 11043 } 11044 11045 case "ModelKmsKeyId": 11046 if value != nil { 11047 jtv, ok := value.(string) 11048 if !ok { 11049 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 11050 } 11051 sv.ModelKmsKeyId = ptr.String(jtv) 11052 } 11053 11054 case "RecognizerMetadata": 11055 if err := awsAwsjson11_deserializeDocumentEntityRecognizerMetadata(&sv.RecognizerMetadata, value); err != nil { 11056 return err 11057 } 11058 11059 case "Status": 11060 if value != nil { 11061 jtv, ok := value.(string) 11062 if !ok { 11063 return fmt.Errorf("expected ModelStatus to be of type string, got %T instead", value) 11064 } 11065 sv.Status = types.ModelStatus(jtv) 11066 } 11067 11068 case "SubmitTime": 11069 if value != nil { 11070 switch jtv := value.(type) { 11071 case json.Number: 11072 f64, err := jtv.Float64() 11073 if err != nil { 11074 return err 11075 } 11076 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11077 11078 default: 11079 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11080 11081 } 11082 } 11083 11084 case "TrainingEndTime": 11085 if value != nil { 11086 switch jtv := value.(type) { 11087 case json.Number: 11088 f64, err := jtv.Float64() 11089 if err != nil { 11090 return err 11091 } 11092 sv.TrainingEndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11093 11094 default: 11095 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11096 11097 } 11098 } 11099 11100 case "TrainingStartTime": 11101 if value != nil { 11102 switch jtv := value.(type) { 11103 case json.Number: 11104 f64, err := jtv.Float64() 11105 if err != nil { 11106 return err 11107 } 11108 sv.TrainingStartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11109 11110 default: 11111 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11112 11113 } 11114 } 11115 11116 case "VolumeKmsKeyId": 11117 if value != nil { 11118 jtv, ok := value.(string) 11119 if !ok { 11120 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 11121 } 11122 sv.VolumeKmsKeyId = ptr.String(jtv) 11123 } 11124 11125 case "VpcConfig": 11126 if err := awsAwsjson11_deserializeDocumentVpcConfig(&sv.VpcConfig, value); err != nil { 11127 return err 11128 } 11129 11130 default: 11131 _, _ = key, value 11132 11133 } 11134 } 11135 *v = sv 11136 return nil 11137} 11138 11139func awsAwsjson11_deserializeDocumentEntityRecognizerPropertiesList(v *[]types.EntityRecognizerProperties, value interface{}) error { 11140 if v == nil { 11141 return fmt.Errorf("unexpected nil of type %T", v) 11142 } 11143 if value == nil { 11144 return nil 11145 } 11146 11147 shape, ok := value.([]interface{}) 11148 if !ok { 11149 return fmt.Errorf("unexpected JSON type %v", value) 11150 } 11151 11152 var cv []types.EntityRecognizerProperties 11153 if *v == nil { 11154 cv = []types.EntityRecognizerProperties{} 11155 } else { 11156 cv = *v 11157 } 11158 11159 for _, value := range shape { 11160 var col types.EntityRecognizerProperties 11161 destAddr := &col 11162 if err := awsAwsjson11_deserializeDocumentEntityRecognizerProperties(&destAddr, value); err != nil { 11163 return err 11164 } 11165 col = *destAddr 11166 cv = append(cv, col) 11167 11168 } 11169 *v = cv 11170 return nil 11171} 11172 11173func awsAwsjson11_deserializeDocumentEntityTypesEvaluationMetrics(v **types.EntityTypesEvaluationMetrics, value interface{}) error { 11174 if v == nil { 11175 return fmt.Errorf("unexpected nil of type %T", v) 11176 } 11177 if value == nil { 11178 return nil 11179 } 11180 11181 shape, ok := value.(map[string]interface{}) 11182 if !ok { 11183 return fmt.Errorf("unexpected JSON type %v", value) 11184 } 11185 11186 var sv *types.EntityTypesEvaluationMetrics 11187 if *v == nil { 11188 sv = &types.EntityTypesEvaluationMetrics{} 11189 } else { 11190 sv = *v 11191 } 11192 11193 for key, value := range shape { 11194 switch key { 11195 case "F1Score": 11196 if value != nil { 11197 switch jtv := value.(type) { 11198 case json.Number: 11199 f64, err := jtv.Float64() 11200 if err != nil { 11201 return err 11202 } 11203 sv.F1Score = ptr.Float64(f64) 11204 11205 case string: 11206 var f64 float64 11207 switch { 11208 case strings.EqualFold(jtv, "NaN"): 11209 f64 = math.NaN() 11210 11211 case strings.EqualFold(jtv, "Infinity"): 11212 f64 = math.Inf(1) 11213 11214 case strings.EqualFold(jtv, "-Infinity"): 11215 f64 = math.Inf(-1) 11216 11217 default: 11218 return fmt.Errorf("unknown JSON number value: %s", jtv) 11219 11220 } 11221 sv.F1Score = ptr.Float64(f64) 11222 11223 default: 11224 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 11225 11226 } 11227 } 11228 11229 case "Precision": 11230 if value != nil { 11231 switch jtv := value.(type) { 11232 case json.Number: 11233 f64, err := jtv.Float64() 11234 if err != nil { 11235 return err 11236 } 11237 sv.Precision = ptr.Float64(f64) 11238 11239 case string: 11240 var f64 float64 11241 switch { 11242 case strings.EqualFold(jtv, "NaN"): 11243 f64 = math.NaN() 11244 11245 case strings.EqualFold(jtv, "Infinity"): 11246 f64 = math.Inf(1) 11247 11248 case strings.EqualFold(jtv, "-Infinity"): 11249 f64 = math.Inf(-1) 11250 11251 default: 11252 return fmt.Errorf("unknown JSON number value: %s", jtv) 11253 11254 } 11255 sv.Precision = ptr.Float64(f64) 11256 11257 default: 11258 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 11259 11260 } 11261 } 11262 11263 case "Recall": 11264 if value != nil { 11265 switch jtv := value.(type) { 11266 case json.Number: 11267 f64, err := jtv.Float64() 11268 if err != nil { 11269 return err 11270 } 11271 sv.Recall = ptr.Float64(f64) 11272 11273 case string: 11274 var f64 float64 11275 switch { 11276 case strings.EqualFold(jtv, "NaN"): 11277 f64 = math.NaN() 11278 11279 case strings.EqualFold(jtv, "Infinity"): 11280 f64 = math.Inf(1) 11281 11282 case strings.EqualFold(jtv, "-Infinity"): 11283 f64 = math.Inf(-1) 11284 11285 default: 11286 return fmt.Errorf("unknown JSON number value: %s", jtv) 11287 11288 } 11289 sv.Recall = ptr.Float64(f64) 11290 11291 default: 11292 return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value) 11293 11294 } 11295 } 11296 11297 default: 11298 _, _ = key, value 11299 11300 } 11301 } 11302 *v = sv 11303 return nil 11304} 11305 11306func awsAwsjson11_deserializeDocumentEntityTypesList(v *[]types.EntityTypesListItem, value interface{}) error { 11307 if v == nil { 11308 return fmt.Errorf("unexpected nil of type %T", v) 11309 } 11310 if value == nil { 11311 return nil 11312 } 11313 11314 shape, ok := value.([]interface{}) 11315 if !ok { 11316 return fmt.Errorf("unexpected JSON type %v", value) 11317 } 11318 11319 var cv []types.EntityTypesListItem 11320 if *v == nil { 11321 cv = []types.EntityTypesListItem{} 11322 } else { 11323 cv = *v 11324 } 11325 11326 for _, value := range shape { 11327 var col types.EntityTypesListItem 11328 destAddr := &col 11329 if err := awsAwsjson11_deserializeDocumentEntityTypesListItem(&destAddr, value); err != nil { 11330 return err 11331 } 11332 col = *destAddr 11333 cv = append(cv, col) 11334 11335 } 11336 *v = cv 11337 return nil 11338} 11339 11340func awsAwsjson11_deserializeDocumentEntityTypesListItem(v **types.EntityTypesListItem, value interface{}) error { 11341 if v == nil { 11342 return fmt.Errorf("unexpected nil of type %T", v) 11343 } 11344 if value == nil { 11345 return nil 11346 } 11347 11348 shape, ok := value.(map[string]interface{}) 11349 if !ok { 11350 return fmt.Errorf("unexpected JSON type %v", value) 11351 } 11352 11353 var sv *types.EntityTypesListItem 11354 if *v == nil { 11355 sv = &types.EntityTypesListItem{} 11356 } else { 11357 sv = *v 11358 } 11359 11360 for key, value := range shape { 11361 switch key { 11362 case "Type": 11363 if value != nil { 11364 jtv, ok := value.(string) 11365 if !ok { 11366 return fmt.Errorf("expected EntityTypeName to be of type string, got %T instead", value) 11367 } 11368 sv.Type = ptr.String(jtv) 11369 } 11370 11371 default: 11372 _, _ = key, value 11373 11374 } 11375 } 11376 *v = sv 11377 return nil 11378} 11379 11380func awsAwsjson11_deserializeDocumentEventsDetectionJobProperties(v **types.EventsDetectionJobProperties, value interface{}) error { 11381 if v == nil { 11382 return fmt.Errorf("unexpected nil of type %T", v) 11383 } 11384 if value == nil { 11385 return nil 11386 } 11387 11388 shape, ok := value.(map[string]interface{}) 11389 if !ok { 11390 return fmt.Errorf("unexpected JSON type %v", value) 11391 } 11392 11393 var sv *types.EventsDetectionJobProperties 11394 if *v == nil { 11395 sv = &types.EventsDetectionJobProperties{} 11396 } else { 11397 sv = *v 11398 } 11399 11400 for key, value := range shape { 11401 switch key { 11402 case "DataAccessRoleArn": 11403 if value != nil { 11404 jtv, ok := value.(string) 11405 if !ok { 11406 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 11407 } 11408 sv.DataAccessRoleArn = ptr.String(jtv) 11409 } 11410 11411 case "EndTime": 11412 if value != nil { 11413 switch jtv := value.(type) { 11414 case json.Number: 11415 f64, err := jtv.Float64() 11416 if err != nil { 11417 return err 11418 } 11419 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11420 11421 default: 11422 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11423 11424 } 11425 } 11426 11427 case "InputDataConfig": 11428 if err := awsAwsjson11_deserializeDocumentInputDataConfig(&sv.InputDataConfig, value); err != nil { 11429 return err 11430 } 11431 11432 case "JobArn": 11433 if value != nil { 11434 jtv, ok := value.(string) 11435 if !ok { 11436 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 11437 } 11438 sv.JobArn = ptr.String(jtv) 11439 } 11440 11441 case "JobId": 11442 if value != nil { 11443 jtv, ok := value.(string) 11444 if !ok { 11445 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 11446 } 11447 sv.JobId = ptr.String(jtv) 11448 } 11449 11450 case "JobName": 11451 if value != nil { 11452 jtv, ok := value.(string) 11453 if !ok { 11454 return fmt.Errorf("expected JobName to be of type string, got %T instead", value) 11455 } 11456 sv.JobName = ptr.String(jtv) 11457 } 11458 11459 case "JobStatus": 11460 if value != nil { 11461 jtv, ok := value.(string) 11462 if !ok { 11463 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 11464 } 11465 sv.JobStatus = types.JobStatus(jtv) 11466 } 11467 11468 case "LanguageCode": 11469 if value != nil { 11470 jtv, ok := value.(string) 11471 if !ok { 11472 return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) 11473 } 11474 sv.LanguageCode = types.LanguageCode(jtv) 11475 } 11476 11477 case "Message": 11478 if value != nil { 11479 jtv, ok := value.(string) 11480 if !ok { 11481 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 11482 } 11483 sv.Message = ptr.String(jtv) 11484 } 11485 11486 case "OutputDataConfig": 11487 if err := awsAwsjson11_deserializeDocumentOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 11488 return err 11489 } 11490 11491 case "SubmitTime": 11492 if value != nil { 11493 switch jtv := value.(type) { 11494 case json.Number: 11495 f64, err := jtv.Float64() 11496 if err != nil { 11497 return err 11498 } 11499 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11500 11501 default: 11502 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11503 11504 } 11505 } 11506 11507 case "TargetEventTypes": 11508 if err := awsAwsjson11_deserializeDocumentTargetEventTypes(&sv.TargetEventTypes, value); err != nil { 11509 return err 11510 } 11511 11512 default: 11513 _, _ = key, value 11514 11515 } 11516 } 11517 *v = sv 11518 return nil 11519} 11520 11521func awsAwsjson11_deserializeDocumentEventsDetectionJobPropertiesList(v *[]types.EventsDetectionJobProperties, value interface{}) error { 11522 if v == nil { 11523 return fmt.Errorf("unexpected nil of type %T", v) 11524 } 11525 if value == nil { 11526 return nil 11527 } 11528 11529 shape, ok := value.([]interface{}) 11530 if !ok { 11531 return fmt.Errorf("unexpected JSON type %v", value) 11532 } 11533 11534 var cv []types.EventsDetectionJobProperties 11535 if *v == nil { 11536 cv = []types.EventsDetectionJobProperties{} 11537 } else { 11538 cv = *v 11539 } 11540 11541 for _, value := range shape { 11542 var col types.EventsDetectionJobProperties 11543 destAddr := &col 11544 if err := awsAwsjson11_deserializeDocumentEventsDetectionJobProperties(&destAddr, value); err != nil { 11545 return err 11546 } 11547 col = *destAddr 11548 cv = append(cv, col) 11549 11550 } 11551 *v = cv 11552 return nil 11553} 11554 11555func awsAwsjson11_deserializeDocumentInputDataConfig(v **types.InputDataConfig, value interface{}) error { 11556 if v == nil { 11557 return fmt.Errorf("unexpected nil of type %T", v) 11558 } 11559 if value == nil { 11560 return nil 11561 } 11562 11563 shape, ok := value.(map[string]interface{}) 11564 if !ok { 11565 return fmt.Errorf("unexpected JSON type %v", value) 11566 } 11567 11568 var sv *types.InputDataConfig 11569 if *v == nil { 11570 sv = &types.InputDataConfig{} 11571 } else { 11572 sv = *v 11573 } 11574 11575 for key, value := range shape { 11576 switch key { 11577 case "DocumentReaderConfig": 11578 if err := awsAwsjson11_deserializeDocumentDocumentReaderConfig(&sv.DocumentReaderConfig, value); err != nil { 11579 return err 11580 } 11581 11582 case "InputFormat": 11583 if value != nil { 11584 jtv, ok := value.(string) 11585 if !ok { 11586 return fmt.Errorf("expected InputFormat to be of type string, got %T instead", value) 11587 } 11588 sv.InputFormat = types.InputFormat(jtv) 11589 } 11590 11591 case "S3Uri": 11592 if value != nil { 11593 jtv, ok := value.(string) 11594 if !ok { 11595 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 11596 } 11597 sv.S3Uri = ptr.String(jtv) 11598 } 11599 11600 default: 11601 _, _ = key, value 11602 11603 } 11604 } 11605 *v = sv 11606 return nil 11607} 11608 11609func awsAwsjson11_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { 11610 if v == nil { 11611 return fmt.Errorf("unexpected nil of type %T", v) 11612 } 11613 if value == nil { 11614 return nil 11615 } 11616 11617 shape, ok := value.(map[string]interface{}) 11618 if !ok { 11619 return fmt.Errorf("unexpected JSON type %v", value) 11620 } 11621 11622 var sv *types.InternalServerException 11623 if *v == nil { 11624 sv = &types.InternalServerException{} 11625 } else { 11626 sv = *v 11627 } 11628 11629 for key, value := range shape { 11630 switch key { 11631 case "Message": 11632 if value != nil { 11633 jtv, ok := value.(string) 11634 if !ok { 11635 return fmt.Errorf("expected String to be of type string, got %T instead", value) 11636 } 11637 sv.Message = ptr.String(jtv) 11638 } 11639 11640 default: 11641 _, _ = key, value 11642 11643 } 11644 } 11645 *v = sv 11646 return nil 11647} 11648 11649func awsAwsjson11_deserializeDocumentInvalidFilterException(v **types.InvalidFilterException, value interface{}) error { 11650 if v == nil { 11651 return fmt.Errorf("unexpected nil of type %T", v) 11652 } 11653 if value == nil { 11654 return nil 11655 } 11656 11657 shape, ok := value.(map[string]interface{}) 11658 if !ok { 11659 return fmt.Errorf("unexpected JSON type %v", value) 11660 } 11661 11662 var sv *types.InvalidFilterException 11663 if *v == nil { 11664 sv = &types.InvalidFilterException{} 11665 } else { 11666 sv = *v 11667 } 11668 11669 for key, value := range shape { 11670 switch key { 11671 case "Message": 11672 if value != nil { 11673 jtv, ok := value.(string) 11674 if !ok { 11675 return fmt.Errorf("expected String to be of type string, got %T instead", value) 11676 } 11677 sv.Message = ptr.String(jtv) 11678 } 11679 11680 default: 11681 _, _ = key, value 11682 11683 } 11684 } 11685 *v = sv 11686 return nil 11687} 11688 11689func awsAwsjson11_deserializeDocumentInvalidRequestException(v **types.InvalidRequestException, value interface{}) error { 11690 if v == nil { 11691 return fmt.Errorf("unexpected nil of type %T", v) 11692 } 11693 if value == nil { 11694 return nil 11695 } 11696 11697 shape, ok := value.(map[string]interface{}) 11698 if !ok { 11699 return fmt.Errorf("unexpected JSON type %v", value) 11700 } 11701 11702 var sv *types.InvalidRequestException 11703 if *v == nil { 11704 sv = &types.InvalidRequestException{} 11705 } else { 11706 sv = *v 11707 } 11708 11709 for key, value := range shape { 11710 switch key { 11711 case "Message": 11712 if value != nil { 11713 jtv, ok := value.(string) 11714 if !ok { 11715 return fmt.Errorf("expected String to be of type string, got %T instead", value) 11716 } 11717 sv.Message = ptr.String(jtv) 11718 } 11719 11720 default: 11721 _, _ = key, value 11722 11723 } 11724 } 11725 *v = sv 11726 return nil 11727} 11728 11729func awsAwsjson11_deserializeDocumentJobNotFoundException(v **types.JobNotFoundException, value interface{}) error { 11730 if v == nil { 11731 return fmt.Errorf("unexpected nil of type %T", v) 11732 } 11733 if value == nil { 11734 return nil 11735 } 11736 11737 shape, ok := value.(map[string]interface{}) 11738 if !ok { 11739 return fmt.Errorf("unexpected JSON type %v", value) 11740 } 11741 11742 var sv *types.JobNotFoundException 11743 if *v == nil { 11744 sv = &types.JobNotFoundException{} 11745 } else { 11746 sv = *v 11747 } 11748 11749 for key, value := range shape { 11750 switch key { 11751 case "Message": 11752 if value != nil { 11753 jtv, ok := value.(string) 11754 if !ok { 11755 return fmt.Errorf("expected String to be of type string, got %T instead", value) 11756 } 11757 sv.Message = ptr.String(jtv) 11758 } 11759 11760 default: 11761 _, _ = key, value 11762 11763 } 11764 } 11765 *v = sv 11766 return nil 11767} 11768 11769func awsAwsjson11_deserializeDocumentKeyPhrase(v **types.KeyPhrase, value interface{}) error { 11770 if v == nil { 11771 return fmt.Errorf("unexpected nil of type %T", v) 11772 } 11773 if value == nil { 11774 return nil 11775 } 11776 11777 shape, ok := value.(map[string]interface{}) 11778 if !ok { 11779 return fmt.Errorf("unexpected JSON type %v", value) 11780 } 11781 11782 var sv *types.KeyPhrase 11783 if *v == nil { 11784 sv = &types.KeyPhrase{} 11785 } else { 11786 sv = *v 11787 } 11788 11789 for key, value := range shape { 11790 switch key { 11791 case "BeginOffset": 11792 if value != nil { 11793 jtv, ok := value.(json.Number) 11794 if !ok { 11795 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 11796 } 11797 i64, err := jtv.Int64() 11798 if err != nil { 11799 return err 11800 } 11801 sv.BeginOffset = ptr.Int32(int32(i64)) 11802 } 11803 11804 case "EndOffset": 11805 if value != nil { 11806 jtv, ok := value.(json.Number) 11807 if !ok { 11808 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 11809 } 11810 i64, err := jtv.Int64() 11811 if err != nil { 11812 return err 11813 } 11814 sv.EndOffset = ptr.Int32(int32(i64)) 11815 } 11816 11817 case "Score": 11818 if value != nil { 11819 switch jtv := value.(type) { 11820 case json.Number: 11821 f64, err := jtv.Float64() 11822 if err != nil { 11823 return err 11824 } 11825 sv.Score = ptr.Float32(float32(f64)) 11826 11827 case string: 11828 var f64 float64 11829 switch { 11830 case strings.EqualFold(jtv, "NaN"): 11831 f64 = math.NaN() 11832 11833 case strings.EqualFold(jtv, "Infinity"): 11834 f64 = math.Inf(1) 11835 11836 case strings.EqualFold(jtv, "-Infinity"): 11837 f64 = math.Inf(-1) 11838 11839 default: 11840 return fmt.Errorf("unknown JSON number value: %s", jtv) 11841 11842 } 11843 sv.Score = ptr.Float32(float32(f64)) 11844 11845 default: 11846 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 11847 11848 } 11849 } 11850 11851 case "Text": 11852 if value != nil { 11853 jtv, ok := value.(string) 11854 if !ok { 11855 return fmt.Errorf("expected String to be of type string, got %T instead", value) 11856 } 11857 sv.Text = ptr.String(jtv) 11858 } 11859 11860 default: 11861 _, _ = key, value 11862 11863 } 11864 } 11865 *v = sv 11866 return nil 11867} 11868 11869func awsAwsjson11_deserializeDocumentKeyPhrasesDetectionJobProperties(v **types.KeyPhrasesDetectionJobProperties, value interface{}) error { 11870 if v == nil { 11871 return fmt.Errorf("unexpected nil of type %T", v) 11872 } 11873 if value == nil { 11874 return nil 11875 } 11876 11877 shape, ok := value.(map[string]interface{}) 11878 if !ok { 11879 return fmt.Errorf("unexpected JSON type %v", value) 11880 } 11881 11882 var sv *types.KeyPhrasesDetectionJobProperties 11883 if *v == nil { 11884 sv = &types.KeyPhrasesDetectionJobProperties{} 11885 } else { 11886 sv = *v 11887 } 11888 11889 for key, value := range shape { 11890 switch key { 11891 case "DataAccessRoleArn": 11892 if value != nil { 11893 jtv, ok := value.(string) 11894 if !ok { 11895 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 11896 } 11897 sv.DataAccessRoleArn = ptr.String(jtv) 11898 } 11899 11900 case "EndTime": 11901 if value != nil { 11902 switch jtv := value.(type) { 11903 case json.Number: 11904 f64, err := jtv.Float64() 11905 if err != nil { 11906 return err 11907 } 11908 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11909 11910 default: 11911 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11912 11913 } 11914 } 11915 11916 case "InputDataConfig": 11917 if err := awsAwsjson11_deserializeDocumentInputDataConfig(&sv.InputDataConfig, value); err != nil { 11918 return err 11919 } 11920 11921 case "JobArn": 11922 if value != nil { 11923 jtv, ok := value.(string) 11924 if !ok { 11925 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 11926 } 11927 sv.JobArn = ptr.String(jtv) 11928 } 11929 11930 case "JobId": 11931 if value != nil { 11932 jtv, ok := value.(string) 11933 if !ok { 11934 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 11935 } 11936 sv.JobId = ptr.String(jtv) 11937 } 11938 11939 case "JobName": 11940 if value != nil { 11941 jtv, ok := value.(string) 11942 if !ok { 11943 return fmt.Errorf("expected JobName to be of type string, got %T instead", value) 11944 } 11945 sv.JobName = ptr.String(jtv) 11946 } 11947 11948 case "JobStatus": 11949 if value != nil { 11950 jtv, ok := value.(string) 11951 if !ok { 11952 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 11953 } 11954 sv.JobStatus = types.JobStatus(jtv) 11955 } 11956 11957 case "LanguageCode": 11958 if value != nil { 11959 jtv, ok := value.(string) 11960 if !ok { 11961 return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) 11962 } 11963 sv.LanguageCode = types.LanguageCode(jtv) 11964 } 11965 11966 case "Message": 11967 if value != nil { 11968 jtv, ok := value.(string) 11969 if !ok { 11970 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 11971 } 11972 sv.Message = ptr.String(jtv) 11973 } 11974 11975 case "OutputDataConfig": 11976 if err := awsAwsjson11_deserializeDocumentOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 11977 return err 11978 } 11979 11980 case "SubmitTime": 11981 if value != nil { 11982 switch jtv := value.(type) { 11983 case json.Number: 11984 f64, err := jtv.Float64() 11985 if err != nil { 11986 return err 11987 } 11988 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11989 11990 default: 11991 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11992 11993 } 11994 } 11995 11996 case "VolumeKmsKeyId": 11997 if value != nil { 11998 jtv, ok := value.(string) 11999 if !ok { 12000 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 12001 } 12002 sv.VolumeKmsKeyId = ptr.String(jtv) 12003 } 12004 12005 case "VpcConfig": 12006 if err := awsAwsjson11_deserializeDocumentVpcConfig(&sv.VpcConfig, value); err != nil { 12007 return err 12008 } 12009 12010 default: 12011 _, _ = key, value 12012 12013 } 12014 } 12015 *v = sv 12016 return nil 12017} 12018 12019func awsAwsjson11_deserializeDocumentKeyPhrasesDetectionJobPropertiesList(v *[]types.KeyPhrasesDetectionJobProperties, value interface{}) error { 12020 if v == nil { 12021 return fmt.Errorf("unexpected nil of type %T", v) 12022 } 12023 if value == nil { 12024 return nil 12025 } 12026 12027 shape, ok := value.([]interface{}) 12028 if !ok { 12029 return fmt.Errorf("unexpected JSON type %v", value) 12030 } 12031 12032 var cv []types.KeyPhrasesDetectionJobProperties 12033 if *v == nil { 12034 cv = []types.KeyPhrasesDetectionJobProperties{} 12035 } else { 12036 cv = *v 12037 } 12038 12039 for _, value := range shape { 12040 var col types.KeyPhrasesDetectionJobProperties 12041 destAddr := &col 12042 if err := awsAwsjson11_deserializeDocumentKeyPhrasesDetectionJobProperties(&destAddr, value); err != nil { 12043 return err 12044 } 12045 col = *destAddr 12046 cv = append(cv, col) 12047 12048 } 12049 *v = cv 12050 return nil 12051} 12052 12053func awsAwsjson11_deserializeDocumentKmsKeyValidationException(v **types.KmsKeyValidationException, value interface{}) error { 12054 if v == nil { 12055 return fmt.Errorf("unexpected nil of type %T", v) 12056 } 12057 if value == nil { 12058 return nil 12059 } 12060 12061 shape, ok := value.(map[string]interface{}) 12062 if !ok { 12063 return fmt.Errorf("unexpected JSON type %v", value) 12064 } 12065 12066 var sv *types.KmsKeyValidationException 12067 if *v == nil { 12068 sv = &types.KmsKeyValidationException{} 12069 } else { 12070 sv = *v 12071 } 12072 12073 for key, value := range shape { 12074 switch key { 12075 case "Message": 12076 if value != nil { 12077 jtv, ok := value.(string) 12078 if !ok { 12079 return fmt.Errorf("expected String to be of type string, got %T instead", value) 12080 } 12081 sv.Message = ptr.String(jtv) 12082 } 12083 12084 default: 12085 _, _ = key, value 12086 12087 } 12088 } 12089 *v = sv 12090 return nil 12091} 12092 12093func awsAwsjson11_deserializeDocumentListOfClasses(v *[]types.DocumentClass, value interface{}) error { 12094 if v == nil { 12095 return fmt.Errorf("unexpected nil of type %T", v) 12096 } 12097 if value == nil { 12098 return nil 12099 } 12100 12101 shape, ok := value.([]interface{}) 12102 if !ok { 12103 return fmt.Errorf("unexpected JSON type %v", value) 12104 } 12105 12106 var cv []types.DocumentClass 12107 if *v == nil { 12108 cv = []types.DocumentClass{} 12109 } else { 12110 cv = *v 12111 } 12112 12113 for _, value := range shape { 12114 var col types.DocumentClass 12115 destAddr := &col 12116 if err := awsAwsjson11_deserializeDocumentDocumentClass(&destAddr, value); err != nil { 12117 return err 12118 } 12119 col = *destAddr 12120 cv = append(cv, col) 12121 12122 } 12123 *v = cv 12124 return nil 12125} 12126 12127func awsAwsjson11_deserializeDocumentListOfDetectDominantLanguageResult(v *[]types.BatchDetectDominantLanguageItemResult, value interface{}) error { 12128 if v == nil { 12129 return fmt.Errorf("unexpected nil of type %T", v) 12130 } 12131 if value == nil { 12132 return nil 12133 } 12134 12135 shape, ok := value.([]interface{}) 12136 if !ok { 12137 return fmt.Errorf("unexpected JSON type %v", value) 12138 } 12139 12140 var cv []types.BatchDetectDominantLanguageItemResult 12141 if *v == nil { 12142 cv = []types.BatchDetectDominantLanguageItemResult{} 12143 } else { 12144 cv = *v 12145 } 12146 12147 for _, value := range shape { 12148 var col types.BatchDetectDominantLanguageItemResult 12149 destAddr := &col 12150 if err := awsAwsjson11_deserializeDocumentBatchDetectDominantLanguageItemResult(&destAddr, value); err != nil { 12151 return err 12152 } 12153 col = *destAddr 12154 cv = append(cv, col) 12155 12156 } 12157 *v = cv 12158 return nil 12159} 12160 12161func awsAwsjson11_deserializeDocumentListOfDetectEntitiesResult(v *[]types.BatchDetectEntitiesItemResult, value interface{}) error { 12162 if v == nil { 12163 return fmt.Errorf("unexpected nil of type %T", v) 12164 } 12165 if value == nil { 12166 return nil 12167 } 12168 12169 shape, ok := value.([]interface{}) 12170 if !ok { 12171 return fmt.Errorf("unexpected JSON type %v", value) 12172 } 12173 12174 var cv []types.BatchDetectEntitiesItemResult 12175 if *v == nil { 12176 cv = []types.BatchDetectEntitiesItemResult{} 12177 } else { 12178 cv = *v 12179 } 12180 12181 for _, value := range shape { 12182 var col types.BatchDetectEntitiesItemResult 12183 destAddr := &col 12184 if err := awsAwsjson11_deserializeDocumentBatchDetectEntitiesItemResult(&destAddr, value); err != nil { 12185 return err 12186 } 12187 col = *destAddr 12188 cv = append(cv, col) 12189 12190 } 12191 *v = cv 12192 return nil 12193} 12194 12195func awsAwsjson11_deserializeDocumentListOfDetectKeyPhrasesResult(v *[]types.BatchDetectKeyPhrasesItemResult, value interface{}) error { 12196 if v == nil { 12197 return fmt.Errorf("unexpected nil of type %T", v) 12198 } 12199 if value == nil { 12200 return nil 12201 } 12202 12203 shape, ok := value.([]interface{}) 12204 if !ok { 12205 return fmt.Errorf("unexpected JSON type %v", value) 12206 } 12207 12208 var cv []types.BatchDetectKeyPhrasesItemResult 12209 if *v == nil { 12210 cv = []types.BatchDetectKeyPhrasesItemResult{} 12211 } else { 12212 cv = *v 12213 } 12214 12215 for _, value := range shape { 12216 var col types.BatchDetectKeyPhrasesItemResult 12217 destAddr := &col 12218 if err := awsAwsjson11_deserializeDocumentBatchDetectKeyPhrasesItemResult(&destAddr, value); err != nil { 12219 return err 12220 } 12221 col = *destAddr 12222 cv = append(cv, col) 12223 12224 } 12225 *v = cv 12226 return nil 12227} 12228 12229func awsAwsjson11_deserializeDocumentListOfDetectSentimentResult(v *[]types.BatchDetectSentimentItemResult, value interface{}) error { 12230 if v == nil { 12231 return fmt.Errorf("unexpected nil of type %T", v) 12232 } 12233 if value == nil { 12234 return nil 12235 } 12236 12237 shape, ok := value.([]interface{}) 12238 if !ok { 12239 return fmt.Errorf("unexpected JSON type %v", value) 12240 } 12241 12242 var cv []types.BatchDetectSentimentItemResult 12243 if *v == nil { 12244 cv = []types.BatchDetectSentimentItemResult{} 12245 } else { 12246 cv = *v 12247 } 12248 12249 for _, value := range shape { 12250 var col types.BatchDetectSentimentItemResult 12251 destAddr := &col 12252 if err := awsAwsjson11_deserializeDocumentBatchDetectSentimentItemResult(&destAddr, value); err != nil { 12253 return err 12254 } 12255 col = *destAddr 12256 cv = append(cv, col) 12257 12258 } 12259 *v = cv 12260 return nil 12261} 12262 12263func awsAwsjson11_deserializeDocumentListOfDetectSyntaxResult(v *[]types.BatchDetectSyntaxItemResult, value interface{}) error { 12264 if v == nil { 12265 return fmt.Errorf("unexpected nil of type %T", v) 12266 } 12267 if value == nil { 12268 return nil 12269 } 12270 12271 shape, ok := value.([]interface{}) 12272 if !ok { 12273 return fmt.Errorf("unexpected JSON type %v", value) 12274 } 12275 12276 var cv []types.BatchDetectSyntaxItemResult 12277 if *v == nil { 12278 cv = []types.BatchDetectSyntaxItemResult{} 12279 } else { 12280 cv = *v 12281 } 12282 12283 for _, value := range shape { 12284 var col types.BatchDetectSyntaxItemResult 12285 destAddr := &col 12286 if err := awsAwsjson11_deserializeDocumentBatchDetectSyntaxItemResult(&destAddr, value); err != nil { 12287 return err 12288 } 12289 col = *destAddr 12290 cv = append(cv, col) 12291 12292 } 12293 *v = cv 12294 return nil 12295} 12296 12297func awsAwsjson11_deserializeDocumentListOfDocumentReadFeatureTypes(v *[]types.DocumentReadFeatureTypes, value interface{}) error { 12298 if v == nil { 12299 return fmt.Errorf("unexpected nil of type %T", v) 12300 } 12301 if value == nil { 12302 return nil 12303 } 12304 12305 shape, ok := value.([]interface{}) 12306 if !ok { 12307 return fmt.Errorf("unexpected JSON type %v", value) 12308 } 12309 12310 var cv []types.DocumentReadFeatureTypes 12311 if *v == nil { 12312 cv = []types.DocumentReadFeatureTypes{} 12313 } else { 12314 cv = *v 12315 } 12316 12317 for _, value := range shape { 12318 var col types.DocumentReadFeatureTypes 12319 if value != nil { 12320 jtv, ok := value.(string) 12321 if !ok { 12322 return fmt.Errorf("expected DocumentReadFeatureTypes to be of type string, got %T instead", value) 12323 } 12324 col = types.DocumentReadFeatureTypes(jtv) 12325 } 12326 cv = append(cv, col) 12327 12328 } 12329 *v = cv 12330 return nil 12331} 12332 12333func awsAwsjson11_deserializeDocumentListOfDominantLanguages(v *[]types.DominantLanguage, value interface{}) error { 12334 if v == nil { 12335 return fmt.Errorf("unexpected nil of type %T", v) 12336 } 12337 if value == nil { 12338 return nil 12339 } 12340 12341 shape, ok := value.([]interface{}) 12342 if !ok { 12343 return fmt.Errorf("unexpected JSON type %v", value) 12344 } 12345 12346 var cv []types.DominantLanguage 12347 if *v == nil { 12348 cv = []types.DominantLanguage{} 12349 } else { 12350 cv = *v 12351 } 12352 12353 for _, value := range shape { 12354 var col types.DominantLanguage 12355 destAddr := &col 12356 if err := awsAwsjson11_deserializeDocumentDominantLanguage(&destAddr, value); err != nil { 12357 return err 12358 } 12359 col = *destAddr 12360 cv = append(cv, col) 12361 12362 } 12363 *v = cv 12364 return nil 12365} 12366 12367func awsAwsjson11_deserializeDocumentListOfEntities(v *[]types.Entity, value interface{}) error { 12368 if v == nil { 12369 return fmt.Errorf("unexpected nil of type %T", v) 12370 } 12371 if value == nil { 12372 return nil 12373 } 12374 12375 shape, ok := value.([]interface{}) 12376 if !ok { 12377 return fmt.Errorf("unexpected JSON type %v", value) 12378 } 12379 12380 var cv []types.Entity 12381 if *v == nil { 12382 cv = []types.Entity{} 12383 } else { 12384 cv = *v 12385 } 12386 12387 for _, value := range shape { 12388 var col types.Entity 12389 destAddr := &col 12390 if err := awsAwsjson11_deserializeDocumentEntity(&destAddr, value); err != nil { 12391 return err 12392 } 12393 col = *destAddr 12394 cv = append(cv, col) 12395 12396 } 12397 *v = cv 12398 return nil 12399} 12400 12401func awsAwsjson11_deserializeDocumentListOfEntityLabels(v *[]types.EntityLabel, value interface{}) error { 12402 if v == nil { 12403 return fmt.Errorf("unexpected nil of type %T", v) 12404 } 12405 if value == nil { 12406 return nil 12407 } 12408 12409 shape, ok := value.([]interface{}) 12410 if !ok { 12411 return fmt.Errorf("unexpected JSON type %v", value) 12412 } 12413 12414 var cv []types.EntityLabel 12415 if *v == nil { 12416 cv = []types.EntityLabel{} 12417 } else { 12418 cv = *v 12419 } 12420 12421 for _, value := range shape { 12422 var col types.EntityLabel 12423 destAddr := &col 12424 if err := awsAwsjson11_deserializeDocumentEntityLabel(&destAddr, value); err != nil { 12425 return err 12426 } 12427 col = *destAddr 12428 cv = append(cv, col) 12429 12430 } 12431 *v = cv 12432 return nil 12433} 12434 12435func awsAwsjson11_deserializeDocumentListOfKeyPhrases(v *[]types.KeyPhrase, value interface{}) error { 12436 if v == nil { 12437 return fmt.Errorf("unexpected nil of type %T", v) 12438 } 12439 if value == nil { 12440 return nil 12441 } 12442 12443 shape, ok := value.([]interface{}) 12444 if !ok { 12445 return fmt.Errorf("unexpected JSON type %v", value) 12446 } 12447 12448 var cv []types.KeyPhrase 12449 if *v == nil { 12450 cv = []types.KeyPhrase{} 12451 } else { 12452 cv = *v 12453 } 12454 12455 for _, value := range shape { 12456 var col types.KeyPhrase 12457 destAddr := &col 12458 if err := awsAwsjson11_deserializeDocumentKeyPhrase(&destAddr, value); err != nil { 12459 return err 12460 } 12461 col = *destAddr 12462 cv = append(cv, col) 12463 12464 } 12465 *v = cv 12466 return nil 12467} 12468 12469func awsAwsjson11_deserializeDocumentListOfLabels(v *[]types.DocumentLabel, value interface{}) error { 12470 if v == nil { 12471 return fmt.Errorf("unexpected nil of type %T", v) 12472 } 12473 if value == nil { 12474 return nil 12475 } 12476 12477 shape, ok := value.([]interface{}) 12478 if !ok { 12479 return fmt.Errorf("unexpected JSON type %v", value) 12480 } 12481 12482 var cv []types.DocumentLabel 12483 if *v == nil { 12484 cv = []types.DocumentLabel{} 12485 } else { 12486 cv = *v 12487 } 12488 12489 for _, value := range shape { 12490 var col types.DocumentLabel 12491 destAddr := &col 12492 if err := awsAwsjson11_deserializeDocumentDocumentLabel(&destAddr, value); err != nil { 12493 return err 12494 } 12495 col = *destAddr 12496 cv = append(cv, col) 12497 12498 } 12499 *v = cv 12500 return nil 12501} 12502 12503func awsAwsjson11_deserializeDocumentListOfPiiEntities(v *[]types.PiiEntity, value interface{}) error { 12504 if v == nil { 12505 return fmt.Errorf("unexpected nil of type %T", v) 12506 } 12507 if value == nil { 12508 return nil 12509 } 12510 12511 shape, ok := value.([]interface{}) 12512 if !ok { 12513 return fmt.Errorf("unexpected JSON type %v", value) 12514 } 12515 12516 var cv []types.PiiEntity 12517 if *v == nil { 12518 cv = []types.PiiEntity{} 12519 } else { 12520 cv = *v 12521 } 12522 12523 for _, value := range shape { 12524 var col types.PiiEntity 12525 destAddr := &col 12526 if err := awsAwsjson11_deserializeDocumentPiiEntity(&destAddr, value); err != nil { 12527 return err 12528 } 12529 col = *destAddr 12530 cv = append(cv, col) 12531 12532 } 12533 *v = cv 12534 return nil 12535} 12536 12537func awsAwsjson11_deserializeDocumentListOfPiiEntityTypes(v *[]types.PiiEntityType, value interface{}) error { 12538 if v == nil { 12539 return fmt.Errorf("unexpected nil of type %T", v) 12540 } 12541 if value == nil { 12542 return nil 12543 } 12544 12545 shape, ok := value.([]interface{}) 12546 if !ok { 12547 return fmt.Errorf("unexpected JSON type %v", value) 12548 } 12549 12550 var cv []types.PiiEntityType 12551 if *v == nil { 12552 cv = []types.PiiEntityType{} 12553 } else { 12554 cv = *v 12555 } 12556 12557 for _, value := range shape { 12558 var col types.PiiEntityType 12559 if value != nil { 12560 jtv, ok := value.(string) 12561 if !ok { 12562 return fmt.Errorf("expected PiiEntityType to be of type string, got %T instead", value) 12563 } 12564 col = types.PiiEntityType(jtv) 12565 } 12566 cv = append(cv, col) 12567 12568 } 12569 *v = cv 12570 return nil 12571} 12572 12573func awsAwsjson11_deserializeDocumentListOfSyntaxTokens(v *[]types.SyntaxToken, value interface{}) error { 12574 if v == nil { 12575 return fmt.Errorf("unexpected nil of type %T", v) 12576 } 12577 if value == nil { 12578 return nil 12579 } 12580 12581 shape, ok := value.([]interface{}) 12582 if !ok { 12583 return fmt.Errorf("unexpected JSON type %v", value) 12584 } 12585 12586 var cv []types.SyntaxToken 12587 if *v == nil { 12588 cv = []types.SyntaxToken{} 12589 } else { 12590 cv = *v 12591 } 12592 12593 for _, value := range shape { 12594 var col types.SyntaxToken 12595 destAddr := &col 12596 if err := awsAwsjson11_deserializeDocumentSyntaxToken(&destAddr, value); err != nil { 12597 return err 12598 } 12599 col = *destAddr 12600 cv = append(cv, col) 12601 12602 } 12603 *v = cv 12604 return nil 12605} 12606 12607func awsAwsjson11_deserializeDocumentOutputDataConfig(v **types.OutputDataConfig, value interface{}) error { 12608 if v == nil { 12609 return fmt.Errorf("unexpected nil of type %T", v) 12610 } 12611 if value == nil { 12612 return nil 12613 } 12614 12615 shape, ok := value.(map[string]interface{}) 12616 if !ok { 12617 return fmt.Errorf("unexpected JSON type %v", value) 12618 } 12619 12620 var sv *types.OutputDataConfig 12621 if *v == nil { 12622 sv = &types.OutputDataConfig{} 12623 } else { 12624 sv = *v 12625 } 12626 12627 for key, value := range shape { 12628 switch key { 12629 case "KmsKeyId": 12630 if value != nil { 12631 jtv, ok := value.(string) 12632 if !ok { 12633 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 12634 } 12635 sv.KmsKeyId = ptr.String(jtv) 12636 } 12637 12638 case "S3Uri": 12639 if value != nil { 12640 jtv, ok := value.(string) 12641 if !ok { 12642 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 12643 } 12644 sv.S3Uri = ptr.String(jtv) 12645 } 12646 12647 default: 12648 _, _ = key, value 12649 12650 } 12651 } 12652 *v = sv 12653 return nil 12654} 12655 12656func awsAwsjson11_deserializeDocumentPartOfSpeechTag(v **types.PartOfSpeechTag, value interface{}) error { 12657 if v == nil { 12658 return fmt.Errorf("unexpected nil of type %T", v) 12659 } 12660 if value == nil { 12661 return nil 12662 } 12663 12664 shape, ok := value.(map[string]interface{}) 12665 if !ok { 12666 return fmt.Errorf("unexpected JSON type %v", value) 12667 } 12668 12669 var sv *types.PartOfSpeechTag 12670 if *v == nil { 12671 sv = &types.PartOfSpeechTag{} 12672 } else { 12673 sv = *v 12674 } 12675 12676 for key, value := range shape { 12677 switch key { 12678 case "Score": 12679 if value != nil { 12680 switch jtv := value.(type) { 12681 case json.Number: 12682 f64, err := jtv.Float64() 12683 if err != nil { 12684 return err 12685 } 12686 sv.Score = ptr.Float32(float32(f64)) 12687 12688 case string: 12689 var f64 float64 12690 switch { 12691 case strings.EqualFold(jtv, "NaN"): 12692 f64 = math.NaN() 12693 12694 case strings.EqualFold(jtv, "Infinity"): 12695 f64 = math.Inf(1) 12696 12697 case strings.EqualFold(jtv, "-Infinity"): 12698 f64 = math.Inf(-1) 12699 12700 default: 12701 return fmt.Errorf("unknown JSON number value: %s", jtv) 12702 12703 } 12704 sv.Score = ptr.Float32(float32(f64)) 12705 12706 default: 12707 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 12708 12709 } 12710 } 12711 12712 case "Tag": 12713 if value != nil { 12714 jtv, ok := value.(string) 12715 if !ok { 12716 return fmt.Errorf("expected PartOfSpeechTagType to be of type string, got %T instead", value) 12717 } 12718 sv.Tag = types.PartOfSpeechTagType(jtv) 12719 } 12720 12721 default: 12722 _, _ = key, value 12723 12724 } 12725 } 12726 *v = sv 12727 return nil 12728} 12729 12730func awsAwsjson11_deserializeDocumentPiiEntitiesDetectionJobProperties(v **types.PiiEntitiesDetectionJobProperties, value interface{}) error { 12731 if v == nil { 12732 return fmt.Errorf("unexpected nil of type %T", v) 12733 } 12734 if value == nil { 12735 return nil 12736 } 12737 12738 shape, ok := value.(map[string]interface{}) 12739 if !ok { 12740 return fmt.Errorf("unexpected JSON type %v", value) 12741 } 12742 12743 var sv *types.PiiEntitiesDetectionJobProperties 12744 if *v == nil { 12745 sv = &types.PiiEntitiesDetectionJobProperties{} 12746 } else { 12747 sv = *v 12748 } 12749 12750 for key, value := range shape { 12751 switch key { 12752 case "DataAccessRoleArn": 12753 if value != nil { 12754 jtv, ok := value.(string) 12755 if !ok { 12756 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 12757 } 12758 sv.DataAccessRoleArn = ptr.String(jtv) 12759 } 12760 12761 case "EndTime": 12762 if value != nil { 12763 switch jtv := value.(type) { 12764 case json.Number: 12765 f64, err := jtv.Float64() 12766 if err != nil { 12767 return err 12768 } 12769 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12770 12771 default: 12772 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12773 12774 } 12775 } 12776 12777 case "InputDataConfig": 12778 if err := awsAwsjson11_deserializeDocumentInputDataConfig(&sv.InputDataConfig, value); err != nil { 12779 return err 12780 } 12781 12782 case "JobArn": 12783 if value != nil { 12784 jtv, ok := value.(string) 12785 if !ok { 12786 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 12787 } 12788 sv.JobArn = ptr.String(jtv) 12789 } 12790 12791 case "JobId": 12792 if value != nil { 12793 jtv, ok := value.(string) 12794 if !ok { 12795 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 12796 } 12797 sv.JobId = ptr.String(jtv) 12798 } 12799 12800 case "JobName": 12801 if value != nil { 12802 jtv, ok := value.(string) 12803 if !ok { 12804 return fmt.Errorf("expected JobName to be of type string, got %T instead", value) 12805 } 12806 sv.JobName = ptr.String(jtv) 12807 } 12808 12809 case "JobStatus": 12810 if value != nil { 12811 jtv, ok := value.(string) 12812 if !ok { 12813 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 12814 } 12815 sv.JobStatus = types.JobStatus(jtv) 12816 } 12817 12818 case "LanguageCode": 12819 if value != nil { 12820 jtv, ok := value.(string) 12821 if !ok { 12822 return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) 12823 } 12824 sv.LanguageCode = types.LanguageCode(jtv) 12825 } 12826 12827 case "Message": 12828 if value != nil { 12829 jtv, ok := value.(string) 12830 if !ok { 12831 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 12832 } 12833 sv.Message = ptr.String(jtv) 12834 } 12835 12836 case "Mode": 12837 if value != nil { 12838 jtv, ok := value.(string) 12839 if !ok { 12840 return fmt.Errorf("expected PiiEntitiesDetectionMode to be of type string, got %T instead", value) 12841 } 12842 sv.Mode = types.PiiEntitiesDetectionMode(jtv) 12843 } 12844 12845 case "OutputDataConfig": 12846 if err := awsAwsjson11_deserializeDocumentPiiOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 12847 return err 12848 } 12849 12850 case "RedactionConfig": 12851 if err := awsAwsjson11_deserializeDocumentRedactionConfig(&sv.RedactionConfig, value); err != nil { 12852 return err 12853 } 12854 12855 case "SubmitTime": 12856 if value != nil { 12857 switch jtv := value.(type) { 12858 case json.Number: 12859 f64, err := jtv.Float64() 12860 if err != nil { 12861 return err 12862 } 12863 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12864 12865 default: 12866 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12867 12868 } 12869 } 12870 12871 default: 12872 _, _ = key, value 12873 12874 } 12875 } 12876 *v = sv 12877 return nil 12878} 12879 12880func awsAwsjson11_deserializeDocumentPiiEntitiesDetectionJobPropertiesList(v *[]types.PiiEntitiesDetectionJobProperties, value interface{}) error { 12881 if v == nil { 12882 return fmt.Errorf("unexpected nil of type %T", v) 12883 } 12884 if value == nil { 12885 return nil 12886 } 12887 12888 shape, ok := value.([]interface{}) 12889 if !ok { 12890 return fmt.Errorf("unexpected JSON type %v", value) 12891 } 12892 12893 var cv []types.PiiEntitiesDetectionJobProperties 12894 if *v == nil { 12895 cv = []types.PiiEntitiesDetectionJobProperties{} 12896 } else { 12897 cv = *v 12898 } 12899 12900 for _, value := range shape { 12901 var col types.PiiEntitiesDetectionJobProperties 12902 destAddr := &col 12903 if err := awsAwsjson11_deserializeDocumentPiiEntitiesDetectionJobProperties(&destAddr, value); err != nil { 12904 return err 12905 } 12906 col = *destAddr 12907 cv = append(cv, col) 12908 12909 } 12910 *v = cv 12911 return nil 12912} 12913 12914func awsAwsjson11_deserializeDocumentPiiEntity(v **types.PiiEntity, value interface{}) error { 12915 if v == nil { 12916 return fmt.Errorf("unexpected nil of type %T", v) 12917 } 12918 if value == nil { 12919 return nil 12920 } 12921 12922 shape, ok := value.(map[string]interface{}) 12923 if !ok { 12924 return fmt.Errorf("unexpected JSON type %v", value) 12925 } 12926 12927 var sv *types.PiiEntity 12928 if *v == nil { 12929 sv = &types.PiiEntity{} 12930 } else { 12931 sv = *v 12932 } 12933 12934 for key, value := range shape { 12935 switch key { 12936 case "BeginOffset": 12937 if value != nil { 12938 jtv, ok := value.(json.Number) 12939 if !ok { 12940 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 12941 } 12942 i64, err := jtv.Int64() 12943 if err != nil { 12944 return err 12945 } 12946 sv.BeginOffset = ptr.Int32(int32(i64)) 12947 } 12948 12949 case "EndOffset": 12950 if value != nil { 12951 jtv, ok := value.(json.Number) 12952 if !ok { 12953 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 12954 } 12955 i64, err := jtv.Int64() 12956 if err != nil { 12957 return err 12958 } 12959 sv.EndOffset = ptr.Int32(int32(i64)) 12960 } 12961 12962 case "Score": 12963 if value != nil { 12964 switch jtv := value.(type) { 12965 case json.Number: 12966 f64, err := jtv.Float64() 12967 if err != nil { 12968 return err 12969 } 12970 sv.Score = ptr.Float32(float32(f64)) 12971 12972 case string: 12973 var f64 float64 12974 switch { 12975 case strings.EqualFold(jtv, "NaN"): 12976 f64 = math.NaN() 12977 12978 case strings.EqualFold(jtv, "Infinity"): 12979 f64 = math.Inf(1) 12980 12981 case strings.EqualFold(jtv, "-Infinity"): 12982 f64 = math.Inf(-1) 12983 12984 default: 12985 return fmt.Errorf("unknown JSON number value: %s", jtv) 12986 12987 } 12988 sv.Score = ptr.Float32(float32(f64)) 12989 12990 default: 12991 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 12992 12993 } 12994 } 12995 12996 case "Type": 12997 if value != nil { 12998 jtv, ok := value.(string) 12999 if !ok { 13000 return fmt.Errorf("expected PiiEntityType to be of type string, got %T instead", value) 13001 } 13002 sv.Type = types.PiiEntityType(jtv) 13003 } 13004 13005 default: 13006 _, _ = key, value 13007 13008 } 13009 } 13010 *v = sv 13011 return nil 13012} 13013 13014func awsAwsjson11_deserializeDocumentPiiOutputDataConfig(v **types.PiiOutputDataConfig, value interface{}) error { 13015 if v == nil { 13016 return fmt.Errorf("unexpected nil of type %T", v) 13017 } 13018 if value == nil { 13019 return nil 13020 } 13021 13022 shape, ok := value.(map[string]interface{}) 13023 if !ok { 13024 return fmt.Errorf("unexpected JSON type %v", value) 13025 } 13026 13027 var sv *types.PiiOutputDataConfig 13028 if *v == nil { 13029 sv = &types.PiiOutputDataConfig{} 13030 } else { 13031 sv = *v 13032 } 13033 13034 for key, value := range shape { 13035 switch key { 13036 case "KmsKeyId": 13037 if value != nil { 13038 jtv, ok := value.(string) 13039 if !ok { 13040 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 13041 } 13042 sv.KmsKeyId = ptr.String(jtv) 13043 } 13044 13045 case "S3Uri": 13046 if value != nil { 13047 jtv, ok := value.(string) 13048 if !ok { 13049 return fmt.Errorf("expected S3Uri to be of type string, got %T instead", value) 13050 } 13051 sv.S3Uri = ptr.String(jtv) 13052 } 13053 13054 default: 13055 _, _ = key, value 13056 13057 } 13058 } 13059 *v = sv 13060 return nil 13061} 13062 13063func awsAwsjson11_deserializeDocumentRedactionConfig(v **types.RedactionConfig, value interface{}) error { 13064 if v == nil { 13065 return fmt.Errorf("unexpected nil of type %T", v) 13066 } 13067 if value == nil { 13068 return nil 13069 } 13070 13071 shape, ok := value.(map[string]interface{}) 13072 if !ok { 13073 return fmt.Errorf("unexpected JSON type %v", value) 13074 } 13075 13076 var sv *types.RedactionConfig 13077 if *v == nil { 13078 sv = &types.RedactionConfig{} 13079 } else { 13080 sv = *v 13081 } 13082 13083 for key, value := range shape { 13084 switch key { 13085 case "MaskCharacter": 13086 if value != nil { 13087 jtv, ok := value.(string) 13088 if !ok { 13089 return fmt.Errorf("expected MaskCharacter to be of type string, got %T instead", value) 13090 } 13091 sv.MaskCharacter = ptr.String(jtv) 13092 } 13093 13094 case "MaskMode": 13095 if value != nil { 13096 jtv, ok := value.(string) 13097 if !ok { 13098 return fmt.Errorf("expected PiiEntitiesDetectionMaskMode to be of type string, got %T instead", value) 13099 } 13100 sv.MaskMode = types.PiiEntitiesDetectionMaskMode(jtv) 13101 } 13102 13103 case "PiiEntityTypes": 13104 if err := awsAwsjson11_deserializeDocumentListOfPiiEntityTypes(&sv.PiiEntityTypes, value); err != nil { 13105 return err 13106 } 13107 13108 default: 13109 _, _ = key, value 13110 13111 } 13112 } 13113 *v = sv 13114 return nil 13115} 13116 13117func awsAwsjson11_deserializeDocumentResourceInUseException(v **types.ResourceInUseException, value interface{}) error { 13118 if v == nil { 13119 return fmt.Errorf("unexpected nil of type %T", v) 13120 } 13121 if value == nil { 13122 return nil 13123 } 13124 13125 shape, ok := value.(map[string]interface{}) 13126 if !ok { 13127 return fmt.Errorf("unexpected JSON type %v", value) 13128 } 13129 13130 var sv *types.ResourceInUseException 13131 if *v == nil { 13132 sv = &types.ResourceInUseException{} 13133 } else { 13134 sv = *v 13135 } 13136 13137 for key, value := range shape { 13138 switch key { 13139 case "Message": 13140 if value != nil { 13141 jtv, ok := value.(string) 13142 if !ok { 13143 return fmt.Errorf("expected String to be of type string, got %T instead", value) 13144 } 13145 sv.Message = ptr.String(jtv) 13146 } 13147 13148 default: 13149 _, _ = key, value 13150 13151 } 13152 } 13153 *v = sv 13154 return nil 13155} 13156 13157func awsAwsjson11_deserializeDocumentResourceLimitExceededException(v **types.ResourceLimitExceededException, value interface{}) error { 13158 if v == nil { 13159 return fmt.Errorf("unexpected nil of type %T", v) 13160 } 13161 if value == nil { 13162 return nil 13163 } 13164 13165 shape, ok := value.(map[string]interface{}) 13166 if !ok { 13167 return fmt.Errorf("unexpected JSON type %v", value) 13168 } 13169 13170 var sv *types.ResourceLimitExceededException 13171 if *v == nil { 13172 sv = &types.ResourceLimitExceededException{} 13173 } else { 13174 sv = *v 13175 } 13176 13177 for key, value := range shape { 13178 switch key { 13179 case "Message": 13180 if value != nil { 13181 jtv, ok := value.(string) 13182 if !ok { 13183 return fmt.Errorf("expected String to be of type string, got %T instead", value) 13184 } 13185 sv.Message = ptr.String(jtv) 13186 } 13187 13188 default: 13189 _, _ = key, value 13190 13191 } 13192 } 13193 *v = sv 13194 return nil 13195} 13196 13197func awsAwsjson11_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 13198 if v == nil { 13199 return fmt.Errorf("unexpected nil of type %T", v) 13200 } 13201 if value == nil { 13202 return nil 13203 } 13204 13205 shape, ok := value.(map[string]interface{}) 13206 if !ok { 13207 return fmt.Errorf("unexpected JSON type %v", value) 13208 } 13209 13210 var sv *types.ResourceNotFoundException 13211 if *v == nil { 13212 sv = &types.ResourceNotFoundException{} 13213 } else { 13214 sv = *v 13215 } 13216 13217 for key, value := range shape { 13218 switch key { 13219 case "Message": 13220 if value != nil { 13221 jtv, ok := value.(string) 13222 if !ok { 13223 return fmt.Errorf("expected String to be of type string, got %T instead", value) 13224 } 13225 sv.Message = ptr.String(jtv) 13226 } 13227 13228 default: 13229 _, _ = key, value 13230 13231 } 13232 } 13233 *v = sv 13234 return nil 13235} 13236 13237func awsAwsjson11_deserializeDocumentResourceUnavailableException(v **types.ResourceUnavailableException, value interface{}) error { 13238 if v == nil { 13239 return fmt.Errorf("unexpected nil of type %T", v) 13240 } 13241 if value == nil { 13242 return nil 13243 } 13244 13245 shape, ok := value.(map[string]interface{}) 13246 if !ok { 13247 return fmt.Errorf("unexpected JSON type %v", value) 13248 } 13249 13250 var sv *types.ResourceUnavailableException 13251 if *v == nil { 13252 sv = &types.ResourceUnavailableException{} 13253 } else { 13254 sv = *v 13255 } 13256 13257 for key, value := range shape { 13258 switch key { 13259 case "Message": 13260 if value != nil { 13261 jtv, ok := value.(string) 13262 if !ok { 13263 return fmt.Errorf("expected String to be of type string, got %T instead", value) 13264 } 13265 sv.Message = ptr.String(jtv) 13266 } 13267 13268 default: 13269 _, _ = key, value 13270 13271 } 13272 } 13273 *v = sv 13274 return nil 13275} 13276 13277func awsAwsjson11_deserializeDocumentSecurityGroupIds(v *[]string, value interface{}) error { 13278 if v == nil { 13279 return fmt.Errorf("unexpected nil of type %T", v) 13280 } 13281 if value == nil { 13282 return nil 13283 } 13284 13285 shape, ok := value.([]interface{}) 13286 if !ok { 13287 return fmt.Errorf("unexpected JSON type %v", value) 13288 } 13289 13290 var cv []string 13291 if *v == nil { 13292 cv = []string{} 13293 } else { 13294 cv = *v 13295 } 13296 13297 for _, value := range shape { 13298 var col string 13299 if value != nil { 13300 jtv, ok := value.(string) 13301 if !ok { 13302 return fmt.Errorf("expected SecurityGroupId to be of type string, got %T instead", value) 13303 } 13304 col = jtv 13305 } 13306 cv = append(cv, col) 13307 13308 } 13309 *v = cv 13310 return nil 13311} 13312 13313func awsAwsjson11_deserializeDocumentSentimentDetectionJobProperties(v **types.SentimentDetectionJobProperties, value interface{}) error { 13314 if v == nil { 13315 return fmt.Errorf("unexpected nil of type %T", v) 13316 } 13317 if value == nil { 13318 return nil 13319 } 13320 13321 shape, ok := value.(map[string]interface{}) 13322 if !ok { 13323 return fmt.Errorf("unexpected JSON type %v", value) 13324 } 13325 13326 var sv *types.SentimentDetectionJobProperties 13327 if *v == nil { 13328 sv = &types.SentimentDetectionJobProperties{} 13329 } else { 13330 sv = *v 13331 } 13332 13333 for key, value := range shape { 13334 switch key { 13335 case "DataAccessRoleArn": 13336 if value != nil { 13337 jtv, ok := value.(string) 13338 if !ok { 13339 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 13340 } 13341 sv.DataAccessRoleArn = ptr.String(jtv) 13342 } 13343 13344 case "EndTime": 13345 if value != nil { 13346 switch jtv := value.(type) { 13347 case json.Number: 13348 f64, err := jtv.Float64() 13349 if err != nil { 13350 return err 13351 } 13352 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13353 13354 default: 13355 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 13356 13357 } 13358 } 13359 13360 case "InputDataConfig": 13361 if err := awsAwsjson11_deserializeDocumentInputDataConfig(&sv.InputDataConfig, value); err != nil { 13362 return err 13363 } 13364 13365 case "JobArn": 13366 if value != nil { 13367 jtv, ok := value.(string) 13368 if !ok { 13369 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 13370 } 13371 sv.JobArn = ptr.String(jtv) 13372 } 13373 13374 case "JobId": 13375 if value != nil { 13376 jtv, ok := value.(string) 13377 if !ok { 13378 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 13379 } 13380 sv.JobId = ptr.String(jtv) 13381 } 13382 13383 case "JobName": 13384 if value != nil { 13385 jtv, ok := value.(string) 13386 if !ok { 13387 return fmt.Errorf("expected JobName to be of type string, got %T instead", value) 13388 } 13389 sv.JobName = ptr.String(jtv) 13390 } 13391 13392 case "JobStatus": 13393 if value != nil { 13394 jtv, ok := value.(string) 13395 if !ok { 13396 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 13397 } 13398 sv.JobStatus = types.JobStatus(jtv) 13399 } 13400 13401 case "LanguageCode": 13402 if value != nil { 13403 jtv, ok := value.(string) 13404 if !ok { 13405 return fmt.Errorf("expected LanguageCode to be of type string, got %T instead", value) 13406 } 13407 sv.LanguageCode = types.LanguageCode(jtv) 13408 } 13409 13410 case "Message": 13411 if value != nil { 13412 jtv, ok := value.(string) 13413 if !ok { 13414 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 13415 } 13416 sv.Message = ptr.String(jtv) 13417 } 13418 13419 case "OutputDataConfig": 13420 if err := awsAwsjson11_deserializeDocumentOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 13421 return err 13422 } 13423 13424 case "SubmitTime": 13425 if value != nil { 13426 switch jtv := value.(type) { 13427 case json.Number: 13428 f64, err := jtv.Float64() 13429 if err != nil { 13430 return err 13431 } 13432 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13433 13434 default: 13435 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 13436 13437 } 13438 } 13439 13440 case "VolumeKmsKeyId": 13441 if value != nil { 13442 jtv, ok := value.(string) 13443 if !ok { 13444 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 13445 } 13446 sv.VolumeKmsKeyId = ptr.String(jtv) 13447 } 13448 13449 case "VpcConfig": 13450 if err := awsAwsjson11_deserializeDocumentVpcConfig(&sv.VpcConfig, value); err != nil { 13451 return err 13452 } 13453 13454 default: 13455 _, _ = key, value 13456 13457 } 13458 } 13459 *v = sv 13460 return nil 13461} 13462 13463func awsAwsjson11_deserializeDocumentSentimentDetectionJobPropertiesList(v *[]types.SentimentDetectionJobProperties, value interface{}) error { 13464 if v == nil { 13465 return fmt.Errorf("unexpected nil of type %T", v) 13466 } 13467 if value == nil { 13468 return nil 13469 } 13470 13471 shape, ok := value.([]interface{}) 13472 if !ok { 13473 return fmt.Errorf("unexpected JSON type %v", value) 13474 } 13475 13476 var cv []types.SentimentDetectionJobProperties 13477 if *v == nil { 13478 cv = []types.SentimentDetectionJobProperties{} 13479 } else { 13480 cv = *v 13481 } 13482 13483 for _, value := range shape { 13484 var col types.SentimentDetectionJobProperties 13485 destAddr := &col 13486 if err := awsAwsjson11_deserializeDocumentSentimentDetectionJobProperties(&destAddr, value); err != nil { 13487 return err 13488 } 13489 col = *destAddr 13490 cv = append(cv, col) 13491 13492 } 13493 *v = cv 13494 return nil 13495} 13496 13497func awsAwsjson11_deserializeDocumentSentimentScore(v **types.SentimentScore, value interface{}) error { 13498 if v == nil { 13499 return fmt.Errorf("unexpected nil of type %T", v) 13500 } 13501 if value == nil { 13502 return nil 13503 } 13504 13505 shape, ok := value.(map[string]interface{}) 13506 if !ok { 13507 return fmt.Errorf("unexpected JSON type %v", value) 13508 } 13509 13510 var sv *types.SentimentScore 13511 if *v == nil { 13512 sv = &types.SentimentScore{} 13513 } else { 13514 sv = *v 13515 } 13516 13517 for key, value := range shape { 13518 switch key { 13519 case "Mixed": 13520 if value != nil { 13521 switch jtv := value.(type) { 13522 case json.Number: 13523 f64, err := jtv.Float64() 13524 if err != nil { 13525 return err 13526 } 13527 sv.Mixed = ptr.Float32(float32(f64)) 13528 13529 case string: 13530 var f64 float64 13531 switch { 13532 case strings.EqualFold(jtv, "NaN"): 13533 f64 = math.NaN() 13534 13535 case strings.EqualFold(jtv, "Infinity"): 13536 f64 = math.Inf(1) 13537 13538 case strings.EqualFold(jtv, "-Infinity"): 13539 f64 = math.Inf(-1) 13540 13541 default: 13542 return fmt.Errorf("unknown JSON number value: %s", jtv) 13543 13544 } 13545 sv.Mixed = ptr.Float32(float32(f64)) 13546 13547 default: 13548 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 13549 13550 } 13551 } 13552 13553 case "Negative": 13554 if value != nil { 13555 switch jtv := value.(type) { 13556 case json.Number: 13557 f64, err := jtv.Float64() 13558 if err != nil { 13559 return err 13560 } 13561 sv.Negative = ptr.Float32(float32(f64)) 13562 13563 case string: 13564 var f64 float64 13565 switch { 13566 case strings.EqualFold(jtv, "NaN"): 13567 f64 = math.NaN() 13568 13569 case strings.EqualFold(jtv, "Infinity"): 13570 f64 = math.Inf(1) 13571 13572 case strings.EqualFold(jtv, "-Infinity"): 13573 f64 = math.Inf(-1) 13574 13575 default: 13576 return fmt.Errorf("unknown JSON number value: %s", jtv) 13577 13578 } 13579 sv.Negative = ptr.Float32(float32(f64)) 13580 13581 default: 13582 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 13583 13584 } 13585 } 13586 13587 case "Neutral": 13588 if value != nil { 13589 switch jtv := value.(type) { 13590 case json.Number: 13591 f64, err := jtv.Float64() 13592 if err != nil { 13593 return err 13594 } 13595 sv.Neutral = ptr.Float32(float32(f64)) 13596 13597 case string: 13598 var f64 float64 13599 switch { 13600 case strings.EqualFold(jtv, "NaN"): 13601 f64 = math.NaN() 13602 13603 case strings.EqualFold(jtv, "Infinity"): 13604 f64 = math.Inf(1) 13605 13606 case strings.EqualFold(jtv, "-Infinity"): 13607 f64 = math.Inf(-1) 13608 13609 default: 13610 return fmt.Errorf("unknown JSON number value: %s", jtv) 13611 13612 } 13613 sv.Neutral = ptr.Float32(float32(f64)) 13614 13615 default: 13616 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 13617 13618 } 13619 } 13620 13621 case "Positive": 13622 if value != nil { 13623 switch jtv := value.(type) { 13624 case json.Number: 13625 f64, err := jtv.Float64() 13626 if err != nil { 13627 return err 13628 } 13629 sv.Positive = ptr.Float32(float32(f64)) 13630 13631 case string: 13632 var f64 float64 13633 switch { 13634 case strings.EqualFold(jtv, "NaN"): 13635 f64 = math.NaN() 13636 13637 case strings.EqualFold(jtv, "Infinity"): 13638 f64 = math.Inf(1) 13639 13640 case strings.EqualFold(jtv, "-Infinity"): 13641 f64 = math.Inf(-1) 13642 13643 default: 13644 return fmt.Errorf("unknown JSON number value: %s", jtv) 13645 13646 } 13647 sv.Positive = ptr.Float32(float32(f64)) 13648 13649 default: 13650 return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) 13651 13652 } 13653 } 13654 13655 default: 13656 _, _ = key, value 13657 13658 } 13659 } 13660 *v = sv 13661 return nil 13662} 13663 13664func awsAwsjson11_deserializeDocumentSubnets(v *[]string, value interface{}) error { 13665 if v == nil { 13666 return fmt.Errorf("unexpected nil of type %T", v) 13667 } 13668 if value == nil { 13669 return nil 13670 } 13671 13672 shape, ok := value.([]interface{}) 13673 if !ok { 13674 return fmt.Errorf("unexpected JSON type %v", value) 13675 } 13676 13677 var cv []string 13678 if *v == nil { 13679 cv = []string{} 13680 } else { 13681 cv = *v 13682 } 13683 13684 for _, value := range shape { 13685 var col string 13686 if value != nil { 13687 jtv, ok := value.(string) 13688 if !ok { 13689 return fmt.Errorf("expected SubnetId to be of type string, got %T instead", value) 13690 } 13691 col = jtv 13692 } 13693 cv = append(cv, col) 13694 13695 } 13696 *v = cv 13697 return nil 13698} 13699 13700func awsAwsjson11_deserializeDocumentSyntaxToken(v **types.SyntaxToken, value interface{}) error { 13701 if v == nil { 13702 return fmt.Errorf("unexpected nil of type %T", v) 13703 } 13704 if value == nil { 13705 return nil 13706 } 13707 13708 shape, ok := value.(map[string]interface{}) 13709 if !ok { 13710 return fmt.Errorf("unexpected JSON type %v", value) 13711 } 13712 13713 var sv *types.SyntaxToken 13714 if *v == nil { 13715 sv = &types.SyntaxToken{} 13716 } else { 13717 sv = *v 13718 } 13719 13720 for key, value := range shape { 13721 switch key { 13722 case "BeginOffset": 13723 if value != nil { 13724 jtv, ok := value.(json.Number) 13725 if !ok { 13726 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 13727 } 13728 i64, err := jtv.Int64() 13729 if err != nil { 13730 return err 13731 } 13732 sv.BeginOffset = ptr.Int32(int32(i64)) 13733 } 13734 13735 case "EndOffset": 13736 if value != nil { 13737 jtv, ok := value.(json.Number) 13738 if !ok { 13739 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 13740 } 13741 i64, err := jtv.Int64() 13742 if err != nil { 13743 return err 13744 } 13745 sv.EndOffset = ptr.Int32(int32(i64)) 13746 } 13747 13748 case "PartOfSpeech": 13749 if err := awsAwsjson11_deserializeDocumentPartOfSpeechTag(&sv.PartOfSpeech, value); err != nil { 13750 return err 13751 } 13752 13753 case "Text": 13754 if value != nil { 13755 jtv, ok := value.(string) 13756 if !ok { 13757 return fmt.Errorf("expected String to be of type string, got %T instead", value) 13758 } 13759 sv.Text = ptr.String(jtv) 13760 } 13761 13762 case "TokenId": 13763 if value != nil { 13764 jtv, ok := value.(json.Number) 13765 if !ok { 13766 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 13767 } 13768 i64, err := jtv.Int64() 13769 if err != nil { 13770 return err 13771 } 13772 sv.TokenId = ptr.Int32(int32(i64)) 13773 } 13774 13775 default: 13776 _, _ = key, value 13777 13778 } 13779 } 13780 *v = sv 13781 return nil 13782} 13783 13784func awsAwsjson11_deserializeDocumentTag(v **types.Tag, value interface{}) error { 13785 if v == nil { 13786 return fmt.Errorf("unexpected nil of type %T", v) 13787 } 13788 if value == nil { 13789 return nil 13790 } 13791 13792 shape, ok := value.(map[string]interface{}) 13793 if !ok { 13794 return fmt.Errorf("unexpected JSON type %v", value) 13795 } 13796 13797 var sv *types.Tag 13798 if *v == nil { 13799 sv = &types.Tag{} 13800 } else { 13801 sv = *v 13802 } 13803 13804 for key, value := range shape { 13805 switch key { 13806 case "Key": 13807 if value != nil { 13808 jtv, ok := value.(string) 13809 if !ok { 13810 return fmt.Errorf("expected TagKey to be of type string, got %T instead", value) 13811 } 13812 sv.Key = ptr.String(jtv) 13813 } 13814 13815 case "Value": 13816 if value != nil { 13817 jtv, ok := value.(string) 13818 if !ok { 13819 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 13820 } 13821 sv.Value = ptr.String(jtv) 13822 } 13823 13824 default: 13825 _, _ = key, value 13826 13827 } 13828 } 13829 *v = sv 13830 return nil 13831} 13832 13833func awsAwsjson11_deserializeDocumentTagList(v *[]types.Tag, value interface{}) error { 13834 if v == nil { 13835 return fmt.Errorf("unexpected nil of type %T", v) 13836 } 13837 if value == nil { 13838 return nil 13839 } 13840 13841 shape, ok := value.([]interface{}) 13842 if !ok { 13843 return fmt.Errorf("unexpected JSON type %v", value) 13844 } 13845 13846 var cv []types.Tag 13847 if *v == nil { 13848 cv = []types.Tag{} 13849 } else { 13850 cv = *v 13851 } 13852 13853 for _, value := range shape { 13854 var col types.Tag 13855 destAddr := &col 13856 if err := awsAwsjson11_deserializeDocumentTag(&destAddr, value); err != nil { 13857 return err 13858 } 13859 col = *destAddr 13860 cv = append(cv, col) 13861 13862 } 13863 *v = cv 13864 return nil 13865} 13866 13867func awsAwsjson11_deserializeDocumentTargetEventTypes(v *[]string, value interface{}) error { 13868 if v == nil { 13869 return fmt.Errorf("unexpected nil of type %T", v) 13870 } 13871 if value == nil { 13872 return nil 13873 } 13874 13875 shape, ok := value.([]interface{}) 13876 if !ok { 13877 return fmt.Errorf("unexpected JSON type %v", value) 13878 } 13879 13880 var cv []string 13881 if *v == nil { 13882 cv = []string{} 13883 } else { 13884 cv = *v 13885 } 13886 13887 for _, value := range shape { 13888 var col string 13889 if value != nil { 13890 jtv, ok := value.(string) 13891 if !ok { 13892 return fmt.Errorf("expected EventTypeString to be of type string, got %T instead", value) 13893 } 13894 col = jtv 13895 } 13896 cv = append(cv, col) 13897 13898 } 13899 *v = cv 13900 return nil 13901} 13902 13903func awsAwsjson11_deserializeDocumentTextSizeLimitExceededException(v **types.TextSizeLimitExceededException, value interface{}) error { 13904 if v == nil { 13905 return fmt.Errorf("unexpected nil of type %T", v) 13906 } 13907 if value == nil { 13908 return nil 13909 } 13910 13911 shape, ok := value.(map[string]interface{}) 13912 if !ok { 13913 return fmt.Errorf("unexpected JSON type %v", value) 13914 } 13915 13916 var sv *types.TextSizeLimitExceededException 13917 if *v == nil { 13918 sv = &types.TextSizeLimitExceededException{} 13919 } else { 13920 sv = *v 13921 } 13922 13923 for key, value := range shape { 13924 switch key { 13925 case "Message": 13926 if value != nil { 13927 jtv, ok := value.(string) 13928 if !ok { 13929 return fmt.Errorf("expected String to be of type string, got %T instead", value) 13930 } 13931 sv.Message = ptr.String(jtv) 13932 } 13933 13934 default: 13935 _, _ = key, value 13936 13937 } 13938 } 13939 *v = sv 13940 return nil 13941} 13942 13943func awsAwsjson11_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { 13944 if v == nil { 13945 return fmt.Errorf("unexpected nil of type %T", v) 13946 } 13947 if value == nil { 13948 return nil 13949 } 13950 13951 shape, ok := value.(map[string]interface{}) 13952 if !ok { 13953 return fmt.Errorf("unexpected JSON type %v", value) 13954 } 13955 13956 var sv *types.TooManyRequestsException 13957 if *v == nil { 13958 sv = &types.TooManyRequestsException{} 13959 } else { 13960 sv = *v 13961 } 13962 13963 for key, value := range shape { 13964 switch key { 13965 case "Message": 13966 if value != nil { 13967 jtv, ok := value.(string) 13968 if !ok { 13969 return fmt.Errorf("expected String to be of type string, got %T instead", value) 13970 } 13971 sv.Message = ptr.String(jtv) 13972 } 13973 13974 default: 13975 _, _ = key, value 13976 13977 } 13978 } 13979 *v = sv 13980 return nil 13981} 13982 13983func awsAwsjson11_deserializeDocumentTooManyTagKeysException(v **types.TooManyTagKeysException, value interface{}) error { 13984 if v == nil { 13985 return fmt.Errorf("unexpected nil of type %T", v) 13986 } 13987 if value == nil { 13988 return nil 13989 } 13990 13991 shape, ok := value.(map[string]interface{}) 13992 if !ok { 13993 return fmt.Errorf("unexpected JSON type %v", value) 13994 } 13995 13996 var sv *types.TooManyTagKeysException 13997 if *v == nil { 13998 sv = &types.TooManyTagKeysException{} 13999 } else { 14000 sv = *v 14001 } 14002 14003 for key, value := range shape { 14004 switch key { 14005 case "Message": 14006 if value != nil { 14007 jtv, ok := value.(string) 14008 if !ok { 14009 return fmt.Errorf("expected String to be of type string, got %T instead", value) 14010 } 14011 sv.Message = ptr.String(jtv) 14012 } 14013 14014 default: 14015 _, _ = key, value 14016 14017 } 14018 } 14019 *v = sv 14020 return nil 14021} 14022 14023func awsAwsjson11_deserializeDocumentTooManyTagsException(v **types.TooManyTagsException, value interface{}) error { 14024 if v == nil { 14025 return fmt.Errorf("unexpected nil of type %T", v) 14026 } 14027 if value == nil { 14028 return nil 14029 } 14030 14031 shape, ok := value.(map[string]interface{}) 14032 if !ok { 14033 return fmt.Errorf("unexpected JSON type %v", value) 14034 } 14035 14036 var sv *types.TooManyTagsException 14037 if *v == nil { 14038 sv = &types.TooManyTagsException{} 14039 } else { 14040 sv = *v 14041 } 14042 14043 for key, value := range shape { 14044 switch key { 14045 case "Message": 14046 if value != nil { 14047 jtv, ok := value.(string) 14048 if !ok { 14049 return fmt.Errorf("expected String to be of type string, got %T instead", value) 14050 } 14051 sv.Message = ptr.String(jtv) 14052 } 14053 14054 default: 14055 _, _ = key, value 14056 14057 } 14058 } 14059 *v = sv 14060 return nil 14061} 14062 14063func awsAwsjson11_deserializeDocumentTopicsDetectionJobProperties(v **types.TopicsDetectionJobProperties, value interface{}) error { 14064 if v == nil { 14065 return fmt.Errorf("unexpected nil of type %T", v) 14066 } 14067 if value == nil { 14068 return nil 14069 } 14070 14071 shape, ok := value.(map[string]interface{}) 14072 if !ok { 14073 return fmt.Errorf("unexpected JSON type %v", value) 14074 } 14075 14076 var sv *types.TopicsDetectionJobProperties 14077 if *v == nil { 14078 sv = &types.TopicsDetectionJobProperties{} 14079 } else { 14080 sv = *v 14081 } 14082 14083 for key, value := range shape { 14084 switch key { 14085 case "DataAccessRoleArn": 14086 if value != nil { 14087 jtv, ok := value.(string) 14088 if !ok { 14089 return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) 14090 } 14091 sv.DataAccessRoleArn = ptr.String(jtv) 14092 } 14093 14094 case "EndTime": 14095 if value != nil { 14096 switch jtv := value.(type) { 14097 case json.Number: 14098 f64, err := jtv.Float64() 14099 if err != nil { 14100 return err 14101 } 14102 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14103 14104 default: 14105 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 14106 14107 } 14108 } 14109 14110 case "InputDataConfig": 14111 if err := awsAwsjson11_deserializeDocumentInputDataConfig(&sv.InputDataConfig, value); err != nil { 14112 return err 14113 } 14114 14115 case "JobArn": 14116 if value != nil { 14117 jtv, ok := value.(string) 14118 if !ok { 14119 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 14120 } 14121 sv.JobArn = ptr.String(jtv) 14122 } 14123 14124 case "JobId": 14125 if value != nil { 14126 jtv, ok := value.(string) 14127 if !ok { 14128 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 14129 } 14130 sv.JobId = ptr.String(jtv) 14131 } 14132 14133 case "JobName": 14134 if value != nil { 14135 jtv, ok := value.(string) 14136 if !ok { 14137 return fmt.Errorf("expected JobName to be of type string, got %T instead", value) 14138 } 14139 sv.JobName = ptr.String(jtv) 14140 } 14141 14142 case "JobStatus": 14143 if value != nil { 14144 jtv, ok := value.(string) 14145 if !ok { 14146 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 14147 } 14148 sv.JobStatus = types.JobStatus(jtv) 14149 } 14150 14151 case "Message": 14152 if value != nil { 14153 jtv, ok := value.(string) 14154 if !ok { 14155 return fmt.Errorf("expected AnyLengthString to be of type string, got %T instead", value) 14156 } 14157 sv.Message = ptr.String(jtv) 14158 } 14159 14160 case "NumberOfTopics": 14161 if value != nil { 14162 jtv, ok := value.(json.Number) 14163 if !ok { 14164 return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) 14165 } 14166 i64, err := jtv.Int64() 14167 if err != nil { 14168 return err 14169 } 14170 sv.NumberOfTopics = ptr.Int32(int32(i64)) 14171 } 14172 14173 case "OutputDataConfig": 14174 if err := awsAwsjson11_deserializeDocumentOutputDataConfig(&sv.OutputDataConfig, value); err != nil { 14175 return err 14176 } 14177 14178 case "SubmitTime": 14179 if value != nil { 14180 switch jtv := value.(type) { 14181 case json.Number: 14182 f64, err := jtv.Float64() 14183 if err != nil { 14184 return err 14185 } 14186 sv.SubmitTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14187 14188 default: 14189 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 14190 14191 } 14192 } 14193 14194 case "VolumeKmsKeyId": 14195 if value != nil { 14196 jtv, ok := value.(string) 14197 if !ok { 14198 return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value) 14199 } 14200 sv.VolumeKmsKeyId = ptr.String(jtv) 14201 } 14202 14203 case "VpcConfig": 14204 if err := awsAwsjson11_deserializeDocumentVpcConfig(&sv.VpcConfig, value); err != nil { 14205 return err 14206 } 14207 14208 default: 14209 _, _ = key, value 14210 14211 } 14212 } 14213 *v = sv 14214 return nil 14215} 14216 14217func awsAwsjson11_deserializeDocumentTopicsDetectionJobPropertiesList(v *[]types.TopicsDetectionJobProperties, value interface{}) error { 14218 if v == nil { 14219 return fmt.Errorf("unexpected nil of type %T", v) 14220 } 14221 if value == nil { 14222 return nil 14223 } 14224 14225 shape, ok := value.([]interface{}) 14226 if !ok { 14227 return fmt.Errorf("unexpected JSON type %v", value) 14228 } 14229 14230 var cv []types.TopicsDetectionJobProperties 14231 if *v == nil { 14232 cv = []types.TopicsDetectionJobProperties{} 14233 } else { 14234 cv = *v 14235 } 14236 14237 for _, value := range shape { 14238 var col types.TopicsDetectionJobProperties 14239 destAddr := &col 14240 if err := awsAwsjson11_deserializeDocumentTopicsDetectionJobProperties(&destAddr, value); err != nil { 14241 return err 14242 } 14243 col = *destAddr 14244 cv = append(cv, col) 14245 14246 } 14247 *v = cv 14248 return nil 14249} 14250 14251func awsAwsjson11_deserializeDocumentUnsupportedLanguageException(v **types.UnsupportedLanguageException, value interface{}) error { 14252 if v == nil { 14253 return fmt.Errorf("unexpected nil of type %T", v) 14254 } 14255 if value == nil { 14256 return nil 14257 } 14258 14259 shape, ok := value.(map[string]interface{}) 14260 if !ok { 14261 return fmt.Errorf("unexpected JSON type %v", value) 14262 } 14263 14264 var sv *types.UnsupportedLanguageException 14265 if *v == nil { 14266 sv = &types.UnsupportedLanguageException{} 14267 } else { 14268 sv = *v 14269 } 14270 14271 for key, value := range shape { 14272 switch key { 14273 case "Message": 14274 if value != nil { 14275 jtv, ok := value.(string) 14276 if !ok { 14277 return fmt.Errorf("expected String to be of type string, got %T instead", value) 14278 } 14279 sv.Message = ptr.String(jtv) 14280 } 14281 14282 default: 14283 _, _ = key, value 14284 14285 } 14286 } 14287 *v = sv 14288 return nil 14289} 14290 14291func awsAwsjson11_deserializeDocumentVpcConfig(v **types.VpcConfig, value interface{}) error { 14292 if v == nil { 14293 return fmt.Errorf("unexpected nil of type %T", v) 14294 } 14295 if value == nil { 14296 return nil 14297 } 14298 14299 shape, ok := value.(map[string]interface{}) 14300 if !ok { 14301 return fmt.Errorf("unexpected JSON type %v", value) 14302 } 14303 14304 var sv *types.VpcConfig 14305 if *v == nil { 14306 sv = &types.VpcConfig{} 14307 } else { 14308 sv = *v 14309 } 14310 14311 for key, value := range shape { 14312 switch key { 14313 case "SecurityGroupIds": 14314 if err := awsAwsjson11_deserializeDocumentSecurityGroupIds(&sv.SecurityGroupIds, value); err != nil { 14315 return err 14316 } 14317 14318 case "Subnets": 14319 if err := awsAwsjson11_deserializeDocumentSubnets(&sv.Subnets, value); err != nil { 14320 return err 14321 } 14322 14323 default: 14324 _, _ = key, value 14325 14326 } 14327 } 14328 *v = sv 14329 return nil 14330} 14331 14332func awsAwsjson11_deserializeOpDocumentBatchDetectDominantLanguageOutput(v **BatchDetectDominantLanguageOutput, value interface{}) error { 14333 if v == nil { 14334 return fmt.Errorf("unexpected nil of type %T", v) 14335 } 14336 if value == nil { 14337 return nil 14338 } 14339 14340 shape, ok := value.(map[string]interface{}) 14341 if !ok { 14342 return fmt.Errorf("unexpected JSON type %v", value) 14343 } 14344 14345 var sv *BatchDetectDominantLanguageOutput 14346 if *v == nil { 14347 sv = &BatchDetectDominantLanguageOutput{} 14348 } else { 14349 sv = *v 14350 } 14351 14352 for key, value := range shape { 14353 switch key { 14354 case "ErrorList": 14355 if err := awsAwsjson11_deserializeDocumentBatchItemErrorList(&sv.ErrorList, value); err != nil { 14356 return err 14357 } 14358 14359 case "ResultList": 14360 if err := awsAwsjson11_deserializeDocumentListOfDetectDominantLanguageResult(&sv.ResultList, value); err != nil { 14361 return err 14362 } 14363 14364 default: 14365 _, _ = key, value 14366 14367 } 14368 } 14369 *v = sv 14370 return nil 14371} 14372 14373func awsAwsjson11_deserializeOpDocumentBatchDetectEntitiesOutput(v **BatchDetectEntitiesOutput, value interface{}) error { 14374 if v == nil { 14375 return fmt.Errorf("unexpected nil of type %T", v) 14376 } 14377 if value == nil { 14378 return nil 14379 } 14380 14381 shape, ok := value.(map[string]interface{}) 14382 if !ok { 14383 return fmt.Errorf("unexpected JSON type %v", value) 14384 } 14385 14386 var sv *BatchDetectEntitiesOutput 14387 if *v == nil { 14388 sv = &BatchDetectEntitiesOutput{} 14389 } else { 14390 sv = *v 14391 } 14392 14393 for key, value := range shape { 14394 switch key { 14395 case "ErrorList": 14396 if err := awsAwsjson11_deserializeDocumentBatchItemErrorList(&sv.ErrorList, value); err != nil { 14397 return err 14398 } 14399 14400 case "ResultList": 14401 if err := awsAwsjson11_deserializeDocumentListOfDetectEntitiesResult(&sv.ResultList, value); err != nil { 14402 return err 14403 } 14404 14405 default: 14406 _, _ = key, value 14407 14408 } 14409 } 14410 *v = sv 14411 return nil 14412} 14413 14414func awsAwsjson11_deserializeOpDocumentBatchDetectKeyPhrasesOutput(v **BatchDetectKeyPhrasesOutput, value interface{}) error { 14415 if v == nil { 14416 return fmt.Errorf("unexpected nil of type %T", v) 14417 } 14418 if value == nil { 14419 return nil 14420 } 14421 14422 shape, ok := value.(map[string]interface{}) 14423 if !ok { 14424 return fmt.Errorf("unexpected JSON type %v", value) 14425 } 14426 14427 var sv *BatchDetectKeyPhrasesOutput 14428 if *v == nil { 14429 sv = &BatchDetectKeyPhrasesOutput{} 14430 } else { 14431 sv = *v 14432 } 14433 14434 for key, value := range shape { 14435 switch key { 14436 case "ErrorList": 14437 if err := awsAwsjson11_deserializeDocumentBatchItemErrorList(&sv.ErrorList, value); err != nil { 14438 return err 14439 } 14440 14441 case "ResultList": 14442 if err := awsAwsjson11_deserializeDocumentListOfDetectKeyPhrasesResult(&sv.ResultList, value); err != nil { 14443 return err 14444 } 14445 14446 default: 14447 _, _ = key, value 14448 14449 } 14450 } 14451 *v = sv 14452 return nil 14453} 14454 14455func awsAwsjson11_deserializeOpDocumentBatchDetectSentimentOutput(v **BatchDetectSentimentOutput, value interface{}) error { 14456 if v == nil { 14457 return fmt.Errorf("unexpected nil of type %T", v) 14458 } 14459 if value == nil { 14460 return nil 14461 } 14462 14463 shape, ok := value.(map[string]interface{}) 14464 if !ok { 14465 return fmt.Errorf("unexpected JSON type %v", value) 14466 } 14467 14468 var sv *BatchDetectSentimentOutput 14469 if *v == nil { 14470 sv = &BatchDetectSentimentOutput{} 14471 } else { 14472 sv = *v 14473 } 14474 14475 for key, value := range shape { 14476 switch key { 14477 case "ErrorList": 14478 if err := awsAwsjson11_deserializeDocumentBatchItemErrorList(&sv.ErrorList, value); err != nil { 14479 return err 14480 } 14481 14482 case "ResultList": 14483 if err := awsAwsjson11_deserializeDocumentListOfDetectSentimentResult(&sv.ResultList, value); err != nil { 14484 return err 14485 } 14486 14487 default: 14488 _, _ = key, value 14489 14490 } 14491 } 14492 *v = sv 14493 return nil 14494} 14495 14496func awsAwsjson11_deserializeOpDocumentBatchDetectSyntaxOutput(v **BatchDetectSyntaxOutput, value interface{}) error { 14497 if v == nil { 14498 return fmt.Errorf("unexpected nil of type %T", v) 14499 } 14500 if value == nil { 14501 return nil 14502 } 14503 14504 shape, ok := value.(map[string]interface{}) 14505 if !ok { 14506 return fmt.Errorf("unexpected JSON type %v", value) 14507 } 14508 14509 var sv *BatchDetectSyntaxOutput 14510 if *v == nil { 14511 sv = &BatchDetectSyntaxOutput{} 14512 } else { 14513 sv = *v 14514 } 14515 14516 for key, value := range shape { 14517 switch key { 14518 case "ErrorList": 14519 if err := awsAwsjson11_deserializeDocumentBatchItemErrorList(&sv.ErrorList, value); err != nil { 14520 return err 14521 } 14522 14523 case "ResultList": 14524 if err := awsAwsjson11_deserializeDocumentListOfDetectSyntaxResult(&sv.ResultList, value); err != nil { 14525 return err 14526 } 14527 14528 default: 14529 _, _ = key, value 14530 14531 } 14532 } 14533 *v = sv 14534 return nil 14535} 14536 14537func awsAwsjson11_deserializeOpDocumentClassifyDocumentOutput(v **ClassifyDocumentOutput, value interface{}) error { 14538 if v == nil { 14539 return fmt.Errorf("unexpected nil of type %T", v) 14540 } 14541 if value == nil { 14542 return nil 14543 } 14544 14545 shape, ok := value.(map[string]interface{}) 14546 if !ok { 14547 return fmt.Errorf("unexpected JSON type %v", value) 14548 } 14549 14550 var sv *ClassifyDocumentOutput 14551 if *v == nil { 14552 sv = &ClassifyDocumentOutput{} 14553 } else { 14554 sv = *v 14555 } 14556 14557 for key, value := range shape { 14558 switch key { 14559 case "Classes": 14560 if err := awsAwsjson11_deserializeDocumentListOfClasses(&sv.Classes, value); err != nil { 14561 return err 14562 } 14563 14564 case "Labels": 14565 if err := awsAwsjson11_deserializeDocumentListOfLabels(&sv.Labels, value); err != nil { 14566 return err 14567 } 14568 14569 default: 14570 _, _ = key, value 14571 14572 } 14573 } 14574 *v = sv 14575 return nil 14576} 14577 14578func awsAwsjson11_deserializeOpDocumentContainsPiiEntitiesOutput(v **ContainsPiiEntitiesOutput, value interface{}) error { 14579 if v == nil { 14580 return fmt.Errorf("unexpected nil of type %T", v) 14581 } 14582 if value == nil { 14583 return nil 14584 } 14585 14586 shape, ok := value.(map[string]interface{}) 14587 if !ok { 14588 return fmt.Errorf("unexpected JSON type %v", value) 14589 } 14590 14591 var sv *ContainsPiiEntitiesOutput 14592 if *v == nil { 14593 sv = &ContainsPiiEntitiesOutput{} 14594 } else { 14595 sv = *v 14596 } 14597 14598 for key, value := range shape { 14599 switch key { 14600 case "Labels": 14601 if err := awsAwsjson11_deserializeDocumentListOfEntityLabels(&sv.Labels, value); err != nil { 14602 return err 14603 } 14604 14605 default: 14606 _, _ = key, value 14607 14608 } 14609 } 14610 *v = sv 14611 return nil 14612} 14613 14614func awsAwsjson11_deserializeOpDocumentCreateDocumentClassifierOutput(v **CreateDocumentClassifierOutput, value interface{}) error { 14615 if v == nil { 14616 return fmt.Errorf("unexpected nil of type %T", v) 14617 } 14618 if value == nil { 14619 return nil 14620 } 14621 14622 shape, ok := value.(map[string]interface{}) 14623 if !ok { 14624 return fmt.Errorf("unexpected JSON type %v", value) 14625 } 14626 14627 var sv *CreateDocumentClassifierOutput 14628 if *v == nil { 14629 sv = &CreateDocumentClassifierOutput{} 14630 } else { 14631 sv = *v 14632 } 14633 14634 for key, value := range shape { 14635 switch key { 14636 case "DocumentClassifierArn": 14637 if value != nil { 14638 jtv, ok := value.(string) 14639 if !ok { 14640 return fmt.Errorf("expected DocumentClassifierArn to be of type string, got %T instead", value) 14641 } 14642 sv.DocumentClassifierArn = ptr.String(jtv) 14643 } 14644 14645 default: 14646 _, _ = key, value 14647 14648 } 14649 } 14650 *v = sv 14651 return nil 14652} 14653 14654func awsAwsjson11_deserializeOpDocumentCreateEndpointOutput(v **CreateEndpointOutput, value interface{}) error { 14655 if v == nil { 14656 return fmt.Errorf("unexpected nil of type %T", v) 14657 } 14658 if value == nil { 14659 return nil 14660 } 14661 14662 shape, ok := value.(map[string]interface{}) 14663 if !ok { 14664 return fmt.Errorf("unexpected JSON type %v", value) 14665 } 14666 14667 var sv *CreateEndpointOutput 14668 if *v == nil { 14669 sv = &CreateEndpointOutput{} 14670 } else { 14671 sv = *v 14672 } 14673 14674 for key, value := range shape { 14675 switch key { 14676 case "EndpointArn": 14677 if value != nil { 14678 jtv, ok := value.(string) 14679 if !ok { 14680 return fmt.Errorf("expected ComprehendEndpointArn to be of type string, got %T instead", value) 14681 } 14682 sv.EndpointArn = ptr.String(jtv) 14683 } 14684 14685 default: 14686 _, _ = key, value 14687 14688 } 14689 } 14690 *v = sv 14691 return nil 14692} 14693 14694func awsAwsjson11_deserializeOpDocumentCreateEntityRecognizerOutput(v **CreateEntityRecognizerOutput, value interface{}) error { 14695 if v == nil { 14696 return fmt.Errorf("unexpected nil of type %T", v) 14697 } 14698 if value == nil { 14699 return nil 14700 } 14701 14702 shape, ok := value.(map[string]interface{}) 14703 if !ok { 14704 return fmt.Errorf("unexpected JSON type %v", value) 14705 } 14706 14707 var sv *CreateEntityRecognizerOutput 14708 if *v == nil { 14709 sv = &CreateEntityRecognizerOutput{} 14710 } else { 14711 sv = *v 14712 } 14713 14714 for key, value := range shape { 14715 switch key { 14716 case "EntityRecognizerArn": 14717 if value != nil { 14718 jtv, ok := value.(string) 14719 if !ok { 14720 return fmt.Errorf("expected EntityRecognizerArn to be of type string, got %T instead", value) 14721 } 14722 sv.EntityRecognizerArn = ptr.String(jtv) 14723 } 14724 14725 default: 14726 _, _ = key, value 14727 14728 } 14729 } 14730 *v = sv 14731 return nil 14732} 14733 14734func awsAwsjson11_deserializeOpDocumentDeleteDocumentClassifierOutput(v **DeleteDocumentClassifierOutput, value interface{}) error { 14735 if v == nil { 14736 return fmt.Errorf("unexpected nil of type %T", v) 14737 } 14738 if value == nil { 14739 return nil 14740 } 14741 14742 shape, ok := value.(map[string]interface{}) 14743 if !ok { 14744 return fmt.Errorf("unexpected JSON type %v", value) 14745 } 14746 14747 var sv *DeleteDocumentClassifierOutput 14748 if *v == nil { 14749 sv = &DeleteDocumentClassifierOutput{} 14750 } else { 14751 sv = *v 14752 } 14753 14754 for key, value := range shape { 14755 switch key { 14756 default: 14757 _, _ = key, value 14758 14759 } 14760 } 14761 *v = sv 14762 return nil 14763} 14764 14765func awsAwsjson11_deserializeOpDocumentDeleteEndpointOutput(v **DeleteEndpointOutput, value interface{}) error { 14766 if v == nil { 14767 return fmt.Errorf("unexpected nil of type %T", v) 14768 } 14769 if value == nil { 14770 return nil 14771 } 14772 14773 shape, ok := value.(map[string]interface{}) 14774 if !ok { 14775 return fmt.Errorf("unexpected JSON type %v", value) 14776 } 14777 14778 var sv *DeleteEndpointOutput 14779 if *v == nil { 14780 sv = &DeleteEndpointOutput{} 14781 } else { 14782 sv = *v 14783 } 14784 14785 for key, value := range shape { 14786 switch key { 14787 default: 14788 _, _ = key, value 14789 14790 } 14791 } 14792 *v = sv 14793 return nil 14794} 14795 14796func awsAwsjson11_deserializeOpDocumentDeleteEntityRecognizerOutput(v **DeleteEntityRecognizerOutput, value interface{}) error { 14797 if v == nil { 14798 return fmt.Errorf("unexpected nil of type %T", v) 14799 } 14800 if value == nil { 14801 return nil 14802 } 14803 14804 shape, ok := value.(map[string]interface{}) 14805 if !ok { 14806 return fmt.Errorf("unexpected JSON type %v", value) 14807 } 14808 14809 var sv *DeleteEntityRecognizerOutput 14810 if *v == nil { 14811 sv = &DeleteEntityRecognizerOutput{} 14812 } else { 14813 sv = *v 14814 } 14815 14816 for key, value := range shape { 14817 switch key { 14818 default: 14819 _, _ = key, value 14820 14821 } 14822 } 14823 *v = sv 14824 return nil 14825} 14826 14827func awsAwsjson11_deserializeOpDocumentDescribeDocumentClassificationJobOutput(v **DescribeDocumentClassificationJobOutput, value interface{}) error { 14828 if v == nil { 14829 return fmt.Errorf("unexpected nil of type %T", v) 14830 } 14831 if value == nil { 14832 return nil 14833 } 14834 14835 shape, ok := value.(map[string]interface{}) 14836 if !ok { 14837 return fmt.Errorf("unexpected JSON type %v", value) 14838 } 14839 14840 var sv *DescribeDocumentClassificationJobOutput 14841 if *v == nil { 14842 sv = &DescribeDocumentClassificationJobOutput{} 14843 } else { 14844 sv = *v 14845 } 14846 14847 for key, value := range shape { 14848 switch key { 14849 case "DocumentClassificationJobProperties": 14850 if err := awsAwsjson11_deserializeDocumentDocumentClassificationJobProperties(&sv.DocumentClassificationJobProperties, value); err != nil { 14851 return err 14852 } 14853 14854 default: 14855 _, _ = key, value 14856 14857 } 14858 } 14859 *v = sv 14860 return nil 14861} 14862 14863func awsAwsjson11_deserializeOpDocumentDescribeDocumentClassifierOutput(v **DescribeDocumentClassifierOutput, value interface{}) error { 14864 if v == nil { 14865 return fmt.Errorf("unexpected nil of type %T", v) 14866 } 14867 if value == nil { 14868 return nil 14869 } 14870 14871 shape, ok := value.(map[string]interface{}) 14872 if !ok { 14873 return fmt.Errorf("unexpected JSON type %v", value) 14874 } 14875 14876 var sv *DescribeDocumentClassifierOutput 14877 if *v == nil { 14878 sv = &DescribeDocumentClassifierOutput{} 14879 } else { 14880 sv = *v 14881 } 14882 14883 for key, value := range shape { 14884 switch key { 14885 case "DocumentClassifierProperties": 14886 if err := awsAwsjson11_deserializeDocumentDocumentClassifierProperties(&sv.DocumentClassifierProperties, value); err != nil { 14887 return err 14888 } 14889 14890 default: 14891 _, _ = key, value 14892 14893 } 14894 } 14895 *v = sv 14896 return nil 14897} 14898 14899func awsAwsjson11_deserializeOpDocumentDescribeDominantLanguageDetectionJobOutput(v **DescribeDominantLanguageDetectionJobOutput, value interface{}) error { 14900 if v == nil { 14901 return fmt.Errorf("unexpected nil of type %T", v) 14902 } 14903 if value == nil { 14904 return nil 14905 } 14906 14907 shape, ok := value.(map[string]interface{}) 14908 if !ok { 14909 return fmt.Errorf("unexpected JSON type %v", value) 14910 } 14911 14912 var sv *DescribeDominantLanguageDetectionJobOutput 14913 if *v == nil { 14914 sv = &DescribeDominantLanguageDetectionJobOutput{} 14915 } else { 14916 sv = *v 14917 } 14918 14919 for key, value := range shape { 14920 switch key { 14921 case "DominantLanguageDetectionJobProperties": 14922 if err := awsAwsjson11_deserializeDocumentDominantLanguageDetectionJobProperties(&sv.DominantLanguageDetectionJobProperties, value); err != nil { 14923 return err 14924 } 14925 14926 default: 14927 _, _ = key, value 14928 14929 } 14930 } 14931 *v = sv 14932 return nil 14933} 14934 14935func awsAwsjson11_deserializeOpDocumentDescribeEndpointOutput(v **DescribeEndpointOutput, value interface{}) error { 14936 if v == nil { 14937 return fmt.Errorf("unexpected nil of type %T", v) 14938 } 14939 if value == nil { 14940 return nil 14941 } 14942 14943 shape, ok := value.(map[string]interface{}) 14944 if !ok { 14945 return fmt.Errorf("unexpected JSON type %v", value) 14946 } 14947 14948 var sv *DescribeEndpointOutput 14949 if *v == nil { 14950 sv = &DescribeEndpointOutput{} 14951 } else { 14952 sv = *v 14953 } 14954 14955 for key, value := range shape { 14956 switch key { 14957 case "EndpointProperties": 14958 if err := awsAwsjson11_deserializeDocumentEndpointProperties(&sv.EndpointProperties, value); err != nil { 14959 return err 14960 } 14961 14962 default: 14963 _, _ = key, value 14964 14965 } 14966 } 14967 *v = sv 14968 return nil 14969} 14970 14971func awsAwsjson11_deserializeOpDocumentDescribeEntitiesDetectionJobOutput(v **DescribeEntitiesDetectionJobOutput, value interface{}) error { 14972 if v == nil { 14973 return fmt.Errorf("unexpected nil of type %T", v) 14974 } 14975 if value == nil { 14976 return nil 14977 } 14978 14979 shape, ok := value.(map[string]interface{}) 14980 if !ok { 14981 return fmt.Errorf("unexpected JSON type %v", value) 14982 } 14983 14984 var sv *DescribeEntitiesDetectionJobOutput 14985 if *v == nil { 14986 sv = &DescribeEntitiesDetectionJobOutput{} 14987 } else { 14988 sv = *v 14989 } 14990 14991 for key, value := range shape { 14992 switch key { 14993 case "EntitiesDetectionJobProperties": 14994 if err := awsAwsjson11_deserializeDocumentEntitiesDetectionJobProperties(&sv.EntitiesDetectionJobProperties, value); err != nil { 14995 return err 14996 } 14997 14998 default: 14999 _, _ = key, value 15000 15001 } 15002 } 15003 *v = sv 15004 return nil 15005} 15006 15007func awsAwsjson11_deserializeOpDocumentDescribeEntityRecognizerOutput(v **DescribeEntityRecognizerOutput, value interface{}) error { 15008 if v == nil { 15009 return fmt.Errorf("unexpected nil of type %T", v) 15010 } 15011 if value == nil { 15012 return nil 15013 } 15014 15015 shape, ok := value.(map[string]interface{}) 15016 if !ok { 15017 return fmt.Errorf("unexpected JSON type %v", value) 15018 } 15019 15020 var sv *DescribeEntityRecognizerOutput 15021 if *v == nil { 15022 sv = &DescribeEntityRecognizerOutput{} 15023 } else { 15024 sv = *v 15025 } 15026 15027 for key, value := range shape { 15028 switch key { 15029 case "EntityRecognizerProperties": 15030 if err := awsAwsjson11_deserializeDocumentEntityRecognizerProperties(&sv.EntityRecognizerProperties, value); err != nil { 15031 return err 15032 } 15033 15034 default: 15035 _, _ = key, value 15036 15037 } 15038 } 15039 *v = sv 15040 return nil 15041} 15042 15043func awsAwsjson11_deserializeOpDocumentDescribeEventsDetectionJobOutput(v **DescribeEventsDetectionJobOutput, value interface{}) error { 15044 if v == nil { 15045 return fmt.Errorf("unexpected nil of type %T", v) 15046 } 15047 if value == nil { 15048 return nil 15049 } 15050 15051 shape, ok := value.(map[string]interface{}) 15052 if !ok { 15053 return fmt.Errorf("unexpected JSON type %v", value) 15054 } 15055 15056 var sv *DescribeEventsDetectionJobOutput 15057 if *v == nil { 15058 sv = &DescribeEventsDetectionJobOutput{} 15059 } else { 15060 sv = *v 15061 } 15062 15063 for key, value := range shape { 15064 switch key { 15065 case "EventsDetectionJobProperties": 15066 if err := awsAwsjson11_deserializeDocumentEventsDetectionJobProperties(&sv.EventsDetectionJobProperties, value); err != nil { 15067 return err 15068 } 15069 15070 default: 15071 _, _ = key, value 15072 15073 } 15074 } 15075 *v = sv 15076 return nil 15077} 15078 15079func awsAwsjson11_deserializeOpDocumentDescribeKeyPhrasesDetectionJobOutput(v **DescribeKeyPhrasesDetectionJobOutput, value interface{}) error { 15080 if v == nil { 15081 return fmt.Errorf("unexpected nil of type %T", v) 15082 } 15083 if value == nil { 15084 return nil 15085 } 15086 15087 shape, ok := value.(map[string]interface{}) 15088 if !ok { 15089 return fmt.Errorf("unexpected JSON type %v", value) 15090 } 15091 15092 var sv *DescribeKeyPhrasesDetectionJobOutput 15093 if *v == nil { 15094 sv = &DescribeKeyPhrasesDetectionJobOutput{} 15095 } else { 15096 sv = *v 15097 } 15098 15099 for key, value := range shape { 15100 switch key { 15101 case "KeyPhrasesDetectionJobProperties": 15102 if err := awsAwsjson11_deserializeDocumentKeyPhrasesDetectionJobProperties(&sv.KeyPhrasesDetectionJobProperties, value); err != nil { 15103 return err 15104 } 15105 15106 default: 15107 _, _ = key, value 15108 15109 } 15110 } 15111 *v = sv 15112 return nil 15113} 15114 15115func awsAwsjson11_deserializeOpDocumentDescribePiiEntitiesDetectionJobOutput(v **DescribePiiEntitiesDetectionJobOutput, value interface{}) error { 15116 if v == nil { 15117 return fmt.Errorf("unexpected nil of type %T", v) 15118 } 15119 if value == nil { 15120 return nil 15121 } 15122 15123 shape, ok := value.(map[string]interface{}) 15124 if !ok { 15125 return fmt.Errorf("unexpected JSON type %v", value) 15126 } 15127 15128 var sv *DescribePiiEntitiesDetectionJobOutput 15129 if *v == nil { 15130 sv = &DescribePiiEntitiesDetectionJobOutput{} 15131 } else { 15132 sv = *v 15133 } 15134 15135 for key, value := range shape { 15136 switch key { 15137 case "PiiEntitiesDetectionJobProperties": 15138 if err := awsAwsjson11_deserializeDocumentPiiEntitiesDetectionJobProperties(&sv.PiiEntitiesDetectionJobProperties, value); err != nil { 15139 return err 15140 } 15141 15142 default: 15143 _, _ = key, value 15144 15145 } 15146 } 15147 *v = sv 15148 return nil 15149} 15150 15151func awsAwsjson11_deserializeOpDocumentDescribeSentimentDetectionJobOutput(v **DescribeSentimentDetectionJobOutput, value interface{}) error { 15152 if v == nil { 15153 return fmt.Errorf("unexpected nil of type %T", v) 15154 } 15155 if value == nil { 15156 return nil 15157 } 15158 15159 shape, ok := value.(map[string]interface{}) 15160 if !ok { 15161 return fmt.Errorf("unexpected JSON type %v", value) 15162 } 15163 15164 var sv *DescribeSentimentDetectionJobOutput 15165 if *v == nil { 15166 sv = &DescribeSentimentDetectionJobOutput{} 15167 } else { 15168 sv = *v 15169 } 15170 15171 for key, value := range shape { 15172 switch key { 15173 case "SentimentDetectionJobProperties": 15174 if err := awsAwsjson11_deserializeDocumentSentimentDetectionJobProperties(&sv.SentimentDetectionJobProperties, value); err != nil { 15175 return err 15176 } 15177 15178 default: 15179 _, _ = key, value 15180 15181 } 15182 } 15183 *v = sv 15184 return nil 15185} 15186 15187func awsAwsjson11_deserializeOpDocumentDescribeTopicsDetectionJobOutput(v **DescribeTopicsDetectionJobOutput, value interface{}) error { 15188 if v == nil { 15189 return fmt.Errorf("unexpected nil of type %T", v) 15190 } 15191 if value == nil { 15192 return nil 15193 } 15194 15195 shape, ok := value.(map[string]interface{}) 15196 if !ok { 15197 return fmt.Errorf("unexpected JSON type %v", value) 15198 } 15199 15200 var sv *DescribeTopicsDetectionJobOutput 15201 if *v == nil { 15202 sv = &DescribeTopicsDetectionJobOutput{} 15203 } else { 15204 sv = *v 15205 } 15206 15207 for key, value := range shape { 15208 switch key { 15209 case "TopicsDetectionJobProperties": 15210 if err := awsAwsjson11_deserializeDocumentTopicsDetectionJobProperties(&sv.TopicsDetectionJobProperties, value); err != nil { 15211 return err 15212 } 15213 15214 default: 15215 _, _ = key, value 15216 15217 } 15218 } 15219 *v = sv 15220 return nil 15221} 15222 15223func awsAwsjson11_deserializeOpDocumentDetectDominantLanguageOutput(v **DetectDominantLanguageOutput, value interface{}) error { 15224 if v == nil { 15225 return fmt.Errorf("unexpected nil of type %T", v) 15226 } 15227 if value == nil { 15228 return nil 15229 } 15230 15231 shape, ok := value.(map[string]interface{}) 15232 if !ok { 15233 return fmt.Errorf("unexpected JSON type %v", value) 15234 } 15235 15236 var sv *DetectDominantLanguageOutput 15237 if *v == nil { 15238 sv = &DetectDominantLanguageOutput{} 15239 } else { 15240 sv = *v 15241 } 15242 15243 for key, value := range shape { 15244 switch key { 15245 case "Languages": 15246 if err := awsAwsjson11_deserializeDocumentListOfDominantLanguages(&sv.Languages, value); err != nil { 15247 return err 15248 } 15249 15250 default: 15251 _, _ = key, value 15252 15253 } 15254 } 15255 *v = sv 15256 return nil 15257} 15258 15259func awsAwsjson11_deserializeOpDocumentDetectEntitiesOutput(v **DetectEntitiesOutput, value interface{}) error { 15260 if v == nil { 15261 return fmt.Errorf("unexpected nil of type %T", v) 15262 } 15263 if value == nil { 15264 return nil 15265 } 15266 15267 shape, ok := value.(map[string]interface{}) 15268 if !ok { 15269 return fmt.Errorf("unexpected JSON type %v", value) 15270 } 15271 15272 var sv *DetectEntitiesOutput 15273 if *v == nil { 15274 sv = &DetectEntitiesOutput{} 15275 } else { 15276 sv = *v 15277 } 15278 15279 for key, value := range shape { 15280 switch key { 15281 case "Entities": 15282 if err := awsAwsjson11_deserializeDocumentListOfEntities(&sv.Entities, value); err != nil { 15283 return err 15284 } 15285 15286 default: 15287 _, _ = key, value 15288 15289 } 15290 } 15291 *v = sv 15292 return nil 15293} 15294 15295func awsAwsjson11_deserializeOpDocumentDetectKeyPhrasesOutput(v **DetectKeyPhrasesOutput, value interface{}) error { 15296 if v == nil { 15297 return fmt.Errorf("unexpected nil of type %T", v) 15298 } 15299 if value == nil { 15300 return nil 15301 } 15302 15303 shape, ok := value.(map[string]interface{}) 15304 if !ok { 15305 return fmt.Errorf("unexpected JSON type %v", value) 15306 } 15307 15308 var sv *DetectKeyPhrasesOutput 15309 if *v == nil { 15310 sv = &DetectKeyPhrasesOutput{} 15311 } else { 15312 sv = *v 15313 } 15314 15315 for key, value := range shape { 15316 switch key { 15317 case "KeyPhrases": 15318 if err := awsAwsjson11_deserializeDocumentListOfKeyPhrases(&sv.KeyPhrases, value); err != nil { 15319 return err 15320 } 15321 15322 default: 15323 _, _ = key, value 15324 15325 } 15326 } 15327 *v = sv 15328 return nil 15329} 15330 15331func awsAwsjson11_deserializeOpDocumentDetectPiiEntitiesOutput(v **DetectPiiEntitiesOutput, value interface{}) error { 15332 if v == nil { 15333 return fmt.Errorf("unexpected nil of type %T", v) 15334 } 15335 if value == nil { 15336 return nil 15337 } 15338 15339 shape, ok := value.(map[string]interface{}) 15340 if !ok { 15341 return fmt.Errorf("unexpected JSON type %v", value) 15342 } 15343 15344 var sv *DetectPiiEntitiesOutput 15345 if *v == nil { 15346 sv = &DetectPiiEntitiesOutput{} 15347 } else { 15348 sv = *v 15349 } 15350 15351 for key, value := range shape { 15352 switch key { 15353 case "Entities": 15354 if err := awsAwsjson11_deserializeDocumentListOfPiiEntities(&sv.Entities, value); err != nil { 15355 return err 15356 } 15357 15358 default: 15359 _, _ = key, value 15360 15361 } 15362 } 15363 *v = sv 15364 return nil 15365} 15366 15367func awsAwsjson11_deserializeOpDocumentDetectSentimentOutput(v **DetectSentimentOutput, value interface{}) error { 15368 if v == nil { 15369 return fmt.Errorf("unexpected nil of type %T", v) 15370 } 15371 if value == nil { 15372 return nil 15373 } 15374 15375 shape, ok := value.(map[string]interface{}) 15376 if !ok { 15377 return fmt.Errorf("unexpected JSON type %v", value) 15378 } 15379 15380 var sv *DetectSentimentOutput 15381 if *v == nil { 15382 sv = &DetectSentimentOutput{} 15383 } else { 15384 sv = *v 15385 } 15386 15387 for key, value := range shape { 15388 switch key { 15389 case "Sentiment": 15390 if value != nil { 15391 jtv, ok := value.(string) 15392 if !ok { 15393 return fmt.Errorf("expected SentimentType to be of type string, got %T instead", value) 15394 } 15395 sv.Sentiment = types.SentimentType(jtv) 15396 } 15397 15398 case "SentimentScore": 15399 if err := awsAwsjson11_deserializeDocumentSentimentScore(&sv.SentimentScore, value); err != nil { 15400 return err 15401 } 15402 15403 default: 15404 _, _ = key, value 15405 15406 } 15407 } 15408 *v = sv 15409 return nil 15410} 15411 15412func awsAwsjson11_deserializeOpDocumentDetectSyntaxOutput(v **DetectSyntaxOutput, value interface{}) error { 15413 if v == nil { 15414 return fmt.Errorf("unexpected nil of type %T", v) 15415 } 15416 if value == nil { 15417 return nil 15418 } 15419 15420 shape, ok := value.(map[string]interface{}) 15421 if !ok { 15422 return fmt.Errorf("unexpected JSON type %v", value) 15423 } 15424 15425 var sv *DetectSyntaxOutput 15426 if *v == nil { 15427 sv = &DetectSyntaxOutput{} 15428 } else { 15429 sv = *v 15430 } 15431 15432 for key, value := range shape { 15433 switch key { 15434 case "SyntaxTokens": 15435 if err := awsAwsjson11_deserializeDocumentListOfSyntaxTokens(&sv.SyntaxTokens, value); err != nil { 15436 return err 15437 } 15438 15439 default: 15440 _, _ = key, value 15441 15442 } 15443 } 15444 *v = sv 15445 return nil 15446} 15447 15448func awsAwsjson11_deserializeOpDocumentListDocumentClassificationJobsOutput(v **ListDocumentClassificationJobsOutput, value interface{}) error { 15449 if v == nil { 15450 return fmt.Errorf("unexpected nil of type %T", v) 15451 } 15452 if value == nil { 15453 return nil 15454 } 15455 15456 shape, ok := value.(map[string]interface{}) 15457 if !ok { 15458 return fmt.Errorf("unexpected JSON type %v", value) 15459 } 15460 15461 var sv *ListDocumentClassificationJobsOutput 15462 if *v == nil { 15463 sv = &ListDocumentClassificationJobsOutput{} 15464 } else { 15465 sv = *v 15466 } 15467 15468 for key, value := range shape { 15469 switch key { 15470 case "DocumentClassificationJobPropertiesList": 15471 if err := awsAwsjson11_deserializeDocumentDocumentClassificationJobPropertiesList(&sv.DocumentClassificationJobPropertiesList, value); err != nil { 15472 return err 15473 } 15474 15475 case "NextToken": 15476 if value != nil { 15477 jtv, ok := value.(string) 15478 if !ok { 15479 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15480 } 15481 sv.NextToken = ptr.String(jtv) 15482 } 15483 15484 default: 15485 _, _ = key, value 15486 15487 } 15488 } 15489 *v = sv 15490 return nil 15491} 15492 15493func awsAwsjson11_deserializeOpDocumentListDocumentClassifiersOutput(v **ListDocumentClassifiersOutput, value interface{}) error { 15494 if v == nil { 15495 return fmt.Errorf("unexpected nil of type %T", v) 15496 } 15497 if value == nil { 15498 return nil 15499 } 15500 15501 shape, ok := value.(map[string]interface{}) 15502 if !ok { 15503 return fmt.Errorf("unexpected JSON type %v", value) 15504 } 15505 15506 var sv *ListDocumentClassifiersOutput 15507 if *v == nil { 15508 sv = &ListDocumentClassifiersOutput{} 15509 } else { 15510 sv = *v 15511 } 15512 15513 for key, value := range shape { 15514 switch key { 15515 case "DocumentClassifierPropertiesList": 15516 if err := awsAwsjson11_deserializeDocumentDocumentClassifierPropertiesList(&sv.DocumentClassifierPropertiesList, value); err != nil { 15517 return err 15518 } 15519 15520 case "NextToken": 15521 if value != nil { 15522 jtv, ok := value.(string) 15523 if !ok { 15524 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15525 } 15526 sv.NextToken = ptr.String(jtv) 15527 } 15528 15529 default: 15530 _, _ = key, value 15531 15532 } 15533 } 15534 *v = sv 15535 return nil 15536} 15537 15538func awsAwsjson11_deserializeOpDocumentListDominantLanguageDetectionJobsOutput(v **ListDominantLanguageDetectionJobsOutput, value interface{}) error { 15539 if v == nil { 15540 return fmt.Errorf("unexpected nil of type %T", v) 15541 } 15542 if value == nil { 15543 return nil 15544 } 15545 15546 shape, ok := value.(map[string]interface{}) 15547 if !ok { 15548 return fmt.Errorf("unexpected JSON type %v", value) 15549 } 15550 15551 var sv *ListDominantLanguageDetectionJobsOutput 15552 if *v == nil { 15553 sv = &ListDominantLanguageDetectionJobsOutput{} 15554 } else { 15555 sv = *v 15556 } 15557 15558 for key, value := range shape { 15559 switch key { 15560 case "DominantLanguageDetectionJobPropertiesList": 15561 if err := awsAwsjson11_deserializeDocumentDominantLanguageDetectionJobPropertiesList(&sv.DominantLanguageDetectionJobPropertiesList, value); err != nil { 15562 return err 15563 } 15564 15565 case "NextToken": 15566 if value != nil { 15567 jtv, ok := value.(string) 15568 if !ok { 15569 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15570 } 15571 sv.NextToken = ptr.String(jtv) 15572 } 15573 15574 default: 15575 _, _ = key, value 15576 15577 } 15578 } 15579 *v = sv 15580 return nil 15581} 15582 15583func awsAwsjson11_deserializeOpDocumentListEndpointsOutput(v **ListEndpointsOutput, value interface{}) error { 15584 if v == nil { 15585 return fmt.Errorf("unexpected nil of type %T", v) 15586 } 15587 if value == nil { 15588 return nil 15589 } 15590 15591 shape, ok := value.(map[string]interface{}) 15592 if !ok { 15593 return fmt.Errorf("unexpected JSON type %v", value) 15594 } 15595 15596 var sv *ListEndpointsOutput 15597 if *v == nil { 15598 sv = &ListEndpointsOutput{} 15599 } else { 15600 sv = *v 15601 } 15602 15603 for key, value := range shape { 15604 switch key { 15605 case "EndpointPropertiesList": 15606 if err := awsAwsjson11_deserializeDocumentEndpointPropertiesList(&sv.EndpointPropertiesList, value); err != nil { 15607 return err 15608 } 15609 15610 case "NextToken": 15611 if value != nil { 15612 jtv, ok := value.(string) 15613 if !ok { 15614 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15615 } 15616 sv.NextToken = ptr.String(jtv) 15617 } 15618 15619 default: 15620 _, _ = key, value 15621 15622 } 15623 } 15624 *v = sv 15625 return nil 15626} 15627 15628func awsAwsjson11_deserializeOpDocumentListEntitiesDetectionJobsOutput(v **ListEntitiesDetectionJobsOutput, value interface{}) error { 15629 if v == nil { 15630 return fmt.Errorf("unexpected nil of type %T", v) 15631 } 15632 if value == nil { 15633 return nil 15634 } 15635 15636 shape, ok := value.(map[string]interface{}) 15637 if !ok { 15638 return fmt.Errorf("unexpected JSON type %v", value) 15639 } 15640 15641 var sv *ListEntitiesDetectionJobsOutput 15642 if *v == nil { 15643 sv = &ListEntitiesDetectionJobsOutput{} 15644 } else { 15645 sv = *v 15646 } 15647 15648 for key, value := range shape { 15649 switch key { 15650 case "EntitiesDetectionJobPropertiesList": 15651 if err := awsAwsjson11_deserializeDocumentEntitiesDetectionJobPropertiesList(&sv.EntitiesDetectionJobPropertiesList, value); err != nil { 15652 return err 15653 } 15654 15655 case "NextToken": 15656 if value != nil { 15657 jtv, ok := value.(string) 15658 if !ok { 15659 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15660 } 15661 sv.NextToken = ptr.String(jtv) 15662 } 15663 15664 default: 15665 _, _ = key, value 15666 15667 } 15668 } 15669 *v = sv 15670 return nil 15671} 15672 15673func awsAwsjson11_deserializeOpDocumentListEntityRecognizersOutput(v **ListEntityRecognizersOutput, value interface{}) error { 15674 if v == nil { 15675 return fmt.Errorf("unexpected nil of type %T", v) 15676 } 15677 if value == nil { 15678 return nil 15679 } 15680 15681 shape, ok := value.(map[string]interface{}) 15682 if !ok { 15683 return fmt.Errorf("unexpected JSON type %v", value) 15684 } 15685 15686 var sv *ListEntityRecognizersOutput 15687 if *v == nil { 15688 sv = &ListEntityRecognizersOutput{} 15689 } else { 15690 sv = *v 15691 } 15692 15693 for key, value := range shape { 15694 switch key { 15695 case "EntityRecognizerPropertiesList": 15696 if err := awsAwsjson11_deserializeDocumentEntityRecognizerPropertiesList(&sv.EntityRecognizerPropertiesList, value); err != nil { 15697 return err 15698 } 15699 15700 case "NextToken": 15701 if value != nil { 15702 jtv, ok := value.(string) 15703 if !ok { 15704 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15705 } 15706 sv.NextToken = ptr.String(jtv) 15707 } 15708 15709 default: 15710 _, _ = key, value 15711 15712 } 15713 } 15714 *v = sv 15715 return nil 15716} 15717 15718func awsAwsjson11_deserializeOpDocumentListEventsDetectionJobsOutput(v **ListEventsDetectionJobsOutput, value interface{}) error { 15719 if v == nil { 15720 return fmt.Errorf("unexpected nil of type %T", v) 15721 } 15722 if value == nil { 15723 return nil 15724 } 15725 15726 shape, ok := value.(map[string]interface{}) 15727 if !ok { 15728 return fmt.Errorf("unexpected JSON type %v", value) 15729 } 15730 15731 var sv *ListEventsDetectionJobsOutput 15732 if *v == nil { 15733 sv = &ListEventsDetectionJobsOutput{} 15734 } else { 15735 sv = *v 15736 } 15737 15738 for key, value := range shape { 15739 switch key { 15740 case "EventsDetectionJobPropertiesList": 15741 if err := awsAwsjson11_deserializeDocumentEventsDetectionJobPropertiesList(&sv.EventsDetectionJobPropertiesList, value); err != nil { 15742 return err 15743 } 15744 15745 case "NextToken": 15746 if value != nil { 15747 jtv, ok := value.(string) 15748 if !ok { 15749 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15750 } 15751 sv.NextToken = ptr.String(jtv) 15752 } 15753 15754 default: 15755 _, _ = key, value 15756 15757 } 15758 } 15759 *v = sv 15760 return nil 15761} 15762 15763func awsAwsjson11_deserializeOpDocumentListKeyPhrasesDetectionJobsOutput(v **ListKeyPhrasesDetectionJobsOutput, value interface{}) error { 15764 if v == nil { 15765 return fmt.Errorf("unexpected nil of type %T", v) 15766 } 15767 if value == nil { 15768 return nil 15769 } 15770 15771 shape, ok := value.(map[string]interface{}) 15772 if !ok { 15773 return fmt.Errorf("unexpected JSON type %v", value) 15774 } 15775 15776 var sv *ListKeyPhrasesDetectionJobsOutput 15777 if *v == nil { 15778 sv = &ListKeyPhrasesDetectionJobsOutput{} 15779 } else { 15780 sv = *v 15781 } 15782 15783 for key, value := range shape { 15784 switch key { 15785 case "KeyPhrasesDetectionJobPropertiesList": 15786 if err := awsAwsjson11_deserializeDocumentKeyPhrasesDetectionJobPropertiesList(&sv.KeyPhrasesDetectionJobPropertiesList, value); err != nil { 15787 return err 15788 } 15789 15790 case "NextToken": 15791 if value != nil { 15792 jtv, ok := value.(string) 15793 if !ok { 15794 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15795 } 15796 sv.NextToken = ptr.String(jtv) 15797 } 15798 15799 default: 15800 _, _ = key, value 15801 15802 } 15803 } 15804 *v = sv 15805 return nil 15806} 15807 15808func awsAwsjson11_deserializeOpDocumentListPiiEntitiesDetectionJobsOutput(v **ListPiiEntitiesDetectionJobsOutput, value interface{}) error { 15809 if v == nil { 15810 return fmt.Errorf("unexpected nil of type %T", v) 15811 } 15812 if value == nil { 15813 return nil 15814 } 15815 15816 shape, ok := value.(map[string]interface{}) 15817 if !ok { 15818 return fmt.Errorf("unexpected JSON type %v", value) 15819 } 15820 15821 var sv *ListPiiEntitiesDetectionJobsOutput 15822 if *v == nil { 15823 sv = &ListPiiEntitiesDetectionJobsOutput{} 15824 } else { 15825 sv = *v 15826 } 15827 15828 for key, value := range shape { 15829 switch key { 15830 case "NextToken": 15831 if value != nil { 15832 jtv, ok := value.(string) 15833 if !ok { 15834 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15835 } 15836 sv.NextToken = ptr.String(jtv) 15837 } 15838 15839 case "PiiEntitiesDetectionJobPropertiesList": 15840 if err := awsAwsjson11_deserializeDocumentPiiEntitiesDetectionJobPropertiesList(&sv.PiiEntitiesDetectionJobPropertiesList, value); err != nil { 15841 return err 15842 } 15843 15844 default: 15845 _, _ = key, value 15846 15847 } 15848 } 15849 *v = sv 15850 return nil 15851} 15852 15853func awsAwsjson11_deserializeOpDocumentListSentimentDetectionJobsOutput(v **ListSentimentDetectionJobsOutput, value interface{}) error { 15854 if v == nil { 15855 return fmt.Errorf("unexpected nil of type %T", v) 15856 } 15857 if value == nil { 15858 return nil 15859 } 15860 15861 shape, ok := value.(map[string]interface{}) 15862 if !ok { 15863 return fmt.Errorf("unexpected JSON type %v", value) 15864 } 15865 15866 var sv *ListSentimentDetectionJobsOutput 15867 if *v == nil { 15868 sv = &ListSentimentDetectionJobsOutput{} 15869 } else { 15870 sv = *v 15871 } 15872 15873 for key, value := range shape { 15874 switch key { 15875 case "NextToken": 15876 if value != nil { 15877 jtv, ok := value.(string) 15878 if !ok { 15879 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15880 } 15881 sv.NextToken = ptr.String(jtv) 15882 } 15883 15884 case "SentimentDetectionJobPropertiesList": 15885 if err := awsAwsjson11_deserializeDocumentSentimentDetectionJobPropertiesList(&sv.SentimentDetectionJobPropertiesList, value); err != nil { 15886 return err 15887 } 15888 15889 default: 15890 _, _ = key, value 15891 15892 } 15893 } 15894 *v = sv 15895 return nil 15896} 15897 15898func awsAwsjson11_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 15899 if v == nil { 15900 return fmt.Errorf("unexpected nil of type %T", v) 15901 } 15902 if value == nil { 15903 return nil 15904 } 15905 15906 shape, ok := value.(map[string]interface{}) 15907 if !ok { 15908 return fmt.Errorf("unexpected JSON type %v", value) 15909 } 15910 15911 var sv *ListTagsForResourceOutput 15912 if *v == nil { 15913 sv = &ListTagsForResourceOutput{} 15914 } else { 15915 sv = *v 15916 } 15917 15918 for key, value := range shape { 15919 switch key { 15920 case "ResourceArn": 15921 if value != nil { 15922 jtv, ok := value.(string) 15923 if !ok { 15924 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 15925 } 15926 sv.ResourceArn = ptr.String(jtv) 15927 } 15928 15929 case "Tags": 15930 if err := awsAwsjson11_deserializeDocumentTagList(&sv.Tags, value); err != nil { 15931 return err 15932 } 15933 15934 default: 15935 _, _ = key, value 15936 15937 } 15938 } 15939 *v = sv 15940 return nil 15941} 15942 15943func awsAwsjson11_deserializeOpDocumentListTopicsDetectionJobsOutput(v **ListTopicsDetectionJobsOutput, value interface{}) error { 15944 if v == nil { 15945 return fmt.Errorf("unexpected nil of type %T", v) 15946 } 15947 if value == nil { 15948 return nil 15949 } 15950 15951 shape, ok := value.(map[string]interface{}) 15952 if !ok { 15953 return fmt.Errorf("unexpected JSON type %v", value) 15954 } 15955 15956 var sv *ListTopicsDetectionJobsOutput 15957 if *v == nil { 15958 sv = &ListTopicsDetectionJobsOutput{} 15959 } else { 15960 sv = *v 15961 } 15962 15963 for key, value := range shape { 15964 switch key { 15965 case "NextToken": 15966 if value != nil { 15967 jtv, ok := value.(string) 15968 if !ok { 15969 return fmt.Errorf("expected String to be of type string, got %T instead", value) 15970 } 15971 sv.NextToken = ptr.String(jtv) 15972 } 15973 15974 case "TopicsDetectionJobPropertiesList": 15975 if err := awsAwsjson11_deserializeDocumentTopicsDetectionJobPropertiesList(&sv.TopicsDetectionJobPropertiesList, value); err != nil { 15976 return err 15977 } 15978 15979 default: 15980 _, _ = key, value 15981 15982 } 15983 } 15984 *v = sv 15985 return nil 15986} 15987 15988func awsAwsjson11_deserializeOpDocumentStartDocumentClassificationJobOutput(v **StartDocumentClassificationJobOutput, value interface{}) error { 15989 if v == nil { 15990 return fmt.Errorf("unexpected nil of type %T", v) 15991 } 15992 if value == nil { 15993 return nil 15994 } 15995 15996 shape, ok := value.(map[string]interface{}) 15997 if !ok { 15998 return fmt.Errorf("unexpected JSON type %v", value) 15999 } 16000 16001 var sv *StartDocumentClassificationJobOutput 16002 if *v == nil { 16003 sv = &StartDocumentClassificationJobOutput{} 16004 } else { 16005 sv = *v 16006 } 16007 16008 for key, value := range shape { 16009 switch key { 16010 case "JobArn": 16011 if value != nil { 16012 jtv, ok := value.(string) 16013 if !ok { 16014 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 16015 } 16016 sv.JobArn = ptr.String(jtv) 16017 } 16018 16019 case "JobId": 16020 if value != nil { 16021 jtv, ok := value.(string) 16022 if !ok { 16023 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16024 } 16025 sv.JobId = ptr.String(jtv) 16026 } 16027 16028 case "JobStatus": 16029 if value != nil { 16030 jtv, ok := value.(string) 16031 if !ok { 16032 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16033 } 16034 sv.JobStatus = types.JobStatus(jtv) 16035 } 16036 16037 default: 16038 _, _ = key, value 16039 16040 } 16041 } 16042 *v = sv 16043 return nil 16044} 16045 16046func awsAwsjson11_deserializeOpDocumentStartDominantLanguageDetectionJobOutput(v **StartDominantLanguageDetectionJobOutput, value interface{}) error { 16047 if v == nil { 16048 return fmt.Errorf("unexpected nil of type %T", v) 16049 } 16050 if value == nil { 16051 return nil 16052 } 16053 16054 shape, ok := value.(map[string]interface{}) 16055 if !ok { 16056 return fmt.Errorf("unexpected JSON type %v", value) 16057 } 16058 16059 var sv *StartDominantLanguageDetectionJobOutput 16060 if *v == nil { 16061 sv = &StartDominantLanguageDetectionJobOutput{} 16062 } else { 16063 sv = *v 16064 } 16065 16066 for key, value := range shape { 16067 switch key { 16068 case "JobArn": 16069 if value != nil { 16070 jtv, ok := value.(string) 16071 if !ok { 16072 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 16073 } 16074 sv.JobArn = ptr.String(jtv) 16075 } 16076 16077 case "JobId": 16078 if value != nil { 16079 jtv, ok := value.(string) 16080 if !ok { 16081 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16082 } 16083 sv.JobId = ptr.String(jtv) 16084 } 16085 16086 case "JobStatus": 16087 if value != nil { 16088 jtv, ok := value.(string) 16089 if !ok { 16090 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16091 } 16092 sv.JobStatus = types.JobStatus(jtv) 16093 } 16094 16095 default: 16096 _, _ = key, value 16097 16098 } 16099 } 16100 *v = sv 16101 return nil 16102} 16103 16104func awsAwsjson11_deserializeOpDocumentStartEntitiesDetectionJobOutput(v **StartEntitiesDetectionJobOutput, value interface{}) error { 16105 if v == nil { 16106 return fmt.Errorf("unexpected nil of type %T", v) 16107 } 16108 if value == nil { 16109 return nil 16110 } 16111 16112 shape, ok := value.(map[string]interface{}) 16113 if !ok { 16114 return fmt.Errorf("unexpected JSON type %v", value) 16115 } 16116 16117 var sv *StartEntitiesDetectionJobOutput 16118 if *v == nil { 16119 sv = &StartEntitiesDetectionJobOutput{} 16120 } else { 16121 sv = *v 16122 } 16123 16124 for key, value := range shape { 16125 switch key { 16126 case "JobArn": 16127 if value != nil { 16128 jtv, ok := value.(string) 16129 if !ok { 16130 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 16131 } 16132 sv.JobArn = ptr.String(jtv) 16133 } 16134 16135 case "JobId": 16136 if value != nil { 16137 jtv, ok := value.(string) 16138 if !ok { 16139 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16140 } 16141 sv.JobId = ptr.String(jtv) 16142 } 16143 16144 case "JobStatus": 16145 if value != nil { 16146 jtv, ok := value.(string) 16147 if !ok { 16148 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16149 } 16150 sv.JobStatus = types.JobStatus(jtv) 16151 } 16152 16153 default: 16154 _, _ = key, value 16155 16156 } 16157 } 16158 *v = sv 16159 return nil 16160} 16161 16162func awsAwsjson11_deserializeOpDocumentStartEventsDetectionJobOutput(v **StartEventsDetectionJobOutput, value interface{}) error { 16163 if v == nil { 16164 return fmt.Errorf("unexpected nil of type %T", v) 16165 } 16166 if value == nil { 16167 return nil 16168 } 16169 16170 shape, ok := value.(map[string]interface{}) 16171 if !ok { 16172 return fmt.Errorf("unexpected JSON type %v", value) 16173 } 16174 16175 var sv *StartEventsDetectionJobOutput 16176 if *v == nil { 16177 sv = &StartEventsDetectionJobOutput{} 16178 } else { 16179 sv = *v 16180 } 16181 16182 for key, value := range shape { 16183 switch key { 16184 case "JobArn": 16185 if value != nil { 16186 jtv, ok := value.(string) 16187 if !ok { 16188 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 16189 } 16190 sv.JobArn = ptr.String(jtv) 16191 } 16192 16193 case "JobId": 16194 if value != nil { 16195 jtv, ok := value.(string) 16196 if !ok { 16197 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16198 } 16199 sv.JobId = ptr.String(jtv) 16200 } 16201 16202 case "JobStatus": 16203 if value != nil { 16204 jtv, ok := value.(string) 16205 if !ok { 16206 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16207 } 16208 sv.JobStatus = types.JobStatus(jtv) 16209 } 16210 16211 default: 16212 _, _ = key, value 16213 16214 } 16215 } 16216 *v = sv 16217 return nil 16218} 16219 16220func awsAwsjson11_deserializeOpDocumentStartKeyPhrasesDetectionJobOutput(v **StartKeyPhrasesDetectionJobOutput, value interface{}) error { 16221 if v == nil { 16222 return fmt.Errorf("unexpected nil of type %T", v) 16223 } 16224 if value == nil { 16225 return nil 16226 } 16227 16228 shape, ok := value.(map[string]interface{}) 16229 if !ok { 16230 return fmt.Errorf("unexpected JSON type %v", value) 16231 } 16232 16233 var sv *StartKeyPhrasesDetectionJobOutput 16234 if *v == nil { 16235 sv = &StartKeyPhrasesDetectionJobOutput{} 16236 } else { 16237 sv = *v 16238 } 16239 16240 for key, value := range shape { 16241 switch key { 16242 case "JobArn": 16243 if value != nil { 16244 jtv, ok := value.(string) 16245 if !ok { 16246 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 16247 } 16248 sv.JobArn = ptr.String(jtv) 16249 } 16250 16251 case "JobId": 16252 if value != nil { 16253 jtv, ok := value.(string) 16254 if !ok { 16255 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16256 } 16257 sv.JobId = ptr.String(jtv) 16258 } 16259 16260 case "JobStatus": 16261 if value != nil { 16262 jtv, ok := value.(string) 16263 if !ok { 16264 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16265 } 16266 sv.JobStatus = types.JobStatus(jtv) 16267 } 16268 16269 default: 16270 _, _ = key, value 16271 16272 } 16273 } 16274 *v = sv 16275 return nil 16276} 16277 16278func awsAwsjson11_deserializeOpDocumentStartPiiEntitiesDetectionJobOutput(v **StartPiiEntitiesDetectionJobOutput, value interface{}) error { 16279 if v == nil { 16280 return fmt.Errorf("unexpected nil of type %T", v) 16281 } 16282 if value == nil { 16283 return nil 16284 } 16285 16286 shape, ok := value.(map[string]interface{}) 16287 if !ok { 16288 return fmt.Errorf("unexpected JSON type %v", value) 16289 } 16290 16291 var sv *StartPiiEntitiesDetectionJobOutput 16292 if *v == nil { 16293 sv = &StartPiiEntitiesDetectionJobOutput{} 16294 } else { 16295 sv = *v 16296 } 16297 16298 for key, value := range shape { 16299 switch key { 16300 case "JobArn": 16301 if value != nil { 16302 jtv, ok := value.(string) 16303 if !ok { 16304 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 16305 } 16306 sv.JobArn = ptr.String(jtv) 16307 } 16308 16309 case "JobId": 16310 if value != nil { 16311 jtv, ok := value.(string) 16312 if !ok { 16313 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16314 } 16315 sv.JobId = ptr.String(jtv) 16316 } 16317 16318 case "JobStatus": 16319 if value != nil { 16320 jtv, ok := value.(string) 16321 if !ok { 16322 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16323 } 16324 sv.JobStatus = types.JobStatus(jtv) 16325 } 16326 16327 default: 16328 _, _ = key, value 16329 16330 } 16331 } 16332 *v = sv 16333 return nil 16334} 16335 16336func awsAwsjson11_deserializeOpDocumentStartSentimentDetectionJobOutput(v **StartSentimentDetectionJobOutput, value interface{}) error { 16337 if v == nil { 16338 return fmt.Errorf("unexpected nil of type %T", v) 16339 } 16340 if value == nil { 16341 return nil 16342 } 16343 16344 shape, ok := value.(map[string]interface{}) 16345 if !ok { 16346 return fmt.Errorf("unexpected JSON type %v", value) 16347 } 16348 16349 var sv *StartSentimentDetectionJobOutput 16350 if *v == nil { 16351 sv = &StartSentimentDetectionJobOutput{} 16352 } else { 16353 sv = *v 16354 } 16355 16356 for key, value := range shape { 16357 switch key { 16358 case "JobArn": 16359 if value != nil { 16360 jtv, ok := value.(string) 16361 if !ok { 16362 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 16363 } 16364 sv.JobArn = ptr.String(jtv) 16365 } 16366 16367 case "JobId": 16368 if value != nil { 16369 jtv, ok := value.(string) 16370 if !ok { 16371 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16372 } 16373 sv.JobId = ptr.String(jtv) 16374 } 16375 16376 case "JobStatus": 16377 if value != nil { 16378 jtv, ok := value.(string) 16379 if !ok { 16380 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16381 } 16382 sv.JobStatus = types.JobStatus(jtv) 16383 } 16384 16385 default: 16386 _, _ = key, value 16387 16388 } 16389 } 16390 *v = sv 16391 return nil 16392} 16393 16394func awsAwsjson11_deserializeOpDocumentStartTopicsDetectionJobOutput(v **StartTopicsDetectionJobOutput, value interface{}) error { 16395 if v == nil { 16396 return fmt.Errorf("unexpected nil of type %T", v) 16397 } 16398 if value == nil { 16399 return nil 16400 } 16401 16402 shape, ok := value.(map[string]interface{}) 16403 if !ok { 16404 return fmt.Errorf("unexpected JSON type %v", value) 16405 } 16406 16407 var sv *StartTopicsDetectionJobOutput 16408 if *v == nil { 16409 sv = &StartTopicsDetectionJobOutput{} 16410 } else { 16411 sv = *v 16412 } 16413 16414 for key, value := range shape { 16415 switch key { 16416 case "JobArn": 16417 if value != nil { 16418 jtv, ok := value.(string) 16419 if !ok { 16420 return fmt.Errorf("expected ComprehendArn to be of type string, got %T instead", value) 16421 } 16422 sv.JobArn = ptr.String(jtv) 16423 } 16424 16425 case "JobId": 16426 if value != nil { 16427 jtv, ok := value.(string) 16428 if !ok { 16429 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16430 } 16431 sv.JobId = ptr.String(jtv) 16432 } 16433 16434 case "JobStatus": 16435 if value != nil { 16436 jtv, ok := value.(string) 16437 if !ok { 16438 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16439 } 16440 sv.JobStatus = types.JobStatus(jtv) 16441 } 16442 16443 default: 16444 _, _ = key, value 16445 16446 } 16447 } 16448 *v = sv 16449 return nil 16450} 16451 16452func awsAwsjson11_deserializeOpDocumentStopDominantLanguageDetectionJobOutput(v **StopDominantLanguageDetectionJobOutput, value interface{}) error { 16453 if v == nil { 16454 return fmt.Errorf("unexpected nil of type %T", v) 16455 } 16456 if value == nil { 16457 return nil 16458 } 16459 16460 shape, ok := value.(map[string]interface{}) 16461 if !ok { 16462 return fmt.Errorf("unexpected JSON type %v", value) 16463 } 16464 16465 var sv *StopDominantLanguageDetectionJobOutput 16466 if *v == nil { 16467 sv = &StopDominantLanguageDetectionJobOutput{} 16468 } else { 16469 sv = *v 16470 } 16471 16472 for key, value := range shape { 16473 switch key { 16474 case "JobId": 16475 if value != nil { 16476 jtv, ok := value.(string) 16477 if !ok { 16478 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16479 } 16480 sv.JobId = ptr.String(jtv) 16481 } 16482 16483 case "JobStatus": 16484 if value != nil { 16485 jtv, ok := value.(string) 16486 if !ok { 16487 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16488 } 16489 sv.JobStatus = types.JobStatus(jtv) 16490 } 16491 16492 default: 16493 _, _ = key, value 16494 16495 } 16496 } 16497 *v = sv 16498 return nil 16499} 16500 16501func awsAwsjson11_deserializeOpDocumentStopEntitiesDetectionJobOutput(v **StopEntitiesDetectionJobOutput, value interface{}) error { 16502 if v == nil { 16503 return fmt.Errorf("unexpected nil of type %T", v) 16504 } 16505 if value == nil { 16506 return nil 16507 } 16508 16509 shape, ok := value.(map[string]interface{}) 16510 if !ok { 16511 return fmt.Errorf("unexpected JSON type %v", value) 16512 } 16513 16514 var sv *StopEntitiesDetectionJobOutput 16515 if *v == nil { 16516 sv = &StopEntitiesDetectionJobOutput{} 16517 } else { 16518 sv = *v 16519 } 16520 16521 for key, value := range shape { 16522 switch key { 16523 case "JobId": 16524 if value != nil { 16525 jtv, ok := value.(string) 16526 if !ok { 16527 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16528 } 16529 sv.JobId = ptr.String(jtv) 16530 } 16531 16532 case "JobStatus": 16533 if value != nil { 16534 jtv, ok := value.(string) 16535 if !ok { 16536 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16537 } 16538 sv.JobStatus = types.JobStatus(jtv) 16539 } 16540 16541 default: 16542 _, _ = key, value 16543 16544 } 16545 } 16546 *v = sv 16547 return nil 16548} 16549 16550func awsAwsjson11_deserializeOpDocumentStopEventsDetectionJobOutput(v **StopEventsDetectionJobOutput, value interface{}) error { 16551 if v == nil { 16552 return fmt.Errorf("unexpected nil of type %T", v) 16553 } 16554 if value == nil { 16555 return nil 16556 } 16557 16558 shape, ok := value.(map[string]interface{}) 16559 if !ok { 16560 return fmt.Errorf("unexpected JSON type %v", value) 16561 } 16562 16563 var sv *StopEventsDetectionJobOutput 16564 if *v == nil { 16565 sv = &StopEventsDetectionJobOutput{} 16566 } else { 16567 sv = *v 16568 } 16569 16570 for key, value := range shape { 16571 switch key { 16572 case "JobId": 16573 if value != nil { 16574 jtv, ok := value.(string) 16575 if !ok { 16576 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16577 } 16578 sv.JobId = ptr.String(jtv) 16579 } 16580 16581 case "JobStatus": 16582 if value != nil { 16583 jtv, ok := value.(string) 16584 if !ok { 16585 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16586 } 16587 sv.JobStatus = types.JobStatus(jtv) 16588 } 16589 16590 default: 16591 _, _ = key, value 16592 16593 } 16594 } 16595 *v = sv 16596 return nil 16597} 16598 16599func awsAwsjson11_deserializeOpDocumentStopKeyPhrasesDetectionJobOutput(v **StopKeyPhrasesDetectionJobOutput, value interface{}) error { 16600 if v == nil { 16601 return fmt.Errorf("unexpected nil of type %T", v) 16602 } 16603 if value == nil { 16604 return nil 16605 } 16606 16607 shape, ok := value.(map[string]interface{}) 16608 if !ok { 16609 return fmt.Errorf("unexpected JSON type %v", value) 16610 } 16611 16612 var sv *StopKeyPhrasesDetectionJobOutput 16613 if *v == nil { 16614 sv = &StopKeyPhrasesDetectionJobOutput{} 16615 } else { 16616 sv = *v 16617 } 16618 16619 for key, value := range shape { 16620 switch key { 16621 case "JobId": 16622 if value != nil { 16623 jtv, ok := value.(string) 16624 if !ok { 16625 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16626 } 16627 sv.JobId = ptr.String(jtv) 16628 } 16629 16630 case "JobStatus": 16631 if value != nil { 16632 jtv, ok := value.(string) 16633 if !ok { 16634 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16635 } 16636 sv.JobStatus = types.JobStatus(jtv) 16637 } 16638 16639 default: 16640 _, _ = key, value 16641 16642 } 16643 } 16644 *v = sv 16645 return nil 16646} 16647 16648func awsAwsjson11_deserializeOpDocumentStopPiiEntitiesDetectionJobOutput(v **StopPiiEntitiesDetectionJobOutput, value interface{}) error { 16649 if v == nil { 16650 return fmt.Errorf("unexpected nil of type %T", v) 16651 } 16652 if value == nil { 16653 return nil 16654 } 16655 16656 shape, ok := value.(map[string]interface{}) 16657 if !ok { 16658 return fmt.Errorf("unexpected JSON type %v", value) 16659 } 16660 16661 var sv *StopPiiEntitiesDetectionJobOutput 16662 if *v == nil { 16663 sv = &StopPiiEntitiesDetectionJobOutput{} 16664 } else { 16665 sv = *v 16666 } 16667 16668 for key, value := range shape { 16669 switch key { 16670 case "JobId": 16671 if value != nil { 16672 jtv, ok := value.(string) 16673 if !ok { 16674 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16675 } 16676 sv.JobId = ptr.String(jtv) 16677 } 16678 16679 case "JobStatus": 16680 if value != nil { 16681 jtv, ok := value.(string) 16682 if !ok { 16683 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16684 } 16685 sv.JobStatus = types.JobStatus(jtv) 16686 } 16687 16688 default: 16689 _, _ = key, value 16690 16691 } 16692 } 16693 *v = sv 16694 return nil 16695} 16696 16697func awsAwsjson11_deserializeOpDocumentStopSentimentDetectionJobOutput(v **StopSentimentDetectionJobOutput, value interface{}) error { 16698 if v == nil { 16699 return fmt.Errorf("unexpected nil of type %T", v) 16700 } 16701 if value == nil { 16702 return nil 16703 } 16704 16705 shape, ok := value.(map[string]interface{}) 16706 if !ok { 16707 return fmt.Errorf("unexpected JSON type %v", value) 16708 } 16709 16710 var sv *StopSentimentDetectionJobOutput 16711 if *v == nil { 16712 sv = &StopSentimentDetectionJobOutput{} 16713 } else { 16714 sv = *v 16715 } 16716 16717 for key, value := range shape { 16718 switch key { 16719 case "JobId": 16720 if value != nil { 16721 jtv, ok := value.(string) 16722 if !ok { 16723 return fmt.Errorf("expected JobId to be of type string, got %T instead", value) 16724 } 16725 sv.JobId = ptr.String(jtv) 16726 } 16727 16728 case "JobStatus": 16729 if value != nil { 16730 jtv, ok := value.(string) 16731 if !ok { 16732 return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) 16733 } 16734 sv.JobStatus = types.JobStatus(jtv) 16735 } 16736 16737 default: 16738 _, _ = key, value 16739 16740 } 16741 } 16742 *v = sv 16743 return nil 16744} 16745 16746func awsAwsjson11_deserializeOpDocumentStopTrainingDocumentClassifierOutput(v **StopTrainingDocumentClassifierOutput, value interface{}) error { 16747 if v == nil { 16748 return fmt.Errorf("unexpected nil of type %T", v) 16749 } 16750 if value == nil { 16751 return nil 16752 } 16753 16754 shape, ok := value.(map[string]interface{}) 16755 if !ok { 16756 return fmt.Errorf("unexpected JSON type %v", value) 16757 } 16758 16759 var sv *StopTrainingDocumentClassifierOutput 16760 if *v == nil { 16761 sv = &StopTrainingDocumentClassifierOutput{} 16762 } else { 16763 sv = *v 16764 } 16765 16766 for key, value := range shape { 16767 switch key { 16768 default: 16769 _, _ = key, value 16770 16771 } 16772 } 16773 *v = sv 16774 return nil 16775} 16776 16777func awsAwsjson11_deserializeOpDocumentStopTrainingEntityRecognizerOutput(v **StopTrainingEntityRecognizerOutput, value interface{}) error { 16778 if v == nil { 16779 return fmt.Errorf("unexpected nil of type %T", v) 16780 } 16781 if value == nil { 16782 return nil 16783 } 16784 16785 shape, ok := value.(map[string]interface{}) 16786 if !ok { 16787 return fmt.Errorf("unexpected JSON type %v", value) 16788 } 16789 16790 var sv *StopTrainingEntityRecognizerOutput 16791 if *v == nil { 16792 sv = &StopTrainingEntityRecognizerOutput{} 16793 } else { 16794 sv = *v 16795 } 16796 16797 for key, value := range shape { 16798 switch key { 16799 default: 16800 _, _ = key, value 16801 16802 } 16803 } 16804 *v = sv 16805 return nil 16806} 16807 16808func awsAwsjson11_deserializeOpDocumentTagResourceOutput(v **TagResourceOutput, value interface{}) error { 16809 if v == nil { 16810 return fmt.Errorf("unexpected nil of type %T", v) 16811 } 16812 if value == nil { 16813 return nil 16814 } 16815 16816 shape, ok := value.(map[string]interface{}) 16817 if !ok { 16818 return fmt.Errorf("unexpected JSON type %v", value) 16819 } 16820 16821 var sv *TagResourceOutput 16822 if *v == nil { 16823 sv = &TagResourceOutput{} 16824 } else { 16825 sv = *v 16826 } 16827 16828 for key, value := range shape { 16829 switch key { 16830 default: 16831 _, _ = key, value 16832 16833 } 16834 } 16835 *v = sv 16836 return nil 16837} 16838 16839func awsAwsjson11_deserializeOpDocumentUntagResourceOutput(v **UntagResourceOutput, value interface{}) error { 16840 if v == nil { 16841 return fmt.Errorf("unexpected nil of type %T", v) 16842 } 16843 if value == nil { 16844 return nil 16845 } 16846 16847 shape, ok := value.(map[string]interface{}) 16848 if !ok { 16849 return fmt.Errorf("unexpected JSON type %v", value) 16850 } 16851 16852 var sv *UntagResourceOutput 16853 if *v == nil { 16854 sv = &UntagResourceOutput{} 16855 } else { 16856 sv = *v 16857 } 16858 16859 for key, value := range shape { 16860 switch key { 16861 default: 16862 _, _ = key, value 16863 16864 } 16865 } 16866 *v = sv 16867 return nil 16868} 16869 16870func awsAwsjson11_deserializeOpDocumentUpdateEndpointOutput(v **UpdateEndpointOutput, value interface{}) error { 16871 if v == nil { 16872 return fmt.Errorf("unexpected nil of type %T", v) 16873 } 16874 if value == nil { 16875 return nil 16876 } 16877 16878 shape, ok := value.(map[string]interface{}) 16879 if !ok { 16880 return fmt.Errorf("unexpected JSON type %v", value) 16881 } 16882 16883 var sv *UpdateEndpointOutput 16884 if *v == nil { 16885 sv = &UpdateEndpointOutput{} 16886 } else { 16887 sv = *v 16888 } 16889 16890 for key, value := range shape { 16891 switch key { 16892 default: 16893 _, _ = key, value 16894 16895 } 16896 } 16897 *v = sv 16898 return nil 16899} 16900