1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package lexmodelsv2 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/lexmodelsv2/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithytime "github.com/aws/smithy-go/time" 17 smithyhttp "github.com/aws/smithy-go/transport/http" 18 "io" 19 "io/ioutil" 20 "math" 21 "strconv" 22 "strings" 23) 24 25type awsRestjson1_deserializeOpBuildBotLocale struct { 26} 27 28func (*awsRestjson1_deserializeOpBuildBotLocale) ID() string { 29 return "OperationDeserializer" 30} 31 32func (m *awsRestjson1_deserializeOpBuildBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 33 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 34) { 35 out, metadata, err = next.HandleDeserialize(ctx, in) 36 if err != nil { 37 return out, metadata, err 38 } 39 40 response, ok := out.RawResponse.(*smithyhttp.Response) 41 if !ok { 42 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 43 } 44 45 if response.StatusCode < 200 || response.StatusCode >= 300 { 46 return out, metadata, awsRestjson1_deserializeOpErrorBuildBotLocale(response, &metadata) 47 } 48 output := &BuildBotLocaleOutput{} 49 out.Result = output 50 51 var buff [1024]byte 52 ringBuffer := smithyio.NewRingBuffer(buff[:]) 53 54 body := io.TeeReader(response.Body, ringBuffer) 55 56 decoder := json.NewDecoder(body) 57 decoder.UseNumber() 58 var shape interface{} 59 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 60 var snapshot bytes.Buffer 61 io.Copy(&snapshot, ringBuffer) 62 err = &smithy.DeserializationError{ 63 Err: fmt.Errorf("failed to decode response body, %w", err), 64 Snapshot: snapshot.Bytes(), 65 } 66 return out, metadata, err 67 } 68 69 err = awsRestjson1_deserializeOpDocumentBuildBotLocaleOutput(&output, shape) 70 if err != nil { 71 var snapshot bytes.Buffer 72 io.Copy(&snapshot, ringBuffer) 73 return out, metadata, &smithy.DeserializationError{ 74 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 75 Snapshot: snapshot.Bytes(), 76 } 77 } 78 79 return out, metadata, err 80} 81 82func awsRestjson1_deserializeOpErrorBuildBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 83 var errorBuffer bytes.Buffer 84 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 85 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 86 } 87 errorBody := bytes.NewReader(errorBuffer.Bytes()) 88 89 errorCode := "UnknownError" 90 errorMessage := errorCode 91 92 code := response.Header.Get("X-Amzn-ErrorType") 93 if len(code) != 0 { 94 errorCode = restjson.SanitizeErrorCode(code) 95 } 96 97 var buff [1024]byte 98 ringBuffer := smithyio.NewRingBuffer(buff[:]) 99 100 body := io.TeeReader(errorBody, ringBuffer) 101 decoder := json.NewDecoder(body) 102 decoder.UseNumber() 103 code, message, err := restjson.GetErrorInfo(decoder) 104 if err != nil { 105 var snapshot bytes.Buffer 106 io.Copy(&snapshot, ringBuffer) 107 err = &smithy.DeserializationError{ 108 Err: fmt.Errorf("failed to decode response body, %w", err), 109 Snapshot: snapshot.Bytes(), 110 } 111 return err 112 } 113 114 errorBody.Seek(0, io.SeekStart) 115 if len(code) != 0 { 116 errorCode = restjson.SanitizeErrorCode(code) 117 } 118 if len(message) != 0 { 119 errorMessage = message 120 } 121 122 switch { 123 case strings.EqualFold("ConflictException", errorCode): 124 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 125 126 case strings.EqualFold("InternalServerException", errorCode): 127 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 128 129 case strings.EqualFold("PreconditionFailedException", errorCode): 130 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 131 132 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 133 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 134 135 case strings.EqualFold("ThrottlingException", errorCode): 136 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 137 138 case strings.EqualFold("ValidationException", errorCode): 139 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 140 141 default: 142 genericError := &smithy.GenericAPIError{ 143 Code: errorCode, 144 Message: errorMessage, 145 } 146 return genericError 147 148 } 149} 150 151func awsRestjson1_deserializeOpDocumentBuildBotLocaleOutput(v **BuildBotLocaleOutput, value interface{}) error { 152 if v == nil { 153 return fmt.Errorf("unexpected nil of type %T", v) 154 } 155 if value == nil { 156 return nil 157 } 158 159 shape, ok := value.(map[string]interface{}) 160 if !ok { 161 return fmt.Errorf("unexpected JSON type %v", value) 162 } 163 164 var sv *BuildBotLocaleOutput 165 if *v == nil { 166 sv = &BuildBotLocaleOutput{} 167 } else { 168 sv = *v 169 } 170 171 for key, value := range shape { 172 switch key { 173 case "botId": 174 if value != nil { 175 jtv, ok := value.(string) 176 if !ok { 177 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 178 } 179 sv.BotId = ptr.String(jtv) 180 } 181 182 case "botLocaleStatus": 183 if value != nil { 184 jtv, ok := value.(string) 185 if !ok { 186 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 187 } 188 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 189 } 190 191 case "botVersion": 192 if value != nil { 193 jtv, ok := value.(string) 194 if !ok { 195 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 196 } 197 sv.BotVersion = ptr.String(jtv) 198 } 199 200 case "lastBuildSubmittedDateTime": 201 if value != nil { 202 switch jtv := value.(type) { 203 case json.Number: 204 f64, err := jtv.Float64() 205 if err != nil { 206 return err 207 } 208 sv.LastBuildSubmittedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 209 210 default: 211 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 212 213 } 214 } 215 216 case "localeId": 217 if value != nil { 218 jtv, ok := value.(string) 219 if !ok { 220 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 221 } 222 sv.LocaleId = ptr.String(jtv) 223 } 224 225 default: 226 _, _ = key, value 227 228 } 229 } 230 *v = sv 231 return nil 232} 233 234type awsRestjson1_deserializeOpCreateBot struct { 235} 236 237func (*awsRestjson1_deserializeOpCreateBot) ID() string { 238 return "OperationDeserializer" 239} 240 241func (m *awsRestjson1_deserializeOpCreateBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 242 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 243) { 244 out, metadata, err = next.HandleDeserialize(ctx, in) 245 if err != nil { 246 return out, metadata, err 247 } 248 249 response, ok := out.RawResponse.(*smithyhttp.Response) 250 if !ok { 251 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 252 } 253 254 if response.StatusCode < 200 || response.StatusCode >= 300 { 255 return out, metadata, awsRestjson1_deserializeOpErrorCreateBot(response, &metadata) 256 } 257 output := &CreateBotOutput{} 258 out.Result = output 259 260 var buff [1024]byte 261 ringBuffer := smithyio.NewRingBuffer(buff[:]) 262 263 body := io.TeeReader(response.Body, ringBuffer) 264 265 decoder := json.NewDecoder(body) 266 decoder.UseNumber() 267 var shape interface{} 268 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 269 var snapshot bytes.Buffer 270 io.Copy(&snapshot, ringBuffer) 271 err = &smithy.DeserializationError{ 272 Err: fmt.Errorf("failed to decode response body, %w", err), 273 Snapshot: snapshot.Bytes(), 274 } 275 return out, metadata, err 276 } 277 278 err = awsRestjson1_deserializeOpDocumentCreateBotOutput(&output, shape) 279 if err != nil { 280 var snapshot bytes.Buffer 281 io.Copy(&snapshot, ringBuffer) 282 return out, metadata, &smithy.DeserializationError{ 283 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 284 Snapshot: snapshot.Bytes(), 285 } 286 } 287 288 return out, metadata, err 289} 290 291func awsRestjson1_deserializeOpErrorCreateBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 292 var errorBuffer bytes.Buffer 293 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 294 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 295 } 296 errorBody := bytes.NewReader(errorBuffer.Bytes()) 297 298 errorCode := "UnknownError" 299 errorMessage := errorCode 300 301 code := response.Header.Get("X-Amzn-ErrorType") 302 if len(code) != 0 { 303 errorCode = restjson.SanitizeErrorCode(code) 304 } 305 306 var buff [1024]byte 307 ringBuffer := smithyio.NewRingBuffer(buff[:]) 308 309 body := io.TeeReader(errorBody, ringBuffer) 310 decoder := json.NewDecoder(body) 311 decoder.UseNumber() 312 code, message, err := restjson.GetErrorInfo(decoder) 313 if err != nil { 314 var snapshot bytes.Buffer 315 io.Copy(&snapshot, ringBuffer) 316 err = &smithy.DeserializationError{ 317 Err: fmt.Errorf("failed to decode response body, %w", err), 318 Snapshot: snapshot.Bytes(), 319 } 320 return err 321 } 322 323 errorBody.Seek(0, io.SeekStart) 324 if len(code) != 0 { 325 errorCode = restjson.SanitizeErrorCode(code) 326 } 327 if len(message) != 0 { 328 errorMessage = message 329 } 330 331 switch { 332 case strings.EqualFold("ConflictException", errorCode): 333 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 334 335 case strings.EqualFold("InternalServerException", errorCode): 336 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 337 338 case strings.EqualFold("PreconditionFailedException", errorCode): 339 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 340 341 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 342 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 343 344 case strings.EqualFold("ThrottlingException", errorCode): 345 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 346 347 case strings.EqualFold("ValidationException", errorCode): 348 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 349 350 default: 351 genericError := &smithy.GenericAPIError{ 352 Code: errorCode, 353 Message: errorMessage, 354 } 355 return genericError 356 357 } 358} 359 360func awsRestjson1_deserializeOpDocumentCreateBotOutput(v **CreateBotOutput, value interface{}) error { 361 if v == nil { 362 return fmt.Errorf("unexpected nil of type %T", v) 363 } 364 if value == nil { 365 return nil 366 } 367 368 shape, ok := value.(map[string]interface{}) 369 if !ok { 370 return fmt.Errorf("unexpected JSON type %v", value) 371 } 372 373 var sv *CreateBotOutput 374 if *v == nil { 375 sv = &CreateBotOutput{} 376 } else { 377 sv = *v 378 } 379 380 for key, value := range shape { 381 switch key { 382 case "botId": 383 if value != nil { 384 jtv, ok := value.(string) 385 if !ok { 386 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 387 } 388 sv.BotId = ptr.String(jtv) 389 } 390 391 case "botName": 392 if value != nil { 393 jtv, ok := value.(string) 394 if !ok { 395 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 396 } 397 sv.BotName = ptr.String(jtv) 398 } 399 400 case "botStatus": 401 if value != nil { 402 jtv, ok := value.(string) 403 if !ok { 404 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 405 } 406 sv.BotStatus = types.BotStatus(jtv) 407 } 408 409 case "botTags": 410 if err := awsRestjson1_deserializeDocumentTagMap(&sv.BotTags, value); err != nil { 411 return err 412 } 413 414 case "creationDateTime": 415 if value != nil { 416 switch jtv := value.(type) { 417 case json.Number: 418 f64, err := jtv.Float64() 419 if err != nil { 420 return err 421 } 422 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 423 424 default: 425 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 426 427 } 428 } 429 430 case "dataPrivacy": 431 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 432 return err 433 } 434 435 case "description": 436 if value != nil { 437 jtv, ok := value.(string) 438 if !ok { 439 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 440 } 441 sv.Description = ptr.String(jtv) 442 } 443 444 case "idleSessionTTLInSeconds": 445 if value != nil { 446 jtv, ok := value.(json.Number) 447 if !ok { 448 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 449 } 450 i64, err := jtv.Int64() 451 if err != nil { 452 return err 453 } 454 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 455 } 456 457 case "roleArn": 458 if value != nil { 459 jtv, ok := value.(string) 460 if !ok { 461 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 462 } 463 sv.RoleArn = ptr.String(jtv) 464 } 465 466 case "testBotAliasTags": 467 if err := awsRestjson1_deserializeDocumentTagMap(&sv.TestBotAliasTags, value); err != nil { 468 return err 469 } 470 471 default: 472 _, _ = key, value 473 474 } 475 } 476 *v = sv 477 return nil 478} 479 480type awsRestjson1_deserializeOpCreateBotAlias struct { 481} 482 483func (*awsRestjson1_deserializeOpCreateBotAlias) ID() string { 484 return "OperationDeserializer" 485} 486 487func (m *awsRestjson1_deserializeOpCreateBotAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 488 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 489) { 490 out, metadata, err = next.HandleDeserialize(ctx, in) 491 if err != nil { 492 return out, metadata, err 493 } 494 495 response, ok := out.RawResponse.(*smithyhttp.Response) 496 if !ok { 497 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 498 } 499 500 if response.StatusCode < 200 || response.StatusCode >= 300 { 501 return out, metadata, awsRestjson1_deserializeOpErrorCreateBotAlias(response, &metadata) 502 } 503 output := &CreateBotAliasOutput{} 504 out.Result = output 505 506 var buff [1024]byte 507 ringBuffer := smithyio.NewRingBuffer(buff[:]) 508 509 body := io.TeeReader(response.Body, ringBuffer) 510 511 decoder := json.NewDecoder(body) 512 decoder.UseNumber() 513 var shape interface{} 514 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 515 var snapshot bytes.Buffer 516 io.Copy(&snapshot, ringBuffer) 517 err = &smithy.DeserializationError{ 518 Err: fmt.Errorf("failed to decode response body, %w", err), 519 Snapshot: snapshot.Bytes(), 520 } 521 return out, metadata, err 522 } 523 524 err = awsRestjson1_deserializeOpDocumentCreateBotAliasOutput(&output, shape) 525 if err != nil { 526 var snapshot bytes.Buffer 527 io.Copy(&snapshot, ringBuffer) 528 return out, metadata, &smithy.DeserializationError{ 529 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 530 Snapshot: snapshot.Bytes(), 531 } 532 } 533 534 return out, metadata, err 535} 536 537func awsRestjson1_deserializeOpErrorCreateBotAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 538 var errorBuffer bytes.Buffer 539 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 540 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 541 } 542 errorBody := bytes.NewReader(errorBuffer.Bytes()) 543 544 errorCode := "UnknownError" 545 errorMessage := errorCode 546 547 code := response.Header.Get("X-Amzn-ErrorType") 548 if len(code) != 0 { 549 errorCode = restjson.SanitizeErrorCode(code) 550 } 551 552 var buff [1024]byte 553 ringBuffer := smithyio.NewRingBuffer(buff[:]) 554 555 body := io.TeeReader(errorBody, ringBuffer) 556 decoder := json.NewDecoder(body) 557 decoder.UseNumber() 558 code, message, err := restjson.GetErrorInfo(decoder) 559 if err != nil { 560 var snapshot bytes.Buffer 561 io.Copy(&snapshot, ringBuffer) 562 err = &smithy.DeserializationError{ 563 Err: fmt.Errorf("failed to decode response body, %w", err), 564 Snapshot: snapshot.Bytes(), 565 } 566 return err 567 } 568 569 errorBody.Seek(0, io.SeekStart) 570 if len(code) != 0 { 571 errorCode = restjson.SanitizeErrorCode(code) 572 } 573 if len(message) != 0 { 574 errorMessage = message 575 } 576 577 switch { 578 case strings.EqualFold("ConflictException", errorCode): 579 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 580 581 case strings.EqualFold("InternalServerException", errorCode): 582 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 583 584 case strings.EqualFold("PreconditionFailedException", errorCode): 585 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 586 587 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 588 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 589 590 case strings.EqualFold("ThrottlingException", errorCode): 591 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 592 593 case strings.EqualFold("ValidationException", errorCode): 594 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 595 596 default: 597 genericError := &smithy.GenericAPIError{ 598 Code: errorCode, 599 Message: errorMessage, 600 } 601 return genericError 602 603 } 604} 605 606func awsRestjson1_deserializeOpDocumentCreateBotAliasOutput(v **CreateBotAliasOutput, value interface{}) error { 607 if v == nil { 608 return fmt.Errorf("unexpected nil of type %T", v) 609 } 610 if value == nil { 611 return nil 612 } 613 614 shape, ok := value.(map[string]interface{}) 615 if !ok { 616 return fmt.Errorf("unexpected JSON type %v", value) 617 } 618 619 var sv *CreateBotAliasOutput 620 if *v == nil { 621 sv = &CreateBotAliasOutput{} 622 } else { 623 sv = *v 624 } 625 626 for key, value := range shape { 627 switch key { 628 case "botAliasId": 629 if value != nil { 630 jtv, ok := value.(string) 631 if !ok { 632 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 633 } 634 sv.BotAliasId = ptr.String(jtv) 635 } 636 637 case "botAliasLocaleSettings": 638 if err := awsRestjson1_deserializeDocumentBotAliasLocaleSettingsMap(&sv.BotAliasLocaleSettings, value); err != nil { 639 return err 640 } 641 642 case "botAliasName": 643 if value != nil { 644 jtv, ok := value.(string) 645 if !ok { 646 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 647 } 648 sv.BotAliasName = ptr.String(jtv) 649 } 650 651 case "botAliasStatus": 652 if value != nil { 653 jtv, ok := value.(string) 654 if !ok { 655 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 656 } 657 sv.BotAliasStatus = types.BotAliasStatus(jtv) 658 } 659 660 case "botId": 661 if value != nil { 662 jtv, ok := value.(string) 663 if !ok { 664 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 665 } 666 sv.BotId = ptr.String(jtv) 667 } 668 669 case "botVersion": 670 if value != nil { 671 jtv, ok := value.(string) 672 if !ok { 673 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 674 } 675 sv.BotVersion = ptr.String(jtv) 676 } 677 678 case "conversationLogSettings": 679 if err := awsRestjson1_deserializeDocumentConversationLogSettings(&sv.ConversationLogSettings, value); err != nil { 680 return err 681 } 682 683 case "creationDateTime": 684 if value != nil { 685 switch jtv := value.(type) { 686 case json.Number: 687 f64, err := jtv.Float64() 688 if err != nil { 689 return err 690 } 691 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 692 693 default: 694 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 695 696 } 697 } 698 699 case "description": 700 if value != nil { 701 jtv, ok := value.(string) 702 if !ok { 703 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 704 } 705 sv.Description = ptr.String(jtv) 706 } 707 708 case "sentimentAnalysisSettings": 709 if err := awsRestjson1_deserializeDocumentSentimentAnalysisSettings(&sv.SentimentAnalysisSettings, value); err != nil { 710 return err 711 } 712 713 case "tags": 714 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 715 return err 716 } 717 718 default: 719 _, _ = key, value 720 721 } 722 } 723 *v = sv 724 return nil 725} 726 727type awsRestjson1_deserializeOpCreateBotLocale struct { 728} 729 730func (*awsRestjson1_deserializeOpCreateBotLocale) ID() string { 731 return "OperationDeserializer" 732} 733 734func (m *awsRestjson1_deserializeOpCreateBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 735 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 736) { 737 out, metadata, err = next.HandleDeserialize(ctx, in) 738 if err != nil { 739 return out, metadata, err 740 } 741 742 response, ok := out.RawResponse.(*smithyhttp.Response) 743 if !ok { 744 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 745 } 746 747 if response.StatusCode < 200 || response.StatusCode >= 300 { 748 return out, metadata, awsRestjson1_deserializeOpErrorCreateBotLocale(response, &metadata) 749 } 750 output := &CreateBotLocaleOutput{} 751 out.Result = output 752 753 var buff [1024]byte 754 ringBuffer := smithyio.NewRingBuffer(buff[:]) 755 756 body := io.TeeReader(response.Body, ringBuffer) 757 758 decoder := json.NewDecoder(body) 759 decoder.UseNumber() 760 var shape interface{} 761 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 762 var snapshot bytes.Buffer 763 io.Copy(&snapshot, ringBuffer) 764 err = &smithy.DeserializationError{ 765 Err: fmt.Errorf("failed to decode response body, %w", err), 766 Snapshot: snapshot.Bytes(), 767 } 768 return out, metadata, err 769 } 770 771 err = awsRestjson1_deserializeOpDocumentCreateBotLocaleOutput(&output, shape) 772 if err != nil { 773 var snapshot bytes.Buffer 774 io.Copy(&snapshot, ringBuffer) 775 return out, metadata, &smithy.DeserializationError{ 776 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 777 Snapshot: snapshot.Bytes(), 778 } 779 } 780 781 return out, metadata, err 782} 783 784func awsRestjson1_deserializeOpErrorCreateBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 785 var errorBuffer bytes.Buffer 786 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 787 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 788 } 789 errorBody := bytes.NewReader(errorBuffer.Bytes()) 790 791 errorCode := "UnknownError" 792 errorMessage := errorCode 793 794 code := response.Header.Get("X-Amzn-ErrorType") 795 if len(code) != 0 { 796 errorCode = restjson.SanitizeErrorCode(code) 797 } 798 799 var buff [1024]byte 800 ringBuffer := smithyio.NewRingBuffer(buff[:]) 801 802 body := io.TeeReader(errorBody, ringBuffer) 803 decoder := json.NewDecoder(body) 804 decoder.UseNumber() 805 code, message, err := restjson.GetErrorInfo(decoder) 806 if err != nil { 807 var snapshot bytes.Buffer 808 io.Copy(&snapshot, ringBuffer) 809 err = &smithy.DeserializationError{ 810 Err: fmt.Errorf("failed to decode response body, %w", err), 811 Snapshot: snapshot.Bytes(), 812 } 813 return err 814 } 815 816 errorBody.Seek(0, io.SeekStart) 817 if len(code) != 0 { 818 errorCode = restjson.SanitizeErrorCode(code) 819 } 820 if len(message) != 0 { 821 errorMessage = message 822 } 823 824 switch { 825 case strings.EqualFold("ConflictException", errorCode): 826 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 827 828 case strings.EqualFold("InternalServerException", errorCode): 829 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 830 831 case strings.EqualFold("PreconditionFailedException", errorCode): 832 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 833 834 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 835 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 836 837 case strings.EqualFold("ThrottlingException", errorCode): 838 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 839 840 case strings.EqualFold("ValidationException", errorCode): 841 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 842 843 default: 844 genericError := &smithy.GenericAPIError{ 845 Code: errorCode, 846 Message: errorMessage, 847 } 848 return genericError 849 850 } 851} 852 853func awsRestjson1_deserializeOpDocumentCreateBotLocaleOutput(v **CreateBotLocaleOutput, value interface{}) error { 854 if v == nil { 855 return fmt.Errorf("unexpected nil of type %T", v) 856 } 857 if value == nil { 858 return nil 859 } 860 861 shape, ok := value.(map[string]interface{}) 862 if !ok { 863 return fmt.Errorf("unexpected JSON type %v", value) 864 } 865 866 var sv *CreateBotLocaleOutput 867 if *v == nil { 868 sv = &CreateBotLocaleOutput{} 869 } else { 870 sv = *v 871 } 872 873 for key, value := range shape { 874 switch key { 875 case "botId": 876 if value != nil { 877 jtv, ok := value.(string) 878 if !ok { 879 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 880 } 881 sv.BotId = ptr.String(jtv) 882 } 883 884 case "botLocaleStatus": 885 if value != nil { 886 jtv, ok := value.(string) 887 if !ok { 888 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 889 } 890 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 891 } 892 893 case "botVersion": 894 if value != nil { 895 jtv, ok := value.(string) 896 if !ok { 897 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 898 } 899 sv.BotVersion = ptr.String(jtv) 900 } 901 902 case "creationDateTime": 903 if value != nil { 904 switch jtv := value.(type) { 905 case json.Number: 906 f64, err := jtv.Float64() 907 if err != nil { 908 return err 909 } 910 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 911 912 default: 913 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 914 915 } 916 } 917 918 case "description": 919 if value != nil { 920 jtv, ok := value.(string) 921 if !ok { 922 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 923 } 924 sv.Description = ptr.String(jtv) 925 } 926 927 case "localeId": 928 if value != nil { 929 jtv, ok := value.(string) 930 if !ok { 931 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 932 } 933 sv.LocaleId = ptr.String(jtv) 934 } 935 936 case "localeName": 937 if value != nil { 938 jtv, ok := value.(string) 939 if !ok { 940 return fmt.Errorf("expected LocaleName to be of type string, got %T instead", value) 941 } 942 sv.LocaleName = ptr.String(jtv) 943 } 944 945 case "nluIntentConfidenceThreshold": 946 if value != nil { 947 switch jtv := value.(type) { 948 case json.Number: 949 f64, err := jtv.Float64() 950 if err != nil { 951 return err 952 } 953 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 954 955 case string: 956 var f64 float64 957 switch { 958 case strings.EqualFold(jtv, "NaN"): 959 f64 = math.NaN() 960 961 case strings.EqualFold(jtv, "Infinity"): 962 f64 = math.Inf(1) 963 964 case strings.EqualFold(jtv, "-Infinity"): 965 f64 = math.Inf(-1) 966 967 default: 968 return fmt.Errorf("unknown JSON number value: %s", jtv) 969 970 } 971 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 972 973 default: 974 return fmt.Errorf("expected ConfidenceThreshold to be a JSON Number, got %T instead", value) 975 976 } 977 } 978 979 case "voiceSettings": 980 if err := awsRestjson1_deserializeDocumentVoiceSettings(&sv.VoiceSettings, value); err != nil { 981 return err 982 } 983 984 default: 985 _, _ = key, value 986 987 } 988 } 989 *v = sv 990 return nil 991} 992 993type awsRestjson1_deserializeOpCreateBotVersion struct { 994} 995 996func (*awsRestjson1_deserializeOpCreateBotVersion) ID() string { 997 return "OperationDeserializer" 998} 999 1000func (m *awsRestjson1_deserializeOpCreateBotVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1001 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1002) { 1003 out, metadata, err = next.HandleDeserialize(ctx, in) 1004 if err != nil { 1005 return out, metadata, err 1006 } 1007 1008 response, ok := out.RawResponse.(*smithyhttp.Response) 1009 if !ok { 1010 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1011 } 1012 1013 if response.StatusCode < 200 || response.StatusCode >= 300 { 1014 return out, metadata, awsRestjson1_deserializeOpErrorCreateBotVersion(response, &metadata) 1015 } 1016 output := &CreateBotVersionOutput{} 1017 out.Result = output 1018 1019 var buff [1024]byte 1020 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1021 1022 body := io.TeeReader(response.Body, ringBuffer) 1023 1024 decoder := json.NewDecoder(body) 1025 decoder.UseNumber() 1026 var shape interface{} 1027 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1028 var snapshot bytes.Buffer 1029 io.Copy(&snapshot, ringBuffer) 1030 err = &smithy.DeserializationError{ 1031 Err: fmt.Errorf("failed to decode response body, %w", err), 1032 Snapshot: snapshot.Bytes(), 1033 } 1034 return out, metadata, err 1035 } 1036 1037 err = awsRestjson1_deserializeOpDocumentCreateBotVersionOutput(&output, shape) 1038 if err != nil { 1039 var snapshot bytes.Buffer 1040 io.Copy(&snapshot, ringBuffer) 1041 return out, metadata, &smithy.DeserializationError{ 1042 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1043 Snapshot: snapshot.Bytes(), 1044 } 1045 } 1046 1047 return out, metadata, err 1048} 1049 1050func awsRestjson1_deserializeOpErrorCreateBotVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1051 var errorBuffer bytes.Buffer 1052 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1053 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1054 } 1055 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1056 1057 errorCode := "UnknownError" 1058 errorMessage := errorCode 1059 1060 code := response.Header.Get("X-Amzn-ErrorType") 1061 if len(code) != 0 { 1062 errorCode = restjson.SanitizeErrorCode(code) 1063 } 1064 1065 var buff [1024]byte 1066 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1067 1068 body := io.TeeReader(errorBody, ringBuffer) 1069 decoder := json.NewDecoder(body) 1070 decoder.UseNumber() 1071 code, message, err := restjson.GetErrorInfo(decoder) 1072 if err != nil { 1073 var snapshot bytes.Buffer 1074 io.Copy(&snapshot, ringBuffer) 1075 err = &smithy.DeserializationError{ 1076 Err: fmt.Errorf("failed to decode response body, %w", err), 1077 Snapshot: snapshot.Bytes(), 1078 } 1079 return err 1080 } 1081 1082 errorBody.Seek(0, io.SeekStart) 1083 if len(code) != 0 { 1084 errorCode = restjson.SanitizeErrorCode(code) 1085 } 1086 if len(message) != 0 { 1087 errorMessage = message 1088 } 1089 1090 switch { 1091 case strings.EqualFold("ConflictException", errorCode): 1092 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1093 1094 case strings.EqualFold("InternalServerException", errorCode): 1095 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1096 1097 case strings.EqualFold("PreconditionFailedException", errorCode): 1098 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 1099 1100 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1101 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1102 1103 case strings.EqualFold("ThrottlingException", errorCode): 1104 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1105 1106 case strings.EqualFold("ValidationException", errorCode): 1107 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1108 1109 default: 1110 genericError := &smithy.GenericAPIError{ 1111 Code: errorCode, 1112 Message: errorMessage, 1113 } 1114 return genericError 1115 1116 } 1117} 1118 1119func awsRestjson1_deserializeOpDocumentCreateBotVersionOutput(v **CreateBotVersionOutput, value interface{}) error { 1120 if v == nil { 1121 return fmt.Errorf("unexpected nil of type %T", v) 1122 } 1123 if value == nil { 1124 return nil 1125 } 1126 1127 shape, ok := value.(map[string]interface{}) 1128 if !ok { 1129 return fmt.Errorf("unexpected JSON type %v", value) 1130 } 1131 1132 var sv *CreateBotVersionOutput 1133 if *v == nil { 1134 sv = &CreateBotVersionOutput{} 1135 } else { 1136 sv = *v 1137 } 1138 1139 for key, value := range shape { 1140 switch key { 1141 case "botId": 1142 if value != nil { 1143 jtv, ok := value.(string) 1144 if !ok { 1145 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1146 } 1147 sv.BotId = ptr.String(jtv) 1148 } 1149 1150 case "botStatus": 1151 if value != nil { 1152 jtv, ok := value.(string) 1153 if !ok { 1154 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 1155 } 1156 sv.BotStatus = types.BotStatus(jtv) 1157 } 1158 1159 case "botVersion": 1160 if value != nil { 1161 jtv, ok := value.(string) 1162 if !ok { 1163 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 1164 } 1165 sv.BotVersion = ptr.String(jtv) 1166 } 1167 1168 case "botVersionLocaleSpecification": 1169 if err := awsRestjson1_deserializeDocumentBotVersionLocaleSpecification(&sv.BotVersionLocaleSpecification, value); err != nil { 1170 return err 1171 } 1172 1173 case "creationDateTime": 1174 if value != nil { 1175 switch jtv := value.(type) { 1176 case json.Number: 1177 f64, err := jtv.Float64() 1178 if err != nil { 1179 return err 1180 } 1181 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1182 1183 default: 1184 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 1185 1186 } 1187 } 1188 1189 case "description": 1190 if value != nil { 1191 jtv, ok := value.(string) 1192 if !ok { 1193 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 1194 } 1195 sv.Description = ptr.String(jtv) 1196 } 1197 1198 default: 1199 _, _ = key, value 1200 1201 } 1202 } 1203 *v = sv 1204 return nil 1205} 1206 1207type awsRestjson1_deserializeOpCreateExport struct { 1208} 1209 1210func (*awsRestjson1_deserializeOpCreateExport) ID() string { 1211 return "OperationDeserializer" 1212} 1213 1214func (m *awsRestjson1_deserializeOpCreateExport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1215 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1216) { 1217 out, metadata, err = next.HandleDeserialize(ctx, in) 1218 if err != nil { 1219 return out, metadata, err 1220 } 1221 1222 response, ok := out.RawResponse.(*smithyhttp.Response) 1223 if !ok { 1224 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1225 } 1226 1227 if response.StatusCode < 200 || response.StatusCode >= 300 { 1228 return out, metadata, awsRestjson1_deserializeOpErrorCreateExport(response, &metadata) 1229 } 1230 output := &CreateExportOutput{} 1231 out.Result = output 1232 1233 var buff [1024]byte 1234 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1235 1236 body := io.TeeReader(response.Body, ringBuffer) 1237 1238 decoder := json.NewDecoder(body) 1239 decoder.UseNumber() 1240 var shape interface{} 1241 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1242 var snapshot bytes.Buffer 1243 io.Copy(&snapshot, ringBuffer) 1244 err = &smithy.DeserializationError{ 1245 Err: fmt.Errorf("failed to decode response body, %w", err), 1246 Snapshot: snapshot.Bytes(), 1247 } 1248 return out, metadata, err 1249 } 1250 1251 err = awsRestjson1_deserializeOpDocumentCreateExportOutput(&output, shape) 1252 if err != nil { 1253 var snapshot bytes.Buffer 1254 io.Copy(&snapshot, ringBuffer) 1255 return out, metadata, &smithy.DeserializationError{ 1256 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1257 Snapshot: snapshot.Bytes(), 1258 } 1259 } 1260 1261 return out, metadata, err 1262} 1263 1264func awsRestjson1_deserializeOpErrorCreateExport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1265 var errorBuffer bytes.Buffer 1266 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1267 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1268 } 1269 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1270 1271 errorCode := "UnknownError" 1272 errorMessage := errorCode 1273 1274 code := response.Header.Get("X-Amzn-ErrorType") 1275 if len(code) != 0 { 1276 errorCode = restjson.SanitizeErrorCode(code) 1277 } 1278 1279 var buff [1024]byte 1280 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1281 1282 body := io.TeeReader(errorBody, ringBuffer) 1283 decoder := json.NewDecoder(body) 1284 decoder.UseNumber() 1285 code, message, err := restjson.GetErrorInfo(decoder) 1286 if err != nil { 1287 var snapshot bytes.Buffer 1288 io.Copy(&snapshot, ringBuffer) 1289 err = &smithy.DeserializationError{ 1290 Err: fmt.Errorf("failed to decode response body, %w", err), 1291 Snapshot: snapshot.Bytes(), 1292 } 1293 return err 1294 } 1295 1296 errorBody.Seek(0, io.SeekStart) 1297 if len(code) != 0 { 1298 errorCode = restjson.SanitizeErrorCode(code) 1299 } 1300 if len(message) != 0 { 1301 errorMessage = message 1302 } 1303 1304 switch { 1305 case strings.EqualFold("ConflictException", errorCode): 1306 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1307 1308 case strings.EqualFold("InternalServerException", errorCode): 1309 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1310 1311 case strings.EqualFold("ResourceNotFoundException", errorCode): 1312 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1313 1314 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1315 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1316 1317 case strings.EqualFold("ThrottlingException", errorCode): 1318 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1319 1320 case strings.EqualFold("ValidationException", errorCode): 1321 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1322 1323 default: 1324 genericError := &smithy.GenericAPIError{ 1325 Code: errorCode, 1326 Message: errorMessage, 1327 } 1328 return genericError 1329 1330 } 1331} 1332 1333func awsRestjson1_deserializeOpDocumentCreateExportOutput(v **CreateExportOutput, value interface{}) error { 1334 if v == nil { 1335 return fmt.Errorf("unexpected nil of type %T", v) 1336 } 1337 if value == nil { 1338 return nil 1339 } 1340 1341 shape, ok := value.(map[string]interface{}) 1342 if !ok { 1343 return fmt.Errorf("unexpected JSON type %v", value) 1344 } 1345 1346 var sv *CreateExportOutput 1347 if *v == nil { 1348 sv = &CreateExportOutput{} 1349 } else { 1350 sv = *v 1351 } 1352 1353 for key, value := range shape { 1354 switch key { 1355 case "creationDateTime": 1356 if value != nil { 1357 switch jtv := value.(type) { 1358 case json.Number: 1359 f64, err := jtv.Float64() 1360 if err != nil { 1361 return err 1362 } 1363 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1364 1365 default: 1366 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 1367 1368 } 1369 } 1370 1371 case "exportId": 1372 if value != nil { 1373 jtv, ok := value.(string) 1374 if !ok { 1375 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1376 } 1377 sv.ExportId = ptr.String(jtv) 1378 } 1379 1380 case "exportStatus": 1381 if value != nil { 1382 jtv, ok := value.(string) 1383 if !ok { 1384 return fmt.Errorf("expected ExportStatus to be of type string, got %T instead", value) 1385 } 1386 sv.ExportStatus = types.ExportStatus(jtv) 1387 } 1388 1389 case "fileFormat": 1390 if value != nil { 1391 jtv, ok := value.(string) 1392 if !ok { 1393 return fmt.Errorf("expected ImportExportFileFormat to be of type string, got %T instead", value) 1394 } 1395 sv.FileFormat = types.ImportExportFileFormat(jtv) 1396 } 1397 1398 case "resourceSpecification": 1399 if err := awsRestjson1_deserializeDocumentExportResourceSpecification(&sv.ResourceSpecification, value); err != nil { 1400 return err 1401 } 1402 1403 default: 1404 _, _ = key, value 1405 1406 } 1407 } 1408 *v = sv 1409 return nil 1410} 1411 1412type awsRestjson1_deserializeOpCreateIntent struct { 1413} 1414 1415func (*awsRestjson1_deserializeOpCreateIntent) ID() string { 1416 return "OperationDeserializer" 1417} 1418 1419func (m *awsRestjson1_deserializeOpCreateIntent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1420 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1421) { 1422 out, metadata, err = next.HandleDeserialize(ctx, in) 1423 if err != nil { 1424 return out, metadata, err 1425 } 1426 1427 response, ok := out.RawResponse.(*smithyhttp.Response) 1428 if !ok { 1429 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1430 } 1431 1432 if response.StatusCode < 200 || response.StatusCode >= 300 { 1433 return out, metadata, awsRestjson1_deserializeOpErrorCreateIntent(response, &metadata) 1434 } 1435 output := &CreateIntentOutput{} 1436 out.Result = output 1437 1438 var buff [1024]byte 1439 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1440 1441 body := io.TeeReader(response.Body, ringBuffer) 1442 1443 decoder := json.NewDecoder(body) 1444 decoder.UseNumber() 1445 var shape interface{} 1446 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1447 var snapshot bytes.Buffer 1448 io.Copy(&snapshot, ringBuffer) 1449 err = &smithy.DeserializationError{ 1450 Err: fmt.Errorf("failed to decode response body, %w", err), 1451 Snapshot: snapshot.Bytes(), 1452 } 1453 return out, metadata, err 1454 } 1455 1456 err = awsRestjson1_deserializeOpDocumentCreateIntentOutput(&output, shape) 1457 if err != nil { 1458 var snapshot bytes.Buffer 1459 io.Copy(&snapshot, ringBuffer) 1460 return out, metadata, &smithy.DeserializationError{ 1461 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1462 Snapshot: snapshot.Bytes(), 1463 } 1464 } 1465 1466 return out, metadata, err 1467} 1468 1469func awsRestjson1_deserializeOpErrorCreateIntent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1470 var errorBuffer bytes.Buffer 1471 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1472 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1473 } 1474 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1475 1476 errorCode := "UnknownError" 1477 errorMessage := errorCode 1478 1479 code := response.Header.Get("X-Amzn-ErrorType") 1480 if len(code) != 0 { 1481 errorCode = restjson.SanitizeErrorCode(code) 1482 } 1483 1484 var buff [1024]byte 1485 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1486 1487 body := io.TeeReader(errorBody, ringBuffer) 1488 decoder := json.NewDecoder(body) 1489 decoder.UseNumber() 1490 code, message, err := restjson.GetErrorInfo(decoder) 1491 if err != nil { 1492 var snapshot bytes.Buffer 1493 io.Copy(&snapshot, ringBuffer) 1494 err = &smithy.DeserializationError{ 1495 Err: fmt.Errorf("failed to decode response body, %w", err), 1496 Snapshot: snapshot.Bytes(), 1497 } 1498 return err 1499 } 1500 1501 errorBody.Seek(0, io.SeekStart) 1502 if len(code) != 0 { 1503 errorCode = restjson.SanitizeErrorCode(code) 1504 } 1505 if len(message) != 0 { 1506 errorMessage = message 1507 } 1508 1509 switch { 1510 case strings.EqualFold("ConflictException", errorCode): 1511 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1512 1513 case strings.EqualFold("InternalServerException", errorCode): 1514 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1515 1516 case strings.EqualFold("PreconditionFailedException", errorCode): 1517 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 1518 1519 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1520 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1521 1522 case strings.EqualFold("ThrottlingException", errorCode): 1523 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1524 1525 case strings.EqualFold("ValidationException", errorCode): 1526 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1527 1528 default: 1529 genericError := &smithy.GenericAPIError{ 1530 Code: errorCode, 1531 Message: errorMessage, 1532 } 1533 return genericError 1534 1535 } 1536} 1537 1538func awsRestjson1_deserializeOpDocumentCreateIntentOutput(v **CreateIntentOutput, value interface{}) error { 1539 if v == nil { 1540 return fmt.Errorf("unexpected nil of type %T", v) 1541 } 1542 if value == nil { 1543 return nil 1544 } 1545 1546 shape, ok := value.(map[string]interface{}) 1547 if !ok { 1548 return fmt.Errorf("unexpected JSON type %v", value) 1549 } 1550 1551 var sv *CreateIntentOutput 1552 if *v == nil { 1553 sv = &CreateIntentOutput{} 1554 } else { 1555 sv = *v 1556 } 1557 1558 for key, value := range shape { 1559 switch key { 1560 case "botId": 1561 if value != nil { 1562 jtv, ok := value.(string) 1563 if !ok { 1564 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1565 } 1566 sv.BotId = ptr.String(jtv) 1567 } 1568 1569 case "botVersion": 1570 if value != nil { 1571 jtv, ok := value.(string) 1572 if !ok { 1573 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 1574 } 1575 sv.BotVersion = ptr.String(jtv) 1576 } 1577 1578 case "creationDateTime": 1579 if value != nil { 1580 switch jtv := value.(type) { 1581 case json.Number: 1582 f64, err := jtv.Float64() 1583 if err != nil { 1584 return err 1585 } 1586 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1587 1588 default: 1589 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 1590 1591 } 1592 } 1593 1594 case "description": 1595 if value != nil { 1596 jtv, ok := value.(string) 1597 if !ok { 1598 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 1599 } 1600 sv.Description = ptr.String(jtv) 1601 } 1602 1603 case "dialogCodeHook": 1604 if err := awsRestjson1_deserializeDocumentDialogCodeHookSettings(&sv.DialogCodeHook, value); err != nil { 1605 return err 1606 } 1607 1608 case "fulfillmentCodeHook": 1609 if err := awsRestjson1_deserializeDocumentFulfillmentCodeHookSettings(&sv.FulfillmentCodeHook, value); err != nil { 1610 return err 1611 } 1612 1613 case "inputContexts": 1614 if err := awsRestjson1_deserializeDocumentInputContextsList(&sv.InputContexts, value); err != nil { 1615 return err 1616 } 1617 1618 case "intentClosingSetting": 1619 if err := awsRestjson1_deserializeDocumentIntentClosingSetting(&sv.IntentClosingSetting, value); err != nil { 1620 return err 1621 } 1622 1623 case "intentConfirmationSetting": 1624 if err := awsRestjson1_deserializeDocumentIntentConfirmationSetting(&sv.IntentConfirmationSetting, value); err != nil { 1625 return err 1626 } 1627 1628 case "intentId": 1629 if value != nil { 1630 jtv, ok := value.(string) 1631 if !ok { 1632 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1633 } 1634 sv.IntentId = ptr.String(jtv) 1635 } 1636 1637 case "intentName": 1638 if value != nil { 1639 jtv, ok := value.(string) 1640 if !ok { 1641 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1642 } 1643 sv.IntentName = ptr.String(jtv) 1644 } 1645 1646 case "kendraConfiguration": 1647 if err := awsRestjson1_deserializeDocumentKendraConfiguration(&sv.KendraConfiguration, value); err != nil { 1648 return err 1649 } 1650 1651 case "localeId": 1652 if value != nil { 1653 jtv, ok := value.(string) 1654 if !ok { 1655 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 1656 } 1657 sv.LocaleId = ptr.String(jtv) 1658 } 1659 1660 case "outputContexts": 1661 if err := awsRestjson1_deserializeDocumentOutputContextsList(&sv.OutputContexts, value); err != nil { 1662 return err 1663 } 1664 1665 case "parentIntentSignature": 1666 if value != nil { 1667 jtv, ok := value.(string) 1668 if !ok { 1669 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 1670 } 1671 sv.ParentIntentSignature = ptr.String(jtv) 1672 } 1673 1674 case "sampleUtterances": 1675 if err := awsRestjson1_deserializeDocumentSampleUtterancesList(&sv.SampleUtterances, value); err != nil { 1676 return err 1677 } 1678 1679 default: 1680 _, _ = key, value 1681 1682 } 1683 } 1684 *v = sv 1685 return nil 1686} 1687 1688type awsRestjson1_deserializeOpCreateResourcePolicy struct { 1689} 1690 1691func (*awsRestjson1_deserializeOpCreateResourcePolicy) ID() string { 1692 return "OperationDeserializer" 1693} 1694 1695func (m *awsRestjson1_deserializeOpCreateResourcePolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1696 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1697) { 1698 out, metadata, err = next.HandleDeserialize(ctx, in) 1699 if err != nil { 1700 return out, metadata, err 1701 } 1702 1703 response, ok := out.RawResponse.(*smithyhttp.Response) 1704 if !ok { 1705 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1706 } 1707 1708 if response.StatusCode < 200 || response.StatusCode >= 300 { 1709 return out, metadata, awsRestjson1_deserializeOpErrorCreateResourcePolicy(response, &metadata) 1710 } 1711 output := &CreateResourcePolicyOutput{} 1712 out.Result = output 1713 1714 var buff [1024]byte 1715 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1716 1717 body := io.TeeReader(response.Body, ringBuffer) 1718 1719 decoder := json.NewDecoder(body) 1720 decoder.UseNumber() 1721 var shape interface{} 1722 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1723 var snapshot bytes.Buffer 1724 io.Copy(&snapshot, ringBuffer) 1725 err = &smithy.DeserializationError{ 1726 Err: fmt.Errorf("failed to decode response body, %w", err), 1727 Snapshot: snapshot.Bytes(), 1728 } 1729 return out, metadata, err 1730 } 1731 1732 err = awsRestjson1_deserializeOpDocumentCreateResourcePolicyOutput(&output, shape) 1733 if err != nil { 1734 var snapshot bytes.Buffer 1735 io.Copy(&snapshot, ringBuffer) 1736 return out, metadata, &smithy.DeserializationError{ 1737 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1738 Snapshot: snapshot.Bytes(), 1739 } 1740 } 1741 1742 return out, metadata, err 1743} 1744 1745func awsRestjson1_deserializeOpErrorCreateResourcePolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1746 var errorBuffer bytes.Buffer 1747 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1748 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1749 } 1750 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1751 1752 errorCode := "UnknownError" 1753 errorMessage := errorCode 1754 1755 code := response.Header.Get("X-Amzn-ErrorType") 1756 if len(code) != 0 { 1757 errorCode = restjson.SanitizeErrorCode(code) 1758 } 1759 1760 var buff [1024]byte 1761 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1762 1763 body := io.TeeReader(errorBody, ringBuffer) 1764 decoder := json.NewDecoder(body) 1765 decoder.UseNumber() 1766 code, message, err := restjson.GetErrorInfo(decoder) 1767 if err != nil { 1768 var snapshot bytes.Buffer 1769 io.Copy(&snapshot, ringBuffer) 1770 err = &smithy.DeserializationError{ 1771 Err: fmt.Errorf("failed to decode response body, %w", err), 1772 Snapshot: snapshot.Bytes(), 1773 } 1774 return err 1775 } 1776 1777 errorBody.Seek(0, io.SeekStart) 1778 if len(code) != 0 { 1779 errorCode = restjson.SanitizeErrorCode(code) 1780 } 1781 if len(message) != 0 { 1782 errorMessage = message 1783 } 1784 1785 switch { 1786 case strings.EqualFold("InternalServerException", errorCode): 1787 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1788 1789 case strings.EqualFold("PreconditionFailedException", errorCode): 1790 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 1791 1792 case strings.EqualFold("ResourceNotFoundException", errorCode): 1793 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1794 1795 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1796 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1797 1798 case strings.EqualFold("ThrottlingException", errorCode): 1799 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1800 1801 case strings.EqualFold("ValidationException", errorCode): 1802 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1803 1804 default: 1805 genericError := &smithy.GenericAPIError{ 1806 Code: errorCode, 1807 Message: errorMessage, 1808 } 1809 return genericError 1810 1811 } 1812} 1813 1814func awsRestjson1_deserializeOpDocumentCreateResourcePolicyOutput(v **CreateResourcePolicyOutput, value interface{}) error { 1815 if v == nil { 1816 return fmt.Errorf("unexpected nil of type %T", v) 1817 } 1818 if value == nil { 1819 return nil 1820 } 1821 1822 shape, ok := value.(map[string]interface{}) 1823 if !ok { 1824 return fmt.Errorf("unexpected JSON type %v", value) 1825 } 1826 1827 var sv *CreateResourcePolicyOutput 1828 if *v == nil { 1829 sv = &CreateResourcePolicyOutput{} 1830 } else { 1831 sv = *v 1832 } 1833 1834 for key, value := range shape { 1835 switch key { 1836 case "resourceArn": 1837 if value != nil { 1838 jtv, ok := value.(string) 1839 if !ok { 1840 return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) 1841 } 1842 sv.ResourceArn = ptr.String(jtv) 1843 } 1844 1845 case "revisionId": 1846 if value != nil { 1847 jtv, ok := value.(string) 1848 if !ok { 1849 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 1850 } 1851 sv.RevisionId = ptr.String(jtv) 1852 } 1853 1854 default: 1855 _, _ = key, value 1856 1857 } 1858 } 1859 *v = sv 1860 return nil 1861} 1862 1863type awsRestjson1_deserializeOpCreateResourcePolicyStatement struct { 1864} 1865 1866func (*awsRestjson1_deserializeOpCreateResourcePolicyStatement) ID() string { 1867 return "OperationDeserializer" 1868} 1869 1870func (m *awsRestjson1_deserializeOpCreateResourcePolicyStatement) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1871 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1872) { 1873 out, metadata, err = next.HandleDeserialize(ctx, in) 1874 if err != nil { 1875 return out, metadata, err 1876 } 1877 1878 response, ok := out.RawResponse.(*smithyhttp.Response) 1879 if !ok { 1880 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1881 } 1882 1883 if response.StatusCode < 200 || response.StatusCode >= 300 { 1884 return out, metadata, awsRestjson1_deserializeOpErrorCreateResourcePolicyStatement(response, &metadata) 1885 } 1886 output := &CreateResourcePolicyStatementOutput{} 1887 out.Result = output 1888 1889 var buff [1024]byte 1890 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1891 1892 body := io.TeeReader(response.Body, ringBuffer) 1893 1894 decoder := json.NewDecoder(body) 1895 decoder.UseNumber() 1896 var shape interface{} 1897 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1898 var snapshot bytes.Buffer 1899 io.Copy(&snapshot, ringBuffer) 1900 err = &smithy.DeserializationError{ 1901 Err: fmt.Errorf("failed to decode response body, %w", err), 1902 Snapshot: snapshot.Bytes(), 1903 } 1904 return out, metadata, err 1905 } 1906 1907 err = awsRestjson1_deserializeOpDocumentCreateResourcePolicyStatementOutput(&output, shape) 1908 if err != nil { 1909 var snapshot bytes.Buffer 1910 io.Copy(&snapshot, ringBuffer) 1911 return out, metadata, &smithy.DeserializationError{ 1912 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1913 Snapshot: snapshot.Bytes(), 1914 } 1915 } 1916 1917 return out, metadata, err 1918} 1919 1920func awsRestjson1_deserializeOpErrorCreateResourcePolicyStatement(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1921 var errorBuffer bytes.Buffer 1922 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1923 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1924 } 1925 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1926 1927 errorCode := "UnknownError" 1928 errorMessage := errorCode 1929 1930 code := response.Header.Get("X-Amzn-ErrorType") 1931 if len(code) != 0 { 1932 errorCode = restjson.SanitizeErrorCode(code) 1933 } 1934 1935 var buff [1024]byte 1936 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1937 1938 body := io.TeeReader(errorBody, ringBuffer) 1939 decoder := json.NewDecoder(body) 1940 decoder.UseNumber() 1941 code, message, err := restjson.GetErrorInfo(decoder) 1942 if err != nil { 1943 var snapshot bytes.Buffer 1944 io.Copy(&snapshot, ringBuffer) 1945 err = &smithy.DeserializationError{ 1946 Err: fmt.Errorf("failed to decode response body, %w", err), 1947 Snapshot: snapshot.Bytes(), 1948 } 1949 return err 1950 } 1951 1952 errorBody.Seek(0, io.SeekStart) 1953 if len(code) != 0 { 1954 errorCode = restjson.SanitizeErrorCode(code) 1955 } 1956 if len(message) != 0 { 1957 errorMessage = message 1958 } 1959 1960 switch { 1961 case strings.EqualFold("ConflictException", errorCode): 1962 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1963 1964 case strings.EqualFold("InternalServerException", errorCode): 1965 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1966 1967 case strings.EqualFold("PreconditionFailedException", errorCode): 1968 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 1969 1970 case strings.EqualFold("ResourceNotFoundException", errorCode): 1971 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1972 1973 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1974 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1975 1976 case strings.EqualFold("ThrottlingException", errorCode): 1977 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1978 1979 case strings.EqualFold("ValidationException", errorCode): 1980 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1981 1982 default: 1983 genericError := &smithy.GenericAPIError{ 1984 Code: errorCode, 1985 Message: errorMessage, 1986 } 1987 return genericError 1988 1989 } 1990} 1991 1992func awsRestjson1_deserializeOpDocumentCreateResourcePolicyStatementOutput(v **CreateResourcePolicyStatementOutput, value interface{}) error { 1993 if v == nil { 1994 return fmt.Errorf("unexpected nil of type %T", v) 1995 } 1996 if value == nil { 1997 return nil 1998 } 1999 2000 shape, ok := value.(map[string]interface{}) 2001 if !ok { 2002 return fmt.Errorf("unexpected JSON type %v", value) 2003 } 2004 2005 var sv *CreateResourcePolicyStatementOutput 2006 if *v == nil { 2007 sv = &CreateResourcePolicyStatementOutput{} 2008 } else { 2009 sv = *v 2010 } 2011 2012 for key, value := range shape { 2013 switch key { 2014 case "resourceArn": 2015 if value != nil { 2016 jtv, ok := value.(string) 2017 if !ok { 2018 return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) 2019 } 2020 sv.ResourceArn = ptr.String(jtv) 2021 } 2022 2023 case "revisionId": 2024 if value != nil { 2025 jtv, ok := value.(string) 2026 if !ok { 2027 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 2028 } 2029 sv.RevisionId = ptr.String(jtv) 2030 } 2031 2032 default: 2033 _, _ = key, value 2034 2035 } 2036 } 2037 *v = sv 2038 return nil 2039} 2040 2041type awsRestjson1_deserializeOpCreateSlot struct { 2042} 2043 2044func (*awsRestjson1_deserializeOpCreateSlot) ID() string { 2045 return "OperationDeserializer" 2046} 2047 2048func (m *awsRestjson1_deserializeOpCreateSlot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2049 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2050) { 2051 out, metadata, err = next.HandleDeserialize(ctx, in) 2052 if err != nil { 2053 return out, metadata, err 2054 } 2055 2056 response, ok := out.RawResponse.(*smithyhttp.Response) 2057 if !ok { 2058 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2059 } 2060 2061 if response.StatusCode < 200 || response.StatusCode >= 300 { 2062 return out, metadata, awsRestjson1_deserializeOpErrorCreateSlot(response, &metadata) 2063 } 2064 output := &CreateSlotOutput{} 2065 out.Result = output 2066 2067 var buff [1024]byte 2068 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2069 2070 body := io.TeeReader(response.Body, ringBuffer) 2071 2072 decoder := json.NewDecoder(body) 2073 decoder.UseNumber() 2074 var shape interface{} 2075 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2076 var snapshot bytes.Buffer 2077 io.Copy(&snapshot, ringBuffer) 2078 err = &smithy.DeserializationError{ 2079 Err: fmt.Errorf("failed to decode response body, %w", err), 2080 Snapshot: snapshot.Bytes(), 2081 } 2082 return out, metadata, err 2083 } 2084 2085 err = awsRestjson1_deserializeOpDocumentCreateSlotOutput(&output, shape) 2086 if err != nil { 2087 var snapshot bytes.Buffer 2088 io.Copy(&snapshot, ringBuffer) 2089 return out, metadata, &smithy.DeserializationError{ 2090 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2091 Snapshot: snapshot.Bytes(), 2092 } 2093 } 2094 2095 return out, metadata, err 2096} 2097 2098func awsRestjson1_deserializeOpErrorCreateSlot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2099 var errorBuffer bytes.Buffer 2100 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2101 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2102 } 2103 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2104 2105 errorCode := "UnknownError" 2106 errorMessage := errorCode 2107 2108 code := response.Header.Get("X-Amzn-ErrorType") 2109 if len(code) != 0 { 2110 errorCode = restjson.SanitizeErrorCode(code) 2111 } 2112 2113 var buff [1024]byte 2114 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2115 2116 body := io.TeeReader(errorBody, ringBuffer) 2117 decoder := json.NewDecoder(body) 2118 decoder.UseNumber() 2119 code, message, err := restjson.GetErrorInfo(decoder) 2120 if err != nil { 2121 var snapshot bytes.Buffer 2122 io.Copy(&snapshot, ringBuffer) 2123 err = &smithy.DeserializationError{ 2124 Err: fmt.Errorf("failed to decode response body, %w", err), 2125 Snapshot: snapshot.Bytes(), 2126 } 2127 return err 2128 } 2129 2130 errorBody.Seek(0, io.SeekStart) 2131 if len(code) != 0 { 2132 errorCode = restjson.SanitizeErrorCode(code) 2133 } 2134 if len(message) != 0 { 2135 errorMessage = message 2136 } 2137 2138 switch { 2139 case strings.EqualFold("ConflictException", errorCode): 2140 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2141 2142 case strings.EqualFold("InternalServerException", errorCode): 2143 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2144 2145 case strings.EqualFold("PreconditionFailedException", errorCode): 2146 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2147 2148 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2149 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2150 2151 case strings.EqualFold("ThrottlingException", errorCode): 2152 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2153 2154 case strings.EqualFold("ValidationException", errorCode): 2155 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2156 2157 default: 2158 genericError := &smithy.GenericAPIError{ 2159 Code: errorCode, 2160 Message: errorMessage, 2161 } 2162 return genericError 2163 2164 } 2165} 2166 2167func awsRestjson1_deserializeOpDocumentCreateSlotOutput(v **CreateSlotOutput, value interface{}) error { 2168 if v == nil { 2169 return fmt.Errorf("unexpected nil of type %T", v) 2170 } 2171 if value == nil { 2172 return nil 2173 } 2174 2175 shape, ok := value.(map[string]interface{}) 2176 if !ok { 2177 return fmt.Errorf("unexpected JSON type %v", value) 2178 } 2179 2180 var sv *CreateSlotOutput 2181 if *v == nil { 2182 sv = &CreateSlotOutput{} 2183 } else { 2184 sv = *v 2185 } 2186 2187 for key, value := range shape { 2188 switch key { 2189 case "botId": 2190 if value != nil { 2191 jtv, ok := value.(string) 2192 if !ok { 2193 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2194 } 2195 sv.BotId = ptr.String(jtv) 2196 } 2197 2198 case "botVersion": 2199 if value != nil { 2200 jtv, ok := value.(string) 2201 if !ok { 2202 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 2203 } 2204 sv.BotVersion = ptr.String(jtv) 2205 } 2206 2207 case "creationDateTime": 2208 if value != nil { 2209 switch jtv := value.(type) { 2210 case json.Number: 2211 f64, err := jtv.Float64() 2212 if err != nil { 2213 return err 2214 } 2215 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 2216 2217 default: 2218 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 2219 2220 } 2221 } 2222 2223 case "description": 2224 if value != nil { 2225 jtv, ok := value.(string) 2226 if !ok { 2227 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 2228 } 2229 sv.Description = ptr.String(jtv) 2230 } 2231 2232 case "intentId": 2233 if value != nil { 2234 jtv, ok := value.(string) 2235 if !ok { 2236 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2237 } 2238 sv.IntentId = ptr.String(jtv) 2239 } 2240 2241 case "localeId": 2242 if value != nil { 2243 jtv, ok := value.(string) 2244 if !ok { 2245 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 2246 } 2247 sv.LocaleId = ptr.String(jtv) 2248 } 2249 2250 case "multipleValuesSetting": 2251 if err := awsRestjson1_deserializeDocumentMultipleValuesSetting(&sv.MultipleValuesSetting, value); err != nil { 2252 return err 2253 } 2254 2255 case "obfuscationSetting": 2256 if err := awsRestjson1_deserializeDocumentObfuscationSetting(&sv.ObfuscationSetting, value); err != nil { 2257 return err 2258 } 2259 2260 case "slotId": 2261 if value != nil { 2262 jtv, ok := value.(string) 2263 if !ok { 2264 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2265 } 2266 sv.SlotId = ptr.String(jtv) 2267 } 2268 2269 case "slotName": 2270 if value != nil { 2271 jtv, ok := value.(string) 2272 if !ok { 2273 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 2274 } 2275 sv.SlotName = ptr.String(jtv) 2276 } 2277 2278 case "slotTypeId": 2279 if value != nil { 2280 jtv, ok := value.(string) 2281 if !ok { 2282 return fmt.Errorf("expected BuiltInOrCustomSlotTypeId to be of type string, got %T instead", value) 2283 } 2284 sv.SlotTypeId = ptr.String(jtv) 2285 } 2286 2287 case "valueElicitationSetting": 2288 if err := awsRestjson1_deserializeDocumentSlotValueElicitationSetting(&sv.ValueElicitationSetting, value); err != nil { 2289 return err 2290 } 2291 2292 default: 2293 _, _ = key, value 2294 2295 } 2296 } 2297 *v = sv 2298 return nil 2299} 2300 2301type awsRestjson1_deserializeOpCreateSlotType struct { 2302} 2303 2304func (*awsRestjson1_deserializeOpCreateSlotType) ID() string { 2305 return "OperationDeserializer" 2306} 2307 2308func (m *awsRestjson1_deserializeOpCreateSlotType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2309 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2310) { 2311 out, metadata, err = next.HandleDeserialize(ctx, in) 2312 if err != nil { 2313 return out, metadata, err 2314 } 2315 2316 response, ok := out.RawResponse.(*smithyhttp.Response) 2317 if !ok { 2318 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2319 } 2320 2321 if response.StatusCode < 200 || response.StatusCode >= 300 { 2322 return out, metadata, awsRestjson1_deserializeOpErrorCreateSlotType(response, &metadata) 2323 } 2324 output := &CreateSlotTypeOutput{} 2325 out.Result = output 2326 2327 var buff [1024]byte 2328 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2329 2330 body := io.TeeReader(response.Body, ringBuffer) 2331 2332 decoder := json.NewDecoder(body) 2333 decoder.UseNumber() 2334 var shape interface{} 2335 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2336 var snapshot bytes.Buffer 2337 io.Copy(&snapshot, ringBuffer) 2338 err = &smithy.DeserializationError{ 2339 Err: fmt.Errorf("failed to decode response body, %w", err), 2340 Snapshot: snapshot.Bytes(), 2341 } 2342 return out, metadata, err 2343 } 2344 2345 err = awsRestjson1_deserializeOpDocumentCreateSlotTypeOutput(&output, shape) 2346 if err != nil { 2347 var snapshot bytes.Buffer 2348 io.Copy(&snapshot, ringBuffer) 2349 return out, metadata, &smithy.DeserializationError{ 2350 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2351 Snapshot: snapshot.Bytes(), 2352 } 2353 } 2354 2355 return out, metadata, err 2356} 2357 2358func awsRestjson1_deserializeOpErrorCreateSlotType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2359 var errorBuffer bytes.Buffer 2360 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2361 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2362 } 2363 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2364 2365 errorCode := "UnknownError" 2366 errorMessage := errorCode 2367 2368 code := response.Header.Get("X-Amzn-ErrorType") 2369 if len(code) != 0 { 2370 errorCode = restjson.SanitizeErrorCode(code) 2371 } 2372 2373 var buff [1024]byte 2374 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2375 2376 body := io.TeeReader(errorBody, ringBuffer) 2377 decoder := json.NewDecoder(body) 2378 decoder.UseNumber() 2379 code, message, err := restjson.GetErrorInfo(decoder) 2380 if err != nil { 2381 var snapshot bytes.Buffer 2382 io.Copy(&snapshot, ringBuffer) 2383 err = &smithy.DeserializationError{ 2384 Err: fmt.Errorf("failed to decode response body, %w", err), 2385 Snapshot: snapshot.Bytes(), 2386 } 2387 return err 2388 } 2389 2390 errorBody.Seek(0, io.SeekStart) 2391 if len(code) != 0 { 2392 errorCode = restjson.SanitizeErrorCode(code) 2393 } 2394 if len(message) != 0 { 2395 errorMessage = message 2396 } 2397 2398 switch { 2399 case strings.EqualFold("ConflictException", errorCode): 2400 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2401 2402 case strings.EqualFold("InternalServerException", errorCode): 2403 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2404 2405 case strings.EqualFold("PreconditionFailedException", errorCode): 2406 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2407 2408 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2409 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2410 2411 case strings.EqualFold("ThrottlingException", errorCode): 2412 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2413 2414 case strings.EqualFold("ValidationException", errorCode): 2415 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2416 2417 default: 2418 genericError := &smithy.GenericAPIError{ 2419 Code: errorCode, 2420 Message: errorMessage, 2421 } 2422 return genericError 2423 2424 } 2425} 2426 2427func awsRestjson1_deserializeOpDocumentCreateSlotTypeOutput(v **CreateSlotTypeOutput, value interface{}) error { 2428 if v == nil { 2429 return fmt.Errorf("unexpected nil of type %T", v) 2430 } 2431 if value == nil { 2432 return nil 2433 } 2434 2435 shape, ok := value.(map[string]interface{}) 2436 if !ok { 2437 return fmt.Errorf("unexpected JSON type %v", value) 2438 } 2439 2440 var sv *CreateSlotTypeOutput 2441 if *v == nil { 2442 sv = &CreateSlotTypeOutput{} 2443 } else { 2444 sv = *v 2445 } 2446 2447 for key, value := range shape { 2448 switch key { 2449 case "botId": 2450 if value != nil { 2451 jtv, ok := value.(string) 2452 if !ok { 2453 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2454 } 2455 sv.BotId = ptr.String(jtv) 2456 } 2457 2458 case "botVersion": 2459 if value != nil { 2460 jtv, ok := value.(string) 2461 if !ok { 2462 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 2463 } 2464 sv.BotVersion = ptr.String(jtv) 2465 } 2466 2467 case "creationDateTime": 2468 if value != nil { 2469 switch jtv := value.(type) { 2470 case json.Number: 2471 f64, err := jtv.Float64() 2472 if err != nil { 2473 return err 2474 } 2475 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 2476 2477 default: 2478 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 2479 2480 } 2481 } 2482 2483 case "description": 2484 if value != nil { 2485 jtv, ok := value.(string) 2486 if !ok { 2487 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 2488 } 2489 sv.Description = ptr.String(jtv) 2490 } 2491 2492 case "localeId": 2493 if value != nil { 2494 jtv, ok := value.(string) 2495 if !ok { 2496 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 2497 } 2498 sv.LocaleId = ptr.String(jtv) 2499 } 2500 2501 case "parentSlotTypeSignature": 2502 if value != nil { 2503 jtv, ok := value.(string) 2504 if !ok { 2505 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 2506 } 2507 sv.ParentSlotTypeSignature = ptr.String(jtv) 2508 } 2509 2510 case "slotTypeId": 2511 if value != nil { 2512 jtv, ok := value.(string) 2513 if !ok { 2514 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2515 } 2516 sv.SlotTypeId = ptr.String(jtv) 2517 } 2518 2519 case "slotTypeName": 2520 if value != nil { 2521 jtv, ok := value.(string) 2522 if !ok { 2523 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 2524 } 2525 sv.SlotTypeName = ptr.String(jtv) 2526 } 2527 2528 case "slotTypeValues": 2529 if err := awsRestjson1_deserializeDocumentSlotTypeValues(&sv.SlotTypeValues, value); err != nil { 2530 return err 2531 } 2532 2533 case "valueSelectionSetting": 2534 if err := awsRestjson1_deserializeDocumentSlotValueSelectionSetting(&sv.ValueSelectionSetting, value); err != nil { 2535 return err 2536 } 2537 2538 default: 2539 _, _ = key, value 2540 2541 } 2542 } 2543 *v = sv 2544 return nil 2545} 2546 2547type awsRestjson1_deserializeOpCreateUploadUrl struct { 2548} 2549 2550func (*awsRestjson1_deserializeOpCreateUploadUrl) ID() string { 2551 return "OperationDeserializer" 2552} 2553 2554func (m *awsRestjson1_deserializeOpCreateUploadUrl) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2555 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2556) { 2557 out, metadata, err = next.HandleDeserialize(ctx, in) 2558 if err != nil { 2559 return out, metadata, err 2560 } 2561 2562 response, ok := out.RawResponse.(*smithyhttp.Response) 2563 if !ok { 2564 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2565 } 2566 2567 if response.StatusCode < 200 || response.StatusCode >= 300 { 2568 return out, metadata, awsRestjson1_deserializeOpErrorCreateUploadUrl(response, &metadata) 2569 } 2570 output := &CreateUploadUrlOutput{} 2571 out.Result = output 2572 2573 var buff [1024]byte 2574 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2575 2576 body := io.TeeReader(response.Body, ringBuffer) 2577 2578 decoder := json.NewDecoder(body) 2579 decoder.UseNumber() 2580 var shape interface{} 2581 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2582 var snapshot bytes.Buffer 2583 io.Copy(&snapshot, ringBuffer) 2584 err = &smithy.DeserializationError{ 2585 Err: fmt.Errorf("failed to decode response body, %w", err), 2586 Snapshot: snapshot.Bytes(), 2587 } 2588 return out, metadata, err 2589 } 2590 2591 err = awsRestjson1_deserializeOpDocumentCreateUploadUrlOutput(&output, shape) 2592 if err != nil { 2593 var snapshot bytes.Buffer 2594 io.Copy(&snapshot, ringBuffer) 2595 return out, metadata, &smithy.DeserializationError{ 2596 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2597 Snapshot: snapshot.Bytes(), 2598 } 2599 } 2600 2601 return out, metadata, err 2602} 2603 2604func awsRestjson1_deserializeOpErrorCreateUploadUrl(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2605 var errorBuffer bytes.Buffer 2606 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2607 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2608 } 2609 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2610 2611 errorCode := "UnknownError" 2612 errorMessage := errorCode 2613 2614 code := response.Header.Get("X-Amzn-ErrorType") 2615 if len(code) != 0 { 2616 errorCode = restjson.SanitizeErrorCode(code) 2617 } 2618 2619 var buff [1024]byte 2620 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2621 2622 body := io.TeeReader(errorBody, ringBuffer) 2623 decoder := json.NewDecoder(body) 2624 decoder.UseNumber() 2625 code, message, err := restjson.GetErrorInfo(decoder) 2626 if err != nil { 2627 var snapshot bytes.Buffer 2628 io.Copy(&snapshot, ringBuffer) 2629 err = &smithy.DeserializationError{ 2630 Err: fmt.Errorf("failed to decode response body, %w", err), 2631 Snapshot: snapshot.Bytes(), 2632 } 2633 return err 2634 } 2635 2636 errorBody.Seek(0, io.SeekStart) 2637 if len(code) != 0 { 2638 errorCode = restjson.SanitizeErrorCode(code) 2639 } 2640 if len(message) != 0 { 2641 errorMessage = message 2642 } 2643 2644 switch { 2645 case strings.EqualFold("ConflictException", errorCode): 2646 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2647 2648 case strings.EqualFold("InternalServerException", errorCode): 2649 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2650 2651 case strings.EqualFold("ResourceNotFoundException", errorCode): 2652 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2653 2654 case strings.EqualFold("ThrottlingException", errorCode): 2655 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2656 2657 case strings.EqualFold("ValidationException", errorCode): 2658 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2659 2660 default: 2661 genericError := &smithy.GenericAPIError{ 2662 Code: errorCode, 2663 Message: errorMessage, 2664 } 2665 return genericError 2666 2667 } 2668} 2669 2670func awsRestjson1_deserializeOpDocumentCreateUploadUrlOutput(v **CreateUploadUrlOutput, value interface{}) error { 2671 if v == nil { 2672 return fmt.Errorf("unexpected nil of type %T", v) 2673 } 2674 if value == nil { 2675 return nil 2676 } 2677 2678 shape, ok := value.(map[string]interface{}) 2679 if !ok { 2680 return fmt.Errorf("unexpected JSON type %v", value) 2681 } 2682 2683 var sv *CreateUploadUrlOutput 2684 if *v == nil { 2685 sv = &CreateUploadUrlOutput{} 2686 } else { 2687 sv = *v 2688 } 2689 2690 for key, value := range shape { 2691 switch key { 2692 case "importId": 2693 if value != nil { 2694 jtv, ok := value.(string) 2695 if !ok { 2696 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2697 } 2698 sv.ImportId = ptr.String(jtv) 2699 } 2700 2701 case "uploadUrl": 2702 if value != nil { 2703 jtv, ok := value.(string) 2704 if !ok { 2705 return fmt.Errorf("expected PresignedS3Url to be of type string, got %T instead", value) 2706 } 2707 sv.UploadUrl = ptr.String(jtv) 2708 } 2709 2710 default: 2711 _, _ = key, value 2712 2713 } 2714 } 2715 *v = sv 2716 return nil 2717} 2718 2719type awsRestjson1_deserializeOpDeleteBot struct { 2720} 2721 2722func (*awsRestjson1_deserializeOpDeleteBot) ID() string { 2723 return "OperationDeserializer" 2724} 2725 2726func (m *awsRestjson1_deserializeOpDeleteBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2727 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2728) { 2729 out, metadata, err = next.HandleDeserialize(ctx, in) 2730 if err != nil { 2731 return out, metadata, err 2732 } 2733 2734 response, ok := out.RawResponse.(*smithyhttp.Response) 2735 if !ok { 2736 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2737 } 2738 2739 if response.StatusCode < 200 || response.StatusCode >= 300 { 2740 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBot(response, &metadata) 2741 } 2742 output := &DeleteBotOutput{} 2743 out.Result = output 2744 2745 var buff [1024]byte 2746 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2747 2748 body := io.TeeReader(response.Body, ringBuffer) 2749 2750 decoder := json.NewDecoder(body) 2751 decoder.UseNumber() 2752 var shape interface{} 2753 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2754 var snapshot bytes.Buffer 2755 io.Copy(&snapshot, ringBuffer) 2756 err = &smithy.DeserializationError{ 2757 Err: fmt.Errorf("failed to decode response body, %w", err), 2758 Snapshot: snapshot.Bytes(), 2759 } 2760 return out, metadata, err 2761 } 2762 2763 err = awsRestjson1_deserializeOpDocumentDeleteBotOutput(&output, shape) 2764 if err != nil { 2765 var snapshot bytes.Buffer 2766 io.Copy(&snapshot, ringBuffer) 2767 return out, metadata, &smithy.DeserializationError{ 2768 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2769 Snapshot: snapshot.Bytes(), 2770 } 2771 } 2772 2773 return out, metadata, err 2774} 2775 2776func awsRestjson1_deserializeOpErrorDeleteBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2777 var errorBuffer bytes.Buffer 2778 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2779 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2780 } 2781 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2782 2783 errorCode := "UnknownError" 2784 errorMessage := errorCode 2785 2786 code := response.Header.Get("X-Amzn-ErrorType") 2787 if len(code) != 0 { 2788 errorCode = restjson.SanitizeErrorCode(code) 2789 } 2790 2791 var buff [1024]byte 2792 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2793 2794 body := io.TeeReader(errorBody, ringBuffer) 2795 decoder := json.NewDecoder(body) 2796 decoder.UseNumber() 2797 code, message, err := restjson.GetErrorInfo(decoder) 2798 if err != nil { 2799 var snapshot bytes.Buffer 2800 io.Copy(&snapshot, ringBuffer) 2801 err = &smithy.DeserializationError{ 2802 Err: fmt.Errorf("failed to decode response body, %w", err), 2803 Snapshot: snapshot.Bytes(), 2804 } 2805 return err 2806 } 2807 2808 errorBody.Seek(0, io.SeekStart) 2809 if len(code) != 0 { 2810 errorCode = restjson.SanitizeErrorCode(code) 2811 } 2812 if len(message) != 0 { 2813 errorMessage = message 2814 } 2815 2816 switch { 2817 case strings.EqualFold("ConflictException", errorCode): 2818 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2819 2820 case strings.EqualFold("InternalServerException", errorCode): 2821 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2822 2823 case strings.EqualFold("PreconditionFailedException", errorCode): 2824 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2825 2826 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2827 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2828 2829 case strings.EqualFold("ThrottlingException", errorCode): 2830 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2831 2832 case strings.EqualFold("ValidationException", errorCode): 2833 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2834 2835 default: 2836 genericError := &smithy.GenericAPIError{ 2837 Code: errorCode, 2838 Message: errorMessage, 2839 } 2840 return genericError 2841 2842 } 2843} 2844 2845func awsRestjson1_deserializeOpDocumentDeleteBotOutput(v **DeleteBotOutput, value interface{}) error { 2846 if v == nil { 2847 return fmt.Errorf("unexpected nil of type %T", v) 2848 } 2849 if value == nil { 2850 return nil 2851 } 2852 2853 shape, ok := value.(map[string]interface{}) 2854 if !ok { 2855 return fmt.Errorf("unexpected JSON type %v", value) 2856 } 2857 2858 var sv *DeleteBotOutput 2859 if *v == nil { 2860 sv = &DeleteBotOutput{} 2861 } else { 2862 sv = *v 2863 } 2864 2865 for key, value := range shape { 2866 switch key { 2867 case "botId": 2868 if value != nil { 2869 jtv, ok := value.(string) 2870 if !ok { 2871 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2872 } 2873 sv.BotId = ptr.String(jtv) 2874 } 2875 2876 case "botStatus": 2877 if value != nil { 2878 jtv, ok := value.(string) 2879 if !ok { 2880 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 2881 } 2882 sv.BotStatus = types.BotStatus(jtv) 2883 } 2884 2885 default: 2886 _, _ = key, value 2887 2888 } 2889 } 2890 *v = sv 2891 return nil 2892} 2893 2894type awsRestjson1_deserializeOpDeleteBotAlias struct { 2895} 2896 2897func (*awsRestjson1_deserializeOpDeleteBotAlias) ID() string { 2898 return "OperationDeserializer" 2899} 2900 2901func (m *awsRestjson1_deserializeOpDeleteBotAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2902 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2903) { 2904 out, metadata, err = next.HandleDeserialize(ctx, in) 2905 if err != nil { 2906 return out, metadata, err 2907 } 2908 2909 response, ok := out.RawResponse.(*smithyhttp.Response) 2910 if !ok { 2911 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2912 } 2913 2914 if response.StatusCode < 200 || response.StatusCode >= 300 { 2915 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBotAlias(response, &metadata) 2916 } 2917 output := &DeleteBotAliasOutput{} 2918 out.Result = output 2919 2920 var buff [1024]byte 2921 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2922 2923 body := io.TeeReader(response.Body, ringBuffer) 2924 2925 decoder := json.NewDecoder(body) 2926 decoder.UseNumber() 2927 var shape interface{} 2928 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2929 var snapshot bytes.Buffer 2930 io.Copy(&snapshot, ringBuffer) 2931 err = &smithy.DeserializationError{ 2932 Err: fmt.Errorf("failed to decode response body, %w", err), 2933 Snapshot: snapshot.Bytes(), 2934 } 2935 return out, metadata, err 2936 } 2937 2938 err = awsRestjson1_deserializeOpDocumentDeleteBotAliasOutput(&output, shape) 2939 if err != nil { 2940 var snapshot bytes.Buffer 2941 io.Copy(&snapshot, ringBuffer) 2942 return out, metadata, &smithy.DeserializationError{ 2943 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2944 Snapshot: snapshot.Bytes(), 2945 } 2946 } 2947 2948 return out, metadata, err 2949} 2950 2951func awsRestjson1_deserializeOpErrorDeleteBotAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2952 var errorBuffer bytes.Buffer 2953 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2954 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2955 } 2956 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2957 2958 errorCode := "UnknownError" 2959 errorMessage := errorCode 2960 2961 code := response.Header.Get("X-Amzn-ErrorType") 2962 if len(code) != 0 { 2963 errorCode = restjson.SanitizeErrorCode(code) 2964 } 2965 2966 var buff [1024]byte 2967 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2968 2969 body := io.TeeReader(errorBody, ringBuffer) 2970 decoder := json.NewDecoder(body) 2971 decoder.UseNumber() 2972 code, message, err := restjson.GetErrorInfo(decoder) 2973 if err != nil { 2974 var snapshot bytes.Buffer 2975 io.Copy(&snapshot, ringBuffer) 2976 err = &smithy.DeserializationError{ 2977 Err: fmt.Errorf("failed to decode response body, %w", err), 2978 Snapshot: snapshot.Bytes(), 2979 } 2980 return err 2981 } 2982 2983 errorBody.Seek(0, io.SeekStart) 2984 if len(code) != 0 { 2985 errorCode = restjson.SanitizeErrorCode(code) 2986 } 2987 if len(message) != 0 { 2988 errorMessage = message 2989 } 2990 2991 switch { 2992 case strings.EqualFold("ConflictException", errorCode): 2993 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2994 2995 case strings.EqualFold("InternalServerException", errorCode): 2996 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2997 2998 case strings.EqualFold("PreconditionFailedException", errorCode): 2999 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 3000 3001 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3002 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3003 3004 case strings.EqualFold("ThrottlingException", errorCode): 3005 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3006 3007 case strings.EqualFold("ValidationException", errorCode): 3008 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3009 3010 default: 3011 genericError := &smithy.GenericAPIError{ 3012 Code: errorCode, 3013 Message: errorMessage, 3014 } 3015 return genericError 3016 3017 } 3018} 3019 3020func awsRestjson1_deserializeOpDocumentDeleteBotAliasOutput(v **DeleteBotAliasOutput, value interface{}) error { 3021 if v == nil { 3022 return fmt.Errorf("unexpected nil of type %T", v) 3023 } 3024 if value == nil { 3025 return nil 3026 } 3027 3028 shape, ok := value.(map[string]interface{}) 3029 if !ok { 3030 return fmt.Errorf("unexpected JSON type %v", value) 3031 } 3032 3033 var sv *DeleteBotAliasOutput 3034 if *v == nil { 3035 sv = &DeleteBotAliasOutput{} 3036 } else { 3037 sv = *v 3038 } 3039 3040 for key, value := range shape { 3041 switch key { 3042 case "botAliasId": 3043 if value != nil { 3044 jtv, ok := value.(string) 3045 if !ok { 3046 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 3047 } 3048 sv.BotAliasId = ptr.String(jtv) 3049 } 3050 3051 case "botAliasStatus": 3052 if value != nil { 3053 jtv, ok := value.(string) 3054 if !ok { 3055 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 3056 } 3057 sv.BotAliasStatus = types.BotAliasStatus(jtv) 3058 } 3059 3060 case "botId": 3061 if value != nil { 3062 jtv, ok := value.(string) 3063 if !ok { 3064 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3065 } 3066 sv.BotId = ptr.String(jtv) 3067 } 3068 3069 default: 3070 _, _ = key, value 3071 3072 } 3073 } 3074 *v = sv 3075 return nil 3076} 3077 3078type awsRestjson1_deserializeOpDeleteBotLocale struct { 3079} 3080 3081func (*awsRestjson1_deserializeOpDeleteBotLocale) ID() string { 3082 return "OperationDeserializer" 3083} 3084 3085func (m *awsRestjson1_deserializeOpDeleteBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3086 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3087) { 3088 out, metadata, err = next.HandleDeserialize(ctx, in) 3089 if err != nil { 3090 return out, metadata, err 3091 } 3092 3093 response, ok := out.RawResponse.(*smithyhttp.Response) 3094 if !ok { 3095 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3096 } 3097 3098 if response.StatusCode < 200 || response.StatusCode >= 300 { 3099 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBotLocale(response, &metadata) 3100 } 3101 output := &DeleteBotLocaleOutput{} 3102 out.Result = output 3103 3104 var buff [1024]byte 3105 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3106 3107 body := io.TeeReader(response.Body, ringBuffer) 3108 3109 decoder := json.NewDecoder(body) 3110 decoder.UseNumber() 3111 var shape interface{} 3112 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3113 var snapshot bytes.Buffer 3114 io.Copy(&snapshot, ringBuffer) 3115 err = &smithy.DeserializationError{ 3116 Err: fmt.Errorf("failed to decode response body, %w", err), 3117 Snapshot: snapshot.Bytes(), 3118 } 3119 return out, metadata, err 3120 } 3121 3122 err = awsRestjson1_deserializeOpDocumentDeleteBotLocaleOutput(&output, shape) 3123 if err != nil { 3124 var snapshot bytes.Buffer 3125 io.Copy(&snapshot, ringBuffer) 3126 return out, metadata, &smithy.DeserializationError{ 3127 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3128 Snapshot: snapshot.Bytes(), 3129 } 3130 } 3131 3132 return out, metadata, err 3133} 3134 3135func awsRestjson1_deserializeOpErrorDeleteBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3136 var errorBuffer bytes.Buffer 3137 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3138 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3139 } 3140 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3141 3142 errorCode := "UnknownError" 3143 errorMessage := errorCode 3144 3145 code := response.Header.Get("X-Amzn-ErrorType") 3146 if len(code) != 0 { 3147 errorCode = restjson.SanitizeErrorCode(code) 3148 } 3149 3150 var buff [1024]byte 3151 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3152 3153 body := io.TeeReader(errorBody, ringBuffer) 3154 decoder := json.NewDecoder(body) 3155 decoder.UseNumber() 3156 code, message, err := restjson.GetErrorInfo(decoder) 3157 if err != nil { 3158 var snapshot bytes.Buffer 3159 io.Copy(&snapshot, ringBuffer) 3160 err = &smithy.DeserializationError{ 3161 Err: fmt.Errorf("failed to decode response body, %w", err), 3162 Snapshot: snapshot.Bytes(), 3163 } 3164 return err 3165 } 3166 3167 errorBody.Seek(0, io.SeekStart) 3168 if len(code) != 0 { 3169 errorCode = restjson.SanitizeErrorCode(code) 3170 } 3171 if len(message) != 0 { 3172 errorMessage = message 3173 } 3174 3175 switch { 3176 case strings.EqualFold("ConflictException", errorCode): 3177 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 3178 3179 case strings.EqualFold("InternalServerException", errorCode): 3180 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3181 3182 case strings.EqualFold("PreconditionFailedException", errorCode): 3183 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 3184 3185 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3186 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3187 3188 case strings.EqualFold("ThrottlingException", errorCode): 3189 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3190 3191 case strings.EqualFold("ValidationException", errorCode): 3192 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3193 3194 default: 3195 genericError := &smithy.GenericAPIError{ 3196 Code: errorCode, 3197 Message: errorMessage, 3198 } 3199 return genericError 3200 3201 } 3202} 3203 3204func awsRestjson1_deserializeOpDocumentDeleteBotLocaleOutput(v **DeleteBotLocaleOutput, value interface{}) error { 3205 if v == nil { 3206 return fmt.Errorf("unexpected nil of type %T", v) 3207 } 3208 if value == nil { 3209 return nil 3210 } 3211 3212 shape, ok := value.(map[string]interface{}) 3213 if !ok { 3214 return fmt.Errorf("unexpected JSON type %v", value) 3215 } 3216 3217 var sv *DeleteBotLocaleOutput 3218 if *v == nil { 3219 sv = &DeleteBotLocaleOutput{} 3220 } else { 3221 sv = *v 3222 } 3223 3224 for key, value := range shape { 3225 switch key { 3226 case "botId": 3227 if value != nil { 3228 jtv, ok := value.(string) 3229 if !ok { 3230 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3231 } 3232 sv.BotId = ptr.String(jtv) 3233 } 3234 3235 case "botLocaleStatus": 3236 if value != nil { 3237 jtv, ok := value.(string) 3238 if !ok { 3239 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 3240 } 3241 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 3242 } 3243 3244 case "botVersion": 3245 if value != nil { 3246 jtv, ok := value.(string) 3247 if !ok { 3248 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 3249 } 3250 sv.BotVersion = ptr.String(jtv) 3251 } 3252 3253 case "localeId": 3254 if value != nil { 3255 jtv, ok := value.(string) 3256 if !ok { 3257 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 3258 } 3259 sv.LocaleId = ptr.String(jtv) 3260 } 3261 3262 default: 3263 _, _ = key, value 3264 3265 } 3266 } 3267 *v = sv 3268 return nil 3269} 3270 3271type awsRestjson1_deserializeOpDeleteBotVersion struct { 3272} 3273 3274func (*awsRestjson1_deserializeOpDeleteBotVersion) ID() string { 3275 return "OperationDeserializer" 3276} 3277 3278func (m *awsRestjson1_deserializeOpDeleteBotVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3279 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3280) { 3281 out, metadata, err = next.HandleDeserialize(ctx, in) 3282 if err != nil { 3283 return out, metadata, err 3284 } 3285 3286 response, ok := out.RawResponse.(*smithyhttp.Response) 3287 if !ok { 3288 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3289 } 3290 3291 if response.StatusCode < 200 || response.StatusCode >= 300 { 3292 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBotVersion(response, &metadata) 3293 } 3294 output := &DeleteBotVersionOutput{} 3295 out.Result = output 3296 3297 var buff [1024]byte 3298 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3299 3300 body := io.TeeReader(response.Body, ringBuffer) 3301 3302 decoder := json.NewDecoder(body) 3303 decoder.UseNumber() 3304 var shape interface{} 3305 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3306 var snapshot bytes.Buffer 3307 io.Copy(&snapshot, ringBuffer) 3308 err = &smithy.DeserializationError{ 3309 Err: fmt.Errorf("failed to decode response body, %w", err), 3310 Snapshot: snapshot.Bytes(), 3311 } 3312 return out, metadata, err 3313 } 3314 3315 err = awsRestjson1_deserializeOpDocumentDeleteBotVersionOutput(&output, shape) 3316 if err != nil { 3317 var snapshot bytes.Buffer 3318 io.Copy(&snapshot, ringBuffer) 3319 return out, metadata, &smithy.DeserializationError{ 3320 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3321 Snapshot: snapshot.Bytes(), 3322 } 3323 } 3324 3325 return out, metadata, err 3326} 3327 3328func awsRestjson1_deserializeOpErrorDeleteBotVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3329 var errorBuffer bytes.Buffer 3330 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3331 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3332 } 3333 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3334 3335 errorCode := "UnknownError" 3336 errorMessage := errorCode 3337 3338 code := response.Header.Get("X-Amzn-ErrorType") 3339 if len(code) != 0 { 3340 errorCode = restjson.SanitizeErrorCode(code) 3341 } 3342 3343 var buff [1024]byte 3344 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3345 3346 body := io.TeeReader(errorBody, ringBuffer) 3347 decoder := json.NewDecoder(body) 3348 decoder.UseNumber() 3349 code, message, err := restjson.GetErrorInfo(decoder) 3350 if err != nil { 3351 var snapshot bytes.Buffer 3352 io.Copy(&snapshot, ringBuffer) 3353 err = &smithy.DeserializationError{ 3354 Err: fmt.Errorf("failed to decode response body, %w", err), 3355 Snapshot: snapshot.Bytes(), 3356 } 3357 return err 3358 } 3359 3360 errorBody.Seek(0, io.SeekStart) 3361 if len(code) != 0 { 3362 errorCode = restjson.SanitizeErrorCode(code) 3363 } 3364 if len(message) != 0 { 3365 errorMessage = message 3366 } 3367 3368 switch { 3369 case strings.EqualFold("ConflictException", errorCode): 3370 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 3371 3372 case strings.EqualFold("InternalServerException", errorCode): 3373 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3374 3375 case strings.EqualFold("PreconditionFailedException", errorCode): 3376 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 3377 3378 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3379 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3380 3381 case strings.EqualFold("ThrottlingException", errorCode): 3382 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3383 3384 case strings.EqualFold("ValidationException", errorCode): 3385 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3386 3387 default: 3388 genericError := &smithy.GenericAPIError{ 3389 Code: errorCode, 3390 Message: errorMessage, 3391 } 3392 return genericError 3393 3394 } 3395} 3396 3397func awsRestjson1_deserializeOpDocumentDeleteBotVersionOutput(v **DeleteBotVersionOutput, value interface{}) error { 3398 if v == nil { 3399 return fmt.Errorf("unexpected nil of type %T", v) 3400 } 3401 if value == nil { 3402 return nil 3403 } 3404 3405 shape, ok := value.(map[string]interface{}) 3406 if !ok { 3407 return fmt.Errorf("unexpected JSON type %v", value) 3408 } 3409 3410 var sv *DeleteBotVersionOutput 3411 if *v == nil { 3412 sv = &DeleteBotVersionOutput{} 3413 } else { 3414 sv = *v 3415 } 3416 3417 for key, value := range shape { 3418 switch key { 3419 case "botId": 3420 if value != nil { 3421 jtv, ok := value.(string) 3422 if !ok { 3423 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3424 } 3425 sv.BotId = ptr.String(jtv) 3426 } 3427 3428 case "botStatus": 3429 if value != nil { 3430 jtv, ok := value.(string) 3431 if !ok { 3432 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 3433 } 3434 sv.BotStatus = types.BotStatus(jtv) 3435 } 3436 3437 case "botVersion": 3438 if value != nil { 3439 jtv, ok := value.(string) 3440 if !ok { 3441 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 3442 } 3443 sv.BotVersion = ptr.String(jtv) 3444 } 3445 3446 default: 3447 _, _ = key, value 3448 3449 } 3450 } 3451 *v = sv 3452 return nil 3453} 3454 3455type awsRestjson1_deserializeOpDeleteExport struct { 3456} 3457 3458func (*awsRestjson1_deserializeOpDeleteExport) ID() string { 3459 return "OperationDeserializer" 3460} 3461 3462func (m *awsRestjson1_deserializeOpDeleteExport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3463 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3464) { 3465 out, metadata, err = next.HandleDeserialize(ctx, in) 3466 if err != nil { 3467 return out, metadata, err 3468 } 3469 3470 response, ok := out.RawResponse.(*smithyhttp.Response) 3471 if !ok { 3472 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3473 } 3474 3475 if response.StatusCode < 200 || response.StatusCode >= 300 { 3476 return out, metadata, awsRestjson1_deserializeOpErrorDeleteExport(response, &metadata) 3477 } 3478 output := &DeleteExportOutput{} 3479 out.Result = output 3480 3481 var buff [1024]byte 3482 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3483 3484 body := io.TeeReader(response.Body, ringBuffer) 3485 3486 decoder := json.NewDecoder(body) 3487 decoder.UseNumber() 3488 var shape interface{} 3489 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3490 var snapshot bytes.Buffer 3491 io.Copy(&snapshot, ringBuffer) 3492 err = &smithy.DeserializationError{ 3493 Err: fmt.Errorf("failed to decode response body, %w", err), 3494 Snapshot: snapshot.Bytes(), 3495 } 3496 return out, metadata, err 3497 } 3498 3499 err = awsRestjson1_deserializeOpDocumentDeleteExportOutput(&output, shape) 3500 if err != nil { 3501 var snapshot bytes.Buffer 3502 io.Copy(&snapshot, ringBuffer) 3503 return out, metadata, &smithy.DeserializationError{ 3504 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3505 Snapshot: snapshot.Bytes(), 3506 } 3507 } 3508 3509 return out, metadata, err 3510} 3511 3512func awsRestjson1_deserializeOpErrorDeleteExport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3513 var errorBuffer bytes.Buffer 3514 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3515 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3516 } 3517 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3518 3519 errorCode := "UnknownError" 3520 errorMessage := errorCode 3521 3522 code := response.Header.Get("X-Amzn-ErrorType") 3523 if len(code) != 0 { 3524 errorCode = restjson.SanitizeErrorCode(code) 3525 } 3526 3527 var buff [1024]byte 3528 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3529 3530 body := io.TeeReader(errorBody, ringBuffer) 3531 decoder := json.NewDecoder(body) 3532 decoder.UseNumber() 3533 code, message, err := restjson.GetErrorInfo(decoder) 3534 if err != nil { 3535 var snapshot bytes.Buffer 3536 io.Copy(&snapshot, ringBuffer) 3537 err = &smithy.DeserializationError{ 3538 Err: fmt.Errorf("failed to decode response body, %w", err), 3539 Snapshot: snapshot.Bytes(), 3540 } 3541 return err 3542 } 3543 3544 errorBody.Seek(0, io.SeekStart) 3545 if len(code) != 0 { 3546 errorCode = restjson.SanitizeErrorCode(code) 3547 } 3548 if len(message) != 0 { 3549 errorMessage = message 3550 } 3551 3552 switch { 3553 case strings.EqualFold("InternalServerException", errorCode): 3554 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3555 3556 case strings.EqualFold("PreconditionFailedException", errorCode): 3557 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 3558 3559 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3560 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3561 3562 case strings.EqualFold("ThrottlingException", errorCode): 3563 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3564 3565 case strings.EqualFold("ValidationException", errorCode): 3566 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3567 3568 default: 3569 genericError := &smithy.GenericAPIError{ 3570 Code: errorCode, 3571 Message: errorMessage, 3572 } 3573 return genericError 3574 3575 } 3576} 3577 3578func awsRestjson1_deserializeOpDocumentDeleteExportOutput(v **DeleteExportOutput, value interface{}) error { 3579 if v == nil { 3580 return fmt.Errorf("unexpected nil of type %T", v) 3581 } 3582 if value == nil { 3583 return nil 3584 } 3585 3586 shape, ok := value.(map[string]interface{}) 3587 if !ok { 3588 return fmt.Errorf("unexpected JSON type %v", value) 3589 } 3590 3591 var sv *DeleteExportOutput 3592 if *v == nil { 3593 sv = &DeleteExportOutput{} 3594 } else { 3595 sv = *v 3596 } 3597 3598 for key, value := range shape { 3599 switch key { 3600 case "exportId": 3601 if value != nil { 3602 jtv, ok := value.(string) 3603 if !ok { 3604 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3605 } 3606 sv.ExportId = ptr.String(jtv) 3607 } 3608 3609 case "exportStatus": 3610 if value != nil { 3611 jtv, ok := value.(string) 3612 if !ok { 3613 return fmt.Errorf("expected ExportStatus to be of type string, got %T instead", value) 3614 } 3615 sv.ExportStatus = types.ExportStatus(jtv) 3616 } 3617 3618 default: 3619 _, _ = key, value 3620 3621 } 3622 } 3623 *v = sv 3624 return nil 3625} 3626 3627type awsRestjson1_deserializeOpDeleteImport struct { 3628} 3629 3630func (*awsRestjson1_deserializeOpDeleteImport) ID() string { 3631 return "OperationDeserializer" 3632} 3633 3634func (m *awsRestjson1_deserializeOpDeleteImport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3635 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3636) { 3637 out, metadata, err = next.HandleDeserialize(ctx, in) 3638 if err != nil { 3639 return out, metadata, err 3640 } 3641 3642 response, ok := out.RawResponse.(*smithyhttp.Response) 3643 if !ok { 3644 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3645 } 3646 3647 if response.StatusCode < 200 || response.StatusCode >= 300 { 3648 return out, metadata, awsRestjson1_deserializeOpErrorDeleteImport(response, &metadata) 3649 } 3650 output := &DeleteImportOutput{} 3651 out.Result = output 3652 3653 var buff [1024]byte 3654 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3655 3656 body := io.TeeReader(response.Body, ringBuffer) 3657 3658 decoder := json.NewDecoder(body) 3659 decoder.UseNumber() 3660 var shape interface{} 3661 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3662 var snapshot bytes.Buffer 3663 io.Copy(&snapshot, ringBuffer) 3664 err = &smithy.DeserializationError{ 3665 Err: fmt.Errorf("failed to decode response body, %w", err), 3666 Snapshot: snapshot.Bytes(), 3667 } 3668 return out, metadata, err 3669 } 3670 3671 err = awsRestjson1_deserializeOpDocumentDeleteImportOutput(&output, shape) 3672 if err != nil { 3673 var snapshot bytes.Buffer 3674 io.Copy(&snapshot, ringBuffer) 3675 return out, metadata, &smithy.DeserializationError{ 3676 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3677 Snapshot: snapshot.Bytes(), 3678 } 3679 } 3680 3681 return out, metadata, err 3682} 3683 3684func awsRestjson1_deserializeOpErrorDeleteImport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3685 var errorBuffer bytes.Buffer 3686 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3687 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3688 } 3689 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3690 3691 errorCode := "UnknownError" 3692 errorMessage := errorCode 3693 3694 code := response.Header.Get("X-Amzn-ErrorType") 3695 if len(code) != 0 { 3696 errorCode = restjson.SanitizeErrorCode(code) 3697 } 3698 3699 var buff [1024]byte 3700 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3701 3702 body := io.TeeReader(errorBody, ringBuffer) 3703 decoder := json.NewDecoder(body) 3704 decoder.UseNumber() 3705 code, message, err := restjson.GetErrorInfo(decoder) 3706 if err != nil { 3707 var snapshot bytes.Buffer 3708 io.Copy(&snapshot, ringBuffer) 3709 err = &smithy.DeserializationError{ 3710 Err: fmt.Errorf("failed to decode response body, %w", err), 3711 Snapshot: snapshot.Bytes(), 3712 } 3713 return err 3714 } 3715 3716 errorBody.Seek(0, io.SeekStart) 3717 if len(code) != 0 { 3718 errorCode = restjson.SanitizeErrorCode(code) 3719 } 3720 if len(message) != 0 { 3721 errorMessage = message 3722 } 3723 3724 switch { 3725 case strings.EqualFold("InternalServerException", errorCode): 3726 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3727 3728 case strings.EqualFold("PreconditionFailedException", errorCode): 3729 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 3730 3731 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3732 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3733 3734 case strings.EqualFold("ThrottlingException", errorCode): 3735 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3736 3737 case strings.EqualFold("ValidationException", errorCode): 3738 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3739 3740 default: 3741 genericError := &smithy.GenericAPIError{ 3742 Code: errorCode, 3743 Message: errorMessage, 3744 } 3745 return genericError 3746 3747 } 3748} 3749 3750func awsRestjson1_deserializeOpDocumentDeleteImportOutput(v **DeleteImportOutput, value interface{}) error { 3751 if v == nil { 3752 return fmt.Errorf("unexpected nil of type %T", v) 3753 } 3754 if value == nil { 3755 return nil 3756 } 3757 3758 shape, ok := value.(map[string]interface{}) 3759 if !ok { 3760 return fmt.Errorf("unexpected JSON type %v", value) 3761 } 3762 3763 var sv *DeleteImportOutput 3764 if *v == nil { 3765 sv = &DeleteImportOutput{} 3766 } else { 3767 sv = *v 3768 } 3769 3770 for key, value := range shape { 3771 switch key { 3772 case "importId": 3773 if value != nil { 3774 jtv, ok := value.(string) 3775 if !ok { 3776 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3777 } 3778 sv.ImportId = ptr.String(jtv) 3779 } 3780 3781 case "importStatus": 3782 if value != nil { 3783 jtv, ok := value.(string) 3784 if !ok { 3785 return fmt.Errorf("expected ImportStatus to be of type string, got %T instead", value) 3786 } 3787 sv.ImportStatus = types.ImportStatus(jtv) 3788 } 3789 3790 default: 3791 _, _ = key, value 3792 3793 } 3794 } 3795 *v = sv 3796 return nil 3797} 3798 3799type awsRestjson1_deserializeOpDeleteIntent struct { 3800} 3801 3802func (*awsRestjson1_deserializeOpDeleteIntent) ID() string { 3803 return "OperationDeserializer" 3804} 3805 3806func (m *awsRestjson1_deserializeOpDeleteIntent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3807 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3808) { 3809 out, metadata, err = next.HandleDeserialize(ctx, in) 3810 if err != nil { 3811 return out, metadata, err 3812 } 3813 3814 response, ok := out.RawResponse.(*smithyhttp.Response) 3815 if !ok { 3816 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3817 } 3818 3819 if response.StatusCode < 200 || response.StatusCode >= 300 { 3820 return out, metadata, awsRestjson1_deserializeOpErrorDeleteIntent(response, &metadata) 3821 } 3822 output := &DeleteIntentOutput{} 3823 out.Result = output 3824 3825 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 3826 return out, metadata, &smithy.DeserializationError{ 3827 Err: fmt.Errorf("failed to discard response body, %w", err), 3828 } 3829 } 3830 3831 return out, metadata, err 3832} 3833 3834func awsRestjson1_deserializeOpErrorDeleteIntent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3835 var errorBuffer bytes.Buffer 3836 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3837 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3838 } 3839 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3840 3841 errorCode := "UnknownError" 3842 errorMessage := errorCode 3843 3844 code := response.Header.Get("X-Amzn-ErrorType") 3845 if len(code) != 0 { 3846 errorCode = restjson.SanitizeErrorCode(code) 3847 } 3848 3849 var buff [1024]byte 3850 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3851 3852 body := io.TeeReader(errorBody, ringBuffer) 3853 decoder := json.NewDecoder(body) 3854 decoder.UseNumber() 3855 code, message, err := restjson.GetErrorInfo(decoder) 3856 if err != nil { 3857 var snapshot bytes.Buffer 3858 io.Copy(&snapshot, ringBuffer) 3859 err = &smithy.DeserializationError{ 3860 Err: fmt.Errorf("failed to decode response body, %w", err), 3861 Snapshot: snapshot.Bytes(), 3862 } 3863 return err 3864 } 3865 3866 errorBody.Seek(0, io.SeekStart) 3867 if len(code) != 0 { 3868 errorCode = restjson.SanitizeErrorCode(code) 3869 } 3870 if len(message) != 0 { 3871 errorMessage = message 3872 } 3873 3874 switch { 3875 case strings.EqualFold("ConflictException", errorCode): 3876 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 3877 3878 case strings.EqualFold("InternalServerException", errorCode): 3879 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3880 3881 case strings.EqualFold("PreconditionFailedException", errorCode): 3882 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 3883 3884 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3885 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3886 3887 case strings.EqualFold("ThrottlingException", errorCode): 3888 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3889 3890 case strings.EqualFold("ValidationException", errorCode): 3891 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3892 3893 default: 3894 genericError := &smithy.GenericAPIError{ 3895 Code: errorCode, 3896 Message: errorMessage, 3897 } 3898 return genericError 3899 3900 } 3901} 3902 3903type awsRestjson1_deserializeOpDeleteResourcePolicy struct { 3904} 3905 3906func (*awsRestjson1_deserializeOpDeleteResourcePolicy) ID() string { 3907 return "OperationDeserializer" 3908} 3909 3910func (m *awsRestjson1_deserializeOpDeleteResourcePolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3911 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3912) { 3913 out, metadata, err = next.HandleDeserialize(ctx, in) 3914 if err != nil { 3915 return out, metadata, err 3916 } 3917 3918 response, ok := out.RawResponse.(*smithyhttp.Response) 3919 if !ok { 3920 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3921 } 3922 3923 if response.StatusCode < 200 || response.StatusCode >= 300 { 3924 return out, metadata, awsRestjson1_deserializeOpErrorDeleteResourcePolicy(response, &metadata) 3925 } 3926 output := &DeleteResourcePolicyOutput{} 3927 out.Result = output 3928 3929 var buff [1024]byte 3930 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3931 3932 body := io.TeeReader(response.Body, ringBuffer) 3933 3934 decoder := json.NewDecoder(body) 3935 decoder.UseNumber() 3936 var shape interface{} 3937 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3938 var snapshot bytes.Buffer 3939 io.Copy(&snapshot, ringBuffer) 3940 err = &smithy.DeserializationError{ 3941 Err: fmt.Errorf("failed to decode response body, %w", err), 3942 Snapshot: snapshot.Bytes(), 3943 } 3944 return out, metadata, err 3945 } 3946 3947 err = awsRestjson1_deserializeOpDocumentDeleteResourcePolicyOutput(&output, shape) 3948 if err != nil { 3949 var snapshot bytes.Buffer 3950 io.Copy(&snapshot, ringBuffer) 3951 return out, metadata, &smithy.DeserializationError{ 3952 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3953 Snapshot: snapshot.Bytes(), 3954 } 3955 } 3956 3957 return out, metadata, err 3958} 3959 3960func awsRestjson1_deserializeOpErrorDeleteResourcePolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3961 var errorBuffer bytes.Buffer 3962 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3963 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3964 } 3965 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3966 3967 errorCode := "UnknownError" 3968 errorMessage := errorCode 3969 3970 code := response.Header.Get("X-Amzn-ErrorType") 3971 if len(code) != 0 { 3972 errorCode = restjson.SanitizeErrorCode(code) 3973 } 3974 3975 var buff [1024]byte 3976 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3977 3978 body := io.TeeReader(errorBody, ringBuffer) 3979 decoder := json.NewDecoder(body) 3980 decoder.UseNumber() 3981 code, message, err := restjson.GetErrorInfo(decoder) 3982 if err != nil { 3983 var snapshot bytes.Buffer 3984 io.Copy(&snapshot, ringBuffer) 3985 err = &smithy.DeserializationError{ 3986 Err: fmt.Errorf("failed to decode response body, %w", err), 3987 Snapshot: snapshot.Bytes(), 3988 } 3989 return err 3990 } 3991 3992 errorBody.Seek(0, io.SeekStart) 3993 if len(code) != 0 { 3994 errorCode = restjson.SanitizeErrorCode(code) 3995 } 3996 if len(message) != 0 { 3997 errorMessage = message 3998 } 3999 4000 switch { 4001 case strings.EqualFold("InternalServerException", errorCode): 4002 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4003 4004 case strings.EqualFold("PreconditionFailedException", errorCode): 4005 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 4006 4007 case strings.EqualFold("ResourceNotFoundException", errorCode): 4008 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4009 4010 case strings.EqualFold("ThrottlingException", errorCode): 4011 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4012 4013 default: 4014 genericError := &smithy.GenericAPIError{ 4015 Code: errorCode, 4016 Message: errorMessage, 4017 } 4018 return genericError 4019 4020 } 4021} 4022 4023func awsRestjson1_deserializeOpDocumentDeleteResourcePolicyOutput(v **DeleteResourcePolicyOutput, value interface{}) error { 4024 if v == nil { 4025 return fmt.Errorf("unexpected nil of type %T", v) 4026 } 4027 if value == nil { 4028 return nil 4029 } 4030 4031 shape, ok := value.(map[string]interface{}) 4032 if !ok { 4033 return fmt.Errorf("unexpected JSON type %v", value) 4034 } 4035 4036 var sv *DeleteResourcePolicyOutput 4037 if *v == nil { 4038 sv = &DeleteResourcePolicyOutput{} 4039 } else { 4040 sv = *v 4041 } 4042 4043 for key, value := range shape { 4044 switch key { 4045 case "resourceArn": 4046 if value != nil { 4047 jtv, ok := value.(string) 4048 if !ok { 4049 return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) 4050 } 4051 sv.ResourceArn = ptr.String(jtv) 4052 } 4053 4054 case "revisionId": 4055 if value != nil { 4056 jtv, ok := value.(string) 4057 if !ok { 4058 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 4059 } 4060 sv.RevisionId = ptr.String(jtv) 4061 } 4062 4063 default: 4064 _, _ = key, value 4065 4066 } 4067 } 4068 *v = sv 4069 return nil 4070} 4071 4072type awsRestjson1_deserializeOpDeleteResourcePolicyStatement struct { 4073} 4074 4075func (*awsRestjson1_deserializeOpDeleteResourcePolicyStatement) ID() string { 4076 return "OperationDeserializer" 4077} 4078 4079func (m *awsRestjson1_deserializeOpDeleteResourcePolicyStatement) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4080 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4081) { 4082 out, metadata, err = next.HandleDeserialize(ctx, in) 4083 if err != nil { 4084 return out, metadata, err 4085 } 4086 4087 response, ok := out.RawResponse.(*smithyhttp.Response) 4088 if !ok { 4089 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4090 } 4091 4092 if response.StatusCode < 200 || response.StatusCode >= 300 { 4093 return out, metadata, awsRestjson1_deserializeOpErrorDeleteResourcePolicyStatement(response, &metadata) 4094 } 4095 output := &DeleteResourcePolicyStatementOutput{} 4096 out.Result = output 4097 4098 var buff [1024]byte 4099 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4100 4101 body := io.TeeReader(response.Body, ringBuffer) 4102 4103 decoder := json.NewDecoder(body) 4104 decoder.UseNumber() 4105 var shape interface{} 4106 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4107 var snapshot bytes.Buffer 4108 io.Copy(&snapshot, ringBuffer) 4109 err = &smithy.DeserializationError{ 4110 Err: fmt.Errorf("failed to decode response body, %w", err), 4111 Snapshot: snapshot.Bytes(), 4112 } 4113 return out, metadata, err 4114 } 4115 4116 err = awsRestjson1_deserializeOpDocumentDeleteResourcePolicyStatementOutput(&output, shape) 4117 if err != nil { 4118 var snapshot bytes.Buffer 4119 io.Copy(&snapshot, ringBuffer) 4120 return out, metadata, &smithy.DeserializationError{ 4121 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4122 Snapshot: snapshot.Bytes(), 4123 } 4124 } 4125 4126 return out, metadata, err 4127} 4128 4129func awsRestjson1_deserializeOpErrorDeleteResourcePolicyStatement(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4130 var errorBuffer bytes.Buffer 4131 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4132 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4133 } 4134 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4135 4136 errorCode := "UnknownError" 4137 errorMessage := errorCode 4138 4139 code := response.Header.Get("X-Amzn-ErrorType") 4140 if len(code) != 0 { 4141 errorCode = restjson.SanitizeErrorCode(code) 4142 } 4143 4144 var buff [1024]byte 4145 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4146 4147 body := io.TeeReader(errorBody, ringBuffer) 4148 decoder := json.NewDecoder(body) 4149 decoder.UseNumber() 4150 code, message, err := restjson.GetErrorInfo(decoder) 4151 if err != nil { 4152 var snapshot bytes.Buffer 4153 io.Copy(&snapshot, ringBuffer) 4154 err = &smithy.DeserializationError{ 4155 Err: fmt.Errorf("failed to decode response body, %w", err), 4156 Snapshot: snapshot.Bytes(), 4157 } 4158 return err 4159 } 4160 4161 errorBody.Seek(0, io.SeekStart) 4162 if len(code) != 0 { 4163 errorCode = restjson.SanitizeErrorCode(code) 4164 } 4165 if len(message) != 0 { 4166 errorMessage = message 4167 } 4168 4169 switch { 4170 case strings.EqualFold("InternalServerException", errorCode): 4171 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4172 4173 case strings.EqualFold("PreconditionFailedException", errorCode): 4174 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 4175 4176 case strings.EqualFold("ResourceNotFoundException", errorCode): 4177 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4178 4179 case strings.EqualFold("ThrottlingException", errorCode): 4180 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4181 4182 default: 4183 genericError := &smithy.GenericAPIError{ 4184 Code: errorCode, 4185 Message: errorMessage, 4186 } 4187 return genericError 4188 4189 } 4190} 4191 4192func awsRestjson1_deserializeOpDocumentDeleteResourcePolicyStatementOutput(v **DeleteResourcePolicyStatementOutput, value interface{}) error { 4193 if v == nil { 4194 return fmt.Errorf("unexpected nil of type %T", v) 4195 } 4196 if value == nil { 4197 return nil 4198 } 4199 4200 shape, ok := value.(map[string]interface{}) 4201 if !ok { 4202 return fmt.Errorf("unexpected JSON type %v", value) 4203 } 4204 4205 var sv *DeleteResourcePolicyStatementOutput 4206 if *v == nil { 4207 sv = &DeleteResourcePolicyStatementOutput{} 4208 } else { 4209 sv = *v 4210 } 4211 4212 for key, value := range shape { 4213 switch key { 4214 case "resourceArn": 4215 if value != nil { 4216 jtv, ok := value.(string) 4217 if !ok { 4218 return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) 4219 } 4220 sv.ResourceArn = ptr.String(jtv) 4221 } 4222 4223 case "revisionId": 4224 if value != nil { 4225 jtv, ok := value.(string) 4226 if !ok { 4227 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 4228 } 4229 sv.RevisionId = ptr.String(jtv) 4230 } 4231 4232 default: 4233 _, _ = key, value 4234 4235 } 4236 } 4237 *v = sv 4238 return nil 4239} 4240 4241type awsRestjson1_deserializeOpDeleteSlot struct { 4242} 4243 4244func (*awsRestjson1_deserializeOpDeleteSlot) ID() string { 4245 return "OperationDeserializer" 4246} 4247 4248func (m *awsRestjson1_deserializeOpDeleteSlot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4249 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4250) { 4251 out, metadata, err = next.HandleDeserialize(ctx, in) 4252 if err != nil { 4253 return out, metadata, err 4254 } 4255 4256 response, ok := out.RawResponse.(*smithyhttp.Response) 4257 if !ok { 4258 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4259 } 4260 4261 if response.StatusCode < 200 || response.StatusCode >= 300 { 4262 return out, metadata, awsRestjson1_deserializeOpErrorDeleteSlot(response, &metadata) 4263 } 4264 output := &DeleteSlotOutput{} 4265 out.Result = output 4266 4267 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4268 return out, metadata, &smithy.DeserializationError{ 4269 Err: fmt.Errorf("failed to discard response body, %w", err), 4270 } 4271 } 4272 4273 return out, metadata, err 4274} 4275 4276func awsRestjson1_deserializeOpErrorDeleteSlot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4277 var errorBuffer bytes.Buffer 4278 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4279 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4280 } 4281 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4282 4283 errorCode := "UnknownError" 4284 errorMessage := errorCode 4285 4286 code := response.Header.Get("X-Amzn-ErrorType") 4287 if len(code) != 0 { 4288 errorCode = restjson.SanitizeErrorCode(code) 4289 } 4290 4291 var buff [1024]byte 4292 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4293 4294 body := io.TeeReader(errorBody, ringBuffer) 4295 decoder := json.NewDecoder(body) 4296 decoder.UseNumber() 4297 code, message, err := restjson.GetErrorInfo(decoder) 4298 if err != nil { 4299 var snapshot bytes.Buffer 4300 io.Copy(&snapshot, ringBuffer) 4301 err = &smithy.DeserializationError{ 4302 Err: fmt.Errorf("failed to decode response body, %w", err), 4303 Snapshot: snapshot.Bytes(), 4304 } 4305 return err 4306 } 4307 4308 errorBody.Seek(0, io.SeekStart) 4309 if len(code) != 0 { 4310 errorCode = restjson.SanitizeErrorCode(code) 4311 } 4312 if len(message) != 0 { 4313 errorMessage = message 4314 } 4315 4316 switch { 4317 case strings.EqualFold("ConflictException", errorCode): 4318 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 4319 4320 case strings.EqualFold("InternalServerException", errorCode): 4321 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4322 4323 case strings.EqualFold("PreconditionFailedException", errorCode): 4324 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 4325 4326 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 4327 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 4328 4329 case strings.EqualFold("ThrottlingException", errorCode): 4330 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4331 4332 case strings.EqualFold("ValidationException", errorCode): 4333 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4334 4335 default: 4336 genericError := &smithy.GenericAPIError{ 4337 Code: errorCode, 4338 Message: errorMessage, 4339 } 4340 return genericError 4341 4342 } 4343} 4344 4345type awsRestjson1_deserializeOpDeleteSlotType struct { 4346} 4347 4348func (*awsRestjson1_deserializeOpDeleteSlotType) ID() string { 4349 return "OperationDeserializer" 4350} 4351 4352func (m *awsRestjson1_deserializeOpDeleteSlotType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4353 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4354) { 4355 out, metadata, err = next.HandleDeserialize(ctx, in) 4356 if err != nil { 4357 return out, metadata, err 4358 } 4359 4360 response, ok := out.RawResponse.(*smithyhttp.Response) 4361 if !ok { 4362 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4363 } 4364 4365 if response.StatusCode < 200 || response.StatusCode >= 300 { 4366 return out, metadata, awsRestjson1_deserializeOpErrorDeleteSlotType(response, &metadata) 4367 } 4368 output := &DeleteSlotTypeOutput{} 4369 out.Result = output 4370 4371 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 4372 return out, metadata, &smithy.DeserializationError{ 4373 Err: fmt.Errorf("failed to discard response body, %w", err), 4374 } 4375 } 4376 4377 return out, metadata, err 4378} 4379 4380func awsRestjson1_deserializeOpErrorDeleteSlotType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4381 var errorBuffer bytes.Buffer 4382 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4383 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4384 } 4385 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4386 4387 errorCode := "UnknownError" 4388 errorMessage := errorCode 4389 4390 code := response.Header.Get("X-Amzn-ErrorType") 4391 if len(code) != 0 { 4392 errorCode = restjson.SanitizeErrorCode(code) 4393 } 4394 4395 var buff [1024]byte 4396 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4397 4398 body := io.TeeReader(errorBody, ringBuffer) 4399 decoder := json.NewDecoder(body) 4400 decoder.UseNumber() 4401 code, message, err := restjson.GetErrorInfo(decoder) 4402 if err != nil { 4403 var snapshot bytes.Buffer 4404 io.Copy(&snapshot, ringBuffer) 4405 err = &smithy.DeserializationError{ 4406 Err: fmt.Errorf("failed to decode response body, %w", err), 4407 Snapshot: snapshot.Bytes(), 4408 } 4409 return err 4410 } 4411 4412 errorBody.Seek(0, io.SeekStart) 4413 if len(code) != 0 { 4414 errorCode = restjson.SanitizeErrorCode(code) 4415 } 4416 if len(message) != 0 { 4417 errorMessage = message 4418 } 4419 4420 switch { 4421 case strings.EqualFold("ConflictException", errorCode): 4422 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 4423 4424 case strings.EqualFold("InternalServerException", errorCode): 4425 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4426 4427 case strings.EqualFold("PreconditionFailedException", errorCode): 4428 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 4429 4430 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 4431 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 4432 4433 case strings.EqualFold("ThrottlingException", errorCode): 4434 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4435 4436 case strings.EqualFold("ValidationException", errorCode): 4437 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4438 4439 default: 4440 genericError := &smithy.GenericAPIError{ 4441 Code: errorCode, 4442 Message: errorMessage, 4443 } 4444 return genericError 4445 4446 } 4447} 4448 4449type awsRestjson1_deserializeOpDescribeBot struct { 4450} 4451 4452func (*awsRestjson1_deserializeOpDescribeBot) ID() string { 4453 return "OperationDeserializer" 4454} 4455 4456func (m *awsRestjson1_deserializeOpDescribeBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4457 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4458) { 4459 out, metadata, err = next.HandleDeserialize(ctx, in) 4460 if err != nil { 4461 return out, metadata, err 4462 } 4463 4464 response, ok := out.RawResponse.(*smithyhttp.Response) 4465 if !ok { 4466 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4467 } 4468 4469 if response.StatusCode < 200 || response.StatusCode >= 300 { 4470 return out, metadata, awsRestjson1_deserializeOpErrorDescribeBot(response, &metadata) 4471 } 4472 output := &DescribeBotOutput{} 4473 out.Result = output 4474 4475 var buff [1024]byte 4476 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4477 4478 body := io.TeeReader(response.Body, ringBuffer) 4479 4480 decoder := json.NewDecoder(body) 4481 decoder.UseNumber() 4482 var shape interface{} 4483 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4484 var snapshot bytes.Buffer 4485 io.Copy(&snapshot, ringBuffer) 4486 err = &smithy.DeserializationError{ 4487 Err: fmt.Errorf("failed to decode response body, %w", err), 4488 Snapshot: snapshot.Bytes(), 4489 } 4490 return out, metadata, err 4491 } 4492 4493 err = awsRestjson1_deserializeOpDocumentDescribeBotOutput(&output, shape) 4494 if err != nil { 4495 var snapshot bytes.Buffer 4496 io.Copy(&snapshot, ringBuffer) 4497 return out, metadata, &smithy.DeserializationError{ 4498 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4499 Snapshot: snapshot.Bytes(), 4500 } 4501 } 4502 4503 return out, metadata, err 4504} 4505 4506func awsRestjson1_deserializeOpErrorDescribeBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4507 var errorBuffer bytes.Buffer 4508 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4509 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4510 } 4511 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4512 4513 errorCode := "UnknownError" 4514 errorMessage := errorCode 4515 4516 code := response.Header.Get("X-Amzn-ErrorType") 4517 if len(code) != 0 { 4518 errorCode = restjson.SanitizeErrorCode(code) 4519 } 4520 4521 var buff [1024]byte 4522 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4523 4524 body := io.TeeReader(errorBody, ringBuffer) 4525 decoder := json.NewDecoder(body) 4526 decoder.UseNumber() 4527 code, message, err := restjson.GetErrorInfo(decoder) 4528 if err != nil { 4529 var snapshot bytes.Buffer 4530 io.Copy(&snapshot, ringBuffer) 4531 err = &smithy.DeserializationError{ 4532 Err: fmt.Errorf("failed to decode response body, %w", err), 4533 Snapshot: snapshot.Bytes(), 4534 } 4535 return err 4536 } 4537 4538 errorBody.Seek(0, io.SeekStart) 4539 if len(code) != 0 { 4540 errorCode = restjson.SanitizeErrorCode(code) 4541 } 4542 if len(message) != 0 { 4543 errorMessage = message 4544 } 4545 4546 switch { 4547 case strings.EqualFold("InternalServerException", errorCode): 4548 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4549 4550 case strings.EqualFold("ResourceNotFoundException", errorCode): 4551 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4552 4553 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 4554 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 4555 4556 case strings.EqualFold("ThrottlingException", errorCode): 4557 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4558 4559 case strings.EqualFold("ValidationException", errorCode): 4560 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4561 4562 default: 4563 genericError := &smithy.GenericAPIError{ 4564 Code: errorCode, 4565 Message: errorMessage, 4566 } 4567 return genericError 4568 4569 } 4570} 4571 4572func awsRestjson1_deserializeOpDocumentDescribeBotOutput(v **DescribeBotOutput, value interface{}) error { 4573 if v == nil { 4574 return fmt.Errorf("unexpected nil of type %T", v) 4575 } 4576 if value == nil { 4577 return nil 4578 } 4579 4580 shape, ok := value.(map[string]interface{}) 4581 if !ok { 4582 return fmt.Errorf("unexpected JSON type %v", value) 4583 } 4584 4585 var sv *DescribeBotOutput 4586 if *v == nil { 4587 sv = &DescribeBotOutput{} 4588 } else { 4589 sv = *v 4590 } 4591 4592 for key, value := range shape { 4593 switch key { 4594 case "botId": 4595 if value != nil { 4596 jtv, ok := value.(string) 4597 if !ok { 4598 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4599 } 4600 sv.BotId = ptr.String(jtv) 4601 } 4602 4603 case "botName": 4604 if value != nil { 4605 jtv, ok := value.(string) 4606 if !ok { 4607 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4608 } 4609 sv.BotName = ptr.String(jtv) 4610 } 4611 4612 case "botStatus": 4613 if value != nil { 4614 jtv, ok := value.(string) 4615 if !ok { 4616 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 4617 } 4618 sv.BotStatus = types.BotStatus(jtv) 4619 } 4620 4621 case "creationDateTime": 4622 if value != nil { 4623 switch jtv := value.(type) { 4624 case json.Number: 4625 f64, err := jtv.Float64() 4626 if err != nil { 4627 return err 4628 } 4629 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4630 4631 default: 4632 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4633 4634 } 4635 } 4636 4637 case "dataPrivacy": 4638 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 4639 return err 4640 } 4641 4642 case "description": 4643 if value != nil { 4644 jtv, ok := value.(string) 4645 if !ok { 4646 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 4647 } 4648 sv.Description = ptr.String(jtv) 4649 } 4650 4651 case "idleSessionTTLInSeconds": 4652 if value != nil { 4653 jtv, ok := value.(json.Number) 4654 if !ok { 4655 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 4656 } 4657 i64, err := jtv.Int64() 4658 if err != nil { 4659 return err 4660 } 4661 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 4662 } 4663 4664 case "lastUpdatedDateTime": 4665 if value != nil { 4666 switch jtv := value.(type) { 4667 case json.Number: 4668 f64, err := jtv.Float64() 4669 if err != nil { 4670 return err 4671 } 4672 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4673 4674 default: 4675 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4676 4677 } 4678 } 4679 4680 case "roleArn": 4681 if value != nil { 4682 jtv, ok := value.(string) 4683 if !ok { 4684 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 4685 } 4686 sv.RoleArn = ptr.String(jtv) 4687 } 4688 4689 default: 4690 _, _ = key, value 4691 4692 } 4693 } 4694 *v = sv 4695 return nil 4696} 4697 4698type awsRestjson1_deserializeOpDescribeBotAlias struct { 4699} 4700 4701func (*awsRestjson1_deserializeOpDescribeBotAlias) ID() string { 4702 return "OperationDeserializer" 4703} 4704 4705func (m *awsRestjson1_deserializeOpDescribeBotAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4706 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4707) { 4708 out, metadata, err = next.HandleDeserialize(ctx, in) 4709 if err != nil { 4710 return out, metadata, err 4711 } 4712 4713 response, ok := out.RawResponse.(*smithyhttp.Response) 4714 if !ok { 4715 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4716 } 4717 4718 if response.StatusCode < 200 || response.StatusCode >= 300 { 4719 return out, metadata, awsRestjson1_deserializeOpErrorDescribeBotAlias(response, &metadata) 4720 } 4721 output := &DescribeBotAliasOutput{} 4722 out.Result = output 4723 4724 var buff [1024]byte 4725 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4726 4727 body := io.TeeReader(response.Body, ringBuffer) 4728 4729 decoder := json.NewDecoder(body) 4730 decoder.UseNumber() 4731 var shape interface{} 4732 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4733 var snapshot bytes.Buffer 4734 io.Copy(&snapshot, ringBuffer) 4735 err = &smithy.DeserializationError{ 4736 Err: fmt.Errorf("failed to decode response body, %w", err), 4737 Snapshot: snapshot.Bytes(), 4738 } 4739 return out, metadata, err 4740 } 4741 4742 err = awsRestjson1_deserializeOpDocumentDescribeBotAliasOutput(&output, shape) 4743 if err != nil { 4744 var snapshot bytes.Buffer 4745 io.Copy(&snapshot, ringBuffer) 4746 return out, metadata, &smithy.DeserializationError{ 4747 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4748 Snapshot: snapshot.Bytes(), 4749 } 4750 } 4751 4752 return out, metadata, err 4753} 4754 4755func awsRestjson1_deserializeOpErrorDescribeBotAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4756 var errorBuffer bytes.Buffer 4757 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4758 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4759 } 4760 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4761 4762 errorCode := "UnknownError" 4763 errorMessage := errorCode 4764 4765 code := response.Header.Get("X-Amzn-ErrorType") 4766 if len(code) != 0 { 4767 errorCode = restjson.SanitizeErrorCode(code) 4768 } 4769 4770 var buff [1024]byte 4771 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4772 4773 body := io.TeeReader(errorBody, ringBuffer) 4774 decoder := json.NewDecoder(body) 4775 decoder.UseNumber() 4776 code, message, err := restjson.GetErrorInfo(decoder) 4777 if err != nil { 4778 var snapshot bytes.Buffer 4779 io.Copy(&snapshot, ringBuffer) 4780 err = &smithy.DeserializationError{ 4781 Err: fmt.Errorf("failed to decode response body, %w", err), 4782 Snapshot: snapshot.Bytes(), 4783 } 4784 return err 4785 } 4786 4787 errorBody.Seek(0, io.SeekStart) 4788 if len(code) != 0 { 4789 errorCode = restjson.SanitizeErrorCode(code) 4790 } 4791 if len(message) != 0 { 4792 errorMessage = message 4793 } 4794 4795 switch { 4796 case strings.EqualFold("InternalServerException", errorCode): 4797 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4798 4799 case strings.EqualFold("ResourceNotFoundException", errorCode): 4800 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4801 4802 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 4803 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 4804 4805 case strings.EqualFold("ThrottlingException", errorCode): 4806 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4807 4808 case strings.EqualFold("ValidationException", errorCode): 4809 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4810 4811 default: 4812 genericError := &smithy.GenericAPIError{ 4813 Code: errorCode, 4814 Message: errorMessage, 4815 } 4816 return genericError 4817 4818 } 4819} 4820 4821func awsRestjson1_deserializeOpDocumentDescribeBotAliasOutput(v **DescribeBotAliasOutput, value interface{}) error { 4822 if v == nil { 4823 return fmt.Errorf("unexpected nil of type %T", v) 4824 } 4825 if value == nil { 4826 return nil 4827 } 4828 4829 shape, ok := value.(map[string]interface{}) 4830 if !ok { 4831 return fmt.Errorf("unexpected JSON type %v", value) 4832 } 4833 4834 var sv *DescribeBotAliasOutput 4835 if *v == nil { 4836 sv = &DescribeBotAliasOutput{} 4837 } else { 4838 sv = *v 4839 } 4840 4841 for key, value := range shape { 4842 switch key { 4843 case "botAliasHistoryEvents": 4844 if err := awsRestjson1_deserializeDocumentBotAliasHistoryEventsList(&sv.BotAliasHistoryEvents, value); err != nil { 4845 return err 4846 } 4847 4848 case "botAliasId": 4849 if value != nil { 4850 jtv, ok := value.(string) 4851 if !ok { 4852 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 4853 } 4854 sv.BotAliasId = ptr.String(jtv) 4855 } 4856 4857 case "botAliasLocaleSettings": 4858 if err := awsRestjson1_deserializeDocumentBotAliasLocaleSettingsMap(&sv.BotAliasLocaleSettings, value); err != nil { 4859 return err 4860 } 4861 4862 case "botAliasName": 4863 if value != nil { 4864 jtv, ok := value.(string) 4865 if !ok { 4866 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4867 } 4868 sv.BotAliasName = ptr.String(jtv) 4869 } 4870 4871 case "botAliasStatus": 4872 if value != nil { 4873 jtv, ok := value.(string) 4874 if !ok { 4875 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 4876 } 4877 sv.BotAliasStatus = types.BotAliasStatus(jtv) 4878 } 4879 4880 case "botId": 4881 if value != nil { 4882 jtv, ok := value.(string) 4883 if !ok { 4884 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4885 } 4886 sv.BotId = ptr.String(jtv) 4887 } 4888 4889 case "botVersion": 4890 if value != nil { 4891 jtv, ok := value.(string) 4892 if !ok { 4893 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 4894 } 4895 sv.BotVersion = ptr.String(jtv) 4896 } 4897 4898 case "conversationLogSettings": 4899 if err := awsRestjson1_deserializeDocumentConversationLogSettings(&sv.ConversationLogSettings, value); err != nil { 4900 return err 4901 } 4902 4903 case "creationDateTime": 4904 if value != nil { 4905 switch jtv := value.(type) { 4906 case json.Number: 4907 f64, err := jtv.Float64() 4908 if err != nil { 4909 return err 4910 } 4911 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4912 4913 default: 4914 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4915 4916 } 4917 } 4918 4919 case "description": 4920 if value != nil { 4921 jtv, ok := value.(string) 4922 if !ok { 4923 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 4924 } 4925 sv.Description = ptr.String(jtv) 4926 } 4927 4928 case "lastUpdatedDateTime": 4929 if value != nil { 4930 switch jtv := value.(type) { 4931 case json.Number: 4932 f64, err := jtv.Float64() 4933 if err != nil { 4934 return err 4935 } 4936 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4937 4938 default: 4939 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4940 4941 } 4942 } 4943 4944 case "sentimentAnalysisSettings": 4945 if err := awsRestjson1_deserializeDocumentSentimentAnalysisSettings(&sv.SentimentAnalysisSettings, value); err != nil { 4946 return err 4947 } 4948 4949 default: 4950 _, _ = key, value 4951 4952 } 4953 } 4954 *v = sv 4955 return nil 4956} 4957 4958type awsRestjson1_deserializeOpDescribeBotLocale struct { 4959} 4960 4961func (*awsRestjson1_deserializeOpDescribeBotLocale) ID() string { 4962 return "OperationDeserializer" 4963} 4964 4965func (m *awsRestjson1_deserializeOpDescribeBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4966 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4967) { 4968 out, metadata, err = next.HandleDeserialize(ctx, in) 4969 if err != nil { 4970 return out, metadata, err 4971 } 4972 4973 response, ok := out.RawResponse.(*smithyhttp.Response) 4974 if !ok { 4975 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4976 } 4977 4978 if response.StatusCode < 200 || response.StatusCode >= 300 { 4979 return out, metadata, awsRestjson1_deserializeOpErrorDescribeBotLocale(response, &metadata) 4980 } 4981 output := &DescribeBotLocaleOutput{} 4982 out.Result = output 4983 4984 var buff [1024]byte 4985 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4986 4987 body := io.TeeReader(response.Body, ringBuffer) 4988 4989 decoder := json.NewDecoder(body) 4990 decoder.UseNumber() 4991 var shape interface{} 4992 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4993 var snapshot bytes.Buffer 4994 io.Copy(&snapshot, ringBuffer) 4995 err = &smithy.DeserializationError{ 4996 Err: fmt.Errorf("failed to decode response body, %w", err), 4997 Snapshot: snapshot.Bytes(), 4998 } 4999 return out, metadata, err 5000 } 5001 5002 err = awsRestjson1_deserializeOpDocumentDescribeBotLocaleOutput(&output, shape) 5003 if err != nil { 5004 var snapshot bytes.Buffer 5005 io.Copy(&snapshot, ringBuffer) 5006 return out, metadata, &smithy.DeserializationError{ 5007 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5008 Snapshot: snapshot.Bytes(), 5009 } 5010 } 5011 5012 return out, metadata, err 5013} 5014 5015func awsRestjson1_deserializeOpErrorDescribeBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5016 var errorBuffer bytes.Buffer 5017 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5018 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5019 } 5020 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5021 5022 errorCode := "UnknownError" 5023 errorMessage := errorCode 5024 5025 code := response.Header.Get("X-Amzn-ErrorType") 5026 if len(code) != 0 { 5027 errorCode = restjson.SanitizeErrorCode(code) 5028 } 5029 5030 var buff [1024]byte 5031 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5032 5033 body := io.TeeReader(errorBody, ringBuffer) 5034 decoder := json.NewDecoder(body) 5035 decoder.UseNumber() 5036 code, message, err := restjson.GetErrorInfo(decoder) 5037 if err != nil { 5038 var snapshot bytes.Buffer 5039 io.Copy(&snapshot, ringBuffer) 5040 err = &smithy.DeserializationError{ 5041 Err: fmt.Errorf("failed to decode response body, %w", err), 5042 Snapshot: snapshot.Bytes(), 5043 } 5044 return err 5045 } 5046 5047 errorBody.Seek(0, io.SeekStart) 5048 if len(code) != 0 { 5049 errorCode = restjson.SanitizeErrorCode(code) 5050 } 5051 if len(message) != 0 { 5052 errorMessage = message 5053 } 5054 5055 switch { 5056 case strings.EqualFold("InternalServerException", errorCode): 5057 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5058 5059 case strings.EqualFold("ResourceNotFoundException", errorCode): 5060 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5061 5062 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 5063 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 5064 5065 case strings.EqualFold("ThrottlingException", errorCode): 5066 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5067 5068 case strings.EqualFold("ValidationException", errorCode): 5069 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5070 5071 default: 5072 genericError := &smithy.GenericAPIError{ 5073 Code: errorCode, 5074 Message: errorMessage, 5075 } 5076 return genericError 5077 5078 } 5079} 5080 5081func awsRestjson1_deserializeOpDocumentDescribeBotLocaleOutput(v **DescribeBotLocaleOutput, value interface{}) error { 5082 if v == nil { 5083 return fmt.Errorf("unexpected nil of type %T", v) 5084 } 5085 if value == nil { 5086 return nil 5087 } 5088 5089 shape, ok := value.(map[string]interface{}) 5090 if !ok { 5091 return fmt.Errorf("unexpected JSON type %v", value) 5092 } 5093 5094 var sv *DescribeBotLocaleOutput 5095 if *v == nil { 5096 sv = &DescribeBotLocaleOutput{} 5097 } else { 5098 sv = *v 5099 } 5100 5101 for key, value := range shape { 5102 switch key { 5103 case "botId": 5104 if value != nil { 5105 jtv, ok := value.(string) 5106 if !ok { 5107 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5108 } 5109 sv.BotId = ptr.String(jtv) 5110 } 5111 5112 case "botLocaleHistoryEvents": 5113 if err := awsRestjson1_deserializeDocumentBotLocaleHistoryEventsList(&sv.BotLocaleHistoryEvents, value); err != nil { 5114 return err 5115 } 5116 5117 case "botLocaleStatus": 5118 if value != nil { 5119 jtv, ok := value.(string) 5120 if !ok { 5121 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 5122 } 5123 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 5124 } 5125 5126 case "botVersion": 5127 if value != nil { 5128 jtv, ok := value.(string) 5129 if !ok { 5130 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 5131 } 5132 sv.BotVersion = ptr.String(jtv) 5133 } 5134 5135 case "creationDateTime": 5136 if value != nil { 5137 switch jtv := value.(type) { 5138 case json.Number: 5139 f64, err := jtv.Float64() 5140 if err != nil { 5141 return err 5142 } 5143 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5144 5145 default: 5146 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5147 5148 } 5149 } 5150 5151 case "description": 5152 if value != nil { 5153 jtv, ok := value.(string) 5154 if !ok { 5155 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 5156 } 5157 sv.Description = ptr.String(jtv) 5158 } 5159 5160 case "failureReasons": 5161 if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { 5162 return err 5163 } 5164 5165 case "intentsCount": 5166 if value != nil { 5167 jtv, ok := value.(json.Number) 5168 if !ok { 5169 return fmt.Errorf("expected ResourceCount to be json.Number, got %T instead", value) 5170 } 5171 i64, err := jtv.Int64() 5172 if err != nil { 5173 return err 5174 } 5175 sv.IntentsCount = ptr.Int32(int32(i64)) 5176 } 5177 5178 case "lastBuildSubmittedDateTime": 5179 if value != nil { 5180 switch jtv := value.(type) { 5181 case json.Number: 5182 f64, err := jtv.Float64() 5183 if err != nil { 5184 return err 5185 } 5186 sv.LastBuildSubmittedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5187 5188 default: 5189 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5190 5191 } 5192 } 5193 5194 case "lastUpdatedDateTime": 5195 if value != nil { 5196 switch jtv := value.(type) { 5197 case json.Number: 5198 f64, err := jtv.Float64() 5199 if err != nil { 5200 return err 5201 } 5202 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5203 5204 default: 5205 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5206 5207 } 5208 } 5209 5210 case "localeId": 5211 if value != nil { 5212 jtv, ok := value.(string) 5213 if !ok { 5214 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 5215 } 5216 sv.LocaleId = ptr.String(jtv) 5217 } 5218 5219 case "localeName": 5220 if value != nil { 5221 jtv, ok := value.(string) 5222 if !ok { 5223 return fmt.Errorf("expected LocaleName to be of type string, got %T instead", value) 5224 } 5225 sv.LocaleName = ptr.String(jtv) 5226 } 5227 5228 case "nluIntentConfidenceThreshold": 5229 if value != nil { 5230 switch jtv := value.(type) { 5231 case json.Number: 5232 f64, err := jtv.Float64() 5233 if err != nil { 5234 return err 5235 } 5236 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 5237 5238 case string: 5239 var f64 float64 5240 switch { 5241 case strings.EqualFold(jtv, "NaN"): 5242 f64 = math.NaN() 5243 5244 case strings.EqualFold(jtv, "Infinity"): 5245 f64 = math.Inf(1) 5246 5247 case strings.EqualFold(jtv, "-Infinity"): 5248 f64 = math.Inf(-1) 5249 5250 default: 5251 return fmt.Errorf("unknown JSON number value: %s", jtv) 5252 5253 } 5254 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 5255 5256 default: 5257 return fmt.Errorf("expected ConfidenceThreshold to be a JSON Number, got %T instead", value) 5258 5259 } 5260 } 5261 5262 case "slotTypesCount": 5263 if value != nil { 5264 jtv, ok := value.(json.Number) 5265 if !ok { 5266 return fmt.Errorf("expected ResourceCount to be json.Number, got %T instead", value) 5267 } 5268 i64, err := jtv.Int64() 5269 if err != nil { 5270 return err 5271 } 5272 sv.SlotTypesCount = ptr.Int32(int32(i64)) 5273 } 5274 5275 case "voiceSettings": 5276 if err := awsRestjson1_deserializeDocumentVoiceSettings(&sv.VoiceSettings, value); err != nil { 5277 return err 5278 } 5279 5280 default: 5281 _, _ = key, value 5282 5283 } 5284 } 5285 *v = sv 5286 return nil 5287} 5288 5289type awsRestjson1_deserializeOpDescribeBotVersion struct { 5290} 5291 5292func (*awsRestjson1_deserializeOpDescribeBotVersion) ID() string { 5293 return "OperationDeserializer" 5294} 5295 5296func (m *awsRestjson1_deserializeOpDescribeBotVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5297 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5298) { 5299 out, metadata, err = next.HandleDeserialize(ctx, in) 5300 if err != nil { 5301 return out, metadata, err 5302 } 5303 5304 response, ok := out.RawResponse.(*smithyhttp.Response) 5305 if !ok { 5306 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5307 } 5308 5309 if response.StatusCode < 200 || response.StatusCode >= 300 { 5310 return out, metadata, awsRestjson1_deserializeOpErrorDescribeBotVersion(response, &metadata) 5311 } 5312 output := &DescribeBotVersionOutput{} 5313 out.Result = output 5314 5315 var buff [1024]byte 5316 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5317 5318 body := io.TeeReader(response.Body, ringBuffer) 5319 5320 decoder := json.NewDecoder(body) 5321 decoder.UseNumber() 5322 var shape interface{} 5323 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5324 var snapshot bytes.Buffer 5325 io.Copy(&snapshot, ringBuffer) 5326 err = &smithy.DeserializationError{ 5327 Err: fmt.Errorf("failed to decode response body, %w", err), 5328 Snapshot: snapshot.Bytes(), 5329 } 5330 return out, metadata, err 5331 } 5332 5333 err = awsRestjson1_deserializeOpDocumentDescribeBotVersionOutput(&output, shape) 5334 if err != nil { 5335 var snapshot bytes.Buffer 5336 io.Copy(&snapshot, ringBuffer) 5337 return out, metadata, &smithy.DeserializationError{ 5338 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5339 Snapshot: snapshot.Bytes(), 5340 } 5341 } 5342 5343 return out, metadata, err 5344} 5345 5346func awsRestjson1_deserializeOpErrorDescribeBotVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5347 var errorBuffer bytes.Buffer 5348 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5349 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5350 } 5351 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5352 5353 errorCode := "UnknownError" 5354 errorMessage := errorCode 5355 5356 code := response.Header.Get("X-Amzn-ErrorType") 5357 if len(code) != 0 { 5358 errorCode = restjson.SanitizeErrorCode(code) 5359 } 5360 5361 var buff [1024]byte 5362 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5363 5364 body := io.TeeReader(errorBody, ringBuffer) 5365 decoder := json.NewDecoder(body) 5366 decoder.UseNumber() 5367 code, message, err := restjson.GetErrorInfo(decoder) 5368 if err != nil { 5369 var snapshot bytes.Buffer 5370 io.Copy(&snapshot, ringBuffer) 5371 err = &smithy.DeserializationError{ 5372 Err: fmt.Errorf("failed to decode response body, %w", err), 5373 Snapshot: snapshot.Bytes(), 5374 } 5375 return err 5376 } 5377 5378 errorBody.Seek(0, io.SeekStart) 5379 if len(code) != 0 { 5380 errorCode = restjson.SanitizeErrorCode(code) 5381 } 5382 if len(message) != 0 { 5383 errorMessage = message 5384 } 5385 5386 switch { 5387 case strings.EqualFold("InternalServerException", errorCode): 5388 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5389 5390 case strings.EqualFold("ResourceNotFoundException", errorCode): 5391 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5392 5393 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 5394 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 5395 5396 case strings.EqualFold("ThrottlingException", errorCode): 5397 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5398 5399 case strings.EqualFold("ValidationException", errorCode): 5400 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5401 5402 default: 5403 genericError := &smithy.GenericAPIError{ 5404 Code: errorCode, 5405 Message: errorMessage, 5406 } 5407 return genericError 5408 5409 } 5410} 5411 5412func awsRestjson1_deserializeOpDocumentDescribeBotVersionOutput(v **DescribeBotVersionOutput, value interface{}) error { 5413 if v == nil { 5414 return fmt.Errorf("unexpected nil of type %T", v) 5415 } 5416 if value == nil { 5417 return nil 5418 } 5419 5420 shape, ok := value.(map[string]interface{}) 5421 if !ok { 5422 return fmt.Errorf("unexpected JSON type %v", value) 5423 } 5424 5425 var sv *DescribeBotVersionOutput 5426 if *v == nil { 5427 sv = &DescribeBotVersionOutput{} 5428 } else { 5429 sv = *v 5430 } 5431 5432 for key, value := range shape { 5433 switch key { 5434 case "botId": 5435 if value != nil { 5436 jtv, ok := value.(string) 5437 if !ok { 5438 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5439 } 5440 sv.BotId = ptr.String(jtv) 5441 } 5442 5443 case "botName": 5444 if value != nil { 5445 jtv, ok := value.(string) 5446 if !ok { 5447 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 5448 } 5449 sv.BotName = ptr.String(jtv) 5450 } 5451 5452 case "botStatus": 5453 if value != nil { 5454 jtv, ok := value.(string) 5455 if !ok { 5456 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 5457 } 5458 sv.BotStatus = types.BotStatus(jtv) 5459 } 5460 5461 case "botVersion": 5462 if value != nil { 5463 jtv, ok := value.(string) 5464 if !ok { 5465 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 5466 } 5467 sv.BotVersion = ptr.String(jtv) 5468 } 5469 5470 case "creationDateTime": 5471 if value != nil { 5472 switch jtv := value.(type) { 5473 case json.Number: 5474 f64, err := jtv.Float64() 5475 if err != nil { 5476 return err 5477 } 5478 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5479 5480 default: 5481 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5482 5483 } 5484 } 5485 5486 case "dataPrivacy": 5487 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 5488 return err 5489 } 5490 5491 case "description": 5492 if value != nil { 5493 jtv, ok := value.(string) 5494 if !ok { 5495 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 5496 } 5497 sv.Description = ptr.String(jtv) 5498 } 5499 5500 case "failureReasons": 5501 if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { 5502 return err 5503 } 5504 5505 case "idleSessionTTLInSeconds": 5506 if value != nil { 5507 jtv, ok := value.(json.Number) 5508 if !ok { 5509 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 5510 } 5511 i64, err := jtv.Int64() 5512 if err != nil { 5513 return err 5514 } 5515 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 5516 } 5517 5518 case "roleArn": 5519 if value != nil { 5520 jtv, ok := value.(string) 5521 if !ok { 5522 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 5523 } 5524 sv.RoleArn = ptr.String(jtv) 5525 } 5526 5527 default: 5528 _, _ = key, value 5529 5530 } 5531 } 5532 *v = sv 5533 return nil 5534} 5535 5536type awsRestjson1_deserializeOpDescribeExport struct { 5537} 5538 5539func (*awsRestjson1_deserializeOpDescribeExport) ID() string { 5540 return "OperationDeserializer" 5541} 5542 5543func (m *awsRestjson1_deserializeOpDescribeExport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5544 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5545) { 5546 out, metadata, err = next.HandleDeserialize(ctx, in) 5547 if err != nil { 5548 return out, metadata, err 5549 } 5550 5551 response, ok := out.RawResponse.(*smithyhttp.Response) 5552 if !ok { 5553 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5554 } 5555 5556 if response.StatusCode < 200 || response.StatusCode >= 300 { 5557 return out, metadata, awsRestjson1_deserializeOpErrorDescribeExport(response, &metadata) 5558 } 5559 output := &DescribeExportOutput{} 5560 out.Result = output 5561 5562 var buff [1024]byte 5563 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5564 5565 body := io.TeeReader(response.Body, ringBuffer) 5566 5567 decoder := json.NewDecoder(body) 5568 decoder.UseNumber() 5569 var shape interface{} 5570 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5571 var snapshot bytes.Buffer 5572 io.Copy(&snapshot, ringBuffer) 5573 err = &smithy.DeserializationError{ 5574 Err: fmt.Errorf("failed to decode response body, %w", err), 5575 Snapshot: snapshot.Bytes(), 5576 } 5577 return out, metadata, err 5578 } 5579 5580 err = awsRestjson1_deserializeOpDocumentDescribeExportOutput(&output, shape) 5581 if err != nil { 5582 var snapshot bytes.Buffer 5583 io.Copy(&snapshot, ringBuffer) 5584 return out, metadata, &smithy.DeserializationError{ 5585 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5586 Snapshot: snapshot.Bytes(), 5587 } 5588 } 5589 5590 return out, metadata, err 5591} 5592 5593func awsRestjson1_deserializeOpErrorDescribeExport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5594 var errorBuffer bytes.Buffer 5595 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5596 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5597 } 5598 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5599 5600 errorCode := "UnknownError" 5601 errorMessage := errorCode 5602 5603 code := response.Header.Get("X-Amzn-ErrorType") 5604 if len(code) != 0 { 5605 errorCode = restjson.SanitizeErrorCode(code) 5606 } 5607 5608 var buff [1024]byte 5609 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5610 5611 body := io.TeeReader(errorBody, ringBuffer) 5612 decoder := json.NewDecoder(body) 5613 decoder.UseNumber() 5614 code, message, err := restjson.GetErrorInfo(decoder) 5615 if err != nil { 5616 var snapshot bytes.Buffer 5617 io.Copy(&snapshot, ringBuffer) 5618 err = &smithy.DeserializationError{ 5619 Err: fmt.Errorf("failed to decode response body, %w", err), 5620 Snapshot: snapshot.Bytes(), 5621 } 5622 return err 5623 } 5624 5625 errorBody.Seek(0, io.SeekStart) 5626 if len(code) != 0 { 5627 errorCode = restjson.SanitizeErrorCode(code) 5628 } 5629 if len(message) != 0 { 5630 errorMessage = message 5631 } 5632 5633 switch { 5634 case strings.EqualFold("InternalServerException", errorCode): 5635 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5636 5637 case strings.EqualFold("ResourceNotFoundException", errorCode): 5638 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5639 5640 case strings.EqualFold("ThrottlingException", errorCode): 5641 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5642 5643 case strings.EqualFold("ValidationException", errorCode): 5644 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5645 5646 default: 5647 genericError := &smithy.GenericAPIError{ 5648 Code: errorCode, 5649 Message: errorMessage, 5650 } 5651 return genericError 5652 5653 } 5654} 5655 5656func awsRestjson1_deserializeOpDocumentDescribeExportOutput(v **DescribeExportOutput, value interface{}) error { 5657 if v == nil { 5658 return fmt.Errorf("unexpected nil of type %T", v) 5659 } 5660 if value == nil { 5661 return nil 5662 } 5663 5664 shape, ok := value.(map[string]interface{}) 5665 if !ok { 5666 return fmt.Errorf("unexpected JSON type %v", value) 5667 } 5668 5669 var sv *DescribeExportOutput 5670 if *v == nil { 5671 sv = &DescribeExportOutput{} 5672 } else { 5673 sv = *v 5674 } 5675 5676 for key, value := range shape { 5677 switch key { 5678 case "creationDateTime": 5679 if value != nil { 5680 switch jtv := value.(type) { 5681 case json.Number: 5682 f64, err := jtv.Float64() 5683 if err != nil { 5684 return err 5685 } 5686 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5687 5688 default: 5689 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5690 5691 } 5692 } 5693 5694 case "downloadUrl": 5695 if value != nil { 5696 jtv, ok := value.(string) 5697 if !ok { 5698 return fmt.Errorf("expected PresignedS3Url to be of type string, got %T instead", value) 5699 } 5700 sv.DownloadUrl = ptr.String(jtv) 5701 } 5702 5703 case "exportId": 5704 if value != nil { 5705 jtv, ok := value.(string) 5706 if !ok { 5707 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5708 } 5709 sv.ExportId = ptr.String(jtv) 5710 } 5711 5712 case "exportStatus": 5713 if value != nil { 5714 jtv, ok := value.(string) 5715 if !ok { 5716 return fmt.Errorf("expected ExportStatus to be of type string, got %T instead", value) 5717 } 5718 sv.ExportStatus = types.ExportStatus(jtv) 5719 } 5720 5721 case "failureReasons": 5722 if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { 5723 return err 5724 } 5725 5726 case "fileFormat": 5727 if value != nil { 5728 jtv, ok := value.(string) 5729 if !ok { 5730 return fmt.Errorf("expected ImportExportFileFormat to be of type string, got %T instead", value) 5731 } 5732 sv.FileFormat = types.ImportExportFileFormat(jtv) 5733 } 5734 5735 case "lastUpdatedDateTime": 5736 if value != nil { 5737 switch jtv := value.(type) { 5738 case json.Number: 5739 f64, err := jtv.Float64() 5740 if err != nil { 5741 return err 5742 } 5743 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5744 5745 default: 5746 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5747 5748 } 5749 } 5750 5751 case "resourceSpecification": 5752 if err := awsRestjson1_deserializeDocumentExportResourceSpecification(&sv.ResourceSpecification, value); err != nil { 5753 return err 5754 } 5755 5756 default: 5757 _, _ = key, value 5758 5759 } 5760 } 5761 *v = sv 5762 return nil 5763} 5764 5765type awsRestjson1_deserializeOpDescribeImport struct { 5766} 5767 5768func (*awsRestjson1_deserializeOpDescribeImport) ID() string { 5769 return "OperationDeserializer" 5770} 5771 5772func (m *awsRestjson1_deserializeOpDescribeImport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5773 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5774) { 5775 out, metadata, err = next.HandleDeserialize(ctx, in) 5776 if err != nil { 5777 return out, metadata, err 5778 } 5779 5780 response, ok := out.RawResponse.(*smithyhttp.Response) 5781 if !ok { 5782 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5783 } 5784 5785 if response.StatusCode < 200 || response.StatusCode >= 300 { 5786 return out, metadata, awsRestjson1_deserializeOpErrorDescribeImport(response, &metadata) 5787 } 5788 output := &DescribeImportOutput{} 5789 out.Result = output 5790 5791 var buff [1024]byte 5792 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5793 5794 body := io.TeeReader(response.Body, ringBuffer) 5795 5796 decoder := json.NewDecoder(body) 5797 decoder.UseNumber() 5798 var shape interface{} 5799 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5800 var snapshot bytes.Buffer 5801 io.Copy(&snapshot, ringBuffer) 5802 err = &smithy.DeserializationError{ 5803 Err: fmt.Errorf("failed to decode response body, %w", err), 5804 Snapshot: snapshot.Bytes(), 5805 } 5806 return out, metadata, err 5807 } 5808 5809 err = awsRestjson1_deserializeOpDocumentDescribeImportOutput(&output, shape) 5810 if err != nil { 5811 var snapshot bytes.Buffer 5812 io.Copy(&snapshot, ringBuffer) 5813 return out, metadata, &smithy.DeserializationError{ 5814 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5815 Snapshot: snapshot.Bytes(), 5816 } 5817 } 5818 5819 return out, metadata, err 5820} 5821 5822func awsRestjson1_deserializeOpErrorDescribeImport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5823 var errorBuffer bytes.Buffer 5824 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5825 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5826 } 5827 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5828 5829 errorCode := "UnknownError" 5830 errorMessage := errorCode 5831 5832 code := response.Header.Get("X-Amzn-ErrorType") 5833 if len(code) != 0 { 5834 errorCode = restjson.SanitizeErrorCode(code) 5835 } 5836 5837 var buff [1024]byte 5838 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5839 5840 body := io.TeeReader(errorBody, ringBuffer) 5841 decoder := json.NewDecoder(body) 5842 decoder.UseNumber() 5843 code, message, err := restjson.GetErrorInfo(decoder) 5844 if err != nil { 5845 var snapshot bytes.Buffer 5846 io.Copy(&snapshot, ringBuffer) 5847 err = &smithy.DeserializationError{ 5848 Err: fmt.Errorf("failed to decode response body, %w", err), 5849 Snapshot: snapshot.Bytes(), 5850 } 5851 return err 5852 } 5853 5854 errorBody.Seek(0, io.SeekStart) 5855 if len(code) != 0 { 5856 errorCode = restjson.SanitizeErrorCode(code) 5857 } 5858 if len(message) != 0 { 5859 errorMessage = message 5860 } 5861 5862 switch { 5863 case strings.EqualFold("InternalServerException", errorCode): 5864 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5865 5866 case strings.EqualFold("ResourceNotFoundException", errorCode): 5867 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 5868 5869 case strings.EqualFold("ThrottlingException", errorCode): 5870 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5871 5872 case strings.EqualFold("ValidationException", errorCode): 5873 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5874 5875 default: 5876 genericError := &smithy.GenericAPIError{ 5877 Code: errorCode, 5878 Message: errorMessage, 5879 } 5880 return genericError 5881 5882 } 5883} 5884 5885func awsRestjson1_deserializeOpDocumentDescribeImportOutput(v **DescribeImportOutput, value interface{}) error { 5886 if v == nil { 5887 return fmt.Errorf("unexpected nil of type %T", v) 5888 } 5889 if value == nil { 5890 return nil 5891 } 5892 5893 shape, ok := value.(map[string]interface{}) 5894 if !ok { 5895 return fmt.Errorf("unexpected JSON type %v", value) 5896 } 5897 5898 var sv *DescribeImportOutput 5899 if *v == nil { 5900 sv = &DescribeImportOutput{} 5901 } else { 5902 sv = *v 5903 } 5904 5905 for key, value := range shape { 5906 switch key { 5907 case "creationDateTime": 5908 if value != nil { 5909 switch jtv := value.(type) { 5910 case json.Number: 5911 f64, err := jtv.Float64() 5912 if err != nil { 5913 return err 5914 } 5915 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5916 5917 default: 5918 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5919 5920 } 5921 } 5922 5923 case "failureReasons": 5924 if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { 5925 return err 5926 } 5927 5928 case "importedResourceId": 5929 if value != nil { 5930 jtv, ok := value.(string) 5931 if !ok { 5932 return fmt.Errorf("expected ImportedResourceId to be of type string, got %T instead", value) 5933 } 5934 sv.ImportedResourceId = ptr.String(jtv) 5935 } 5936 5937 case "importedResourceName": 5938 if value != nil { 5939 jtv, ok := value.(string) 5940 if !ok { 5941 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 5942 } 5943 sv.ImportedResourceName = ptr.String(jtv) 5944 } 5945 5946 case "importId": 5947 if value != nil { 5948 jtv, ok := value.(string) 5949 if !ok { 5950 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5951 } 5952 sv.ImportId = ptr.String(jtv) 5953 } 5954 5955 case "importStatus": 5956 if value != nil { 5957 jtv, ok := value.(string) 5958 if !ok { 5959 return fmt.Errorf("expected ImportStatus to be of type string, got %T instead", value) 5960 } 5961 sv.ImportStatus = types.ImportStatus(jtv) 5962 } 5963 5964 case "lastUpdatedDateTime": 5965 if value != nil { 5966 switch jtv := value.(type) { 5967 case json.Number: 5968 f64, err := jtv.Float64() 5969 if err != nil { 5970 return err 5971 } 5972 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5973 5974 default: 5975 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5976 5977 } 5978 } 5979 5980 case "mergeStrategy": 5981 if value != nil { 5982 jtv, ok := value.(string) 5983 if !ok { 5984 return fmt.Errorf("expected MergeStrategy to be of type string, got %T instead", value) 5985 } 5986 sv.MergeStrategy = types.MergeStrategy(jtv) 5987 } 5988 5989 case "resourceSpecification": 5990 if err := awsRestjson1_deserializeDocumentImportResourceSpecification(&sv.ResourceSpecification, value); err != nil { 5991 return err 5992 } 5993 5994 default: 5995 _, _ = key, value 5996 5997 } 5998 } 5999 *v = sv 6000 return nil 6001} 6002 6003type awsRestjson1_deserializeOpDescribeIntent struct { 6004} 6005 6006func (*awsRestjson1_deserializeOpDescribeIntent) ID() string { 6007 return "OperationDeserializer" 6008} 6009 6010func (m *awsRestjson1_deserializeOpDescribeIntent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6011 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6012) { 6013 out, metadata, err = next.HandleDeserialize(ctx, in) 6014 if err != nil { 6015 return out, metadata, err 6016 } 6017 6018 response, ok := out.RawResponse.(*smithyhttp.Response) 6019 if !ok { 6020 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6021 } 6022 6023 if response.StatusCode < 200 || response.StatusCode >= 300 { 6024 return out, metadata, awsRestjson1_deserializeOpErrorDescribeIntent(response, &metadata) 6025 } 6026 output := &DescribeIntentOutput{} 6027 out.Result = output 6028 6029 var buff [1024]byte 6030 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6031 6032 body := io.TeeReader(response.Body, ringBuffer) 6033 6034 decoder := json.NewDecoder(body) 6035 decoder.UseNumber() 6036 var shape interface{} 6037 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 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 err = awsRestjson1_deserializeOpDocumentDescribeIntentOutput(&output, shape) 6048 if err != nil { 6049 var snapshot bytes.Buffer 6050 io.Copy(&snapshot, ringBuffer) 6051 return out, metadata, &smithy.DeserializationError{ 6052 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6053 Snapshot: snapshot.Bytes(), 6054 } 6055 } 6056 6057 return out, metadata, err 6058} 6059 6060func awsRestjson1_deserializeOpErrorDescribeIntent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6061 var errorBuffer bytes.Buffer 6062 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6063 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6064 } 6065 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6066 6067 errorCode := "UnknownError" 6068 errorMessage := errorCode 6069 6070 code := response.Header.Get("X-Amzn-ErrorType") 6071 if len(code) != 0 { 6072 errorCode = restjson.SanitizeErrorCode(code) 6073 } 6074 6075 var buff [1024]byte 6076 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6077 6078 body := io.TeeReader(errorBody, ringBuffer) 6079 decoder := json.NewDecoder(body) 6080 decoder.UseNumber() 6081 code, message, err := restjson.GetErrorInfo(decoder) 6082 if err != nil { 6083 var snapshot bytes.Buffer 6084 io.Copy(&snapshot, ringBuffer) 6085 err = &smithy.DeserializationError{ 6086 Err: fmt.Errorf("failed to decode response body, %w", err), 6087 Snapshot: snapshot.Bytes(), 6088 } 6089 return err 6090 } 6091 6092 errorBody.Seek(0, io.SeekStart) 6093 if len(code) != 0 { 6094 errorCode = restjson.SanitizeErrorCode(code) 6095 } 6096 if len(message) != 0 { 6097 errorMessage = message 6098 } 6099 6100 switch { 6101 case strings.EqualFold("InternalServerException", errorCode): 6102 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6103 6104 case strings.EqualFold("ResourceNotFoundException", errorCode): 6105 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6106 6107 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 6108 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 6109 6110 case strings.EqualFold("ThrottlingException", errorCode): 6111 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6112 6113 case strings.EqualFold("ValidationException", errorCode): 6114 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6115 6116 default: 6117 genericError := &smithy.GenericAPIError{ 6118 Code: errorCode, 6119 Message: errorMessage, 6120 } 6121 return genericError 6122 6123 } 6124} 6125 6126func awsRestjson1_deserializeOpDocumentDescribeIntentOutput(v **DescribeIntentOutput, value interface{}) error { 6127 if v == nil { 6128 return fmt.Errorf("unexpected nil of type %T", v) 6129 } 6130 if value == nil { 6131 return nil 6132 } 6133 6134 shape, ok := value.(map[string]interface{}) 6135 if !ok { 6136 return fmt.Errorf("unexpected JSON type %v", value) 6137 } 6138 6139 var sv *DescribeIntentOutput 6140 if *v == nil { 6141 sv = &DescribeIntentOutput{} 6142 } else { 6143 sv = *v 6144 } 6145 6146 for key, value := range shape { 6147 switch key { 6148 case "botId": 6149 if value != nil { 6150 jtv, ok := value.(string) 6151 if !ok { 6152 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6153 } 6154 sv.BotId = ptr.String(jtv) 6155 } 6156 6157 case "botVersion": 6158 if value != nil { 6159 jtv, ok := value.(string) 6160 if !ok { 6161 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 6162 } 6163 sv.BotVersion = ptr.String(jtv) 6164 } 6165 6166 case "creationDateTime": 6167 if value != nil { 6168 switch jtv := value.(type) { 6169 case json.Number: 6170 f64, err := jtv.Float64() 6171 if err != nil { 6172 return err 6173 } 6174 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6175 6176 default: 6177 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 6178 6179 } 6180 } 6181 6182 case "description": 6183 if value != nil { 6184 jtv, ok := value.(string) 6185 if !ok { 6186 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 6187 } 6188 sv.Description = ptr.String(jtv) 6189 } 6190 6191 case "dialogCodeHook": 6192 if err := awsRestjson1_deserializeDocumentDialogCodeHookSettings(&sv.DialogCodeHook, value); err != nil { 6193 return err 6194 } 6195 6196 case "fulfillmentCodeHook": 6197 if err := awsRestjson1_deserializeDocumentFulfillmentCodeHookSettings(&sv.FulfillmentCodeHook, value); err != nil { 6198 return err 6199 } 6200 6201 case "inputContexts": 6202 if err := awsRestjson1_deserializeDocumentInputContextsList(&sv.InputContexts, value); err != nil { 6203 return err 6204 } 6205 6206 case "intentClosingSetting": 6207 if err := awsRestjson1_deserializeDocumentIntentClosingSetting(&sv.IntentClosingSetting, value); err != nil { 6208 return err 6209 } 6210 6211 case "intentConfirmationSetting": 6212 if err := awsRestjson1_deserializeDocumentIntentConfirmationSetting(&sv.IntentConfirmationSetting, value); err != nil { 6213 return err 6214 } 6215 6216 case "intentId": 6217 if value != nil { 6218 jtv, ok := value.(string) 6219 if !ok { 6220 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6221 } 6222 sv.IntentId = ptr.String(jtv) 6223 } 6224 6225 case "intentName": 6226 if value != nil { 6227 jtv, ok := value.(string) 6228 if !ok { 6229 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 6230 } 6231 sv.IntentName = ptr.String(jtv) 6232 } 6233 6234 case "kendraConfiguration": 6235 if err := awsRestjson1_deserializeDocumentKendraConfiguration(&sv.KendraConfiguration, value); err != nil { 6236 return err 6237 } 6238 6239 case "lastUpdatedDateTime": 6240 if value != nil { 6241 switch jtv := value.(type) { 6242 case json.Number: 6243 f64, err := jtv.Float64() 6244 if err != nil { 6245 return err 6246 } 6247 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6248 6249 default: 6250 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 6251 6252 } 6253 } 6254 6255 case "localeId": 6256 if value != nil { 6257 jtv, ok := value.(string) 6258 if !ok { 6259 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 6260 } 6261 sv.LocaleId = ptr.String(jtv) 6262 } 6263 6264 case "outputContexts": 6265 if err := awsRestjson1_deserializeDocumentOutputContextsList(&sv.OutputContexts, value); err != nil { 6266 return err 6267 } 6268 6269 case "parentIntentSignature": 6270 if value != nil { 6271 jtv, ok := value.(string) 6272 if !ok { 6273 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 6274 } 6275 sv.ParentIntentSignature = ptr.String(jtv) 6276 } 6277 6278 case "sampleUtterances": 6279 if err := awsRestjson1_deserializeDocumentSampleUtterancesList(&sv.SampleUtterances, value); err != nil { 6280 return err 6281 } 6282 6283 case "slotPriorities": 6284 if err := awsRestjson1_deserializeDocumentSlotPrioritiesList(&sv.SlotPriorities, value); err != nil { 6285 return err 6286 } 6287 6288 default: 6289 _, _ = key, value 6290 6291 } 6292 } 6293 *v = sv 6294 return nil 6295} 6296 6297type awsRestjson1_deserializeOpDescribeResourcePolicy struct { 6298} 6299 6300func (*awsRestjson1_deserializeOpDescribeResourcePolicy) ID() string { 6301 return "OperationDeserializer" 6302} 6303 6304func (m *awsRestjson1_deserializeOpDescribeResourcePolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6305 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6306) { 6307 out, metadata, err = next.HandleDeserialize(ctx, in) 6308 if err != nil { 6309 return out, metadata, err 6310 } 6311 6312 response, ok := out.RawResponse.(*smithyhttp.Response) 6313 if !ok { 6314 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6315 } 6316 6317 if response.StatusCode < 200 || response.StatusCode >= 300 { 6318 return out, metadata, awsRestjson1_deserializeOpErrorDescribeResourcePolicy(response, &metadata) 6319 } 6320 output := &DescribeResourcePolicyOutput{} 6321 out.Result = output 6322 6323 var buff [1024]byte 6324 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6325 6326 body := io.TeeReader(response.Body, ringBuffer) 6327 6328 decoder := json.NewDecoder(body) 6329 decoder.UseNumber() 6330 var shape interface{} 6331 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6332 var snapshot bytes.Buffer 6333 io.Copy(&snapshot, ringBuffer) 6334 err = &smithy.DeserializationError{ 6335 Err: fmt.Errorf("failed to decode response body, %w", err), 6336 Snapshot: snapshot.Bytes(), 6337 } 6338 return out, metadata, err 6339 } 6340 6341 err = awsRestjson1_deserializeOpDocumentDescribeResourcePolicyOutput(&output, shape) 6342 if err != nil { 6343 var snapshot bytes.Buffer 6344 io.Copy(&snapshot, ringBuffer) 6345 return out, metadata, &smithy.DeserializationError{ 6346 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6347 Snapshot: snapshot.Bytes(), 6348 } 6349 } 6350 6351 return out, metadata, err 6352} 6353 6354func awsRestjson1_deserializeOpErrorDescribeResourcePolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6355 var errorBuffer bytes.Buffer 6356 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6357 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6358 } 6359 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6360 6361 errorCode := "UnknownError" 6362 errorMessage := errorCode 6363 6364 code := response.Header.Get("X-Amzn-ErrorType") 6365 if len(code) != 0 { 6366 errorCode = restjson.SanitizeErrorCode(code) 6367 } 6368 6369 var buff [1024]byte 6370 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6371 6372 body := io.TeeReader(errorBody, ringBuffer) 6373 decoder := json.NewDecoder(body) 6374 decoder.UseNumber() 6375 code, message, err := restjson.GetErrorInfo(decoder) 6376 if err != nil { 6377 var snapshot bytes.Buffer 6378 io.Copy(&snapshot, ringBuffer) 6379 err = &smithy.DeserializationError{ 6380 Err: fmt.Errorf("failed to decode response body, %w", err), 6381 Snapshot: snapshot.Bytes(), 6382 } 6383 return err 6384 } 6385 6386 errorBody.Seek(0, io.SeekStart) 6387 if len(code) != 0 { 6388 errorCode = restjson.SanitizeErrorCode(code) 6389 } 6390 if len(message) != 0 { 6391 errorMessage = message 6392 } 6393 6394 switch { 6395 case strings.EqualFold("InternalServerException", errorCode): 6396 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6397 6398 case strings.EqualFold("ResourceNotFoundException", errorCode): 6399 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6400 6401 case strings.EqualFold("ThrottlingException", errorCode): 6402 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6403 6404 default: 6405 genericError := &smithy.GenericAPIError{ 6406 Code: errorCode, 6407 Message: errorMessage, 6408 } 6409 return genericError 6410 6411 } 6412} 6413 6414func awsRestjson1_deserializeOpDocumentDescribeResourcePolicyOutput(v **DescribeResourcePolicyOutput, value interface{}) error { 6415 if v == nil { 6416 return fmt.Errorf("unexpected nil of type %T", v) 6417 } 6418 if value == nil { 6419 return nil 6420 } 6421 6422 shape, ok := value.(map[string]interface{}) 6423 if !ok { 6424 return fmt.Errorf("unexpected JSON type %v", value) 6425 } 6426 6427 var sv *DescribeResourcePolicyOutput 6428 if *v == nil { 6429 sv = &DescribeResourcePolicyOutput{} 6430 } else { 6431 sv = *v 6432 } 6433 6434 for key, value := range shape { 6435 switch key { 6436 case "policy": 6437 if value != nil { 6438 jtv, ok := value.(string) 6439 if !ok { 6440 return fmt.Errorf("expected Policy to be of type string, got %T instead", value) 6441 } 6442 sv.Policy = ptr.String(jtv) 6443 } 6444 6445 case "resourceArn": 6446 if value != nil { 6447 jtv, ok := value.(string) 6448 if !ok { 6449 return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) 6450 } 6451 sv.ResourceArn = ptr.String(jtv) 6452 } 6453 6454 case "revisionId": 6455 if value != nil { 6456 jtv, ok := value.(string) 6457 if !ok { 6458 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 6459 } 6460 sv.RevisionId = ptr.String(jtv) 6461 } 6462 6463 default: 6464 _, _ = key, value 6465 6466 } 6467 } 6468 *v = sv 6469 return nil 6470} 6471 6472type awsRestjson1_deserializeOpDescribeSlot struct { 6473} 6474 6475func (*awsRestjson1_deserializeOpDescribeSlot) ID() string { 6476 return "OperationDeserializer" 6477} 6478 6479func (m *awsRestjson1_deserializeOpDescribeSlot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6480 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6481) { 6482 out, metadata, err = next.HandleDeserialize(ctx, in) 6483 if err != nil { 6484 return out, metadata, err 6485 } 6486 6487 response, ok := out.RawResponse.(*smithyhttp.Response) 6488 if !ok { 6489 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6490 } 6491 6492 if response.StatusCode < 200 || response.StatusCode >= 300 { 6493 return out, metadata, awsRestjson1_deserializeOpErrorDescribeSlot(response, &metadata) 6494 } 6495 output := &DescribeSlotOutput{} 6496 out.Result = output 6497 6498 var buff [1024]byte 6499 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6500 6501 body := io.TeeReader(response.Body, ringBuffer) 6502 6503 decoder := json.NewDecoder(body) 6504 decoder.UseNumber() 6505 var shape interface{} 6506 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6507 var snapshot bytes.Buffer 6508 io.Copy(&snapshot, ringBuffer) 6509 err = &smithy.DeserializationError{ 6510 Err: fmt.Errorf("failed to decode response body, %w", err), 6511 Snapshot: snapshot.Bytes(), 6512 } 6513 return out, metadata, err 6514 } 6515 6516 err = awsRestjson1_deserializeOpDocumentDescribeSlotOutput(&output, shape) 6517 if err != nil { 6518 var snapshot bytes.Buffer 6519 io.Copy(&snapshot, ringBuffer) 6520 return out, metadata, &smithy.DeserializationError{ 6521 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6522 Snapshot: snapshot.Bytes(), 6523 } 6524 } 6525 6526 return out, metadata, err 6527} 6528 6529func awsRestjson1_deserializeOpErrorDescribeSlot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6530 var errorBuffer bytes.Buffer 6531 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6532 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6533 } 6534 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6535 6536 errorCode := "UnknownError" 6537 errorMessage := errorCode 6538 6539 code := response.Header.Get("X-Amzn-ErrorType") 6540 if len(code) != 0 { 6541 errorCode = restjson.SanitizeErrorCode(code) 6542 } 6543 6544 var buff [1024]byte 6545 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6546 6547 body := io.TeeReader(errorBody, ringBuffer) 6548 decoder := json.NewDecoder(body) 6549 decoder.UseNumber() 6550 code, message, err := restjson.GetErrorInfo(decoder) 6551 if err != nil { 6552 var snapshot bytes.Buffer 6553 io.Copy(&snapshot, ringBuffer) 6554 err = &smithy.DeserializationError{ 6555 Err: fmt.Errorf("failed to decode response body, %w", err), 6556 Snapshot: snapshot.Bytes(), 6557 } 6558 return err 6559 } 6560 6561 errorBody.Seek(0, io.SeekStart) 6562 if len(code) != 0 { 6563 errorCode = restjson.SanitizeErrorCode(code) 6564 } 6565 if len(message) != 0 { 6566 errorMessage = message 6567 } 6568 6569 switch { 6570 case strings.EqualFold("InternalServerException", errorCode): 6571 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6572 6573 case strings.EqualFold("ResourceNotFoundException", errorCode): 6574 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6575 6576 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 6577 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 6578 6579 case strings.EqualFold("ThrottlingException", errorCode): 6580 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6581 6582 case strings.EqualFold("ValidationException", errorCode): 6583 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6584 6585 default: 6586 genericError := &smithy.GenericAPIError{ 6587 Code: errorCode, 6588 Message: errorMessage, 6589 } 6590 return genericError 6591 6592 } 6593} 6594 6595func awsRestjson1_deserializeOpDocumentDescribeSlotOutput(v **DescribeSlotOutput, value interface{}) error { 6596 if v == nil { 6597 return fmt.Errorf("unexpected nil of type %T", v) 6598 } 6599 if value == nil { 6600 return nil 6601 } 6602 6603 shape, ok := value.(map[string]interface{}) 6604 if !ok { 6605 return fmt.Errorf("unexpected JSON type %v", value) 6606 } 6607 6608 var sv *DescribeSlotOutput 6609 if *v == nil { 6610 sv = &DescribeSlotOutput{} 6611 } else { 6612 sv = *v 6613 } 6614 6615 for key, value := range shape { 6616 switch key { 6617 case "botId": 6618 if value != nil { 6619 jtv, ok := value.(string) 6620 if !ok { 6621 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6622 } 6623 sv.BotId = ptr.String(jtv) 6624 } 6625 6626 case "botVersion": 6627 if value != nil { 6628 jtv, ok := value.(string) 6629 if !ok { 6630 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 6631 } 6632 sv.BotVersion = ptr.String(jtv) 6633 } 6634 6635 case "creationDateTime": 6636 if value != nil { 6637 switch jtv := value.(type) { 6638 case json.Number: 6639 f64, err := jtv.Float64() 6640 if err != nil { 6641 return err 6642 } 6643 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6644 6645 default: 6646 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 6647 6648 } 6649 } 6650 6651 case "description": 6652 if value != nil { 6653 jtv, ok := value.(string) 6654 if !ok { 6655 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 6656 } 6657 sv.Description = ptr.String(jtv) 6658 } 6659 6660 case "intentId": 6661 if value != nil { 6662 jtv, ok := value.(string) 6663 if !ok { 6664 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6665 } 6666 sv.IntentId = ptr.String(jtv) 6667 } 6668 6669 case "lastUpdatedDateTime": 6670 if value != nil { 6671 switch jtv := value.(type) { 6672 case json.Number: 6673 f64, err := jtv.Float64() 6674 if err != nil { 6675 return err 6676 } 6677 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6678 6679 default: 6680 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 6681 6682 } 6683 } 6684 6685 case "localeId": 6686 if value != nil { 6687 jtv, ok := value.(string) 6688 if !ok { 6689 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 6690 } 6691 sv.LocaleId = ptr.String(jtv) 6692 } 6693 6694 case "multipleValuesSetting": 6695 if err := awsRestjson1_deserializeDocumentMultipleValuesSetting(&sv.MultipleValuesSetting, value); err != nil { 6696 return err 6697 } 6698 6699 case "obfuscationSetting": 6700 if err := awsRestjson1_deserializeDocumentObfuscationSetting(&sv.ObfuscationSetting, value); err != nil { 6701 return err 6702 } 6703 6704 case "slotId": 6705 if value != nil { 6706 jtv, ok := value.(string) 6707 if !ok { 6708 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6709 } 6710 sv.SlotId = ptr.String(jtv) 6711 } 6712 6713 case "slotName": 6714 if value != nil { 6715 jtv, ok := value.(string) 6716 if !ok { 6717 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 6718 } 6719 sv.SlotName = ptr.String(jtv) 6720 } 6721 6722 case "slotTypeId": 6723 if value != nil { 6724 jtv, ok := value.(string) 6725 if !ok { 6726 return fmt.Errorf("expected BuiltInOrCustomSlotTypeId to be of type string, got %T instead", value) 6727 } 6728 sv.SlotTypeId = ptr.String(jtv) 6729 } 6730 6731 case "valueElicitationSetting": 6732 if err := awsRestjson1_deserializeDocumentSlotValueElicitationSetting(&sv.ValueElicitationSetting, value); err != nil { 6733 return err 6734 } 6735 6736 default: 6737 _, _ = key, value 6738 6739 } 6740 } 6741 *v = sv 6742 return nil 6743} 6744 6745type awsRestjson1_deserializeOpDescribeSlotType struct { 6746} 6747 6748func (*awsRestjson1_deserializeOpDescribeSlotType) ID() string { 6749 return "OperationDeserializer" 6750} 6751 6752func (m *awsRestjson1_deserializeOpDescribeSlotType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6753 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6754) { 6755 out, metadata, err = next.HandleDeserialize(ctx, in) 6756 if err != nil { 6757 return out, metadata, err 6758 } 6759 6760 response, ok := out.RawResponse.(*smithyhttp.Response) 6761 if !ok { 6762 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6763 } 6764 6765 if response.StatusCode < 200 || response.StatusCode >= 300 { 6766 return out, metadata, awsRestjson1_deserializeOpErrorDescribeSlotType(response, &metadata) 6767 } 6768 output := &DescribeSlotTypeOutput{} 6769 out.Result = output 6770 6771 var buff [1024]byte 6772 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6773 6774 body := io.TeeReader(response.Body, ringBuffer) 6775 6776 decoder := json.NewDecoder(body) 6777 decoder.UseNumber() 6778 var shape interface{} 6779 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6780 var snapshot bytes.Buffer 6781 io.Copy(&snapshot, ringBuffer) 6782 err = &smithy.DeserializationError{ 6783 Err: fmt.Errorf("failed to decode response body, %w", err), 6784 Snapshot: snapshot.Bytes(), 6785 } 6786 return out, metadata, err 6787 } 6788 6789 err = awsRestjson1_deserializeOpDocumentDescribeSlotTypeOutput(&output, shape) 6790 if err != nil { 6791 var snapshot bytes.Buffer 6792 io.Copy(&snapshot, ringBuffer) 6793 return out, metadata, &smithy.DeserializationError{ 6794 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6795 Snapshot: snapshot.Bytes(), 6796 } 6797 } 6798 6799 return out, metadata, err 6800} 6801 6802func awsRestjson1_deserializeOpErrorDescribeSlotType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6803 var errorBuffer bytes.Buffer 6804 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6805 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6806 } 6807 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6808 6809 errorCode := "UnknownError" 6810 errorMessage := errorCode 6811 6812 code := response.Header.Get("X-Amzn-ErrorType") 6813 if len(code) != 0 { 6814 errorCode = restjson.SanitizeErrorCode(code) 6815 } 6816 6817 var buff [1024]byte 6818 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6819 6820 body := io.TeeReader(errorBody, ringBuffer) 6821 decoder := json.NewDecoder(body) 6822 decoder.UseNumber() 6823 code, message, err := restjson.GetErrorInfo(decoder) 6824 if err != nil { 6825 var snapshot bytes.Buffer 6826 io.Copy(&snapshot, ringBuffer) 6827 err = &smithy.DeserializationError{ 6828 Err: fmt.Errorf("failed to decode response body, %w", err), 6829 Snapshot: snapshot.Bytes(), 6830 } 6831 return err 6832 } 6833 6834 errorBody.Seek(0, io.SeekStart) 6835 if len(code) != 0 { 6836 errorCode = restjson.SanitizeErrorCode(code) 6837 } 6838 if len(message) != 0 { 6839 errorMessage = message 6840 } 6841 6842 switch { 6843 case strings.EqualFold("InternalServerException", errorCode): 6844 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6845 6846 case strings.EqualFold("ResourceNotFoundException", errorCode): 6847 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6848 6849 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 6850 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 6851 6852 case strings.EqualFold("ThrottlingException", errorCode): 6853 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6854 6855 case strings.EqualFold("ValidationException", errorCode): 6856 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6857 6858 default: 6859 genericError := &smithy.GenericAPIError{ 6860 Code: errorCode, 6861 Message: errorMessage, 6862 } 6863 return genericError 6864 6865 } 6866} 6867 6868func awsRestjson1_deserializeOpDocumentDescribeSlotTypeOutput(v **DescribeSlotTypeOutput, value interface{}) error { 6869 if v == nil { 6870 return fmt.Errorf("unexpected nil of type %T", v) 6871 } 6872 if value == nil { 6873 return nil 6874 } 6875 6876 shape, ok := value.(map[string]interface{}) 6877 if !ok { 6878 return fmt.Errorf("unexpected JSON type %v", value) 6879 } 6880 6881 var sv *DescribeSlotTypeOutput 6882 if *v == nil { 6883 sv = &DescribeSlotTypeOutput{} 6884 } else { 6885 sv = *v 6886 } 6887 6888 for key, value := range shape { 6889 switch key { 6890 case "botId": 6891 if value != nil { 6892 jtv, ok := value.(string) 6893 if !ok { 6894 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6895 } 6896 sv.BotId = ptr.String(jtv) 6897 } 6898 6899 case "botVersion": 6900 if value != nil { 6901 jtv, ok := value.(string) 6902 if !ok { 6903 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 6904 } 6905 sv.BotVersion = ptr.String(jtv) 6906 } 6907 6908 case "creationDateTime": 6909 if value != nil { 6910 switch jtv := value.(type) { 6911 case json.Number: 6912 f64, err := jtv.Float64() 6913 if err != nil { 6914 return err 6915 } 6916 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6917 6918 default: 6919 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 6920 6921 } 6922 } 6923 6924 case "description": 6925 if value != nil { 6926 jtv, ok := value.(string) 6927 if !ok { 6928 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 6929 } 6930 sv.Description = ptr.String(jtv) 6931 } 6932 6933 case "lastUpdatedDateTime": 6934 if value != nil { 6935 switch jtv := value.(type) { 6936 case json.Number: 6937 f64, err := jtv.Float64() 6938 if err != nil { 6939 return err 6940 } 6941 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6942 6943 default: 6944 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 6945 6946 } 6947 } 6948 6949 case "localeId": 6950 if value != nil { 6951 jtv, ok := value.(string) 6952 if !ok { 6953 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 6954 } 6955 sv.LocaleId = ptr.String(jtv) 6956 } 6957 6958 case "parentSlotTypeSignature": 6959 if value != nil { 6960 jtv, ok := value.(string) 6961 if !ok { 6962 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 6963 } 6964 sv.ParentSlotTypeSignature = ptr.String(jtv) 6965 } 6966 6967 case "slotTypeId": 6968 if value != nil { 6969 jtv, ok := value.(string) 6970 if !ok { 6971 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6972 } 6973 sv.SlotTypeId = ptr.String(jtv) 6974 } 6975 6976 case "slotTypeName": 6977 if value != nil { 6978 jtv, ok := value.(string) 6979 if !ok { 6980 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 6981 } 6982 sv.SlotTypeName = ptr.String(jtv) 6983 } 6984 6985 case "slotTypeValues": 6986 if err := awsRestjson1_deserializeDocumentSlotTypeValues(&sv.SlotTypeValues, value); err != nil { 6987 return err 6988 } 6989 6990 case "valueSelectionSetting": 6991 if err := awsRestjson1_deserializeDocumentSlotValueSelectionSetting(&sv.ValueSelectionSetting, value); err != nil { 6992 return err 6993 } 6994 6995 default: 6996 _, _ = key, value 6997 6998 } 6999 } 7000 *v = sv 7001 return nil 7002} 7003 7004type awsRestjson1_deserializeOpListBotAliases struct { 7005} 7006 7007func (*awsRestjson1_deserializeOpListBotAliases) ID() string { 7008 return "OperationDeserializer" 7009} 7010 7011func (m *awsRestjson1_deserializeOpListBotAliases) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7012 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7013) { 7014 out, metadata, err = next.HandleDeserialize(ctx, in) 7015 if err != nil { 7016 return out, metadata, err 7017 } 7018 7019 response, ok := out.RawResponse.(*smithyhttp.Response) 7020 if !ok { 7021 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7022 } 7023 7024 if response.StatusCode < 200 || response.StatusCode >= 300 { 7025 return out, metadata, awsRestjson1_deserializeOpErrorListBotAliases(response, &metadata) 7026 } 7027 output := &ListBotAliasesOutput{} 7028 out.Result = output 7029 7030 var buff [1024]byte 7031 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7032 7033 body := io.TeeReader(response.Body, ringBuffer) 7034 7035 decoder := json.NewDecoder(body) 7036 decoder.UseNumber() 7037 var shape interface{} 7038 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7039 var snapshot bytes.Buffer 7040 io.Copy(&snapshot, ringBuffer) 7041 err = &smithy.DeserializationError{ 7042 Err: fmt.Errorf("failed to decode response body, %w", err), 7043 Snapshot: snapshot.Bytes(), 7044 } 7045 return out, metadata, err 7046 } 7047 7048 err = awsRestjson1_deserializeOpDocumentListBotAliasesOutput(&output, shape) 7049 if err != nil { 7050 var snapshot bytes.Buffer 7051 io.Copy(&snapshot, ringBuffer) 7052 return out, metadata, &smithy.DeserializationError{ 7053 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7054 Snapshot: snapshot.Bytes(), 7055 } 7056 } 7057 7058 return out, metadata, err 7059} 7060 7061func awsRestjson1_deserializeOpErrorListBotAliases(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7062 var errorBuffer bytes.Buffer 7063 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7064 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7065 } 7066 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7067 7068 errorCode := "UnknownError" 7069 errorMessage := errorCode 7070 7071 code := response.Header.Get("X-Amzn-ErrorType") 7072 if len(code) != 0 { 7073 errorCode = restjson.SanitizeErrorCode(code) 7074 } 7075 7076 var buff [1024]byte 7077 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7078 7079 body := io.TeeReader(errorBody, ringBuffer) 7080 decoder := json.NewDecoder(body) 7081 decoder.UseNumber() 7082 code, message, err := restjson.GetErrorInfo(decoder) 7083 if err != nil { 7084 var snapshot bytes.Buffer 7085 io.Copy(&snapshot, ringBuffer) 7086 err = &smithy.DeserializationError{ 7087 Err: fmt.Errorf("failed to decode response body, %w", err), 7088 Snapshot: snapshot.Bytes(), 7089 } 7090 return err 7091 } 7092 7093 errorBody.Seek(0, io.SeekStart) 7094 if len(code) != 0 { 7095 errorCode = restjson.SanitizeErrorCode(code) 7096 } 7097 if len(message) != 0 { 7098 errorMessage = message 7099 } 7100 7101 switch { 7102 case strings.EqualFold("InternalServerException", errorCode): 7103 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7104 7105 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7106 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7107 7108 case strings.EqualFold("ThrottlingException", errorCode): 7109 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7110 7111 case strings.EqualFold("ValidationException", errorCode): 7112 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7113 7114 default: 7115 genericError := &smithy.GenericAPIError{ 7116 Code: errorCode, 7117 Message: errorMessage, 7118 } 7119 return genericError 7120 7121 } 7122} 7123 7124func awsRestjson1_deserializeOpDocumentListBotAliasesOutput(v **ListBotAliasesOutput, value interface{}) error { 7125 if v == nil { 7126 return fmt.Errorf("unexpected nil of type %T", v) 7127 } 7128 if value == nil { 7129 return nil 7130 } 7131 7132 shape, ok := value.(map[string]interface{}) 7133 if !ok { 7134 return fmt.Errorf("unexpected JSON type %v", value) 7135 } 7136 7137 var sv *ListBotAliasesOutput 7138 if *v == nil { 7139 sv = &ListBotAliasesOutput{} 7140 } else { 7141 sv = *v 7142 } 7143 7144 for key, value := range shape { 7145 switch key { 7146 case "botAliasSummaries": 7147 if err := awsRestjson1_deserializeDocumentBotAliasSummaryList(&sv.BotAliasSummaries, value); err != nil { 7148 return err 7149 } 7150 7151 case "botId": 7152 if value != nil { 7153 jtv, ok := value.(string) 7154 if !ok { 7155 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7156 } 7157 sv.BotId = ptr.String(jtv) 7158 } 7159 7160 case "nextToken": 7161 if value != nil { 7162 jtv, ok := value.(string) 7163 if !ok { 7164 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7165 } 7166 sv.NextToken = ptr.String(jtv) 7167 } 7168 7169 default: 7170 _, _ = key, value 7171 7172 } 7173 } 7174 *v = sv 7175 return nil 7176} 7177 7178type awsRestjson1_deserializeOpListBotLocales struct { 7179} 7180 7181func (*awsRestjson1_deserializeOpListBotLocales) ID() string { 7182 return "OperationDeserializer" 7183} 7184 7185func (m *awsRestjson1_deserializeOpListBotLocales) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7186 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7187) { 7188 out, metadata, err = next.HandleDeserialize(ctx, in) 7189 if err != nil { 7190 return out, metadata, err 7191 } 7192 7193 response, ok := out.RawResponse.(*smithyhttp.Response) 7194 if !ok { 7195 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7196 } 7197 7198 if response.StatusCode < 200 || response.StatusCode >= 300 { 7199 return out, metadata, awsRestjson1_deserializeOpErrorListBotLocales(response, &metadata) 7200 } 7201 output := &ListBotLocalesOutput{} 7202 out.Result = output 7203 7204 var buff [1024]byte 7205 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7206 7207 body := io.TeeReader(response.Body, ringBuffer) 7208 7209 decoder := json.NewDecoder(body) 7210 decoder.UseNumber() 7211 var shape interface{} 7212 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7213 var snapshot bytes.Buffer 7214 io.Copy(&snapshot, ringBuffer) 7215 err = &smithy.DeserializationError{ 7216 Err: fmt.Errorf("failed to decode response body, %w", err), 7217 Snapshot: snapshot.Bytes(), 7218 } 7219 return out, metadata, err 7220 } 7221 7222 err = awsRestjson1_deserializeOpDocumentListBotLocalesOutput(&output, shape) 7223 if err != nil { 7224 var snapshot bytes.Buffer 7225 io.Copy(&snapshot, ringBuffer) 7226 return out, metadata, &smithy.DeserializationError{ 7227 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7228 Snapshot: snapshot.Bytes(), 7229 } 7230 } 7231 7232 return out, metadata, err 7233} 7234 7235func awsRestjson1_deserializeOpErrorListBotLocales(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7236 var errorBuffer bytes.Buffer 7237 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7238 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7239 } 7240 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7241 7242 errorCode := "UnknownError" 7243 errorMessage := errorCode 7244 7245 code := response.Header.Get("X-Amzn-ErrorType") 7246 if len(code) != 0 { 7247 errorCode = restjson.SanitizeErrorCode(code) 7248 } 7249 7250 var buff [1024]byte 7251 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7252 7253 body := io.TeeReader(errorBody, ringBuffer) 7254 decoder := json.NewDecoder(body) 7255 decoder.UseNumber() 7256 code, message, err := restjson.GetErrorInfo(decoder) 7257 if err != nil { 7258 var snapshot bytes.Buffer 7259 io.Copy(&snapshot, ringBuffer) 7260 err = &smithy.DeserializationError{ 7261 Err: fmt.Errorf("failed to decode response body, %w", err), 7262 Snapshot: snapshot.Bytes(), 7263 } 7264 return err 7265 } 7266 7267 errorBody.Seek(0, io.SeekStart) 7268 if len(code) != 0 { 7269 errorCode = restjson.SanitizeErrorCode(code) 7270 } 7271 if len(message) != 0 { 7272 errorMessage = message 7273 } 7274 7275 switch { 7276 case strings.EqualFold("InternalServerException", errorCode): 7277 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7278 7279 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7280 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7281 7282 case strings.EqualFold("ThrottlingException", errorCode): 7283 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7284 7285 case strings.EqualFold("ValidationException", errorCode): 7286 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7287 7288 default: 7289 genericError := &smithy.GenericAPIError{ 7290 Code: errorCode, 7291 Message: errorMessage, 7292 } 7293 return genericError 7294 7295 } 7296} 7297 7298func awsRestjson1_deserializeOpDocumentListBotLocalesOutput(v **ListBotLocalesOutput, value interface{}) error { 7299 if v == nil { 7300 return fmt.Errorf("unexpected nil of type %T", v) 7301 } 7302 if value == nil { 7303 return nil 7304 } 7305 7306 shape, ok := value.(map[string]interface{}) 7307 if !ok { 7308 return fmt.Errorf("unexpected JSON type %v", value) 7309 } 7310 7311 var sv *ListBotLocalesOutput 7312 if *v == nil { 7313 sv = &ListBotLocalesOutput{} 7314 } else { 7315 sv = *v 7316 } 7317 7318 for key, value := range shape { 7319 switch key { 7320 case "botId": 7321 if value != nil { 7322 jtv, ok := value.(string) 7323 if !ok { 7324 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7325 } 7326 sv.BotId = ptr.String(jtv) 7327 } 7328 7329 case "botLocaleSummaries": 7330 if err := awsRestjson1_deserializeDocumentBotLocaleSummaryList(&sv.BotLocaleSummaries, value); err != nil { 7331 return err 7332 } 7333 7334 case "botVersion": 7335 if value != nil { 7336 jtv, ok := value.(string) 7337 if !ok { 7338 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 7339 } 7340 sv.BotVersion = ptr.String(jtv) 7341 } 7342 7343 case "nextToken": 7344 if value != nil { 7345 jtv, ok := value.(string) 7346 if !ok { 7347 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7348 } 7349 sv.NextToken = ptr.String(jtv) 7350 } 7351 7352 default: 7353 _, _ = key, value 7354 7355 } 7356 } 7357 *v = sv 7358 return nil 7359} 7360 7361type awsRestjson1_deserializeOpListBots struct { 7362} 7363 7364func (*awsRestjson1_deserializeOpListBots) ID() string { 7365 return "OperationDeserializer" 7366} 7367 7368func (m *awsRestjson1_deserializeOpListBots) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7369 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7370) { 7371 out, metadata, err = next.HandleDeserialize(ctx, in) 7372 if err != nil { 7373 return out, metadata, err 7374 } 7375 7376 response, ok := out.RawResponse.(*smithyhttp.Response) 7377 if !ok { 7378 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7379 } 7380 7381 if response.StatusCode < 200 || response.StatusCode >= 300 { 7382 return out, metadata, awsRestjson1_deserializeOpErrorListBots(response, &metadata) 7383 } 7384 output := &ListBotsOutput{} 7385 out.Result = output 7386 7387 var buff [1024]byte 7388 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7389 7390 body := io.TeeReader(response.Body, ringBuffer) 7391 7392 decoder := json.NewDecoder(body) 7393 decoder.UseNumber() 7394 var shape interface{} 7395 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7396 var snapshot bytes.Buffer 7397 io.Copy(&snapshot, ringBuffer) 7398 err = &smithy.DeserializationError{ 7399 Err: fmt.Errorf("failed to decode response body, %w", err), 7400 Snapshot: snapshot.Bytes(), 7401 } 7402 return out, metadata, err 7403 } 7404 7405 err = awsRestjson1_deserializeOpDocumentListBotsOutput(&output, shape) 7406 if err != nil { 7407 var snapshot bytes.Buffer 7408 io.Copy(&snapshot, ringBuffer) 7409 return out, metadata, &smithy.DeserializationError{ 7410 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7411 Snapshot: snapshot.Bytes(), 7412 } 7413 } 7414 7415 return out, metadata, err 7416} 7417 7418func awsRestjson1_deserializeOpErrorListBots(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7419 var errorBuffer bytes.Buffer 7420 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7421 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7422 } 7423 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7424 7425 errorCode := "UnknownError" 7426 errorMessage := errorCode 7427 7428 code := response.Header.Get("X-Amzn-ErrorType") 7429 if len(code) != 0 { 7430 errorCode = restjson.SanitizeErrorCode(code) 7431 } 7432 7433 var buff [1024]byte 7434 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7435 7436 body := io.TeeReader(errorBody, ringBuffer) 7437 decoder := json.NewDecoder(body) 7438 decoder.UseNumber() 7439 code, message, err := restjson.GetErrorInfo(decoder) 7440 if err != nil { 7441 var snapshot bytes.Buffer 7442 io.Copy(&snapshot, ringBuffer) 7443 err = &smithy.DeserializationError{ 7444 Err: fmt.Errorf("failed to decode response body, %w", err), 7445 Snapshot: snapshot.Bytes(), 7446 } 7447 return err 7448 } 7449 7450 errorBody.Seek(0, io.SeekStart) 7451 if len(code) != 0 { 7452 errorCode = restjson.SanitizeErrorCode(code) 7453 } 7454 if len(message) != 0 { 7455 errorMessage = message 7456 } 7457 7458 switch { 7459 case strings.EqualFold("InternalServerException", errorCode): 7460 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7461 7462 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7463 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7464 7465 case strings.EqualFold("ThrottlingException", errorCode): 7466 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7467 7468 case strings.EqualFold("ValidationException", errorCode): 7469 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7470 7471 default: 7472 genericError := &smithy.GenericAPIError{ 7473 Code: errorCode, 7474 Message: errorMessage, 7475 } 7476 return genericError 7477 7478 } 7479} 7480 7481func awsRestjson1_deserializeOpDocumentListBotsOutput(v **ListBotsOutput, value interface{}) error { 7482 if v == nil { 7483 return fmt.Errorf("unexpected nil of type %T", v) 7484 } 7485 if value == nil { 7486 return nil 7487 } 7488 7489 shape, ok := value.(map[string]interface{}) 7490 if !ok { 7491 return fmt.Errorf("unexpected JSON type %v", value) 7492 } 7493 7494 var sv *ListBotsOutput 7495 if *v == nil { 7496 sv = &ListBotsOutput{} 7497 } else { 7498 sv = *v 7499 } 7500 7501 for key, value := range shape { 7502 switch key { 7503 case "botSummaries": 7504 if err := awsRestjson1_deserializeDocumentBotSummaryList(&sv.BotSummaries, value); err != nil { 7505 return err 7506 } 7507 7508 case "nextToken": 7509 if value != nil { 7510 jtv, ok := value.(string) 7511 if !ok { 7512 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7513 } 7514 sv.NextToken = ptr.String(jtv) 7515 } 7516 7517 default: 7518 _, _ = key, value 7519 7520 } 7521 } 7522 *v = sv 7523 return nil 7524} 7525 7526type awsRestjson1_deserializeOpListBotVersions struct { 7527} 7528 7529func (*awsRestjson1_deserializeOpListBotVersions) ID() string { 7530 return "OperationDeserializer" 7531} 7532 7533func (m *awsRestjson1_deserializeOpListBotVersions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7534 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7535) { 7536 out, metadata, err = next.HandleDeserialize(ctx, in) 7537 if err != nil { 7538 return out, metadata, err 7539 } 7540 7541 response, ok := out.RawResponse.(*smithyhttp.Response) 7542 if !ok { 7543 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7544 } 7545 7546 if response.StatusCode < 200 || response.StatusCode >= 300 { 7547 return out, metadata, awsRestjson1_deserializeOpErrorListBotVersions(response, &metadata) 7548 } 7549 output := &ListBotVersionsOutput{} 7550 out.Result = output 7551 7552 var buff [1024]byte 7553 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7554 7555 body := io.TeeReader(response.Body, ringBuffer) 7556 7557 decoder := json.NewDecoder(body) 7558 decoder.UseNumber() 7559 var shape interface{} 7560 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7561 var snapshot bytes.Buffer 7562 io.Copy(&snapshot, ringBuffer) 7563 err = &smithy.DeserializationError{ 7564 Err: fmt.Errorf("failed to decode response body, %w", err), 7565 Snapshot: snapshot.Bytes(), 7566 } 7567 return out, metadata, err 7568 } 7569 7570 err = awsRestjson1_deserializeOpDocumentListBotVersionsOutput(&output, shape) 7571 if err != nil { 7572 var snapshot bytes.Buffer 7573 io.Copy(&snapshot, ringBuffer) 7574 return out, metadata, &smithy.DeserializationError{ 7575 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7576 Snapshot: snapshot.Bytes(), 7577 } 7578 } 7579 7580 return out, metadata, err 7581} 7582 7583func awsRestjson1_deserializeOpErrorListBotVersions(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7584 var errorBuffer bytes.Buffer 7585 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7586 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7587 } 7588 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7589 7590 errorCode := "UnknownError" 7591 errorMessage := errorCode 7592 7593 code := response.Header.Get("X-Amzn-ErrorType") 7594 if len(code) != 0 { 7595 errorCode = restjson.SanitizeErrorCode(code) 7596 } 7597 7598 var buff [1024]byte 7599 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7600 7601 body := io.TeeReader(errorBody, ringBuffer) 7602 decoder := json.NewDecoder(body) 7603 decoder.UseNumber() 7604 code, message, err := restjson.GetErrorInfo(decoder) 7605 if err != nil { 7606 var snapshot bytes.Buffer 7607 io.Copy(&snapshot, ringBuffer) 7608 err = &smithy.DeserializationError{ 7609 Err: fmt.Errorf("failed to decode response body, %w", err), 7610 Snapshot: snapshot.Bytes(), 7611 } 7612 return err 7613 } 7614 7615 errorBody.Seek(0, io.SeekStart) 7616 if len(code) != 0 { 7617 errorCode = restjson.SanitizeErrorCode(code) 7618 } 7619 if len(message) != 0 { 7620 errorMessage = message 7621 } 7622 7623 switch { 7624 case strings.EqualFold("InternalServerException", errorCode): 7625 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7626 7627 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7628 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7629 7630 case strings.EqualFold("ThrottlingException", errorCode): 7631 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7632 7633 case strings.EqualFold("ValidationException", errorCode): 7634 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7635 7636 default: 7637 genericError := &smithy.GenericAPIError{ 7638 Code: errorCode, 7639 Message: errorMessage, 7640 } 7641 return genericError 7642 7643 } 7644} 7645 7646func awsRestjson1_deserializeOpDocumentListBotVersionsOutput(v **ListBotVersionsOutput, value interface{}) error { 7647 if v == nil { 7648 return fmt.Errorf("unexpected nil of type %T", v) 7649 } 7650 if value == nil { 7651 return nil 7652 } 7653 7654 shape, ok := value.(map[string]interface{}) 7655 if !ok { 7656 return fmt.Errorf("unexpected JSON type %v", value) 7657 } 7658 7659 var sv *ListBotVersionsOutput 7660 if *v == nil { 7661 sv = &ListBotVersionsOutput{} 7662 } else { 7663 sv = *v 7664 } 7665 7666 for key, value := range shape { 7667 switch key { 7668 case "botId": 7669 if value != nil { 7670 jtv, ok := value.(string) 7671 if !ok { 7672 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7673 } 7674 sv.BotId = ptr.String(jtv) 7675 } 7676 7677 case "botVersionSummaries": 7678 if err := awsRestjson1_deserializeDocumentBotVersionSummaryList(&sv.BotVersionSummaries, value); err != nil { 7679 return err 7680 } 7681 7682 case "nextToken": 7683 if value != nil { 7684 jtv, ok := value.(string) 7685 if !ok { 7686 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7687 } 7688 sv.NextToken = ptr.String(jtv) 7689 } 7690 7691 default: 7692 _, _ = key, value 7693 7694 } 7695 } 7696 *v = sv 7697 return nil 7698} 7699 7700type awsRestjson1_deserializeOpListBuiltInIntents struct { 7701} 7702 7703func (*awsRestjson1_deserializeOpListBuiltInIntents) ID() string { 7704 return "OperationDeserializer" 7705} 7706 7707func (m *awsRestjson1_deserializeOpListBuiltInIntents) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7708 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7709) { 7710 out, metadata, err = next.HandleDeserialize(ctx, in) 7711 if err != nil { 7712 return out, metadata, err 7713 } 7714 7715 response, ok := out.RawResponse.(*smithyhttp.Response) 7716 if !ok { 7717 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7718 } 7719 7720 if response.StatusCode < 200 || response.StatusCode >= 300 { 7721 return out, metadata, awsRestjson1_deserializeOpErrorListBuiltInIntents(response, &metadata) 7722 } 7723 output := &ListBuiltInIntentsOutput{} 7724 out.Result = output 7725 7726 var buff [1024]byte 7727 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7728 7729 body := io.TeeReader(response.Body, ringBuffer) 7730 7731 decoder := json.NewDecoder(body) 7732 decoder.UseNumber() 7733 var shape interface{} 7734 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 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 out, metadata, err 7742 } 7743 7744 err = awsRestjson1_deserializeOpDocumentListBuiltInIntentsOutput(&output, shape) 7745 if err != nil { 7746 var snapshot bytes.Buffer 7747 io.Copy(&snapshot, ringBuffer) 7748 return out, metadata, &smithy.DeserializationError{ 7749 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7750 Snapshot: snapshot.Bytes(), 7751 } 7752 } 7753 7754 return out, metadata, err 7755} 7756 7757func awsRestjson1_deserializeOpErrorListBuiltInIntents(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7758 var errorBuffer bytes.Buffer 7759 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7760 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7761 } 7762 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7763 7764 errorCode := "UnknownError" 7765 errorMessage := errorCode 7766 7767 code := response.Header.Get("X-Amzn-ErrorType") 7768 if len(code) != 0 { 7769 errorCode = restjson.SanitizeErrorCode(code) 7770 } 7771 7772 var buff [1024]byte 7773 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7774 7775 body := io.TeeReader(errorBody, ringBuffer) 7776 decoder := json.NewDecoder(body) 7777 decoder.UseNumber() 7778 code, message, err := restjson.GetErrorInfo(decoder) 7779 if err != nil { 7780 var snapshot bytes.Buffer 7781 io.Copy(&snapshot, ringBuffer) 7782 err = &smithy.DeserializationError{ 7783 Err: fmt.Errorf("failed to decode response body, %w", err), 7784 Snapshot: snapshot.Bytes(), 7785 } 7786 return err 7787 } 7788 7789 errorBody.Seek(0, io.SeekStart) 7790 if len(code) != 0 { 7791 errorCode = restjson.SanitizeErrorCode(code) 7792 } 7793 if len(message) != 0 { 7794 errorMessage = message 7795 } 7796 7797 switch { 7798 case strings.EqualFold("InternalServerException", errorCode): 7799 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7800 7801 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7802 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7803 7804 case strings.EqualFold("ThrottlingException", errorCode): 7805 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7806 7807 case strings.EqualFold("ValidationException", errorCode): 7808 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7809 7810 default: 7811 genericError := &smithy.GenericAPIError{ 7812 Code: errorCode, 7813 Message: errorMessage, 7814 } 7815 return genericError 7816 7817 } 7818} 7819 7820func awsRestjson1_deserializeOpDocumentListBuiltInIntentsOutput(v **ListBuiltInIntentsOutput, value interface{}) error { 7821 if v == nil { 7822 return fmt.Errorf("unexpected nil of type %T", v) 7823 } 7824 if value == nil { 7825 return nil 7826 } 7827 7828 shape, ok := value.(map[string]interface{}) 7829 if !ok { 7830 return fmt.Errorf("unexpected JSON type %v", value) 7831 } 7832 7833 var sv *ListBuiltInIntentsOutput 7834 if *v == nil { 7835 sv = &ListBuiltInIntentsOutput{} 7836 } else { 7837 sv = *v 7838 } 7839 7840 for key, value := range shape { 7841 switch key { 7842 case "builtInIntentSummaries": 7843 if err := awsRestjson1_deserializeDocumentBuiltInIntentSummaryList(&sv.BuiltInIntentSummaries, value); err != nil { 7844 return err 7845 } 7846 7847 case "localeId": 7848 if value != nil { 7849 jtv, ok := value.(string) 7850 if !ok { 7851 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 7852 } 7853 sv.LocaleId = ptr.String(jtv) 7854 } 7855 7856 case "nextToken": 7857 if value != nil { 7858 jtv, ok := value.(string) 7859 if !ok { 7860 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 7861 } 7862 sv.NextToken = ptr.String(jtv) 7863 } 7864 7865 default: 7866 _, _ = key, value 7867 7868 } 7869 } 7870 *v = sv 7871 return nil 7872} 7873 7874type awsRestjson1_deserializeOpListBuiltInSlotTypes struct { 7875} 7876 7877func (*awsRestjson1_deserializeOpListBuiltInSlotTypes) ID() string { 7878 return "OperationDeserializer" 7879} 7880 7881func (m *awsRestjson1_deserializeOpListBuiltInSlotTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7882 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7883) { 7884 out, metadata, err = next.HandleDeserialize(ctx, in) 7885 if err != nil { 7886 return out, metadata, err 7887 } 7888 7889 response, ok := out.RawResponse.(*smithyhttp.Response) 7890 if !ok { 7891 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7892 } 7893 7894 if response.StatusCode < 200 || response.StatusCode >= 300 { 7895 return out, metadata, awsRestjson1_deserializeOpErrorListBuiltInSlotTypes(response, &metadata) 7896 } 7897 output := &ListBuiltInSlotTypesOutput{} 7898 out.Result = output 7899 7900 var buff [1024]byte 7901 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7902 7903 body := io.TeeReader(response.Body, ringBuffer) 7904 7905 decoder := json.NewDecoder(body) 7906 decoder.UseNumber() 7907 var shape interface{} 7908 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7909 var snapshot bytes.Buffer 7910 io.Copy(&snapshot, ringBuffer) 7911 err = &smithy.DeserializationError{ 7912 Err: fmt.Errorf("failed to decode response body, %w", err), 7913 Snapshot: snapshot.Bytes(), 7914 } 7915 return out, metadata, err 7916 } 7917 7918 err = awsRestjson1_deserializeOpDocumentListBuiltInSlotTypesOutput(&output, shape) 7919 if err != nil { 7920 var snapshot bytes.Buffer 7921 io.Copy(&snapshot, ringBuffer) 7922 return out, metadata, &smithy.DeserializationError{ 7923 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7924 Snapshot: snapshot.Bytes(), 7925 } 7926 } 7927 7928 return out, metadata, err 7929} 7930 7931func awsRestjson1_deserializeOpErrorListBuiltInSlotTypes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7932 var errorBuffer bytes.Buffer 7933 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7934 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7935 } 7936 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7937 7938 errorCode := "UnknownError" 7939 errorMessage := errorCode 7940 7941 code := response.Header.Get("X-Amzn-ErrorType") 7942 if len(code) != 0 { 7943 errorCode = restjson.SanitizeErrorCode(code) 7944 } 7945 7946 var buff [1024]byte 7947 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7948 7949 body := io.TeeReader(errorBody, ringBuffer) 7950 decoder := json.NewDecoder(body) 7951 decoder.UseNumber() 7952 code, message, err := restjson.GetErrorInfo(decoder) 7953 if err != nil { 7954 var snapshot bytes.Buffer 7955 io.Copy(&snapshot, ringBuffer) 7956 err = &smithy.DeserializationError{ 7957 Err: fmt.Errorf("failed to decode response body, %w", err), 7958 Snapshot: snapshot.Bytes(), 7959 } 7960 return err 7961 } 7962 7963 errorBody.Seek(0, io.SeekStart) 7964 if len(code) != 0 { 7965 errorCode = restjson.SanitizeErrorCode(code) 7966 } 7967 if len(message) != 0 { 7968 errorMessage = message 7969 } 7970 7971 switch { 7972 case strings.EqualFold("InternalServerException", errorCode): 7973 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7974 7975 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7976 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7977 7978 case strings.EqualFold("ThrottlingException", errorCode): 7979 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7980 7981 case strings.EqualFold("ValidationException", errorCode): 7982 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7983 7984 default: 7985 genericError := &smithy.GenericAPIError{ 7986 Code: errorCode, 7987 Message: errorMessage, 7988 } 7989 return genericError 7990 7991 } 7992} 7993 7994func awsRestjson1_deserializeOpDocumentListBuiltInSlotTypesOutput(v **ListBuiltInSlotTypesOutput, value interface{}) error { 7995 if v == nil { 7996 return fmt.Errorf("unexpected nil of type %T", v) 7997 } 7998 if value == nil { 7999 return nil 8000 } 8001 8002 shape, ok := value.(map[string]interface{}) 8003 if !ok { 8004 return fmt.Errorf("unexpected JSON type %v", value) 8005 } 8006 8007 var sv *ListBuiltInSlotTypesOutput 8008 if *v == nil { 8009 sv = &ListBuiltInSlotTypesOutput{} 8010 } else { 8011 sv = *v 8012 } 8013 8014 for key, value := range shape { 8015 switch key { 8016 case "builtInSlotTypeSummaries": 8017 if err := awsRestjson1_deserializeDocumentBuiltInSlotTypeSummaryList(&sv.BuiltInSlotTypeSummaries, value); err != nil { 8018 return err 8019 } 8020 8021 case "localeId": 8022 if value != nil { 8023 jtv, ok := value.(string) 8024 if !ok { 8025 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 8026 } 8027 sv.LocaleId = ptr.String(jtv) 8028 } 8029 8030 case "nextToken": 8031 if value != nil { 8032 jtv, ok := value.(string) 8033 if !ok { 8034 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8035 } 8036 sv.NextToken = ptr.String(jtv) 8037 } 8038 8039 default: 8040 _, _ = key, value 8041 8042 } 8043 } 8044 *v = sv 8045 return nil 8046} 8047 8048type awsRestjson1_deserializeOpListExports struct { 8049} 8050 8051func (*awsRestjson1_deserializeOpListExports) ID() string { 8052 return "OperationDeserializer" 8053} 8054 8055func (m *awsRestjson1_deserializeOpListExports) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8056 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8057) { 8058 out, metadata, err = next.HandleDeserialize(ctx, in) 8059 if err != nil { 8060 return out, metadata, err 8061 } 8062 8063 response, ok := out.RawResponse.(*smithyhttp.Response) 8064 if !ok { 8065 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8066 } 8067 8068 if response.StatusCode < 200 || response.StatusCode >= 300 { 8069 return out, metadata, awsRestjson1_deserializeOpErrorListExports(response, &metadata) 8070 } 8071 output := &ListExportsOutput{} 8072 out.Result = output 8073 8074 var buff [1024]byte 8075 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8076 8077 body := io.TeeReader(response.Body, ringBuffer) 8078 8079 decoder := json.NewDecoder(body) 8080 decoder.UseNumber() 8081 var shape interface{} 8082 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8083 var snapshot bytes.Buffer 8084 io.Copy(&snapshot, ringBuffer) 8085 err = &smithy.DeserializationError{ 8086 Err: fmt.Errorf("failed to decode response body, %w", err), 8087 Snapshot: snapshot.Bytes(), 8088 } 8089 return out, metadata, err 8090 } 8091 8092 err = awsRestjson1_deserializeOpDocumentListExportsOutput(&output, shape) 8093 if err != nil { 8094 var snapshot bytes.Buffer 8095 io.Copy(&snapshot, ringBuffer) 8096 return out, metadata, &smithy.DeserializationError{ 8097 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8098 Snapshot: snapshot.Bytes(), 8099 } 8100 } 8101 8102 return out, metadata, err 8103} 8104 8105func awsRestjson1_deserializeOpErrorListExports(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8106 var errorBuffer bytes.Buffer 8107 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8108 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8109 } 8110 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8111 8112 errorCode := "UnknownError" 8113 errorMessage := errorCode 8114 8115 code := response.Header.Get("X-Amzn-ErrorType") 8116 if len(code) != 0 { 8117 errorCode = restjson.SanitizeErrorCode(code) 8118 } 8119 8120 var buff [1024]byte 8121 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8122 8123 body := io.TeeReader(errorBody, ringBuffer) 8124 decoder := json.NewDecoder(body) 8125 decoder.UseNumber() 8126 code, message, err := restjson.GetErrorInfo(decoder) 8127 if err != nil { 8128 var snapshot bytes.Buffer 8129 io.Copy(&snapshot, ringBuffer) 8130 err = &smithy.DeserializationError{ 8131 Err: fmt.Errorf("failed to decode response body, %w", err), 8132 Snapshot: snapshot.Bytes(), 8133 } 8134 return err 8135 } 8136 8137 errorBody.Seek(0, io.SeekStart) 8138 if len(code) != 0 { 8139 errorCode = restjson.SanitizeErrorCode(code) 8140 } 8141 if len(message) != 0 { 8142 errorMessage = message 8143 } 8144 8145 switch { 8146 case strings.EqualFold("InternalServerException", errorCode): 8147 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8148 8149 case strings.EqualFold("ThrottlingException", errorCode): 8150 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8151 8152 case strings.EqualFold("ValidationException", errorCode): 8153 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 8154 8155 default: 8156 genericError := &smithy.GenericAPIError{ 8157 Code: errorCode, 8158 Message: errorMessage, 8159 } 8160 return genericError 8161 8162 } 8163} 8164 8165func awsRestjson1_deserializeOpDocumentListExportsOutput(v **ListExportsOutput, value interface{}) error { 8166 if v == nil { 8167 return fmt.Errorf("unexpected nil of type %T", v) 8168 } 8169 if value == nil { 8170 return nil 8171 } 8172 8173 shape, ok := value.(map[string]interface{}) 8174 if !ok { 8175 return fmt.Errorf("unexpected JSON type %v", value) 8176 } 8177 8178 var sv *ListExportsOutput 8179 if *v == nil { 8180 sv = &ListExportsOutput{} 8181 } else { 8182 sv = *v 8183 } 8184 8185 for key, value := range shape { 8186 switch key { 8187 case "botId": 8188 if value != nil { 8189 jtv, ok := value.(string) 8190 if !ok { 8191 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8192 } 8193 sv.BotId = ptr.String(jtv) 8194 } 8195 8196 case "botVersion": 8197 if value != nil { 8198 jtv, ok := value.(string) 8199 if !ok { 8200 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 8201 } 8202 sv.BotVersion = ptr.String(jtv) 8203 } 8204 8205 case "exportSummaries": 8206 if err := awsRestjson1_deserializeDocumentExportSummaryList(&sv.ExportSummaries, value); err != nil { 8207 return err 8208 } 8209 8210 case "nextToken": 8211 if value != nil { 8212 jtv, ok := value.(string) 8213 if !ok { 8214 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8215 } 8216 sv.NextToken = ptr.String(jtv) 8217 } 8218 8219 default: 8220 _, _ = key, value 8221 8222 } 8223 } 8224 *v = sv 8225 return nil 8226} 8227 8228type awsRestjson1_deserializeOpListImports struct { 8229} 8230 8231func (*awsRestjson1_deserializeOpListImports) ID() string { 8232 return "OperationDeserializer" 8233} 8234 8235func (m *awsRestjson1_deserializeOpListImports) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8236 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8237) { 8238 out, metadata, err = next.HandleDeserialize(ctx, in) 8239 if err != nil { 8240 return out, metadata, err 8241 } 8242 8243 response, ok := out.RawResponse.(*smithyhttp.Response) 8244 if !ok { 8245 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8246 } 8247 8248 if response.StatusCode < 200 || response.StatusCode >= 300 { 8249 return out, metadata, awsRestjson1_deserializeOpErrorListImports(response, &metadata) 8250 } 8251 output := &ListImportsOutput{} 8252 out.Result = output 8253 8254 var buff [1024]byte 8255 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8256 8257 body := io.TeeReader(response.Body, ringBuffer) 8258 8259 decoder := json.NewDecoder(body) 8260 decoder.UseNumber() 8261 var shape interface{} 8262 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8263 var snapshot bytes.Buffer 8264 io.Copy(&snapshot, ringBuffer) 8265 err = &smithy.DeserializationError{ 8266 Err: fmt.Errorf("failed to decode response body, %w", err), 8267 Snapshot: snapshot.Bytes(), 8268 } 8269 return out, metadata, err 8270 } 8271 8272 err = awsRestjson1_deserializeOpDocumentListImportsOutput(&output, shape) 8273 if err != nil { 8274 var snapshot bytes.Buffer 8275 io.Copy(&snapshot, ringBuffer) 8276 return out, metadata, &smithy.DeserializationError{ 8277 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8278 Snapshot: snapshot.Bytes(), 8279 } 8280 } 8281 8282 return out, metadata, err 8283} 8284 8285func awsRestjson1_deserializeOpErrorListImports(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8286 var errorBuffer bytes.Buffer 8287 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8288 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8289 } 8290 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8291 8292 errorCode := "UnknownError" 8293 errorMessage := errorCode 8294 8295 code := response.Header.Get("X-Amzn-ErrorType") 8296 if len(code) != 0 { 8297 errorCode = restjson.SanitizeErrorCode(code) 8298 } 8299 8300 var buff [1024]byte 8301 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8302 8303 body := io.TeeReader(errorBody, ringBuffer) 8304 decoder := json.NewDecoder(body) 8305 decoder.UseNumber() 8306 code, message, err := restjson.GetErrorInfo(decoder) 8307 if err != nil { 8308 var snapshot bytes.Buffer 8309 io.Copy(&snapshot, ringBuffer) 8310 err = &smithy.DeserializationError{ 8311 Err: fmt.Errorf("failed to decode response body, %w", err), 8312 Snapshot: snapshot.Bytes(), 8313 } 8314 return err 8315 } 8316 8317 errorBody.Seek(0, io.SeekStart) 8318 if len(code) != 0 { 8319 errorCode = restjson.SanitizeErrorCode(code) 8320 } 8321 if len(message) != 0 { 8322 errorMessage = message 8323 } 8324 8325 switch { 8326 case strings.EqualFold("InternalServerException", errorCode): 8327 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8328 8329 case strings.EqualFold("ThrottlingException", errorCode): 8330 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8331 8332 case strings.EqualFold("ValidationException", errorCode): 8333 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 8334 8335 default: 8336 genericError := &smithy.GenericAPIError{ 8337 Code: errorCode, 8338 Message: errorMessage, 8339 } 8340 return genericError 8341 8342 } 8343} 8344 8345func awsRestjson1_deserializeOpDocumentListImportsOutput(v **ListImportsOutput, value interface{}) error { 8346 if v == nil { 8347 return fmt.Errorf("unexpected nil of type %T", v) 8348 } 8349 if value == nil { 8350 return nil 8351 } 8352 8353 shape, ok := value.(map[string]interface{}) 8354 if !ok { 8355 return fmt.Errorf("unexpected JSON type %v", value) 8356 } 8357 8358 var sv *ListImportsOutput 8359 if *v == nil { 8360 sv = &ListImportsOutput{} 8361 } else { 8362 sv = *v 8363 } 8364 8365 for key, value := range shape { 8366 switch key { 8367 case "botId": 8368 if value != nil { 8369 jtv, ok := value.(string) 8370 if !ok { 8371 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8372 } 8373 sv.BotId = ptr.String(jtv) 8374 } 8375 8376 case "botVersion": 8377 if value != nil { 8378 jtv, ok := value.(string) 8379 if !ok { 8380 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 8381 } 8382 sv.BotVersion = ptr.String(jtv) 8383 } 8384 8385 case "importSummaries": 8386 if err := awsRestjson1_deserializeDocumentImportSummaryList(&sv.ImportSummaries, value); err != nil { 8387 return err 8388 } 8389 8390 case "nextToken": 8391 if value != nil { 8392 jtv, ok := value.(string) 8393 if !ok { 8394 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8395 } 8396 sv.NextToken = ptr.String(jtv) 8397 } 8398 8399 default: 8400 _, _ = key, value 8401 8402 } 8403 } 8404 *v = sv 8405 return nil 8406} 8407 8408type awsRestjson1_deserializeOpListIntents struct { 8409} 8410 8411func (*awsRestjson1_deserializeOpListIntents) ID() string { 8412 return "OperationDeserializer" 8413} 8414 8415func (m *awsRestjson1_deserializeOpListIntents) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8416 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8417) { 8418 out, metadata, err = next.HandleDeserialize(ctx, in) 8419 if err != nil { 8420 return out, metadata, err 8421 } 8422 8423 response, ok := out.RawResponse.(*smithyhttp.Response) 8424 if !ok { 8425 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8426 } 8427 8428 if response.StatusCode < 200 || response.StatusCode >= 300 { 8429 return out, metadata, awsRestjson1_deserializeOpErrorListIntents(response, &metadata) 8430 } 8431 output := &ListIntentsOutput{} 8432 out.Result = output 8433 8434 var buff [1024]byte 8435 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8436 8437 body := io.TeeReader(response.Body, ringBuffer) 8438 8439 decoder := json.NewDecoder(body) 8440 decoder.UseNumber() 8441 var shape interface{} 8442 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8443 var snapshot bytes.Buffer 8444 io.Copy(&snapshot, ringBuffer) 8445 err = &smithy.DeserializationError{ 8446 Err: fmt.Errorf("failed to decode response body, %w", err), 8447 Snapshot: snapshot.Bytes(), 8448 } 8449 return out, metadata, err 8450 } 8451 8452 err = awsRestjson1_deserializeOpDocumentListIntentsOutput(&output, shape) 8453 if err != nil { 8454 var snapshot bytes.Buffer 8455 io.Copy(&snapshot, ringBuffer) 8456 return out, metadata, &smithy.DeserializationError{ 8457 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8458 Snapshot: snapshot.Bytes(), 8459 } 8460 } 8461 8462 return out, metadata, err 8463} 8464 8465func awsRestjson1_deserializeOpErrorListIntents(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8466 var errorBuffer bytes.Buffer 8467 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8468 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8469 } 8470 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8471 8472 errorCode := "UnknownError" 8473 errorMessage := errorCode 8474 8475 code := response.Header.Get("X-Amzn-ErrorType") 8476 if len(code) != 0 { 8477 errorCode = restjson.SanitizeErrorCode(code) 8478 } 8479 8480 var buff [1024]byte 8481 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8482 8483 body := io.TeeReader(errorBody, ringBuffer) 8484 decoder := json.NewDecoder(body) 8485 decoder.UseNumber() 8486 code, message, err := restjson.GetErrorInfo(decoder) 8487 if err != nil { 8488 var snapshot bytes.Buffer 8489 io.Copy(&snapshot, ringBuffer) 8490 err = &smithy.DeserializationError{ 8491 Err: fmt.Errorf("failed to decode response body, %w", err), 8492 Snapshot: snapshot.Bytes(), 8493 } 8494 return err 8495 } 8496 8497 errorBody.Seek(0, io.SeekStart) 8498 if len(code) != 0 { 8499 errorCode = restjson.SanitizeErrorCode(code) 8500 } 8501 if len(message) != 0 { 8502 errorMessage = message 8503 } 8504 8505 switch { 8506 case strings.EqualFold("InternalServerException", errorCode): 8507 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8508 8509 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 8510 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 8511 8512 case strings.EqualFold("ThrottlingException", errorCode): 8513 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8514 8515 case strings.EqualFold("ValidationException", errorCode): 8516 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 8517 8518 default: 8519 genericError := &smithy.GenericAPIError{ 8520 Code: errorCode, 8521 Message: errorMessage, 8522 } 8523 return genericError 8524 8525 } 8526} 8527 8528func awsRestjson1_deserializeOpDocumentListIntentsOutput(v **ListIntentsOutput, value interface{}) error { 8529 if v == nil { 8530 return fmt.Errorf("unexpected nil of type %T", v) 8531 } 8532 if value == nil { 8533 return nil 8534 } 8535 8536 shape, ok := value.(map[string]interface{}) 8537 if !ok { 8538 return fmt.Errorf("unexpected JSON type %v", value) 8539 } 8540 8541 var sv *ListIntentsOutput 8542 if *v == nil { 8543 sv = &ListIntentsOutput{} 8544 } else { 8545 sv = *v 8546 } 8547 8548 for key, value := range shape { 8549 switch key { 8550 case "botId": 8551 if value != nil { 8552 jtv, ok := value.(string) 8553 if !ok { 8554 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8555 } 8556 sv.BotId = ptr.String(jtv) 8557 } 8558 8559 case "botVersion": 8560 if value != nil { 8561 jtv, ok := value.(string) 8562 if !ok { 8563 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 8564 } 8565 sv.BotVersion = ptr.String(jtv) 8566 } 8567 8568 case "intentSummaries": 8569 if err := awsRestjson1_deserializeDocumentIntentSummaryList(&sv.IntentSummaries, value); err != nil { 8570 return err 8571 } 8572 8573 case "localeId": 8574 if value != nil { 8575 jtv, ok := value.(string) 8576 if !ok { 8577 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 8578 } 8579 sv.LocaleId = ptr.String(jtv) 8580 } 8581 8582 case "nextToken": 8583 if value != nil { 8584 jtv, ok := value.(string) 8585 if !ok { 8586 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8587 } 8588 sv.NextToken = ptr.String(jtv) 8589 } 8590 8591 default: 8592 _, _ = key, value 8593 8594 } 8595 } 8596 *v = sv 8597 return nil 8598} 8599 8600type awsRestjson1_deserializeOpListSlots struct { 8601} 8602 8603func (*awsRestjson1_deserializeOpListSlots) ID() string { 8604 return "OperationDeserializer" 8605} 8606 8607func (m *awsRestjson1_deserializeOpListSlots) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8608 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8609) { 8610 out, metadata, err = next.HandleDeserialize(ctx, in) 8611 if err != nil { 8612 return out, metadata, err 8613 } 8614 8615 response, ok := out.RawResponse.(*smithyhttp.Response) 8616 if !ok { 8617 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8618 } 8619 8620 if response.StatusCode < 200 || response.StatusCode >= 300 { 8621 return out, metadata, awsRestjson1_deserializeOpErrorListSlots(response, &metadata) 8622 } 8623 output := &ListSlotsOutput{} 8624 out.Result = output 8625 8626 var buff [1024]byte 8627 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8628 8629 body := io.TeeReader(response.Body, ringBuffer) 8630 8631 decoder := json.NewDecoder(body) 8632 decoder.UseNumber() 8633 var shape interface{} 8634 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8635 var snapshot bytes.Buffer 8636 io.Copy(&snapshot, ringBuffer) 8637 err = &smithy.DeserializationError{ 8638 Err: fmt.Errorf("failed to decode response body, %w", err), 8639 Snapshot: snapshot.Bytes(), 8640 } 8641 return out, metadata, err 8642 } 8643 8644 err = awsRestjson1_deserializeOpDocumentListSlotsOutput(&output, shape) 8645 if err != nil { 8646 var snapshot bytes.Buffer 8647 io.Copy(&snapshot, ringBuffer) 8648 return out, metadata, &smithy.DeserializationError{ 8649 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8650 Snapshot: snapshot.Bytes(), 8651 } 8652 } 8653 8654 return out, metadata, err 8655} 8656 8657func awsRestjson1_deserializeOpErrorListSlots(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8658 var errorBuffer bytes.Buffer 8659 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8660 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8661 } 8662 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8663 8664 errorCode := "UnknownError" 8665 errorMessage := errorCode 8666 8667 code := response.Header.Get("X-Amzn-ErrorType") 8668 if len(code) != 0 { 8669 errorCode = restjson.SanitizeErrorCode(code) 8670 } 8671 8672 var buff [1024]byte 8673 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8674 8675 body := io.TeeReader(errorBody, ringBuffer) 8676 decoder := json.NewDecoder(body) 8677 decoder.UseNumber() 8678 code, message, err := restjson.GetErrorInfo(decoder) 8679 if err != nil { 8680 var snapshot bytes.Buffer 8681 io.Copy(&snapshot, ringBuffer) 8682 err = &smithy.DeserializationError{ 8683 Err: fmt.Errorf("failed to decode response body, %w", err), 8684 Snapshot: snapshot.Bytes(), 8685 } 8686 return err 8687 } 8688 8689 errorBody.Seek(0, io.SeekStart) 8690 if len(code) != 0 { 8691 errorCode = restjson.SanitizeErrorCode(code) 8692 } 8693 if len(message) != 0 { 8694 errorMessage = message 8695 } 8696 8697 switch { 8698 case strings.EqualFold("InternalServerException", errorCode): 8699 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8700 8701 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 8702 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 8703 8704 case strings.EqualFold("ThrottlingException", errorCode): 8705 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8706 8707 case strings.EqualFold("ValidationException", errorCode): 8708 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 8709 8710 default: 8711 genericError := &smithy.GenericAPIError{ 8712 Code: errorCode, 8713 Message: errorMessage, 8714 } 8715 return genericError 8716 8717 } 8718} 8719 8720func awsRestjson1_deserializeOpDocumentListSlotsOutput(v **ListSlotsOutput, value interface{}) error { 8721 if v == nil { 8722 return fmt.Errorf("unexpected nil of type %T", v) 8723 } 8724 if value == nil { 8725 return nil 8726 } 8727 8728 shape, ok := value.(map[string]interface{}) 8729 if !ok { 8730 return fmt.Errorf("unexpected JSON type %v", value) 8731 } 8732 8733 var sv *ListSlotsOutput 8734 if *v == nil { 8735 sv = &ListSlotsOutput{} 8736 } else { 8737 sv = *v 8738 } 8739 8740 for key, value := range shape { 8741 switch key { 8742 case "botId": 8743 if value != nil { 8744 jtv, ok := value.(string) 8745 if !ok { 8746 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8747 } 8748 sv.BotId = ptr.String(jtv) 8749 } 8750 8751 case "botVersion": 8752 if value != nil { 8753 jtv, ok := value.(string) 8754 if !ok { 8755 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 8756 } 8757 sv.BotVersion = ptr.String(jtv) 8758 } 8759 8760 case "intentId": 8761 if value != nil { 8762 jtv, ok := value.(string) 8763 if !ok { 8764 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8765 } 8766 sv.IntentId = ptr.String(jtv) 8767 } 8768 8769 case "localeId": 8770 if value != nil { 8771 jtv, ok := value.(string) 8772 if !ok { 8773 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 8774 } 8775 sv.LocaleId = ptr.String(jtv) 8776 } 8777 8778 case "nextToken": 8779 if value != nil { 8780 jtv, ok := value.(string) 8781 if !ok { 8782 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8783 } 8784 sv.NextToken = ptr.String(jtv) 8785 } 8786 8787 case "slotSummaries": 8788 if err := awsRestjson1_deserializeDocumentSlotSummaryList(&sv.SlotSummaries, value); err != nil { 8789 return err 8790 } 8791 8792 default: 8793 _, _ = key, value 8794 8795 } 8796 } 8797 *v = sv 8798 return nil 8799} 8800 8801type awsRestjson1_deserializeOpListSlotTypes struct { 8802} 8803 8804func (*awsRestjson1_deserializeOpListSlotTypes) ID() string { 8805 return "OperationDeserializer" 8806} 8807 8808func (m *awsRestjson1_deserializeOpListSlotTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8809 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8810) { 8811 out, metadata, err = next.HandleDeserialize(ctx, in) 8812 if err != nil { 8813 return out, metadata, err 8814 } 8815 8816 response, ok := out.RawResponse.(*smithyhttp.Response) 8817 if !ok { 8818 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8819 } 8820 8821 if response.StatusCode < 200 || response.StatusCode >= 300 { 8822 return out, metadata, awsRestjson1_deserializeOpErrorListSlotTypes(response, &metadata) 8823 } 8824 output := &ListSlotTypesOutput{} 8825 out.Result = output 8826 8827 var buff [1024]byte 8828 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8829 8830 body := io.TeeReader(response.Body, ringBuffer) 8831 8832 decoder := json.NewDecoder(body) 8833 decoder.UseNumber() 8834 var shape interface{} 8835 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8836 var snapshot bytes.Buffer 8837 io.Copy(&snapshot, ringBuffer) 8838 err = &smithy.DeserializationError{ 8839 Err: fmt.Errorf("failed to decode response body, %w", err), 8840 Snapshot: snapshot.Bytes(), 8841 } 8842 return out, metadata, err 8843 } 8844 8845 err = awsRestjson1_deserializeOpDocumentListSlotTypesOutput(&output, shape) 8846 if err != nil { 8847 var snapshot bytes.Buffer 8848 io.Copy(&snapshot, ringBuffer) 8849 return out, metadata, &smithy.DeserializationError{ 8850 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8851 Snapshot: snapshot.Bytes(), 8852 } 8853 } 8854 8855 return out, metadata, err 8856} 8857 8858func awsRestjson1_deserializeOpErrorListSlotTypes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8859 var errorBuffer bytes.Buffer 8860 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8861 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8862 } 8863 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8864 8865 errorCode := "UnknownError" 8866 errorMessage := errorCode 8867 8868 code := response.Header.Get("X-Amzn-ErrorType") 8869 if len(code) != 0 { 8870 errorCode = restjson.SanitizeErrorCode(code) 8871 } 8872 8873 var buff [1024]byte 8874 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8875 8876 body := io.TeeReader(errorBody, ringBuffer) 8877 decoder := json.NewDecoder(body) 8878 decoder.UseNumber() 8879 code, message, err := restjson.GetErrorInfo(decoder) 8880 if err != nil { 8881 var snapshot bytes.Buffer 8882 io.Copy(&snapshot, ringBuffer) 8883 err = &smithy.DeserializationError{ 8884 Err: fmt.Errorf("failed to decode response body, %w", err), 8885 Snapshot: snapshot.Bytes(), 8886 } 8887 return err 8888 } 8889 8890 errorBody.Seek(0, io.SeekStart) 8891 if len(code) != 0 { 8892 errorCode = restjson.SanitizeErrorCode(code) 8893 } 8894 if len(message) != 0 { 8895 errorMessage = message 8896 } 8897 8898 switch { 8899 case strings.EqualFold("InternalServerException", errorCode): 8900 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8901 8902 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 8903 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 8904 8905 case strings.EqualFold("ThrottlingException", errorCode): 8906 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8907 8908 case strings.EqualFold("ValidationException", errorCode): 8909 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 8910 8911 default: 8912 genericError := &smithy.GenericAPIError{ 8913 Code: errorCode, 8914 Message: errorMessage, 8915 } 8916 return genericError 8917 8918 } 8919} 8920 8921func awsRestjson1_deserializeOpDocumentListSlotTypesOutput(v **ListSlotTypesOutput, value interface{}) error { 8922 if v == nil { 8923 return fmt.Errorf("unexpected nil of type %T", v) 8924 } 8925 if value == nil { 8926 return nil 8927 } 8928 8929 shape, ok := value.(map[string]interface{}) 8930 if !ok { 8931 return fmt.Errorf("unexpected JSON type %v", value) 8932 } 8933 8934 var sv *ListSlotTypesOutput 8935 if *v == nil { 8936 sv = &ListSlotTypesOutput{} 8937 } else { 8938 sv = *v 8939 } 8940 8941 for key, value := range shape { 8942 switch key { 8943 case "botId": 8944 if value != nil { 8945 jtv, ok := value.(string) 8946 if !ok { 8947 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8948 } 8949 sv.BotId = ptr.String(jtv) 8950 } 8951 8952 case "botVersion": 8953 if value != nil { 8954 jtv, ok := value.(string) 8955 if !ok { 8956 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 8957 } 8958 sv.BotVersion = ptr.String(jtv) 8959 } 8960 8961 case "localeId": 8962 if value != nil { 8963 jtv, ok := value.(string) 8964 if !ok { 8965 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 8966 } 8967 sv.LocaleId = ptr.String(jtv) 8968 } 8969 8970 case "nextToken": 8971 if value != nil { 8972 jtv, ok := value.(string) 8973 if !ok { 8974 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 8975 } 8976 sv.NextToken = ptr.String(jtv) 8977 } 8978 8979 case "slotTypeSummaries": 8980 if err := awsRestjson1_deserializeDocumentSlotTypeSummaryList(&sv.SlotTypeSummaries, value); err != nil { 8981 return err 8982 } 8983 8984 default: 8985 _, _ = key, value 8986 8987 } 8988 } 8989 *v = sv 8990 return nil 8991} 8992 8993type awsRestjson1_deserializeOpListTagsForResource struct { 8994} 8995 8996func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { 8997 return "OperationDeserializer" 8998} 8999 9000func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9001 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9002) { 9003 out, metadata, err = next.HandleDeserialize(ctx, in) 9004 if err != nil { 9005 return out, metadata, err 9006 } 9007 9008 response, ok := out.RawResponse.(*smithyhttp.Response) 9009 if !ok { 9010 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9011 } 9012 9013 if response.StatusCode < 200 || response.StatusCode >= 300 { 9014 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) 9015 } 9016 output := &ListTagsForResourceOutput{} 9017 out.Result = output 9018 9019 var buff [1024]byte 9020 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9021 9022 body := io.TeeReader(response.Body, ringBuffer) 9023 9024 decoder := json.NewDecoder(body) 9025 decoder.UseNumber() 9026 var shape interface{} 9027 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9028 var snapshot bytes.Buffer 9029 io.Copy(&snapshot, ringBuffer) 9030 err = &smithy.DeserializationError{ 9031 Err: fmt.Errorf("failed to decode response body, %w", err), 9032 Snapshot: snapshot.Bytes(), 9033 } 9034 return out, metadata, err 9035 } 9036 9037 err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 9038 if err != nil { 9039 var snapshot bytes.Buffer 9040 io.Copy(&snapshot, ringBuffer) 9041 return out, metadata, &smithy.DeserializationError{ 9042 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9043 Snapshot: snapshot.Bytes(), 9044 } 9045 } 9046 9047 return out, metadata, err 9048} 9049 9050func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9051 var errorBuffer bytes.Buffer 9052 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9053 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9054 } 9055 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9056 9057 errorCode := "UnknownError" 9058 errorMessage := errorCode 9059 9060 code := response.Header.Get("X-Amzn-ErrorType") 9061 if len(code) != 0 { 9062 errorCode = restjson.SanitizeErrorCode(code) 9063 } 9064 9065 var buff [1024]byte 9066 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9067 9068 body := io.TeeReader(errorBody, ringBuffer) 9069 decoder := json.NewDecoder(body) 9070 decoder.UseNumber() 9071 code, message, err := restjson.GetErrorInfo(decoder) 9072 if err != nil { 9073 var snapshot bytes.Buffer 9074 io.Copy(&snapshot, ringBuffer) 9075 err = &smithy.DeserializationError{ 9076 Err: fmt.Errorf("failed to decode response body, %w", err), 9077 Snapshot: snapshot.Bytes(), 9078 } 9079 return err 9080 } 9081 9082 errorBody.Seek(0, io.SeekStart) 9083 if len(code) != 0 { 9084 errorCode = restjson.SanitizeErrorCode(code) 9085 } 9086 if len(message) != 0 { 9087 errorMessage = message 9088 } 9089 9090 switch { 9091 case strings.EqualFold("InternalServerException", errorCode): 9092 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9093 9094 case strings.EqualFold("ResourceNotFoundException", errorCode): 9095 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9096 9097 case strings.EqualFold("ThrottlingException", errorCode): 9098 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9099 9100 case strings.EqualFold("ValidationException", errorCode): 9101 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 9102 9103 default: 9104 genericError := &smithy.GenericAPIError{ 9105 Code: errorCode, 9106 Message: errorMessage, 9107 } 9108 return genericError 9109 9110 } 9111} 9112 9113func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 9114 if v == nil { 9115 return fmt.Errorf("unexpected nil of type %T", v) 9116 } 9117 if value == nil { 9118 return nil 9119 } 9120 9121 shape, ok := value.(map[string]interface{}) 9122 if !ok { 9123 return fmt.Errorf("unexpected JSON type %v", value) 9124 } 9125 9126 var sv *ListTagsForResourceOutput 9127 if *v == nil { 9128 sv = &ListTagsForResourceOutput{} 9129 } else { 9130 sv = *v 9131 } 9132 9133 for key, value := range shape { 9134 switch key { 9135 case "tags": 9136 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 9137 return err 9138 } 9139 9140 default: 9141 _, _ = key, value 9142 9143 } 9144 } 9145 *v = sv 9146 return nil 9147} 9148 9149type awsRestjson1_deserializeOpStartImport struct { 9150} 9151 9152func (*awsRestjson1_deserializeOpStartImport) ID() string { 9153 return "OperationDeserializer" 9154} 9155 9156func (m *awsRestjson1_deserializeOpStartImport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9157 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9158) { 9159 out, metadata, err = next.HandleDeserialize(ctx, in) 9160 if err != nil { 9161 return out, metadata, err 9162 } 9163 9164 response, ok := out.RawResponse.(*smithyhttp.Response) 9165 if !ok { 9166 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9167 } 9168 9169 if response.StatusCode < 200 || response.StatusCode >= 300 { 9170 return out, metadata, awsRestjson1_deserializeOpErrorStartImport(response, &metadata) 9171 } 9172 output := &StartImportOutput{} 9173 out.Result = output 9174 9175 var buff [1024]byte 9176 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9177 9178 body := io.TeeReader(response.Body, ringBuffer) 9179 9180 decoder := json.NewDecoder(body) 9181 decoder.UseNumber() 9182 var shape interface{} 9183 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9184 var snapshot bytes.Buffer 9185 io.Copy(&snapshot, ringBuffer) 9186 err = &smithy.DeserializationError{ 9187 Err: fmt.Errorf("failed to decode response body, %w", err), 9188 Snapshot: snapshot.Bytes(), 9189 } 9190 return out, metadata, err 9191 } 9192 9193 err = awsRestjson1_deserializeOpDocumentStartImportOutput(&output, shape) 9194 if err != nil { 9195 var snapshot bytes.Buffer 9196 io.Copy(&snapshot, ringBuffer) 9197 return out, metadata, &smithy.DeserializationError{ 9198 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9199 Snapshot: snapshot.Bytes(), 9200 } 9201 } 9202 9203 return out, metadata, err 9204} 9205 9206func awsRestjson1_deserializeOpErrorStartImport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9207 var errorBuffer bytes.Buffer 9208 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9209 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9210 } 9211 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9212 9213 errorCode := "UnknownError" 9214 errorMessage := errorCode 9215 9216 code := response.Header.Get("X-Amzn-ErrorType") 9217 if len(code) != 0 { 9218 errorCode = restjson.SanitizeErrorCode(code) 9219 } 9220 9221 var buff [1024]byte 9222 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9223 9224 body := io.TeeReader(errorBody, ringBuffer) 9225 decoder := json.NewDecoder(body) 9226 decoder.UseNumber() 9227 code, message, err := restjson.GetErrorInfo(decoder) 9228 if err != nil { 9229 var snapshot bytes.Buffer 9230 io.Copy(&snapshot, ringBuffer) 9231 err = &smithy.DeserializationError{ 9232 Err: fmt.Errorf("failed to decode response body, %w", err), 9233 Snapshot: snapshot.Bytes(), 9234 } 9235 return err 9236 } 9237 9238 errorBody.Seek(0, io.SeekStart) 9239 if len(code) != 0 { 9240 errorCode = restjson.SanitizeErrorCode(code) 9241 } 9242 if len(message) != 0 { 9243 errorMessage = message 9244 } 9245 9246 switch { 9247 case strings.EqualFold("ConflictException", errorCode): 9248 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 9249 9250 case strings.EqualFold("InternalServerException", errorCode): 9251 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9252 9253 case strings.EqualFold("ResourceNotFoundException", errorCode): 9254 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9255 9256 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 9257 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 9258 9259 case strings.EqualFold("ThrottlingException", errorCode): 9260 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9261 9262 case strings.EqualFold("ValidationException", errorCode): 9263 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 9264 9265 default: 9266 genericError := &smithy.GenericAPIError{ 9267 Code: errorCode, 9268 Message: errorMessage, 9269 } 9270 return genericError 9271 9272 } 9273} 9274 9275func awsRestjson1_deserializeOpDocumentStartImportOutput(v **StartImportOutput, value interface{}) error { 9276 if v == nil { 9277 return fmt.Errorf("unexpected nil of type %T", v) 9278 } 9279 if value == nil { 9280 return nil 9281 } 9282 9283 shape, ok := value.(map[string]interface{}) 9284 if !ok { 9285 return fmt.Errorf("unexpected JSON type %v", value) 9286 } 9287 9288 var sv *StartImportOutput 9289 if *v == nil { 9290 sv = &StartImportOutput{} 9291 } else { 9292 sv = *v 9293 } 9294 9295 for key, value := range shape { 9296 switch key { 9297 case "creationDateTime": 9298 if value != nil { 9299 switch jtv := value.(type) { 9300 case json.Number: 9301 f64, err := jtv.Float64() 9302 if err != nil { 9303 return err 9304 } 9305 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9306 9307 default: 9308 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9309 9310 } 9311 } 9312 9313 case "importId": 9314 if value != nil { 9315 jtv, ok := value.(string) 9316 if !ok { 9317 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9318 } 9319 sv.ImportId = ptr.String(jtv) 9320 } 9321 9322 case "importStatus": 9323 if value != nil { 9324 jtv, ok := value.(string) 9325 if !ok { 9326 return fmt.Errorf("expected ImportStatus to be of type string, got %T instead", value) 9327 } 9328 sv.ImportStatus = types.ImportStatus(jtv) 9329 } 9330 9331 case "mergeStrategy": 9332 if value != nil { 9333 jtv, ok := value.(string) 9334 if !ok { 9335 return fmt.Errorf("expected MergeStrategy to be of type string, got %T instead", value) 9336 } 9337 sv.MergeStrategy = types.MergeStrategy(jtv) 9338 } 9339 9340 case "resourceSpecification": 9341 if err := awsRestjson1_deserializeDocumentImportResourceSpecification(&sv.ResourceSpecification, value); err != nil { 9342 return err 9343 } 9344 9345 default: 9346 _, _ = key, value 9347 9348 } 9349 } 9350 *v = sv 9351 return nil 9352} 9353 9354type awsRestjson1_deserializeOpTagResource struct { 9355} 9356 9357func (*awsRestjson1_deserializeOpTagResource) ID() string { 9358 return "OperationDeserializer" 9359} 9360 9361func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9362 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9363) { 9364 out, metadata, err = next.HandleDeserialize(ctx, in) 9365 if err != nil { 9366 return out, metadata, err 9367 } 9368 9369 response, ok := out.RawResponse.(*smithyhttp.Response) 9370 if !ok { 9371 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9372 } 9373 9374 if response.StatusCode < 200 || response.StatusCode >= 300 { 9375 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 9376 } 9377 output := &TagResourceOutput{} 9378 out.Result = output 9379 9380 return out, metadata, err 9381} 9382 9383func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9384 var errorBuffer bytes.Buffer 9385 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9386 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9387 } 9388 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9389 9390 errorCode := "UnknownError" 9391 errorMessage := errorCode 9392 9393 code := response.Header.Get("X-Amzn-ErrorType") 9394 if len(code) != 0 { 9395 errorCode = restjson.SanitizeErrorCode(code) 9396 } 9397 9398 var buff [1024]byte 9399 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9400 9401 body := io.TeeReader(errorBody, ringBuffer) 9402 decoder := json.NewDecoder(body) 9403 decoder.UseNumber() 9404 code, message, err := restjson.GetErrorInfo(decoder) 9405 if err != nil { 9406 var snapshot bytes.Buffer 9407 io.Copy(&snapshot, ringBuffer) 9408 err = &smithy.DeserializationError{ 9409 Err: fmt.Errorf("failed to decode response body, %w", err), 9410 Snapshot: snapshot.Bytes(), 9411 } 9412 return err 9413 } 9414 9415 errorBody.Seek(0, io.SeekStart) 9416 if len(code) != 0 { 9417 errorCode = restjson.SanitizeErrorCode(code) 9418 } 9419 if len(message) != 0 { 9420 errorMessage = message 9421 } 9422 9423 switch { 9424 case strings.EqualFold("InternalServerException", errorCode): 9425 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9426 9427 case strings.EqualFold("ResourceNotFoundException", errorCode): 9428 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9429 9430 case strings.EqualFold("ThrottlingException", errorCode): 9431 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9432 9433 case strings.EqualFold("ValidationException", errorCode): 9434 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 9435 9436 default: 9437 genericError := &smithy.GenericAPIError{ 9438 Code: errorCode, 9439 Message: errorMessage, 9440 } 9441 return genericError 9442 9443 } 9444} 9445 9446type awsRestjson1_deserializeOpUntagResource struct { 9447} 9448 9449func (*awsRestjson1_deserializeOpUntagResource) ID() string { 9450 return "OperationDeserializer" 9451} 9452 9453func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9454 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9455) { 9456 out, metadata, err = next.HandleDeserialize(ctx, in) 9457 if err != nil { 9458 return out, metadata, err 9459 } 9460 9461 response, ok := out.RawResponse.(*smithyhttp.Response) 9462 if !ok { 9463 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9464 } 9465 9466 if response.StatusCode < 200 || response.StatusCode >= 300 { 9467 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 9468 } 9469 output := &UntagResourceOutput{} 9470 out.Result = output 9471 9472 return out, metadata, err 9473} 9474 9475func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9476 var errorBuffer bytes.Buffer 9477 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9478 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9479 } 9480 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9481 9482 errorCode := "UnknownError" 9483 errorMessage := errorCode 9484 9485 code := response.Header.Get("X-Amzn-ErrorType") 9486 if len(code) != 0 { 9487 errorCode = restjson.SanitizeErrorCode(code) 9488 } 9489 9490 var buff [1024]byte 9491 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9492 9493 body := io.TeeReader(errorBody, ringBuffer) 9494 decoder := json.NewDecoder(body) 9495 decoder.UseNumber() 9496 code, message, err := restjson.GetErrorInfo(decoder) 9497 if err != nil { 9498 var snapshot bytes.Buffer 9499 io.Copy(&snapshot, ringBuffer) 9500 err = &smithy.DeserializationError{ 9501 Err: fmt.Errorf("failed to decode response body, %w", err), 9502 Snapshot: snapshot.Bytes(), 9503 } 9504 return err 9505 } 9506 9507 errorBody.Seek(0, io.SeekStart) 9508 if len(code) != 0 { 9509 errorCode = restjson.SanitizeErrorCode(code) 9510 } 9511 if len(message) != 0 { 9512 errorMessage = message 9513 } 9514 9515 switch { 9516 case strings.EqualFold("InternalServerException", errorCode): 9517 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9518 9519 case strings.EqualFold("ResourceNotFoundException", errorCode): 9520 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 9521 9522 case strings.EqualFold("ThrottlingException", errorCode): 9523 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9524 9525 case strings.EqualFold("ValidationException", errorCode): 9526 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 9527 9528 default: 9529 genericError := &smithy.GenericAPIError{ 9530 Code: errorCode, 9531 Message: errorMessage, 9532 } 9533 return genericError 9534 9535 } 9536} 9537 9538type awsRestjson1_deserializeOpUpdateBot struct { 9539} 9540 9541func (*awsRestjson1_deserializeOpUpdateBot) ID() string { 9542 return "OperationDeserializer" 9543} 9544 9545func (m *awsRestjson1_deserializeOpUpdateBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9546 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9547) { 9548 out, metadata, err = next.HandleDeserialize(ctx, in) 9549 if err != nil { 9550 return out, metadata, err 9551 } 9552 9553 response, ok := out.RawResponse.(*smithyhttp.Response) 9554 if !ok { 9555 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9556 } 9557 9558 if response.StatusCode < 200 || response.StatusCode >= 300 { 9559 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBot(response, &metadata) 9560 } 9561 output := &UpdateBotOutput{} 9562 out.Result = output 9563 9564 var buff [1024]byte 9565 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9566 9567 body := io.TeeReader(response.Body, ringBuffer) 9568 9569 decoder := json.NewDecoder(body) 9570 decoder.UseNumber() 9571 var shape interface{} 9572 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9573 var snapshot bytes.Buffer 9574 io.Copy(&snapshot, ringBuffer) 9575 err = &smithy.DeserializationError{ 9576 Err: fmt.Errorf("failed to decode response body, %w", err), 9577 Snapshot: snapshot.Bytes(), 9578 } 9579 return out, metadata, err 9580 } 9581 9582 err = awsRestjson1_deserializeOpDocumentUpdateBotOutput(&output, shape) 9583 if err != nil { 9584 var snapshot bytes.Buffer 9585 io.Copy(&snapshot, ringBuffer) 9586 return out, metadata, &smithy.DeserializationError{ 9587 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9588 Snapshot: snapshot.Bytes(), 9589 } 9590 } 9591 9592 return out, metadata, err 9593} 9594 9595func awsRestjson1_deserializeOpErrorUpdateBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9596 var errorBuffer bytes.Buffer 9597 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9598 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9599 } 9600 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9601 9602 errorCode := "UnknownError" 9603 errorMessage := errorCode 9604 9605 code := response.Header.Get("X-Amzn-ErrorType") 9606 if len(code) != 0 { 9607 errorCode = restjson.SanitizeErrorCode(code) 9608 } 9609 9610 var buff [1024]byte 9611 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9612 9613 body := io.TeeReader(errorBody, ringBuffer) 9614 decoder := json.NewDecoder(body) 9615 decoder.UseNumber() 9616 code, message, err := restjson.GetErrorInfo(decoder) 9617 if err != nil { 9618 var snapshot bytes.Buffer 9619 io.Copy(&snapshot, ringBuffer) 9620 err = &smithy.DeserializationError{ 9621 Err: fmt.Errorf("failed to decode response body, %w", err), 9622 Snapshot: snapshot.Bytes(), 9623 } 9624 return err 9625 } 9626 9627 errorBody.Seek(0, io.SeekStart) 9628 if len(code) != 0 { 9629 errorCode = restjson.SanitizeErrorCode(code) 9630 } 9631 if len(message) != 0 { 9632 errorMessage = message 9633 } 9634 9635 switch { 9636 case strings.EqualFold("ConflictException", errorCode): 9637 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 9638 9639 case strings.EqualFold("InternalServerException", errorCode): 9640 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9641 9642 case strings.EqualFold("PreconditionFailedException", errorCode): 9643 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 9644 9645 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 9646 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 9647 9648 case strings.EqualFold("ThrottlingException", errorCode): 9649 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9650 9651 case strings.EqualFold("ValidationException", errorCode): 9652 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 9653 9654 default: 9655 genericError := &smithy.GenericAPIError{ 9656 Code: errorCode, 9657 Message: errorMessage, 9658 } 9659 return genericError 9660 9661 } 9662} 9663 9664func awsRestjson1_deserializeOpDocumentUpdateBotOutput(v **UpdateBotOutput, value interface{}) error { 9665 if v == nil { 9666 return fmt.Errorf("unexpected nil of type %T", v) 9667 } 9668 if value == nil { 9669 return nil 9670 } 9671 9672 shape, ok := value.(map[string]interface{}) 9673 if !ok { 9674 return fmt.Errorf("unexpected JSON type %v", value) 9675 } 9676 9677 var sv *UpdateBotOutput 9678 if *v == nil { 9679 sv = &UpdateBotOutput{} 9680 } else { 9681 sv = *v 9682 } 9683 9684 for key, value := range shape { 9685 switch key { 9686 case "botId": 9687 if value != nil { 9688 jtv, ok := value.(string) 9689 if !ok { 9690 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9691 } 9692 sv.BotId = ptr.String(jtv) 9693 } 9694 9695 case "botName": 9696 if value != nil { 9697 jtv, ok := value.(string) 9698 if !ok { 9699 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 9700 } 9701 sv.BotName = ptr.String(jtv) 9702 } 9703 9704 case "botStatus": 9705 if value != nil { 9706 jtv, ok := value.(string) 9707 if !ok { 9708 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 9709 } 9710 sv.BotStatus = types.BotStatus(jtv) 9711 } 9712 9713 case "creationDateTime": 9714 if value != nil { 9715 switch jtv := value.(type) { 9716 case json.Number: 9717 f64, err := jtv.Float64() 9718 if err != nil { 9719 return err 9720 } 9721 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9722 9723 default: 9724 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9725 9726 } 9727 } 9728 9729 case "dataPrivacy": 9730 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 9731 return err 9732 } 9733 9734 case "description": 9735 if value != nil { 9736 jtv, ok := value.(string) 9737 if !ok { 9738 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 9739 } 9740 sv.Description = ptr.String(jtv) 9741 } 9742 9743 case "idleSessionTTLInSeconds": 9744 if value != nil { 9745 jtv, ok := value.(json.Number) 9746 if !ok { 9747 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 9748 } 9749 i64, err := jtv.Int64() 9750 if err != nil { 9751 return err 9752 } 9753 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 9754 } 9755 9756 case "lastUpdatedDateTime": 9757 if value != nil { 9758 switch jtv := value.(type) { 9759 case json.Number: 9760 f64, err := jtv.Float64() 9761 if err != nil { 9762 return err 9763 } 9764 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9765 9766 default: 9767 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 9768 9769 } 9770 } 9771 9772 case "roleArn": 9773 if value != nil { 9774 jtv, ok := value.(string) 9775 if !ok { 9776 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 9777 } 9778 sv.RoleArn = ptr.String(jtv) 9779 } 9780 9781 default: 9782 _, _ = key, value 9783 9784 } 9785 } 9786 *v = sv 9787 return nil 9788} 9789 9790type awsRestjson1_deserializeOpUpdateBotAlias struct { 9791} 9792 9793func (*awsRestjson1_deserializeOpUpdateBotAlias) ID() string { 9794 return "OperationDeserializer" 9795} 9796 9797func (m *awsRestjson1_deserializeOpUpdateBotAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 9798 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 9799) { 9800 out, metadata, err = next.HandleDeserialize(ctx, in) 9801 if err != nil { 9802 return out, metadata, err 9803 } 9804 9805 response, ok := out.RawResponse.(*smithyhttp.Response) 9806 if !ok { 9807 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 9808 } 9809 9810 if response.StatusCode < 200 || response.StatusCode >= 300 { 9811 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBotAlias(response, &metadata) 9812 } 9813 output := &UpdateBotAliasOutput{} 9814 out.Result = output 9815 9816 var buff [1024]byte 9817 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9818 9819 body := io.TeeReader(response.Body, ringBuffer) 9820 9821 decoder := json.NewDecoder(body) 9822 decoder.UseNumber() 9823 var shape interface{} 9824 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 9825 var snapshot bytes.Buffer 9826 io.Copy(&snapshot, ringBuffer) 9827 err = &smithy.DeserializationError{ 9828 Err: fmt.Errorf("failed to decode response body, %w", err), 9829 Snapshot: snapshot.Bytes(), 9830 } 9831 return out, metadata, err 9832 } 9833 9834 err = awsRestjson1_deserializeOpDocumentUpdateBotAliasOutput(&output, shape) 9835 if err != nil { 9836 var snapshot bytes.Buffer 9837 io.Copy(&snapshot, ringBuffer) 9838 return out, metadata, &smithy.DeserializationError{ 9839 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 9840 Snapshot: snapshot.Bytes(), 9841 } 9842 } 9843 9844 return out, metadata, err 9845} 9846 9847func awsRestjson1_deserializeOpErrorUpdateBotAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 9848 var errorBuffer bytes.Buffer 9849 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 9850 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 9851 } 9852 errorBody := bytes.NewReader(errorBuffer.Bytes()) 9853 9854 errorCode := "UnknownError" 9855 errorMessage := errorCode 9856 9857 code := response.Header.Get("X-Amzn-ErrorType") 9858 if len(code) != 0 { 9859 errorCode = restjson.SanitizeErrorCode(code) 9860 } 9861 9862 var buff [1024]byte 9863 ringBuffer := smithyio.NewRingBuffer(buff[:]) 9864 9865 body := io.TeeReader(errorBody, ringBuffer) 9866 decoder := json.NewDecoder(body) 9867 decoder.UseNumber() 9868 code, message, err := restjson.GetErrorInfo(decoder) 9869 if err != nil { 9870 var snapshot bytes.Buffer 9871 io.Copy(&snapshot, ringBuffer) 9872 err = &smithy.DeserializationError{ 9873 Err: fmt.Errorf("failed to decode response body, %w", err), 9874 Snapshot: snapshot.Bytes(), 9875 } 9876 return err 9877 } 9878 9879 errorBody.Seek(0, io.SeekStart) 9880 if len(code) != 0 { 9881 errorCode = restjson.SanitizeErrorCode(code) 9882 } 9883 if len(message) != 0 { 9884 errorMessage = message 9885 } 9886 9887 switch { 9888 case strings.EqualFold("ConflictException", errorCode): 9889 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 9890 9891 case strings.EqualFold("InternalServerException", errorCode): 9892 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 9893 9894 case strings.EqualFold("PreconditionFailedException", errorCode): 9895 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 9896 9897 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 9898 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 9899 9900 case strings.EqualFold("ThrottlingException", errorCode): 9901 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 9902 9903 case strings.EqualFold("ValidationException", errorCode): 9904 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 9905 9906 default: 9907 genericError := &smithy.GenericAPIError{ 9908 Code: errorCode, 9909 Message: errorMessage, 9910 } 9911 return genericError 9912 9913 } 9914} 9915 9916func awsRestjson1_deserializeOpDocumentUpdateBotAliasOutput(v **UpdateBotAliasOutput, value interface{}) error { 9917 if v == nil { 9918 return fmt.Errorf("unexpected nil of type %T", v) 9919 } 9920 if value == nil { 9921 return nil 9922 } 9923 9924 shape, ok := value.(map[string]interface{}) 9925 if !ok { 9926 return fmt.Errorf("unexpected JSON type %v", value) 9927 } 9928 9929 var sv *UpdateBotAliasOutput 9930 if *v == nil { 9931 sv = &UpdateBotAliasOutput{} 9932 } else { 9933 sv = *v 9934 } 9935 9936 for key, value := range shape { 9937 switch key { 9938 case "botAliasId": 9939 if value != nil { 9940 jtv, ok := value.(string) 9941 if !ok { 9942 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 9943 } 9944 sv.BotAliasId = ptr.String(jtv) 9945 } 9946 9947 case "botAliasLocaleSettings": 9948 if err := awsRestjson1_deserializeDocumentBotAliasLocaleSettingsMap(&sv.BotAliasLocaleSettings, value); err != nil { 9949 return err 9950 } 9951 9952 case "botAliasName": 9953 if value != nil { 9954 jtv, ok := value.(string) 9955 if !ok { 9956 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 9957 } 9958 sv.BotAliasName = ptr.String(jtv) 9959 } 9960 9961 case "botAliasStatus": 9962 if value != nil { 9963 jtv, ok := value.(string) 9964 if !ok { 9965 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 9966 } 9967 sv.BotAliasStatus = types.BotAliasStatus(jtv) 9968 } 9969 9970 case "botId": 9971 if value != nil { 9972 jtv, ok := value.(string) 9973 if !ok { 9974 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9975 } 9976 sv.BotId = ptr.String(jtv) 9977 } 9978 9979 case "botVersion": 9980 if value != nil { 9981 jtv, ok := value.(string) 9982 if !ok { 9983 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 9984 } 9985 sv.BotVersion = ptr.String(jtv) 9986 } 9987 9988 case "conversationLogSettings": 9989 if err := awsRestjson1_deserializeDocumentConversationLogSettings(&sv.ConversationLogSettings, value); err != nil { 9990 return err 9991 } 9992 9993 case "creationDateTime": 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.CreationDateTime = 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 "description": 10010 if value != nil { 10011 jtv, ok := value.(string) 10012 if !ok { 10013 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 10014 } 10015 sv.Description = ptr.String(jtv) 10016 } 10017 10018 case "lastUpdatedDateTime": 10019 if value != nil { 10020 switch jtv := value.(type) { 10021 case json.Number: 10022 f64, err := jtv.Float64() 10023 if err != nil { 10024 return err 10025 } 10026 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10027 10028 default: 10029 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10030 10031 } 10032 } 10033 10034 case "sentimentAnalysisSettings": 10035 if err := awsRestjson1_deserializeDocumentSentimentAnalysisSettings(&sv.SentimentAnalysisSettings, value); err != nil { 10036 return err 10037 } 10038 10039 default: 10040 _, _ = key, value 10041 10042 } 10043 } 10044 *v = sv 10045 return nil 10046} 10047 10048type awsRestjson1_deserializeOpUpdateBotLocale struct { 10049} 10050 10051func (*awsRestjson1_deserializeOpUpdateBotLocale) ID() string { 10052 return "OperationDeserializer" 10053} 10054 10055func (m *awsRestjson1_deserializeOpUpdateBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10056 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10057) { 10058 out, metadata, err = next.HandleDeserialize(ctx, in) 10059 if err != nil { 10060 return out, metadata, err 10061 } 10062 10063 response, ok := out.RawResponse.(*smithyhttp.Response) 10064 if !ok { 10065 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10066 } 10067 10068 if response.StatusCode < 200 || response.StatusCode >= 300 { 10069 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBotLocale(response, &metadata) 10070 } 10071 output := &UpdateBotLocaleOutput{} 10072 out.Result = output 10073 10074 var buff [1024]byte 10075 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10076 10077 body := io.TeeReader(response.Body, ringBuffer) 10078 10079 decoder := json.NewDecoder(body) 10080 decoder.UseNumber() 10081 var shape interface{} 10082 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10083 var snapshot bytes.Buffer 10084 io.Copy(&snapshot, ringBuffer) 10085 err = &smithy.DeserializationError{ 10086 Err: fmt.Errorf("failed to decode response body, %w", err), 10087 Snapshot: snapshot.Bytes(), 10088 } 10089 return out, metadata, err 10090 } 10091 10092 err = awsRestjson1_deserializeOpDocumentUpdateBotLocaleOutput(&output, shape) 10093 if err != nil { 10094 var snapshot bytes.Buffer 10095 io.Copy(&snapshot, ringBuffer) 10096 return out, metadata, &smithy.DeserializationError{ 10097 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10098 Snapshot: snapshot.Bytes(), 10099 } 10100 } 10101 10102 return out, metadata, err 10103} 10104 10105func awsRestjson1_deserializeOpErrorUpdateBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10106 var errorBuffer bytes.Buffer 10107 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10108 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10109 } 10110 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10111 10112 errorCode := "UnknownError" 10113 errorMessage := errorCode 10114 10115 code := response.Header.Get("X-Amzn-ErrorType") 10116 if len(code) != 0 { 10117 errorCode = restjson.SanitizeErrorCode(code) 10118 } 10119 10120 var buff [1024]byte 10121 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10122 10123 body := io.TeeReader(errorBody, ringBuffer) 10124 decoder := json.NewDecoder(body) 10125 decoder.UseNumber() 10126 code, message, err := restjson.GetErrorInfo(decoder) 10127 if err != nil { 10128 var snapshot bytes.Buffer 10129 io.Copy(&snapshot, ringBuffer) 10130 err = &smithy.DeserializationError{ 10131 Err: fmt.Errorf("failed to decode response body, %w", err), 10132 Snapshot: snapshot.Bytes(), 10133 } 10134 return err 10135 } 10136 10137 errorBody.Seek(0, io.SeekStart) 10138 if len(code) != 0 { 10139 errorCode = restjson.SanitizeErrorCode(code) 10140 } 10141 if len(message) != 0 { 10142 errorMessage = message 10143 } 10144 10145 switch { 10146 case strings.EqualFold("ConflictException", errorCode): 10147 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10148 10149 case strings.EqualFold("InternalServerException", errorCode): 10150 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 10151 10152 case strings.EqualFold("PreconditionFailedException", errorCode): 10153 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 10154 10155 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 10156 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 10157 10158 case strings.EqualFold("ThrottlingException", errorCode): 10159 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 10160 10161 case strings.EqualFold("ValidationException", errorCode): 10162 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 10163 10164 default: 10165 genericError := &smithy.GenericAPIError{ 10166 Code: errorCode, 10167 Message: errorMessage, 10168 } 10169 return genericError 10170 10171 } 10172} 10173 10174func awsRestjson1_deserializeOpDocumentUpdateBotLocaleOutput(v **UpdateBotLocaleOutput, value interface{}) error { 10175 if v == nil { 10176 return fmt.Errorf("unexpected nil of type %T", v) 10177 } 10178 if value == nil { 10179 return nil 10180 } 10181 10182 shape, ok := value.(map[string]interface{}) 10183 if !ok { 10184 return fmt.Errorf("unexpected JSON type %v", value) 10185 } 10186 10187 var sv *UpdateBotLocaleOutput 10188 if *v == nil { 10189 sv = &UpdateBotLocaleOutput{} 10190 } else { 10191 sv = *v 10192 } 10193 10194 for key, value := range shape { 10195 switch key { 10196 case "botId": 10197 if value != nil { 10198 jtv, ok := value.(string) 10199 if !ok { 10200 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10201 } 10202 sv.BotId = ptr.String(jtv) 10203 } 10204 10205 case "botLocaleStatus": 10206 if value != nil { 10207 jtv, ok := value.(string) 10208 if !ok { 10209 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 10210 } 10211 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 10212 } 10213 10214 case "botVersion": 10215 if value != nil { 10216 jtv, ok := value.(string) 10217 if !ok { 10218 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 10219 } 10220 sv.BotVersion = ptr.String(jtv) 10221 } 10222 10223 case "creationDateTime": 10224 if value != nil { 10225 switch jtv := value.(type) { 10226 case json.Number: 10227 f64, err := jtv.Float64() 10228 if err != nil { 10229 return err 10230 } 10231 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10232 10233 default: 10234 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10235 10236 } 10237 } 10238 10239 case "description": 10240 if value != nil { 10241 jtv, ok := value.(string) 10242 if !ok { 10243 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 10244 } 10245 sv.Description = ptr.String(jtv) 10246 } 10247 10248 case "failureReasons": 10249 if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { 10250 return err 10251 } 10252 10253 case "lastUpdatedDateTime": 10254 if value != nil { 10255 switch jtv := value.(type) { 10256 case json.Number: 10257 f64, err := jtv.Float64() 10258 if err != nil { 10259 return err 10260 } 10261 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10262 10263 default: 10264 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10265 10266 } 10267 } 10268 10269 case "localeId": 10270 if value != nil { 10271 jtv, ok := value.(string) 10272 if !ok { 10273 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 10274 } 10275 sv.LocaleId = ptr.String(jtv) 10276 } 10277 10278 case "localeName": 10279 if value != nil { 10280 jtv, ok := value.(string) 10281 if !ok { 10282 return fmt.Errorf("expected LocaleName to be of type string, got %T instead", value) 10283 } 10284 sv.LocaleName = ptr.String(jtv) 10285 } 10286 10287 case "nluIntentConfidenceThreshold": 10288 if value != nil { 10289 switch jtv := value.(type) { 10290 case json.Number: 10291 f64, err := jtv.Float64() 10292 if err != nil { 10293 return err 10294 } 10295 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 10296 10297 case string: 10298 var f64 float64 10299 switch { 10300 case strings.EqualFold(jtv, "NaN"): 10301 f64 = math.NaN() 10302 10303 case strings.EqualFold(jtv, "Infinity"): 10304 f64 = math.Inf(1) 10305 10306 case strings.EqualFold(jtv, "-Infinity"): 10307 f64 = math.Inf(-1) 10308 10309 default: 10310 return fmt.Errorf("unknown JSON number value: %s", jtv) 10311 10312 } 10313 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 10314 10315 default: 10316 return fmt.Errorf("expected ConfidenceThreshold to be a JSON Number, got %T instead", value) 10317 10318 } 10319 } 10320 10321 case "voiceSettings": 10322 if err := awsRestjson1_deserializeDocumentVoiceSettings(&sv.VoiceSettings, value); err != nil { 10323 return err 10324 } 10325 10326 default: 10327 _, _ = key, value 10328 10329 } 10330 } 10331 *v = sv 10332 return nil 10333} 10334 10335type awsRestjson1_deserializeOpUpdateExport struct { 10336} 10337 10338func (*awsRestjson1_deserializeOpUpdateExport) ID() string { 10339 return "OperationDeserializer" 10340} 10341 10342func (m *awsRestjson1_deserializeOpUpdateExport) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10343 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10344) { 10345 out, metadata, err = next.HandleDeserialize(ctx, in) 10346 if err != nil { 10347 return out, metadata, err 10348 } 10349 10350 response, ok := out.RawResponse.(*smithyhttp.Response) 10351 if !ok { 10352 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10353 } 10354 10355 if response.StatusCode < 200 || response.StatusCode >= 300 { 10356 return out, metadata, awsRestjson1_deserializeOpErrorUpdateExport(response, &metadata) 10357 } 10358 output := &UpdateExportOutput{} 10359 out.Result = output 10360 10361 var buff [1024]byte 10362 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10363 10364 body := io.TeeReader(response.Body, ringBuffer) 10365 10366 decoder := json.NewDecoder(body) 10367 decoder.UseNumber() 10368 var shape interface{} 10369 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10370 var snapshot bytes.Buffer 10371 io.Copy(&snapshot, ringBuffer) 10372 err = &smithy.DeserializationError{ 10373 Err: fmt.Errorf("failed to decode response body, %w", err), 10374 Snapshot: snapshot.Bytes(), 10375 } 10376 return out, metadata, err 10377 } 10378 10379 err = awsRestjson1_deserializeOpDocumentUpdateExportOutput(&output, shape) 10380 if err != nil { 10381 var snapshot bytes.Buffer 10382 io.Copy(&snapshot, ringBuffer) 10383 return out, metadata, &smithy.DeserializationError{ 10384 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10385 Snapshot: snapshot.Bytes(), 10386 } 10387 } 10388 10389 return out, metadata, err 10390} 10391 10392func awsRestjson1_deserializeOpErrorUpdateExport(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10393 var errorBuffer bytes.Buffer 10394 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10395 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10396 } 10397 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10398 10399 errorCode := "UnknownError" 10400 errorMessage := errorCode 10401 10402 code := response.Header.Get("X-Amzn-ErrorType") 10403 if len(code) != 0 { 10404 errorCode = restjson.SanitizeErrorCode(code) 10405 } 10406 10407 var buff [1024]byte 10408 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10409 10410 body := io.TeeReader(errorBody, ringBuffer) 10411 decoder := json.NewDecoder(body) 10412 decoder.UseNumber() 10413 code, message, err := restjson.GetErrorInfo(decoder) 10414 if err != nil { 10415 var snapshot bytes.Buffer 10416 io.Copy(&snapshot, ringBuffer) 10417 err = &smithy.DeserializationError{ 10418 Err: fmt.Errorf("failed to decode response body, %w", err), 10419 Snapshot: snapshot.Bytes(), 10420 } 10421 return err 10422 } 10423 10424 errorBody.Seek(0, io.SeekStart) 10425 if len(code) != 0 { 10426 errorCode = restjson.SanitizeErrorCode(code) 10427 } 10428 if len(message) != 0 { 10429 errorMessage = message 10430 } 10431 10432 switch { 10433 case strings.EqualFold("ConflictException", errorCode): 10434 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10435 10436 case strings.EqualFold("InternalServerException", errorCode): 10437 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 10438 10439 case strings.EqualFold("ResourceNotFoundException", errorCode): 10440 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10441 10442 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 10443 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 10444 10445 case strings.EqualFold("ThrottlingException", errorCode): 10446 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 10447 10448 case strings.EqualFold("ValidationException", errorCode): 10449 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 10450 10451 default: 10452 genericError := &smithy.GenericAPIError{ 10453 Code: errorCode, 10454 Message: errorMessage, 10455 } 10456 return genericError 10457 10458 } 10459} 10460 10461func awsRestjson1_deserializeOpDocumentUpdateExportOutput(v **UpdateExportOutput, value interface{}) error { 10462 if v == nil { 10463 return fmt.Errorf("unexpected nil of type %T", v) 10464 } 10465 if value == nil { 10466 return nil 10467 } 10468 10469 shape, ok := value.(map[string]interface{}) 10470 if !ok { 10471 return fmt.Errorf("unexpected JSON type %v", value) 10472 } 10473 10474 var sv *UpdateExportOutput 10475 if *v == nil { 10476 sv = &UpdateExportOutput{} 10477 } else { 10478 sv = *v 10479 } 10480 10481 for key, value := range shape { 10482 switch key { 10483 case "creationDateTime": 10484 if value != nil { 10485 switch jtv := value.(type) { 10486 case json.Number: 10487 f64, err := jtv.Float64() 10488 if err != nil { 10489 return err 10490 } 10491 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10492 10493 default: 10494 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10495 10496 } 10497 } 10498 10499 case "exportId": 10500 if value != nil { 10501 jtv, ok := value.(string) 10502 if !ok { 10503 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10504 } 10505 sv.ExportId = ptr.String(jtv) 10506 } 10507 10508 case "exportStatus": 10509 if value != nil { 10510 jtv, ok := value.(string) 10511 if !ok { 10512 return fmt.Errorf("expected ExportStatus to be of type string, got %T instead", value) 10513 } 10514 sv.ExportStatus = types.ExportStatus(jtv) 10515 } 10516 10517 case "fileFormat": 10518 if value != nil { 10519 jtv, ok := value.(string) 10520 if !ok { 10521 return fmt.Errorf("expected ImportExportFileFormat to be of type string, got %T instead", value) 10522 } 10523 sv.FileFormat = types.ImportExportFileFormat(jtv) 10524 } 10525 10526 case "lastUpdatedDateTime": 10527 if value != nil { 10528 switch jtv := value.(type) { 10529 case json.Number: 10530 f64, err := jtv.Float64() 10531 if err != nil { 10532 return err 10533 } 10534 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10535 10536 default: 10537 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10538 10539 } 10540 } 10541 10542 case "resourceSpecification": 10543 if err := awsRestjson1_deserializeDocumentExportResourceSpecification(&sv.ResourceSpecification, value); err != nil { 10544 return err 10545 } 10546 10547 default: 10548 _, _ = key, value 10549 10550 } 10551 } 10552 *v = sv 10553 return nil 10554} 10555 10556type awsRestjson1_deserializeOpUpdateIntent struct { 10557} 10558 10559func (*awsRestjson1_deserializeOpUpdateIntent) ID() string { 10560 return "OperationDeserializer" 10561} 10562 10563func (m *awsRestjson1_deserializeOpUpdateIntent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10564 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10565) { 10566 out, metadata, err = next.HandleDeserialize(ctx, in) 10567 if err != nil { 10568 return out, metadata, err 10569 } 10570 10571 response, ok := out.RawResponse.(*smithyhttp.Response) 10572 if !ok { 10573 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10574 } 10575 10576 if response.StatusCode < 200 || response.StatusCode >= 300 { 10577 return out, metadata, awsRestjson1_deserializeOpErrorUpdateIntent(response, &metadata) 10578 } 10579 output := &UpdateIntentOutput{} 10580 out.Result = output 10581 10582 var buff [1024]byte 10583 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10584 10585 body := io.TeeReader(response.Body, ringBuffer) 10586 10587 decoder := json.NewDecoder(body) 10588 decoder.UseNumber() 10589 var shape interface{} 10590 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10591 var snapshot bytes.Buffer 10592 io.Copy(&snapshot, ringBuffer) 10593 err = &smithy.DeserializationError{ 10594 Err: fmt.Errorf("failed to decode response body, %w", err), 10595 Snapshot: snapshot.Bytes(), 10596 } 10597 return out, metadata, err 10598 } 10599 10600 err = awsRestjson1_deserializeOpDocumentUpdateIntentOutput(&output, shape) 10601 if err != nil { 10602 var snapshot bytes.Buffer 10603 io.Copy(&snapshot, ringBuffer) 10604 return out, metadata, &smithy.DeserializationError{ 10605 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10606 Snapshot: snapshot.Bytes(), 10607 } 10608 } 10609 10610 return out, metadata, err 10611} 10612 10613func awsRestjson1_deserializeOpErrorUpdateIntent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10614 var errorBuffer bytes.Buffer 10615 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10616 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10617 } 10618 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10619 10620 errorCode := "UnknownError" 10621 errorMessage := errorCode 10622 10623 code := response.Header.Get("X-Amzn-ErrorType") 10624 if len(code) != 0 { 10625 errorCode = restjson.SanitizeErrorCode(code) 10626 } 10627 10628 var buff [1024]byte 10629 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10630 10631 body := io.TeeReader(errorBody, ringBuffer) 10632 decoder := json.NewDecoder(body) 10633 decoder.UseNumber() 10634 code, message, err := restjson.GetErrorInfo(decoder) 10635 if err != nil { 10636 var snapshot bytes.Buffer 10637 io.Copy(&snapshot, ringBuffer) 10638 err = &smithy.DeserializationError{ 10639 Err: fmt.Errorf("failed to decode response body, %w", err), 10640 Snapshot: snapshot.Bytes(), 10641 } 10642 return err 10643 } 10644 10645 errorBody.Seek(0, io.SeekStart) 10646 if len(code) != 0 { 10647 errorCode = restjson.SanitizeErrorCode(code) 10648 } 10649 if len(message) != 0 { 10650 errorMessage = message 10651 } 10652 10653 switch { 10654 case strings.EqualFold("ConflictException", errorCode): 10655 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 10656 10657 case strings.EqualFold("InternalServerException", errorCode): 10658 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 10659 10660 case strings.EqualFold("PreconditionFailedException", errorCode): 10661 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 10662 10663 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 10664 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 10665 10666 case strings.EqualFold("ThrottlingException", errorCode): 10667 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 10668 10669 case strings.EqualFold("ValidationException", errorCode): 10670 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 10671 10672 default: 10673 genericError := &smithy.GenericAPIError{ 10674 Code: errorCode, 10675 Message: errorMessage, 10676 } 10677 return genericError 10678 10679 } 10680} 10681 10682func awsRestjson1_deserializeOpDocumentUpdateIntentOutput(v **UpdateIntentOutput, value interface{}) error { 10683 if v == nil { 10684 return fmt.Errorf("unexpected nil of type %T", v) 10685 } 10686 if value == nil { 10687 return nil 10688 } 10689 10690 shape, ok := value.(map[string]interface{}) 10691 if !ok { 10692 return fmt.Errorf("unexpected JSON type %v", value) 10693 } 10694 10695 var sv *UpdateIntentOutput 10696 if *v == nil { 10697 sv = &UpdateIntentOutput{} 10698 } else { 10699 sv = *v 10700 } 10701 10702 for key, value := range shape { 10703 switch key { 10704 case "botId": 10705 if value != nil { 10706 jtv, ok := value.(string) 10707 if !ok { 10708 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10709 } 10710 sv.BotId = ptr.String(jtv) 10711 } 10712 10713 case "botVersion": 10714 if value != nil { 10715 jtv, ok := value.(string) 10716 if !ok { 10717 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 10718 } 10719 sv.BotVersion = ptr.String(jtv) 10720 } 10721 10722 case "creationDateTime": 10723 if value != nil { 10724 switch jtv := value.(type) { 10725 case json.Number: 10726 f64, err := jtv.Float64() 10727 if err != nil { 10728 return err 10729 } 10730 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10731 10732 default: 10733 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10734 10735 } 10736 } 10737 10738 case "description": 10739 if value != nil { 10740 jtv, ok := value.(string) 10741 if !ok { 10742 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 10743 } 10744 sv.Description = ptr.String(jtv) 10745 } 10746 10747 case "dialogCodeHook": 10748 if err := awsRestjson1_deserializeDocumentDialogCodeHookSettings(&sv.DialogCodeHook, value); err != nil { 10749 return err 10750 } 10751 10752 case "fulfillmentCodeHook": 10753 if err := awsRestjson1_deserializeDocumentFulfillmentCodeHookSettings(&sv.FulfillmentCodeHook, value); err != nil { 10754 return err 10755 } 10756 10757 case "inputContexts": 10758 if err := awsRestjson1_deserializeDocumentInputContextsList(&sv.InputContexts, value); err != nil { 10759 return err 10760 } 10761 10762 case "intentClosingSetting": 10763 if err := awsRestjson1_deserializeDocumentIntentClosingSetting(&sv.IntentClosingSetting, value); err != nil { 10764 return err 10765 } 10766 10767 case "intentConfirmationSetting": 10768 if err := awsRestjson1_deserializeDocumentIntentConfirmationSetting(&sv.IntentConfirmationSetting, value); err != nil { 10769 return err 10770 } 10771 10772 case "intentId": 10773 if value != nil { 10774 jtv, ok := value.(string) 10775 if !ok { 10776 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10777 } 10778 sv.IntentId = ptr.String(jtv) 10779 } 10780 10781 case "intentName": 10782 if value != nil { 10783 jtv, ok := value.(string) 10784 if !ok { 10785 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 10786 } 10787 sv.IntentName = ptr.String(jtv) 10788 } 10789 10790 case "kendraConfiguration": 10791 if err := awsRestjson1_deserializeDocumentKendraConfiguration(&sv.KendraConfiguration, value); err != nil { 10792 return err 10793 } 10794 10795 case "lastUpdatedDateTime": 10796 if value != nil { 10797 switch jtv := value.(type) { 10798 case json.Number: 10799 f64, err := jtv.Float64() 10800 if err != nil { 10801 return err 10802 } 10803 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10804 10805 default: 10806 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 10807 10808 } 10809 } 10810 10811 case "localeId": 10812 if value != nil { 10813 jtv, ok := value.(string) 10814 if !ok { 10815 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 10816 } 10817 sv.LocaleId = ptr.String(jtv) 10818 } 10819 10820 case "outputContexts": 10821 if err := awsRestjson1_deserializeDocumentOutputContextsList(&sv.OutputContexts, value); err != nil { 10822 return err 10823 } 10824 10825 case "parentIntentSignature": 10826 if value != nil { 10827 jtv, ok := value.(string) 10828 if !ok { 10829 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 10830 } 10831 sv.ParentIntentSignature = ptr.String(jtv) 10832 } 10833 10834 case "sampleUtterances": 10835 if err := awsRestjson1_deserializeDocumentSampleUtterancesList(&sv.SampleUtterances, value); err != nil { 10836 return err 10837 } 10838 10839 case "slotPriorities": 10840 if err := awsRestjson1_deserializeDocumentSlotPrioritiesList(&sv.SlotPriorities, value); err != nil { 10841 return err 10842 } 10843 10844 default: 10845 _, _ = key, value 10846 10847 } 10848 } 10849 *v = sv 10850 return nil 10851} 10852 10853type awsRestjson1_deserializeOpUpdateResourcePolicy struct { 10854} 10855 10856func (*awsRestjson1_deserializeOpUpdateResourcePolicy) ID() string { 10857 return "OperationDeserializer" 10858} 10859 10860func (m *awsRestjson1_deserializeOpUpdateResourcePolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 10861 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 10862) { 10863 out, metadata, err = next.HandleDeserialize(ctx, in) 10864 if err != nil { 10865 return out, metadata, err 10866 } 10867 10868 response, ok := out.RawResponse.(*smithyhttp.Response) 10869 if !ok { 10870 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 10871 } 10872 10873 if response.StatusCode < 200 || response.StatusCode >= 300 { 10874 return out, metadata, awsRestjson1_deserializeOpErrorUpdateResourcePolicy(response, &metadata) 10875 } 10876 output := &UpdateResourcePolicyOutput{} 10877 out.Result = output 10878 10879 var buff [1024]byte 10880 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10881 10882 body := io.TeeReader(response.Body, ringBuffer) 10883 10884 decoder := json.NewDecoder(body) 10885 decoder.UseNumber() 10886 var shape interface{} 10887 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 10888 var snapshot bytes.Buffer 10889 io.Copy(&snapshot, ringBuffer) 10890 err = &smithy.DeserializationError{ 10891 Err: fmt.Errorf("failed to decode response body, %w", err), 10892 Snapshot: snapshot.Bytes(), 10893 } 10894 return out, metadata, err 10895 } 10896 10897 err = awsRestjson1_deserializeOpDocumentUpdateResourcePolicyOutput(&output, shape) 10898 if err != nil { 10899 var snapshot bytes.Buffer 10900 io.Copy(&snapshot, ringBuffer) 10901 return out, metadata, &smithy.DeserializationError{ 10902 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 10903 Snapshot: snapshot.Bytes(), 10904 } 10905 } 10906 10907 return out, metadata, err 10908} 10909 10910func awsRestjson1_deserializeOpErrorUpdateResourcePolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { 10911 var errorBuffer bytes.Buffer 10912 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 10913 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 10914 } 10915 errorBody := bytes.NewReader(errorBuffer.Bytes()) 10916 10917 errorCode := "UnknownError" 10918 errorMessage := errorCode 10919 10920 code := response.Header.Get("X-Amzn-ErrorType") 10921 if len(code) != 0 { 10922 errorCode = restjson.SanitizeErrorCode(code) 10923 } 10924 10925 var buff [1024]byte 10926 ringBuffer := smithyio.NewRingBuffer(buff[:]) 10927 10928 body := io.TeeReader(errorBody, ringBuffer) 10929 decoder := json.NewDecoder(body) 10930 decoder.UseNumber() 10931 code, message, err := restjson.GetErrorInfo(decoder) 10932 if err != nil { 10933 var snapshot bytes.Buffer 10934 io.Copy(&snapshot, ringBuffer) 10935 err = &smithy.DeserializationError{ 10936 Err: fmt.Errorf("failed to decode response body, %w", err), 10937 Snapshot: snapshot.Bytes(), 10938 } 10939 return err 10940 } 10941 10942 errorBody.Seek(0, io.SeekStart) 10943 if len(code) != 0 { 10944 errorCode = restjson.SanitizeErrorCode(code) 10945 } 10946 if len(message) != 0 { 10947 errorMessage = message 10948 } 10949 10950 switch { 10951 case strings.EqualFold("InternalServerException", errorCode): 10952 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 10953 10954 case strings.EqualFold("PreconditionFailedException", errorCode): 10955 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 10956 10957 case strings.EqualFold("ResourceNotFoundException", errorCode): 10958 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 10959 10960 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 10961 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 10962 10963 case strings.EqualFold("ThrottlingException", errorCode): 10964 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 10965 10966 case strings.EqualFold("ValidationException", errorCode): 10967 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 10968 10969 default: 10970 genericError := &smithy.GenericAPIError{ 10971 Code: errorCode, 10972 Message: errorMessage, 10973 } 10974 return genericError 10975 10976 } 10977} 10978 10979func awsRestjson1_deserializeOpDocumentUpdateResourcePolicyOutput(v **UpdateResourcePolicyOutput, value interface{}) error { 10980 if v == nil { 10981 return fmt.Errorf("unexpected nil of type %T", v) 10982 } 10983 if value == nil { 10984 return nil 10985 } 10986 10987 shape, ok := value.(map[string]interface{}) 10988 if !ok { 10989 return fmt.Errorf("unexpected JSON type %v", value) 10990 } 10991 10992 var sv *UpdateResourcePolicyOutput 10993 if *v == nil { 10994 sv = &UpdateResourcePolicyOutput{} 10995 } else { 10996 sv = *v 10997 } 10998 10999 for key, value := range shape { 11000 switch key { 11001 case "resourceArn": 11002 if value != nil { 11003 jtv, ok := value.(string) 11004 if !ok { 11005 return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value) 11006 } 11007 sv.ResourceArn = ptr.String(jtv) 11008 } 11009 11010 case "revisionId": 11011 if value != nil { 11012 jtv, ok := value.(string) 11013 if !ok { 11014 return fmt.Errorf("expected RevisionId to be of type string, got %T instead", value) 11015 } 11016 sv.RevisionId = ptr.String(jtv) 11017 } 11018 11019 default: 11020 _, _ = key, value 11021 11022 } 11023 } 11024 *v = sv 11025 return nil 11026} 11027 11028type awsRestjson1_deserializeOpUpdateSlot struct { 11029} 11030 11031func (*awsRestjson1_deserializeOpUpdateSlot) ID() string { 11032 return "OperationDeserializer" 11033} 11034 11035func (m *awsRestjson1_deserializeOpUpdateSlot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11036 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11037) { 11038 out, metadata, err = next.HandleDeserialize(ctx, in) 11039 if err != nil { 11040 return out, metadata, err 11041 } 11042 11043 response, ok := out.RawResponse.(*smithyhttp.Response) 11044 if !ok { 11045 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11046 } 11047 11048 if response.StatusCode < 200 || response.StatusCode >= 300 { 11049 return out, metadata, awsRestjson1_deserializeOpErrorUpdateSlot(response, &metadata) 11050 } 11051 output := &UpdateSlotOutput{} 11052 out.Result = output 11053 11054 var buff [1024]byte 11055 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11056 11057 body := io.TeeReader(response.Body, ringBuffer) 11058 11059 decoder := json.NewDecoder(body) 11060 decoder.UseNumber() 11061 var shape interface{} 11062 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11063 var snapshot bytes.Buffer 11064 io.Copy(&snapshot, ringBuffer) 11065 err = &smithy.DeserializationError{ 11066 Err: fmt.Errorf("failed to decode response body, %w", err), 11067 Snapshot: snapshot.Bytes(), 11068 } 11069 return out, metadata, err 11070 } 11071 11072 err = awsRestjson1_deserializeOpDocumentUpdateSlotOutput(&output, shape) 11073 if err != nil { 11074 var snapshot bytes.Buffer 11075 io.Copy(&snapshot, ringBuffer) 11076 return out, metadata, &smithy.DeserializationError{ 11077 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11078 Snapshot: snapshot.Bytes(), 11079 } 11080 } 11081 11082 return out, metadata, err 11083} 11084 11085func awsRestjson1_deserializeOpErrorUpdateSlot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11086 var errorBuffer bytes.Buffer 11087 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11088 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11089 } 11090 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11091 11092 errorCode := "UnknownError" 11093 errorMessage := errorCode 11094 11095 code := response.Header.Get("X-Amzn-ErrorType") 11096 if len(code) != 0 { 11097 errorCode = restjson.SanitizeErrorCode(code) 11098 } 11099 11100 var buff [1024]byte 11101 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11102 11103 body := io.TeeReader(errorBody, ringBuffer) 11104 decoder := json.NewDecoder(body) 11105 decoder.UseNumber() 11106 code, message, err := restjson.GetErrorInfo(decoder) 11107 if err != nil { 11108 var snapshot bytes.Buffer 11109 io.Copy(&snapshot, ringBuffer) 11110 err = &smithy.DeserializationError{ 11111 Err: fmt.Errorf("failed to decode response body, %w", err), 11112 Snapshot: snapshot.Bytes(), 11113 } 11114 return err 11115 } 11116 11117 errorBody.Seek(0, io.SeekStart) 11118 if len(code) != 0 { 11119 errorCode = restjson.SanitizeErrorCode(code) 11120 } 11121 if len(message) != 0 { 11122 errorMessage = message 11123 } 11124 11125 switch { 11126 case strings.EqualFold("ConflictException", errorCode): 11127 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11128 11129 case strings.EqualFold("InternalServerException", errorCode): 11130 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 11131 11132 case strings.EqualFold("PreconditionFailedException", errorCode): 11133 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 11134 11135 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 11136 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 11137 11138 case strings.EqualFold("ThrottlingException", errorCode): 11139 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11140 11141 case strings.EqualFold("ValidationException", errorCode): 11142 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 11143 11144 default: 11145 genericError := &smithy.GenericAPIError{ 11146 Code: errorCode, 11147 Message: errorMessage, 11148 } 11149 return genericError 11150 11151 } 11152} 11153 11154func awsRestjson1_deserializeOpDocumentUpdateSlotOutput(v **UpdateSlotOutput, value interface{}) error { 11155 if v == nil { 11156 return fmt.Errorf("unexpected nil of type %T", v) 11157 } 11158 if value == nil { 11159 return nil 11160 } 11161 11162 shape, ok := value.(map[string]interface{}) 11163 if !ok { 11164 return fmt.Errorf("unexpected JSON type %v", value) 11165 } 11166 11167 var sv *UpdateSlotOutput 11168 if *v == nil { 11169 sv = &UpdateSlotOutput{} 11170 } else { 11171 sv = *v 11172 } 11173 11174 for key, value := range shape { 11175 switch key { 11176 case "botId": 11177 if value != nil { 11178 jtv, ok := value.(string) 11179 if !ok { 11180 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11181 } 11182 sv.BotId = ptr.String(jtv) 11183 } 11184 11185 case "botVersion": 11186 if value != nil { 11187 jtv, ok := value.(string) 11188 if !ok { 11189 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 11190 } 11191 sv.BotVersion = ptr.String(jtv) 11192 } 11193 11194 case "creationDateTime": 11195 if value != nil { 11196 switch jtv := value.(type) { 11197 case json.Number: 11198 f64, err := jtv.Float64() 11199 if err != nil { 11200 return err 11201 } 11202 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11203 11204 default: 11205 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11206 11207 } 11208 } 11209 11210 case "description": 11211 if value != nil { 11212 jtv, ok := value.(string) 11213 if !ok { 11214 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 11215 } 11216 sv.Description = ptr.String(jtv) 11217 } 11218 11219 case "intentId": 11220 if value != nil { 11221 jtv, ok := value.(string) 11222 if !ok { 11223 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11224 } 11225 sv.IntentId = ptr.String(jtv) 11226 } 11227 11228 case "lastUpdatedDateTime": 11229 if value != nil { 11230 switch jtv := value.(type) { 11231 case json.Number: 11232 f64, err := jtv.Float64() 11233 if err != nil { 11234 return err 11235 } 11236 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11237 11238 default: 11239 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11240 11241 } 11242 } 11243 11244 case "localeId": 11245 if value != nil { 11246 jtv, ok := value.(string) 11247 if !ok { 11248 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 11249 } 11250 sv.LocaleId = ptr.String(jtv) 11251 } 11252 11253 case "multipleValuesSetting": 11254 if err := awsRestjson1_deserializeDocumentMultipleValuesSetting(&sv.MultipleValuesSetting, value); err != nil { 11255 return err 11256 } 11257 11258 case "obfuscationSetting": 11259 if err := awsRestjson1_deserializeDocumentObfuscationSetting(&sv.ObfuscationSetting, value); err != nil { 11260 return err 11261 } 11262 11263 case "slotId": 11264 if value != nil { 11265 jtv, ok := value.(string) 11266 if !ok { 11267 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11268 } 11269 sv.SlotId = ptr.String(jtv) 11270 } 11271 11272 case "slotName": 11273 if value != nil { 11274 jtv, ok := value.(string) 11275 if !ok { 11276 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 11277 } 11278 sv.SlotName = ptr.String(jtv) 11279 } 11280 11281 case "slotTypeId": 11282 if value != nil { 11283 jtv, ok := value.(string) 11284 if !ok { 11285 return fmt.Errorf("expected BuiltInOrCustomSlotTypeId to be of type string, got %T instead", value) 11286 } 11287 sv.SlotTypeId = ptr.String(jtv) 11288 } 11289 11290 case "valueElicitationSetting": 11291 if err := awsRestjson1_deserializeDocumentSlotValueElicitationSetting(&sv.ValueElicitationSetting, value); err != nil { 11292 return err 11293 } 11294 11295 default: 11296 _, _ = key, value 11297 11298 } 11299 } 11300 *v = sv 11301 return nil 11302} 11303 11304type awsRestjson1_deserializeOpUpdateSlotType struct { 11305} 11306 11307func (*awsRestjson1_deserializeOpUpdateSlotType) ID() string { 11308 return "OperationDeserializer" 11309} 11310 11311func (m *awsRestjson1_deserializeOpUpdateSlotType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 11312 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 11313) { 11314 out, metadata, err = next.HandleDeserialize(ctx, in) 11315 if err != nil { 11316 return out, metadata, err 11317 } 11318 11319 response, ok := out.RawResponse.(*smithyhttp.Response) 11320 if !ok { 11321 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 11322 } 11323 11324 if response.StatusCode < 200 || response.StatusCode >= 300 { 11325 return out, metadata, awsRestjson1_deserializeOpErrorUpdateSlotType(response, &metadata) 11326 } 11327 output := &UpdateSlotTypeOutput{} 11328 out.Result = output 11329 11330 var buff [1024]byte 11331 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11332 11333 body := io.TeeReader(response.Body, ringBuffer) 11334 11335 decoder := json.NewDecoder(body) 11336 decoder.UseNumber() 11337 var shape interface{} 11338 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11339 var snapshot bytes.Buffer 11340 io.Copy(&snapshot, ringBuffer) 11341 err = &smithy.DeserializationError{ 11342 Err: fmt.Errorf("failed to decode response body, %w", err), 11343 Snapshot: snapshot.Bytes(), 11344 } 11345 return out, metadata, err 11346 } 11347 11348 err = awsRestjson1_deserializeOpDocumentUpdateSlotTypeOutput(&output, shape) 11349 if err != nil { 11350 var snapshot bytes.Buffer 11351 io.Copy(&snapshot, ringBuffer) 11352 return out, metadata, &smithy.DeserializationError{ 11353 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 11354 Snapshot: snapshot.Bytes(), 11355 } 11356 } 11357 11358 return out, metadata, err 11359} 11360 11361func awsRestjson1_deserializeOpErrorUpdateSlotType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 11362 var errorBuffer bytes.Buffer 11363 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 11364 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 11365 } 11366 errorBody := bytes.NewReader(errorBuffer.Bytes()) 11367 11368 errorCode := "UnknownError" 11369 errorMessage := errorCode 11370 11371 code := response.Header.Get("X-Amzn-ErrorType") 11372 if len(code) != 0 { 11373 errorCode = restjson.SanitizeErrorCode(code) 11374 } 11375 11376 var buff [1024]byte 11377 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11378 11379 body := io.TeeReader(errorBody, ringBuffer) 11380 decoder := json.NewDecoder(body) 11381 decoder.UseNumber() 11382 code, message, err := restjson.GetErrorInfo(decoder) 11383 if err != nil { 11384 var snapshot bytes.Buffer 11385 io.Copy(&snapshot, ringBuffer) 11386 err = &smithy.DeserializationError{ 11387 Err: fmt.Errorf("failed to decode response body, %w", err), 11388 Snapshot: snapshot.Bytes(), 11389 } 11390 return err 11391 } 11392 11393 errorBody.Seek(0, io.SeekStart) 11394 if len(code) != 0 { 11395 errorCode = restjson.SanitizeErrorCode(code) 11396 } 11397 if len(message) != 0 { 11398 errorMessage = message 11399 } 11400 11401 switch { 11402 case strings.EqualFold("ConflictException", errorCode): 11403 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 11404 11405 case strings.EqualFold("InternalServerException", errorCode): 11406 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 11407 11408 case strings.EqualFold("PreconditionFailedException", errorCode): 11409 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 11410 11411 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 11412 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 11413 11414 case strings.EqualFold("ThrottlingException", errorCode): 11415 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 11416 11417 case strings.EqualFold("ValidationException", errorCode): 11418 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 11419 11420 default: 11421 genericError := &smithy.GenericAPIError{ 11422 Code: errorCode, 11423 Message: errorMessage, 11424 } 11425 return genericError 11426 11427 } 11428} 11429 11430func awsRestjson1_deserializeOpDocumentUpdateSlotTypeOutput(v **UpdateSlotTypeOutput, value interface{}) error { 11431 if v == nil { 11432 return fmt.Errorf("unexpected nil of type %T", v) 11433 } 11434 if value == nil { 11435 return nil 11436 } 11437 11438 shape, ok := value.(map[string]interface{}) 11439 if !ok { 11440 return fmt.Errorf("unexpected JSON type %v", value) 11441 } 11442 11443 var sv *UpdateSlotTypeOutput 11444 if *v == nil { 11445 sv = &UpdateSlotTypeOutput{} 11446 } else { 11447 sv = *v 11448 } 11449 11450 for key, value := range shape { 11451 switch key { 11452 case "botId": 11453 if value != nil { 11454 jtv, ok := value.(string) 11455 if !ok { 11456 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11457 } 11458 sv.BotId = ptr.String(jtv) 11459 } 11460 11461 case "botVersion": 11462 if value != nil { 11463 jtv, ok := value.(string) 11464 if !ok { 11465 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 11466 } 11467 sv.BotVersion = ptr.String(jtv) 11468 } 11469 11470 case "creationDateTime": 11471 if value != nil { 11472 switch jtv := value.(type) { 11473 case json.Number: 11474 f64, err := jtv.Float64() 11475 if err != nil { 11476 return err 11477 } 11478 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11479 11480 default: 11481 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11482 11483 } 11484 } 11485 11486 case "description": 11487 if value != nil { 11488 jtv, ok := value.(string) 11489 if !ok { 11490 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 11491 } 11492 sv.Description = ptr.String(jtv) 11493 } 11494 11495 case "lastUpdatedDateTime": 11496 if value != nil { 11497 switch jtv := value.(type) { 11498 case json.Number: 11499 f64, err := jtv.Float64() 11500 if err != nil { 11501 return err 11502 } 11503 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11504 11505 default: 11506 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11507 11508 } 11509 } 11510 11511 case "localeId": 11512 if value != nil { 11513 jtv, ok := value.(string) 11514 if !ok { 11515 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 11516 } 11517 sv.LocaleId = ptr.String(jtv) 11518 } 11519 11520 case "parentSlotTypeSignature": 11521 if value != nil { 11522 jtv, ok := value.(string) 11523 if !ok { 11524 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 11525 } 11526 sv.ParentSlotTypeSignature = ptr.String(jtv) 11527 } 11528 11529 case "slotTypeId": 11530 if value != nil { 11531 jtv, ok := value.(string) 11532 if !ok { 11533 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11534 } 11535 sv.SlotTypeId = ptr.String(jtv) 11536 } 11537 11538 case "slotTypeName": 11539 if value != nil { 11540 jtv, ok := value.(string) 11541 if !ok { 11542 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 11543 } 11544 sv.SlotTypeName = ptr.String(jtv) 11545 } 11546 11547 case "slotTypeValues": 11548 if err := awsRestjson1_deserializeDocumentSlotTypeValues(&sv.SlotTypeValues, value); err != nil { 11549 return err 11550 } 11551 11552 case "valueSelectionSetting": 11553 if err := awsRestjson1_deserializeDocumentSlotValueSelectionSetting(&sv.ValueSelectionSetting, value); err != nil { 11554 return err 11555 } 11556 11557 default: 11558 _, _ = key, value 11559 11560 } 11561 } 11562 *v = sv 11563 return nil 11564} 11565 11566func awsRestjson1_deserializeOpHttpBindingsThrottlingException(v *types.ThrottlingException, response *smithyhttp.Response) error { 11567 if v == nil { 11568 return fmt.Errorf("unsupported deserialization for nil %T", v) 11569 } 11570 11571 if headerValues := response.Header.Values("Retry-After"); len(headerValues) != 0 { 11572 headerValues[0] = strings.TrimSpace(headerValues[0]) 11573 vv, err := strconv.ParseInt(headerValues[0], 0, 32) 11574 if err != nil { 11575 return err 11576 } 11577 v.RetryAfterSeconds = int32(vv) 11578 } 11579 11580 return nil 11581} 11582func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 11583 output := &types.ConflictException{} 11584 var buff [1024]byte 11585 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11586 11587 body := io.TeeReader(errorBody, ringBuffer) 11588 decoder := json.NewDecoder(body) 11589 decoder.UseNumber() 11590 var shape interface{} 11591 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11592 var snapshot bytes.Buffer 11593 io.Copy(&snapshot, ringBuffer) 11594 err = &smithy.DeserializationError{ 11595 Err: fmt.Errorf("failed to decode response body, %w", err), 11596 Snapshot: snapshot.Bytes(), 11597 } 11598 return err 11599 } 11600 11601 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 11602 11603 if err != nil { 11604 var snapshot bytes.Buffer 11605 io.Copy(&snapshot, ringBuffer) 11606 err = &smithy.DeserializationError{ 11607 Err: fmt.Errorf("failed to decode response body, %w", err), 11608 Snapshot: snapshot.Bytes(), 11609 } 11610 return err 11611 } 11612 11613 errorBody.Seek(0, io.SeekStart) 11614 11615 return output 11616} 11617 11618func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 11619 output := &types.InternalServerException{} 11620 var buff [1024]byte 11621 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11622 11623 body := io.TeeReader(errorBody, ringBuffer) 11624 decoder := json.NewDecoder(body) 11625 decoder.UseNumber() 11626 var shape interface{} 11627 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11628 var snapshot bytes.Buffer 11629 io.Copy(&snapshot, ringBuffer) 11630 err = &smithy.DeserializationError{ 11631 Err: fmt.Errorf("failed to decode response body, %w", err), 11632 Snapshot: snapshot.Bytes(), 11633 } 11634 return err 11635 } 11636 11637 err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) 11638 11639 if err != nil { 11640 var snapshot bytes.Buffer 11641 io.Copy(&snapshot, ringBuffer) 11642 err = &smithy.DeserializationError{ 11643 Err: fmt.Errorf("failed to decode response body, %w", err), 11644 Snapshot: snapshot.Bytes(), 11645 } 11646 return err 11647 } 11648 11649 errorBody.Seek(0, io.SeekStart) 11650 11651 return output 11652} 11653 11654func awsRestjson1_deserializeErrorPreconditionFailedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 11655 output := &types.PreconditionFailedException{} 11656 var buff [1024]byte 11657 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11658 11659 body := io.TeeReader(errorBody, ringBuffer) 11660 decoder := json.NewDecoder(body) 11661 decoder.UseNumber() 11662 var shape interface{} 11663 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11664 var snapshot bytes.Buffer 11665 io.Copy(&snapshot, ringBuffer) 11666 err = &smithy.DeserializationError{ 11667 Err: fmt.Errorf("failed to decode response body, %w", err), 11668 Snapshot: snapshot.Bytes(), 11669 } 11670 return err 11671 } 11672 11673 err := awsRestjson1_deserializeDocumentPreconditionFailedException(&output, shape) 11674 11675 if err != nil { 11676 var snapshot bytes.Buffer 11677 io.Copy(&snapshot, ringBuffer) 11678 err = &smithy.DeserializationError{ 11679 Err: fmt.Errorf("failed to decode response body, %w", err), 11680 Snapshot: snapshot.Bytes(), 11681 } 11682 return err 11683 } 11684 11685 errorBody.Seek(0, io.SeekStart) 11686 11687 return output 11688} 11689 11690func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 11691 output := &types.ResourceNotFoundException{} 11692 var buff [1024]byte 11693 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11694 11695 body := io.TeeReader(errorBody, ringBuffer) 11696 decoder := json.NewDecoder(body) 11697 decoder.UseNumber() 11698 var shape interface{} 11699 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11700 var snapshot bytes.Buffer 11701 io.Copy(&snapshot, ringBuffer) 11702 err = &smithy.DeserializationError{ 11703 Err: fmt.Errorf("failed to decode response body, %w", err), 11704 Snapshot: snapshot.Bytes(), 11705 } 11706 return err 11707 } 11708 11709 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 11710 11711 if err != nil { 11712 var snapshot bytes.Buffer 11713 io.Copy(&snapshot, ringBuffer) 11714 err = &smithy.DeserializationError{ 11715 Err: fmt.Errorf("failed to decode response body, %w", err), 11716 Snapshot: snapshot.Bytes(), 11717 } 11718 return err 11719 } 11720 11721 errorBody.Seek(0, io.SeekStart) 11722 11723 return output 11724} 11725 11726func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 11727 output := &types.ServiceQuotaExceededException{} 11728 var buff [1024]byte 11729 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11730 11731 body := io.TeeReader(errorBody, ringBuffer) 11732 decoder := json.NewDecoder(body) 11733 decoder.UseNumber() 11734 var shape interface{} 11735 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11736 var snapshot bytes.Buffer 11737 io.Copy(&snapshot, ringBuffer) 11738 err = &smithy.DeserializationError{ 11739 Err: fmt.Errorf("failed to decode response body, %w", err), 11740 Snapshot: snapshot.Bytes(), 11741 } 11742 return err 11743 } 11744 11745 err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) 11746 11747 if err != nil { 11748 var snapshot bytes.Buffer 11749 io.Copy(&snapshot, ringBuffer) 11750 err = &smithy.DeserializationError{ 11751 Err: fmt.Errorf("failed to decode response body, %w", err), 11752 Snapshot: snapshot.Bytes(), 11753 } 11754 return err 11755 } 11756 11757 errorBody.Seek(0, io.SeekStart) 11758 11759 return output 11760} 11761 11762func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 11763 output := &types.ThrottlingException{} 11764 var buff [1024]byte 11765 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11766 11767 body := io.TeeReader(errorBody, ringBuffer) 11768 decoder := json.NewDecoder(body) 11769 decoder.UseNumber() 11770 var shape interface{} 11771 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11772 var snapshot bytes.Buffer 11773 io.Copy(&snapshot, ringBuffer) 11774 err = &smithy.DeserializationError{ 11775 Err: fmt.Errorf("failed to decode response body, %w", err), 11776 Snapshot: snapshot.Bytes(), 11777 } 11778 return err 11779 } 11780 11781 err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) 11782 11783 if err != nil { 11784 var snapshot bytes.Buffer 11785 io.Copy(&snapshot, ringBuffer) 11786 err = &smithy.DeserializationError{ 11787 Err: fmt.Errorf("failed to decode response body, %w", err), 11788 Snapshot: snapshot.Bytes(), 11789 } 11790 return err 11791 } 11792 11793 errorBody.Seek(0, io.SeekStart) 11794 11795 if err := awsRestjson1_deserializeOpHttpBindingsThrottlingException(output, response); err != nil { 11796 return &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid HTTP bindings, %w", err)} 11797 } 11798 11799 return output 11800} 11801 11802func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 11803 output := &types.ValidationException{} 11804 var buff [1024]byte 11805 ringBuffer := smithyio.NewRingBuffer(buff[:]) 11806 11807 body := io.TeeReader(errorBody, ringBuffer) 11808 decoder := json.NewDecoder(body) 11809 decoder.UseNumber() 11810 var shape interface{} 11811 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 11812 var snapshot bytes.Buffer 11813 io.Copy(&snapshot, ringBuffer) 11814 err = &smithy.DeserializationError{ 11815 Err: fmt.Errorf("failed to decode response body, %w", err), 11816 Snapshot: snapshot.Bytes(), 11817 } 11818 return err 11819 } 11820 11821 err := awsRestjson1_deserializeDocumentValidationException(&output, shape) 11822 11823 if err != nil { 11824 var snapshot bytes.Buffer 11825 io.Copy(&snapshot, ringBuffer) 11826 err = &smithy.DeserializationError{ 11827 Err: fmt.Errorf("failed to decode response body, %w", err), 11828 Snapshot: snapshot.Bytes(), 11829 } 11830 return err 11831 } 11832 11833 errorBody.Seek(0, io.SeekStart) 11834 11835 return output 11836} 11837 11838func awsRestjson1_deserializeDocumentAudioLogDestination(v **types.AudioLogDestination, value interface{}) error { 11839 if v == nil { 11840 return fmt.Errorf("unexpected nil of type %T", v) 11841 } 11842 if value == nil { 11843 return nil 11844 } 11845 11846 shape, ok := value.(map[string]interface{}) 11847 if !ok { 11848 return fmt.Errorf("unexpected JSON type %v", value) 11849 } 11850 11851 var sv *types.AudioLogDestination 11852 if *v == nil { 11853 sv = &types.AudioLogDestination{} 11854 } else { 11855 sv = *v 11856 } 11857 11858 for key, value := range shape { 11859 switch key { 11860 case "s3Bucket": 11861 if err := awsRestjson1_deserializeDocumentS3BucketLogDestination(&sv.S3Bucket, value); err != nil { 11862 return err 11863 } 11864 11865 default: 11866 _, _ = key, value 11867 11868 } 11869 } 11870 *v = sv 11871 return nil 11872} 11873 11874func awsRestjson1_deserializeDocumentAudioLogSetting(v **types.AudioLogSetting, value interface{}) error { 11875 if v == nil { 11876 return fmt.Errorf("unexpected nil of type %T", v) 11877 } 11878 if value == nil { 11879 return nil 11880 } 11881 11882 shape, ok := value.(map[string]interface{}) 11883 if !ok { 11884 return fmt.Errorf("unexpected JSON type %v", value) 11885 } 11886 11887 var sv *types.AudioLogSetting 11888 if *v == nil { 11889 sv = &types.AudioLogSetting{} 11890 } else { 11891 sv = *v 11892 } 11893 11894 for key, value := range shape { 11895 switch key { 11896 case "destination": 11897 if err := awsRestjson1_deserializeDocumentAudioLogDestination(&sv.Destination, value); err != nil { 11898 return err 11899 } 11900 11901 case "enabled": 11902 if value != nil { 11903 jtv, ok := value.(bool) 11904 if !ok { 11905 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 11906 } 11907 sv.Enabled = jtv 11908 } 11909 11910 default: 11911 _, _ = key, value 11912 11913 } 11914 } 11915 *v = sv 11916 return nil 11917} 11918 11919func awsRestjson1_deserializeDocumentAudioLogSettingsList(v *[]types.AudioLogSetting, value interface{}) error { 11920 if v == nil { 11921 return fmt.Errorf("unexpected nil of type %T", v) 11922 } 11923 if value == nil { 11924 return nil 11925 } 11926 11927 shape, ok := value.([]interface{}) 11928 if !ok { 11929 return fmt.Errorf("unexpected JSON type %v", value) 11930 } 11931 11932 var cv []types.AudioLogSetting 11933 if *v == nil { 11934 cv = []types.AudioLogSetting{} 11935 } else { 11936 cv = *v 11937 } 11938 11939 for _, value := range shape { 11940 var col types.AudioLogSetting 11941 destAddr := &col 11942 if err := awsRestjson1_deserializeDocumentAudioLogSetting(&destAddr, value); err != nil { 11943 return err 11944 } 11945 col = *destAddr 11946 cv = append(cv, col) 11947 11948 } 11949 *v = cv 11950 return nil 11951} 11952 11953func awsRestjson1_deserializeDocumentBotAliasHistoryEvent(v **types.BotAliasHistoryEvent, value interface{}) error { 11954 if v == nil { 11955 return fmt.Errorf("unexpected nil of type %T", v) 11956 } 11957 if value == nil { 11958 return nil 11959 } 11960 11961 shape, ok := value.(map[string]interface{}) 11962 if !ok { 11963 return fmt.Errorf("unexpected JSON type %v", value) 11964 } 11965 11966 var sv *types.BotAliasHistoryEvent 11967 if *v == nil { 11968 sv = &types.BotAliasHistoryEvent{} 11969 } else { 11970 sv = *v 11971 } 11972 11973 for key, value := range shape { 11974 switch key { 11975 case "botVersion": 11976 if value != nil { 11977 jtv, ok := value.(string) 11978 if !ok { 11979 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 11980 } 11981 sv.BotVersion = ptr.String(jtv) 11982 } 11983 11984 case "endDate": 11985 if value != nil { 11986 switch jtv := value.(type) { 11987 case json.Number: 11988 f64, err := jtv.Float64() 11989 if err != nil { 11990 return err 11991 } 11992 sv.EndDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11993 11994 default: 11995 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 11996 11997 } 11998 } 11999 12000 case "startDate": 12001 if value != nil { 12002 switch jtv := value.(type) { 12003 case json.Number: 12004 f64, err := jtv.Float64() 12005 if err != nil { 12006 return err 12007 } 12008 sv.StartDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12009 12010 default: 12011 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12012 12013 } 12014 } 12015 12016 default: 12017 _, _ = key, value 12018 12019 } 12020 } 12021 *v = sv 12022 return nil 12023} 12024 12025func awsRestjson1_deserializeDocumentBotAliasHistoryEventsList(v *[]types.BotAliasHistoryEvent, value interface{}) error { 12026 if v == nil { 12027 return fmt.Errorf("unexpected nil of type %T", v) 12028 } 12029 if value == nil { 12030 return nil 12031 } 12032 12033 shape, ok := value.([]interface{}) 12034 if !ok { 12035 return fmt.Errorf("unexpected JSON type %v", value) 12036 } 12037 12038 var cv []types.BotAliasHistoryEvent 12039 if *v == nil { 12040 cv = []types.BotAliasHistoryEvent{} 12041 } else { 12042 cv = *v 12043 } 12044 12045 for _, value := range shape { 12046 var col types.BotAliasHistoryEvent 12047 destAddr := &col 12048 if err := awsRestjson1_deserializeDocumentBotAliasHistoryEvent(&destAddr, value); err != nil { 12049 return err 12050 } 12051 col = *destAddr 12052 cv = append(cv, col) 12053 12054 } 12055 *v = cv 12056 return nil 12057} 12058 12059func awsRestjson1_deserializeDocumentBotAliasLocaleSettings(v **types.BotAliasLocaleSettings, value interface{}) error { 12060 if v == nil { 12061 return fmt.Errorf("unexpected nil of type %T", v) 12062 } 12063 if value == nil { 12064 return nil 12065 } 12066 12067 shape, ok := value.(map[string]interface{}) 12068 if !ok { 12069 return fmt.Errorf("unexpected JSON type %v", value) 12070 } 12071 12072 var sv *types.BotAliasLocaleSettings 12073 if *v == nil { 12074 sv = &types.BotAliasLocaleSettings{} 12075 } else { 12076 sv = *v 12077 } 12078 12079 for key, value := range shape { 12080 switch key { 12081 case "codeHookSpecification": 12082 if err := awsRestjson1_deserializeDocumentCodeHookSpecification(&sv.CodeHookSpecification, value); err != nil { 12083 return err 12084 } 12085 12086 case "enabled": 12087 if value != nil { 12088 jtv, ok := value.(bool) 12089 if !ok { 12090 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 12091 } 12092 sv.Enabled = jtv 12093 } 12094 12095 default: 12096 _, _ = key, value 12097 12098 } 12099 } 12100 *v = sv 12101 return nil 12102} 12103 12104func awsRestjson1_deserializeDocumentBotAliasLocaleSettingsMap(v *map[string]types.BotAliasLocaleSettings, value interface{}) error { 12105 if v == nil { 12106 return fmt.Errorf("unexpected nil of type %T", v) 12107 } 12108 if value == nil { 12109 return nil 12110 } 12111 12112 shape, ok := value.(map[string]interface{}) 12113 if !ok { 12114 return fmt.Errorf("unexpected JSON type %v", value) 12115 } 12116 12117 var mv map[string]types.BotAliasLocaleSettings 12118 if *v == nil { 12119 mv = map[string]types.BotAliasLocaleSettings{} 12120 } else { 12121 mv = *v 12122 } 12123 12124 for key, value := range shape { 12125 var parsedVal types.BotAliasLocaleSettings 12126 mapVar := parsedVal 12127 destAddr := &mapVar 12128 if err := awsRestjson1_deserializeDocumentBotAliasLocaleSettings(&destAddr, value); err != nil { 12129 return err 12130 } 12131 parsedVal = *destAddr 12132 mv[key] = parsedVal 12133 12134 } 12135 *v = mv 12136 return nil 12137} 12138 12139func awsRestjson1_deserializeDocumentBotAliasSummary(v **types.BotAliasSummary, value interface{}) error { 12140 if v == nil { 12141 return fmt.Errorf("unexpected nil of type %T", v) 12142 } 12143 if value == nil { 12144 return nil 12145 } 12146 12147 shape, ok := value.(map[string]interface{}) 12148 if !ok { 12149 return fmt.Errorf("unexpected JSON type %v", value) 12150 } 12151 12152 var sv *types.BotAliasSummary 12153 if *v == nil { 12154 sv = &types.BotAliasSummary{} 12155 } else { 12156 sv = *v 12157 } 12158 12159 for key, value := range shape { 12160 switch key { 12161 case "botAliasId": 12162 if value != nil { 12163 jtv, ok := value.(string) 12164 if !ok { 12165 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 12166 } 12167 sv.BotAliasId = ptr.String(jtv) 12168 } 12169 12170 case "botAliasName": 12171 if value != nil { 12172 jtv, ok := value.(string) 12173 if !ok { 12174 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 12175 } 12176 sv.BotAliasName = ptr.String(jtv) 12177 } 12178 12179 case "botAliasStatus": 12180 if value != nil { 12181 jtv, ok := value.(string) 12182 if !ok { 12183 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 12184 } 12185 sv.BotAliasStatus = types.BotAliasStatus(jtv) 12186 } 12187 12188 case "botVersion": 12189 if value != nil { 12190 jtv, ok := value.(string) 12191 if !ok { 12192 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 12193 } 12194 sv.BotVersion = ptr.String(jtv) 12195 } 12196 12197 case "creationDateTime": 12198 if value != nil { 12199 switch jtv := value.(type) { 12200 case json.Number: 12201 f64, err := jtv.Float64() 12202 if err != nil { 12203 return err 12204 } 12205 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12206 12207 default: 12208 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12209 12210 } 12211 } 12212 12213 case "description": 12214 if value != nil { 12215 jtv, ok := value.(string) 12216 if !ok { 12217 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 12218 } 12219 sv.Description = ptr.String(jtv) 12220 } 12221 12222 case "lastUpdatedDateTime": 12223 if value != nil { 12224 switch jtv := value.(type) { 12225 case json.Number: 12226 f64, err := jtv.Float64() 12227 if err != nil { 12228 return err 12229 } 12230 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12231 12232 default: 12233 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12234 12235 } 12236 } 12237 12238 default: 12239 _, _ = key, value 12240 12241 } 12242 } 12243 *v = sv 12244 return nil 12245} 12246 12247func awsRestjson1_deserializeDocumentBotAliasSummaryList(v *[]types.BotAliasSummary, value interface{}) error { 12248 if v == nil { 12249 return fmt.Errorf("unexpected nil of type %T", v) 12250 } 12251 if value == nil { 12252 return nil 12253 } 12254 12255 shape, ok := value.([]interface{}) 12256 if !ok { 12257 return fmt.Errorf("unexpected JSON type %v", value) 12258 } 12259 12260 var cv []types.BotAliasSummary 12261 if *v == nil { 12262 cv = []types.BotAliasSummary{} 12263 } else { 12264 cv = *v 12265 } 12266 12267 for _, value := range shape { 12268 var col types.BotAliasSummary 12269 destAddr := &col 12270 if err := awsRestjson1_deserializeDocumentBotAliasSummary(&destAddr, value); err != nil { 12271 return err 12272 } 12273 col = *destAddr 12274 cv = append(cv, col) 12275 12276 } 12277 *v = cv 12278 return nil 12279} 12280 12281func awsRestjson1_deserializeDocumentBotExportSpecification(v **types.BotExportSpecification, value interface{}) error { 12282 if v == nil { 12283 return fmt.Errorf("unexpected nil of type %T", v) 12284 } 12285 if value == nil { 12286 return nil 12287 } 12288 12289 shape, ok := value.(map[string]interface{}) 12290 if !ok { 12291 return fmt.Errorf("unexpected JSON type %v", value) 12292 } 12293 12294 var sv *types.BotExportSpecification 12295 if *v == nil { 12296 sv = &types.BotExportSpecification{} 12297 } else { 12298 sv = *v 12299 } 12300 12301 for key, value := range shape { 12302 switch key { 12303 case "botId": 12304 if value != nil { 12305 jtv, ok := value.(string) 12306 if !ok { 12307 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12308 } 12309 sv.BotId = ptr.String(jtv) 12310 } 12311 12312 case "botVersion": 12313 if value != nil { 12314 jtv, ok := value.(string) 12315 if !ok { 12316 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 12317 } 12318 sv.BotVersion = ptr.String(jtv) 12319 } 12320 12321 default: 12322 _, _ = key, value 12323 12324 } 12325 } 12326 *v = sv 12327 return nil 12328} 12329 12330func awsRestjson1_deserializeDocumentBotImportSpecification(v **types.BotImportSpecification, value interface{}) error { 12331 if v == nil { 12332 return fmt.Errorf("unexpected nil of type %T", v) 12333 } 12334 if value == nil { 12335 return nil 12336 } 12337 12338 shape, ok := value.(map[string]interface{}) 12339 if !ok { 12340 return fmt.Errorf("unexpected JSON type %v", value) 12341 } 12342 12343 var sv *types.BotImportSpecification 12344 if *v == nil { 12345 sv = &types.BotImportSpecification{} 12346 } else { 12347 sv = *v 12348 } 12349 12350 for key, value := range shape { 12351 switch key { 12352 case "botName": 12353 if value != nil { 12354 jtv, ok := value.(string) 12355 if !ok { 12356 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 12357 } 12358 sv.BotName = ptr.String(jtv) 12359 } 12360 12361 case "botTags": 12362 if err := awsRestjson1_deserializeDocumentTagMap(&sv.BotTags, value); err != nil { 12363 return err 12364 } 12365 12366 case "dataPrivacy": 12367 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 12368 return err 12369 } 12370 12371 case "idleSessionTTLInSeconds": 12372 if value != nil { 12373 jtv, ok := value.(json.Number) 12374 if !ok { 12375 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 12376 } 12377 i64, err := jtv.Int64() 12378 if err != nil { 12379 return err 12380 } 12381 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 12382 } 12383 12384 case "roleArn": 12385 if value != nil { 12386 jtv, ok := value.(string) 12387 if !ok { 12388 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 12389 } 12390 sv.RoleArn = ptr.String(jtv) 12391 } 12392 12393 case "testBotAliasTags": 12394 if err := awsRestjson1_deserializeDocumentTagMap(&sv.TestBotAliasTags, value); err != nil { 12395 return err 12396 } 12397 12398 default: 12399 _, _ = key, value 12400 12401 } 12402 } 12403 *v = sv 12404 return nil 12405} 12406 12407func awsRestjson1_deserializeDocumentBotLocaleExportSpecification(v **types.BotLocaleExportSpecification, value interface{}) error { 12408 if v == nil { 12409 return fmt.Errorf("unexpected nil of type %T", v) 12410 } 12411 if value == nil { 12412 return nil 12413 } 12414 12415 shape, ok := value.(map[string]interface{}) 12416 if !ok { 12417 return fmt.Errorf("unexpected JSON type %v", value) 12418 } 12419 12420 var sv *types.BotLocaleExportSpecification 12421 if *v == nil { 12422 sv = &types.BotLocaleExportSpecification{} 12423 } else { 12424 sv = *v 12425 } 12426 12427 for key, value := range shape { 12428 switch key { 12429 case "botId": 12430 if value != nil { 12431 jtv, ok := value.(string) 12432 if !ok { 12433 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12434 } 12435 sv.BotId = ptr.String(jtv) 12436 } 12437 12438 case "botVersion": 12439 if value != nil { 12440 jtv, ok := value.(string) 12441 if !ok { 12442 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 12443 } 12444 sv.BotVersion = ptr.String(jtv) 12445 } 12446 12447 case "localeId": 12448 if value != nil { 12449 jtv, ok := value.(string) 12450 if !ok { 12451 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 12452 } 12453 sv.LocaleId = ptr.String(jtv) 12454 } 12455 12456 default: 12457 _, _ = key, value 12458 12459 } 12460 } 12461 *v = sv 12462 return nil 12463} 12464 12465func awsRestjson1_deserializeDocumentBotLocaleHistoryEvent(v **types.BotLocaleHistoryEvent, value interface{}) error { 12466 if v == nil { 12467 return fmt.Errorf("unexpected nil of type %T", v) 12468 } 12469 if value == nil { 12470 return nil 12471 } 12472 12473 shape, ok := value.(map[string]interface{}) 12474 if !ok { 12475 return fmt.Errorf("unexpected JSON type %v", value) 12476 } 12477 12478 var sv *types.BotLocaleHistoryEvent 12479 if *v == nil { 12480 sv = &types.BotLocaleHistoryEvent{} 12481 } else { 12482 sv = *v 12483 } 12484 12485 for key, value := range shape { 12486 switch key { 12487 case "event": 12488 if value != nil { 12489 jtv, ok := value.(string) 12490 if !ok { 12491 return fmt.Errorf("expected BotLocaleHistoryEventDescription to be of type string, got %T instead", value) 12492 } 12493 sv.Event = ptr.String(jtv) 12494 } 12495 12496 case "eventDate": 12497 if value != nil { 12498 switch jtv := value.(type) { 12499 case json.Number: 12500 f64, err := jtv.Float64() 12501 if err != nil { 12502 return err 12503 } 12504 sv.EventDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12505 12506 default: 12507 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12508 12509 } 12510 } 12511 12512 default: 12513 _, _ = key, value 12514 12515 } 12516 } 12517 *v = sv 12518 return nil 12519} 12520 12521func awsRestjson1_deserializeDocumentBotLocaleHistoryEventsList(v *[]types.BotLocaleHistoryEvent, value interface{}) error { 12522 if v == nil { 12523 return fmt.Errorf("unexpected nil of type %T", v) 12524 } 12525 if value == nil { 12526 return nil 12527 } 12528 12529 shape, ok := value.([]interface{}) 12530 if !ok { 12531 return fmt.Errorf("unexpected JSON type %v", value) 12532 } 12533 12534 var cv []types.BotLocaleHistoryEvent 12535 if *v == nil { 12536 cv = []types.BotLocaleHistoryEvent{} 12537 } else { 12538 cv = *v 12539 } 12540 12541 for _, value := range shape { 12542 var col types.BotLocaleHistoryEvent 12543 destAddr := &col 12544 if err := awsRestjson1_deserializeDocumentBotLocaleHistoryEvent(&destAddr, value); err != nil { 12545 return err 12546 } 12547 col = *destAddr 12548 cv = append(cv, col) 12549 12550 } 12551 *v = cv 12552 return nil 12553} 12554 12555func awsRestjson1_deserializeDocumentBotLocaleImportSpecification(v **types.BotLocaleImportSpecification, value interface{}) error { 12556 if v == nil { 12557 return fmt.Errorf("unexpected nil of type %T", v) 12558 } 12559 if value == nil { 12560 return nil 12561 } 12562 12563 shape, ok := value.(map[string]interface{}) 12564 if !ok { 12565 return fmt.Errorf("unexpected JSON type %v", value) 12566 } 12567 12568 var sv *types.BotLocaleImportSpecification 12569 if *v == nil { 12570 sv = &types.BotLocaleImportSpecification{} 12571 } else { 12572 sv = *v 12573 } 12574 12575 for key, value := range shape { 12576 switch key { 12577 case "botId": 12578 if value != nil { 12579 jtv, ok := value.(string) 12580 if !ok { 12581 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12582 } 12583 sv.BotId = ptr.String(jtv) 12584 } 12585 12586 case "botVersion": 12587 if value != nil { 12588 jtv, ok := value.(string) 12589 if !ok { 12590 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 12591 } 12592 sv.BotVersion = ptr.String(jtv) 12593 } 12594 12595 case "localeId": 12596 if value != nil { 12597 jtv, ok := value.(string) 12598 if !ok { 12599 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 12600 } 12601 sv.LocaleId = ptr.String(jtv) 12602 } 12603 12604 case "nluIntentConfidenceThreshold": 12605 if value != nil { 12606 switch jtv := value.(type) { 12607 case json.Number: 12608 f64, err := jtv.Float64() 12609 if err != nil { 12610 return err 12611 } 12612 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 12613 12614 case string: 12615 var f64 float64 12616 switch { 12617 case strings.EqualFold(jtv, "NaN"): 12618 f64 = math.NaN() 12619 12620 case strings.EqualFold(jtv, "Infinity"): 12621 f64 = math.Inf(1) 12622 12623 case strings.EqualFold(jtv, "-Infinity"): 12624 f64 = math.Inf(-1) 12625 12626 default: 12627 return fmt.Errorf("unknown JSON number value: %s", jtv) 12628 12629 } 12630 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 12631 12632 default: 12633 return fmt.Errorf("expected ConfidenceThreshold to be a JSON Number, got %T instead", value) 12634 12635 } 12636 } 12637 12638 case "voiceSettings": 12639 if err := awsRestjson1_deserializeDocumentVoiceSettings(&sv.VoiceSettings, value); err != nil { 12640 return err 12641 } 12642 12643 default: 12644 _, _ = key, value 12645 12646 } 12647 } 12648 *v = sv 12649 return nil 12650} 12651 12652func awsRestjson1_deserializeDocumentBotLocaleSummary(v **types.BotLocaleSummary, value interface{}) error { 12653 if v == nil { 12654 return fmt.Errorf("unexpected nil of type %T", v) 12655 } 12656 if value == nil { 12657 return nil 12658 } 12659 12660 shape, ok := value.(map[string]interface{}) 12661 if !ok { 12662 return fmt.Errorf("unexpected JSON type %v", value) 12663 } 12664 12665 var sv *types.BotLocaleSummary 12666 if *v == nil { 12667 sv = &types.BotLocaleSummary{} 12668 } else { 12669 sv = *v 12670 } 12671 12672 for key, value := range shape { 12673 switch key { 12674 case "botLocaleStatus": 12675 if value != nil { 12676 jtv, ok := value.(string) 12677 if !ok { 12678 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 12679 } 12680 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 12681 } 12682 12683 case "description": 12684 if value != nil { 12685 jtv, ok := value.(string) 12686 if !ok { 12687 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 12688 } 12689 sv.Description = ptr.String(jtv) 12690 } 12691 12692 case "lastBuildSubmittedDateTime": 12693 if value != nil { 12694 switch jtv := value.(type) { 12695 case json.Number: 12696 f64, err := jtv.Float64() 12697 if err != nil { 12698 return err 12699 } 12700 sv.LastBuildSubmittedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12701 12702 default: 12703 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12704 12705 } 12706 } 12707 12708 case "lastUpdatedDateTime": 12709 if value != nil { 12710 switch jtv := value.(type) { 12711 case json.Number: 12712 f64, err := jtv.Float64() 12713 if err != nil { 12714 return err 12715 } 12716 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12717 12718 default: 12719 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12720 12721 } 12722 } 12723 12724 case "localeId": 12725 if value != nil { 12726 jtv, ok := value.(string) 12727 if !ok { 12728 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 12729 } 12730 sv.LocaleId = ptr.String(jtv) 12731 } 12732 12733 case "localeName": 12734 if value != nil { 12735 jtv, ok := value.(string) 12736 if !ok { 12737 return fmt.Errorf("expected LocaleName to be of type string, got %T instead", value) 12738 } 12739 sv.LocaleName = ptr.String(jtv) 12740 } 12741 12742 default: 12743 _, _ = key, value 12744 12745 } 12746 } 12747 *v = sv 12748 return nil 12749} 12750 12751func awsRestjson1_deserializeDocumentBotLocaleSummaryList(v *[]types.BotLocaleSummary, value interface{}) error { 12752 if v == nil { 12753 return fmt.Errorf("unexpected nil of type %T", v) 12754 } 12755 if value == nil { 12756 return nil 12757 } 12758 12759 shape, ok := value.([]interface{}) 12760 if !ok { 12761 return fmt.Errorf("unexpected JSON type %v", value) 12762 } 12763 12764 var cv []types.BotLocaleSummary 12765 if *v == nil { 12766 cv = []types.BotLocaleSummary{} 12767 } else { 12768 cv = *v 12769 } 12770 12771 for _, value := range shape { 12772 var col types.BotLocaleSummary 12773 destAddr := &col 12774 if err := awsRestjson1_deserializeDocumentBotLocaleSummary(&destAddr, value); err != nil { 12775 return err 12776 } 12777 col = *destAddr 12778 cv = append(cv, col) 12779 12780 } 12781 *v = cv 12782 return nil 12783} 12784 12785func awsRestjson1_deserializeDocumentBotSummary(v **types.BotSummary, value interface{}) error { 12786 if v == nil { 12787 return fmt.Errorf("unexpected nil of type %T", v) 12788 } 12789 if value == nil { 12790 return nil 12791 } 12792 12793 shape, ok := value.(map[string]interface{}) 12794 if !ok { 12795 return fmt.Errorf("unexpected JSON type %v", value) 12796 } 12797 12798 var sv *types.BotSummary 12799 if *v == nil { 12800 sv = &types.BotSummary{} 12801 } else { 12802 sv = *v 12803 } 12804 12805 for key, value := range shape { 12806 switch key { 12807 case "botId": 12808 if value != nil { 12809 jtv, ok := value.(string) 12810 if !ok { 12811 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 12812 } 12813 sv.BotId = ptr.String(jtv) 12814 } 12815 12816 case "botName": 12817 if value != nil { 12818 jtv, ok := value.(string) 12819 if !ok { 12820 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 12821 } 12822 sv.BotName = ptr.String(jtv) 12823 } 12824 12825 case "botStatus": 12826 if value != nil { 12827 jtv, ok := value.(string) 12828 if !ok { 12829 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 12830 } 12831 sv.BotStatus = types.BotStatus(jtv) 12832 } 12833 12834 case "description": 12835 if value != nil { 12836 jtv, ok := value.(string) 12837 if !ok { 12838 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 12839 } 12840 sv.Description = ptr.String(jtv) 12841 } 12842 12843 case "lastUpdatedDateTime": 12844 if value != nil { 12845 switch jtv := value.(type) { 12846 case json.Number: 12847 f64, err := jtv.Float64() 12848 if err != nil { 12849 return err 12850 } 12851 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 12852 12853 default: 12854 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 12855 12856 } 12857 } 12858 12859 case "latestBotVersion": 12860 if value != nil { 12861 jtv, ok := value.(string) 12862 if !ok { 12863 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 12864 } 12865 sv.LatestBotVersion = ptr.String(jtv) 12866 } 12867 12868 default: 12869 _, _ = key, value 12870 12871 } 12872 } 12873 *v = sv 12874 return nil 12875} 12876 12877func awsRestjson1_deserializeDocumentBotSummaryList(v *[]types.BotSummary, value interface{}) error { 12878 if v == nil { 12879 return fmt.Errorf("unexpected nil of type %T", v) 12880 } 12881 if value == nil { 12882 return nil 12883 } 12884 12885 shape, ok := value.([]interface{}) 12886 if !ok { 12887 return fmt.Errorf("unexpected JSON type %v", value) 12888 } 12889 12890 var cv []types.BotSummary 12891 if *v == nil { 12892 cv = []types.BotSummary{} 12893 } else { 12894 cv = *v 12895 } 12896 12897 for _, value := range shape { 12898 var col types.BotSummary 12899 destAddr := &col 12900 if err := awsRestjson1_deserializeDocumentBotSummary(&destAddr, value); err != nil { 12901 return err 12902 } 12903 col = *destAddr 12904 cv = append(cv, col) 12905 12906 } 12907 *v = cv 12908 return nil 12909} 12910 12911func awsRestjson1_deserializeDocumentBotVersionLocaleDetails(v **types.BotVersionLocaleDetails, value interface{}) error { 12912 if v == nil { 12913 return fmt.Errorf("unexpected nil of type %T", v) 12914 } 12915 if value == nil { 12916 return nil 12917 } 12918 12919 shape, ok := value.(map[string]interface{}) 12920 if !ok { 12921 return fmt.Errorf("unexpected JSON type %v", value) 12922 } 12923 12924 var sv *types.BotVersionLocaleDetails 12925 if *v == nil { 12926 sv = &types.BotVersionLocaleDetails{} 12927 } else { 12928 sv = *v 12929 } 12930 12931 for key, value := range shape { 12932 switch key { 12933 case "sourceBotVersion": 12934 if value != nil { 12935 jtv, ok := value.(string) 12936 if !ok { 12937 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 12938 } 12939 sv.SourceBotVersion = ptr.String(jtv) 12940 } 12941 12942 default: 12943 _, _ = key, value 12944 12945 } 12946 } 12947 *v = sv 12948 return nil 12949} 12950 12951func awsRestjson1_deserializeDocumentBotVersionLocaleSpecification(v *map[string]types.BotVersionLocaleDetails, value interface{}) error { 12952 if v == nil { 12953 return fmt.Errorf("unexpected nil of type %T", v) 12954 } 12955 if value == nil { 12956 return nil 12957 } 12958 12959 shape, ok := value.(map[string]interface{}) 12960 if !ok { 12961 return fmt.Errorf("unexpected JSON type %v", value) 12962 } 12963 12964 var mv map[string]types.BotVersionLocaleDetails 12965 if *v == nil { 12966 mv = map[string]types.BotVersionLocaleDetails{} 12967 } else { 12968 mv = *v 12969 } 12970 12971 for key, value := range shape { 12972 var parsedVal types.BotVersionLocaleDetails 12973 mapVar := parsedVal 12974 destAddr := &mapVar 12975 if err := awsRestjson1_deserializeDocumentBotVersionLocaleDetails(&destAddr, value); err != nil { 12976 return err 12977 } 12978 parsedVal = *destAddr 12979 mv[key] = parsedVal 12980 12981 } 12982 *v = mv 12983 return nil 12984} 12985 12986func awsRestjson1_deserializeDocumentBotVersionSummary(v **types.BotVersionSummary, value interface{}) error { 12987 if v == nil { 12988 return fmt.Errorf("unexpected nil of type %T", v) 12989 } 12990 if value == nil { 12991 return nil 12992 } 12993 12994 shape, ok := value.(map[string]interface{}) 12995 if !ok { 12996 return fmt.Errorf("unexpected JSON type %v", value) 12997 } 12998 12999 var sv *types.BotVersionSummary 13000 if *v == nil { 13001 sv = &types.BotVersionSummary{} 13002 } else { 13003 sv = *v 13004 } 13005 13006 for key, value := range shape { 13007 switch key { 13008 case "botName": 13009 if value != nil { 13010 jtv, ok := value.(string) 13011 if !ok { 13012 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 13013 } 13014 sv.BotName = ptr.String(jtv) 13015 } 13016 13017 case "botStatus": 13018 if value != nil { 13019 jtv, ok := value.(string) 13020 if !ok { 13021 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 13022 } 13023 sv.BotStatus = types.BotStatus(jtv) 13024 } 13025 13026 case "botVersion": 13027 if value != nil { 13028 jtv, ok := value.(string) 13029 if !ok { 13030 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 13031 } 13032 sv.BotVersion = ptr.String(jtv) 13033 } 13034 13035 case "creationDateTime": 13036 if value != nil { 13037 switch jtv := value.(type) { 13038 case json.Number: 13039 f64, err := jtv.Float64() 13040 if err != nil { 13041 return err 13042 } 13043 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13044 13045 default: 13046 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 13047 13048 } 13049 } 13050 13051 case "description": 13052 if value != nil { 13053 jtv, ok := value.(string) 13054 if !ok { 13055 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 13056 } 13057 sv.Description = ptr.String(jtv) 13058 } 13059 13060 default: 13061 _, _ = key, value 13062 13063 } 13064 } 13065 *v = sv 13066 return nil 13067} 13068 13069func awsRestjson1_deserializeDocumentBotVersionSummaryList(v *[]types.BotVersionSummary, value interface{}) error { 13070 if v == nil { 13071 return fmt.Errorf("unexpected nil of type %T", v) 13072 } 13073 if value == nil { 13074 return nil 13075 } 13076 13077 shape, ok := value.([]interface{}) 13078 if !ok { 13079 return fmt.Errorf("unexpected JSON type %v", value) 13080 } 13081 13082 var cv []types.BotVersionSummary 13083 if *v == nil { 13084 cv = []types.BotVersionSummary{} 13085 } else { 13086 cv = *v 13087 } 13088 13089 for _, value := range shape { 13090 var col types.BotVersionSummary 13091 destAddr := &col 13092 if err := awsRestjson1_deserializeDocumentBotVersionSummary(&destAddr, value); err != nil { 13093 return err 13094 } 13095 col = *destAddr 13096 cv = append(cv, col) 13097 13098 } 13099 *v = cv 13100 return nil 13101} 13102 13103func awsRestjson1_deserializeDocumentBuiltInIntentSummary(v **types.BuiltInIntentSummary, value interface{}) error { 13104 if v == nil { 13105 return fmt.Errorf("unexpected nil of type %T", v) 13106 } 13107 if value == nil { 13108 return nil 13109 } 13110 13111 shape, ok := value.(map[string]interface{}) 13112 if !ok { 13113 return fmt.Errorf("unexpected JSON type %v", value) 13114 } 13115 13116 var sv *types.BuiltInIntentSummary 13117 if *v == nil { 13118 sv = &types.BuiltInIntentSummary{} 13119 } else { 13120 sv = *v 13121 } 13122 13123 for key, value := range shape { 13124 switch key { 13125 case "description": 13126 if value != nil { 13127 jtv, ok := value.(string) 13128 if !ok { 13129 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 13130 } 13131 sv.Description = ptr.String(jtv) 13132 } 13133 13134 case "intentSignature": 13135 if value != nil { 13136 jtv, ok := value.(string) 13137 if !ok { 13138 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 13139 } 13140 sv.IntentSignature = ptr.String(jtv) 13141 } 13142 13143 default: 13144 _, _ = key, value 13145 13146 } 13147 } 13148 *v = sv 13149 return nil 13150} 13151 13152func awsRestjson1_deserializeDocumentBuiltInIntentSummaryList(v *[]types.BuiltInIntentSummary, value interface{}) error { 13153 if v == nil { 13154 return fmt.Errorf("unexpected nil of type %T", v) 13155 } 13156 if value == nil { 13157 return nil 13158 } 13159 13160 shape, ok := value.([]interface{}) 13161 if !ok { 13162 return fmt.Errorf("unexpected JSON type %v", value) 13163 } 13164 13165 var cv []types.BuiltInIntentSummary 13166 if *v == nil { 13167 cv = []types.BuiltInIntentSummary{} 13168 } else { 13169 cv = *v 13170 } 13171 13172 for _, value := range shape { 13173 var col types.BuiltInIntentSummary 13174 destAddr := &col 13175 if err := awsRestjson1_deserializeDocumentBuiltInIntentSummary(&destAddr, value); err != nil { 13176 return err 13177 } 13178 col = *destAddr 13179 cv = append(cv, col) 13180 13181 } 13182 *v = cv 13183 return nil 13184} 13185 13186func awsRestjson1_deserializeDocumentBuiltInSlotTypeSummary(v **types.BuiltInSlotTypeSummary, value interface{}) error { 13187 if v == nil { 13188 return fmt.Errorf("unexpected nil of type %T", v) 13189 } 13190 if value == nil { 13191 return nil 13192 } 13193 13194 shape, ok := value.(map[string]interface{}) 13195 if !ok { 13196 return fmt.Errorf("unexpected JSON type %v", value) 13197 } 13198 13199 var sv *types.BuiltInSlotTypeSummary 13200 if *v == nil { 13201 sv = &types.BuiltInSlotTypeSummary{} 13202 } else { 13203 sv = *v 13204 } 13205 13206 for key, value := range shape { 13207 switch key { 13208 case "description": 13209 if value != nil { 13210 jtv, ok := value.(string) 13211 if !ok { 13212 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 13213 } 13214 sv.Description = ptr.String(jtv) 13215 } 13216 13217 case "slotTypeSignature": 13218 if value != nil { 13219 jtv, ok := value.(string) 13220 if !ok { 13221 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 13222 } 13223 sv.SlotTypeSignature = ptr.String(jtv) 13224 } 13225 13226 default: 13227 _, _ = key, value 13228 13229 } 13230 } 13231 *v = sv 13232 return nil 13233} 13234 13235func awsRestjson1_deserializeDocumentBuiltInSlotTypeSummaryList(v *[]types.BuiltInSlotTypeSummary, value interface{}) error { 13236 if v == nil { 13237 return fmt.Errorf("unexpected nil of type %T", v) 13238 } 13239 if value == nil { 13240 return nil 13241 } 13242 13243 shape, ok := value.([]interface{}) 13244 if !ok { 13245 return fmt.Errorf("unexpected JSON type %v", value) 13246 } 13247 13248 var cv []types.BuiltInSlotTypeSummary 13249 if *v == nil { 13250 cv = []types.BuiltInSlotTypeSummary{} 13251 } else { 13252 cv = *v 13253 } 13254 13255 for _, value := range shape { 13256 var col types.BuiltInSlotTypeSummary 13257 destAddr := &col 13258 if err := awsRestjson1_deserializeDocumentBuiltInSlotTypeSummary(&destAddr, value); err != nil { 13259 return err 13260 } 13261 col = *destAddr 13262 cv = append(cv, col) 13263 13264 } 13265 *v = cv 13266 return nil 13267} 13268 13269func awsRestjson1_deserializeDocumentButton(v **types.Button, value interface{}) error { 13270 if v == nil { 13271 return fmt.Errorf("unexpected nil of type %T", v) 13272 } 13273 if value == nil { 13274 return nil 13275 } 13276 13277 shape, ok := value.(map[string]interface{}) 13278 if !ok { 13279 return fmt.Errorf("unexpected JSON type %v", value) 13280 } 13281 13282 var sv *types.Button 13283 if *v == nil { 13284 sv = &types.Button{} 13285 } else { 13286 sv = *v 13287 } 13288 13289 for key, value := range shape { 13290 switch key { 13291 case "text": 13292 if value != nil { 13293 jtv, ok := value.(string) 13294 if !ok { 13295 return fmt.Errorf("expected ButtonText to be of type string, got %T instead", value) 13296 } 13297 sv.Text = ptr.String(jtv) 13298 } 13299 13300 case "value": 13301 if value != nil { 13302 jtv, ok := value.(string) 13303 if !ok { 13304 return fmt.Errorf("expected ButtonValue to be of type string, got %T instead", value) 13305 } 13306 sv.Value = ptr.String(jtv) 13307 } 13308 13309 default: 13310 _, _ = key, value 13311 13312 } 13313 } 13314 *v = sv 13315 return nil 13316} 13317 13318func awsRestjson1_deserializeDocumentButtonsList(v *[]types.Button, value interface{}) error { 13319 if v == nil { 13320 return fmt.Errorf("unexpected nil of type %T", v) 13321 } 13322 if value == nil { 13323 return nil 13324 } 13325 13326 shape, ok := value.([]interface{}) 13327 if !ok { 13328 return fmt.Errorf("unexpected JSON type %v", value) 13329 } 13330 13331 var cv []types.Button 13332 if *v == nil { 13333 cv = []types.Button{} 13334 } else { 13335 cv = *v 13336 } 13337 13338 for _, value := range shape { 13339 var col types.Button 13340 destAddr := &col 13341 if err := awsRestjson1_deserializeDocumentButton(&destAddr, value); err != nil { 13342 return err 13343 } 13344 col = *destAddr 13345 cv = append(cv, col) 13346 13347 } 13348 *v = cv 13349 return nil 13350} 13351 13352func awsRestjson1_deserializeDocumentCloudWatchLogGroupLogDestination(v **types.CloudWatchLogGroupLogDestination, value interface{}) error { 13353 if v == nil { 13354 return fmt.Errorf("unexpected nil of type %T", v) 13355 } 13356 if value == nil { 13357 return nil 13358 } 13359 13360 shape, ok := value.(map[string]interface{}) 13361 if !ok { 13362 return fmt.Errorf("unexpected JSON type %v", value) 13363 } 13364 13365 var sv *types.CloudWatchLogGroupLogDestination 13366 if *v == nil { 13367 sv = &types.CloudWatchLogGroupLogDestination{} 13368 } else { 13369 sv = *v 13370 } 13371 13372 for key, value := range shape { 13373 switch key { 13374 case "cloudWatchLogGroupArn": 13375 if value != nil { 13376 jtv, ok := value.(string) 13377 if !ok { 13378 return fmt.Errorf("expected CloudWatchLogGroupArn to be of type string, got %T instead", value) 13379 } 13380 sv.CloudWatchLogGroupArn = ptr.String(jtv) 13381 } 13382 13383 case "logPrefix": 13384 if value != nil { 13385 jtv, ok := value.(string) 13386 if !ok { 13387 return fmt.Errorf("expected LogPrefix to be of type string, got %T instead", value) 13388 } 13389 sv.LogPrefix = ptr.String(jtv) 13390 } 13391 13392 default: 13393 _, _ = key, value 13394 13395 } 13396 } 13397 *v = sv 13398 return nil 13399} 13400 13401func awsRestjson1_deserializeDocumentCodeHookSpecification(v **types.CodeHookSpecification, value interface{}) error { 13402 if v == nil { 13403 return fmt.Errorf("unexpected nil of type %T", v) 13404 } 13405 if value == nil { 13406 return nil 13407 } 13408 13409 shape, ok := value.(map[string]interface{}) 13410 if !ok { 13411 return fmt.Errorf("unexpected JSON type %v", value) 13412 } 13413 13414 var sv *types.CodeHookSpecification 13415 if *v == nil { 13416 sv = &types.CodeHookSpecification{} 13417 } else { 13418 sv = *v 13419 } 13420 13421 for key, value := range shape { 13422 switch key { 13423 case "lambdaCodeHook": 13424 if err := awsRestjson1_deserializeDocumentLambdaCodeHook(&sv.LambdaCodeHook, value); err != nil { 13425 return err 13426 } 13427 13428 default: 13429 _, _ = key, value 13430 13431 } 13432 } 13433 *v = sv 13434 return nil 13435} 13436 13437func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 13438 if v == nil { 13439 return fmt.Errorf("unexpected nil of type %T", v) 13440 } 13441 if value == nil { 13442 return nil 13443 } 13444 13445 shape, ok := value.(map[string]interface{}) 13446 if !ok { 13447 return fmt.Errorf("unexpected JSON type %v", value) 13448 } 13449 13450 var sv *types.ConflictException 13451 if *v == nil { 13452 sv = &types.ConflictException{} 13453 } else { 13454 sv = *v 13455 } 13456 13457 for key, value := range shape { 13458 switch key { 13459 case "message": 13460 if value != nil { 13461 jtv, ok := value.(string) 13462 if !ok { 13463 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 13464 } 13465 sv.Message = ptr.String(jtv) 13466 } 13467 13468 default: 13469 _, _ = key, value 13470 13471 } 13472 } 13473 *v = sv 13474 return nil 13475} 13476 13477func awsRestjson1_deserializeDocumentConversationLogSettings(v **types.ConversationLogSettings, value interface{}) error { 13478 if v == nil { 13479 return fmt.Errorf("unexpected nil of type %T", v) 13480 } 13481 if value == nil { 13482 return nil 13483 } 13484 13485 shape, ok := value.(map[string]interface{}) 13486 if !ok { 13487 return fmt.Errorf("unexpected JSON type %v", value) 13488 } 13489 13490 var sv *types.ConversationLogSettings 13491 if *v == nil { 13492 sv = &types.ConversationLogSettings{} 13493 } else { 13494 sv = *v 13495 } 13496 13497 for key, value := range shape { 13498 switch key { 13499 case "audioLogSettings": 13500 if err := awsRestjson1_deserializeDocumentAudioLogSettingsList(&sv.AudioLogSettings, value); err != nil { 13501 return err 13502 } 13503 13504 case "textLogSettings": 13505 if err := awsRestjson1_deserializeDocumentTextLogSettingsList(&sv.TextLogSettings, value); err != nil { 13506 return err 13507 } 13508 13509 default: 13510 _, _ = key, value 13511 13512 } 13513 } 13514 *v = sv 13515 return nil 13516} 13517 13518func awsRestjson1_deserializeDocumentCustomPayload(v **types.CustomPayload, value interface{}) error { 13519 if v == nil { 13520 return fmt.Errorf("unexpected nil of type %T", v) 13521 } 13522 if value == nil { 13523 return nil 13524 } 13525 13526 shape, ok := value.(map[string]interface{}) 13527 if !ok { 13528 return fmt.Errorf("unexpected JSON type %v", value) 13529 } 13530 13531 var sv *types.CustomPayload 13532 if *v == nil { 13533 sv = &types.CustomPayload{} 13534 } else { 13535 sv = *v 13536 } 13537 13538 for key, value := range shape { 13539 switch key { 13540 case "value": 13541 if value != nil { 13542 jtv, ok := value.(string) 13543 if !ok { 13544 return fmt.Errorf("expected CustomPayloadValue to be of type string, got %T instead", value) 13545 } 13546 sv.Value = ptr.String(jtv) 13547 } 13548 13549 default: 13550 _, _ = key, value 13551 13552 } 13553 } 13554 *v = sv 13555 return nil 13556} 13557 13558func awsRestjson1_deserializeDocumentDataPrivacy(v **types.DataPrivacy, value interface{}) error { 13559 if v == nil { 13560 return fmt.Errorf("unexpected nil of type %T", v) 13561 } 13562 if value == nil { 13563 return nil 13564 } 13565 13566 shape, ok := value.(map[string]interface{}) 13567 if !ok { 13568 return fmt.Errorf("unexpected JSON type %v", value) 13569 } 13570 13571 var sv *types.DataPrivacy 13572 if *v == nil { 13573 sv = &types.DataPrivacy{} 13574 } else { 13575 sv = *v 13576 } 13577 13578 for key, value := range shape { 13579 switch key { 13580 case "childDirected": 13581 if value != nil { 13582 jtv, ok := value.(bool) 13583 if !ok { 13584 return fmt.Errorf("expected ChildDirected to be of type *bool, got %T instead", value) 13585 } 13586 sv.ChildDirected = jtv 13587 } 13588 13589 default: 13590 _, _ = key, value 13591 13592 } 13593 } 13594 *v = sv 13595 return nil 13596} 13597 13598func awsRestjson1_deserializeDocumentDialogCodeHookSettings(v **types.DialogCodeHookSettings, value interface{}) error { 13599 if v == nil { 13600 return fmt.Errorf("unexpected nil of type %T", v) 13601 } 13602 if value == nil { 13603 return nil 13604 } 13605 13606 shape, ok := value.(map[string]interface{}) 13607 if !ok { 13608 return fmt.Errorf("unexpected JSON type %v", value) 13609 } 13610 13611 var sv *types.DialogCodeHookSettings 13612 if *v == nil { 13613 sv = &types.DialogCodeHookSettings{} 13614 } else { 13615 sv = *v 13616 } 13617 13618 for key, value := range shape { 13619 switch key { 13620 case "enabled": 13621 if value != nil { 13622 jtv, ok := value.(bool) 13623 if !ok { 13624 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 13625 } 13626 sv.Enabled = jtv 13627 } 13628 13629 default: 13630 _, _ = key, value 13631 13632 } 13633 } 13634 *v = sv 13635 return nil 13636} 13637 13638func awsRestjson1_deserializeDocumentExportResourceSpecification(v **types.ExportResourceSpecification, value interface{}) error { 13639 if v == nil { 13640 return fmt.Errorf("unexpected nil of type %T", v) 13641 } 13642 if value == nil { 13643 return nil 13644 } 13645 13646 shape, ok := value.(map[string]interface{}) 13647 if !ok { 13648 return fmt.Errorf("unexpected JSON type %v", value) 13649 } 13650 13651 var sv *types.ExportResourceSpecification 13652 if *v == nil { 13653 sv = &types.ExportResourceSpecification{} 13654 } else { 13655 sv = *v 13656 } 13657 13658 for key, value := range shape { 13659 switch key { 13660 case "botExportSpecification": 13661 if err := awsRestjson1_deserializeDocumentBotExportSpecification(&sv.BotExportSpecification, value); err != nil { 13662 return err 13663 } 13664 13665 case "botLocaleExportSpecification": 13666 if err := awsRestjson1_deserializeDocumentBotLocaleExportSpecification(&sv.BotLocaleExportSpecification, value); err != nil { 13667 return err 13668 } 13669 13670 default: 13671 _, _ = key, value 13672 13673 } 13674 } 13675 *v = sv 13676 return nil 13677} 13678 13679func awsRestjson1_deserializeDocumentExportSummary(v **types.ExportSummary, value interface{}) error { 13680 if v == nil { 13681 return fmt.Errorf("unexpected nil of type %T", v) 13682 } 13683 if value == nil { 13684 return nil 13685 } 13686 13687 shape, ok := value.(map[string]interface{}) 13688 if !ok { 13689 return fmt.Errorf("unexpected JSON type %v", value) 13690 } 13691 13692 var sv *types.ExportSummary 13693 if *v == nil { 13694 sv = &types.ExportSummary{} 13695 } else { 13696 sv = *v 13697 } 13698 13699 for key, value := range shape { 13700 switch key { 13701 case "creationDateTime": 13702 if value != nil { 13703 switch jtv := value.(type) { 13704 case json.Number: 13705 f64, err := jtv.Float64() 13706 if err != nil { 13707 return err 13708 } 13709 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13710 13711 default: 13712 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 13713 13714 } 13715 } 13716 13717 case "exportId": 13718 if value != nil { 13719 jtv, ok := value.(string) 13720 if !ok { 13721 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 13722 } 13723 sv.ExportId = ptr.String(jtv) 13724 } 13725 13726 case "exportStatus": 13727 if value != nil { 13728 jtv, ok := value.(string) 13729 if !ok { 13730 return fmt.Errorf("expected ExportStatus to be of type string, got %T instead", value) 13731 } 13732 sv.ExportStatus = types.ExportStatus(jtv) 13733 } 13734 13735 case "fileFormat": 13736 if value != nil { 13737 jtv, ok := value.(string) 13738 if !ok { 13739 return fmt.Errorf("expected ImportExportFileFormat to be of type string, got %T instead", value) 13740 } 13741 sv.FileFormat = types.ImportExportFileFormat(jtv) 13742 } 13743 13744 case "lastUpdatedDateTime": 13745 if value != nil { 13746 switch jtv := value.(type) { 13747 case json.Number: 13748 f64, err := jtv.Float64() 13749 if err != nil { 13750 return err 13751 } 13752 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 13753 13754 default: 13755 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 13756 13757 } 13758 } 13759 13760 case "resourceSpecification": 13761 if err := awsRestjson1_deserializeDocumentExportResourceSpecification(&sv.ResourceSpecification, value); err != nil { 13762 return err 13763 } 13764 13765 default: 13766 _, _ = key, value 13767 13768 } 13769 } 13770 *v = sv 13771 return nil 13772} 13773 13774func awsRestjson1_deserializeDocumentExportSummaryList(v *[]types.ExportSummary, value interface{}) error { 13775 if v == nil { 13776 return fmt.Errorf("unexpected nil of type %T", v) 13777 } 13778 if value == nil { 13779 return nil 13780 } 13781 13782 shape, ok := value.([]interface{}) 13783 if !ok { 13784 return fmt.Errorf("unexpected JSON type %v", value) 13785 } 13786 13787 var cv []types.ExportSummary 13788 if *v == nil { 13789 cv = []types.ExportSummary{} 13790 } else { 13791 cv = *v 13792 } 13793 13794 for _, value := range shape { 13795 var col types.ExportSummary 13796 destAddr := &col 13797 if err := awsRestjson1_deserializeDocumentExportSummary(&destAddr, value); err != nil { 13798 return err 13799 } 13800 col = *destAddr 13801 cv = append(cv, col) 13802 13803 } 13804 *v = cv 13805 return nil 13806} 13807 13808func awsRestjson1_deserializeDocumentFailureReasons(v *[]string, value interface{}) error { 13809 if v == nil { 13810 return fmt.Errorf("unexpected nil of type %T", v) 13811 } 13812 if value == nil { 13813 return nil 13814 } 13815 13816 shape, ok := value.([]interface{}) 13817 if !ok { 13818 return fmt.Errorf("unexpected JSON type %v", value) 13819 } 13820 13821 var cv []string 13822 if *v == nil { 13823 cv = []string{} 13824 } else { 13825 cv = *v 13826 } 13827 13828 for _, value := range shape { 13829 var col string 13830 if value != nil { 13831 jtv, ok := value.(string) 13832 if !ok { 13833 return fmt.Errorf("expected FailureReason to be of type string, got %T instead", value) 13834 } 13835 col = jtv 13836 } 13837 cv = append(cv, col) 13838 13839 } 13840 *v = cv 13841 return nil 13842} 13843 13844func awsRestjson1_deserializeDocumentFulfillmentCodeHookSettings(v **types.FulfillmentCodeHookSettings, value interface{}) error { 13845 if v == nil { 13846 return fmt.Errorf("unexpected nil of type %T", v) 13847 } 13848 if value == nil { 13849 return nil 13850 } 13851 13852 shape, ok := value.(map[string]interface{}) 13853 if !ok { 13854 return fmt.Errorf("unexpected JSON type %v", value) 13855 } 13856 13857 var sv *types.FulfillmentCodeHookSettings 13858 if *v == nil { 13859 sv = &types.FulfillmentCodeHookSettings{} 13860 } else { 13861 sv = *v 13862 } 13863 13864 for key, value := range shape { 13865 switch key { 13866 case "enabled": 13867 if value != nil { 13868 jtv, ok := value.(bool) 13869 if !ok { 13870 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 13871 } 13872 sv.Enabled = jtv 13873 } 13874 13875 default: 13876 _, _ = key, value 13877 13878 } 13879 } 13880 *v = sv 13881 return nil 13882} 13883 13884func awsRestjson1_deserializeDocumentImageResponseCard(v **types.ImageResponseCard, value interface{}) error { 13885 if v == nil { 13886 return fmt.Errorf("unexpected nil of type %T", v) 13887 } 13888 if value == nil { 13889 return nil 13890 } 13891 13892 shape, ok := value.(map[string]interface{}) 13893 if !ok { 13894 return fmt.Errorf("unexpected JSON type %v", value) 13895 } 13896 13897 var sv *types.ImageResponseCard 13898 if *v == nil { 13899 sv = &types.ImageResponseCard{} 13900 } else { 13901 sv = *v 13902 } 13903 13904 for key, value := range shape { 13905 switch key { 13906 case "buttons": 13907 if err := awsRestjson1_deserializeDocumentButtonsList(&sv.Buttons, value); err != nil { 13908 return err 13909 } 13910 13911 case "imageUrl": 13912 if value != nil { 13913 jtv, ok := value.(string) 13914 if !ok { 13915 return fmt.Errorf("expected AttachmentUrl to be of type string, got %T instead", value) 13916 } 13917 sv.ImageUrl = ptr.String(jtv) 13918 } 13919 13920 case "subtitle": 13921 if value != nil { 13922 jtv, ok := value.(string) 13923 if !ok { 13924 return fmt.Errorf("expected AttachmentTitle to be of type string, got %T instead", value) 13925 } 13926 sv.Subtitle = ptr.String(jtv) 13927 } 13928 13929 case "title": 13930 if value != nil { 13931 jtv, ok := value.(string) 13932 if !ok { 13933 return fmt.Errorf("expected AttachmentTitle to be of type string, got %T instead", value) 13934 } 13935 sv.Title = ptr.String(jtv) 13936 } 13937 13938 default: 13939 _, _ = key, value 13940 13941 } 13942 } 13943 *v = sv 13944 return nil 13945} 13946 13947func awsRestjson1_deserializeDocumentImportResourceSpecification(v **types.ImportResourceSpecification, value interface{}) error { 13948 if v == nil { 13949 return fmt.Errorf("unexpected nil of type %T", v) 13950 } 13951 if value == nil { 13952 return nil 13953 } 13954 13955 shape, ok := value.(map[string]interface{}) 13956 if !ok { 13957 return fmt.Errorf("unexpected JSON type %v", value) 13958 } 13959 13960 var sv *types.ImportResourceSpecification 13961 if *v == nil { 13962 sv = &types.ImportResourceSpecification{} 13963 } else { 13964 sv = *v 13965 } 13966 13967 for key, value := range shape { 13968 switch key { 13969 case "botImportSpecification": 13970 if err := awsRestjson1_deserializeDocumentBotImportSpecification(&sv.BotImportSpecification, value); err != nil { 13971 return err 13972 } 13973 13974 case "botLocaleImportSpecification": 13975 if err := awsRestjson1_deserializeDocumentBotLocaleImportSpecification(&sv.BotLocaleImportSpecification, value); err != nil { 13976 return err 13977 } 13978 13979 default: 13980 _, _ = key, value 13981 13982 } 13983 } 13984 *v = sv 13985 return nil 13986} 13987 13988func awsRestjson1_deserializeDocumentImportSummary(v **types.ImportSummary, value interface{}) error { 13989 if v == nil { 13990 return fmt.Errorf("unexpected nil of type %T", v) 13991 } 13992 if value == nil { 13993 return nil 13994 } 13995 13996 shape, ok := value.(map[string]interface{}) 13997 if !ok { 13998 return fmt.Errorf("unexpected JSON type %v", value) 13999 } 14000 14001 var sv *types.ImportSummary 14002 if *v == nil { 14003 sv = &types.ImportSummary{} 14004 } else { 14005 sv = *v 14006 } 14007 14008 for key, value := range shape { 14009 switch key { 14010 case "creationDateTime": 14011 if value != nil { 14012 switch jtv := value.(type) { 14013 case json.Number: 14014 f64, err := jtv.Float64() 14015 if err != nil { 14016 return err 14017 } 14018 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14019 14020 default: 14021 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 14022 14023 } 14024 } 14025 14026 case "importedResourceId": 14027 if value != nil { 14028 jtv, ok := value.(string) 14029 if !ok { 14030 return fmt.Errorf("expected ImportedResourceId to be of type string, got %T instead", value) 14031 } 14032 sv.ImportedResourceId = ptr.String(jtv) 14033 } 14034 14035 case "importedResourceName": 14036 if value != nil { 14037 jtv, ok := value.(string) 14038 if !ok { 14039 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 14040 } 14041 sv.ImportedResourceName = ptr.String(jtv) 14042 } 14043 14044 case "importId": 14045 if value != nil { 14046 jtv, ok := value.(string) 14047 if !ok { 14048 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14049 } 14050 sv.ImportId = ptr.String(jtv) 14051 } 14052 14053 case "importStatus": 14054 if value != nil { 14055 jtv, ok := value.(string) 14056 if !ok { 14057 return fmt.Errorf("expected ImportStatus to be of type string, got %T instead", value) 14058 } 14059 sv.ImportStatus = types.ImportStatus(jtv) 14060 } 14061 14062 case "lastUpdatedDateTime": 14063 if value != nil { 14064 switch jtv := value.(type) { 14065 case json.Number: 14066 f64, err := jtv.Float64() 14067 if err != nil { 14068 return err 14069 } 14070 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14071 14072 default: 14073 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 14074 14075 } 14076 } 14077 14078 case "mergeStrategy": 14079 if value != nil { 14080 jtv, ok := value.(string) 14081 if !ok { 14082 return fmt.Errorf("expected MergeStrategy to be of type string, got %T instead", value) 14083 } 14084 sv.MergeStrategy = types.MergeStrategy(jtv) 14085 } 14086 14087 default: 14088 _, _ = key, value 14089 14090 } 14091 } 14092 *v = sv 14093 return nil 14094} 14095 14096func awsRestjson1_deserializeDocumentImportSummaryList(v *[]types.ImportSummary, value interface{}) error { 14097 if v == nil { 14098 return fmt.Errorf("unexpected nil of type %T", v) 14099 } 14100 if value == nil { 14101 return nil 14102 } 14103 14104 shape, ok := value.([]interface{}) 14105 if !ok { 14106 return fmt.Errorf("unexpected JSON type %v", value) 14107 } 14108 14109 var cv []types.ImportSummary 14110 if *v == nil { 14111 cv = []types.ImportSummary{} 14112 } else { 14113 cv = *v 14114 } 14115 14116 for _, value := range shape { 14117 var col types.ImportSummary 14118 destAddr := &col 14119 if err := awsRestjson1_deserializeDocumentImportSummary(&destAddr, value); err != nil { 14120 return err 14121 } 14122 col = *destAddr 14123 cv = append(cv, col) 14124 14125 } 14126 *v = cv 14127 return nil 14128} 14129 14130func awsRestjson1_deserializeDocumentInputContext(v **types.InputContext, value interface{}) error { 14131 if v == nil { 14132 return fmt.Errorf("unexpected nil of type %T", v) 14133 } 14134 if value == nil { 14135 return nil 14136 } 14137 14138 shape, ok := value.(map[string]interface{}) 14139 if !ok { 14140 return fmt.Errorf("unexpected JSON type %v", value) 14141 } 14142 14143 var sv *types.InputContext 14144 if *v == nil { 14145 sv = &types.InputContext{} 14146 } else { 14147 sv = *v 14148 } 14149 14150 for key, value := range shape { 14151 switch key { 14152 case "name": 14153 if value != nil { 14154 jtv, ok := value.(string) 14155 if !ok { 14156 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 14157 } 14158 sv.Name = ptr.String(jtv) 14159 } 14160 14161 default: 14162 _, _ = key, value 14163 14164 } 14165 } 14166 *v = sv 14167 return nil 14168} 14169 14170func awsRestjson1_deserializeDocumentInputContextsList(v *[]types.InputContext, value interface{}) error { 14171 if v == nil { 14172 return fmt.Errorf("unexpected nil of type %T", v) 14173 } 14174 if value == nil { 14175 return nil 14176 } 14177 14178 shape, ok := value.([]interface{}) 14179 if !ok { 14180 return fmt.Errorf("unexpected JSON type %v", value) 14181 } 14182 14183 var cv []types.InputContext 14184 if *v == nil { 14185 cv = []types.InputContext{} 14186 } else { 14187 cv = *v 14188 } 14189 14190 for _, value := range shape { 14191 var col types.InputContext 14192 destAddr := &col 14193 if err := awsRestjson1_deserializeDocumentInputContext(&destAddr, value); err != nil { 14194 return err 14195 } 14196 col = *destAddr 14197 cv = append(cv, col) 14198 14199 } 14200 *v = cv 14201 return nil 14202} 14203 14204func awsRestjson1_deserializeDocumentIntentClosingSetting(v **types.IntentClosingSetting, value interface{}) error { 14205 if v == nil { 14206 return fmt.Errorf("unexpected nil of type %T", v) 14207 } 14208 if value == nil { 14209 return nil 14210 } 14211 14212 shape, ok := value.(map[string]interface{}) 14213 if !ok { 14214 return fmt.Errorf("unexpected JSON type %v", value) 14215 } 14216 14217 var sv *types.IntentClosingSetting 14218 if *v == nil { 14219 sv = &types.IntentClosingSetting{} 14220 } else { 14221 sv = *v 14222 } 14223 14224 for key, value := range shape { 14225 switch key { 14226 case "active": 14227 if value != nil { 14228 jtv, ok := value.(bool) 14229 if !ok { 14230 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 14231 } 14232 sv.Active = ptr.Bool(jtv) 14233 } 14234 14235 case "closingResponse": 14236 if err := awsRestjson1_deserializeDocumentResponseSpecification(&sv.ClosingResponse, value); err != nil { 14237 return err 14238 } 14239 14240 default: 14241 _, _ = key, value 14242 14243 } 14244 } 14245 *v = sv 14246 return nil 14247} 14248 14249func awsRestjson1_deserializeDocumentIntentConfirmationSetting(v **types.IntentConfirmationSetting, value interface{}) error { 14250 if v == nil { 14251 return fmt.Errorf("unexpected nil of type %T", v) 14252 } 14253 if value == nil { 14254 return nil 14255 } 14256 14257 shape, ok := value.(map[string]interface{}) 14258 if !ok { 14259 return fmt.Errorf("unexpected JSON type %v", value) 14260 } 14261 14262 var sv *types.IntentConfirmationSetting 14263 if *v == nil { 14264 sv = &types.IntentConfirmationSetting{} 14265 } else { 14266 sv = *v 14267 } 14268 14269 for key, value := range shape { 14270 switch key { 14271 case "active": 14272 if value != nil { 14273 jtv, ok := value.(bool) 14274 if !ok { 14275 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 14276 } 14277 sv.Active = ptr.Bool(jtv) 14278 } 14279 14280 case "declinationResponse": 14281 if err := awsRestjson1_deserializeDocumentResponseSpecification(&sv.DeclinationResponse, value); err != nil { 14282 return err 14283 } 14284 14285 case "promptSpecification": 14286 if err := awsRestjson1_deserializeDocumentPromptSpecification(&sv.PromptSpecification, value); err != nil { 14287 return err 14288 } 14289 14290 default: 14291 _, _ = key, value 14292 14293 } 14294 } 14295 *v = sv 14296 return nil 14297} 14298 14299func awsRestjson1_deserializeDocumentIntentSummary(v **types.IntentSummary, value interface{}) error { 14300 if v == nil { 14301 return fmt.Errorf("unexpected nil of type %T", v) 14302 } 14303 if value == nil { 14304 return nil 14305 } 14306 14307 shape, ok := value.(map[string]interface{}) 14308 if !ok { 14309 return fmt.Errorf("unexpected JSON type %v", value) 14310 } 14311 14312 var sv *types.IntentSummary 14313 if *v == nil { 14314 sv = &types.IntentSummary{} 14315 } else { 14316 sv = *v 14317 } 14318 14319 for key, value := range shape { 14320 switch key { 14321 case "description": 14322 if value != nil { 14323 jtv, ok := value.(string) 14324 if !ok { 14325 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 14326 } 14327 sv.Description = ptr.String(jtv) 14328 } 14329 14330 case "inputContexts": 14331 if err := awsRestjson1_deserializeDocumentInputContextsList(&sv.InputContexts, value); err != nil { 14332 return err 14333 } 14334 14335 case "intentId": 14336 if value != nil { 14337 jtv, ok := value.(string) 14338 if !ok { 14339 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 14340 } 14341 sv.IntentId = ptr.String(jtv) 14342 } 14343 14344 case "intentName": 14345 if value != nil { 14346 jtv, ok := value.(string) 14347 if !ok { 14348 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 14349 } 14350 sv.IntentName = ptr.String(jtv) 14351 } 14352 14353 case "lastUpdatedDateTime": 14354 if value != nil { 14355 switch jtv := value.(type) { 14356 case json.Number: 14357 f64, err := jtv.Float64() 14358 if err != nil { 14359 return err 14360 } 14361 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 14362 14363 default: 14364 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 14365 14366 } 14367 } 14368 14369 case "outputContexts": 14370 if err := awsRestjson1_deserializeDocumentOutputContextsList(&sv.OutputContexts, value); err != nil { 14371 return err 14372 } 14373 14374 case "parentIntentSignature": 14375 if value != nil { 14376 jtv, ok := value.(string) 14377 if !ok { 14378 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 14379 } 14380 sv.ParentIntentSignature = ptr.String(jtv) 14381 } 14382 14383 default: 14384 _, _ = key, value 14385 14386 } 14387 } 14388 *v = sv 14389 return nil 14390} 14391 14392func awsRestjson1_deserializeDocumentIntentSummaryList(v *[]types.IntentSummary, value interface{}) error { 14393 if v == nil { 14394 return fmt.Errorf("unexpected nil of type %T", v) 14395 } 14396 if value == nil { 14397 return nil 14398 } 14399 14400 shape, ok := value.([]interface{}) 14401 if !ok { 14402 return fmt.Errorf("unexpected JSON type %v", value) 14403 } 14404 14405 var cv []types.IntentSummary 14406 if *v == nil { 14407 cv = []types.IntentSummary{} 14408 } else { 14409 cv = *v 14410 } 14411 14412 for _, value := range shape { 14413 var col types.IntentSummary 14414 destAddr := &col 14415 if err := awsRestjson1_deserializeDocumentIntentSummary(&destAddr, value); err != nil { 14416 return err 14417 } 14418 col = *destAddr 14419 cv = append(cv, col) 14420 14421 } 14422 *v = cv 14423 return nil 14424} 14425 14426func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { 14427 if v == nil { 14428 return fmt.Errorf("unexpected nil of type %T", v) 14429 } 14430 if value == nil { 14431 return nil 14432 } 14433 14434 shape, ok := value.(map[string]interface{}) 14435 if !ok { 14436 return fmt.Errorf("unexpected JSON type %v", value) 14437 } 14438 14439 var sv *types.InternalServerException 14440 if *v == nil { 14441 sv = &types.InternalServerException{} 14442 } else { 14443 sv = *v 14444 } 14445 14446 for key, value := range shape { 14447 switch key { 14448 case "message": 14449 if value != nil { 14450 jtv, ok := value.(string) 14451 if !ok { 14452 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 14453 } 14454 sv.Message = ptr.String(jtv) 14455 } 14456 14457 default: 14458 _, _ = key, value 14459 14460 } 14461 } 14462 *v = sv 14463 return nil 14464} 14465 14466func awsRestjson1_deserializeDocumentKendraConfiguration(v **types.KendraConfiguration, value interface{}) error { 14467 if v == nil { 14468 return fmt.Errorf("unexpected nil of type %T", v) 14469 } 14470 if value == nil { 14471 return nil 14472 } 14473 14474 shape, ok := value.(map[string]interface{}) 14475 if !ok { 14476 return fmt.Errorf("unexpected JSON type %v", value) 14477 } 14478 14479 var sv *types.KendraConfiguration 14480 if *v == nil { 14481 sv = &types.KendraConfiguration{} 14482 } else { 14483 sv = *v 14484 } 14485 14486 for key, value := range shape { 14487 switch key { 14488 case "kendraIndex": 14489 if value != nil { 14490 jtv, ok := value.(string) 14491 if !ok { 14492 return fmt.Errorf("expected KendraIndexArn to be of type string, got %T instead", value) 14493 } 14494 sv.KendraIndex = ptr.String(jtv) 14495 } 14496 14497 case "queryFilterString": 14498 if value != nil { 14499 jtv, ok := value.(string) 14500 if !ok { 14501 return fmt.Errorf("expected QueryFilterString to be of type string, got %T instead", value) 14502 } 14503 sv.QueryFilterString = ptr.String(jtv) 14504 } 14505 14506 case "queryFilterStringEnabled": 14507 if value != nil { 14508 jtv, ok := value.(bool) 14509 if !ok { 14510 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 14511 } 14512 sv.QueryFilterStringEnabled = jtv 14513 } 14514 14515 default: 14516 _, _ = key, value 14517 14518 } 14519 } 14520 *v = sv 14521 return nil 14522} 14523 14524func awsRestjson1_deserializeDocumentLambdaCodeHook(v **types.LambdaCodeHook, value interface{}) error { 14525 if v == nil { 14526 return fmt.Errorf("unexpected nil of type %T", v) 14527 } 14528 if value == nil { 14529 return nil 14530 } 14531 14532 shape, ok := value.(map[string]interface{}) 14533 if !ok { 14534 return fmt.Errorf("unexpected JSON type %v", value) 14535 } 14536 14537 var sv *types.LambdaCodeHook 14538 if *v == nil { 14539 sv = &types.LambdaCodeHook{} 14540 } else { 14541 sv = *v 14542 } 14543 14544 for key, value := range shape { 14545 switch key { 14546 case "codeHookInterfaceVersion": 14547 if value != nil { 14548 jtv, ok := value.(string) 14549 if !ok { 14550 return fmt.Errorf("expected CodeHookInterfaceVersion to be of type string, got %T instead", value) 14551 } 14552 sv.CodeHookInterfaceVersion = ptr.String(jtv) 14553 } 14554 14555 case "lambdaARN": 14556 if value != nil { 14557 jtv, ok := value.(string) 14558 if !ok { 14559 return fmt.Errorf("expected LambdaARN to be of type string, got %T instead", value) 14560 } 14561 sv.LambdaARN = ptr.String(jtv) 14562 } 14563 14564 default: 14565 _, _ = key, value 14566 14567 } 14568 } 14569 *v = sv 14570 return nil 14571} 14572 14573func awsRestjson1_deserializeDocumentMessage(v **types.Message, value interface{}) error { 14574 if v == nil { 14575 return fmt.Errorf("unexpected nil of type %T", v) 14576 } 14577 if value == nil { 14578 return nil 14579 } 14580 14581 shape, ok := value.(map[string]interface{}) 14582 if !ok { 14583 return fmt.Errorf("unexpected JSON type %v", value) 14584 } 14585 14586 var sv *types.Message 14587 if *v == nil { 14588 sv = &types.Message{} 14589 } else { 14590 sv = *v 14591 } 14592 14593 for key, value := range shape { 14594 switch key { 14595 case "customPayload": 14596 if err := awsRestjson1_deserializeDocumentCustomPayload(&sv.CustomPayload, value); err != nil { 14597 return err 14598 } 14599 14600 case "imageResponseCard": 14601 if err := awsRestjson1_deserializeDocumentImageResponseCard(&sv.ImageResponseCard, value); err != nil { 14602 return err 14603 } 14604 14605 case "plainTextMessage": 14606 if err := awsRestjson1_deserializeDocumentPlainTextMessage(&sv.PlainTextMessage, value); err != nil { 14607 return err 14608 } 14609 14610 case "ssmlMessage": 14611 if err := awsRestjson1_deserializeDocumentSSMLMessage(&sv.SsmlMessage, value); err != nil { 14612 return err 14613 } 14614 14615 default: 14616 _, _ = key, value 14617 14618 } 14619 } 14620 *v = sv 14621 return nil 14622} 14623 14624func awsRestjson1_deserializeDocumentMessageGroup(v **types.MessageGroup, value interface{}) error { 14625 if v == nil { 14626 return fmt.Errorf("unexpected nil of type %T", v) 14627 } 14628 if value == nil { 14629 return nil 14630 } 14631 14632 shape, ok := value.(map[string]interface{}) 14633 if !ok { 14634 return fmt.Errorf("unexpected JSON type %v", value) 14635 } 14636 14637 var sv *types.MessageGroup 14638 if *v == nil { 14639 sv = &types.MessageGroup{} 14640 } else { 14641 sv = *v 14642 } 14643 14644 for key, value := range shape { 14645 switch key { 14646 case "message": 14647 if err := awsRestjson1_deserializeDocumentMessage(&sv.Message, value); err != nil { 14648 return err 14649 } 14650 14651 case "variations": 14652 if err := awsRestjson1_deserializeDocumentMessageVariationsList(&sv.Variations, value); err != nil { 14653 return err 14654 } 14655 14656 default: 14657 _, _ = key, value 14658 14659 } 14660 } 14661 *v = sv 14662 return nil 14663} 14664 14665func awsRestjson1_deserializeDocumentMessageGroupsList(v *[]types.MessageGroup, value interface{}) error { 14666 if v == nil { 14667 return fmt.Errorf("unexpected nil of type %T", v) 14668 } 14669 if value == nil { 14670 return nil 14671 } 14672 14673 shape, ok := value.([]interface{}) 14674 if !ok { 14675 return fmt.Errorf("unexpected JSON type %v", value) 14676 } 14677 14678 var cv []types.MessageGroup 14679 if *v == nil { 14680 cv = []types.MessageGroup{} 14681 } else { 14682 cv = *v 14683 } 14684 14685 for _, value := range shape { 14686 var col types.MessageGroup 14687 destAddr := &col 14688 if err := awsRestjson1_deserializeDocumentMessageGroup(&destAddr, value); err != nil { 14689 return err 14690 } 14691 col = *destAddr 14692 cv = append(cv, col) 14693 14694 } 14695 *v = cv 14696 return nil 14697} 14698 14699func awsRestjson1_deserializeDocumentMessageVariationsList(v *[]types.Message, value interface{}) error { 14700 if v == nil { 14701 return fmt.Errorf("unexpected nil of type %T", v) 14702 } 14703 if value == nil { 14704 return nil 14705 } 14706 14707 shape, ok := value.([]interface{}) 14708 if !ok { 14709 return fmt.Errorf("unexpected JSON type %v", value) 14710 } 14711 14712 var cv []types.Message 14713 if *v == nil { 14714 cv = []types.Message{} 14715 } else { 14716 cv = *v 14717 } 14718 14719 for _, value := range shape { 14720 var col types.Message 14721 destAddr := &col 14722 if err := awsRestjson1_deserializeDocumentMessage(&destAddr, value); err != nil { 14723 return err 14724 } 14725 col = *destAddr 14726 cv = append(cv, col) 14727 14728 } 14729 *v = cv 14730 return nil 14731} 14732 14733func awsRestjson1_deserializeDocumentMultipleValuesSetting(v **types.MultipleValuesSetting, value interface{}) error { 14734 if v == nil { 14735 return fmt.Errorf("unexpected nil of type %T", v) 14736 } 14737 if value == nil { 14738 return nil 14739 } 14740 14741 shape, ok := value.(map[string]interface{}) 14742 if !ok { 14743 return fmt.Errorf("unexpected JSON type %v", value) 14744 } 14745 14746 var sv *types.MultipleValuesSetting 14747 if *v == nil { 14748 sv = &types.MultipleValuesSetting{} 14749 } else { 14750 sv = *v 14751 } 14752 14753 for key, value := range shape { 14754 switch key { 14755 case "allowMultipleValues": 14756 if value != nil { 14757 jtv, ok := value.(bool) 14758 if !ok { 14759 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 14760 } 14761 sv.AllowMultipleValues = jtv 14762 } 14763 14764 default: 14765 _, _ = key, value 14766 14767 } 14768 } 14769 *v = sv 14770 return nil 14771} 14772 14773func awsRestjson1_deserializeDocumentObfuscationSetting(v **types.ObfuscationSetting, value interface{}) error { 14774 if v == nil { 14775 return fmt.Errorf("unexpected nil of type %T", v) 14776 } 14777 if value == nil { 14778 return nil 14779 } 14780 14781 shape, ok := value.(map[string]interface{}) 14782 if !ok { 14783 return fmt.Errorf("unexpected JSON type %v", value) 14784 } 14785 14786 var sv *types.ObfuscationSetting 14787 if *v == nil { 14788 sv = &types.ObfuscationSetting{} 14789 } else { 14790 sv = *v 14791 } 14792 14793 for key, value := range shape { 14794 switch key { 14795 case "obfuscationSettingType": 14796 if value != nil { 14797 jtv, ok := value.(string) 14798 if !ok { 14799 return fmt.Errorf("expected ObfuscationSettingType to be of type string, got %T instead", value) 14800 } 14801 sv.ObfuscationSettingType = types.ObfuscationSettingType(jtv) 14802 } 14803 14804 default: 14805 _, _ = key, value 14806 14807 } 14808 } 14809 *v = sv 14810 return nil 14811} 14812 14813func awsRestjson1_deserializeDocumentOutputContext(v **types.OutputContext, value interface{}) error { 14814 if v == nil { 14815 return fmt.Errorf("unexpected nil of type %T", v) 14816 } 14817 if value == nil { 14818 return nil 14819 } 14820 14821 shape, ok := value.(map[string]interface{}) 14822 if !ok { 14823 return fmt.Errorf("unexpected JSON type %v", value) 14824 } 14825 14826 var sv *types.OutputContext 14827 if *v == nil { 14828 sv = &types.OutputContext{} 14829 } else { 14830 sv = *v 14831 } 14832 14833 for key, value := range shape { 14834 switch key { 14835 case "name": 14836 if value != nil { 14837 jtv, ok := value.(string) 14838 if !ok { 14839 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 14840 } 14841 sv.Name = ptr.String(jtv) 14842 } 14843 14844 case "timeToLiveInSeconds": 14845 if value != nil { 14846 jtv, ok := value.(json.Number) 14847 if !ok { 14848 return fmt.Errorf("expected ContextTimeToLiveInSeconds to be json.Number, got %T instead", value) 14849 } 14850 i64, err := jtv.Int64() 14851 if err != nil { 14852 return err 14853 } 14854 sv.TimeToLiveInSeconds = ptr.Int32(int32(i64)) 14855 } 14856 14857 case "turnsToLive": 14858 if value != nil { 14859 jtv, ok := value.(json.Number) 14860 if !ok { 14861 return fmt.Errorf("expected ContextTurnsToLive to be json.Number, got %T instead", value) 14862 } 14863 i64, err := jtv.Int64() 14864 if err != nil { 14865 return err 14866 } 14867 sv.TurnsToLive = ptr.Int32(int32(i64)) 14868 } 14869 14870 default: 14871 _, _ = key, value 14872 14873 } 14874 } 14875 *v = sv 14876 return nil 14877} 14878 14879func awsRestjson1_deserializeDocumentOutputContextsList(v *[]types.OutputContext, value interface{}) error { 14880 if v == nil { 14881 return fmt.Errorf("unexpected nil of type %T", v) 14882 } 14883 if value == nil { 14884 return nil 14885 } 14886 14887 shape, ok := value.([]interface{}) 14888 if !ok { 14889 return fmt.Errorf("unexpected JSON type %v", value) 14890 } 14891 14892 var cv []types.OutputContext 14893 if *v == nil { 14894 cv = []types.OutputContext{} 14895 } else { 14896 cv = *v 14897 } 14898 14899 for _, value := range shape { 14900 var col types.OutputContext 14901 destAddr := &col 14902 if err := awsRestjson1_deserializeDocumentOutputContext(&destAddr, value); err != nil { 14903 return err 14904 } 14905 col = *destAddr 14906 cv = append(cv, col) 14907 14908 } 14909 *v = cv 14910 return nil 14911} 14912 14913func awsRestjson1_deserializeDocumentPlainTextMessage(v **types.PlainTextMessage, value interface{}) error { 14914 if v == nil { 14915 return fmt.Errorf("unexpected nil of type %T", v) 14916 } 14917 if value == nil { 14918 return nil 14919 } 14920 14921 shape, ok := value.(map[string]interface{}) 14922 if !ok { 14923 return fmt.Errorf("unexpected JSON type %v", value) 14924 } 14925 14926 var sv *types.PlainTextMessage 14927 if *v == nil { 14928 sv = &types.PlainTextMessage{} 14929 } else { 14930 sv = *v 14931 } 14932 14933 for key, value := range shape { 14934 switch key { 14935 case "value": 14936 if value != nil { 14937 jtv, ok := value.(string) 14938 if !ok { 14939 return fmt.Errorf("expected PlainTextMessageValue to be of type string, got %T instead", value) 14940 } 14941 sv.Value = ptr.String(jtv) 14942 } 14943 14944 default: 14945 _, _ = key, value 14946 14947 } 14948 } 14949 *v = sv 14950 return nil 14951} 14952 14953func awsRestjson1_deserializeDocumentPreconditionFailedException(v **types.PreconditionFailedException, value interface{}) error { 14954 if v == nil { 14955 return fmt.Errorf("unexpected nil of type %T", v) 14956 } 14957 if value == nil { 14958 return nil 14959 } 14960 14961 shape, ok := value.(map[string]interface{}) 14962 if !ok { 14963 return fmt.Errorf("unexpected JSON type %v", value) 14964 } 14965 14966 var sv *types.PreconditionFailedException 14967 if *v == nil { 14968 sv = &types.PreconditionFailedException{} 14969 } else { 14970 sv = *v 14971 } 14972 14973 for key, value := range shape { 14974 switch key { 14975 case "message": 14976 if value != nil { 14977 jtv, ok := value.(string) 14978 if !ok { 14979 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 14980 } 14981 sv.Message = ptr.String(jtv) 14982 } 14983 14984 default: 14985 _, _ = key, value 14986 14987 } 14988 } 14989 *v = sv 14990 return nil 14991} 14992 14993func awsRestjson1_deserializeDocumentPromptSpecification(v **types.PromptSpecification, value interface{}) error { 14994 if v == nil { 14995 return fmt.Errorf("unexpected nil of type %T", v) 14996 } 14997 if value == nil { 14998 return nil 14999 } 15000 15001 shape, ok := value.(map[string]interface{}) 15002 if !ok { 15003 return fmt.Errorf("unexpected JSON type %v", value) 15004 } 15005 15006 var sv *types.PromptSpecification 15007 if *v == nil { 15008 sv = &types.PromptSpecification{} 15009 } else { 15010 sv = *v 15011 } 15012 15013 for key, value := range shape { 15014 switch key { 15015 case "allowInterrupt": 15016 if value != nil { 15017 jtv, ok := value.(bool) 15018 if !ok { 15019 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 15020 } 15021 sv.AllowInterrupt = ptr.Bool(jtv) 15022 } 15023 15024 case "maxRetries": 15025 if value != nil { 15026 jtv, ok := value.(json.Number) 15027 if !ok { 15028 return fmt.Errorf("expected PromptMaxRetries to be json.Number, got %T instead", value) 15029 } 15030 i64, err := jtv.Int64() 15031 if err != nil { 15032 return err 15033 } 15034 sv.MaxRetries = ptr.Int32(int32(i64)) 15035 } 15036 15037 case "messageGroups": 15038 if err := awsRestjson1_deserializeDocumentMessageGroupsList(&sv.MessageGroups, value); err != nil { 15039 return err 15040 } 15041 15042 default: 15043 _, _ = key, value 15044 15045 } 15046 } 15047 *v = sv 15048 return nil 15049} 15050 15051func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 15052 if v == nil { 15053 return fmt.Errorf("unexpected nil of type %T", v) 15054 } 15055 if value == nil { 15056 return nil 15057 } 15058 15059 shape, ok := value.(map[string]interface{}) 15060 if !ok { 15061 return fmt.Errorf("unexpected JSON type %v", value) 15062 } 15063 15064 var sv *types.ResourceNotFoundException 15065 if *v == nil { 15066 sv = &types.ResourceNotFoundException{} 15067 } else { 15068 sv = *v 15069 } 15070 15071 for key, value := range shape { 15072 switch key { 15073 case "message": 15074 if value != nil { 15075 jtv, ok := value.(string) 15076 if !ok { 15077 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 15078 } 15079 sv.Message = ptr.String(jtv) 15080 } 15081 15082 default: 15083 _, _ = key, value 15084 15085 } 15086 } 15087 *v = sv 15088 return nil 15089} 15090 15091func awsRestjson1_deserializeDocumentResponseSpecification(v **types.ResponseSpecification, value interface{}) error { 15092 if v == nil { 15093 return fmt.Errorf("unexpected nil of type %T", v) 15094 } 15095 if value == nil { 15096 return nil 15097 } 15098 15099 shape, ok := value.(map[string]interface{}) 15100 if !ok { 15101 return fmt.Errorf("unexpected JSON type %v", value) 15102 } 15103 15104 var sv *types.ResponseSpecification 15105 if *v == nil { 15106 sv = &types.ResponseSpecification{} 15107 } else { 15108 sv = *v 15109 } 15110 15111 for key, value := range shape { 15112 switch key { 15113 case "allowInterrupt": 15114 if value != nil { 15115 jtv, ok := value.(bool) 15116 if !ok { 15117 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 15118 } 15119 sv.AllowInterrupt = ptr.Bool(jtv) 15120 } 15121 15122 case "messageGroups": 15123 if err := awsRestjson1_deserializeDocumentMessageGroupsList(&sv.MessageGroups, value); err != nil { 15124 return err 15125 } 15126 15127 default: 15128 _, _ = key, value 15129 15130 } 15131 } 15132 *v = sv 15133 return nil 15134} 15135 15136func awsRestjson1_deserializeDocumentS3BucketLogDestination(v **types.S3BucketLogDestination, value interface{}) error { 15137 if v == nil { 15138 return fmt.Errorf("unexpected nil of type %T", v) 15139 } 15140 if value == nil { 15141 return nil 15142 } 15143 15144 shape, ok := value.(map[string]interface{}) 15145 if !ok { 15146 return fmt.Errorf("unexpected JSON type %v", value) 15147 } 15148 15149 var sv *types.S3BucketLogDestination 15150 if *v == nil { 15151 sv = &types.S3BucketLogDestination{} 15152 } else { 15153 sv = *v 15154 } 15155 15156 for key, value := range shape { 15157 switch key { 15158 case "kmsKeyArn": 15159 if value != nil { 15160 jtv, ok := value.(string) 15161 if !ok { 15162 return fmt.Errorf("expected KmsKeyArn to be of type string, got %T instead", value) 15163 } 15164 sv.KmsKeyArn = ptr.String(jtv) 15165 } 15166 15167 case "logPrefix": 15168 if value != nil { 15169 jtv, ok := value.(string) 15170 if !ok { 15171 return fmt.Errorf("expected LogPrefix to be of type string, got %T instead", value) 15172 } 15173 sv.LogPrefix = ptr.String(jtv) 15174 } 15175 15176 case "s3BucketArn": 15177 if value != nil { 15178 jtv, ok := value.(string) 15179 if !ok { 15180 return fmt.Errorf("expected S3BucketArn to be of type string, got %T instead", value) 15181 } 15182 sv.S3BucketArn = ptr.String(jtv) 15183 } 15184 15185 default: 15186 _, _ = key, value 15187 15188 } 15189 } 15190 *v = sv 15191 return nil 15192} 15193 15194func awsRestjson1_deserializeDocumentSampleUtterance(v **types.SampleUtterance, value interface{}) error { 15195 if v == nil { 15196 return fmt.Errorf("unexpected nil of type %T", v) 15197 } 15198 if value == nil { 15199 return nil 15200 } 15201 15202 shape, ok := value.(map[string]interface{}) 15203 if !ok { 15204 return fmt.Errorf("unexpected JSON type %v", value) 15205 } 15206 15207 var sv *types.SampleUtterance 15208 if *v == nil { 15209 sv = &types.SampleUtterance{} 15210 } else { 15211 sv = *v 15212 } 15213 15214 for key, value := range shape { 15215 switch key { 15216 case "utterance": 15217 if value != nil { 15218 jtv, ok := value.(string) 15219 if !ok { 15220 return fmt.Errorf("expected Utterance to be of type string, got %T instead", value) 15221 } 15222 sv.Utterance = ptr.String(jtv) 15223 } 15224 15225 default: 15226 _, _ = key, value 15227 15228 } 15229 } 15230 *v = sv 15231 return nil 15232} 15233 15234func awsRestjson1_deserializeDocumentSampleUtterancesList(v *[]types.SampleUtterance, value interface{}) error { 15235 if v == nil { 15236 return fmt.Errorf("unexpected nil of type %T", v) 15237 } 15238 if value == nil { 15239 return nil 15240 } 15241 15242 shape, ok := value.([]interface{}) 15243 if !ok { 15244 return fmt.Errorf("unexpected JSON type %v", value) 15245 } 15246 15247 var cv []types.SampleUtterance 15248 if *v == nil { 15249 cv = []types.SampleUtterance{} 15250 } else { 15251 cv = *v 15252 } 15253 15254 for _, value := range shape { 15255 var col types.SampleUtterance 15256 destAddr := &col 15257 if err := awsRestjson1_deserializeDocumentSampleUtterance(&destAddr, value); err != nil { 15258 return err 15259 } 15260 col = *destAddr 15261 cv = append(cv, col) 15262 15263 } 15264 *v = cv 15265 return nil 15266} 15267 15268func awsRestjson1_deserializeDocumentSampleValue(v **types.SampleValue, value interface{}) error { 15269 if v == nil { 15270 return fmt.Errorf("unexpected nil of type %T", v) 15271 } 15272 if value == nil { 15273 return nil 15274 } 15275 15276 shape, ok := value.(map[string]interface{}) 15277 if !ok { 15278 return fmt.Errorf("unexpected JSON type %v", value) 15279 } 15280 15281 var sv *types.SampleValue 15282 if *v == nil { 15283 sv = &types.SampleValue{} 15284 } else { 15285 sv = *v 15286 } 15287 15288 for key, value := range shape { 15289 switch key { 15290 case "value": 15291 if value != nil { 15292 jtv, ok := value.(string) 15293 if !ok { 15294 return fmt.Errorf("expected Value to be of type string, got %T instead", value) 15295 } 15296 sv.Value = ptr.String(jtv) 15297 } 15298 15299 default: 15300 _, _ = key, value 15301 15302 } 15303 } 15304 *v = sv 15305 return nil 15306} 15307 15308func awsRestjson1_deserializeDocumentSentimentAnalysisSettings(v **types.SentimentAnalysisSettings, value interface{}) error { 15309 if v == nil { 15310 return fmt.Errorf("unexpected nil of type %T", v) 15311 } 15312 if value == nil { 15313 return nil 15314 } 15315 15316 shape, ok := value.(map[string]interface{}) 15317 if !ok { 15318 return fmt.Errorf("unexpected JSON type %v", value) 15319 } 15320 15321 var sv *types.SentimentAnalysisSettings 15322 if *v == nil { 15323 sv = &types.SentimentAnalysisSettings{} 15324 } else { 15325 sv = *v 15326 } 15327 15328 for key, value := range shape { 15329 switch key { 15330 case "detectSentiment": 15331 if value != nil { 15332 jtv, ok := value.(bool) 15333 if !ok { 15334 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 15335 } 15336 sv.DetectSentiment = jtv 15337 } 15338 15339 default: 15340 _, _ = key, value 15341 15342 } 15343 } 15344 *v = sv 15345 return nil 15346} 15347 15348func awsRestjson1_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error { 15349 if v == nil { 15350 return fmt.Errorf("unexpected nil of type %T", v) 15351 } 15352 if value == nil { 15353 return nil 15354 } 15355 15356 shape, ok := value.(map[string]interface{}) 15357 if !ok { 15358 return fmt.Errorf("unexpected JSON type %v", value) 15359 } 15360 15361 var sv *types.ServiceQuotaExceededException 15362 if *v == nil { 15363 sv = &types.ServiceQuotaExceededException{} 15364 } else { 15365 sv = *v 15366 } 15367 15368 for key, value := range shape { 15369 switch key { 15370 case "message": 15371 if value != nil { 15372 jtv, ok := value.(string) 15373 if !ok { 15374 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 15375 } 15376 sv.Message = ptr.String(jtv) 15377 } 15378 15379 default: 15380 _, _ = key, value 15381 15382 } 15383 } 15384 *v = sv 15385 return nil 15386} 15387 15388func awsRestjson1_deserializeDocumentSlotDefaultValue(v **types.SlotDefaultValue, value interface{}) error { 15389 if v == nil { 15390 return fmt.Errorf("unexpected nil of type %T", v) 15391 } 15392 if value == nil { 15393 return nil 15394 } 15395 15396 shape, ok := value.(map[string]interface{}) 15397 if !ok { 15398 return fmt.Errorf("unexpected JSON type %v", value) 15399 } 15400 15401 var sv *types.SlotDefaultValue 15402 if *v == nil { 15403 sv = &types.SlotDefaultValue{} 15404 } else { 15405 sv = *v 15406 } 15407 15408 for key, value := range shape { 15409 switch key { 15410 case "defaultValue": 15411 if value != nil { 15412 jtv, ok := value.(string) 15413 if !ok { 15414 return fmt.Errorf("expected SlotDefaultValueString to be of type string, got %T instead", value) 15415 } 15416 sv.DefaultValue = ptr.String(jtv) 15417 } 15418 15419 default: 15420 _, _ = key, value 15421 15422 } 15423 } 15424 *v = sv 15425 return nil 15426} 15427 15428func awsRestjson1_deserializeDocumentSlotDefaultValueList(v *[]types.SlotDefaultValue, value interface{}) error { 15429 if v == nil { 15430 return fmt.Errorf("unexpected nil of type %T", v) 15431 } 15432 if value == nil { 15433 return nil 15434 } 15435 15436 shape, ok := value.([]interface{}) 15437 if !ok { 15438 return fmt.Errorf("unexpected JSON type %v", value) 15439 } 15440 15441 var cv []types.SlotDefaultValue 15442 if *v == nil { 15443 cv = []types.SlotDefaultValue{} 15444 } else { 15445 cv = *v 15446 } 15447 15448 for _, value := range shape { 15449 var col types.SlotDefaultValue 15450 destAddr := &col 15451 if err := awsRestjson1_deserializeDocumentSlotDefaultValue(&destAddr, value); err != nil { 15452 return err 15453 } 15454 col = *destAddr 15455 cv = append(cv, col) 15456 15457 } 15458 *v = cv 15459 return nil 15460} 15461 15462func awsRestjson1_deserializeDocumentSlotDefaultValueSpecification(v **types.SlotDefaultValueSpecification, value interface{}) error { 15463 if v == nil { 15464 return fmt.Errorf("unexpected nil of type %T", v) 15465 } 15466 if value == nil { 15467 return nil 15468 } 15469 15470 shape, ok := value.(map[string]interface{}) 15471 if !ok { 15472 return fmt.Errorf("unexpected JSON type %v", value) 15473 } 15474 15475 var sv *types.SlotDefaultValueSpecification 15476 if *v == nil { 15477 sv = &types.SlotDefaultValueSpecification{} 15478 } else { 15479 sv = *v 15480 } 15481 15482 for key, value := range shape { 15483 switch key { 15484 case "defaultValueList": 15485 if err := awsRestjson1_deserializeDocumentSlotDefaultValueList(&sv.DefaultValueList, value); err != nil { 15486 return err 15487 } 15488 15489 default: 15490 _, _ = key, value 15491 15492 } 15493 } 15494 *v = sv 15495 return nil 15496} 15497 15498func awsRestjson1_deserializeDocumentSlotPrioritiesList(v *[]types.SlotPriority, value interface{}) error { 15499 if v == nil { 15500 return fmt.Errorf("unexpected nil of type %T", v) 15501 } 15502 if value == nil { 15503 return nil 15504 } 15505 15506 shape, ok := value.([]interface{}) 15507 if !ok { 15508 return fmt.Errorf("unexpected JSON type %v", value) 15509 } 15510 15511 var cv []types.SlotPriority 15512 if *v == nil { 15513 cv = []types.SlotPriority{} 15514 } else { 15515 cv = *v 15516 } 15517 15518 for _, value := range shape { 15519 var col types.SlotPriority 15520 destAddr := &col 15521 if err := awsRestjson1_deserializeDocumentSlotPriority(&destAddr, value); err != nil { 15522 return err 15523 } 15524 col = *destAddr 15525 cv = append(cv, col) 15526 15527 } 15528 *v = cv 15529 return nil 15530} 15531 15532func awsRestjson1_deserializeDocumentSlotPriority(v **types.SlotPriority, value interface{}) error { 15533 if v == nil { 15534 return fmt.Errorf("unexpected nil of type %T", v) 15535 } 15536 if value == nil { 15537 return nil 15538 } 15539 15540 shape, ok := value.(map[string]interface{}) 15541 if !ok { 15542 return fmt.Errorf("unexpected JSON type %v", value) 15543 } 15544 15545 var sv *types.SlotPriority 15546 if *v == nil { 15547 sv = &types.SlotPriority{} 15548 } else { 15549 sv = *v 15550 } 15551 15552 for key, value := range shape { 15553 switch key { 15554 case "priority": 15555 if value != nil { 15556 jtv, ok := value.(json.Number) 15557 if !ok { 15558 return fmt.Errorf("expected PriorityValue to be json.Number, got %T instead", value) 15559 } 15560 i64, err := jtv.Int64() 15561 if err != nil { 15562 return err 15563 } 15564 sv.Priority = ptr.Int32(int32(i64)) 15565 } 15566 15567 case "slotId": 15568 if value != nil { 15569 jtv, ok := value.(string) 15570 if !ok { 15571 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15572 } 15573 sv.SlotId = ptr.String(jtv) 15574 } 15575 15576 default: 15577 _, _ = key, value 15578 15579 } 15580 } 15581 *v = sv 15582 return nil 15583} 15584 15585func awsRestjson1_deserializeDocumentSlotSummary(v **types.SlotSummary, value interface{}) error { 15586 if v == nil { 15587 return fmt.Errorf("unexpected nil of type %T", v) 15588 } 15589 if value == nil { 15590 return nil 15591 } 15592 15593 shape, ok := value.(map[string]interface{}) 15594 if !ok { 15595 return fmt.Errorf("unexpected JSON type %v", value) 15596 } 15597 15598 var sv *types.SlotSummary 15599 if *v == nil { 15600 sv = &types.SlotSummary{} 15601 } else { 15602 sv = *v 15603 } 15604 15605 for key, value := range shape { 15606 switch key { 15607 case "description": 15608 if value != nil { 15609 jtv, ok := value.(string) 15610 if !ok { 15611 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 15612 } 15613 sv.Description = ptr.String(jtv) 15614 } 15615 15616 case "lastUpdatedDateTime": 15617 if value != nil { 15618 switch jtv := value.(type) { 15619 case json.Number: 15620 f64, err := jtv.Float64() 15621 if err != nil { 15622 return err 15623 } 15624 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 15625 15626 default: 15627 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 15628 15629 } 15630 } 15631 15632 case "slotConstraint": 15633 if value != nil { 15634 jtv, ok := value.(string) 15635 if !ok { 15636 return fmt.Errorf("expected SlotConstraint to be of type string, got %T instead", value) 15637 } 15638 sv.SlotConstraint = types.SlotConstraint(jtv) 15639 } 15640 15641 case "slotId": 15642 if value != nil { 15643 jtv, ok := value.(string) 15644 if !ok { 15645 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15646 } 15647 sv.SlotId = ptr.String(jtv) 15648 } 15649 15650 case "slotName": 15651 if value != nil { 15652 jtv, ok := value.(string) 15653 if !ok { 15654 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 15655 } 15656 sv.SlotName = ptr.String(jtv) 15657 } 15658 15659 case "slotTypeId": 15660 if value != nil { 15661 jtv, ok := value.(string) 15662 if !ok { 15663 return fmt.Errorf("expected BuiltInOrCustomSlotTypeId to be of type string, got %T instead", value) 15664 } 15665 sv.SlotTypeId = ptr.String(jtv) 15666 } 15667 15668 case "valueElicitationPromptSpecification": 15669 if err := awsRestjson1_deserializeDocumentPromptSpecification(&sv.ValueElicitationPromptSpecification, value); err != nil { 15670 return err 15671 } 15672 15673 default: 15674 _, _ = key, value 15675 15676 } 15677 } 15678 *v = sv 15679 return nil 15680} 15681 15682func awsRestjson1_deserializeDocumentSlotSummaryList(v *[]types.SlotSummary, value interface{}) error { 15683 if v == nil { 15684 return fmt.Errorf("unexpected nil of type %T", v) 15685 } 15686 if value == nil { 15687 return nil 15688 } 15689 15690 shape, ok := value.([]interface{}) 15691 if !ok { 15692 return fmt.Errorf("unexpected JSON type %v", value) 15693 } 15694 15695 var cv []types.SlotSummary 15696 if *v == nil { 15697 cv = []types.SlotSummary{} 15698 } else { 15699 cv = *v 15700 } 15701 15702 for _, value := range shape { 15703 var col types.SlotSummary 15704 destAddr := &col 15705 if err := awsRestjson1_deserializeDocumentSlotSummary(&destAddr, value); err != nil { 15706 return err 15707 } 15708 col = *destAddr 15709 cv = append(cv, col) 15710 15711 } 15712 *v = cv 15713 return nil 15714} 15715 15716func awsRestjson1_deserializeDocumentSlotTypeSummary(v **types.SlotTypeSummary, value interface{}) error { 15717 if v == nil { 15718 return fmt.Errorf("unexpected nil of type %T", v) 15719 } 15720 if value == nil { 15721 return nil 15722 } 15723 15724 shape, ok := value.(map[string]interface{}) 15725 if !ok { 15726 return fmt.Errorf("unexpected JSON type %v", value) 15727 } 15728 15729 var sv *types.SlotTypeSummary 15730 if *v == nil { 15731 sv = &types.SlotTypeSummary{} 15732 } else { 15733 sv = *v 15734 } 15735 15736 for key, value := range shape { 15737 switch key { 15738 case "description": 15739 if value != nil { 15740 jtv, ok := value.(string) 15741 if !ok { 15742 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 15743 } 15744 sv.Description = ptr.String(jtv) 15745 } 15746 15747 case "lastUpdatedDateTime": 15748 if value != nil { 15749 switch jtv := value.(type) { 15750 case json.Number: 15751 f64, err := jtv.Float64() 15752 if err != nil { 15753 return err 15754 } 15755 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 15756 15757 default: 15758 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 15759 15760 } 15761 } 15762 15763 case "parentSlotTypeSignature": 15764 if value != nil { 15765 jtv, ok := value.(string) 15766 if !ok { 15767 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 15768 } 15769 sv.ParentSlotTypeSignature = ptr.String(jtv) 15770 } 15771 15772 case "slotTypeId": 15773 if value != nil { 15774 jtv, ok := value.(string) 15775 if !ok { 15776 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 15777 } 15778 sv.SlotTypeId = ptr.String(jtv) 15779 } 15780 15781 case "slotTypeName": 15782 if value != nil { 15783 jtv, ok := value.(string) 15784 if !ok { 15785 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 15786 } 15787 sv.SlotTypeName = ptr.String(jtv) 15788 } 15789 15790 default: 15791 _, _ = key, value 15792 15793 } 15794 } 15795 *v = sv 15796 return nil 15797} 15798 15799func awsRestjson1_deserializeDocumentSlotTypeSummaryList(v *[]types.SlotTypeSummary, value interface{}) error { 15800 if v == nil { 15801 return fmt.Errorf("unexpected nil of type %T", v) 15802 } 15803 if value == nil { 15804 return nil 15805 } 15806 15807 shape, ok := value.([]interface{}) 15808 if !ok { 15809 return fmt.Errorf("unexpected JSON type %v", value) 15810 } 15811 15812 var cv []types.SlotTypeSummary 15813 if *v == nil { 15814 cv = []types.SlotTypeSummary{} 15815 } else { 15816 cv = *v 15817 } 15818 15819 for _, value := range shape { 15820 var col types.SlotTypeSummary 15821 destAddr := &col 15822 if err := awsRestjson1_deserializeDocumentSlotTypeSummary(&destAddr, value); err != nil { 15823 return err 15824 } 15825 col = *destAddr 15826 cv = append(cv, col) 15827 15828 } 15829 *v = cv 15830 return nil 15831} 15832 15833func awsRestjson1_deserializeDocumentSlotTypeValue(v **types.SlotTypeValue, value interface{}) error { 15834 if v == nil { 15835 return fmt.Errorf("unexpected nil of type %T", v) 15836 } 15837 if value == nil { 15838 return nil 15839 } 15840 15841 shape, ok := value.(map[string]interface{}) 15842 if !ok { 15843 return fmt.Errorf("unexpected JSON type %v", value) 15844 } 15845 15846 var sv *types.SlotTypeValue 15847 if *v == nil { 15848 sv = &types.SlotTypeValue{} 15849 } else { 15850 sv = *v 15851 } 15852 15853 for key, value := range shape { 15854 switch key { 15855 case "sampleValue": 15856 if err := awsRestjson1_deserializeDocumentSampleValue(&sv.SampleValue, value); err != nil { 15857 return err 15858 } 15859 15860 case "synonyms": 15861 if err := awsRestjson1_deserializeDocumentSynonymList(&sv.Synonyms, value); err != nil { 15862 return err 15863 } 15864 15865 default: 15866 _, _ = key, value 15867 15868 } 15869 } 15870 *v = sv 15871 return nil 15872} 15873 15874func awsRestjson1_deserializeDocumentSlotTypeValues(v *[]types.SlotTypeValue, value interface{}) error { 15875 if v == nil { 15876 return fmt.Errorf("unexpected nil of type %T", v) 15877 } 15878 if value == nil { 15879 return nil 15880 } 15881 15882 shape, ok := value.([]interface{}) 15883 if !ok { 15884 return fmt.Errorf("unexpected JSON type %v", value) 15885 } 15886 15887 var cv []types.SlotTypeValue 15888 if *v == nil { 15889 cv = []types.SlotTypeValue{} 15890 } else { 15891 cv = *v 15892 } 15893 15894 for _, value := range shape { 15895 var col types.SlotTypeValue 15896 destAddr := &col 15897 if err := awsRestjson1_deserializeDocumentSlotTypeValue(&destAddr, value); err != nil { 15898 return err 15899 } 15900 col = *destAddr 15901 cv = append(cv, col) 15902 15903 } 15904 *v = cv 15905 return nil 15906} 15907 15908func awsRestjson1_deserializeDocumentSlotValueElicitationSetting(v **types.SlotValueElicitationSetting, value interface{}) error { 15909 if v == nil { 15910 return fmt.Errorf("unexpected nil of type %T", v) 15911 } 15912 if value == nil { 15913 return nil 15914 } 15915 15916 shape, ok := value.(map[string]interface{}) 15917 if !ok { 15918 return fmt.Errorf("unexpected JSON type %v", value) 15919 } 15920 15921 var sv *types.SlotValueElicitationSetting 15922 if *v == nil { 15923 sv = &types.SlotValueElicitationSetting{} 15924 } else { 15925 sv = *v 15926 } 15927 15928 for key, value := range shape { 15929 switch key { 15930 case "defaultValueSpecification": 15931 if err := awsRestjson1_deserializeDocumentSlotDefaultValueSpecification(&sv.DefaultValueSpecification, value); err != nil { 15932 return err 15933 } 15934 15935 case "promptSpecification": 15936 if err := awsRestjson1_deserializeDocumentPromptSpecification(&sv.PromptSpecification, value); err != nil { 15937 return err 15938 } 15939 15940 case "sampleUtterances": 15941 if err := awsRestjson1_deserializeDocumentSampleUtterancesList(&sv.SampleUtterances, value); err != nil { 15942 return err 15943 } 15944 15945 case "slotConstraint": 15946 if value != nil { 15947 jtv, ok := value.(string) 15948 if !ok { 15949 return fmt.Errorf("expected SlotConstraint to be of type string, got %T instead", value) 15950 } 15951 sv.SlotConstraint = types.SlotConstraint(jtv) 15952 } 15953 15954 case "waitAndContinueSpecification": 15955 if err := awsRestjson1_deserializeDocumentWaitAndContinueSpecification(&sv.WaitAndContinueSpecification, value); err != nil { 15956 return err 15957 } 15958 15959 default: 15960 _, _ = key, value 15961 15962 } 15963 } 15964 *v = sv 15965 return nil 15966} 15967 15968func awsRestjson1_deserializeDocumentSlotValueRegexFilter(v **types.SlotValueRegexFilter, value interface{}) error { 15969 if v == nil { 15970 return fmt.Errorf("unexpected nil of type %T", v) 15971 } 15972 if value == nil { 15973 return nil 15974 } 15975 15976 shape, ok := value.(map[string]interface{}) 15977 if !ok { 15978 return fmt.Errorf("unexpected JSON type %v", value) 15979 } 15980 15981 var sv *types.SlotValueRegexFilter 15982 if *v == nil { 15983 sv = &types.SlotValueRegexFilter{} 15984 } else { 15985 sv = *v 15986 } 15987 15988 for key, value := range shape { 15989 switch key { 15990 case "pattern": 15991 if value != nil { 15992 jtv, ok := value.(string) 15993 if !ok { 15994 return fmt.Errorf("expected RegexPattern to be of type string, got %T instead", value) 15995 } 15996 sv.Pattern = ptr.String(jtv) 15997 } 15998 15999 default: 16000 _, _ = key, value 16001 16002 } 16003 } 16004 *v = sv 16005 return nil 16006} 16007 16008func awsRestjson1_deserializeDocumentSlotValueSelectionSetting(v **types.SlotValueSelectionSetting, value interface{}) error { 16009 if v == nil { 16010 return fmt.Errorf("unexpected nil of type %T", v) 16011 } 16012 if value == nil { 16013 return nil 16014 } 16015 16016 shape, ok := value.(map[string]interface{}) 16017 if !ok { 16018 return fmt.Errorf("unexpected JSON type %v", value) 16019 } 16020 16021 var sv *types.SlotValueSelectionSetting 16022 if *v == nil { 16023 sv = &types.SlotValueSelectionSetting{} 16024 } else { 16025 sv = *v 16026 } 16027 16028 for key, value := range shape { 16029 switch key { 16030 case "regexFilter": 16031 if err := awsRestjson1_deserializeDocumentSlotValueRegexFilter(&sv.RegexFilter, value); err != nil { 16032 return err 16033 } 16034 16035 case "resolutionStrategy": 16036 if value != nil { 16037 jtv, ok := value.(string) 16038 if !ok { 16039 return fmt.Errorf("expected SlotValueResolutionStrategy to be of type string, got %T instead", value) 16040 } 16041 sv.ResolutionStrategy = types.SlotValueResolutionStrategy(jtv) 16042 } 16043 16044 default: 16045 _, _ = key, value 16046 16047 } 16048 } 16049 *v = sv 16050 return nil 16051} 16052 16053func awsRestjson1_deserializeDocumentSSMLMessage(v **types.SSMLMessage, value interface{}) error { 16054 if v == nil { 16055 return fmt.Errorf("unexpected nil of type %T", v) 16056 } 16057 if value == nil { 16058 return nil 16059 } 16060 16061 shape, ok := value.(map[string]interface{}) 16062 if !ok { 16063 return fmt.Errorf("unexpected JSON type %v", value) 16064 } 16065 16066 var sv *types.SSMLMessage 16067 if *v == nil { 16068 sv = &types.SSMLMessage{} 16069 } else { 16070 sv = *v 16071 } 16072 16073 for key, value := range shape { 16074 switch key { 16075 case "value": 16076 if value != nil { 16077 jtv, ok := value.(string) 16078 if !ok { 16079 return fmt.Errorf("expected SSMLMessageValue to be of type string, got %T instead", value) 16080 } 16081 sv.Value = ptr.String(jtv) 16082 } 16083 16084 default: 16085 _, _ = key, value 16086 16087 } 16088 } 16089 *v = sv 16090 return nil 16091} 16092 16093func awsRestjson1_deserializeDocumentStillWaitingResponseSpecification(v **types.StillWaitingResponseSpecification, value interface{}) error { 16094 if v == nil { 16095 return fmt.Errorf("unexpected nil of type %T", v) 16096 } 16097 if value == nil { 16098 return nil 16099 } 16100 16101 shape, ok := value.(map[string]interface{}) 16102 if !ok { 16103 return fmt.Errorf("unexpected JSON type %v", value) 16104 } 16105 16106 var sv *types.StillWaitingResponseSpecification 16107 if *v == nil { 16108 sv = &types.StillWaitingResponseSpecification{} 16109 } else { 16110 sv = *v 16111 } 16112 16113 for key, value := range shape { 16114 switch key { 16115 case "allowInterrupt": 16116 if value != nil { 16117 jtv, ok := value.(bool) 16118 if !ok { 16119 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 16120 } 16121 sv.AllowInterrupt = ptr.Bool(jtv) 16122 } 16123 16124 case "frequencyInSeconds": 16125 if value != nil { 16126 jtv, ok := value.(json.Number) 16127 if !ok { 16128 return fmt.Errorf("expected StillWaitingResponseFrequency to be json.Number, got %T instead", value) 16129 } 16130 i64, err := jtv.Int64() 16131 if err != nil { 16132 return err 16133 } 16134 sv.FrequencyInSeconds = ptr.Int32(int32(i64)) 16135 } 16136 16137 case "messageGroups": 16138 if err := awsRestjson1_deserializeDocumentMessageGroupsList(&sv.MessageGroups, value); err != nil { 16139 return err 16140 } 16141 16142 case "timeoutInSeconds": 16143 if value != nil { 16144 jtv, ok := value.(json.Number) 16145 if !ok { 16146 return fmt.Errorf("expected StillWaitingResponseTimeout to be json.Number, got %T instead", value) 16147 } 16148 i64, err := jtv.Int64() 16149 if err != nil { 16150 return err 16151 } 16152 sv.TimeoutInSeconds = ptr.Int32(int32(i64)) 16153 } 16154 16155 default: 16156 _, _ = key, value 16157 16158 } 16159 } 16160 *v = sv 16161 return nil 16162} 16163 16164func awsRestjson1_deserializeDocumentSynonymList(v *[]types.SampleValue, value interface{}) error { 16165 if v == nil { 16166 return fmt.Errorf("unexpected nil of type %T", v) 16167 } 16168 if value == nil { 16169 return nil 16170 } 16171 16172 shape, ok := value.([]interface{}) 16173 if !ok { 16174 return fmt.Errorf("unexpected JSON type %v", value) 16175 } 16176 16177 var cv []types.SampleValue 16178 if *v == nil { 16179 cv = []types.SampleValue{} 16180 } else { 16181 cv = *v 16182 } 16183 16184 for _, value := range shape { 16185 var col types.SampleValue 16186 destAddr := &col 16187 if err := awsRestjson1_deserializeDocumentSampleValue(&destAddr, value); err != nil { 16188 return err 16189 } 16190 col = *destAddr 16191 cv = append(cv, col) 16192 16193 } 16194 *v = cv 16195 return nil 16196} 16197 16198func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { 16199 if v == nil { 16200 return fmt.Errorf("unexpected nil of type %T", v) 16201 } 16202 if value == nil { 16203 return nil 16204 } 16205 16206 shape, ok := value.(map[string]interface{}) 16207 if !ok { 16208 return fmt.Errorf("unexpected JSON type %v", value) 16209 } 16210 16211 var mv map[string]string 16212 if *v == nil { 16213 mv = map[string]string{} 16214 } else { 16215 mv = *v 16216 } 16217 16218 for key, value := range shape { 16219 var parsedVal string 16220 if value != nil { 16221 jtv, ok := value.(string) 16222 if !ok { 16223 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 16224 } 16225 parsedVal = jtv 16226 } 16227 mv[key] = parsedVal 16228 16229 } 16230 *v = mv 16231 return nil 16232} 16233 16234func awsRestjson1_deserializeDocumentTextLogDestination(v **types.TextLogDestination, value interface{}) error { 16235 if v == nil { 16236 return fmt.Errorf("unexpected nil of type %T", v) 16237 } 16238 if value == nil { 16239 return nil 16240 } 16241 16242 shape, ok := value.(map[string]interface{}) 16243 if !ok { 16244 return fmt.Errorf("unexpected JSON type %v", value) 16245 } 16246 16247 var sv *types.TextLogDestination 16248 if *v == nil { 16249 sv = &types.TextLogDestination{} 16250 } else { 16251 sv = *v 16252 } 16253 16254 for key, value := range shape { 16255 switch key { 16256 case "cloudWatch": 16257 if err := awsRestjson1_deserializeDocumentCloudWatchLogGroupLogDestination(&sv.CloudWatch, value); err != nil { 16258 return err 16259 } 16260 16261 default: 16262 _, _ = key, value 16263 16264 } 16265 } 16266 *v = sv 16267 return nil 16268} 16269 16270func awsRestjson1_deserializeDocumentTextLogSetting(v **types.TextLogSetting, value interface{}) error { 16271 if v == nil { 16272 return fmt.Errorf("unexpected nil of type %T", v) 16273 } 16274 if value == nil { 16275 return nil 16276 } 16277 16278 shape, ok := value.(map[string]interface{}) 16279 if !ok { 16280 return fmt.Errorf("unexpected JSON type %v", value) 16281 } 16282 16283 var sv *types.TextLogSetting 16284 if *v == nil { 16285 sv = &types.TextLogSetting{} 16286 } else { 16287 sv = *v 16288 } 16289 16290 for key, value := range shape { 16291 switch key { 16292 case "destination": 16293 if err := awsRestjson1_deserializeDocumentTextLogDestination(&sv.Destination, value); err != nil { 16294 return err 16295 } 16296 16297 case "enabled": 16298 if value != nil { 16299 jtv, ok := value.(bool) 16300 if !ok { 16301 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 16302 } 16303 sv.Enabled = jtv 16304 } 16305 16306 default: 16307 _, _ = key, value 16308 16309 } 16310 } 16311 *v = sv 16312 return nil 16313} 16314 16315func awsRestjson1_deserializeDocumentTextLogSettingsList(v *[]types.TextLogSetting, value interface{}) error { 16316 if v == nil { 16317 return fmt.Errorf("unexpected nil of type %T", v) 16318 } 16319 if value == nil { 16320 return nil 16321 } 16322 16323 shape, ok := value.([]interface{}) 16324 if !ok { 16325 return fmt.Errorf("unexpected JSON type %v", value) 16326 } 16327 16328 var cv []types.TextLogSetting 16329 if *v == nil { 16330 cv = []types.TextLogSetting{} 16331 } else { 16332 cv = *v 16333 } 16334 16335 for _, value := range shape { 16336 var col types.TextLogSetting 16337 destAddr := &col 16338 if err := awsRestjson1_deserializeDocumentTextLogSetting(&destAddr, value); err != nil { 16339 return err 16340 } 16341 col = *destAddr 16342 cv = append(cv, col) 16343 16344 } 16345 *v = cv 16346 return nil 16347} 16348 16349func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { 16350 if v == nil { 16351 return fmt.Errorf("unexpected nil of type %T", v) 16352 } 16353 if value == nil { 16354 return nil 16355 } 16356 16357 shape, ok := value.(map[string]interface{}) 16358 if !ok { 16359 return fmt.Errorf("unexpected JSON type %v", value) 16360 } 16361 16362 var sv *types.ThrottlingException 16363 if *v == nil { 16364 sv = &types.ThrottlingException{} 16365 } else { 16366 sv = *v 16367 } 16368 16369 for key, value := range shape { 16370 switch key { 16371 case "message": 16372 if value != nil { 16373 jtv, ok := value.(string) 16374 if !ok { 16375 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 16376 } 16377 sv.Message = ptr.String(jtv) 16378 } 16379 16380 case "retryAfterSeconds": 16381 if value != nil { 16382 jtv, ok := value.(json.Number) 16383 if !ok { 16384 return fmt.Errorf("expected RetryAfterSeconds to be json.Number, got %T instead", value) 16385 } 16386 i64, err := jtv.Int64() 16387 if err != nil { 16388 return err 16389 } 16390 sv.RetryAfterSeconds = int32(i64) 16391 } 16392 16393 default: 16394 _, _ = key, value 16395 16396 } 16397 } 16398 *v = sv 16399 return nil 16400} 16401 16402func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { 16403 if v == nil { 16404 return fmt.Errorf("unexpected nil of type %T", v) 16405 } 16406 if value == nil { 16407 return nil 16408 } 16409 16410 shape, ok := value.(map[string]interface{}) 16411 if !ok { 16412 return fmt.Errorf("unexpected JSON type %v", value) 16413 } 16414 16415 var sv *types.ValidationException 16416 if *v == nil { 16417 sv = &types.ValidationException{} 16418 } else { 16419 sv = *v 16420 } 16421 16422 for key, value := range shape { 16423 switch key { 16424 case "message": 16425 if value != nil { 16426 jtv, ok := value.(string) 16427 if !ok { 16428 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 16429 } 16430 sv.Message = ptr.String(jtv) 16431 } 16432 16433 default: 16434 _, _ = key, value 16435 16436 } 16437 } 16438 *v = sv 16439 return nil 16440} 16441 16442func awsRestjson1_deserializeDocumentVoiceSettings(v **types.VoiceSettings, value interface{}) error { 16443 if v == nil { 16444 return fmt.Errorf("unexpected nil of type %T", v) 16445 } 16446 if value == nil { 16447 return nil 16448 } 16449 16450 shape, ok := value.(map[string]interface{}) 16451 if !ok { 16452 return fmt.Errorf("unexpected JSON type %v", value) 16453 } 16454 16455 var sv *types.VoiceSettings 16456 if *v == nil { 16457 sv = &types.VoiceSettings{} 16458 } else { 16459 sv = *v 16460 } 16461 16462 for key, value := range shape { 16463 switch key { 16464 case "voiceId": 16465 if value != nil { 16466 jtv, ok := value.(string) 16467 if !ok { 16468 return fmt.Errorf("expected VoiceId to be of type string, got %T instead", value) 16469 } 16470 sv.VoiceId = ptr.String(jtv) 16471 } 16472 16473 default: 16474 _, _ = key, value 16475 16476 } 16477 } 16478 *v = sv 16479 return nil 16480} 16481 16482func awsRestjson1_deserializeDocumentWaitAndContinueSpecification(v **types.WaitAndContinueSpecification, value interface{}) error { 16483 if v == nil { 16484 return fmt.Errorf("unexpected nil of type %T", v) 16485 } 16486 if value == nil { 16487 return nil 16488 } 16489 16490 shape, ok := value.(map[string]interface{}) 16491 if !ok { 16492 return fmt.Errorf("unexpected JSON type %v", value) 16493 } 16494 16495 var sv *types.WaitAndContinueSpecification 16496 if *v == nil { 16497 sv = &types.WaitAndContinueSpecification{} 16498 } else { 16499 sv = *v 16500 } 16501 16502 for key, value := range shape { 16503 switch key { 16504 case "active": 16505 if value != nil { 16506 jtv, ok := value.(bool) 16507 if !ok { 16508 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 16509 } 16510 sv.Active = ptr.Bool(jtv) 16511 } 16512 16513 case "continueResponse": 16514 if err := awsRestjson1_deserializeDocumentResponseSpecification(&sv.ContinueResponse, value); err != nil { 16515 return err 16516 } 16517 16518 case "stillWaitingResponse": 16519 if err := awsRestjson1_deserializeDocumentStillWaitingResponseSpecification(&sv.StillWaitingResponse, value); err != nil { 16520 return err 16521 } 16522 16523 case "waitingResponse": 16524 if err := awsRestjson1_deserializeDocumentResponseSpecification(&sv.WaitingResponse, value); err != nil { 16525 return err 16526 } 16527 16528 default: 16529 _, _ = key, value 16530 16531 } 16532 } 16533 *v = sv 16534 return nil 16535} 16536