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 "strconv" 21 "strings" 22) 23 24type awsRestjson1_deserializeOpBuildBotLocale struct { 25} 26 27func (*awsRestjson1_deserializeOpBuildBotLocale) ID() string { 28 return "OperationDeserializer" 29} 30 31func (m *awsRestjson1_deserializeOpBuildBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 32 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 33) { 34 out, metadata, err = next.HandleDeserialize(ctx, in) 35 if err != nil { 36 return out, metadata, err 37 } 38 39 response, ok := out.RawResponse.(*smithyhttp.Response) 40 if !ok { 41 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 42 } 43 44 if response.StatusCode < 200 || response.StatusCode >= 300 { 45 return out, metadata, awsRestjson1_deserializeOpErrorBuildBotLocale(response, &metadata) 46 } 47 output := &BuildBotLocaleOutput{} 48 out.Result = output 49 50 var buff [1024]byte 51 ringBuffer := smithyio.NewRingBuffer(buff[:]) 52 53 body := io.TeeReader(response.Body, ringBuffer) 54 55 decoder := json.NewDecoder(body) 56 decoder.UseNumber() 57 var shape interface{} 58 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 59 var snapshot bytes.Buffer 60 io.Copy(&snapshot, ringBuffer) 61 err = &smithy.DeserializationError{ 62 Err: fmt.Errorf("failed to decode response body, %w", err), 63 Snapshot: snapshot.Bytes(), 64 } 65 return out, metadata, err 66 } 67 68 err = awsRestjson1_deserializeOpDocumentBuildBotLocaleOutput(&output, shape) 69 if err != nil { 70 var snapshot bytes.Buffer 71 io.Copy(&snapshot, ringBuffer) 72 return out, metadata, &smithy.DeserializationError{ 73 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 74 Snapshot: snapshot.Bytes(), 75 } 76 } 77 78 return out, metadata, err 79} 80 81func awsRestjson1_deserializeOpErrorBuildBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 82 var errorBuffer bytes.Buffer 83 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 84 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 85 } 86 errorBody := bytes.NewReader(errorBuffer.Bytes()) 87 88 errorCode := "UnknownError" 89 errorMessage := errorCode 90 91 code := response.Header.Get("X-Amzn-ErrorType") 92 if len(code) != 0 { 93 errorCode = restjson.SanitizeErrorCode(code) 94 } 95 96 var buff [1024]byte 97 ringBuffer := smithyio.NewRingBuffer(buff[:]) 98 99 body := io.TeeReader(errorBody, ringBuffer) 100 decoder := json.NewDecoder(body) 101 decoder.UseNumber() 102 code, message, err := restjson.GetErrorInfo(decoder) 103 if err != nil { 104 var snapshot bytes.Buffer 105 io.Copy(&snapshot, ringBuffer) 106 err = &smithy.DeserializationError{ 107 Err: fmt.Errorf("failed to decode response body, %w", err), 108 Snapshot: snapshot.Bytes(), 109 } 110 return err 111 } 112 113 errorBody.Seek(0, io.SeekStart) 114 if len(code) != 0 { 115 errorCode = restjson.SanitizeErrorCode(code) 116 } 117 if len(message) != 0 { 118 errorMessage = message 119 } 120 121 switch { 122 case strings.EqualFold("ConflictException", errorCode): 123 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 124 125 case strings.EqualFold("InternalServerException", errorCode): 126 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 127 128 case strings.EqualFold("PreconditionFailedException", errorCode): 129 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 130 131 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 132 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 133 134 case strings.EqualFold("ThrottlingException", errorCode): 135 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 136 137 case strings.EqualFold("ValidationException", errorCode): 138 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 139 140 default: 141 genericError := &smithy.GenericAPIError{ 142 Code: errorCode, 143 Message: errorMessage, 144 } 145 return genericError 146 147 } 148} 149 150func awsRestjson1_deserializeOpDocumentBuildBotLocaleOutput(v **BuildBotLocaleOutput, value interface{}) error { 151 if v == nil { 152 return fmt.Errorf("unexpected nil of type %T", v) 153 } 154 if value == nil { 155 return nil 156 } 157 158 shape, ok := value.(map[string]interface{}) 159 if !ok { 160 return fmt.Errorf("unexpected JSON type %v", value) 161 } 162 163 var sv *BuildBotLocaleOutput 164 if *v == nil { 165 sv = &BuildBotLocaleOutput{} 166 } else { 167 sv = *v 168 } 169 170 for key, value := range shape { 171 switch key { 172 case "botId": 173 if value != nil { 174 jtv, ok := value.(string) 175 if !ok { 176 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 177 } 178 sv.BotId = ptr.String(jtv) 179 } 180 181 case "botLocaleStatus": 182 if value != nil { 183 jtv, ok := value.(string) 184 if !ok { 185 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 186 } 187 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 188 } 189 190 case "botVersion": 191 if value != nil { 192 jtv, ok := value.(string) 193 if !ok { 194 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 195 } 196 sv.BotVersion = ptr.String(jtv) 197 } 198 199 case "lastBuildSubmittedDateTime": 200 if value != nil { 201 jtv, ok := value.(json.Number) 202 if !ok { 203 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 204 } 205 f64, err := jtv.Float64() 206 if err != nil { 207 return err 208 } 209 sv.LastBuildSubmittedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 210 } 211 212 case "localeId": 213 if value != nil { 214 jtv, ok := value.(string) 215 if !ok { 216 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 217 } 218 sv.LocaleId = ptr.String(jtv) 219 } 220 221 default: 222 _, _ = key, value 223 224 } 225 } 226 *v = sv 227 return nil 228} 229 230type awsRestjson1_deserializeOpCreateBot struct { 231} 232 233func (*awsRestjson1_deserializeOpCreateBot) ID() string { 234 return "OperationDeserializer" 235} 236 237func (m *awsRestjson1_deserializeOpCreateBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 238 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 239) { 240 out, metadata, err = next.HandleDeserialize(ctx, in) 241 if err != nil { 242 return out, metadata, err 243 } 244 245 response, ok := out.RawResponse.(*smithyhttp.Response) 246 if !ok { 247 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 248 } 249 250 if response.StatusCode < 200 || response.StatusCode >= 300 { 251 return out, metadata, awsRestjson1_deserializeOpErrorCreateBot(response, &metadata) 252 } 253 output := &CreateBotOutput{} 254 out.Result = output 255 256 var buff [1024]byte 257 ringBuffer := smithyio.NewRingBuffer(buff[:]) 258 259 body := io.TeeReader(response.Body, ringBuffer) 260 261 decoder := json.NewDecoder(body) 262 decoder.UseNumber() 263 var shape interface{} 264 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 265 var snapshot bytes.Buffer 266 io.Copy(&snapshot, ringBuffer) 267 err = &smithy.DeserializationError{ 268 Err: fmt.Errorf("failed to decode response body, %w", err), 269 Snapshot: snapshot.Bytes(), 270 } 271 return out, metadata, err 272 } 273 274 err = awsRestjson1_deserializeOpDocumentCreateBotOutput(&output, shape) 275 if err != nil { 276 var snapshot bytes.Buffer 277 io.Copy(&snapshot, ringBuffer) 278 return out, metadata, &smithy.DeserializationError{ 279 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 280 Snapshot: snapshot.Bytes(), 281 } 282 } 283 284 return out, metadata, err 285} 286 287func awsRestjson1_deserializeOpErrorCreateBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 288 var errorBuffer bytes.Buffer 289 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 290 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 291 } 292 errorBody := bytes.NewReader(errorBuffer.Bytes()) 293 294 errorCode := "UnknownError" 295 errorMessage := errorCode 296 297 code := response.Header.Get("X-Amzn-ErrorType") 298 if len(code) != 0 { 299 errorCode = restjson.SanitizeErrorCode(code) 300 } 301 302 var buff [1024]byte 303 ringBuffer := smithyio.NewRingBuffer(buff[:]) 304 305 body := io.TeeReader(errorBody, ringBuffer) 306 decoder := json.NewDecoder(body) 307 decoder.UseNumber() 308 code, message, err := restjson.GetErrorInfo(decoder) 309 if err != nil { 310 var snapshot bytes.Buffer 311 io.Copy(&snapshot, ringBuffer) 312 err = &smithy.DeserializationError{ 313 Err: fmt.Errorf("failed to decode response body, %w", err), 314 Snapshot: snapshot.Bytes(), 315 } 316 return err 317 } 318 319 errorBody.Seek(0, io.SeekStart) 320 if len(code) != 0 { 321 errorCode = restjson.SanitizeErrorCode(code) 322 } 323 if len(message) != 0 { 324 errorMessage = message 325 } 326 327 switch { 328 case strings.EqualFold("ConflictException", errorCode): 329 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 330 331 case strings.EqualFold("InternalServerException", errorCode): 332 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 333 334 case strings.EqualFold("PreconditionFailedException", errorCode): 335 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 336 337 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 338 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 339 340 case strings.EqualFold("ThrottlingException", errorCode): 341 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 342 343 case strings.EqualFold("ValidationException", errorCode): 344 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 345 346 default: 347 genericError := &smithy.GenericAPIError{ 348 Code: errorCode, 349 Message: errorMessage, 350 } 351 return genericError 352 353 } 354} 355 356func awsRestjson1_deserializeOpDocumentCreateBotOutput(v **CreateBotOutput, value interface{}) error { 357 if v == nil { 358 return fmt.Errorf("unexpected nil of type %T", v) 359 } 360 if value == nil { 361 return nil 362 } 363 364 shape, ok := value.(map[string]interface{}) 365 if !ok { 366 return fmt.Errorf("unexpected JSON type %v", value) 367 } 368 369 var sv *CreateBotOutput 370 if *v == nil { 371 sv = &CreateBotOutput{} 372 } else { 373 sv = *v 374 } 375 376 for key, value := range shape { 377 switch key { 378 case "botId": 379 if value != nil { 380 jtv, ok := value.(string) 381 if !ok { 382 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 383 } 384 sv.BotId = ptr.String(jtv) 385 } 386 387 case "botName": 388 if value != nil { 389 jtv, ok := value.(string) 390 if !ok { 391 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 392 } 393 sv.BotName = ptr.String(jtv) 394 } 395 396 case "botStatus": 397 if value != nil { 398 jtv, ok := value.(string) 399 if !ok { 400 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 401 } 402 sv.BotStatus = types.BotStatus(jtv) 403 } 404 405 case "botTags": 406 if err := awsRestjson1_deserializeDocumentTagMap(&sv.BotTags, value); err != nil { 407 return err 408 } 409 410 case "creationDateTime": 411 if value != nil { 412 jtv, ok := value.(json.Number) 413 if !ok { 414 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 415 } 416 f64, err := jtv.Float64() 417 if err != nil { 418 return err 419 } 420 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 421 } 422 423 case "dataPrivacy": 424 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 425 return err 426 } 427 428 case "description": 429 if value != nil { 430 jtv, ok := value.(string) 431 if !ok { 432 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 433 } 434 sv.Description = ptr.String(jtv) 435 } 436 437 case "idleSessionTTLInSeconds": 438 if value != nil { 439 jtv, ok := value.(json.Number) 440 if !ok { 441 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 442 } 443 i64, err := jtv.Int64() 444 if err != nil { 445 return err 446 } 447 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 448 } 449 450 case "roleArn": 451 if value != nil { 452 jtv, ok := value.(string) 453 if !ok { 454 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 455 } 456 sv.RoleArn = ptr.String(jtv) 457 } 458 459 case "testBotAliasTags": 460 if err := awsRestjson1_deserializeDocumentTagMap(&sv.TestBotAliasTags, value); err != nil { 461 return err 462 } 463 464 default: 465 _, _ = key, value 466 467 } 468 } 469 *v = sv 470 return nil 471} 472 473type awsRestjson1_deserializeOpCreateBotAlias struct { 474} 475 476func (*awsRestjson1_deserializeOpCreateBotAlias) ID() string { 477 return "OperationDeserializer" 478} 479 480func (m *awsRestjson1_deserializeOpCreateBotAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 481 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 482) { 483 out, metadata, err = next.HandleDeserialize(ctx, in) 484 if err != nil { 485 return out, metadata, err 486 } 487 488 response, ok := out.RawResponse.(*smithyhttp.Response) 489 if !ok { 490 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 491 } 492 493 if response.StatusCode < 200 || response.StatusCode >= 300 { 494 return out, metadata, awsRestjson1_deserializeOpErrorCreateBotAlias(response, &metadata) 495 } 496 output := &CreateBotAliasOutput{} 497 out.Result = output 498 499 var buff [1024]byte 500 ringBuffer := smithyio.NewRingBuffer(buff[:]) 501 502 body := io.TeeReader(response.Body, ringBuffer) 503 504 decoder := json.NewDecoder(body) 505 decoder.UseNumber() 506 var shape interface{} 507 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 508 var snapshot bytes.Buffer 509 io.Copy(&snapshot, ringBuffer) 510 err = &smithy.DeserializationError{ 511 Err: fmt.Errorf("failed to decode response body, %w", err), 512 Snapshot: snapshot.Bytes(), 513 } 514 return out, metadata, err 515 } 516 517 err = awsRestjson1_deserializeOpDocumentCreateBotAliasOutput(&output, shape) 518 if err != nil { 519 var snapshot bytes.Buffer 520 io.Copy(&snapshot, ringBuffer) 521 return out, metadata, &smithy.DeserializationError{ 522 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 523 Snapshot: snapshot.Bytes(), 524 } 525 } 526 527 return out, metadata, err 528} 529 530func awsRestjson1_deserializeOpErrorCreateBotAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 531 var errorBuffer bytes.Buffer 532 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 533 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 534 } 535 errorBody := bytes.NewReader(errorBuffer.Bytes()) 536 537 errorCode := "UnknownError" 538 errorMessage := errorCode 539 540 code := response.Header.Get("X-Amzn-ErrorType") 541 if len(code) != 0 { 542 errorCode = restjson.SanitizeErrorCode(code) 543 } 544 545 var buff [1024]byte 546 ringBuffer := smithyio.NewRingBuffer(buff[:]) 547 548 body := io.TeeReader(errorBody, ringBuffer) 549 decoder := json.NewDecoder(body) 550 decoder.UseNumber() 551 code, message, err := restjson.GetErrorInfo(decoder) 552 if err != nil { 553 var snapshot bytes.Buffer 554 io.Copy(&snapshot, ringBuffer) 555 err = &smithy.DeserializationError{ 556 Err: fmt.Errorf("failed to decode response body, %w", err), 557 Snapshot: snapshot.Bytes(), 558 } 559 return err 560 } 561 562 errorBody.Seek(0, io.SeekStart) 563 if len(code) != 0 { 564 errorCode = restjson.SanitizeErrorCode(code) 565 } 566 if len(message) != 0 { 567 errorMessage = message 568 } 569 570 switch { 571 case strings.EqualFold("ConflictException", errorCode): 572 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 573 574 case strings.EqualFold("InternalServerException", errorCode): 575 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 576 577 case strings.EqualFold("PreconditionFailedException", errorCode): 578 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 579 580 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 581 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 582 583 case strings.EqualFold("ThrottlingException", errorCode): 584 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 585 586 case strings.EqualFold("ValidationException", errorCode): 587 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 588 589 default: 590 genericError := &smithy.GenericAPIError{ 591 Code: errorCode, 592 Message: errorMessage, 593 } 594 return genericError 595 596 } 597} 598 599func awsRestjson1_deserializeOpDocumentCreateBotAliasOutput(v **CreateBotAliasOutput, value interface{}) error { 600 if v == nil { 601 return fmt.Errorf("unexpected nil of type %T", v) 602 } 603 if value == nil { 604 return nil 605 } 606 607 shape, ok := value.(map[string]interface{}) 608 if !ok { 609 return fmt.Errorf("unexpected JSON type %v", value) 610 } 611 612 var sv *CreateBotAliasOutput 613 if *v == nil { 614 sv = &CreateBotAliasOutput{} 615 } else { 616 sv = *v 617 } 618 619 for key, value := range shape { 620 switch key { 621 case "botAliasId": 622 if value != nil { 623 jtv, ok := value.(string) 624 if !ok { 625 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 626 } 627 sv.BotAliasId = ptr.String(jtv) 628 } 629 630 case "botAliasLocaleSettings": 631 if err := awsRestjson1_deserializeDocumentBotAliasLocaleSettingsMap(&sv.BotAliasLocaleSettings, value); err != nil { 632 return err 633 } 634 635 case "botAliasName": 636 if value != nil { 637 jtv, ok := value.(string) 638 if !ok { 639 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 640 } 641 sv.BotAliasName = ptr.String(jtv) 642 } 643 644 case "botAliasStatus": 645 if value != nil { 646 jtv, ok := value.(string) 647 if !ok { 648 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 649 } 650 sv.BotAliasStatus = types.BotAliasStatus(jtv) 651 } 652 653 case "botId": 654 if value != nil { 655 jtv, ok := value.(string) 656 if !ok { 657 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 658 } 659 sv.BotId = ptr.String(jtv) 660 } 661 662 case "botVersion": 663 if value != nil { 664 jtv, ok := value.(string) 665 if !ok { 666 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 667 } 668 sv.BotVersion = ptr.String(jtv) 669 } 670 671 case "conversationLogSettings": 672 if err := awsRestjson1_deserializeDocumentConversationLogSettings(&sv.ConversationLogSettings, value); err != nil { 673 return err 674 } 675 676 case "creationDateTime": 677 if value != nil { 678 jtv, ok := value.(json.Number) 679 if !ok { 680 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 681 } 682 f64, err := jtv.Float64() 683 if err != nil { 684 return err 685 } 686 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 687 } 688 689 case "description": 690 if value != nil { 691 jtv, ok := value.(string) 692 if !ok { 693 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 694 } 695 sv.Description = ptr.String(jtv) 696 } 697 698 case "sentimentAnalysisSettings": 699 if err := awsRestjson1_deserializeDocumentSentimentAnalysisSettings(&sv.SentimentAnalysisSettings, value); err != nil { 700 return err 701 } 702 703 case "tags": 704 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 705 return err 706 } 707 708 default: 709 _, _ = key, value 710 711 } 712 } 713 *v = sv 714 return nil 715} 716 717type awsRestjson1_deserializeOpCreateBotLocale struct { 718} 719 720func (*awsRestjson1_deserializeOpCreateBotLocale) ID() string { 721 return "OperationDeserializer" 722} 723 724func (m *awsRestjson1_deserializeOpCreateBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 725 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 726) { 727 out, metadata, err = next.HandleDeserialize(ctx, in) 728 if err != nil { 729 return out, metadata, err 730 } 731 732 response, ok := out.RawResponse.(*smithyhttp.Response) 733 if !ok { 734 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 735 } 736 737 if response.StatusCode < 200 || response.StatusCode >= 300 { 738 return out, metadata, awsRestjson1_deserializeOpErrorCreateBotLocale(response, &metadata) 739 } 740 output := &CreateBotLocaleOutput{} 741 out.Result = output 742 743 var buff [1024]byte 744 ringBuffer := smithyio.NewRingBuffer(buff[:]) 745 746 body := io.TeeReader(response.Body, ringBuffer) 747 748 decoder := json.NewDecoder(body) 749 decoder.UseNumber() 750 var shape interface{} 751 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 752 var snapshot bytes.Buffer 753 io.Copy(&snapshot, ringBuffer) 754 err = &smithy.DeserializationError{ 755 Err: fmt.Errorf("failed to decode response body, %w", err), 756 Snapshot: snapshot.Bytes(), 757 } 758 return out, metadata, err 759 } 760 761 err = awsRestjson1_deserializeOpDocumentCreateBotLocaleOutput(&output, shape) 762 if err != nil { 763 var snapshot bytes.Buffer 764 io.Copy(&snapshot, ringBuffer) 765 return out, metadata, &smithy.DeserializationError{ 766 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 767 Snapshot: snapshot.Bytes(), 768 } 769 } 770 771 return out, metadata, err 772} 773 774func awsRestjson1_deserializeOpErrorCreateBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 775 var errorBuffer bytes.Buffer 776 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 777 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 778 } 779 errorBody := bytes.NewReader(errorBuffer.Bytes()) 780 781 errorCode := "UnknownError" 782 errorMessage := errorCode 783 784 code := response.Header.Get("X-Amzn-ErrorType") 785 if len(code) != 0 { 786 errorCode = restjson.SanitizeErrorCode(code) 787 } 788 789 var buff [1024]byte 790 ringBuffer := smithyio.NewRingBuffer(buff[:]) 791 792 body := io.TeeReader(errorBody, ringBuffer) 793 decoder := json.NewDecoder(body) 794 decoder.UseNumber() 795 code, message, err := restjson.GetErrorInfo(decoder) 796 if err != nil { 797 var snapshot bytes.Buffer 798 io.Copy(&snapshot, ringBuffer) 799 err = &smithy.DeserializationError{ 800 Err: fmt.Errorf("failed to decode response body, %w", err), 801 Snapshot: snapshot.Bytes(), 802 } 803 return err 804 } 805 806 errorBody.Seek(0, io.SeekStart) 807 if len(code) != 0 { 808 errorCode = restjson.SanitizeErrorCode(code) 809 } 810 if len(message) != 0 { 811 errorMessage = message 812 } 813 814 switch { 815 case strings.EqualFold("ConflictException", errorCode): 816 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 817 818 case strings.EqualFold("InternalServerException", errorCode): 819 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 820 821 case strings.EqualFold("PreconditionFailedException", errorCode): 822 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 823 824 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 825 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 826 827 case strings.EqualFold("ThrottlingException", errorCode): 828 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 829 830 case strings.EqualFold("ValidationException", errorCode): 831 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 832 833 default: 834 genericError := &smithy.GenericAPIError{ 835 Code: errorCode, 836 Message: errorMessage, 837 } 838 return genericError 839 840 } 841} 842 843func awsRestjson1_deserializeOpDocumentCreateBotLocaleOutput(v **CreateBotLocaleOutput, value interface{}) error { 844 if v == nil { 845 return fmt.Errorf("unexpected nil of type %T", v) 846 } 847 if value == nil { 848 return nil 849 } 850 851 shape, ok := value.(map[string]interface{}) 852 if !ok { 853 return fmt.Errorf("unexpected JSON type %v", value) 854 } 855 856 var sv *CreateBotLocaleOutput 857 if *v == nil { 858 sv = &CreateBotLocaleOutput{} 859 } else { 860 sv = *v 861 } 862 863 for key, value := range shape { 864 switch key { 865 case "botId": 866 if value != nil { 867 jtv, ok := value.(string) 868 if !ok { 869 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 870 } 871 sv.BotId = ptr.String(jtv) 872 } 873 874 case "botLocaleStatus": 875 if value != nil { 876 jtv, ok := value.(string) 877 if !ok { 878 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 879 } 880 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 881 } 882 883 case "botVersion": 884 if value != nil { 885 jtv, ok := value.(string) 886 if !ok { 887 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 888 } 889 sv.BotVersion = ptr.String(jtv) 890 } 891 892 case "creationDateTime": 893 if value != nil { 894 jtv, ok := value.(json.Number) 895 if !ok { 896 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 897 } 898 f64, err := jtv.Float64() 899 if err != nil { 900 return err 901 } 902 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 903 } 904 905 case "description": 906 if value != nil { 907 jtv, ok := value.(string) 908 if !ok { 909 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 910 } 911 sv.Description = ptr.String(jtv) 912 } 913 914 case "localeId": 915 if value != nil { 916 jtv, ok := value.(string) 917 if !ok { 918 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 919 } 920 sv.LocaleId = ptr.String(jtv) 921 } 922 923 case "localeName": 924 if value != nil { 925 jtv, ok := value.(string) 926 if !ok { 927 return fmt.Errorf("expected LocaleName to be of type string, got %T instead", value) 928 } 929 sv.LocaleName = ptr.String(jtv) 930 } 931 932 case "nluIntentConfidenceThreshold": 933 if value != nil { 934 jtv, ok := value.(json.Number) 935 if !ok { 936 return fmt.Errorf("expected ConfidenceThreshold to be json.Number, got %T instead", value) 937 } 938 f64, err := jtv.Float64() 939 if err != nil { 940 return err 941 } 942 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 943 } 944 945 case "voiceSettings": 946 if err := awsRestjson1_deserializeDocumentVoiceSettings(&sv.VoiceSettings, value); err != nil { 947 return err 948 } 949 950 default: 951 _, _ = key, value 952 953 } 954 } 955 *v = sv 956 return nil 957} 958 959type awsRestjson1_deserializeOpCreateBotVersion struct { 960} 961 962func (*awsRestjson1_deserializeOpCreateBotVersion) ID() string { 963 return "OperationDeserializer" 964} 965 966func (m *awsRestjson1_deserializeOpCreateBotVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 967 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 968) { 969 out, metadata, err = next.HandleDeserialize(ctx, in) 970 if err != nil { 971 return out, metadata, err 972 } 973 974 response, ok := out.RawResponse.(*smithyhttp.Response) 975 if !ok { 976 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 977 } 978 979 if response.StatusCode < 200 || response.StatusCode >= 300 { 980 return out, metadata, awsRestjson1_deserializeOpErrorCreateBotVersion(response, &metadata) 981 } 982 output := &CreateBotVersionOutput{} 983 out.Result = output 984 985 var buff [1024]byte 986 ringBuffer := smithyio.NewRingBuffer(buff[:]) 987 988 body := io.TeeReader(response.Body, ringBuffer) 989 990 decoder := json.NewDecoder(body) 991 decoder.UseNumber() 992 var shape interface{} 993 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 994 var snapshot bytes.Buffer 995 io.Copy(&snapshot, ringBuffer) 996 err = &smithy.DeserializationError{ 997 Err: fmt.Errorf("failed to decode response body, %w", err), 998 Snapshot: snapshot.Bytes(), 999 } 1000 return out, metadata, err 1001 } 1002 1003 err = awsRestjson1_deserializeOpDocumentCreateBotVersionOutput(&output, shape) 1004 if err != nil { 1005 var snapshot bytes.Buffer 1006 io.Copy(&snapshot, ringBuffer) 1007 return out, metadata, &smithy.DeserializationError{ 1008 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1009 Snapshot: snapshot.Bytes(), 1010 } 1011 } 1012 1013 return out, metadata, err 1014} 1015 1016func awsRestjson1_deserializeOpErrorCreateBotVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1017 var errorBuffer bytes.Buffer 1018 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1019 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1020 } 1021 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1022 1023 errorCode := "UnknownError" 1024 errorMessage := errorCode 1025 1026 code := response.Header.Get("X-Amzn-ErrorType") 1027 if len(code) != 0 { 1028 errorCode = restjson.SanitizeErrorCode(code) 1029 } 1030 1031 var buff [1024]byte 1032 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1033 1034 body := io.TeeReader(errorBody, ringBuffer) 1035 decoder := json.NewDecoder(body) 1036 decoder.UseNumber() 1037 code, message, err := restjson.GetErrorInfo(decoder) 1038 if err != nil { 1039 var snapshot bytes.Buffer 1040 io.Copy(&snapshot, ringBuffer) 1041 err = &smithy.DeserializationError{ 1042 Err: fmt.Errorf("failed to decode response body, %w", err), 1043 Snapshot: snapshot.Bytes(), 1044 } 1045 return err 1046 } 1047 1048 errorBody.Seek(0, io.SeekStart) 1049 if len(code) != 0 { 1050 errorCode = restjson.SanitizeErrorCode(code) 1051 } 1052 if len(message) != 0 { 1053 errorMessage = message 1054 } 1055 1056 switch { 1057 case strings.EqualFold("ConflictException", errorCode): 1058 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1059 1060 case strings.EqualFold("InternalServerException", errorCode): 1061 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1062 1063 case strings.EqualFold("PreconditionFailedException", errorCode): 1064 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 1065 1066 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1067 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1068 1069 case strings.EqualFold("ThrottlingException", errorCode): 1070 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1071 1072 case strings.EqualFold("ValidationException", errorCode): 1073 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1074 1075 default: 1076 genericError := &smithy.GenericAPIError{ 1077 Code: errorCode, 1078 Message: errorMessage, 1079 } 1080 return genericError 1081 1082 } 1083} 1084 1085func awsRestjson1_deserializeOpDocumentCreateBotVersionOutput(v **CreateBotVersionOutput, value interface{}) error { 1086 if v == nil { 1087 return fmt.Errorf("unexpected nil of type %T", v) 1088 } 1089 if value == nil { 1090 return nil 1091 } 1092 1093 shape, ok := value.(map[string]interface{}) 1094 if !ok { 1095 return fmt.Errorf("unexpected JSON type %v", value) 1096 } 1097 1098 var sv *CreateBotVersionOutput 1099 if *v == nil { 1100 sv = &CreateBotVersionOutput{} 1101 } else { 1102 sv = *v 1103 } 1104 1105 for key, value := range shape { 1106 switch key { 1107 case "botId": 1108 if value != nil { 1109 jtv, ok := value.(string) 1110 if !ok { 1111 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1112 } 1113 sv.BotId = ptr.String(jtv) 1114 } 1115 1116 case "botStatus": 1117 if value != nil { 1118 jtv, ok := value.(string) 1119 if !ok { 1120 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 1121 } 1122 sv.BotStatus = types.BotStatus(jtv) 1123 } 1124 1125 case "botVersion": 1126 if value != nil { 1127 jtv, ok := value.(string) 1128 if !ok { 1129 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 1130 } 1131 sv.BotVersion = ptr.String(jtv) 1132 } 1133 1134 case "botVersionLocaleSpecification": 1135 if err := awsRestjson1_deserializeDocumentBotVersionLocaleSpecification(&sv.BotVersionLocaleSpecification, value); err != nil { 1136 return err 1137 } 1138 1139 case "creationDateTime": 1140 if value != nil { 1141 jtv, ok := value.(json.Number) 1142 if !ok { 1143 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 1144 } 1145 f64, err := jtv.Float64() 1146 if err != nil { 1147 return err 1148 } 1149 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1150 } 1151 1152 case "description": 1153 if value != nil { 1154 jtv, ok := value.(string) 1155 if !ok { 1156 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 1157 } 1158 sv.Description = ptr.String(jtv) 1159 } 1160 1161 default: 1162 _, _ = key, value 1163 1164 } 1165 } 1166 *v = sv 1167 return nil 1168} 1169 1170type awsRestjson1_deserializeOpCreateIntent struct { 1171} 1172 1173func (*awsRestjson1_deserializeOpCreateIntent) ID() string { 1174 return "OperationDeserializer" 1175} 1176 1177func (m *awsRestjson1_deserializeOpCreateIntent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1178 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1179) { 1180 out, metadata, err = next.HandleDeserialize(ctx, in) 1181 if err != nil { 1182 return out, metadata, err 1183 } 1184 1185 response, ok := out.RawResponse.(*smithyhttp.Response) 1186 if !ok { 1187 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1188 } 1189 1190 if response.StatusCode < 200 || response.StatusCode >= 300 { 1191 return out, metadata, awsRestjson1_deserializeOpErrorCreateIntent(response, &metadata) 1192 } 1193 output := &CreateIntentOutput{} 1194 out.Result = output 1195 1196 var buff [1024]byte 1197 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1198 1199 body := io.TeeReader(response.Body, ringBuffer) 1200 1201 decoder := json.NewDecoder(body) 1202 decoder.UseNumber() 1203 var shape interface{} 1204 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1205 var snapshot bytes.Buffer 1206 io.Copy(&snapshot, ringBuffer) 1207 err = &smithy.DeserializationError{ 1208 Err: fmt.Errorf("failed to decode response body, %w", err), 1209 Snapshot: snapshot.Bytes(), 1210 } 1211 return out, metadata, err 1212 } 1213 1214 err = awsRestjson1_deserializeOpDocumentCreateIntentOutput(&output, shape) 1215 if err != nil { 1216 var snapshot bytes.Buffer 1217 io.Copy(&snapshot, ringBuffer) 1218 return out, metadata, &smithy.DeserializationError{ 1219 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1220 Snapshot: snapshot.Bytes(), 1221 } 1222 } 1223 1224 return out, metadata, err 1225} 1226 1227func awsRestjson1_deserializeOpErrorCreateIntent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1228 var errorBuffer bytes.Buffer 1229 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1230 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1231 } 1232 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1233 1234 errorCode := "UnknownError" 1235 errorMessage := errorCode 1236 1237 code := response.Header.Get("X-Amzn-ErrorType") 1238 if len(code) != 0 { 1239 errorCode = restjson.SanitizeErrorCode(code) 1240 } 1241 1242 var buff [1024]byte 1243 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1244 1245 body := io.TeeReader(errorBody, ringBuffer) 1246 decoder := json.NewDecoder(body) 1247 decoder.UseNumber() 1248 code, message, err := restjson.GetErrorInfo(decoder) 1249 if err != nil { 1250 var snapshot bytes.Buffer 1251 io.Copy(&snapshot, ringBuffer) 1252 err = &smithy.DeserializationError{ 1253 Err: fmt.Errorf("failed to decode response body, %w", err), 1254 Snapshot: snapshot.Bytes(), 1255 } 1256 return err 1257 } 1258 1259 errorBody.Seek(0, io.SeekStart) 1260 if len(code) != 0 { 1261 errorCode = restjson.SanitizeErrorCode(code) 1262 } 1263 if len(message) != 0 { 1264 errorMessage = message 1265 } 1266 1267 switch { 1268 case strings.EqualFold("ConflictException", errorCode): 1269 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1270 1271 case strings.EqualFold("InternalServerException", errorCode): 1272 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1273 1274 case strings.EqualFold("PreconditionFailedException", errorCode): 1275 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 1276 1277 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1278 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1279 1280 case strings.EqualFold("ThrottlingException", errorCode): 1281 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1282 1283 case strings.EqualFold("ValidationException", errorCode): 1284 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1285 1286 default: 1287 genericError := &smithy.GenericAPIError{ 1288 Code: errorCode, 1289 Message: errorMessage, 1290 } 1291 return genericError 1292 1293 } 1294} 1295 1296func awsRestjson1_deserializeOpDocumentCreateIntentOutput(v **CreateIntentOutput, value interface{}) error { 1297 if v == nil { 1298 return fmt.Errorf("unexpected nil of type %T", v) 1299 } 1300 if value == nil { 1301 return nil 1302 } 1303 1304 shape, ok := value.(map[string]interface{}) 1305 if !ok { 1306 return fmt.Errorf("unexpected JSON type %v", value) 1307 } 1308 1309 var sv *CreateIntentOutput 1310 if *v == nil { 1311 sv = &CreateIntentOutput{} 1312 } else { 1313 sv = *v 1314 } 1315 1316 for key, value := range shape { 1317 switch key { 1318 case "botId": 1319 if value != nil { 1320 jtv, ok := value.(string) 1321 if !ok { 1322 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1323 } 1324 sv.BotId = ptr.String(jtv) 1325 } 1326 1327 case "botVersion": 1328 if value != nil { 1329 jtv, ok := value.(string) 1330 if !ok { 1331 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 1332 } 1333 sv.BotVersion = ptr.String(jtv) 1334 } 1335 1336 case "creationDateTime": 1337 if value != nil { 1338 jtv, ok := value.(json.Number) 1339 if !ok { 1340 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 1341 } 1342 f64, err := jtv.Float64() 1343 if err != nil { 1344 return err 1345 } 1346 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1347 } 1348 1349 case "description": 1350 if value != nil { 1351 jtv, ok := value.(string) 1352 if !ok { 1353 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 1354 } 1355 sv.Description = ptr.String(jtv) 1356 } 1357 1358 case "dialogCodeHook": 1359 if err := awsRestjson1_deserializeDocumentDialogCodeHookSettings(&sv.DialogCodeHook, value); err != nil { 1360 return err 1361 } 1362 1363 case "fulfillmentCodeHook": 1364 if err := awsRestjson1_deserializeDocumentFulfillmentCodeHookSettings(&sv.FulfillmentCodeHook, value); err != nil { 1365 return err 1366 } 1367 1368 case "inputContexts": 1369 if err := awsRestjson1_deserializeDocumentInputContextsList(&sv.InputContexts, value); err != nil { 1370 return err 1371 } 1372 1373 case "intentClosingSetting": 1374 if err := awsRestjson1_deserializeDocumentIntentClosingSetting(&sv.IntentClosingSetting, value); err != nil { 1375 return err 1376 } 1377 1378 case "intentConfirmationSetting": 1379 if err := awsRestjson1_deserializeDocumentIntentConfirmationSetting(&sv.IntentConfirmationSetting, value); err != nil { 1380 return err 1381 } 1382 1383 case "intentId": 1384 if value != nil { 1385 jtv, ok := value.(string) 1386 if !ok { 1387 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1388 } 1389 sv.IntentId = ptr.String(jtv) 1390 } 1391 1392 case "intentName": 1393 if value != nil { 1394 jtv, ok := value.(string) 1395 if !ok { 1396 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1397 } 1398 sv.IntentName = ptr.String(jtv) 1399 } 1400 1401 case "kendraConfiguration": 1402 if err := awsRestjson1_deserializeDocumentKendraConfiguration(&sv.KendraConfiguration, value); err != nil { 1403 return err 1404 } 1405 1406 case "localeId": 1407 if value != nil { 1408 jtv, ok := value.(string) 1409 if !ok { 1410 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 1411 } 1412 sv.LocaleId = ptr.String(jtv) 1413 } 1414 1415 case "outputContexts": 1416 if err := awsRestjson1_deserializeDocumentOutputContextsList(&sv.OutputContexts, value); err != nil { 1417 return err 1418 } 1419 1420 case "parentIntentSignature": 1421 if value != nil { 1422 jtv, ok := value.(string) 1423 if !ok { 1424 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 1425 } 1426 sv.ParentIntentSignature = ptr.String(jtv) 1427 } 1428 1429 case "sampleUtterances": 1430 if err := awsRestjson1_deserializeDocumentSampleUtterancesList(&sv.SampleUtterances, value); err != nil { 1431 return err 1432 } 1433 1434 default: 1435 _, _ = key, value 1436 1437 } 1438 } 1439 *v = sv 1440 return nil 1441} 1442 1443type awsRestjson1_deserializeOpCreateSlot struct { 1444} 1445 1446func (*awsRestjson1_deserializeOpCreateSlot) ID() string { 1447 return "OperationDeserializer" 1448} 1449 1450func (m *awsRestjson1_deserializeOpCreateSlot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1451 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1452) { 1453 out, metadata, err = next.HandleDeserialize(ctx, in) 1454 if err != nil { 1455 return out, metadata, err 1456 } 1457 1458 response, ok := out.RawResponse.(*smithyhttp.Response) 1459 if !ok { 1460 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1461 } 1462 1463 if response.StatusCode < 200 || response.StatusCode >= 300 { 1464 return out, metadata, awsRestjson1_deserializeOpErrorCreateSlot(response, &metadata) 1465 } 1466 output := &CreateSlotOutput{} 1467 out.Result = output 1468 1469 var buff [1024]byte 1470 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1471 1472 body := io.TeeReader(response.Body, ringBuffer) 1473 1474 decoder := json.NewDecoder(body) 1475 decoder.UseNumber() 1476 var shape interface{} 1477 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1478 var snapshot bytes.Buffer 1479 io.Copy(&snapshot, ringBuffer) 1480 err = &smithy.DeserializationError{ 1481 Err: fmt.Errorf("failed to decode response body, %w", err), 1482 Snapshot: snapshot.Bytes(), 1483 } 1484 return out, metadata, err 1485 } 1486 1487 err = awsRestjson1_deserializeOpDocumentCreateSlotOutput(&output, shape) 1488 if err != nil { 1489 var snapshot bytes.Buffer 1490 io.Copy(&snapshot, ringBuffer) 1491 return out, metadata, &smithy.DeserializationError{ 1492 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1493 Snapshot: snapshot.Bytes(), 1494 } 1495 } 1496 1497 return out, metadata, err 1498} 1499 1500func awsRestjson1_deserializeOpErrorCreateSlot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1501 var errorBuffer bytes.Buffer 1502 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1503 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1504 } 1505 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1506 1507 errorCode := "UnknownError" 1508 errorMessage := errorCode 1509 1510 code := response.Header.Get("X-Amzn-ErrorType") 1511 if len(code) != 0 { 1512 errorCode = restjson.SanitizeErrorCode(code) 1513 } 1514 1515 var buff [1024]byte 1516 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1517 1518 body := io.TeeReader(errorBody, ringBuffer) 1519 decoder := json.NewDecoder(body) 1520 decoder.UseNumber() 1521 code, message, err := restjson.GetErrorInfo(decoder) 1522 if err != nil { 1523 var snapshot bytes.Buffer 1524 io.Copy(&snapshot, ringBuffer) 1525 err = &smithy.DeserializationError{ 1526 Err: fmt.Errorf("failed to decode response body, %w", err), 1527 Snapshot: snapshot.Bytes(), 1528 } 1529 return err 1530 } 1531 1532 errorBody.Seek(0, io.SeekStart) 1533 if len(code) != 0 { 1534 errorCode = restjson.SanitizeErrorCode(code) 1535 } 1536 if len(message) != 0 { 1537 errorMessage = message 1538 } 1539 1540 switch { 1541 case strings.EqualFold("ConflictException", errorCode): 1542 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1543 1544 case strings.EqualFold("InternalServerException", errorCode): 1545 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1546 1547 case strings.EqualFold("PreconditionFailedException", errorCode): 1548 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 1549 1550 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1551 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1552 1553 case strings.EqualFold("ThrottlingException", errorCode): 1554 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1555 1556 case strings.EqualFold("ValidationException", errorCode): 1557 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1558 1559 default: 1560 genericError := &smithy.GenericAPIError{ 1561 Code: errorCode, 1562 Message: errorMessage, 1563 } 1564 return genericError 1565 1566 } 1567} 1568 1569func awsRestjson1_deserializeOpDocumentCreateSlotOutput(v **CreateSlotOutput, value interface{}) error { 1570 if v == nil { 1571 return fmt.Errorf("unexpected nil of type %T", v) 1572 } 1573 if value == nil { 1574 return nil 1575 } 1576 1577 shape, ok := value.(map[string]interface{}) 1578 if !ok { 1579 return fmt.Errorf("unexpected JSON type %v", value) 1580 } 1581 1582 var sv *CreateSlotOutput 1583 if *v == nil { 1584 sv = &CreateSlotOutput{} 1585 } else { 1586 sv = *v 1587 } 1588 1589 for key, value := range shape { 1590 switch key { 1591 case "botId": 1592 if value != nil { 1593 jtv, ok := value.(string) 1594 if !ok { 1595 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1596 } 1597 sv.BotId = ptr.String(jtv) 1598 } 1599 1600 case "botVersion": 1601 if value != nil { 1602 jtv, ok := value.(string) 1603 if !ok { 1604 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 1605 } 1606 sv.BotVersion = ptr.String(jtv) 1607 } 1608 1609 case "creationDateTime": 1610 if value != nil { 1611 jtv, ok := value.(json.Number) 1612 if !ok { 1613 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 1614 } 1615 f64, err := jtv.Float64() 1616 if err != nil { 1617 return err 1618 } 1619 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1620 } 1621 1622 case "description": 1623 if value != nil { 1624 jtv, ok := value.(string) 1625 if !ok { 1626 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 1627 } 1628 sv.Description = ptr.String(jtv) 1629 } 1630 1631 case "intentId": 1632 if value != nil { 1633 jtv, ok := value.(string) 1634 if !ok { 1635 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1636 } 1637 sv.IntentId = ptr.String(jtv) 1638 } 1639 1640 case "localeId": 1641 if value != nil { 1642 jtv, ok := value.(string) 1643 if !ok { 1644 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 1645 } 1646 sv.LocaleId = ptr.String(jtv) 1647 } 1648 1649 case "obfuscationSetting": 1650 if err := awsRestjson1_deserializeDocumentObfuscationSetting(&sv.ObfuscationSetting, value); err != nil { 1651 return err 1652 } 1653 1654 case "slotId": 1655 if value != nil { 1656 jtv, ok := value.(string) 1657 if !ok { 1658 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1659 } 1660 sv.SlotId = ptr.String(jtv) 1661 } 1662 1663 case "slotName": 1664 if value != nil { 1665 jtv, ok := value.(string) 1666 if !ok { 1667 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1668 } 1669 sv.SlotName = ptr.String(jtv) 1670 } 1671 1672 case "slotTypeId": 1673 if value != nil { 1674 jtv, ok := value.(string) 1675 if !ok { 1676 return fmt.Errorf("expected BuiltInOrCustomSlotTypeId to be of type string, got %T instead", value) 1677 } 1678 sv.SlotTypeId = ptr.String(jtv) 1679 } 1680 1681 case "valueElicitationSetting": 1682 if err := awsRestjson1_deserializeDocumentSlotValueElicitationSetting(&sv.ValueElicitationSetting, value); err != nil { 1683 return err 1684 } 1685 1686 default: 1687 _, _ = key, value 1688 1689 } 1690 } 1691 *v = sv 1692 return nil 1693} 1694 1695type awsRestjson1_deserializeOpCreateSlotType struct { 1696} 1697 1698func (*awsRestjson1_deserializeOpCreateSlotType) ID() string { 1699 return "OperationDeserializer" 1700} 1701 1702func (m *awsRestjson1_deserializeOpCreateSlotType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1703 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1704) { 1705 out, metadata, err = next.HandleDeserialize(ctx, in) 1706 if err != nil { 1707 return out, metadata, err 1708 } 1709 1710 response, ok := out.RawResponse.(*smithyhttp.Response) 1711 if !ok { 1712 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1713 } 1714 1715 if response.StatusCode < 200 || response.StatusCode >= 300 { 1716 return out, metadata, awsRestjson1_deserializeOpErrorCreateSlotType(response, &metadata) 1717 } 1718 output := &CreateSlotTypeOutput{} 1719 out.Result = output 1720 1721 var buff [1024]byte 1722 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1723 1724 body := io.TeeReader(response.Body, ringBuffer) 1725 1726 decoder := json.NewDecoder(body) 1727 decoder.UseNumber() 1728 var shape interface{} 1729 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1730 var snapshot bytes.Buffer 1731 io.Copy(&snapshot, ringBuffer) 1732 err = &smithy.DeserializationError{ 1733 Err: fmt.Errorf("failed to decode response body, %w", err), 1734 Snapshot: snapshot.Bytes(), 1735 } 1736 return out, metadata, err 1737 } 1738 1739 err = awsRestjson1_deserializeOpDocumentCreateSlotTypeOutput(&output, shape) 1740 if err != nil { 1741 var snapshot bytes.Buffer 1742 io.Copy(&snapshot, ringBuffer) 1743 return out, metadata, &smithy.DeserializationError{ 1744 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1745 Snapshot: snapshot.Bytes(), 1746 } 1747 } 1748 1749 return out, metadata, err 1750} 1751 1752func awsRestjson1_deserializeOpErrorCreateSlotType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1753 var errorBuffer bytes.Buffer 1754 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1755 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1756 } 1757 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1758 1759 errorCode := "UnknownError" 1760 errorMessage := errorCode 1761 1762 code := response.Header.Get("X-Amzn-ErrorType") 1763 if len(code) != 0 { 1764 errorCode = restjson.SanitizeErrorCode(code) 1765 } 1766 1767 var buff [1024]byte 1768 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1769 1770 body := io.TeeReader(errorBody, ringBuffer) 1771 decoder := json.NewDecoder(body) 1772 decoder.UseNumber() 1773 code, message, err := restjson.GetErrorInfo(decoder) 1774 if err != nil { 1775 var snapshot bytes.Buffer 1776 io.Copy(&snapshot, ringBuffer) 1777 err = &smithy.DeserializationError{ 1778 Err: fmt.Errorf("failed to decode response body, %w", err), 1779 Snapshot: snapshot.Bytes(), 1780 } 1781 return err 1782 } 1783 1784 errorBody.Seek(0, io.SeekStart) 1785 if len(code) != 0 { 1786 errorCode = restjson.SanitizeErrorCode(code) 1787 } 1788 if len(message) != 0 { 1789 errorMessage = message 1790 } 1791 1792 switch { 1793 case strings.EqualFold("ConflictException", errorCode): 1794 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 1795 1796 case strings.EqualFold("InternalServerException", errorCode): 1797 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1798 1799 case strings.EqualFold("PreconditionFailedException", errorCode): 1800 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 1801 1802 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 1803 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 1804 1805 case strings.EqualFold("ThrottlingException", errorCode): 1806 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1807 1808 case strings.EqualFold("ValidationException", errorCode): 1809 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1810 1811 default: 1812 genericError := &smithy.GenericAPIError{ 1813 Code: errorCode, 1814 Message: errorMessage, 1815 } 1816 return genericError 1817 1818 } 1819} 1820 1821func awsRestjson1_deserializeOpDocumentCreateSlotTypeOutput(v **CreateSlotTypeOutput, value interface{}) error { 1822 if v == nil { 1823 return fmt.Errorf("unexpected nil of type %T", v) 1824 } 1825 if value == nil { 1826 return nil 1827 } 1828 1829 shape, ok := value.(map[string]interface{}) 1830 if !ok { 1831 return fmt.Errorf("unexpected JSON type %v", value) 1832 } 1833 1834 var sv *CreateSlotTypeOutput 1835 if *v == nil { 1836 sv = &CreateSlotTypeOutput{} 1837 } else { 1838 sv = *v 1839 } 1840 1841 for key, value := range shape { 1842 switch key { 1843 case "botId": 1844 if value != nil { 1845 jtv, ok := value.(string) 1846 if !ok { 1847 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1848 } 1849 sv.BotId = ptr.String(jtv) 1850 } 1851 1852 case "botVersion": 1853 if value != nil { 1854 jtv, ok := value.(string) 1855 if !ok { 1856 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 1857 } 1858 sv.BotVersion = ptr.String(jtv) 1859 } 1860 1861 case "creationDateTime": 1862 if value != nil { 1863 jtv, ok := value.(json.Number) 1864 if !ok { 1865 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 1866 } 1867 f64, err := jtv.Float64() 1868 if err != nil { 1869 return err 1870 } 1871 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1872 } 1873 1874 case "description": 1875 if value != nil { 1876 jtv, ok := value.(string) 1877 if !ok { 1878 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 1879 } 1880 sv.Description = ptr.String(jtv) 1881 } 1882 1883 case "localeId": 1884 if value != nil { 1885 jtv, ok := value.(string) 1886 if !ok { 1887 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 1888 } 1889 sv.LocaleId = ptr.String(jtv) 1890 } 1891 1892 case "parentSlotTypeSignature": 1893 if value != nil { 1894 jtv, ok := value.(string) 1895 if !ok { 1896 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 1897 } 1898 sv.ParentSlotTypeSignature = ptr.String(jtv) 1899 } 1900 1901 case "slotTypeId": 1902 if value != nil { 1903 jtv, ok := value.(string) 1904 if !ok { 1905 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 1906 } 1907 sv.SlotTypeId = ptr.String(jtv) 1908 } 1909 1910 case "slotTypeName": 1911 if value != nil { 1912 jtv, ok := value.(string) 1913 if !ok { 1914 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 1915 } 1916 sv.SlotTypeName = ptr.String(jtv) 1917 } 1918 1919 case "slotTypeValues": 1920 if err := awsRestjson1_deserializeDocumentSlotTypeValues(&sv.SlotTypeValues, value); err != nil { 1921 return err 1922 } 1923 1924 case "valueSelectionSetting": 1925 if err := awsRestjson1_deserializeDocumentSlotValueSelectionSetting(&sv.ValueSelectionSetting, value); err != nil { 1926 return err 1927 } 1928 1929 default: 1930 _, _ = key, value 1931 1932 } 1933 } 1934 *v = sv 1935 return nil 1936} 1937 1938type awsRestjson1_deserializeOpDeleteBot struct { 1939} 1940 1941func (*awsRestjson1_deserializeOpDeleteBot) ID() string { 1942 return "OperationDeserializer" 1943} 1944 1945func (m *awsRestjson1_deserializeOpDeleteBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1946 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1947) { 1948 out, metadata, err = next.HandleDeserialize(ctx, in) 1949 if err != nil { 1950 return out, metadata, err 1951 } 1952 1953 response, ok := out.RawResponse.(*smithyhttp.Response) 1954 if !ok { 1955 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1956 } 1957 1958 if response.StatusCode < 200 || response.StatusCode >= 300 { 1959 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBot(response, &metadata) 1960 } 1961 output := &DeleteBotOutput{} 1962 out.Result = output 1963 1964 var buff [1024]byte 1965 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1966 1967 body := io.TeeReader(response.Body, ringBuffer) 1968 1969 decoder := json.NewDecoder(body) 1970 decoder.UseNumber() 1971 var shape interface{} 1972 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1973 var snapshot bytes.Buffer 1974 io.Copy(&snapshot, ringBuffer) 1975 err = &smithy.DeserializationError{ 1976 Err: fmt.Errorf("failed to decode response body, %w", err), 1977 Snapshot: snapshot.Bytes(), 1978 } 1979 return out, metadata, err 1980 } 1981 1982 err = awsRestjson1_deserializeOpDocumentDeleteBotOutput(&output, shape) 1983 if err != nil { 1984 var snapshot bytes.Buffer 1985 io.Copy(&snapshot, ringBuffer) 1986 return out, metadata, &smithy.DeserializationError{ 1987 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1988 Snapshot: snapshot.Bytes(), 1989 } 1990 } 1991 1992 return out, metadata, err 1993} 1994 1995func awsRestjson1_deserializeOpErrorDeleteBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1996 var errorBuffer bytes.Buffer 1997 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1998 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1999 } 2000 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2001 2002 errorCode := "UnknownError" 2003 errorMessage := errorCode 2004 2005 code := response.Header.Get("X-Amzn-ErrorType") 2006 if len(code) != 0 { 2007 errorCode = restjson.SanitizeErrorCode(code) 2008 } 2009 2010 var buff [1024]byte 2011 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2012 2013 body := io.TeeReader(errorBody, ringBuffer) 2014 decoder := json.NewDecoder(body) 2015 decoder.UseNumber() 2016 code, message, err := restjson.GetErrorInfo(decoder) 2017 if err != nil { 2018 var snapshot bytes.Buffer 2019 io.Copy(&snapshot, ringBuffer) 2020 err = &smithy.DeserializationError{ 2021 Err: fmt.Errorf("failed to decode response body, %w", err), 2022 Snapshot: snapshot.Bytes(), 2023 } 2024 return err 2025 } 2026 2027 errorBody.Seek(0, io.SeekStart) 2028 if len(code) != 0 { 2029 errorCode = restjson.SanitizeErrorCode(code) 2030 } 2031 if len(message) != 0 { 2032 errorMessage = message 2033 } 2034 2035 switch { 2036 case strings.EqualFold("ConflictException", errorCode): 2037 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2038 2039 case strings.EqualFold("InternalServerException", errorCode): 2040 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2041 2042 case strings.EqualFold("PreconditionFailedException", errorCode): 2043 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2044 2045 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2046 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2047 2048 case strings.EqualFold("ThrottlingException", errorCode): 2049 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2050 2051 case strings.EqualFold("ValidationException", errorCode): 2052 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2053 2054 default: 2055 genericError := &smithy.GenericAPIError{ 2056 Code: errorCode, 2057 Message: errorMessage, 2058 } 2059 return genericError 2060 2061 } 2062} 2063 2064func awsRestjson1_deserializeOpDocumentDeleteBotOutput(v **DeleteBotOutput, value interface{}) error { 2065 if v == nil { 2066 return fmt.Errorf("unexpected nil of type %T", v) 2067 } 2068 if value == nil { 2069 return nil 2070 } 2071 2072 shape, ok := value.(map[string]interface{}) 2073 if !ok { 2074 return fmt.Errorf("unexpected JSON type %v", value) 2075 } 2076 2077 var sv *DeleteBotOutput 2078 if *v == nil { 2079 sv = &DeleteBotOutput{} 2080 } else { 2081 sv = *v 2082 } 2083 2084 for key, value := range shape { 2085 switch key { 2086 case "botId": 2087 if value != nil { 2088 jtv, ok := value.(string) 2089 if !ok { 2090 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2091 } 2092 sv.BotId = ptr.String(jtv) 2093 } 2094 2095 case "botStatus": 2096 if value != nil { 2097 jtv, ok := value.(string) 2098 if !ok { 2099 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 2100 } 2101 sv.BotStatus = types.BotStatus(jtv) 2102 } 2103 2104 default: 2105 _, _ = key, value 2106 2107 } 2108 } 2109 *v = sv 2110 return nil 2111} 2112 2113type awsRestjson1_deserializeOpDeleteBotAlias struct { 2114} 2115 2116func (*awsRestjson1_deserializeOpDeleteBotAlias) ID() string { 2117 return "OperationDeserializer" 2118} 2119 2120func (m *awsRestjson1_deserializeOpDeleteBotAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2121 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2122) { 2123 out, metadata, err = next.HandleDeserialize(ctx, in) 2124 if err != nil { 2125 return out, metadata, err 2126 } 2127 2128 response, ok := out.RawResponse.(*smithyhttp.Response) 2129 if !ok { 2130 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2131 } 2132 2133 if response.StatusCode < 200 || response.StatusCode >= 300 { 2134 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBotAlias(response, &metadata) 2135 } 2136 output := &DeleteBotAliasOutput{} 2137 out.Result = output 2138 2139 var buff [1024]byte 2140 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2141 2142 body := io.TeeReader(response.Body, ringBuffer) 2143 2144 decoder := json.NewDecoder(body) 2145 decoder.UseNumber() 2146 var shape interface{} 2147 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2148 var snapshot bytes.Buffer 2149 io.Copy(&snapshot, ringBuffer) 2150 err = &smithy.DeserializationError{ 2151 Err: fmt.Errorf("failed to decode response body, %w", err), 2152 Snapshot: snapshot.Bytes(), 2153 } 2154 return out, metadata, err 2155 } 2156 2157 err = awsRestjson1_deserializeOpDocumentDeleteBotAliasOutput(&output, shape) 2158 if err != nil { 2159 var snapshot bytes.Buffer 2160 io.Copy(&snapshot, ringBuffer) 2161 return out, metadata, &smithy.DeserializationError{ 2162 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2163 Snapshot: snapshot.Bytes(), 2164 } 2165 } 2166 2167 return out, metadata, err 2168} 2169 2170func awsRestjson1_deserializeOpErrorDeleteBotAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2171 var errorBuffer bytes.Buffer 2172 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2173 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2174 } 2175 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2176 2177 errorCode := "UnknownError" 2178 errorMessage := errorCode 2179 2180 code := response.Header.Get("X-Amzn-ErrorType") 2181 if len(code) != 0 { 2182 errorCode = restjson.SanitizeErrorCode(code) 2183 } 2184 2185 var buff [1024]byte 2186 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2187 2188 body := io.TeeReader(errorBody, ringBuffer) 2189 decoder := json.NewDecoder(body) 2190 decoder.UseNumber() 2191 code, message, err := restjson.GetErrorInfo(decoder) 2192 if err != nil { 2193 var snapshot bytes.Buffer 2194 io.Copy(&snapshot, ringBuffer) 2195 err = &smithy.DeserializationError{ 2196 Err: fmt.Errorf("failed to decode response body, %w", err), 2197 Snapshot: snapshot.Bytes(), 2198 } 2199 return err 2200 } 2201 2202 errorBody.Seek(0, io.SeekStart) 2203 if len(code) != 0 { 2204 errorCode = restjson.SanitizeErrorCode(code) 2205 } 2206 if len(message) != 0 { 2207 errorMessage = message 2208 } 2209 2210 switch { 2211 case strings.EqualFold("ConflictException", errorCode): 2212 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2213 2214 case strings.EqualFold("InternalServerException", errorCode): 2215 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2216 2217 case strings.EqualFold("PreconditionFailedException", errorCode): 2218 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2219 2220 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2221 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2222 2223 case strings.EqualFold("ThrottlingException", errorCode): 2224 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2225 2226 case strings.EqualFold("ValidationException", errorCode): 2227 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2228 2229 default: 2230 genericError := &smithy.GenericAPIError{ 2231 Code: errorCode, 2232 Message: errorMessage, 2233 } 2234 return genericError 2235 2236 } 2237} 2238 2239func awsRestjson1_deserializeOpDocumentDeleteBotAliasOutput(v **DeleteBotAliasOutput, value interface{}) error { 2240 if v == nil { 2241 return fmt.Errorf("unexpected nil of type %T", v) 2242 } 2243 if value == nil { 2244 return nil 2245 } 2246 2247 shape, ok := value.(map[string]interface{}) 2248 if !ok { 2249 return fmt.Errorf("unexpected JSON type %v", value) 2250 } 2251 2252 var sv *DeleteBotAliasOutput 2253 if *v == nil { 2254 sv = &DeleteBotAliasOutput{} 2255 } else { 2256 sv = *v 2257 } 2258 2259 for key, value := range shape { 2260 switch key { 2261 case "botAliasId": 2262 if value != nil { 2263 jtv, ok := value.(string) 2264 if !ok { 2265 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 2266 } 2267 sv.BotAliasId = ptr.String(jtv) 2268 } 2269 2270 case "botAliasStatus": 2271 if value != nil { 2272 jtv, ok := value.(string) 2273 if !ok { 2274 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 2275 } 2276 sv.BotAliasStatus = types.BotAliasStatus(jtv) 2277 } 2278 2279 case "botId": 2280 if value != nil { 2281 jtv, ok := value.(string) 2282 if !ok { 2283 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2284 } 2285 sv.BotId = ptr.String(jtv) 2286 } 2287 2288 default: 2289 _, _ = key, value 2290 2291 } 2292 } 2293 *v = sv 2294 return nil 2295} 2296 2297type awsRestjson1_deserializeOpDeleteBotLocale struct { 2298} 2299 2300func (*awsRestjson1_deserializeOpDeleteBotLocale) ID() string { 2301 return "OperationDeserializer" 2302} 2303 2304func (m *awsRestjson1_deserializeOpDeleteBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2305 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2306) { 2307 out, metadata, err = next.HandleDeserialize(ctx, in) 2308 if err != nil { 2309 return out, metadata, err 2310 } 2311 2312 response, ok := out.RawResponse.(*smithyhttp.Response) 2313 if !ok { 2314 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2315 } 2316 2317 if response.StatusCode < 200 || response.StatusCode >= 300 { 2318 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBotLocale(response, &metadata) 2319 } 2320 output := &DeleteBotLocaleOutput{} 2321 out.Result = output 2322 2323 var buff [1024]byte 2324 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2325 2326 body := io.TeeReader(response.Body, ringBuffer) 2327 2328 decoder := json.NewDecoder(body) 2329 decoder.UseNumber() 2330 var shape interface{} 2331 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2332 var snapshot bytes.Buffer 2333 io.Copy(&snapshot, ringBuffer) 2334 err = &smithy.DeserializationError{ 2335 Err: fmt.Errorf("failed to decode response body, %w", err), 2336 Snapshot: snapshot.Bytes(), 2337 } 2338 return out, metadata, err 2339 } 2340 2341 err = awsRestjson1_deserializeOpDocumentDeleteBotLocaleOutput(&output, shape) 2342 if err != nil { 2343 var snapshot bytes.Buffer 2344 io.Copy(&snapshot, ringBuffer) 2345 return out, metadata, &smithy.DeserializationError{ 2346 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2347 Snapshot: snapshot.Bytes(), 2348 } 2349 } 2350 2351 return out, metadata, err 2352} 2353 2354func awsRestjson1_deserializeOpErrorDeleteBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2355 var errorBuffer bytes.Buffer 2356 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2357 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2358 } 2359 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2360 2361 errorCode := "UnknownError" 2362 errorMessage := errorCode 2363 2364 code := response.Header.Get("X-Amzn-ErrorType") 2365 if len(code) != 0 { 2366 errorCode = restjson.SanitizeErrorCode(code) 2367 } 2368 2369 var buff [1024]byte 2370 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2371 2372 body := io.TeeReader(errorBody, ringBuffer) 2373 decoder := json.NewDecoder(body) 2374 decoder.UseNumber() 2375 code, message, err := restjson.GetErrorInfo(decoder) 2376 if err != nil { 2377 var snapshot bytes.Buffer 2378 io.Copy(&snapshot, ringBuffer) 2379 err = &smithy.DeserializationError{ 2380 Err: fmt.Errorf("failed to decode response body, %w", err), 2381 Snapshot: snapshot.Bytes(), 2382 } 2383 return err 2384 } 2385 2386 errorBody.Seek(0, io.SeekStart) 2387 if len(code) != 0 { 2388 errorCode = restjson.SanitizeErrorCode(code) 2389 } 2390 if len(message) != 0 { 2391 errorMessage = message 2392 } 2393 2394 switch { 2395 case strings.EqualFold("ConflictException", errorCode): 2396 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2397 2398 case strings.EqualFold("InternalServerException", errorCode): 2399 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2400 2401 case strings.EqualFold("PreconditionFailedException", errorCode): 2402 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2403 2404 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2405 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2406 2407 case strings.EqualFold("ThrottlingException", errorCode): 2408 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2409 2410 case strings.EqualFold("ValidationException", errorCode): 2411 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2412 2413 default: 2414 genericError := &smithy.GenericAPIError{ 2415 Code: errorCode, 2416 Message: errorMessage, 2417 } 2418 return genericError 2419 2420 } 2421} 2422 2423func awsRestjson1_deserializeOpDocumentDeleteBotLocaleOutput(v **DeleteBotLocaleOutput, value interface{}) error { 2424 if v == nil { 2425 return fmt.Errorf("unexpected nil of type %T", v) 2426 } 2427 if value == nil { 2428 return nil 2429 } 2430 2431 shape, ok := value.(map[string]interface{}) 2432 if !ok { 2433 return fmt.Errorf("unexpected JSON type %v", value) 2434 } 2435 2436 var sv *DeleteBotLocaleOutput 2437 if *v == nil { 2438 sv = &DeleteBotLocaleOutput{} 2439 } else { 2440 sv = *v 2441 } 2442 2443 for key, value := range shape { 2444 switch key { 2445 case "botId": 2446 if value != nil { 2447 jtv, ok := value.(string) 2448 if !ok { 2449 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2450 } 2451 sv.BotId = ptr.String(jtv) 2452 } 2453 2454 case "botLocaleStatus": 2455 if value != nil { 2456 jtv, ok := value.(string) 2457 if !ok { 2458 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 2459 } 2460 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 2461 } 2462 2463 case "botVersion": 2464 if value != nil { 2465 jtv, ok := value.(string) 2466 if !ok { 2467 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 2468 } 2469 sv.BotVersion = ptr.String(jtv) 2470 } 2471 2472 case "localeId": 2473 if value != nil { 2474 jtv, ok := value.(string) 2475 if !ok { 2476 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 2477 } 2478 sv.LocaleId = ptr.String(jtv) 2479 } 2480 2481 default: 2482 _, _ = key, value 2483 2484 } 2485 } 2486 *v = sv 2487 return nil 2488} 2489 2490type awsRestjson1_deserializeOpDeleteBotVersion struct { 2491} 2492 2493func (*awsRestjson1_deserializeOpDeleteBotVersion) ID() string { 2494 return "OperationDeserializer" 2495} 2496 2497func (m *awsRestjson1_deserializeOpDeleteBotVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2498 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2499) { 2500 out, metadata, err = next.HandleDeserialize(ctx, in) 2501 if err != nil { 2502 return out, metadata, err 2503 } 2504 2505 response, ok := out.RawResponse.(*smithyhttp.Response) 2506 if !ok { 2507 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2508 } 2509 2510 if response.StatusCode < 200 || response.StatusCode >= 300 { 2511 return out, metadata, awsRestjson1_deserializeOpErrorDeleteBotVersion(response, &metadata) 2512 } 2513 output := &DeleteBotVersionOutput{} 2514 out.Result = output 2515 2516 var buff [1024]byte 2517 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2518 2519 body := io.TeeReader(response.Body, ringBuffer) 2520 2521 decoder := json.NewDecoder(body) 2522 decoder.UseNumber() 2523 var shape interface{} 2524 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2525 var snapshot bytes.Buffer 2526 io.Copy(&snapshot, ringBuffer) 2527 err = &smithy.DeserializationError{ 2528 Err: fmt.Errorf("failed to decode response body, %w", err), 2529 Snapshot: snapshot.Bytes(), 2530 } 2531 return out, metadata, err 2532 } 2533 2534 err = awsRestjson1_deserializeOpDocumentDeleteBotVersionOutput(&output, shape) 2535 if err != nil { 2536 var snapshot bytes.Buffer 2537 io.Copy(&snapshot, ringBuffer) 2538 return out, metadata, &smithy.DeserializationError{ 2539 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2540 Snapshot: snapshot.Bytes(), 2541 } 2542 } 2543 2544 return out, metadata, err 2545} 2546 2547func awsRestjson1_deserializeOpErrorDeleteBotVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2548 var errorBuffer bytes.Buffer 2549 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2550 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2551 } 2552 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2553 2554 errorCode := "UnknownError" 2555 errorMessage := errorCode 2556 2557 code := response.Header.Get("X-Amzn-ErrorType") 2558 if len(code) != 0 { 2559 errorCode = restjson.SanitizeErrorCode(code) 2560 } 2561 2562 var buff [1024]byte 2563 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2564 2565 body := io.TeeReader(errorBody, ringBuffer) 2566 decoder := json.NewDecoder(body) 2567 decoder.UseNumber() 2568 code, message, err := restjson.GetErrorInfo(decoder) 2569 if err != nil { 2570 var snapshot bytes.Buffer 2571 io.Copy(&snapshot, ringBuffer) 2572 err = &smithy.DeserializationError{ 2573 Err: fmt.Errorf("failed to decode response body, %w", err), 2574 Snapshot: snapshot.Bytes(), 2575 } 2576 return err 2577 } 2578 2579 errorBody.Seek(0, io.SeekStart) 2580 if len(code) != 0 { 2581 errorCode = restjson.SanitizeErrorCode(code) 2582 } 2583 if len(message) != 0 { 2584 errorMessage = message 2585 } 2586 2587 switch { 2588 case strings.EqualFold("ConflictException", errorCode): 2589 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2590 2591 case strings.EqualFold("InternalServerException", errorCode): 2592 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2593 2594 case strings.EqualFold("PreconditionFailedException", errorCode): 2595 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2596 2597 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2598 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2599 2600 case strings.EqualFold("ThrottlingException", errorCode): 2601 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2602 2603 case strings.EqualFold("ValidationException", errorCode): 2604 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2605 2606 default: 2607 genericError := &smithy.GenericAPIError{ 2608 Code: errorCode, 2609 Message: errorMessage, 2610 } 2611 return genericError 2612 2613 } 2614} 2615 2616func awsRestjson1_deserializeOpDocumentDeleteBotVersionOutput(v **DeleteBotVersionOutput, value interface{}) error { 2617 if v == nil { 2618 return fmt.Errorf("unexpected nil of type %T", v) 2619 } 2620 if value == nil { 2621 return nil 2622 } 2623 2624 shape, ok := value.(map[string]interface{}) 2625 if !ok { 2626 return fmt.Errorf("unexpected JSON type %v", value) 2627 } 2628 2629 var sv *DeleteBotVersionOutput 2630 if *v == nil { 2631 sv = &DeleteBotVersionOutput{} 2632 } else { 2633 sv = *v 2634 } 2635 2636 for key, value := range shape { 2637 switch key { 2638 case "botId": 2639 if value != nil { 2640 jtv, ok := value.(string) 2641 if !ok { 2642 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 2643 } 2644 sv.BotId = ptr.String(jtv) 2645 } 2646 2647 case "botStatus": 2648 if value != nil { 2649 jtv, ok := value.(string) 2650 if !ok { 2651 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 2652 } 2653 sv.BotStatus = types.BotStatus(jtv) 2654 } 2655 2656 case "botVersion": 2657 if value != nil { 2658 jtv, ok := value.(string) 2659 if !ok { 2660 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 2661 } 2662 sv.BotVersion = ptr.String(jtv) 2663 } 2664 2665 default: 2666 _, _ = key, value 2667 2668 } 2669 } 2670 *v = sv 2671 return nil 2672} 2673 2674type awsRestjson1_deserializeOpDeleteIntent struct { 2675} 2676 2677func (*awsRestjson1_deserializeOpDeleteIntent) ID() string { 2678 return "OperationDeserializer" 2679} 2680 2681func (m *awsRestjson1_deserializeOpDeleteIntent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2682 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2683) { 2684 out, metadata, err = next.HandleDeserialize(ctx, in) 2685 if err != nil { 2686 return out, metadata, err 2687 } 2688 2689 response, ok := out.RawResponse.(*smithyhttp.Response) 2690 if !ok { 2691 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2692 } 2693 2694 if response.StatusCode < 200 || response.StatusCode >= 300 { 2695 return out, metadata, awsRestjson1_deserializeOpErrorDeleteIntent(response, &metadata) 2696 } 2697 output := &DeleteIntentOutput{} 2698 out.Result = output 2699 2700 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2701 return out, metadata, &smithy.DeserializationError{ 2702 Err: fmt.Errorf("failed to discard response body, %w", err), 2703 } 2704 } 2705 2706 return out, metadata, err 2707} 2708 2709func awsRestjson1_deserializeOpErrorDeleteIntent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2710 var errorBuffer bytes.Buffer 2711 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2712 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2713 } 2714 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2715 2716 errorCode := "UnknownError" 2717 errorMessage := errorCode 2718 2719 code := response.Header.Get("X-Amzn-ErrorType") 2720 if len(code) != 0 { 2721 errorCode = restjson.SanitizeErrorCode(code) 2722 } 2723 2724 var buff [1024]byte 2725 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2726 2727 body := io.TeeReader(errorBody, ringBuffer) 2728 decoder := json.NewDecoder(body) 2729 decoder.UseNumber() 2730 code, message, err := restjson.GetErrorInfo(decoder) 2731 if err != nil { 2732 var snapshot bytes.Buffer 2733 io.Copy(&snapshot, ringBuffer) 2734 err = &smithy.DeserializationError{ 2735 Err: fmt.Errorf("failed to decode response body, %w", err), 2736 Snapshot: snapshot.Bytes(), 2737 } 2738 return err 2739 } 2740 2741 errorBody.Seek(0, io.SeekStart) 2742 if len(code) != 0 { 2743 errorCode = restjson.SanitizeErrorCode(code) 2744 } 2745 if len(message) != 0 { 2746 errorMessage = message 2747 } 2748 2749 switch { 2750 case strings.EqualFold("ConflictException", errorCode): 2751 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2752 2753 case strings.EqualFold("InternalServerException", errorCode): 2754 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2755 2756 case strings.EqualFold("PreconditionFailedException", errorCode): 2757 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2758 2759 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2760 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2761 2762 case strings.EqualFold("ThrottlingException", errorCode): 2763 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2764 2765 case strings.EqualFold("ValidationException", errorCode): 2766 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2767 2768 default: 2769 genericError := &smithy.GenericAPIError{ 2770 Code: errorCode, 2771 Message: errorMessage, 2772 } 2773 return genericError 2774 2775 } 2776} 2777 2778type awsRestjson1_deserializeOpDeleteSlot struct { 2779} 2780 2781func (*awsRestjson1_deserializeOpDeleteSlot) ID() string { 2782 return "OperationDeserializer" 2783} 2784 2785func (m *awsRestjson1_deserializeOpDeleteSlot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2786 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2787) { 2788 out, metadata, err = next.HandleDeserialize(ctx, in) 2789 if err != nil { 2790 return out, metadata, err 2791 } 2792 2793 response, ok := out.RawResponse.(*smithyhttp.Response) 2794 if !ok { 2795 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2796 } 2797 2798 if response.StatusCode < 200 || response.StatusCode >= 300 { 2799 return out, metadata, awsRestjson1_deserializeOpErrorDeleteSlot(response, &metadata) 2800 } 2801 output := &DeleteSlotOutput{} 2802 out.Result = output 2803 2804 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2805 return out, metadata, &smithy.DeserializationError{ 2806 Err: fmt.Errorf("failed to discard response body, %w", err), 2807 } 2808 } 2809 2810 return out, metadata, err 2811} 2812 2813func awsRestjson1_deserializeOpErrorDeleteSlot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2814 var errorBuffer bytes.Buffer 2815 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2816 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2817 } 2818 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2819 2820 errorCode := "UnknownError" 2821 errorMessage := errorCode 2822 2823 code := response.Header.Get("X-Amzn-ErrorType") 2824 if len(code) != 0 { 2825 errorCode = restjson.SanitizeErrorCode(code) 2826 } 2827 2828 var buff [1024]byte 2829 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2830 2831 body := io.TeeReader(errorBody, ringBuffer) 2832 decoder := json.NewDecoder(body) 2833 decoder.UseNumber() 2834 code, message, err := restjson.GetErrorInfo(decoder) 2835 if err != nil { 2836 var snapshot bytes.Buffer 2837 io.Copy(&snapshot, ringBuffer) 2838 err = &smithy.DeserializationError{ 2839 Err: fmt.Errorf("failed to decode response body, %w", err), 2840 Snapshot: snapshot.Bytes(), 2841 } 2842 return err 2843 } 2844 2845 errorBody.Seek(0, io.SeekStart) 2846 if len(code) != 0 { 2847 errorCode = restjson.SanitizeErrorCode(code) 2848 } 2849 if len(message) != 0 { 2850 errorMessage = message 2851 } 2852 2853 switch { 2854 case strings.EqualFold("ConflictException", errorCode): 2855 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2856 2857 case strings.EqualFold("InternalServerException", errorCode): 2858 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2859 2860 case strings.EqualFold("PreconditionFailedException", errorCode): 2861 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2862 2863 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2864 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2865 2866 case strings.EqualFold("ThrottlingException", errorCode): 2867 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2868 2869 case strings.EqualFold("ValidationException", errorCode): 2870 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2871 2872 default: 2873 genericError := &smithy.GenericAPIError{ 2874 Code: errorCode, 2875 Message: errorMessage, 2876 } 2877 return genericError 2878 2879 } 2880} 2881 2882type awsRestjson1_deserializeOpDeleteSlotType struct { 2883} 2884 2885func (*awsRestjson1_deserializeOpDeleteSlotType) ID() string { 2886 return "OperationDeserializer" 2887} 2888 2889func (m *awsRestjson1_deserializeOpDeleteSlotType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2890 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2891) { 2892 out, metadata, err = next.HandleDeserialize(ctx, in) 2893 if err != nil { 2894 return out, metadata, err 2895 } 2896 2897 response, ok := out.RawResponse.(*smithyhttp.Response) 2898 if !ok { 2899 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2900 } 2901 2902 if response.StatusCode < 200 || response.StatusCode >= 300 { 2903 return out, metadata, awsRestjson1_deserializeOpErrorDeleteSlotType(response, &metadata) 2904 } 2905 output := &DeleteSlotTypeOutput{} 2906 out.Result = output 2907 2908 if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { 2909 return out, metadata, &smithy.DeserializationError{ 2910 Err: fmt.Errorf("failed to discard response body, %w", err), 2911 } 2912 } 2913 2914 return out, metadata, err 2915} 2916 2917func awsRestjson1_deserializeOpErrorDeleteSlotType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2918 var errorBuffer bytes.Buffer 2919 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2920 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2921 } 2922 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2923 2924 errorCode := "UnknownError" 2925 errorMessage := errorCode 2926 2927 code := response.Header.Get("X-Amzn-ErrorType") 2928 if len(code) != 0 { 2929 errorCode = restjson.SanitizeErrorCode(code) 2930 } 2931 2932 var buff [1024]byte 2933 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2934 2935 body := io.TeeReader(errorBody, ringBuffer) 2936 decoder := json.NewDecoder(body) 2937 decoder.UseNumber() 2938 code, message, err := restjson.GetErrorInfo(decoder) 2939 if err != nil { 2940 var snapshot bytes.Buffer 2941 io.Copy(&snapshot, ringBuffer) 2942 err = &smithy.DeserializationError{ 2943 Err: fmt.Errorf("failed to decode response body, %w", err), 2944 Snapshot: snapshot.Bytes(), 2945 } 2946 return err 2947 } 2948 2949 errorBody.Seek(0, io.SeekStart) 2950 if len(code) != 0 { 2951 errorCode = restjson.SanitizeErrorCode(code) 2952 } 2953 if len(message) != 0 { 2954 errorMessage = message 2955 } 2956 2957 switch { 2958 case strings.EqualFold("ConflictException", errorCode): 2959 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2960 2961 case strings.EqualFold("InternalServerException", errorCode): 2962 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2963 2964 case strings.EqualFold("PreconditionFailedException", errorCode): 2965 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 2966 2967 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 2968 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 2969 2970 case strings.EqualFold("ThrottlingException", errorCode): 2971 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2972 2973 case strings.EqualFold("ValidationException", errorCode): 2974 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2975 2976 default: 2977 genericError := &smithy.GenericAPIError{ 2978 Code: errorCode, 2979 Message: errorMessage, 2980 } 2981 return genericError 2982 2983 } 2984} 2985 2986type awsRestjson1_deserializeOpDescribeBot struct { 2987} 2988 2989func (*awsRestjson1_deserializeOpDescribeBot) ID() string { 2990 return "OperationDeserializer" 2991} 2992 2993func (m *awsRestjson1_deserializeOpDescribeBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2994 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2995) { 2996 out, metadata, err = next.HandleDeserialize(ctx, in) 2997 if err != nil { 2998 return out, metadata, err 2999 } 3000 3001 response, ok := out.RawResponse.(*smithyhttp.Response) 3002 if !ok { 3003 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3004 } 3005 3006 if response.StatusCode < 200 || response.StatusCode >= 300 { 3007 return out, metadata, awsRestjson1_deserializeOpErrorDescribeBot(response, &metadata) 3008 } 3009 output := &DescribeBotOutput{} 3010 out.Result = output 3011 3012 var buff [1024]byte 3013 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3014 3015 body := io.TeeReader(response.Body, ringBuffer) 3016 3017 decoder := json.NewDecoder(body) 3018 decoder.UseNumber() 3019 var shape interface{} 3020 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3021 var snapshot bytes.Buffer 3022 io.Copy(&snapshot, ringBuffer) 3023 err = &smithy.DeserializationError{ 3024 Err: fmt.Errorf("failed to decode response body, %w", err), 3025 Snapshot: snapshot.Bytes(), 3026 } 3027 return out, metadata, err 3028 } 3029 3030 err = awsRestjson1_deserializeOpDocumentDescribeBotOutput(&output, shape) 3031 if err != nil { 3032 var snapshot bytes.Buffer 3033 io.Copy(&snapshot, ringBuffer) 3034 return out, metadata, &smithy.DeserializationError{ 3035 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3036 Snapshot: snapshot.Bytes(), 3037 } 3038 } 3039 3040 return out, metadata, err 3041} 3042 3043func awsRestjson1_deserializeOpErrorDescribeBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3044 var errorBuffer bytes.Buffer 3045 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3046 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3047 } 3048 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3049 3050 errorCode := "UnknownError" 3051 errorMessage := errorCode 3052 3053 code := response.Header.Get("X-Amzn-ErrorType") 3054 if len(code) != 0 { 3055 errorCode = restjson.SanitizeErrorCode(code) 3056 } 3057 3058 var buff [1024]byte 3059 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3060 3061 body := io.TeeReader(errorBody, ringBuffer) 3062 decoder := json.NewDecoder(body) 3063 decoder.UseNumber() 3064 code, message, err := restjson.GetErrorInfo(decoder) 3065 if err != nil { 3066 var snapshot bytes.Buffer 3067 io.Copy(&snapshot, ringBuffer) 3068 err = &smithy.DeserializationError{ 3069 Err: fmt.Errorf("failed to decode response body, %w", err), 3070 Snapshot: snapshot.Bytes(), 3071 } 3072 return err 3073 } 3074 3075 errorBody.Seek(0, io.SeekStart) 3076 if len(code) != 0 { 3077 errorCode = restjson.SanitizeErrorCode(code) 3078 } 3079 if len(message) != 0 { 3080 errorMessage = message 3081 } 3082 3083 switch { 3084 case strings.EqualFold("InternalServerException", errorCode): 3085 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3086 3087 case strings.EqualFold("ResourceNotFoundException", errorCode): 3088 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3089 3090 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3091 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3092 3093 case strings.EqualFold("ThrottlingException", errorCode): 3094 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3095 3096 case strings.EqualFold("ValidationException", errorCode): 3097 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3098 3099 default: 3100 genericError := &smithy.GenericAPIError{ 3101 Code: errorCode, 3102 Message: errorMessage, 3103 } 3104 return genericError 3105 3106 } 3107} 3108 3109func awsRestjson1_deserializeOpDocumentDescribeBotOutput(v **DescribeBotOutput, value interface{}) error { 3110 if v == nil { 3111 return fmt.Errorf("unexpected nil of type %T", v) 3112 } 3113 if value == nil { 3114 return nil 3115 } 3116 3117 shape, ok := value.(map[string]interface{}) 3118 if !ok { 3119 return fmt.Errorf("unexpected JSON type %v", value) 3120 } 3121 3122 var sv *DescribeBotOutput 3123 if *v == nil { 3124 sv = &DescribeBotOutput{} 3125 } else { 3126 sv = *v 3127 } 3128 3129 for key, value := range shape { 3130 switch key { 3131 case "botId": 3132 if value != nil { 3133 jtv, ok := value.(string) 3134 if !ok { 3135 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3136 } 3137 sv.BotId = ptr.String(jtv) 3138 } 3139 3140 case "botName": 3141 if value != nil { 3142 jtv, ok := value.(string) 3143 if !ok { 3144 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 3145 } 3146 sv.BotName = ptr.String(jtv) 3147 } 3148 3149 case "botStatus": 3150 if value != nil { 3151 jtv, ok := value.(string) 3152 if !ok { 3153 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 3154 } 3155 sv.BotStatus = types.BotStatus(jtv) 3156 } 3157 3158 case "creationDateTime": 3159 if value != nil { 3160 jtv, ok := value.(json.Number) 3161 if !ok { 3162 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 3163 } 3164 f64, err := jtv.Float64() 3165 if err != nil { 3166 return err 3167 } 3168 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3169 } 3170 3171 case "dataPrivacy": 3172 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 3173 return err 3174 } 3175 3176 case "description": 3177 if value != nil { 3178 jtv, ok := value.(string) 3179 if !ok { 3180 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 3181 } 3182 sv.Description = ptr.String(jtv) 3183 } 3184 3185 case "idleSessionTTLInSeconds": 3186 if value != nil { 3187 jtv, ok := value.(json.Number) 3188 if !ok { 3189 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 3190 } 3191 i64, err := jtv.Int64() 3192 if err != nil { 3193 return err 3194 } 3195 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 3196 } 3197 3198 case "lastUpdatedDateTime": 3199 if value != nil { 3200 jtv, ok := value.(json.Number) 3201 if !ok { 3202 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 3203 } 3204 f64, err := jtv.Float64() 3205 if err != nil { 3206 return err 3207 } 3208 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3209 } 3210 3211 case "roleArn": 3212 if value != nil { 3213 jtv, ok := value.(string) 3214 if !ok { 3215 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 3216 } 3217 sv.RoleArn = ptr.String(jtv) 3218 } 3219 3220 default: 3221 _, _ = key, value 3222 3223 } 3224 } 3225 *v = sv 3226 return nil 3227} 3228 3229type awsRestjson1_deserializeOpDescribeBotAlias struct { 3230} 3231 3232func (*awsRestjson1_deserializeOpDescribeBotAlias) ID() string { 3233 return "OperationDeserializer" 3234} 3235 3236func (m *awsRestjson1_deserializeOpDescribeBotAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3237 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3238) { 3239 out, metadata, err = next.HandleDeserialize(ctx, in) 3240 if err != nil { 3241 return out, metadata, err 3242 } 3243 3244 response, ok := out.RawResponse.(*smithyhttp.Response) 3245 if !ok { 3246 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3247 } 3248 3249 if response.StatusCode < 200 || response.StatusCode >= 300 { 3250 return out, metadata, awsRestjson1_deserializeOpErrorDescribeBotAlias(response, &metadata) 3251 } 3252 output := &DescribeBotAliasOutput{} 3253 out.Result = output 3254 3255 var buff [1024]byte 3256 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3257 3258 body := io.TeeReader(response.Body, ringBuffer) 3259 3260 decoder := json.NewDecoder(body) 3261 decoder.UseNumber() 3262 var shape interface{} 3263 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3264 var snapshot bytes.Buffer 3265 io.Copy(&snapshot, ringBuffer) 3266 err = &smithy.DeserializationError{ 3267 Err: fmt.Errorf("failed to decode response body, %w", err), 3268 Snapshot: snapshot.Bytes(), 3269 } 3270 return out, metadata, err 3271 } 3272 3273 err = awsRestjson1_deserializeOpDocumentDescribeBotAliasOutput(&output, shape) 3274 if err != nil { 3275 var snapshot bytes.Buffer 3276 io.Copy(&snapshot, ringBuffer) 3277 return out, metadata, &smithy.DeserializationError{ 3278 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3279 Snapshot: snapshot.Bytes(), 3280 } 3281 } 3282 3283 return out, metadata, err 3284} 3285 3286func awsRestjson1_deserializeOpErrorDescribeBotAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3287 var errorBuffer bytes.Buffer 3288 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3289 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3290 } 3291 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3292 3293 errorCode := "UnknownError" 3294 errorMessage := errorCode 3295 3296 code := response.Header.Get("X-Amzn-ErrorType") 3297 if len(code) != 0 { 3298 errorCode = restjson.SanitizeErrorCode(code) 3299 } 3300 3301 var buff [1024]byte 3302 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3303 3304 body := io.TeeReader(errorBody, ringBuffer) 3305 decoder := json.NewDecoder(body) 3306 decoder.UseNumber() 3307 code, message, err := restjson.GetErrorInfo(decoder) 3308 if err != nil { 3309 var snapshot bytes.Buffer 3310 io.Copy(&snapshot, ringBuffer) 3311 err = &smithy.DeserializationError{ 3312 Err: fmt.Errorf("failed to decode response body, %w", err), 3313 Snapshot: snapshot.Bytes(), 3314 } 3315 return err 3316 } 3317 3318 errorBody.Seek(0, io.SeekStart) 3319 if len(code) != 0 { 3320 errorCode = restjson.SanitizeErrorCode(code) 3321 } 3322 if len(message) != 0 { 3323 errorMessage = message 3324 } 3325 3326 switch { 3327 case strings.EqualFold("InternalServerException", errorCode): 3328 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3329 3330 case strings.EqualFold("ResourceNotFoundException", errorCode): 3331 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3332 3333 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3334 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3335 3336 case strings.EqualFold("ThrottlingException", errorCode): 3337 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3338 3339 case strings.EqualFold("ValidationException", errorCode): 3340 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3341 3342 default: 3343 genericError := &smithy.GenericAPIError{ 3344 Code: errorCode, 3345 Message: errorMessage, 3346 } 3347 return genericError 3348 3349 } 3350} 3351 3352func awsRestjson1_deserializeOpDocumentDescribeBotAliasOutput(v **DescribeBotAliasOutput, value interface{}) error { 3353 if v == nil { 3354 return fmt.Errorf("unexpected nil of type %T", v) 3355 } 3356 if value == nil { 3357 return nil 3358 } 3359 3360 shape, ok := value.(map[string]interface{}) 3361 if !ok { 3362 return fmt.Errorf("unexpected JSON type %v", value) 3363 } 3364 3365 var sv *DescribeBotAliasOutput 3366 if *v == nil { 3367 sv = &DescribeBotAliasOutput{} 3368 } else { 3369 sv = *v 3370 } 3371 3372 for key, value := range shape { 3373 switch key { 3374 case "botAliasHistoryEvents": 3375 if err := awsRestjson1_deserializeDocumentBotAliasHistoryEventsList(&sv.BotAliasHistoryEvents, value); err != nil { 3376 return err 3377 } 3378 3379 case "botAliasId": 3380 if value != nil { 3381 jtv, ok := value.(string) 3382 if !ok { 3383 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 3384 } 3385 sv.BotAliasId = ptr.String(jtv) 3386 } 3387 3388 case "botAliasLocaleSettings": 3389 if err := awsRestjson1_deserializeDocumentBotAliasLocaleSettingsMap(&sv.BotAliasLocaleSettings, value); err != nil { 3390 return err 3391 } 3392 3393 case "botAliasName": 3394 if value != nil { 3395 jtv, ok := value.(string) 3396 if !ok { 3397 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 3398 } 3399 sv.BotAliasName = ptr.String(jtv) 3400 } 3401 3402 case "botAliasStatus": 3403 if value != nil { 3404 jtv, ok := value.(string) 3405 if !ok { 3406 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 3407 } 3408 sv.BotAliasStatus = types.BotAliasStatus(jtv) 3409 } 3410 3411 case "botId": 3412 if value != nil { 3413 jtv, ok := value.(string) 3414 if !ok { 3415 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3416 } 3417 sv.BotId = ptr.String(jtv) 3418 } 3419 3420 case "botVersion": 3421 if value != nil { 3422 jtv, ok := value.(string) 3423 if !ok { 3424 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 3425 } 3426 sv.BotVersion = ptr.String(jtv) 3427 } 3428 3429 case "conversationLogSettings": 3430 if err := awsRestjson1_deserializeDocumentConversationLogSettings(&sv.ConversationLogSettings, value); err != nil { 3431 return err 3432 } 3433 3434 case "creationDateTime": 3435 if value != nil { 3436 jtv, ok := value.(json.Number) 3437 if !ok { 3438 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 3439 } 3440 f64, err := jtv.Float64() 3441 if err != nil { 3442 return err 3443 } 3444 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3445 } 3446 3447 case "description": 3448 if value != nil { 3449 jtv, ok := value.(string) 3450 if !ok { 3451 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 3452 } 3453 sv.Description = ptr.String(jtv) 3454 } 3455 3456 case "lastUpdatedDateTime": 3457 if value != nil { 3458 jtv, ok := value.(json.Number) 3459 if !ok { 3460 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 3461 } 3462 f64, err := jtv.Float64() 3463 if err != nil { 3464 return err 3465 } 3466 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3467 } 3468 3469 case "sentimentAnalysisSettings": 3470 if err := awsRestjson1_deserializeDocumentSentimentAnalysisSettings(&sv.SentimentAnalysisSettings, value); err != nil { 3471 return err 3472 } 3473 3474 default: 3475 _, _ = key, value 3476 3477 } 3478 } 3479 *v = sv 3480 return nil 3481} 3482 3483type awsRestjson1_deserializeOpDescribeBotLocale struct { 3484} 3485 3486func (*awsRestjson1_deserializeOpDescribeBotLocale) ID() string { 3487 return "OperationDeserializer" 3488} 3489 3490func (m *awsRestjson1_deserializeOpDescribeBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3491 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3492) { 3493 out, metadata, err = next.HandleDeserialize(ctx, in) 3494 if err != nil { 3495 return out, metadata, err 3496 } 3497 3498 response, ok := out.RawResponse.(*smithyhttp.Response) 3499 if !ok { 3500 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3501 } 3502 3503 if response.StatusCode < 200 || response.StatusCode >= 300 { 3504 return out, metadata, awsRestjson1_deserializeOpErrorDescribeBotLocale(response, &metadata) 3505 } 3506 output := &DescribeBotLocaleOutput{} 3507 out.Result = output 3508 3509 var buff [1024]byte 3510 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3511 3512 body := io.TeeReader(response.Body, ringBuffer) 3513 3514 decoder := json.NewDecoder(body) 3515 decoder.UseNumber() 3516 var shape interface{} 3517 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3518 var snapshot bytes.Buffer 3519 io.Copy(&snapshot, ringBuffer) 3520 err = &smithy.DeserializationError{ 3521 Err: fmt.Errorf("failed to decode response body, %w", err), 3522 Snapshot: snapshot.Bytes(), 3523 } 3524 return out, metadata, err 3525 } 3526 3527 err = awsRestjson1_deserializeOpDocumentDescribeBotLocaleOutput(&output, shape) 3528 if err != nil { 3529 var snapshot bytes.Buffer 3530 io.Copy(&snapshot, ringBuffer) 3531 return out, metadata, &smithy.DeserializationError{ 3532 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3533 Snapshot: snapshot.Bytes(), 3534 } 3535 } 3536 3537 return out, metadata, err 3538} 3539 3540func awsRestjson1_deserializeOpErrorDescribeBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3541 var errorBuffer bytes.Buffer 3542 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3543 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3544 } 3545 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3546 3547 errorCode := "UnknownError" 3548 errorMessage := errorCode 3549 3550 code := response.Header.Get("X-Amzn-ErrorType") 3551 if len(code) != 0 { 3552 errorCode = restjson.SanitizeErrorCode(code) 3553 } 3554 3555 var buff [1024]byte 3556 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3557 3558 body := io.TeeReader(errorBody, ringBuffer) 3559 decoder := json.NewDecoder(body) 3560 decoder.UseNumber() 3561 code, message, err := restjson.GetErrorInfo(decoder) 3562 if err != nil { 3563 var snapshot bytes.Buffer 3564 io.Copy(&snapshot, ringBuffer) 3565 err = &smithy.DeserializationError{ 3566 Err: fmt.Errorf("failed to decode response body, %w", err), 3567 Snapshot: snapshot.Bytes(), 3568 } 3569 return err 3570 } 3571 3572 errorBody.Seek(0, io.SeekStart) 3573 if len(code) != 0 { 3574 errorCode = restjson.SanitizeErrorCode(code) 3575 } 3576 if len(message) != 0 { 3577 errorMessage = message 3578 } 3579 3580 switch { 3581 case strings.EqualFold("InternalServerException", errorCode): 3582 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3583 3584 case strings.EqualFold("ResourceNotFoundException", errorCode): 3585 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3586 3587 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3588 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3589 3590 case strings.EqualFold("ThrottlingException", errorCode): 3591 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3592 3593 case strings.EqualFold("ValidationException", errorCode): 3594 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3595 3596 default: 3597 genericError := &smithy.GenericAPIError{ 3598 Code: errorCode, 3599 Message: errorMessage, 3600 } 3601 return genericError 3602 3603 } 3604} 3605 3606func awsRestjson1_deserializeOpDocumentDescribeBotLocaleOutput(v **DescribeBotLocaleOutput, value interface{}) error { 3607 if v == nil { 3608 return fmt.Errorf("unexpected nil of type %T", v) 3609 } 3610 if value == nil { 3611 return nil 3612 } 3613 3614 shape, ok := value.(map[string]interface{}) 3615 if !ok { 3616 return fmt.Errorf("unexpected JSON type %v", value) 3617 } 3618 3619 var sv *DescribeBotLocaleOutput 3620 if *v == nil { 3621 sv = &DescribeBotLocaleOutput{} 3622 } else { 3623 sv = *v 3624 } 3625 3626 for key, value := range shape { 3627 switch key { 3628 case "botId": 3629 if value != nil { 3630 jtv, ok := value.(string) 3631 if !ok { 3632 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3633 } 3634 sv.BotId = ptr.String(jtv) 3635 } 3636 3637 case "botLocaleHistoryEvents": 3638 if err := awsRestjson1_deserializeDocumentBotLocaleHistoryEventsList(&sv.BotLocaleHistoryEvents, value); err != nil { 3639 return err 3640 } 3641 3642 case "botLocaleStatus": 3643 if value != nil { 3644 jtv, ok := value.(string) 3645 if !ok { 3646 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 3647 } 3648 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 3649 } 3650 3651 case "botVersion": 3652 if value != nil { 3653 jtv, ok := value.(string) 3654 if !ok { 3655 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 3656 } 3657 sv.BotVersion = ptr.String(jtv) 3658 } 3659 3660 case "creationDateTime": 3661 if value != nil { 3662 jtv, ok := value.(json.Number) 3663 if !ok { 3664 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 3665 } 3666 f64, err := jtv.Float64() 3667 if err != nil { 3668 return err 3669 } 3670 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3671 } 3672 3673 case "description": 3674 if value != nil { 3675 jtv, ok := value.(string) 3676 if !ok { 3677 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 3678 } 3679 sv.Description = ptr.String(jtv) 3680 } 3681 3682 case "failureReasons": 3683 if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { 3684 return err 3685 } 3686 3687 case "intentsCount": 3688 if value != nil { 3689 jtv, ok := value.(json.Number) 3690 if !ok { 3691 return fmt.Errorf("expected ResourceCount to be json.Number, got %T instead", value) 3692 } 3693 i64, err := jtv.Int64() 3694 if err != nil { 3695 return err 3696 } 3697 sv.IntentsCount = ptr.Int32(int32(i64)) 3698 } 3699 3700 case "lastBuildSubmittedDateTime": 3701 if value != nil { 3702 jtv, ok := value.(json.Number) 3703 if !ok { 3704 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 3705 } 3706 f64, err := jtv.Float64() 3707 if err != nil { 3708 return err 3709 } 3710 sv.LastBuildSubmittedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3711 } 3712 3713 case "lastUpdatedDateTime": 3714 if value != nil { 3715 jtv, ok := value.(json.Number) 3716 if !ok { 3717 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 3718 } 3719 f64, err := jtv.Float64() 3720 if err != nil { 3721 return err 3722 } 3723 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3724 } 3725 3726 case "localeId": 3727 if value != nil { 3728 jtv, ok := value.(string) 3729 if !ok { 3730 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 3731 } 3732 sv.LocaleId = ptr.String(jtv) 3733 } 3734 3735 case "localeName": 3736 if value != nil { 3737 jtv, ok := value.(string) 3738 if !ok { 3739 return fmt.Errorf("expected LocaleName to be of type string, got %T instead", value) 3740 } 3741 sv.LocaleName = ptr.String(jtv) 3742 } 3743 3744 case "nluIntentConfidenceThreshold": 3745 if value != nil { 3746 jtv, ok := value.(json.Number) 3747 if !ok { 3748 return fmt.Errorf("expected ConfidenceThreshold to be json.Number, got %T instead", value) 3749 } 3750 f64, err := jtv.Float64() 3751 if err != nil { 3752 return err 3753 } 3754 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 3755 } 3756 3757 case "slotTypesCount": 3758 if value != nil { 3759 jtv, ok := value.(json.Number) 3760 if !ok { 3761 return fmt.Errorf("expected ResourceCount to be json.Number, got %T instead", value) 3762 } 3763 i64, err := jtv.Int64() 3764 if err != nil { 3765 return err 3766 } 3767 sv.SlotTypesCount = ptr.Int32(int32(i64)) 3768 } 3769 3770 case "voiceSettings": 3771 if err := awsRestjson1_deserializeDocumentVoiceSettings(&sv.VoiceSettings, value); err != nil { 3772 return err 3773 } 3774 3775 default: 3776 _, _ = key, value 3777 3778 } 3779 } 3780 *v = sv 3781 return nil 3782} 3783 3784type awsRestjson1_deserializeOpDescribeBotVersion struct { 3785} 3786 3787func (*awsRestjson1_deserializeOpDescribeBotVersion) ID() string { 3788 return "OperationDeserializer" 3789} 3790 3791func (m *awsRestjson1_deserializeOpDescribeBotVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3792 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3793) { 3794 out, metadata, err = next.HandleDeserialize(ctx, in) 3795 if err != nil { 3796 return out, metadata, err 3797 } 3798 3799 response, ok := out.RawResponse.(*smithyhttp.Response) 3800 if !ok { 3801 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3802 } 3803 3804 if response.StatusCode < 200 || response.StatusCode >= 300 { 3805 return out, metadata, awsRestjson1_deserializeOpErrorDescribeBotVersion(response, &metadata) 3806 } 3807 output := &DescribeBotVersionOutput{} 3808 out.Result = output 3809 3810 var buff [1024]byte 3811 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3812 3813 body := io.TeeReader(response.Body, ringBuffer) 3814 3815 decoder := json.NewDecoder(body) 3816 decoder.UseNumber() 3817 var shape interface{} 3818 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3819 var snapshot bytes.Buffer 3820 io.Copy(&snapshot, ringBuffer) 3821 err = &smithy.DeserializationError{ 3822 Err: fmt.Errorf("failed to decode response body, %w", err), 3823 Snapshot: snapshot.Bytes(), 3824 } 3825 return out, metadata, err 3826 } 3827 3828 err = awsRestjson1_deserializeOpDocumentDescribeBotVersionOutput(&output, shape) 3829 if err != nil { 3830 var snapshot bytes.Buffer 3831 io.Copy(&snapshot, ringBuffer) 3832 return out, metadata, &smithy.DeserializationError{ 3833 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 3834 Snapshot: snapshot.Bytes(), 3835 } 3836 } 3837 3838 return out, metadata, err 3839} 3840 3841func awsRestjson1_deserializeOpErrorDescribeBotVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3842 var errorBuffer bytes.Buffer 3843 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3844 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3845 } 3846 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3847 3848 errorCode := "UnknownError" 3849 errorMessage := errorCode 3850 3851 code := response.Header.Get("X-Amzn-ErrorType") 3852 if len(code) != 0 { 3853 errorCode = restjson.SanitizeErrorCode(code) 3854 } 3855 3856 var buff [1024]byte 3857 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3858 3859 body := io.TeeReader(errorBody, ringBuffer) 3860 decoder := json.NewDecoder(body) 3861 decoder.UseNumber() 3862 code, message, err := restjson.GetErrorInfo(decoder) 3863 if err != nil { 3864 var snapshot bytes.Buffer 3865 io.Copy(&snapshot, ringBuffer) 3866 err = &smithy.DeserializationError{ 3867 Err: fmt.Errorf("failed to decode response body, %w", err), 3868 Snapshot: snapshot.Bytes(), 3869 } 3870 return err 3871 } 3872 3873 errorBody.Seek(0, io.SeekStart) 3874 if len(code) != 0 { 3875 errorCode = restjson.SanitizeErrorCode(code) 3876 } 3877 if len(message) != 0 { 3878 errorMessage = message 3879 } 3880 3881 switch { 3882 case strings.EqualFold("InternalServerException", errorCode): 3883 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3884 3885 case strings.EqualFold("ResourceNotFoundException", errorCode): 3886 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3887 3888 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 3889 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 3890 3891 case strings.EqualFold("ThrottlingException", errorCode): 3892 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3893 3894 case strings.EqualFold("ValidationException", errorCode): 3895 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3896 3897 default: 3898 genericError := &smithy.GenericAPIError{ 3899 Code: errorCode, 3900 Message: errorMessage, 3901 } 3902 return genericError 3903 3904 } 3905} 3906 3907func awsRestjson1_deserializeOpDocumentDescribeBotVersionOutput(v **DescribeBotVersionOutput, value interface{}) error { 3908 if v == nil { 3909 return fmt.Errorf("unexpected nil of type %T", v) 3910 } 3911 if value == nil { 3912 return nil 3913 } 3914 3915 shape, ok := value.(map[string]interface{}) 3916 if !ok { 3917 return fmt.Errorf("unexpected JSON type %v", value) 3918 } 3919 3920 var sv *DescribeBotVersionOutput 3921 if *v == nil { 3922 sv = &DescribeBotVersionOutput{} 3923 } else { 3924 sv = *v 3925 } 3926 3927 for key, value := range shape { 3928 switch key { 3929 case "botId": 3930 if value != nil { 3931 jtv, ok := value.(string) 3932 if !ok { 3933 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 3934 } 3935 sv.BotId = ptr.String(jtv) 3936 } 3937 3938 case "botName": 3939 if value != nil { 3940 jtv, ok := value.(string) 3941 if !ok { 3942 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 3943 } 3944 sv.BotName = ptr.String(jtv) 3945 } 3946 3947 case "botStatus": 3948 if value != nil { 3949 jtv, ok := value.(string) 3950 if !ok { 3951 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 3952 } 3953 sv.BotStatus = types.BotStatus(jtv) 3954 } 3955 3956 case "botVersion": 3957 if value != nil { 3958 jtv, ok := value.(string) 3959 if !ok { 3960 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 3961 } 3962 sv.BotVersion = ptr.String(jtv) 3963 } 3964 3965 case "creationDateTime": 3966 if value != nil { 3967 jtv, ok := value.(json.Number) 3968 if !ok { 3969 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 3970 } 3971 f64, err := jtv.Float64() 3972 if err != nil { 3973 return err 3974 } 3975 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3976 } 3977 3978 case "dataPrivacy": 3979 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 3980 return err 3981 } 3982 3983 case "description": 3984 if value != nil { 3985 jtv, ok := value.(string) 3986 if !ok { 3987 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 3988 } 3989 sv.Description = ptr.String(jtv) 3990 } 3991 3992 case "failureReasons": 3993 if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { 3994 return err 3995 } 3996 3997 case "idleSessionTTLInSeconds": 3998 if value != nil { 3999 jtv, ok := value.(json.Number) 4000 if !ok { 4001 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 4002 } 4003 i64, err := jtv.Int64() 4004 if err != nil { 4005 return err 4006 } 4007 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 4008 } 4009 4010 case "roleArn": 4011 if value != nil { 4012 jtv, ok := value.(string) 4013 if !ok { 4014 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 4015 } 4016 sv.RoleArn = ptr.String(jtv) 4017 } 4018 4019 default: 4020 _, _ = key, value 4021 4022 } 4023 } 4024 *v = sv 4025 return nil 4026} 4027 4028type awsRestjson1_deserializeOpDescribeIntent struct { 4029} 4030 4031func (*awsRestjson1_deserializeOpDescribeIntent) ID() string { 4032 return "OperationDeserializer" 4033} 4034 4035func (m *awsRestjson1_deserializeOpDescribeIntent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4036 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4037) { 4038 out, metadata, err = next.HandleDeserialize(ctx, in) 4039 if err != nil { 4040 return out, metadata, err 4041 } 4042 4043 response, ok := out.RawResponse.(*smithyhttp.Response) 4044 if !ok { 4045 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4046 } 4047 4048 if response.StatusCode < 200 || response.StatusCode >= 300 { 4049 return out, metadata, awsRestjson1_deserializeOpErrorDescribeIntent(response, &metadata) 4050 } 4051 output := &DescribeIntentOutput{} 4052 out.Result = output 4053 4054 var buff [1024]byte 4055 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4056 4057 body := io.TeeReader(response.Body, ringBuffer) 4058 4059 decoder := json.NewDecoder(body) 4060 decoder.UseNumber() 4061 var shape interface{} 4062 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4063 var snapshot bytes.Buffer 4064 io.Copy(&snapshot, ringBuffer) 4065 err = &smithy.DeserializationError{ 4066 Err: fmt.Errorf("failed to decode response body, %w", err), 4067 Snapshot: snapshot.Bytes(), 4068 } 4069 return out, metadata, err 4070 } 4071 4072 err = awsRestjson1_deserializeOpDocumentDescribeIntentOutput(&output, shape) 4073 if err != nil { 4074 var snapshot bytes.Buffer 4075 io.Copy(&snapshot, ringBuffer) 4076 return out, metadata, &smithy.DeserializationError{ 4077 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4078 Snapshot: snapshot.Bytes(), 4079 } 4080 } 4081 4082 return out, metadata, err 4083} 4084 4085func awsRestjson1_deserializeOpErrorDescribeIntent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4086 var errorBuffer bytes.Buffer 4087 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4088 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4089 } 4090 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4091 4092 errorCode := "UnknownError" 4093 errorMessage := errorCode 4094 4095 code := response.Header.Get("X-Amzn-ErrorType") 4096 if len(code) != 0 { 4097 errorCode = restjson.SanitizeErrorCode(code) 4098 } 4099 4100 var buff [1024]byte 4101 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4102 4103 body := io.TeeReader(errorBody, ringBuffer) 4104 decoder := json.NewDecoder(body) 4105 decoder.UseNumber() 4106 code, message, err := restjson.GetErrorInfo(decoder) 4107 if err != nil { 4108 var snapshot bytes.Buffer 4109 io.Copy(&snapshot, ringBuffer) 4110 err = &smithy.DeserializationError{ 4111 Err: fmt.Errorf("failed to decode response body, %w", err), 4112 Snapshot: snapshot.Bytes(), 4113 } 4114 return err 4115 } 4116 4117 errorBody.Seek(0, io.SeekStart) 4118 if len(code) != 0 { 4119 errorCode = restjson.SanitizeErrorCode(code) 4120 } 4121 if len(message) != 0 { 4122 errorMessage = message 4123 } 4124 4125 switch { 4126 case strings.EqualFold("InternalServerException", errorCode): 4127 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4128 4129 case strings.EqualFold("ResourceNotFoundException", errorCode): 4130 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4131 4132 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 4133 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 4134 4135 case strings.EqualFold("ThrottlingException", errorCode): 4136 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4137 4138 case strings.EqualFold("ValidationException", errorCode): 4139 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4140 4141 default: 4142 genericError := &smithy.GenericAPIError{ 4143 Code: errorCode, 4144 Message: errorMessage, 4145 } 4146 return genericError 4147 4148 } 4149} 4150 4151func awsRestjson1_deserializeOpDocumentDescribeIntentOutput(v **DescribeIntentOutput, value interface{}) error { 4152 if v == nil { 4153 return fmt.Errorf("unexpected nil of type %T", v) 4154 } 4155 if value == nil { 4156 return nil 4157 } 4158 4159 shape, ok := value.(map[string]interface{}) 4160 if !ok { 4161 return fmt.Errorf("unexpected JSON type %v", value) 4162 } 4163 4164 var sv *DescribeIntentOutput 4165 if *v == nil { 4166 sv = &DescribeIntentOutput{} 4167 } else { 4168 sv = *v 4169 } 4170 4171 for key, value := range shape { 4172 switch key { 4173 case "botId": 4174 if value != nil { 4175 jtv, ok := value.(string) 4176 if !ok { 4177 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4178 } 4179 sv.BotId = ptr.String(jtv) 4180 } 4181 4182 case "botVersion": 4183 if value != nil { 4184 jtv, ok := value.(string) 4185 if !ok { 4186 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 4187 } 4188 sv.BotVersion = ptr.String(jtv) 4189 } 4190 4191 case "creationDateTime": 4192 if value != nil { 4193 jtv, ok := value.(json.Number) 4194 if !ok { 4195 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 4196 } 4197 f64, err := jtv.Float64() 4198 if err != nil { 4199 return err 4200 } 4201 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4202 } 4203 4204 case "description": 4205 if value != nil { 4206 jtv, ok := value.(string) 4207 if !ok { 4208 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 4209 } 4210 sv.Description = ptr.String(jtv) 4211 } 4212 4213 case "dialogCodeHook": 4214 if err := awsRestjson1_deserializeDocumentDialogCodeHookSettings(&sv.DialogCodeHook, value); err != nil { 4215 return err 4216 } 4217 4218 case "fulfillmentCodeHook": 4219 if err := awsRestjson1_deserializeDocumentFulfillmentCodeHookSettings(&sv.FulfillmentCodeHook, value); err != nil { 4220 return err 4221 } 4222 4223 case "inputContexts": 4224 if err := awsRestjson1_deserializeDocumentInputContextsList(&sv.InputContexts, value); err != nil { 4225 return err 4226 } 4227 4228 case "intentClosingSetting": 4229 if err := awsRestjson1_deserializeDocumentIntentClosingSetting(&sv.IntentClosingSetting, value); err != nil { 4230 return err 4231 } 4232 4233 case "intentConfirmationSetting": 4234 if err := awsRestjson1_deserializeDocumentIntentConfirmationSetting(&sv.IntentConfirmationSetting, value); err != nil { 4235 return err 4236 } 4237 4238 case "intentId": 4239 if value != nil { 4240 jtv, ok := value.(string) 4241 if !ok { 4242 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4243 } 4244 sv.IntentId = ptr.String(jtv) 4245 } 4246 4247 case "intentName": 4248 if value != nil { 4249 jtv, ok := value.(string) 4250 if !ok { 4251 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4252 } 4253 sv.IntentName = ptr.String(jtv) 4254 } 4255 4256 case "kendraConfiguration": 4257 if err := awsRestjson1_deserializeDocumentKendraConfiguration(&sv.KendraConfiguration, value); err != nil { 4258 return err 4259 } 4260 4261 case "lastUpdatedDateTime": 4262 if value != nil { 4263 jtv, ok := value.(json.Number) 4264 if !ok { 4265 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 4266 } 4267 f64, err := jtv.Float64() 4268 if err != nil { 4269 return err 4270 } 4271 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4272 } 4273 4274 case "localeId": 4275 if value != nil { 4276 jtv, ok := value.(string) 4277 if !ok { 4278 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 4279 } 4280 sv.LocaleId = ptr.String(jtv) 4281 } 4282 4283 case "outputContexts": 4284 if err := awsRestjson1_deserializeDocumentOutputContextsList(&sv.OutputContexts, value); err != nil { 4285 return err 4286 } 4287 4288 case "parentIntentSignature": 4289 if value != nil { 4290 jtv, ok := value.(string) 4291 if !ok { 4292 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 4293 } 4294 sv.ParentIntentSignature = ptr.String(jtv) 4295 } 4296 4297 case "sampleUtterances": 4298 if err := awsRestjson1_deserializeDocumentSampleUtterancesList(&sv.SampleUtterances, value); err != nil { 4299 return err 4300 } 4301 4302 case "slotPriorities": 4303 if err := awsRestjson1_deserializeDocumentSlotPrioritiesList(&sv.SlotPriorities, value); err != nil { 4304 return err 4305 } 4306 4307 default: 4308 _, _ = key, value 4309 4310 } 4311 } 4312 *v = sv 4313 return nil 4314} 4315 4316type awsRestjson1_deserializeOpDescribeSlot struct { 4317} 4318 4319func (*awsRestjson1_deserializeOpDescribeSlot) ID() string { 4320 return "OperationDeserializer" 4321} 4322 4323func (m *awsRestjson1_deserializeOpDescribeSlot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4324 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4325) { 4326 out, metadata, err = next.HandleDeserialize(ctx, in) 4327 if err != nil { 4328 return out, metadata, err 4329 } 4330 4331 response, ok := out.RawResponse.(*smithyhttp.Response) 4332 if !ok { 4333 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4334 } 4335 4336 if response.StatusCode < 200 || response.StatusCode >= 300 { 4337 return out, metadata, awsRestjson1_deserializeOpErrorDescribeSlot(response, &metadata) 4338 } 4339 output := &DescribeSlotOutput{} 4340 out.Result = output 4341 4342 var buff [1024]byte 4343 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4344 4345 body := io.TeeReader(response.Body, ringBuffer) 4346 4347 decoder := json.NewDecoder(body) 4348 decoder.UseNumber() 4349 var shape interface{} 4350 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4351 var snapshot bytes.Buffer 4352 io.Copy(&snapshot, ringBuffer) 4353 err = &smithy.DeserializationError{ 4354 Err: fmt.Errorf("failed to decode response body, %w", err), 4355 Snapshot: snapshot.Bytes(), 4356 } 4357 return out, metadata, err 4358 } 4359 4360 err = awsRestjson1_deserializeOpDocumentDescribeSlotOutput(&output, shape) 4361 if err != nil { 4362 var snapshot bytes.Buffer 4363 io.Copy(&snapshot, ringBuffer) 4364 return out, metadata, &smithy.DeserializationError{ 4365 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4366 Snapshot: snapshot.Bytes(), 4367 } 4368 } 4369 4370 return out, metadata, err 4371} 4372 4373func awsRestjson1_deserializeOpErrorDescribeSlot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4374 var errorBuffer bytes.Buffer 4375 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4376 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4377 } 4378 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4379 4380 errorCode := "UnknownError" 4381 errorMessage := errorCode 4382 4383 code := response.Header.Get("X-Amzn-ErrorType") 4384 if len(code) != 0 { 4385 errorCode = restjson.SanitizeErrorCode(code) 4386 } 4387 4388 var buff [1024]byte 4389 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4390 4391 body := io.TeeReader(errorBody, ringBuffer) 4392 decoder := json.NewDecoder(body) 4393 decoder.UseNumber() 4394 code, message, err := restjson.GetErrorInfo(decoder) 4395 if err != nil { 4396 var snapshot bytes.Buffer 4397 io.Copy(&snapshot, ringBuffer) 4398 err = &smithy.DeserializationError{ 4399 Err: fmt.Errorf("failed to decode response body, %w", err), 4400 Snapshot: snapshot.Bytes(), 4401 } 4402 return err 4403 } 4404 4405 errorBody.Seek(0, io.SeekStart) 4406 if len(code) != 0 { 4407 errorCode = restjson.SanitizeErrorCode(code) 4408 } 4409 if len(message) != 0 { 4410 errorMessage = message 4411 } 4412 4413 switch { 4414 case strings.EqualFold("InternalServerException", errorCode): 4415 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4416 4417 case strings.EqualFold("ResourceNotFoundException", errorCode): 4418 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4419 4420 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 4421 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 4422 4423 case strings.EqualFold("ThrottlingException", errorCode): 4424 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4425 4426 case strings.EqualFold("ValidationException", errorCode): 4427 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4428 4429 default: 4430 genericError := &smithy.GenericAPIError{ 4431 Code: errorCode, 4432 Message: errorMessage, 4433 } 4434 return genericError 4435 4436 } 4437} 4438 4439func awsRestjson1_deserializeOpDocumentDescribeSlotOutput(v **DescribeSlotOutput, value interface{}) error { 4440 if v == nil { 4441 return fmt.Errorf("unexpected nil of type %T", v) 4442 } 4443 if value == nil { 4444 return nil 4445 } 4446 4447 shape, ok := value.(map[string]interface{}) 4448 if !ok { 4449 return fmt.Errorf("unexpected JSON type %v", value) 4450 } 4451 4452 var sv *DescribeSlotOutput 4453 if *v == nil { 4454 sv = &DescribeSlotOutput{} 4455 } else { 4456 sv = *v 4457 } 4458 4459 for key, value := range shape { 4460 switch key { 4461 case "botId": 4462 if value != nil { 4463 jtv, ok := value.(string) 4464 if !ok { 4465 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4466 } 4467 sv.BotId = ptr.String(jtv) 4468 } 4469 4470 case "botVersion": 4471 if value != nil { 4472 jtv, ok := value.(string) 4473 if !ok { 4474 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 4475 } 4476 sv.BotVersion = ptr.String(jtv) 4477 } 4478 4479 case "creationDateTime": 4480 if value != nil { 4481 jtv, ok := value.(json.Number) 4482 if !ok { 4483 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 4484 } 4485 f64, err := jtv.Float64() 4486 if err != nil { 4487 return err 4488 } 4489 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4490 } 4491 4492 case "description": 4493 if value != nil { 4494 jtv, ok := value.(string) 4495 if !ok { 4496 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 4497 } 4498 sv.Description = ptr.String(jtv) 4499 } 4500 4501 case "intentId": 4502 if value != nil { 4503 jtv, ok := value.(string) 4504 if !ok { 4505 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4506 } 4507 sv.IntentId = ptr.String(jtv) 4508 } 4509 4510 case "lastUpdatedDateTime": 4511 if value != nil { 4512 jtv, ok := value.(json.Number) 4513 if !ok { 4514 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 4515 } 4516 f64, err := jtv.Float64() 4517 if err != nil { 4518 return err 4519 } 4520 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4521 } 4522 4523 case "localeId": 4524 if value != nil { 4525 jtv, ok := value.(string) 4526 if !ok { 4527 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 4528 } 4529 sv.LocaleId = ptr.String(jtv) 4530 } 4531 4532 case "obfuscationSetting": 4533 if err := awsRestjson1_deserializeDocumentObfuscationSetting(&sv.ObfuscationSetting, value); err != nil { 4534 return err 4535 } 4536 4537 case "slotId": 4538 if value != nil { 4539 jtv, ok := value.(string) 4540 if !ok { 4541 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4542 } 4543 sv.SlotId = ptr.String(jtv) 4544 } 4545 4546 case "slotName": 4547 if value != nil { 4548 jtv, ok := value.(string) 4549 if !ok { 4550 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4551 } 4552 sv.SlotName = ptr.String(jtv) 4553 } 4554 4555 case "slotTypeId": 4556 if value != nil { 4557 jtv, ok := value.(string) 4558 if !ok { 4559 return fmt.Errorf("expected BuiltInOrCustomSlotTypeId to be of type string, got %T instead", value) 4560 } 4561 sv.SlotTypeId = ptr.String(jtv) 4562 } 4563 4564 case "valueElicitationSetting": 4565 if err := awsRestjson1_deserializeDocumentSlotValueElicitationSetting(&sv.ValueElicitationSetting, value); err != nil { 4566 return err 4567 } 4568 4569 default: 4570 _, _ = key, value 4571 4572 } 4573 } 4574 *v = sv 4575 return nil 4576} 4577 4578type awsRestjson1_deserializeOpDescribeSlotType struct { 4579} 4580 4581func (*awsRestjson1_deserializeOpDescribeSlotType) ID() string { 4582 return "OperationDeserializer" 4583} 4584 4585func (m *awsRestjson1_deserializeOpDescribeSlotType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4586 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4587) { 4588 out, metadata, err = next.HandleDeserialize(ctx, in) 4589 if err != nil { 4590 return out, metadata, err 4591 } 4592 4593 response, ok := out.RawResponse.(*smithyhttp.Response) 4594 if !ok { 4595 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4596 } 4597 4598 if response.StatusCode < 200 || response.StatusCode >= 300 { 4599 return out, metadata, awsRestjson1_deserializeOpErrorDescribeSlotType(response, &metadata) 4600 } 4601 output := &DescribeSlotTypeOutput{} 4602 out.Result = output 4603 4604 var buff [1024]byte 4605 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4606 4607 body := io.TeeReader(response.Body, ringBuffer) 4608 4609 decoder := json.NewDecoder(body) 4610 decoder.UseNumber() 4611 var shape interface{} 4612 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4613 var snapshot bytes.Buffer 4614 io.Copy(&snapshot, ringBuffer) 4615 err = &smithy.DeserializationError{ 4616 Err: fmt.Errorf("failed to decode response body, %w", err), 4617 Snapshot: snapshot.Bytes(), 4618 } 4619 return out, metadata, err 4620 } 4621 4622 err = awsRestjson1_deserializeOpDocumentDescribeSlotTypeOutput(&output, shape) 4623 if err != nil { 4624 var snapshot bytes.Buffer 4625 io.Copy(&snapshot, ringBuffer) 4626 return out, metadata, &smithy.DeserializationError{ 4627 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4628 Snapshot: snapshot.Bytes(), 4629 } 4630 } 4631 4632 return out, metadata, err 4633} 4634 4635func awsRestjson1_deserializeOpErrorDescribeSlotType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4636 var errorBuffer bytes.Buffer 4637 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4638 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4639 } 4640 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4641 4642 errorCode := "UnknownError" 4643 errorMessage := errorCode 4644 4645 code := response.Header.Get("X-Amzn-ErrorType") 4646 if len(code) != 0 { 4647 errorCode = restjson.SanitizeErrorCode(code) 4648 } 4649 4650 var buff [1024]byte 4651 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4652 4653 body := io.TeeReader(errorBody, ringBuffer) 4654 decoder := json.NewDecoder(body) 4655 decoder.UseNumber() 4656 code, message, err := restjson.GetErrorInfo(decoder) 4657 if err != nil { 4658 var snapshot bytes.Buffer 4659 io.Copy(&snapshot, ringBuffer) 4660 err = &smithy.DeserializationError{ 4661 Err: fmt.Errorf("failed to decode response body, %w", err), 4662 Snapshot: snapshot.Bytes(), 4663 } 4664 return err 4665 } 4666 4667 errorBody.Seek(0, io.SeekStart) 4668 if len(code) != 0 { 4669 errorCode = restjson.SanitizeErrorCode(code) 4670 } 4671 if len(message) != 0 { 4672 errorMessage = message 4673 } 4674 4675 switch { 4676 case strings.EqualFold("InternalServerException", errorCode): 4677 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4678 4679 case strings.EqualFold("ResourceNotFoundException", errorCode): 4680 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 4681 4682 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 4683 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 4684 4685 case strings.EqualFold("ThrottlingException", errorCode): 4686 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4687 4688 case strings.EqualFold("ValidationException", errorCode): 4689 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4690 4691 default: 4692 genericError := &smithy.GenericAPIError{ 4693 Code: errorCode, 4694 Message: errorMessage, 4695 } 4696 return genericError 4697 4698 } 4699} 4700 4701func awsRestjson1_deserializeOpDocumentDescribeSlotTypeOutput(v **DescribeSlotTypeOutput, value interface{}) error { 4702 if v == nil { 4703 return fmt.Errorf("unexpected nil of type %T", v) 4704 } 4705 if value == nil { 4706 return nil 4707 } 4708 4709 shape, ok := value.(map[string]interface{}) 4710 if !ok { 4711 return fmt.Errorf("unexpected JSON type %v", value) 4712 } 4713 4714 var sv *DescribeSlotTypeOutput 4715 if *v == nil { 4716 sv = &DescribeSlotTypeOutput{} 4717 } else { 4718 sv = *v 4719 } 4720 4721 for key, value := range shape { 4722 switch key { 4723 case "botId": 4724 if value != nil { 4725 jtv, ok := value.(string) 4726 if !ok { 4727 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4728 } 4729 sv.BotId = ptr.String(jtv) 4730 } 4731 4732 case "botVersion": 4733 if value != nil { 4734 jtv, ok := value.(string) 4735 if !ok { 4736 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 4737 } 4738 sv.BotVersion = ptr.String(jtv) 4739 } 4740 4741 case "creationDateTime": 4742 if value != nil { 4743 jtv, ok := value.(json.Number) 4744 if !ok { 4745 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 4746 } 4747 f64, err := jtv.Float64() 4748 if err != nil { 4749 return err 4750 } 4751 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4752 } 4753 4754 case "description": 4755 if value != nil { 4756 jtv, ok := value.(string) 4757 if !ok { 4758 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 4759 } 4760 sv.Description = ptr.String(jtv) 4761 } 4762 4763 case "lastUpdatedDateTime": 4764 if value != nil { 4765 jtv, ok := value.(json.Number) 4766 if !ok { 4767 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 4768 } 4769 f64, err := jtv.Float64() 4770 if err != nil { 4771 return err 4772 } 4773 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4774 } 4775 4776 case "localeId": 4777 if value != nil { 4778 jtv, ok := value.(string) 4779 if !ok { 4780 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 4781 } 4782 sv.LocaleId = ptr.String(jtv) 4783 } 4784 4785 case "parentSlotTypeSignature": 4786 if value != nil { 4787 jtv, ok := value.(string) 4788 if !ok { 4789 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 4790 } 4791 sv.ParentSlotTypeSignature = ptr.String(jtv) 4792 } 4793 4794 case "slotTypeId": 4795 if value != nil { 4796 jtv, ok := value.(string) 4797 if !ok { 4798 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4799 } 4800 sv.SlotTypeId = ptr.String(jtv) 4801 } 4802 4803 case "slotTypeName": 4804 if value != nil { 4805 jtv, ok := value.(string) 4806 if !ok { 4807 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 4808 } 4809 sv.SlotTypeName = ptr.String(jtv) 4810 } 4811 4812 case "slotTypeValues": 4813 if err := awsRestjson1_deserializeDocumentSlotTypeValues(&sv.SlotTypeValues, value); err != nil { 4814 return err 4815 } 4816 4817 case "valueSelectionSetting": 4818 if err := awsRestjson1_deserializeDocumentSlotValueSelectionSetting(&sv.ValueSelectionSetting, value); err != nil { 4819 return err 4820 } 4821 4822 default: 4823 _, _ = key, value 4824 4825 } 4826 } 4827 *v = sv 4828 return nil 4829} 4830 4831type awsRestjson1_deserializeOpListBotAliases struct { 4832} 4833 4834func (*awsRestjson1_deserializeOpListBotAliases) ID() string { 4835 return "OperationDeserializer" 4836} 4837 4838func (m *awsRestjson1_deserializeOpListBotAliases) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 4839 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 4840) { 4841 out, metadata, err = next.HandleDeserialize(ctx, in) 4842 if err != nil { 4843 return out, metadata, err 4844 } 4845 4846 response, ok := out.RawResponse.(*smithyhttp.Response) 4847 if !ok { 4848 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 4849 } 4850 4851 if response.StatusCode < 200 || response.StatusCode >= 300 { 4852 return out, metadata, awsRestjson1_deserializeOpErrorListBotAliases(response, &metadata) 4853 } 4854 output := &ListBotAliasesOutput{} 4855 out.Result = output 4856 4857 var buff [1024]byte 4858 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4859 4860 body := io.TeeReader(response.Body, ringBuffer) 4861 4862 decoder := json.NewDecoder(body) 4863 decoder.UseNumber() 4864 var shape interface{} 4865 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 4866 var snapshot bytes.Buffer 4867 io.Copy(&snapshot, ringBuffer) 4868 err = &smithy.DeserializationError{ 4869 Err: fmt.Errorf("failed to decode response body, %w", err), 4870 Snapshot: snapshot.Bytes(), 4871 } 4872 return out, metadata, err 4873 } 4874 4875 err = awsRestjson1_deserializeOpDocumentListBotAliasesOutput(&output, shape) 4876 if err != nil { 4877 var snapshot bytes.Buffer 4878 io.Copy(&snapshot, ringBuffer) 4879 return out, metadata, &smithy.DeserializationError{ 4880 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 4881 Snapshot: snapshot.Bytes(), 4882 } 4883 } 4884 4885 return out, metadata, err 4886} 4887 4888func awsRestjson1_deserializeOpErrorListBotAliases(response *smithyhttp.Response, metadata *middleware.Metadata) error { 4889 var errorBuffer bytes.Buffer 4890 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 4891 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 4892 } 4893 errorBody := bytes.NewReader(errorBuffer.Bytes()) 4894 4895 errorCode := "UnknownError" 4896 errorMessage := errorCode 4897 4898 code := response.Header.Get("X-Amzn-ErrorType") 4899 if len(code) != 0 { 4900 errorCode = restjson.SanitizeErrorCode(code) 4901 } 4902 4903 var buff [1024]byte 4904 ringBuffer := smithyio.NewRingBuffer(buff[:]) 4905 4906 body := io.TeeReader(errorBody, ringBuffer) 4907 decoder := json.NewDecoder(body) 4908 decoder.UseNumber() 4909 code, message, err := restjson.GetErrorInfo(decoder) 4910 if err != nil { 4911 var snapshot bytes.Buffer 4912 io.Copy(&snapshot, ringBuffer) 4913 err = &smithy.DeserializationError{ 4914 Err: fmt.Errorf("failed to decode response body, %w", err), 4915 Snapshot: snapshot.Bytes(), 4916 } 4917 return err 4918 } 4919 4920 errorBody.Seek(0, io.SeekStart) 4921 if len(code) != 0 { 4922 errorCode = restjson.SanitizeErrorCode(code) 4923 } 4924 if len(message) != 0 { 4925 errorMessage = message 4926 } 4927 4928 switch { 4929 case strings.EqualFold("InternalServerException", errorCode): 4930 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 4931 4932 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 4933 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 4934 4935 case strings.EqualFold("ThrottlingException", errorCode): 4936 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 4937 4938 case strings.EqualFold("ValidationException", errorCode): 4939 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 4940 4941 default: 4942 genericError := &smithy.GenericAPIError{ 4943 Code: errorCode, 4944 Message: errorMessage, 4945 } 4946 return genericError 4947 4948 } 4949} 4950 4951func awsRestjson1_deserializeOpDocumentListBotAliasesOutput(v **ListBotAliasesOutput, value interface{}) error { 4952 if v == nil { 4953 return fmt.Errorf("unexpected nil of type %T", v) 4954 } 4955 if value == nil { 4956 return nil 4957 } 4958 4959 shape, ok := value.(map[string]interface{}) 4960 if !ok { 4961 return fmt.Errorf("unexpected JSON type %v", value) 4962 } 4963 4964 var sv *ListBotAliasesOutput 4965 if *v == nil { 4966 sv = &ListBotAliasesOutput{} 4967 } else { 4968 sv = *v 4969 } 4970 4971 for key, value := range shape { 4972 switch key { 4973 case "botAliasSummaries": 4974 if err := awsRestjson1_deserializeDocumentBotAliasSummaryList(&sv.BotAliasSummaries, value); err != nil { 4975 return err 4976 } 4977 4978 case "botId": 4979 if value != nil { 4980 jtv, ok := value.(string) 4981 if !ok { 4982 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 4983 } 4984 sv.BotId = ptr.String(jtv) 4985 } 4986 4987 case "nextToken": 4988 if value != nil { 4989 jtv, ok := value.(string) 4990 if !ok { 4991 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 4992 } 4993 sv.NextToken = ptr.String(jtv) 4994 } 4995 4996 default: 4997 _, _ = key, value 4998 4999 } 5000 } 5001 *v = sv 5002 return nil 5003} 5004 5005type awsRestjson1_deserializeOpListBotLocales struct { 5006} 5007 5008func (*awsRestjson1_deserializeOpListBotLocales) ID() string { 5009 return "OperationDeserializer" 5010} 5011 5012func (m *awsRestjson1_deserializeOpListBotLocales) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5013 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5014) { 5015 out, metadata, err = next.HandleDeserialize(ctx, in) 5016 if err != nil { 5017 return out, metadata, err 5018 } 5019 5020 response, ok := out.RawResponse.(*smithyhttp.Response) 5021 if !ok { 5022 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5023 } 5024 5025 if response.StatusCode < 200 || response.StatusCode >= 300 { 5026 return out, metadata, awsRestjson1_deserializeOpErrorListBotLocales(response, &metadata) 5027 } 5028 output := &ListBotLocalesOutput{} 5029 out.Result = output 5030 5031 var buff [1024]byte 5032 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5033 5034 body := io.TeeReader(response.Body, ringBuffer) 5035 5036 decoder := json.NewDecoder(body) 5037 decoder.UseNumber() 5038 var shape interface{} 5039 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5040 var snapshot bytes.Buffer 5041 io.Copy(&snapshot, ringBuffer) 5042 err = &smithy.DeserializationError{ 5043 Err: fmt.Errorf("failed to decode response body, %w", err), 5044 Snapshot: snapshot.Bytes(), 5045 } 5046 return out, metadata, err 5047 } 5048 5049 err = awsRestjson1_deserializeOpDocumentListBotLocalesOutput(&output, shape) 5050 if err != nil { 5051 var snapshot bytes.Buffer 5052 io.Copy(&snapshot, ringBuffer) 5053 return out, metadata, &smithy.DeserializationError{ 5054 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5055 Snapshot: snapshot.Bytes(), 5056 } 5057 } 5058 5059 return out, metadata, err 5060} 5061 5062func awsRestjson1_deserializeOpErrorListBotLocales(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5063 var errorBuffer bytes.Buffer 5064 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5065 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5066 } 5067 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5068 5069 errorCode := "UnknownError" 5070 errorMessage := errorCode 5071 5072 code := response.Header.Get("X-Amzn-ErrorType") 5073 if len(code) != 0 { 5074 errorCode = restjson.SanitizeErrorCode(code) 5075 } 5076 5077 var buff [1024]byte 5078 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5079 5080 body := io.TeeReader(errorBody, ringBuffer) 5081 decoder := json.NewDecoder(body) 5082 decoder.UseNumber() 5083 code, message, err := restjson.GetErrorInfo(decoder) 5084 if err != nil { 5085 var snapshot bytes.Buffer 5086 io.Copy(&snapshot, ringBuffer) 5087 err = &smithy.DeserializationError{ 5088 Err: fmt.Errorf("failed to decode response body, %w", err), 5089 Snapshot: snapshot.Bytes(), 5090 } 5091 return err 5092 } 5093 5094 errorBody.Seek(0, io.SeekStart) 5095 if len(code) != 0 { 5096 errorCode = restjson.SanitizeErrorCode(code) 5097 } 5098 if len(message) != 0 { 5099 errorMessage = message 5100 } 5101 5102 switch { 5103 case strings.EqualFold("InternalServerException", errorCode): 5104 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5105 5106 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 5107 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 5108 5109 case strings.EqualFold("ThrottlingException", errorCode): 5110 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5111 5112 case strings.EqualFold("ValidationException", errorCode): 5113 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5114 5115 default: 5116 genericError := &smithy.GenericAPIError{ 5117 Code: errorCode, 5118 Message: errorMessage, 5119 } 5120 return genericError 5121 5122 } 5123} 5124 5125func awsRestjson1_deserializeOpDocumentListBotLocalesOutput(v **ListBotLocalesOutput, value interface{}) error { 5126 if v == nil { 5127 return fmt.Errorf("unexpected nil of type %T", v) 5128 } 5129 if value == nil { 5130 return nil 5131 } 5132 5133 shape, ok := value.(map[string]interface{}) 5134 if !ok { 5135 return fmt.Errorf("unexpected JSON type %v", value) 5136 } 5137 5138 var sv *ListBotLocalesOutput 5139 if *v == nil { 5140 sv = &ListBotLocalesOutput{} 5141 } else { 5142 sv = *v 5143 } 5144 5145 for key, value := range shape { 5146 switch key { 5147 case "botId": 5148 if value != nil { 5149 jtv, ok := value.(string) 5150 if !ok { 5151 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5152 } 5153 sv.BotId = ptr.String(jtv) 5154 } 5155 5156 case "botLocaleSummaries": 5157 if err := awsRestjson1_deserializeDocumentBotLocaleSummaryList(&sv.BotLocaleSummaries, value); err != nil { 5158 return err 5159 } 5160 5161 case "botVersion": 5162 if value != nil { 5163 jtv, ok := value.(string) 5164 if !ok { 5165 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 5166 } 5167 sv.BotVersion = ptr.String(jtv) 5168 } 5169 5170 case "nextToken": 5171 if value != nil { 5172 jtv, ok := value.(string) 5173 if !ok { 5174 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5175 } 5176 sv.NextToken = ptr.String(jtv) 5177 } 5178 5179 default: 5180 _, _ = key, value 5181 5182 } 5183 } 5184 *v = sv 5185 return nil 5186} 5187 5188type awsRestjson1_deserializeOpListBots struct { 5189} 5190 5191func (*awsRestjson1_deserializeOpListBots) ID() string { 5192 return "OperationDeserializer" 5193} 5194 5195func (m *awsRestjson1_deserializeOpListBots) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5196 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5197) { 5198 out, metadata, err = next.HandleDeserialize(ctx, in) 5199 if err != nil { 5200 return out, metadata, err 5201 } 5202 5203 response, ok := out.RawResponse.(*smithyhttp.Response) 5204 if !ok { 5205 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5206 } 5207 5208 if response.StatusCode < 200 || response.StatusCode >= 300 { 5209 return out, metadata, awsRestjson1_deserializeOpErrorListBots(response, &metadata) 5210 } 5211 output := &ListBotsOutput{} 5212 out.Result = output 5213 5214 var buff [1024]byte 5215 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5216 5217 body := io.TeeReader(response.Body, ringBuffer) 5218 5219 decoder := json.NewDecoder(body) 5220 decoder.UseNumber() 5221 var shape interface{} 5222 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5223 var snapshot bytes.Buffer 5224 io.Copy(&snapshot, ringBuffer) 5225 err = &smithy.DeserializationError{ 5226 Err: fmt.Errorf("failed to decode response body, %w", err), 5227 Snapshot: snapshot.Bytes(), 5228 } 5229 return out, metadata, err 5230 } 5231 5232 err = awsRestjson1_deserializeOpDocumentListBotsOutput(&output, shape) 5233 if err != nil { 5234 var snapshot bytes.Buffer 5235 io.Copy(&snapshot, ringBuffer) 5236 return out, metadata, &smithy.DeserializationError{ 5237 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5238 Snapshot: snapshot.Bytes(), 5239 } 5240 } 5241 5242 return out, metadata, err 5243} 5244 5245func awsRestjson1_deserializeOpErrorListBots(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5246 var errorBuffer bytes.Buffer 5247 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5248 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5249 } 5250 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5251 5252 errorCode := "UnknownError" 5253 errorMessage := errorCode 5254 5255 code := response.Header.Get("X-Amzn-ErrorType") 5256 if len(code) != 0 { 5257 errorCode = restjson.SanitizeErrorCode(code) 5258 } 5259 5260 var buff [1024]byte 5261 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5262 5263 body := io.TeeReader(errorBody, ringBuffer) 5264 decoder := json.NewDecoder(body) 5265 decoder.UseNumber() 5266 code, message, err := restjson.GetErrorInfo(decoder) 5267 if err != nil { 5268 var snapshot bytes.Buffer 5269 io.Copy(&snapshot, ringBuffer) 5270 err = &smithy.DeserializationError{ 5271 Err: fmt.Errorf("failed to decode response body, %w", err), 5272 Snapshot: snapshot.Bytes(), 5273 } 5274 return err 5275 } 5276 5277 errorBody.Seek(0, io.SeekStart) 5278 if len(code) != 0 { 5279 errorCode = restjson.SanitizeErrorCode(code) 5280 } 5281 if len(message) != 0 { 5282 errorMessage = message 5283 } 5284 5285 switch { 5286 case strings.EqualFold("InternalServerException", errorCode): 5287 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5288 5289 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 5290 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 5291 5292 case strings.EqualFold("ThrottlingException", errorCode): 5293 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5294 5295 case strings.EqualFold("ValidationException", errorCode): 5296 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5297 5298 default: 5299 genericError := &smithy.GenericAPIError{ 5300 Code: errorCode, 5301 Message: errorMessage, 5302 } 5303 return genericError 5304 5305 } 5306} 5307 5308func awsRestjson1_deserializeOpDocumentListBotsOutput(v **ListBotsOutput, value interface{}) error { 5309 if v == nil { 5310 return fmt.Errorf("unexpected nil of type %T", v) 5311 } 5312 if value == nil { 5313 return nil 5314 } 5315 5316 shape, ok := value.(map[string]interface{}) 5317 if !ok { 5318 return fmt.Errorf("unexpected JSON type %v", value) 5319 } 5320 5321 var sv *ListBotsOutput 5322 if *v == nil { 5323 sv = &ListBotsOutput{} 5324 } else { 5325 sv = *v 5326 } 5327 5328 for key, value := range shape { 5329 switch key { 5330 case "botSummaries": 5331 if err := awsRestjson1_deserializeDocumentBotSummaryList(&sv.BotSummaries, value); err != nil { 5332 return err 5333 } 5334 5335 case "nextToken": 5336 if value != nil { 5337 jtv, ok := value.(string) 5338 if !ok { 5339 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5340 } 5341 sv.NextToken = ptr.String(jtv) 5342 } 5343 5344 default: 5345 _, _ = key, value 5346 5347 } 5348 } 5349 *v = sv 5350 return nil 5351} 5352 5353type awsRestjson1_deserializeOpListBotVersions struct { 5354} 5355 5356func (*awsRestjson1_deserializeOpListBotVersions) ID() string { 5357 return "OperationDeserializer" 5358} 5359 5360func (m *awsRestjson1_deserializeOpListBotVersions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5361 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5362) { 5363 out, metadata, err = next.HandleDeserialize(ctx, in) 5364 if err != nil { 5365 return out, metadata, err 5366 } 5367 5368 response, ok := out.RawResponse.(*smithyhttp.Response) 5369 if !ok { 5370 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5371 } 5372 5373 if response.StatusCode < 200 || response.StatusCode >= 300 { 5374 return out, metadata, awsRestjson1_deserializeOpErrorListBotVersions(response, &metadata) 5375 } 5376 output := &ListBotVersionsOutput{} 5377 out.Result = output 5378 5379 var buff [1024]byte 5380 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5381 5382 body := io.TeeReader(response.Body, ringBuffer) 5383 5384 decoder := json.NewDecoder(body) 5385 decoder.UseNumber() 5386 var shape interface{} 5387 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5388 var snapshot bytes.Buffer 5389 io.Copy(&snapshot, ringBuffer) 5390 err = &smithy.DeserializationError{ 5391 Err: fmt.Errorf("failed to decode response body, %w", err), 5392 Snapshot: snapshot.Bytes(), 5393 } 5394 return out, metadata, err 5395 } 5396 5397 err = awsRestjson1_deserializeOpDocumentListBotVersionsOutput(&output, shape) 5398 if err != nil { 5399 var snapshot bytes.Buffer 5400 io.Copy(&snapshot, ringBuffer) 5401 return out, metadata, &smithy.DeserializationError{ 5402 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5403 Snapshot: snapshot.Bytes(), 5404 } 5405 } 5406 5407 return out, metadata, err 5408} 5409 5410func awsRestjson1_deserializeOpErrorListBotVersions(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5411 var errorBuffer bytes.Buffer 5412 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5413 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5414 } 5415 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5416 5417 errorCode := "UnknownError" 5418 errorMessage := errorCode 5419 5420 code := response.Header.Get("X-Amzn-ErrorType") 5421 if len(code) != 0 { 5422 errorCode = restjson.SanitizeErrorCode(code) 5423 } 5424 5425 var buff [1024]byte 5426 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5427 5428 body := io.TeeReader(errorBody, ringBuffer) 5429 decoder := json.NewDecoder(body) 5430 decoder.UseNumber() 5431 code, message, err := restjson.GetErrorInfo(decoder) 5432 if err != nil { 5433 var snapshot bytes.Buffer 5434 io.Copy(&snapshot, ringBuffer) 5435 err = &smithy.DeserializationError{ 5436 Err: fmt.Errorf("failed to decode response body, %w", err), 5437 Snapshot: snapshot.Bytes(), 5438 } 5439 return err 5440 } 5441 5442 errorBody.Seek(0, io.SeekStart) 5443 if len(code) != 0 { 5444 errorCode = restjson.SanitizeErrorCode(code) 5445 } 5446 if len(message) != 0 { 5447 errorMessage = message 5448 } 5449 5450 switch { 5451 case strings.EqualFold("InternalServerException", errorCode): 5452 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5453 5454 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 5455 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 5456 5457 case strings.EqualFold("ThrottlingException", errorCode): 5458 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5459 5460 case strings.EqualFold("ValidationException", errorCode): 5461 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5462 5463 default: 5464 genericError := &smithy.GenericAPIError{ 5465 Code: errorCode, 5466 Message: errorMessage, 5467 } 5468 return genericError 5469 5470 } 5471} 5472 5473func awsRestjson1_deserializeOpDocumentListBotVersionsOutput(v **ListBotVersionsOutput, value interface{}) error { 5474 if v == nil { 5475 return fmt.Errorf("unexpected nil of type %T", v) 5476 } 5477 if value == nil { 5478 return nil 5479 } 5480 5481 shape, ok := value.(map[string]interface{}) 5482 if !ok { 5483 return fmt.Errorf("unexpected JSON type %v", value) 5484 } 5485 5486 var sv *ListBotVersionsOutput 5487 if *v == nil { 5488 sv = &ListBotVersionsOutput{} 5489 } else { 5490 sv = *v 5491 } 5492 5493 for key, value := range shape { 5494 switch key { 5495 case "botId": 5496 if value != nil { 5497 jtv, ok := value.(string) 5498 if !ok { 5499 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 5500 } 5501 sv.BotId = ptr.String(jtv) 5502 } 5503 5504 case "botVersionSummaries": 5505 if err := awsRestjson1_deserializeDocumentBotVersionSummaryList(&sv.BotVersionSummaries, value); err != nil { 5506 return err 5507 } 5508 5509 case "nextToken": 5510 if value != nil { 5511 jtv, ok := value.(string) 5512 if !ok { 5513 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5514 } 5515 sv.NextToken = ptr.String(jtv) 5516 } 5517 5518 default: 5519 _, _ = key, value 5520 5521 } 5522 } 5523 *v = sv 5524 return nil 5525} 5526 5527type awsRestjson1_deserializeOpListBuiltInIntents struct { 5528} 5529 5530func (*awsRestjson1_deserializeOpListBuiltInIntents) ID() string { 5531 return "OperationDeserializer" 5532} 5533 5534func (m *awsRestjson1_deserializeOpListBuiltInIntents) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5535 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5536) { 5537 out, metadata, err = next.HandleDeserialize(ctx, in) 5538 if err != nil { 5539 return out, metadata, err 5540 } 5541 5542 response, ok := out.RawResponse.(*smithyhttp.Response) 5543 if !ok { 5544 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5545 } 5546 5547 if response.StatusCode < 200 || response.StatusCode >= 300 { 5548 return out, metadata, awsRestjson1_deserializeOpErrorListBuiltInIntents(response, &metadata) 5549 } 5550 output := &ListBuiltInIntentsOutput{} 5551 out.Result = output 5552 5553 var buff [1024]byte 5554 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5555 5556 body := io.TeeReader(response.Body, ringBuffer) 5557 5558 decoder := json.NewDecoder(body) 5559 decoder.UseNumber() 5560 var shape interface{} 5561 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5562 var snapshot bytes.Buffer 5563 io.Copy(&snapshot, ringBuffer) 5564 err = &smithy.DeserializationError{ 5565 Err: fmt.Errorf("failed to decode response body, %w", err), 5566 Snapshot: snapshot.Bytes(), 5567 } 5568 return out, metadata, err 5569 } 5570 5571 err = awsRestjson1_deserializeOpDocumentListBuiltInIntentsOutput(&output, shape) 5572 if err != nil { 5573 var snapshot bytes.Buffer 5574 io.Copy(&snapshot, ringBuffer) 5575 return out, metadata, &smithy.DeserializationError{ 5576 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5577 Snapshot: snapshot.Bytes(), 5578 } 5579 } 5580 5581 return out, metadata, err 5582} 5583 5584func awsRestjson1_deserializeOpErrorListBuiltInIntents(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5585 var errorBuffer bytes.Buffer 5586 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5587 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5588 } 5589 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5590 5591 errorCode := "UnknownError" 5592 errorMessage := errorCode 5593 5594 code := response.Header.Get("X-Amzn-ErrorType") 5595 if len(code) != 0 { 5596 errorCode = restjson.SanitizeErrorCode(code) 5597 } 5598 5599 var buff [1024]byte 5600 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5601 5602 body := io.TeeReader(errorBody, ringBuffer) 5603 decoder := json.NewDecoder(body) 5604 decoder.UseNumber() 5605 code, message, err := restjson.GetErrorInfo(decoder) 5606 if err != nil { 5607 var snapshot bytes.Buffer 5608 io.Copy(&snapshot, ringBuffer) 5609 err = &smithy.DeserializationError{ 5610 Err: fmt.Errorf("failed to decode response body, %w", err), 5611 Snapshot: snapshot.Bytes(), 5612 } 5613 return err 5614 } 5615 5616 errorBody.Seek(0, io.SeekStart) 5617 if len(code) != 0 { 5618 errorCode = restjson.SanitizeErrorCode(code) 5619 } 5620 if len(message) != 0 { 5621 errorMessage = message 5622 } 5623 5624 switch { 5625 case strings.EqualFold("InternalServerException", errorCode): 5626 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5627 5628 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 5629 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 5630 5631 case strings.EqualFold("ThrottlingException", errorCode): 5632 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5633 5634 case strings.EqualFold("ValidationException", errorCode): 5635 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5636 5637 default: 5638 genericError := &smithy.GenericAPIError{ 5639 Code: errorCode, 5640 Message: errorMessage, 5641 } 5642 return genericError 5643 5644 } 5645} 5646 5647func awsRestjson1_deserializeOpDocumentListBuiltInIntentsOutput(v **ListBuiltInIntentsOutput, value interface{}) error { 5648 if v == nil { 5649 return fmt.Errorf("unexpected nil of type %T", v) 5650 } 5651 if value == nil { 5652 return nil 5653 } 5654 5655 shape, ok := value.(map[string]interface{}) 5656 if !ok { 5657 return fmt.Errorf("unexpected JSON type %v", value) 5658 } 5659 5660 var sv *ListBuiltInIntentsOutput 5661 if *v == nil { 5662 sv = &ListBuiltInIntentsOutput{} 5663 } else { 5664 sv = *v 5665 } 5666 5667 for key, value := range shape { 5668 switch key { 5669 case "builtInIntentSummaries": 5670 if err := awsRestjson1_deserializeDocumentBuiltInIntentSummaryList(&sv.BuiltInIntentSummaries, value); err != nil { 5671 return err 5672 } 5673 5674 case "localeId": 5675 if value != nil { 5676 jtv, ok := value.(string) 5677 if !ok { 5678 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 5679 } 5680 sv.LocaleId = ptr.String(jtv) 5681 } 5682 5683 case "nextToken": 5684 if value != nil { 5685 jtv, ok := value.(string) 5686 if !ok { 5687 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5688 } 5689 sv.NextToken = ptr.String(jtv) 5690 } 5691 5692 default: 5693 _, _ = key, value 5694 5695 } 5696 } 5697 *v = sv 5698 return nil 5699} 5700 5701type awsRestjson1_deserializeOpListBuiltInSlotTypes struct { 5702} 5703 5704func (*awsRestjson1_deserializeOpListBuiltInSlotTypes) ID() string { 5705 return "OperationDeserializer" 5706} 5707 5708func (m *awsRestjson1_deserializeOpListBuiltInSlotTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5709 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5710) { 5711 out, metadata, err = next.HandleDeserialize(ctx, in) 5712 if err != nil { 5713 return out, metadata, err 5714 } 5715 5716 response, ok := out.RawResponse.(*smithyhttp.Response) 5717 if !ok { 5718 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5719 } 5720 5721 if response.StatusCode < 200 || response.StatusCode >= 300 { 5722 return out, metadata, awsRestjson1_deserializeOpErrorListBuiltInSlotTypes(response, &metadata) 5723 } 5724 output := &ListBuiltInSlotTypesOutput{} 5725 out.Result = output 5726 5727 var buff [1024]byte 5728 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5729 5730 body := io.TeeReader(response.Body, ringBuffer) 5731 5732 decoder := json.NewDecoder(body) 5733 decoder.UseNumber() 5734 var shape interface{} 5735 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5736 var snapshot bytes.Buffer 5737 io.Copy(&snapshot, ringBuffer) 5738 err = &smithy.DeserializationError{ 5739 Err: fmt.Errorf("failed to decode response body, %w", err), 5740 Snapshot: snapshot.Bytes(), 5741 } 5742 return out, metadata, err 5743 } 5744 5745 err = awsRestjson1_deserializeOpDocumentListBuiltInSlotTypesOutput(&output, shape) 5746 if err != nil { 5747 var snapshot bytes.Buffer 5748 io.Copy(&snapshot, ringBuffer) 5749 return out, metadata, &smithy.DeserializationError{ 5750 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5751 Snapshot: snapshot.Bytes(), 5752 } 5753 } 5754 5755 return out, metadata, err 5756} 5757 5758func awsRestjson1_deserializeOpErrorListBuiltInSlotTypes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5759 var errorBuffer bytes.Buffer 5760 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5761 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5762 } 5763 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5764 5765 errorCode := "UnknownError" 5766 errorMessage := errorCode 5767 5768 code := response.Header.Get("X-Amzn-ErrorType") 5769 if len(code) != 0 { 5770 errorCode = restjson.SanitizeErrorCode(code) 5771 } 5772 5773 var buff [1024]byte 5774 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5775 5776 body := io.TeeReader(errorBody, ringBuffer) 5777 decoder := json.NewDecoder(body) 5778 decoder.UseNumber() 5779 code, message, err := restjson.GetErrorInfo(decoder) 5780 if err != nil { 5781 var snapshot bytes.Buffer 5782 io.Copy(&snapshot, ringBuffer) 5783 err = &smithy.DeserializationError{ 5784 Err: fmt.Errorf("failed to decode response body, %w", err), 5785 Snapshot: snapshot.Bytes(), 5786 } 5787 return err 5788 } 5789 5790 errorBody.Seek(0, io.SeekStart) 5791 if len(code) != 0 { 5792 errorCode = restjson.SanitizeErrorCode(code) 5793 } 5794 if len(message) != 0 { 5795 errorMessage = message 5796 } 5797 5798 switch { 5799 case strings.EqualFold("InternalServerException", errorCode): 5800 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5801 5802 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 5803 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 5804 5805 case strings.EqualFold("ThrottlingException", errorCode): 5806 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5807 5808 case strings.EqualFold("ValidationException", errorCode): 5809 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5810 5811 default: 5812 genericError := &smithy.GenericAPIError{ 5813 Code: errorCode, 5814 Message: errorMessage, 5815 } 5816 return genericError 5817 5818 } 5819} 5820 5821func awsRestjson1_deserializeOpDocumentListBuiltInSlotTypesOutput(v **ListBuiltInSlotTypesOutput, value interface{}) error { 5822 if v == nil { 5823 return fmt.Errorf("unexpected nil of type %T", v) 5824 } 5825 if value == nil { 5826 return nil 5827 } 5828 5829 shape, ok := value.(map[string]interface{}) 5830 if !ok { 5831 return fmt.Errorf("unexpected JSON type %v", value) 5832 } 5833 5834 var sv *ListBuiltInSlotTypesOutput 5835 if *v == nil { 5836 sv = &ListBuiltInSlotTypesOutput{} 5837 } else { 5838 sv = *v 5839 } 5840 5841 for key, value := range shape { 5842 switch key { 5843 case "builtInSlotTypeSummaries": 5844 if err := awsRestjson1_deserializeDocumentBuiltInSlotTypeSummaryList(&sv.BuiltInSlotTypeSummaries, value); err != nil { 5845 return err 5846 } 5847 5848 case "localeId": 5849 if value != nil { 5850 jtv, ok := value.(string) 5851 if !ok { 5852 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 5853 } 5854 sv.LocaleId = ptr.String(jtv) 5855 } 5856 5857 case "nextToken": 5858 if value != nil { 5859 jtv, ok := value.(string) 5860 if !ok { 5861 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 5862 } 5863 sv.NextToken = ptr.String(jtv) 5864 } 5865 5866 default: 5867 _, _ = key, value 5868 5869 } 5870 } 5871 *v = sv 5872 return nil 5873} 5874 5875type awsRestjson1_deserializeOpListIntents struct { 5876} 5877 5878func (*awsRestjson1_deserializeOpListIntents) ID() string { 5879 return "OperationDeserializer" 5880} 5881 5882func (m *awsRestjson1_deserializeOpListIntents) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 5883 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 5884) { 5885 out, metadata, err = next.HandleDeserialize(ctx, in) 5886 if err != nil { 5887 return out, metadata, err 5888 } 5889 5890 response, ok := out.RawResponse.(*smithyhttp.Response) 5891 if !ok { 5892 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 5893 } 5894 5895 if response.StatusCode < 200 || response.StatusCode >= 300 { 5896 return out, metadata, awsRestjson1_deserializeOpErrorListIntents(response, &metadata) 5897 } 5898 output := &ListIntentsOutput{} 5899 out.Result = output 5900 5901 var buff [1024]byte 5902 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5903 5904 body := io.TeeReader(response.Body, ringBuffer) 5905 5906 decoder := json.NewDecoder(body) 5907 decoder.UseNumber() 5908 var shape interface{} 5909 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 5910 var snapshot bytes.Buffer 5911 io.Copy(&snapshot, ringBuffer) 5912 err = &smithy.DeserializationError{ 5913 Err: fmt.Errorf("failed to decode response body, %w", err), 5914 Snapshot: snapshot.Bytes(), 5915 } 5916 return out, metadata, err 5917 } 5918 5919 err = awsRestjson1_deserializeOpDocumentListIntentsOutput(&output, shape) 5920 if err != nil { 5921 var snapshot bytes.Buffer 5922 io.Copy(&snapshot, ringBuffer) 5923 return out, metadata, &smithy.DeserializationError{ 5924 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 5925 Snapshot: snapshot.Bytes(), 5926 } 5927 } 5928 5929 return out, metadata, err 5930} 5931 5932func awsRestjson1_deserializeOpErrorListIntents(response *smithyhttp.Response, metadata *middleware.Metadata) error { 5933 var errorBuffer bytes.Buffer 5934 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 5935 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 5936 } 5937 errorBody := bytes.NewReader(errorBuffer.Bytes()) 5938 5939 errorCode := "UnknownError" 5940 errorMessage := errorCode 5941 5942 code := response.Header.Get("X-Amzn-ErrorType") 5943 if len(code) != 0 { 5944 errorCode = restjson.SanitizeErrorCode(code) 5945 } 5946 5947 var buff [1024]byte 5948 ringBuffer := smithyio.NewRingBuffer(buff[:]) 5949 5950 body := io.TeeReader(errorBody, ringBuffer) 5951 decoder := json.NewDecoder(body) 5952 decoder.UseNumber() 5953 code, message, err := restjson.GetErrorInfo(decoder) 5954 if err != nil { 5955 var snapshot bytes.Buffer 5956 io.Copy(&snapshot, ringBuffer) 5957 err = &smithy.DeserializationError{ 5958 Err: fmt.Errorf("failed to decode response body, %w", err), 5959 Snapshot: snapshot.Bytes(), 5960 } 5961 return err 5962 } 5963 5964 errorBody.Seek(0, io.SeekStart) 5965 if len(code) != 0 { 5966 errorCode = restjson.SanitizeErrorCode(code) 5967 } 5968 if len(message) != 0 { 5969 errorMessage = message 5970 } 5971 5972 switch { 5973 case strings.EqualFold("InternalServerException", errorCode): 5974 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 5975 5976 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 5977 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 5978 5979 case strings.EqualFold("ThrottlingException", errorCode): 5980 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 5981 5982 case strings.EqualFold("ValidationException", errorCode): 5983 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 5984 5985 default: 5986 genericError := &smithy.GenericAPIError{ 5987 Code: errorCode, 5988 Message: errorMessage, 5989 } 5990 return genericError 5991 5992 } 5993} 5994 5995func awsRestjson1_deserializeOpDocumentListIntentsOutput(v **ListIntentsOutput, value interface{}) error { 5996 if v == nil { 5997 return fmt.Errorf("unexpected nil of type %T", v) 5998 } 5999 if value == nil { 6000 return nil 6001 } 6002 6003 shape, ok := value.(map[string]interface{}) 6004 if !ok { 6005 return fmt.Errorf("unexpected JSON type %v", value) 6006 } 6007 6008 var sv *ListIntentsOutput 6009 if *v == nil { 6010 sv = &ListIntentsOutput{} 6011 } else { 6012 sv = *v 6013 } 6014 6015 for key, value := range shape { 6016 switch key { 6017 case "botId": 6018 if value != nil { 6019 jtv, ok := value.(string) 6020 if !ok { 6021 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6022 } 6023 sv.BotId = ptr.String(jtv) 6024 } 6025 6026 case "botVersion": 6027 if value != nil { 6028 jtv, ok := value.(string) 6029 if !ok { 6030 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 6031 } 6032 sv.BotVersion = ptr.String(jtv) 6033 } 6034 6035 case "intentSummaries": 6036 if err := awsRestjson1_deserializeDocumentIntentSummaryList(&sv.IntentSummaries, value); err != nil { 6037 return err 6038 } 6039 6040 case "localeId": 6041 if value != nil { 6042 jtv, ok := value.(string) 6043 if !ok { 6044 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 6045 } 6046 sv.LocaleId = ptr.String(jtv) 6047 } 6048 6049 case "nextToken": 6050 if value != nil { 6051 jtv, ok := value.(string) 6052 if !ok { 6053 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6054 } 6055 sv.NextToken = ptr.String(jtv) 6056 } 6057 6058 default: 6059 _, _ = key, value 6060 6061 } 6062 } 6063 *v = sv 6064 return nil 6065} 6066 6067type awsRestjson1_deserializeOpListSlots struct { 6068} 6069 6070func (*awsRestjson1_deserializeOpListSlots) ID() string { 6071 return "OperationDeserializer" 6072} 6073 6074func (m *awsRestjson1_deserializeOpListSlots) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6075 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6076) { 6077 out, metadata, err = next.HandleDeserialize(ctx, in) 6078 if err != nil { 6079 return out, metadata, err 6080 } 6081 6082 response, ok := out.RawResponse.(*smithyhttp.Response) 6083 if !ok { 6084 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6085 } 6086 6087 if response.StatusCode < 200 || response.StatusCode >= 300 { 6088 return out, metadata, awsRestjson1_deserializeOpErrorListSlots(response, &metadata) 6089 } 6090 output := &ListSlotsOutput{} 6091 out.Result = output 6092 6093 var buff [1024]byte 6094 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6095 6096 body := io.TeeReader(response.Body, ringBuffer) 6097 6098 decoder := json.NewDecoder(body) 6099 decoder.UseNumber() 6100 var shape interface{} 6101 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6102 var snapshot bytes.Buffer 6103 io.Copy(&snapshot, ringBuffer) 6104 err = &smithy.DeserializationError{ 6105 Err: fmt.Errorf("failed to decode response body, %w", err), 6106 Snapshot: snapshot.Bytes(), 6107 } 6108 return out, metadata, err 6109 } 6110 6111 err = awsRestjson1_deserializeOpDocumentListSlotsOutput(&output, shape) 6112 if err != nil { 6113 var snapshot bytes.Buffer 6114 io.Copy(&snapshot, ringBuffer) 6115 return out, metadata, &smithy.DeserializationError{ 6116 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6117 Snapshot: snapshot.Bytes(), 6118 } 6119 } 6120 6121 return out, metadata, err 6122} 6123 6124func awsRestjson1_deserializeOpErrorListSlots(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6125 var errorBuffer bytes.Buffer 6126 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6127 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6128 } 6129 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6130 6131 errorCode := "UnknownError" 6132 errorMessage := errorCode 6133 6134 code := response.Header.Get("X-Amzn-ErrorType") 6135 if len(code) != 0 { 6136 errorCode = restjson.SanitizeErrorCode(code) 6137 } 6138 6139 var buff [1024]byte 6140 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6141 6142 body := io.TeeReader(errorBody, ringBuffer) 6143 decoder := json.NewDecoder(body) 6144 decoder.UseNumber() 6145 code, message, err := restjson.GetErrorInfo(decoder) 6146 if err != nil { 6147 var snapshot bytes.Buffer 6148 io.Copy(&snapshot, ringBuffer) 6149 err = &smithy.DeserializationError{ 6150 Err: fmt.Errorf("failed to decode response body, %w", err), 6151 Snapshot: snapshot.Bytes(), 6152 } 6153 return err 6154 } 6155 6156 errorBody.Seek(0, io.SeekStart) 6157 if len(code) != 0 { 6158 errorCode = restjson.SanitizeErrorCode(code) 6159 } 6160 if len(message) != 0 { 6161 errorMessage = message 6162 } 6163 6164 switch { 6165 case strings.EqualFold("InternalServerException", errorCode): 6166 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6167 6168 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 6169 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 6170 6171 case strings.EqualFold("ThrottlingException", errorCode): 6172 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6173 6174 case strings.EqualFold("ValidationException", errorCode): 6175 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6176 6177 default: 6178 genericError := &smithy.GenericAPIError{ 6179 Code: errorCode, 6180 Message: errorMessage, 6181 } 6182 return genericError 6183 6184 } 6185} 6186 6187func awsRestjson1_deserializeOpDocumentListSlotsOutput(v **ListSlotsOutput, value interface{}) error { 6188 if v == nil { 6189 return fmt.Errorf("unexpected nil of type %T", v) 6190 } 6191 if value == nil { 6192 return nil 6193 } 6194 6195 shape, ok := value.(map[string]interface{}) 6196 if !ok { 6197 return fmt.Errorf("unexpected JSON type %v", value) 6198 } 6199 6200 var sv *ListSlotsOutput 6201 if *v == nil { 6202 sv = &ListSlotsOutput{} 6203 } else { 6204 sv = *v 6205 } 6206 6207 for key, value := range shape { 6208 switch key { 6209 case "botId": 6210 if value != nil { 6211 jtv, ok := value.(string) 6212 if !ok { 6213 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6214 } 6215 sv.BotId = ptr.String(jtv) 6216 } 6217 6218 case "botVersion": 6219 if value != nil { 6220 jtv, ok := value.(string) 6221 if !ok { 6222 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 6223 } 6224 sv.BotVersion = ptr.String(jtv) 6225 } 6226 6227 case "intentId": 6228 if value != nil { 6229 jtv, ok := value.(string) 6230 if !ok { 6231 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6232 } 6233 sv.IntentId = ptr.String(jtv) 6234 } 6235 6236 case "localeId": 6237 if value != nil { 6238 jtv, ok := value.(string) 6239 if !ok { 6240 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 6241 } 6242 sv.LocaleId = ptr.String(jtv) 6243 } 6244 6245 case "nextToken": 6246 if value != nil { 6247 jtv, ok := value.(string) 6248 if !ok { 6249 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6250 } 6251 sv.NextToken = ptr.String(jtv) 6252 } 6253 6254 case "slotSummaries": 6255 if err := awsRestjson1_deserializeDocumentSlotSummaryList(&sv.SlotSummaries, value); err != nil { 6256 return err 6257 } 6258 6259 default: 6260 _, _ = key, value 6261 6262 } 6263 } 6264 *v = sv 6265 return nil 6266} 6267 6268type awsRestjson1_deserializeOpListSlotTypes struct { 6269} 6270 6271func (*awsRestjson1_deserializeOpListSlotTypes) ID() string { 6272 return "OperationDeserializer" 6273} 6274 6275func (m *awsRestjson1_deserializeOpListSlotTypes) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6276 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6277) { 6278 out, metadata, err = next.HandleDeserialize(ctx, in) 6279 if err != nil { 6280 return out, metadata, err 6281 } 6282 6283 response, ok := out.RawResponse.(*smithyhttp.Response) 6284 if !ok { 6285 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6286 } 6287 6288 if response.StatusCode < 200 || response.StatusCode >= 300 { 6289 return out, metadata, awsRestjson1_deserializeOpErrorListSlotTypes(response, &metadata) 6290 } 6291 output := &ListSlotTypesOutput{} 6292 out.Result = output 6293 6294 var buff [1024]byte 6295 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6296 6297 body := io.TeeReader(response.Body, ringBuffer) 6298 6299 decoder := json.NewDecoder(body) 6300 decoder.UseNumber() 6301 var shape interface{} 6302 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6303 var snapshot bytes.Buffer 6304 io.Copy(&snapshot, ringBuffer) 6305 err = &smithy.DeserializationError{ 6306 Err: fmt.Errorf("failed to decode response body, %w", err), 6307 Snapshot: snapshot.Bytes(), 6308 } 6309 return out, metadata, err 6310 } 6311 6312 err = awsRestjson1_deserializeOpDocumentListSlotTypesOutput(&output, shape) 6313 if err != nil { 6314 var snapshot bytes.Buffer 6315 io.Copy(&snapshot, ringBuffer) 6316 return out, metadata, &smithy.DeserializationError{ 6317 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6318 Snapshot: snapshot.Bytes(), 6319 } 6320 } 6321 6322 return out, metadata, err 6323} 6324 6325func awsRestjson1_deserializeOpErrorListSlotTypes(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6326 var errorBuffer bytes.Buffer 6327 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6328 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6329 } 6330 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6331 6332 errorCode := "UnknownError" 6333 errorMessage := errorCode 6334 6335 code := response.Header.Get("X-Amzn-ErrorType") 6336 if len(code) != 0 { 6337 errorCode = restjson.SanitizeErrorCode(code) 6338 } 6339 6340 var buff [1024]byte 6341 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6342 6343 body := io.TeeReader(errorBody, ringBuffer) 6344 decoder := json.NewDecoder(body) 6345 decoder.UseNumber() 6346 code, message, err := restjson.GetErrorInfo(decoder) 6347 if err != nil { 6348 var snapshot bytes.Buffer 6349 io.Copy(&snapshot, ringBuffer) 6350 err = &smithy.DeserializationError{ 6351 Err: fmt.Errorf("failed to decode response body, %w", err), 6352 Snapshot: snapshot.Bytes(), 6353 } 6354 return err 6355 } 6356 6357 errorBody.Seek(0, io.SeekStart) 6358 if len(code) != 0 { 6359 errorCode = restjson.SanitizeErrorCode(code) 6360 } 6361 if len(message) != 0 { 6362 errorMessage = message 6363 } 6364 6365 switch { 6366 case strings.EqualFold("InternalServerException", errorCode): 6367 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6368 6369 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 6370 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 6371 6372 case strings.EqualFold("ThrottlingException", errorCode): 6373 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6374 6375 case strings.EqualFold("ValidationException", errorCode): 6376 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6377 6378 default: 6379 genericError := &smithy.GenericAPIError{ 6380 Code: errorCode, 6381 Message: errorMessage, 6382 } 6383 return genericError 6384 6385 } 6386} 6387 6388func awsRestjson1_deserializeOpDocumentListSlotTypesOutput(v **ListSlotTypesOutput, value interface{}) error { 6389 if v == nil { 6390 return fmt.Errorf("unexpected nil of type %T", v) 6391 } 6392 if value == nil { 6393 return nil 6394 } 6395 6396 shape, ok := value.(map[string]interface{}) 6397 if !ok { 6398 return fmt.Errorf("unexpected JSON type %v", value) 6399 } 6400 6401 var sv *ListSlotTypesOutput 6402 if *v == nil { 6403 sv = &ListSlotTypesOutput{} 6404 } else { 6405 sv = *v 6406 } 6407 6408 for key, value := range shape { 6409 switch key { 6410 case "botId": 6411 if value != nil { 6412 jtv, ok := value.(string) 6413 if !ok { 6414 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6415 } 6416 sv.BotId = ptr.String(jtv) 6417 } 6418 6419 case "botVersion": 6420 if value != nil { 6421 jtv, ok := value.(string) 6422 if !ok { 6423 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 6424 } 6425 sv.BotVersion = ptr.String(jtv) 6426 } 6427 6428 case "localeId": 6429 if value != nil { 6430 jtv, ok := value.(string) 6431 if !ok { 6432 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 6433 } 6434 sv.LocaleId = ptr.String(jtv) 6435 } 6436 6437 case "nextToken": 6438 if value != nil { 6439 jtv, ok := value.(string) 6440 if !ok { 6441 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 6442 } 6443 sv.NextToken = ptr.String(jtv) 6444 } 6445 6446 case "slotTypeSummaries": 6447 if err := awsRestjson1_deserializeDocumentSlotTypeSummaryList(&sv.SlotTypeSummaries, value); err != nil { 6448 return err 6449 } 6450 6451 default: 6452 _, _ = key, value 6453 6454 } 6455 } 6456 *v = sv 6457 return nil 6458} 6459 6460type awsRestjson1_deserializeOpListTagsForResource struct { 6461} 6462 6463func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { 6464 return "OperationDeserializer" 6465} 6466 6467func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6468 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6469) { 6470 out, metadata, err = next.HandleDeserialize(ctx, in) 6471 if err != nil { 6472 return out, metadata, err 6473 } 6474 6475 response, ok := out.RawResponse.(*smithyhttp.Response) 6476 if !ok { 6477 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6478 } 6479 6480 if response.StatusCode < 200 || response.StatusCode >= 300 { 6481 return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) 6482 } 6483 output := &ListTagsForResourceOutput{} 6484 out.Result = output 6485 6486 var buff [1024]byte 6487 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6488 6489 body := io.TeeReader(response.Body, ringBuffer) 6490 6491 decoder := json.NewDecoder(body) 6492 decoder.UseNumber() 6493 var shape interface{} 6494 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6495 var snapshot bytes.Buffer 6496 io.Copy(&snapshot, ringBuffer) 6497 err = &smithy.DeserializationError{ 6498 Err: fmt.Errorf("failed to decode response body, %w", err), 6499 Snapshot: snapshot.Bytes(), 6500 } 6501 return out, metadata, err 6502 } 6503 6504 err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) 6505 if err != nil { 6506 var snapshot bytes.Buffer 6507 io.Copy(&snapshot, ringBuffer) 6508 return out, metadata, &smithy.DeserializationError{ 6509 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6510 Snapshot: snapshot.Bytes(), 6511 } 6512 } 6513 6514 return out, metadata, err 6515} 6516 6517func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6518 var errorBuffer bytes.Buffer 6519 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6520 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6521 } 6522 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6523 6524 errorCode := "UnknownError" 6525 errorMessage := errorCode 6526 6527 code := response.Header.Get("X-Amzn-ErrorType") 6528 if len(code) != 0 { 6529 errorCode = restjson.SanitizeErrorCode(code) 6530 } 6531 6532 var buff [1024]byte 6533 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6534 6535 body := io.TeeReader(errorBody, ringBuffer) 6536 decoder := json.NewDecoder(body) 6537 decoder.UseNumber() 6538 code, message, err := restjson.GetErrorInfo(decoder) 6539 if err != nil { 6540 var snapshot bytes.Buffer 6541 io.Copy(&snapshot, ringBuffer) 6542 err = &smithy.DeserializationError{ 6543 Err: fmt.Errorf("failed to decode response body, %w", err), 6544 Snapshot: snapshot.Bytes(), 6545 } 6546 return err 6547 } 6548 6549 errorBody.Seek(0, io.SeekStart) 6550 if len(code) != 0 { 6551 errorCode = restjson.SanitizeErrorCode(code) 6552 } 6553 if len(message) != 0 { 6554 errorMessage = message 6555 } 6556 6557 switch { 6558 case strings.EqualFold("InternalServerException", errorCode): 6559 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6560 6561 case strings.EqualFold("ResourceNotFoundException", errorCode): 6562 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6563 6564 case strings.EqualFold("ThrottlingException", errorCode): 6565 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6566 6567 case strings.EqualFold("ValidationException", errorCode): 6568 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6569 6570 default: 6571 genericError := &smithy.GenericAPIError{ 6572 Code: errorCode, 6573 Message: errorMessage, 6574 } 6575 return genericError 6576 6577 } 6578} 6579 6580func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { 6581 if v == nil { 6582 return fmt.Errorf("unexpected nil of type %T", v) 6583 } 6584 if value == nil { 6585 return nil 6586 } 6587 6588 shape, ok := value.(map[string]interface{}) 6589 if !ok { 6590 return fmt.Errorf("unexpected JSON type %v", value) 6591 } 6592 6593 var sv *ListTagsForResourceOutput 6594 if *v == nil { 6595 sv = &ListTagsForResourceOutput{} 6596 } else { 6597 sv = *v 6598 } 6599 6600 for key, value := range shape { 6601 switch key { 6602 case "tags": 6603 if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { 6604 return err 6605 } 6606 6607 default: 6608 _, _ = key, value 6609 6610 } 6611 } 6612 *v = sv 6613 return nil 6614} 6615 6616type awsRestjson1_deserializeOpTagResource struct { 6617} 6618 6619func (*awsRestjson1_deserializeOpTagResource) ID() string { 6620 return "OperationDeserializer" 6621} 6622 6623func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6624 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6625) { 6626 out, metadata, err = next.HandleDeserialize(ctx, in) 6627 if err != nil { 6628 return out, metadata, err 6629 } 6630 6631 response, ok := out.RawResponse.(*smithyhttp.Response) 6632 if !ok { 6633 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6634 } 6635 6636 if response.StatusCode < 200 || response.StatusCode >= 300 { 6637 return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) 6638 } 6639 output := &TagResourceOutput{} 6640 out.Result = output 6641 6642 return out, metadata, err 6643} 6644 6645func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6646 var errorBuffer bytes.Buffer 6647 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6648 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6649 } 6650 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6651 6652 errorCode := "UnknownError" 6653 errorMessage := errorCode 6654 6655 code := response.Header.Get("X-Amzn-ErrorType") 6656 if len(code) != 0 { 6657 errorCode = restjson.SanitizeErrorCode(code) 6658 } 6659 6660 var buff [1024]byte 6661 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6662 6663 body := io.TeeReader(errorBody, ringBuffer) 6664 decoder := json.NewDecoder(body) 6665 decoder.UseNumber() 6666 code, message, err := restjson.GetErrorInfo(decoder) 6667 if err != nil { 6668 var snapshot bytes.Buffer 6669 io.Copy(&snapshot, ringBuffer) 6670 err = &smithy.DeserializationError{ 6671 Err: fmt.Errorf("failed to decode response body, %w", err), 6672 Snapshot: snapshot.Bytes(), 6673 } 6674 return err 6675 } 6676 6677 errorBody.Seek(0, io.SeekStart) 6678 if len(code) != 0 { 6679 errorCode = restjson.SanitizeErrorCode(code) 6680 } 6681 if len(message) != 0 { 6682 errorMessage = message 6683 } 6684 6685 switch { 6686 case strings.EqualFold("InternalServerException", errorCode): 6687 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6688 6689 case strings.EqualFold("ResourceNotFoundException", errorCode): 6690 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6691 6692 case strings.EqualFold("ThrottlingException", errorCode): 6693 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6694 6695 case strings.EqualFold("ValidationException", errorCode): 6696 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6697 6698 default: 6699 genericError := &smithy.GenericAPIError{ 6700 Code: errorCode, 6701 Message: errorMessage, 6702 } 6703 return genericError 6704 6705 } 6706} 6707 6708type awsRestjson1_deserializeOpUntagResource struct { 6709} 6710 6711func (*awsRestjson1_deserializeOpUntagResource) ID() string { 6712 return "OperationDeserializer" 6713} 6714 6715func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6716 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6717) { 6718 out, metadata, err = next.HandleDeserialize(ctx, in) 6719 if err != nil { 6720 return out, metadata, err 6721 } 6722 6723 response, ok := out.RawResponse.(*smithyhttp.Response) 6724 if !ok { 6725 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6726 } 6727 6728 if response.StatusCode < 200 || response.StatusCode >= 300 { 6729 return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) 6730 } 6731 output := &UntagResourceOutput{} 6732 out.Result = output 6733 6734 return out, metadata, err 6735} 6736 6737func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6738 var errorBuffer bytes.Buffer 6739 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6740 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6741 } 6742 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6743 6744 errorCode := "UnknownError" 6745 errorMessage := errorCode 6746 6747 code := response.Header.Get("X-Amzn-ErrorType") 6748 if len(code) != 0 { 6749 errorCode = restjson.SanitizeErrorCode(code) 6750 } 6751 6752 var buff [1024]byte 6753 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6754 6755 body := io.TeeReader(errorBody, ringBuffer) 6756 decoder := json.NewDecoder(body) 6757 decoder.UseNumber() 6758 code, message, err := restjson.GetErrorInfo(decoder) 6759 if err != nil { 6760 var snapshot bytes.Buffer 6761 io.Copy(&snapshot, ringBuffer) 6762 err = &smithy.DeserializationError{ 6763 Err: fmt.Errorf("failed to decode response body, %w", err), 6764 Snapshot: snapshot.Bytes(), 6765 } 6766 return err 6767 } 6768 6769 errorBody.Seek(0, io.SeekStart) 6770 if len(code) != 0 { 6771 errorCode = restjson.SanitizeErrorCode(code) 6772 } 6773 if len(message) != 0 { 6774 errorMessage = message 6775 } 6776 6777 switch { 6778 case strings.EqualFold("InternalServerException", errorCode): 6779 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6780 6781 case strings.EqualFold("ResourceNotFoundException", errorCode): 6782 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 6783 6784 case strings.EqualFold("ThrottlingException", errorCode): 6785 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6786 6787 case strings.EqualFold("ValidationException", errorCode): 6788 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6789 6790 default: 6791 genericError := &smithy.GenericAPIError{ 6792 Code: errorCode, 6793 Message: errorMessage, 6794 } 6795 return genericError 6796 6797 } 6798} 6799 6800type awsRestjson1_deserializeOpUpdateBot struct { 6801} 6802 6803func (*awsRestjson1_deserializeOpUpdateBot) ID() string { 6804 return "OperationDeserializer" 6805} 6806 6807func (m *awsRestjson1_deserializeOpUpdateBot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 6808 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 6809) { 6810 out, metadata, err = next.HandleDeserialize(ctx, in) 6811 if err != nil { 6812 return out, metadata, err 6813 } 6814 6815 response, ok := out.RawResponse.(*smithyhttp.Response) 6816 if !ok { 6817 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 6818 } 6819 6820 if response.StatusCode < 200 || response.StatusCode >= 300 { 6821 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBot(response, &metadata) 6822 } 6823 output := &UpdateBotOutput{} 6824 out.Result = output 6825 6826 var buff [1024]byte 6827 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6828 6829 body := io.TeeReader(response.Body, ringBuffer) 6830 6831 decoder := json.NewDecoder(body) 6832 decoder.UseNumber() 6833 var shape interface{} 6834 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 6835 var snapshot bytes.Buffer 6836 io.Copy(&snapshot, ringBuffer) 6837 err = &smithy.DeserializationError{ 6838 Err: fmt.Errorf("failed to decode response body, %w", err), 6839 Snapshot: snapshot.Bytes(), 6840 } 6841 return out, metadata, err 6842 } 6843 6844 err = awsRestjson1_deserializeOpDocumentUpdateBotOutput(&output, shape) 6845 if err != nil { 6846 var snapshot bytes.Buffer 6847 io.Copy(&snapshot, ringBuffer) 6848 return out, metadata, &smithy.DeserializationError{ 6849 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 6850 Snapshot: snapshot.Bytes(), 6851 } 6852 } 6853 6854 return out, metadata, err 6855} 6856 6857func awsRestjson1_deserializeOpErrorUpdateBot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 6858 var errorBuffer bytes.Buffer 6859 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 6860 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 6861 } 6862 errorBody := bytes.NewReader(errorBuffer.Bytes()) 6863 6864 errorCode := "UnknownError" 6865 errorMessage := errorCode 6866 6867 code := response.Header.Get("X-Amzn-ErrorType") 6868 if len(code) != 0 { 6869 errorCode = restjson.SanitizeErrorCode(code) 6870 } 6871 6872 var buff [1024]byte 6873 ringBuffer := smithyio.NewRingBuffer(buff[:]) 6874 6875 body := io.TeeReader(errorBody, ringBuffer) 6876 decoder := json.NewDecoder(body) 6877 decoder.UseNumber() 6878 code, message, err := restjson.GetErrorInfo(decoder) 6879 if err != nil { 6880 var snapshot bytes.Buffer 6881 io.Copy(&snapshot, ringBuffer) 6882 err = &smithy.DeserializationError{ 6883 Err: fmt.Errorf("failed to decode response body, %w", err), 6884 Snapshot: snapshot.Bytes(), 6885 } 6886 return err 6887 } 6888 6889 errorBody.Seek(0, io.SeekStart) 6890 if len(code) != 0 { 6891 errorCode = restjson.SanitizeErrorCode(code) 6892 } 6893 if len(message) != 0 { 6894 errorMessage = message 6895 } 6896 6897 switch { 6898 case strings.EqualFold("ConflictException", errorCode): 6899 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 6900 6901 case strings.EqualFold("InternalServerException", errorCode): 6902 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 6903 6904 case strings.EqualFold("PreconditionFailedException", errorCode): 6905 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 6906 6907 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 6908 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 6909 6910 case strings.EqualFold("ThrottlingException", errorCode): 6911 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 6912 6913 case strings.EqualFold("ValidationException", errorCode): 6914 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 6915 6916 default: 6917 genericError := &smithy.GenericAPIError{ 6918 Code: errorCode, 6919 Message: errorMessage, 6920 } 6921 return genericError 6922 6923 } 6924} 6925 6926func awsRestjson1_deserializeOpDocumentUpdateBotOutput(v **UpdateBotOutput, value interface{}) error { 6927 if v == nil { 6928 return fmt.Errorf("unexpected nil of type %T", v) 6929 } 6930 if value == nil { 6931 return nil 6932 } 6933 6934 shape, ok := value.(map[string]interface{}) 6935 if !ok { 6936 return fmt.Errorf("unexpected JSON type %v", value) 6937 } 6938 6939 var sv *UpdateBotOutput 6940 if *v == nil { 6941 sv = &UpdateBotOutput{} 6942 } else { 6943 sv = *v 6944 } 6945 6946 for key, value := range shape { 6947 switch key { 6948 case "botId": 6949 if value != nil { 6950 jtv, ok := value.(string) 6951 if !ok { 6952 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 6953 } 6954 sv.BotId = ptr.String(jtv) 6955 } 6956 6957 case "botName": 6958 if value != nil { 6959 jtv, ok := value.(string) 6960 if !ok { 6961 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 6962 } 6963 sv.BotName = ptr.String(jtv) 6964 } 6965 6966 case "botStatus": 6967 if value != nil { 6968 jtv, ok := value.(string) 6969 if !ok { 6970 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 6971 } 6972 sv.BotStatus = types.BotStatus(jtv) 6973 } 6974 6975 case "creationDateTime": 6976 if value != nil { 6977 jtv, ok := value.(json.Number) 6978 if !ok { 6979 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 6980 } 6981 f64, err := jtv.Float64() 6982 if err != nil { 6983 return err 6984 } 6985 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 6986 } 6987 6988 case "dataPrivacy": 6989 if err := awsRestjson1_deserializeDocumentDataPrivacy(&sv.DataPrivacy, value); err != nil { 6990 return err 6991 } 6992 6993 case "description": 6994 if value != nil { 6995 jtv, ok := value.(string) 6996 if !ok { 6997 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 6998 } 6999 sv.Description = ptr.String(jtv) 7000 } 7001 7002 case "idleSessionTTLInSeconds": 7003 if value != nil { 7004 jtv, ok := value.(json.Number) 7005 if !ok { 7006 return fmt.Errorf("expected SessionTTL to be json.Number, got %T instead", value) 7007 } 7008 i64, err := jtv.Int64() 7009 if err != nil { 7010 return err 7011 } 7012 sv.IdleSessionTTLInSeconds = ptr.Int32(int32(i64)) 7013 } 7014 7015 case "lastUpdatedDateTime": 7016 if value != nil { 7017 jtv, ok := value.(json.Number) 7018 if !ok { 7019 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7020 } 7021 f64, err := jtv.Float64() 7022 if err != nil { 7023 return err 7024 } 7025 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7026 } 7027 7028 case "roleArn": 7029 if value != nil { 7030 jtv, ok := value.(string) 7031 if !ok { 7032 return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) 7033 } 7034 sv.RoleArn = ptr.String(jtv) 7035 } 7036 7037 default: 7038 _, _ = key, value 7039 7040 } 7041 } 7042 *v = sv 7043 return nil 7044} 7045 7046type awsRestjson1_deserializeOpUpdateBotAlias struct { 7047} 7048 7049func (*awsRestjson1_deserializeOpUpdateBotAlias) ID() string { 7050 return "OperationDeserializer" 7051} 7052 7053func (m *awsRestjson1_deserializeOpUpdateBotAlias) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7054 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7055) { 7056 out, metadata, err = next.HandleDeserialize(ctx, in) 7057 if err != nil { 7058 return out, metadata, err 7059 } 7060 7061 response, ok := out.RawResponse.(*smithyhttp.Response) 7062 if !ok { 7063 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7064 } 7065 7066 if response.StatusCode < 200 || response.StatusCode >= 300 { 7067 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBotAlias(response, &metadata) 7068 } 7069 output := &UpdateBotAliasOutput{} 7070 out.Result = output 7071 7072 var buff [1024]byte 7073 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7074 7075 body := io.TeeReader(response.Body, ringBuffer) 7076 7077 decoder := json.NewDecoder(body) 7078 decoder.UseNumber() 7079 var shape interface{} 7080 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7081 var snapshot bytes.Buffer 7082 io.Copy(&snapshot, ringBuffer) 7083 err = &smithy.DeserializationError{ 7084 Err: fmt.Errorf("failed to decode response body, %w", err), 7085 Snapshot: snapshot.Bytes(), 7086 } 7087 return out, metadata, err 7088 } 7089 7090 err = awsRestjson1_deserializeOpDocumentUpdateBotAliasOutput(&output, shape) 7091 if err != nil { 7092 var snapshot bytes.Buffer 7093 io.Copy(&snapshot, ringBuffer) 7094 return out, metadata, &smithy.DeserializationError{ 7095 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7096 Snapshot: snapshot.Bytes(), 7097 } 7098 } 7099 7100 return out, metadata, err 7101} 7102 7103func awsRestjson1_deserializeOpErrorUpdateBotAlias(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7104 var errorBuffer bytes.Buffer 7105 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7106 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7107 } 7108 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7109 7110 errorCode := "UnknownError" 7111 errorMessage := errorCode 7112 7113 code := response.Header.Get("X-Amzn-ErrorType") 7114 if len(code) != 0 { 7115 errorCode = restjson.SanitizeErrorCode(code) 7116 } 7117 7118 var buff [1024]byte 7119 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7120 7121 body := io.TeeReader(errorBody, ringBuffer) 7122 decoder := json.NewDecoder(body) 7123 decoder.UseNumber() 7124 code, message, err := restjson.GetErrorInfo(decoder) 7125 if err != nil { 7126 var snapshot bytes.Buffer 7127 io.Copy(&snapshot, ringBuffer) 7128 err = &smithy.DeserializationError{ 7129 Err: fmt.Errorf("failed to decode response body, %w", err), 7130 Snapshot: snapshot.Bytes(), 7131 } 7132 return err 7133 } 7134 7135 errorBody.Seek(0, io.SeekStart) 7136 if len(code) != 0 { 7137 errorCode = restjson.SanitizeErrorCode(code) 7138 } 7139 if len(message) != 0 { 7140 errorMessage = message 7141 } 7142 7143 switch { 7144 case strings.EqualFold("ConflictException", errorCode): 7145 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 7146 7147 case strings.EqualFold("InternalServerException", errorCode): 7148 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7149 7150 case strings.EqualFold("PreconditionFailedException", errorCode): 7151 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 7152 7153 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7154 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7155 7156 case strings.EqualFold("ThrottlingException", errorCode): 7157 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7158 7159 case strings.EqualFold("ValidationException", errorCode): 7160 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7161 7162 default: 7163 genericError := &smithy.GenericAPIError{ 7164 Code: errorCode, 7165 Message: errorMessage, 7166 } 7167 return genericError 7168 7169 } 7170} 7171 7172func awsRestjson1_deserializeOpDocumentUpdateBotAliasOutput(v **UpdateBotAliasOutput, value interface{}) error { 7173 if v == nil { 7174 return fmt.Errorf("unexpected nil of type %T", v) 7175 } 7176 if value == nil { 7177 return nil 7178 } 7179 7180 shape, ok := value.(map[string]interface{}) 7181 if !ok { 7182 return fmt.Errorf("unexpected JSON type %v", value) 7183 } 7184 7185 var sv *UpdateBotAliasOutput 7186 if *v == nil { 7187 sv = &UpdateBotAliasOutput{} 7188 } else { 7189 sv = *v 7190 } 7191 7192 for key, value := range shape { 7193 switch key { 7194 case "botAliasId": 7195 if value != nil { 7196 jtv, ok := value.(string) 7197 if !ok { 7198 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 7199 } 7200 sv.BotAliasId = ptr.String(jtv) 7201 } 7202 7203 case "botAliasLocaleSettings": 7204 if err := awsRestjson1_deserializeDocumentBotAliasLocaleSettingsMap(&sv.BotAliasLocaleSettings, value); err != nil { 7205 return err 7206 } 7207 7208 case "botAliasName": 7209 if value != nil { 7210 jtv, ok := value.(string) 7211 if !ok { 7212 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 7213 } 7214 sv.BotAliasName = ptr.String(jtv) 7215 } 7216 7217 case "botAliasStatus": 7218 if value != nil { 7219 jtv, ok := value.(string) 7220 if !ok { 7221 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 7222 } 7223 sv.BotAliasStatus = types.BotAliasStatus(jtv) 7224 } 7225 7226 case "botId": 7227 if value != nil { 7228 jtv, ok := value.(string) 7229 if !ok { 7230 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7231 } 7232 sv.BotId = ptr.String(jtv) 7233 } 7234 7235 case "botVersion": 7236 if value != nil { 7237 jtv, ok := value.(string) 7238 if !ok { 7239 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 7240 } 7241 sv.BotVersion = ptr.String(jtv) 7242 } 7243 7244 case "conversationLogSettings": 7245 if err := awsRestjson1_deserializeDocumentConversationLogSettings(&sv.ConversationLogSettings, value); err != nil { 7246 return err 7247 } 7248 7249 case "creationDateTime": 7250 if value != nil { 7251 jtv, ok := value.(json.Number) 7252 if !ok { 7253 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7254 } 7255 f64, err := jtv.Float64() 7256 if err != nil { 7257 return err 7258 } 7259 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7260 } 7261 7262 case "description": 7263 if value != nil { 7264 jtv, ok := value.(string) 7265 if !ok { 7266 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 7267 } 7268 sv.Description = ptr.String(jtv) 7269 } 7270 7271 case "lastUpdatedDateTime": 7272 if value != nil { 7273 jtv, ok := value.(json.Number) 7274 if !ok { 7275 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7276 } 7277 f64, err := jtv.Float64() 7278 if err != nil { 7279 return err 7280 } 7281 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7282 } 7283 7284 case "sentimentAnalysisSettings": 7285 if err := awsRestjson1_deserializeDocumentSentimentAnalysisSettings(&sv.SentimentAnalysisSettings, value); err != nil { 7286 return err 7287 } 7288 7289 default: 7290 _, _ = key, value 7291 7292 } 7293 } 7294 *v = sv 7295 return nil 7296} 7297 7298type awsRestjson1_deserializeOpUpdateBotLocale struct { 7299} 7300 7301func (*awsRestjson1_deserializeOpUpdateBotLocale) ID() string { 7302 return "OperationDeserializer" 7303} 7304 7305func (m *awsRestjson1_deserializeOpUpdateBotLocale) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7306 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7307) { 7308 out, metadata, err = next.HandleDeserialize(ctx, in) 7309 if err != nil { 7310 return out, metadata, err 7311 } 7312 7313 response, ok := out.RawResponse.(*smithyhttp.Response) 7314 if !ok { 7315 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7316 } 7317 7318 if response.StatusCode < 200 || response.StatusCode >= 300 { 7319 return out, metadata, awsRestjson1_deserializeOpErrorUpdateBotLocale(response, &metadata) 7320 } 7321 output := &UpdateBotLocaleOutput{} 7322 out.Result = output 7323 7324 var buff [1024]byte 7325 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7326 7327 body := io.TeeReader(response.Body, ringBuffer) 7328 7329 decoder := json.NewDecoder(body) 7330 decoder.UseNumber() 7331 var shape interface{} 7332 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7333 var snapshot bytes.Buffer 7334 io.Copy(&snapshot, ringBuffer) 7335 err = &smithy.DeserializationError{ 7336 Err: fmt.Errorf("failed to decode response body, %w", err), 7337 Snapshot: snapshot.Bytes(), 7338 } 7339 return out, metadata, err 7340 } 7341 7342 err = awsRestjson1_deserializeOpDocumentUpdateBotLocaleOutput(&output, shape) 7343 if err != nil { 7344 var snapshot bytes.Buffer 7345 io.Copy(&snapshot, ringBuffer) 7346 return out, metadata, &smithy.DeserializationError{ 7347 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7348 Snapshot: snapshot.Bytes(), 7349 } 7350 } 7351 7352 return out, metadata, err 7353} 7354 7355func awsRestjson1_deserializeOpErrorUpdateBotLocale(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7356 var errorBuffer bytes.Buffer 7357 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7358 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7359 } 7360 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7361 7362 errorCode := "UnknownError" 7363 errorMessage := errorCode 7364 7365 code := response.Header.Get("X-Amzn-ErrorType") 7366 if len(code) != 0 { 7367 errorCode = restjson.SanitizeErrorCode(code) 7368 } 7369 7370 var buff [1024]byte 7371 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7372 7373 body := io.TeeReader(errorBody, ringBuffer) 7374 decoder := json.NewDecoder(body) 7375 decoder.UseNumber() 7376 code, message, err := restjson.GetErrorInfo(decoder) 7377 if err != nil { 7378 var snapshot bytes.Buffer 7379 io.Copy(&snapshot, ringBuffer) 7380 err = &smithy.DeserializationError{ 7381 Err: fmt.Errorf("failed to decode response body, %w", err), 7382 Snapshot: snapshot.Bytes(), 7383 } 7384 return err 7385 } 7386 7387 errorBody.Seek(0, io.SeekStart) 7388 if len(code) != 0 { 7389 errorCode = restjson.SanitizeErrorCode(code) 7390 } 7391 if len(message) != 0 { 7392 errorMessage = message 7393 } 7394 7395 switch { 7396 case strings.EqualFold("ConflictException", errorCode): 7397 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 7398 7399 case strings.EqualFold("InternalServerException", errorCode): 7400 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7401 7402 case strings.EqualFold("PreconditionFailedException", errorCode): 7403 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 7404 7405 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7406 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7407 7408 case strings.EqualFold("ThrottlingException", errorCode): 7409 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7410 7411 case strings.EqualFold("ValidationException", errorCode): 7412 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7413 7414 default: 7415 genericError := &smithy.GenericAPIError{ 7416 Code: errorCode, 7417 Message: errorMessage, 7418 } 7419 return genericError 7420 7421 } 7422} 7423 7424func awsRestjson1_deserializeOpDocumentUpdateBotLocaleOutput(v **UpdateBotLocaleOutput, value interface{}) error { 7425 if v == nil { 7426 return fmt.Errorf("unexpected nil of type %T", v) 7427 } 7428 if value == nil { 7429 return nil 7430 } 7431 7432 shape, ok := value.(map[string]interface{}) 7433 if !ok { 7434 return fmt.Errorf("unexpected JSON type %v", value) 7435 } 7436 7437 var sv *UpdateBotLocaleOutput 7438 if *v == nil { 7439 sv = &UpdateBotLocaleOutput{} 7440 } else { 7441 sv = *v 7442 } 7443 7444 for key, value := range shape { 7445 switch key { 7446 case "botId": 7447 if value != nil { 7448 jtv, ok := value.(string) 7449 if !ok { 7450 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7451 } 7452 sv.BotId = ptr.String(jtv) 7453 } 7454 7455 case "botLocaleStatus": 7456 if value != nil { 7457 jtv, ok := value.(string) 7458 if !ok { 7459 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 7460 } 7461 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 7462 } 7463 7464 case "botVersion": 7465 if value != nil { 7466 jtv, ok := value.(string) 7467 if !ok { 7468 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 7469 } 7470 sv.BotVersion = ptr.String(jtv) 7471 } 7472 7473 case "creationDateTime": 7474 if value != nil { 7475 jtv, ok := value.(json.Number) 7476 if !ok { 7477 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7478 } 7479 f64, err := jtv.Float64() 7480 if err != nil { 7481 return err 7482 } 7483 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7484 } 7485 7486 case "description": 7487 if value != nil { 7488 jtv, ok := value.(string) 7489 if !ok { 7490 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 7491 } 7492 sv.Description = ptr.String(jtv) 7493 } 7494 7495 case "failureReasons": 7496 if err := awsRestjson1_deserializeDocumentFailureReasons(&sv.FailureReasons, value); err != nil { 7497 return err 7498 } 7499 7500 case "lastUpdatedDateTime": 7501 if value != nil { 7502 jtv, ok := value.(json.Number) 7503 if !ok { 7504 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7505 } 7506 f64, err := jtv.Float64() 7507 if err != nil { 7508 return err 7509 } 7510 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7511 } 7512 7513 case "localeId": 7514 if value != nil { 7515 jtv, ok := value.(string) 7516 if !ok { 7517 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 7518 } 7519 sv.LocaleId = ptr.String(jtv) 7520 } 7521 7522 case "localeName": 7523 if value != nil { 7524 jtv, ok := value.(string) 7525 if !ok { 7526 return fmt.Errorf("expected LocaleName to be of type string, got %T instead", value) 7527 } 7528 sv.LocaleName = ptr.String(jtv) 7529 } 7530 7531 case "nluIntentConfidenceThreshold": 7532 if value != nil { 7533 jtv, ok := value.(json.Number) 7534 if !ok { 7535 return fmt.Errorf("expected ConfidenceThreshold to be json.Number, got %T instead", value) 7536 } 7537 f64, err := jtv.Float64() 7538 if err != nil { 7539 return err 7540 } 7541 sv.NluIntentConfidenceThreshold = ptr.Float64(f64) 7542 } 7543 7544 case "voiceSettings": 7545 if err := awsRestjson1_deserializeDocumentVoiceSettings(&sv.VoiceSettings, value); err != nil { 7546 return err 7547 } 7548 7549 default: 7550 _, _ = key, value 7551 7552 } 7553 } 7554 *v = sv 7555 return nil 7556} 7557 7558type awsRestjson1_deserializeOpUpdateIntent struct { 7559} 7560 7561func (*awsRestjson1_deserializeOpUpdateIntent) ID() string { 7562 return "OperationDeserializer" 7563} 7564 7565func (m *awsRestjson1_deserializeOpUpdateIntent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7566 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7567) { 7568 out, metadata, err = next.HandleDeserialize(ctx, in) 7569 if err != nil { 7570 return out, metadata, err 7571 } 7572 7573 response, ok := out.RawResponse.(*smithyhttp.Response) 7574 if !ok { 7575 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7576 } 7577 7578 if response.StatusCode < 200 || response.StatusCode >= 300 { 7579 return out, metadata, awsRestjson1_deserializeOpErrorUpdateIntent(response, &metadata) 7580 } 7581 output := &UpdateIntentOutput{} 7582 out.Result = output 7583 7584 var buff [1024]byte 7585 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7586 7587 body := io.TeeReader(response.Body, ringBuffer) 7588 7589 decoder := json.NewDecoder(body) 7590 decoder.UseNumber() 7591 var shape interface{} 7592 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7593 var snapshot bytes.Buffer 7594 io.Copy(&snapshot, ringBuffer) 7595 err = &smithy.DeserializationError{ 7596 Err: fmt.Errorf("failed to decode response body, %w", err), 7597 Snapshot: snapshot.Bytes(), 7598 } 7599 return out, metadata, err 7600 } 7601 7602 err = awsRestjson1_deserializeOpDocumentUpdateIntentOutput(&output, shape) 7603 if err != nil { 7604 var snapshot bytes.Buffer 7605 io.Copy(&snapshot, ringBuffer) 7606 return out, metadata, &smithy.DeserializationError{ 7607 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7608 Snapshot: snapshot.Bytes(), 7609 } 7610 } 7611 7612 return out, metadata, err 7613} 7614 7615func awsRestjson1_deserializeOpErrorUpdateIntent(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7616 var errorBuffer bytes.Buffer 7617 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7618 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7619 } 7620 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7621 7622 errorCode := "UnknownError" 7623 errorMessage := errorCode 7624 7625 code := response.Header.Get("X-Amzn-ErrorType") 7626 if len(code) != 0 { 7627 errorCode = restjson.SanitizeErrorCode(code) 7628 } 7629 7630 var buff [1024]byte 7631 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7632 7633 body := io.TeeReader(errorBody, ringBuffer) 7634 decoder := json.NewDecoder(body) 7635 decoder.UseNumber() 7636 code, message, err := restjson.GetErrorInfo(decoder) 7637 if err != nil { 7638 var snapshot bytes.Buffer 7639 io.Copy(&snapshot, ringBuffer) 7640 err = &smithy.DeserializationError{ 7641 Err: fmt.Errorf("failed to decode response body, %w", err), 7642 Snapshot: snapshot.Bytes(), 7643 } 7644 return err 7645 } 7646 7647 errorBody.Seek(0, io.SeekStart) 7648 if len(code) != 0 { 7649 errorCode = restjson.SanitizeErrorCode(code) 7650 } 7651 if len(message) != 0 { 7652 errorMessage = message 7653 } 7654 7655 switch { 7656 case strings.EqualFold("ConflictException", errorCode): 7657 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 7658 7659 case strings.EqualFold("InternalServerException", errorCode): 7660 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7661 7662 case strings.EqualFold("PreconditionFailedException", errorCode): 7663 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 7664 7665 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7666 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7667 7668 case strings.EqualFold("ThrottlingException", errorCode): 7669 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7670 7671 case strings.EqualFold("ValidationException", errorCode): 7672 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7673 7674 default: 7675 genericError := &smithy.GenericAPIError{ 7676 Code: errorCode, 7677 Message: errorMessage, 7678 } 7679 return genericError 7680 7681 } 7682} 7683 7684func awsRestjson1_deserializeOpDocumentUpdateIntentOutput(v **UpdateIntentOutput, value interface{}) error { 7685 if v == nil { 7686 return fmt.Errorf("unexpected nil of type %T", v) 7687 } 7688 if value == nil { 7689 return nil 7690 } 7691 7692 shape, ok := value.(map[string]interface{}) 7693 if !ok { 7694 return fmt.Errorf("unexpected JSON type %v", value) 7695 } 7696 7697 var sv *UpdateIntentOutput 7698 if *v == nil { 7699 sv = &UpdateIntentOutput{} 7700 } else { 7701 sv = *v 7702 } 7703 7704 for key, value := range shape { 7705 switch key { 7706 case "botId": 7707 if value != nil { 7708 jtv, ok := value.(string) 7709 if !ok { 7710 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7711 } 7712 sv.BotId = ptr.String(jtv) 7713 } 7714 7715 case "botVersion": 7716 if value != nil { 7717 jtv, ok := value.(string) 7718 if !ok { 7719 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 7720 } 7721 sv.BotVersion = ptr.String(jtv) 7722 } 7723 7724 case "creationDateTime": 7725 if value != nil { 7726 jtv, ok := value.(json.Number) 7727 if !ok { 7728 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7729 } 7730 f64, err := jtv.Float64() 7731 if err != nil { 7732 return err 7733 } 7734 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7735 } 7736 7737 case "description": 7738 if value != nil { 7739 jtv, ok := value.(string) 7740 if !ok { 7741 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 7742 } 7743 sv.Description = ptr.String(jtv) 7744 } 7745 7746 case "dialogCodeHook": 7747 if err := awsRestjson1_deserializeDocumentDialogCodeHookSettings(&sv.DialogCodeHook, value); err != nil { 7748 return err 7749 } 7750 7751 case "fulfillmentCodeHook": 7752 if err := awsRestjson1_deserializeDocumentFulfillmentCodeHookSettings(&sv.FulfillmentCodeHook, value); err != nil { 7753 return err 7754 } 7755 7756 case "inputContexts": 7757 if err := awsRestjson1_deserializeDocumentInputContextsList(&sv.InputContexts, value); err != nil { 7758 return err 7759 } 7760 7761 case "intentClosingSetting": 7762 if err := awsRestjson1_deserializeDocumentIntentClosingSetting(&sv.IntentClosingSetting, value); err != nil { 7763 return err 7764 } 7765 7766 case "intentConfirmationSetting": 7767 if err := awsRestjson1_deserializeDocumentIntentConfirmationSetting(&sv.IntentConfirmationSetting, value); err != nil { 7768 return err 7769 } 7770 7771 case "intentId": 7772 if value != nil { 7773 jtv, ok := value.(string) 7774 if !ok { 7775 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 7776 } 7777 sv.IntentId = ptr.String(jtv) 7778 } 7779 7780 case "intentName": 7781 if value != nil { 7782 jtv, ok := value.(string) 7783 if !ok { 7784 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 7785 } 7786 sv.IntentName = ptr.String(jtv) 7787 } 7788 7789 case "kendraConfiguration": 7790 if err := awsRestjson1_deserializeDocumentKendraConfiguration(&sv.KendraConfiguration, value); err != nil { 7791 return err 7792 } 7793 7794 case "lastUpdatedDateTime": 7795 if value != nil { 7796 jtv, ok := value.(json.Number) 7797 if !ok { 7798 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 7799 } 7800 f64, err := jtv.Float64() 7801 if err != nil { 7802 return err 7803 } 7804 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 7805 } 7806 7807 case "localeId": 7808 if value != nil { 7809 jtv, ok := value.(string) 7810 if !ok { 7811 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 7812 } 7813 sv.LocaleId = ptr.String(jtv) 7814 } 7815 7816 case "outputContexts": 7817 if err := awsRestjson1_deserializeDocumentOutputContextsList(&sv.OutputContexts, value); err != nil { 7818 return err 7819 } 7820 7821 case "parentIntentSignature": 7822 if value != nil { 7823 jtv, ok := value.(string) 7824 if !ok { 7825 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 7826 } 7827 sv.ParentIntentSignature = ptr.String(jtv) 7828 } 7829 7830 case "sampleUtterances": 7831 if err := awsRestjson1_deserializeDocumentSampleUtterancesList(&sv.SampleUtterances, value); err != nil { 7832 return err 7833 } 7834 7835 case "slotPriorities": 7836 if err := awsRestjson1_deserializeDocumentSlotPrioritiesList(&sv.SlotPriorities, value); err != nil { 7837 return err 7838 } 7839 7840 default: 7841 _, _ = key, value 7842 7843 } 7844 } 7845 *v = sv 7846 return nil 7847} 7848 7849type awsRestjson1_deserializeOpUpdateSlot struct { 7850} 7851 7852func (*awsRestjson1_deserializeOpUpdateSlot) ID() string { 7853 return "OperationDeserializer" 7854} 7855 7856func (m *awsRestjson1_deserializeOpUpdateSlot) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 7857 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 7858) { 7859 out, metadata, err = next.HandleDeserialize(ctx, in) 7860 if err != nil { 7861 return out, metadata, err 7862 } 7863 7864 response, ok := out.RawResponse.(*smithyhttp.Response) 7865 if !ok { 7866 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 7867 } 7868 7869 if response.StatusCode < 200 || response.StatusCode >= 300 { 7870 return out, metadata, awsRestjson1_deserializeOpErrorUpdateSlot(response, &metadata) 7871 } 7872 output := &UpdateSlotOutput{} 7873 out.Result = output 7874 7875 var buff [1024]byte 7876 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7877 7878 body := io.TeeReader(response.Body, ringBuffer) 7879 7880 decoder := json.NewDecoder(body) 7881 decoder.UseNumber() 7882 var shape interface{} 7883 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 7884 var snapshot bytes.Buffer 7885 io.Copy(&snapshot, ringBuffer) 7886 err = &smithy.DeserializationError{ 7887 Err: fmt.Errorf("failed to decode response body, %w", err), 7888 Snapshot: snapshot.Bytes(), 7889 } 7890 return out, metadata, err 7891 } 7892 7893 err = awsRestjson1_deserializeOpDocumentUpdateSlotOutput(&output, shape) 7894 if err != nil { 7895 var snapshot bytes.Buffer 7896 io.Copy(&snapshot, ringBuffer) 7897 return out, metadata, &smithy.DeserializationError{ 7898 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 7899 Snapshot: snapshot.Bytes(), 7900 } 7901 } 7902 7903 return out, metadata, err 7904} 7905 7906func awsRestjson1_deserializeOpErrorUpdateSlot(response *smithyhttp.Response, metadata *middleware.Metadata) error { 7907 var errorBuffer bytes.Buffer 7908 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 7909 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 7910 } 7911 errorBody := bytes.NewReader(errorBuffer.Bytes()) 7912 7913 errorCode := "UnknownError" 7914 errorMessage := errorCode 7915 7916 code := response.Header.Get("X-Amzn-ErrorType") 7917 if len(code) != 0 { 7918 errorCode = restjson.SanitizeErrorCode(code) 7919 } 7920 7921 var buff [1024]byte 7922 ringBuffer := smithyio.NewRingBuffer(buff[:]) 7923 7924 body := io.TeeReader(errorBody, ringBuffer) 7925 decoder := json.NewDecoder(body) 7926 decoder.UseNumber() 7927 code, message, err := restjson.GetErrorInfo(decoder) 7928 if err != nil { 7929 var snapshot bytes.Buffer 7930 io.Copy(&snapshot, ringBuffer) 7931 err = &smithy.DeserializationError{ 7932 Err: fmt.Errorf("failed to decode response body, %w", err), 7933 Snapshot: snapshot.Bytes(), 7934 } 7935 return err 7936 } 7937 7938 errorBody.Seek(0, io.SeekStart) 7939 if len(code) != 0 { 7940 errorCode = restjson.SanitizeErrorCode(code) 7941 } 7942 if len(message) != 0 { 7943 errorMessage = message 7944 } 7945 7946 switch { 7947 case strings.EqualFold("ConflictException", errorCode): 7948 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 7949 7950 case strings.EqualFold("InternalServerException", errorCode): 7951 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 7952 7953 case strings.EqualFold("PreconditionFailedException", errorCode): 7954 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 7955 7956 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 7957 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 7958 7959 case strings.EqualFold("ThrottlingException", errorCode): 7960 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 7961 7962 case strings.EqualFold("ValidationException", errorCode): 7963 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 7964 7965 default: 7966 genericError := &smithy.GenericAPIError{ 7967 Code: errorCode, 7968 Message: errorMessage, 7969 } 7970 return genericError 7971 7972 } 7973} 7974 7975func awsRestjson1_deserializeOpDocumentUpdateSlotOutput(v **UpdateSlotOutput, value interface{}) error { 7976 if v == nil { 7977 return fmt.Errorf("unexpected nil of type %T", v) 7978 } 7979 if value == nil { 7980 return nil 7981 } 7982 7983 shape, ok := value.(map[string]interface{}) 7984 if !ok { 7985 return fmt.Errorf("unexpected JSON type %v", value) 7986 } 7987 7988 var sv *UpdateSlotOutput 7989 if *v == nil { 7990 sv = &UpdateSlotOutput{} 7991 } else { 7992 sv = *v 7993 } 7994 7995 for key, value := range shape { 7996 switch key { 7997 case "botId": 7998 if value != nil { 7999 jtv, ok := value.(string) 8000 if !ok { 8001 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8002 } 8003 sv.BotId = ptr.String(jtv) 8004 } 8005 8006 case "botVersion": 8007 if value != nil { 8008 jtv, ok := value.(string) 8009 if !ok { 8010 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 8011 } 8012 sv.BotVersion = ptr.String(jtv) 8013 } 8014 8015 case "creationDateTime": 8016 if value != nil { 8017 jtv, ok := value.(json.Number) 8018 if !ok { 8019 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 8020 } 8021 f64, err := jtv.Float64() 8022 if err != nil { 8023 return err 8024 } 8025 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8026 } 8027 8028 case "description": 8029 if value != nil { 8030 jtv, ok := value.(string) 8031 if !ok { 8032 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 8033 } 8034 sv.Description = ptr.String(jtv) 8035 } 8036 8037 case "intentId": 8038 if value != nil { 8039 jtv, ok := value.(string) 8040 if !ok { 8041 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8042 } 8043 sv.IntentId = ptr.String(jtv) 8044 } 8045 8046 case "lastUpdatedDateTime": 8047 if value != nil { 8048 jtv, ok := value.(json.Number) 8049 if !ok { 8050 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 8051 } 8052 f64, err := jtv.Float64() 8053 if err != nil { 8054 return err 8055 } 8056 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8057 } 8058 8059 case "localeId": 8060 if value != nil { 8061 jtv, ok := value.(string) 8062 if !ok { 8063 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 8064 } 8065 sv.LocaleId = ptr.String(jtv) 8066 } 8067 8068 case "obfuscationSetting": 8069 if err := awsRestjson1_deserializeDocumentObfuscationSetting(&sv.ObfuscationSetting, value); err != nil { 8070 return err 8071 } 8072 8073 case "slotId": 8074 if value != nil { 8075 jtv, ok := value.(string) 8076 if !ok { 8077 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8078 } 8079 sv.SlotId = ptr.String(jtv) 8080 } 8081 8082 case "slotName": 8083 if value != nil { 8084 jtv, ok := value.(string) 8085 if !ok { 8086 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 8087 } 8088 sv.SlotName = ptr.String(jtv) 8089 } 8090 8091 case "slotTypeId": 8092 if value != nil { 8093 jtv, ok := value.(string) 8094 if !ok { 8095 return fmt.Errorf("expected BuiltInOrCustomSlotTypeId to be of type string, got %T instead", value) 8096 } 8097 sv.SlotTypeId = ptr.String(jtv) 8098 } 8099 8100 case "valueElicitationSetting": 8101 if err := awsRestjson1_deserializeDocumentSlotValueElicitationSetting(&sv.ValueElicitationSetting, value); err != nil { 8102 return err 8103 } 8104 8105 default: 8106 _, _ = key, value 8107 8108 } 8109 } 8110 *v = sv 8111 return nil 8112} 8113 8114type awsRestjson1_deserializeOpUpdateSlotType struct { 8115} 8116 8117func (*awsRestjson1_deserializeOpUpdateSlotType) ID() string { 8118 return "OperationDeserializer" 8119} 8120 8121func (m *awsRestjson1_deserializeOpUpdateSlotType) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 8122 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 8123) { 8124 out, metadata, err = next.HandleDeserialize(ctx, in) 8125 if err != nil { 8126 return out, metadata, err 8127 } 8128 8129 response, ok := out.RawResponse.(*smithyhttp.Response) 8130 if !ok { 8131 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 8132 } 8133 8134 if response.StatusCode < 200 || response.StatusCode >= 300 { 8135 return out, metadata, awsRestjson1_deserializeOpErrorUpdateSlotType(response, &metadata) 8136 } 8137 output := &UpdateSlotTypeOutput{} 8138 out.Result = output 8139 8140 var buff [1024]byte 8141 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8142 8143 body := io.TeeReader(response.Body, ringBuffer) 8144 8145 decoder := json.NewDecoder(body) 8146 decoder.UseNumber() 8147 var shape interface{} 8148 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8149 var snapshot bytes.Buffer 8150 io.Copy(&snapshot, ringBuffer) 8151 err = &smithy.DeserializationError{ 8152 Err: fmt.Errorf("failed to decode response body, %w", err), 8153 Snapshot: snapshot.Bytes(), 8154 } 8155 return out, metadata, err 8156 } 8157 8158 err = awsRestjson1_deserializeOpDocumentUpdateSlotTypeOutput(&output, shape) 8159 if err != nil { 8160 var snapshot bytes.Buffer 8161 io.Copy(&snapshot, ringBuffer) 8162 return out, metadata, &smithy.DeserializationError{ 8163 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 8164 Snapshot: snapshot.Bytes(), 8165 } 8166 } 8167 8168 return out, metadata, err 8169} 8170 8171func awsRestjson1_deserializeOpErrorUpdateSlotType(response *smithyhttp.Response, metadata *middleware.Metadata) error { 8172 var errorBuffer bytes.Buffer 8173 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 8174 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 8175 } 8176 errorBody := bytes.NewReader(errorBuffer.Bytes()) 8177 8178 errorCode := "UnknownError" 8179 errorMessage := errorCode 8180 8181 code := response.Header.Get("X-Amzn-ErrorType") 8182 if len(code) != 0 { 8183 errorCode = restjson.SanitizeErrorCode(code) 8184 } 8185 8186 var buff [1024]byte 8187 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8188 8189 body := io.TeeReader(errorBody, ringBuffer) 8190 decoder := json.NewDecoder(body) 8191 decoder.UseNumber() 8192 code, message, err := restjson.GetErrorInfo(decoder) 8193 if err != nil { 8194 var snapshot bytes.Buffer 8195 io.Copy(&snapshot, ringBuffer) 8196 err = &smithy.DeserializationError{ 8197 Err: fmt.Errorf("failed to decode response body, %w", err), 8198 Snapshot: snapshot.Bytes(), 8199 } 8200 return err 8201 } 8202 8203 errorBody.Seek(0, io.SeekStart) 8204 if len(code) != 0 { 8205 errorCode = restjson.SanitizeErrorCode(code) 8206 } 8207 if len(message) != 0 { 8208 errorMessage = message 8209 } 8210 8211 switch { 8212 case strings.EqualFold("ConflictException", errorCode): 8213 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 8214 8215 case strings.EqualFold("InternalServerException", errorCode): 8216 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 8217 8218 case strings.EqualFold("PreconditionFailedException", errorCode): 8219 return awsRestjson1_deserializeErrorPreconditionFailedException(response, errorBody) 8220 8221 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 8222 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 8223 8224 case strings.EqualFold("ThrottlingException", errorCode): 8225 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 8226 8227 case strings.EqualFold("ValidationException", errorCode): 8228 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 8229 8230 default: 8231 genericError := &smithy.GenericAPIError{ 8232 Code: errorCode, 8233 Message: errorMessage, 8234 } 8235 return genericError 8236 8237 } 8238} 8239 8240func awsRestjson1_deserializeOpDocumentUpdateSlotTypeOutput(v **UpdateSlotTypeOutput, value interface{}) error { 8241 if v == nil { 8242 return fmt.Errorf("unexpected nil of type %T", v) 8243 } 8244 if value == nil { 8245 return nil 8246 } 8247 8248 shape, ok := value.(map[string]interface{}) 8249 if !ok { 8250 return fmt.Errorf("unexpected JSON type %v", value) 8251 } 8252 8253 var sv *UpdateSlotTypeOutput 8254 if *v == nil { 8255 sv = &UpdateSlotTypeOutput{} 8256 } else { 8257 sv = *v 8258 } 8259 8260 for key, value := range shape { 8261 switch key { 8262 case "botId": 8263 if value != nil { 8264 jtv, ok := value.(string) 8265 if !ok { 8266 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8267 } 8268 sv.BotId = ptr.String(jtv) 8269 } 8270 8271 case "botVersion": 8272 if value != nil { 8273 jtv, ok := value.(string) 8274 if !ok { 8275 return fmt.Errorf("expected DraftBotVersion to be of type string, got %T instead", value) 8276 } 8277 sv.BotVersion = ptr.String(jtv) 8278 } 8279 8280 case "creationDateTime": 8281 if value != nil { 8282 jtv, ok := value.(json.Number) 8283 if !ok { 8284 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 8285 } 8286 f64, err := jtv.Float64() 8287 if err != nil { 8288 return err 8289 } 8290 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8291 } 8292 8293 case "description": 8294 if value != nil { 8295 jtv, ok := value.(string) 8296 if !ok { 8297 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 8298 } 8299 sv.Description = ptr.String(jtv) 8300 } 8301 8302 case "lastUpdatedDateTime": 8303 if value != nil { 8304 jtv, ok := value.(json.Number) 8305 if !ok { 8306 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 8307 } 8308 f64, err := jtv.Float64() 8309 if err != nil { 8310 return err 8311 } 8312 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8313 } 8314 8315 case "localeId": 8316 if value != nil { 8317 jtv, ok := value.(string) 8318 if !ok { 8319 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 8320 } 8321 sv.LocaleId = ptr.String(jtv) 8322 } 8323 8324 case "parentSlotTypeSignature": 8325 if value != nil { 8326 jtv, ok := value.(string) 8327 if !ok { 8328 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 8329 } 8330 sv.ParentSlotTypeSignature = ptr.String(jtv) 8331 } 8332 8333 case "slotTypeId": 8334 if value != nil { 8335 jtv, ok := value.(string) 8336 if !ok { 8337 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 8338 } 8339 sv.SlotTypeId = ptr.String(jtv) 8340 } 8341 8342 case "slotTypeName": 8343 if value != nil { 8344 jtv, ok := value.(string) 8345 if !ok { 8346 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 8347 } 8348 sv.SlotTypeName = ptr.String(jtv) 8349 } 8350 8351 case "slotTypeValues": 8352 if err := awsRestjson1_deserializeDocumentSlotTypeValues(&sv.SlotTypeValues, value); err != nil { 8353 return err 8354 } 8355 8356 case "valueSelectionSetting": 8357 if err := awsRestjson1_deserializeDocumentSlotValueSelectionSetting(&sv.ValueSelectionSetting, value); err != nil { 8358 return err 8359 } 8360 8361 default: 8362 _, _ = key, value 8363 8364 } 8365 } 8366 *v = sv 8367 return nil 8368} 8369 8370func awsRestjson1_deserializeOpHttpBindingsThrottlingException(v *types.ThrottlingException, response *smithyhttp.Response) error { 8371 if v == nil { 8372 return fmt.Errorf("unsupported deserialization for nil %T", v) 8373 } 8374 8375 if headerValues := response.Header.Values("Retry-After"); len(headerValues) != 0 { 8376 headerValues[0] = strings.TrimSpace(headerValues[0]) 8377 vv, err := strconv.ParseInt(headerValues[0], 0, 32) 8378 if err != nil { 8379 return err 8380 } 8381 v.RetryAfterSeconds = int32(vv) 8382 } 8383 8384 return nil 8385} 8386func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 8387 output := &types.ConflictException{} 8388 var buff [1024]byte 8389 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8390 8391 body := io.TeeReader(errorBody, ringBuffer) 8392 decoder := json.NewDecoder(body) 8393 decoder.UseNumber() 8394 var shape interface{} 8395 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8396 var snapshot bytes.Buffer 8397 io.Copy(&snapshot, ringBuffer) 8398 err = &smithy.DeserializationError{ 8399 Err: fmt.Errorf("failed to decode response body, %w", err), 8400 Snapshot: snapshot.Bytes(), 8401 } 8402 return err 8403 } 8404 8405 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 8406 8407 if err != nil { 8408 var snapshot bytes.Buffer 8409 io.Copy(&snapshot, ringBuffer) 8410 err = &smithy.DeserializationError{ 8411 Err: fmt.Errorf("failed to decode response body, %w", err), 8412 Snapshot: snapshot.Bytes(), 8413 } 8414 return err 8415 } 8416 8417 errorBody.Seek(0, io.SeekStart) 8418 8419 return output 8420} 8421 8422func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 8423 output := &types.InternalServerException{} 8424 var buff [1024]byte 8425 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8426 8427 body := io.TeeReader(errorBody, ringBuffer) 8428 decoder := json.NewDecoder(body) 8429 decoder.UseNumber() 8430 var shape interface{} 8431 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8432 var snapshot bytes.Buffer 8433 io.Copy(&snapshot, ringBuffer) 8434 err = &smithy.DeserializationError{ 8435 Err: fmt.Errorf("failed to decode response body, %w", err), 8436 Snapshot: snapshot.Bytes(), 8437 } 8438 return err 8439 } 8440 8441 err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) 8442 8443 if err != nil { 8444 var snapshot bytes.Buffer 8445 io.Copy(&snapshot, ringBuffer) 8446 err = &smithy.DeserializationError{ 8447 Err: fmt.Errorf("failed to decode response body, %w", err), 8448 Snapshot: snapshot.Bytes(), 8449 } 8450 return err 8451 } 8452 8453 errorBody.Seek(0, io.SeekStart) 8454 8455 return output 8456} 8457 8458func awsRestjson1_deserializeErrorPreconditionFailedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 8459 output := &types.PreconditionFailedException{} 8460 var buff [1024]byte 8461 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8462 8463 body := io.TeeReader(errorBody, ringBuffer) 8464 decoder := json.NewDecoder(body) 8465 decoder.UseNumber() 8466 var shape interface{} 8467 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8468 var snapshot bytes.Buffer 8469 io.Copy(&snapshot, ringBuffer) 8470 err = &smithy.DeserializationError{ 8471 Err: fmt.Errorf("failed to decode response body, %w", err), 8472 Snapshot: snapshot.Bytes(), 8473 } 8474 return err 8475 } 8476 8477 err := awsRestjson1_deserializeDocumentPreconditionFailedException(&output, shape) 8478 8479 if err != nil { 8480 var snapshot bytes.Buffer 8481 io.Copy(&snapshot, ringBuffer) 8482 err = &smithy.DeserializationError{ 8483 Err: fmt.Errorf("failed to decode response body, %w", err), 8484 Snapshot: snapshot.Bytes(), 8485 } 8486 return err 8487 } 8488 8489 errorBody.Seek(0, io.SeekStart) 8490 8491 return output 8492} 8493 8494func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 8495 output := &types.ResourceNotFoundException{} 8496 var buff [1024]byte 8497 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8498 8499 body := io.TeeReader(errorBody, ringBuffer) 8500 decoder := json.NewDecoder(body) 8501 decoder.UseNumber() 8502 var shape interface{} 8503 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8504 var snapshot bytes.Buffer 8505 io.Copy(&snapshot, ringBuffer) 8506 err = &smithy.DeserializationError{ 8507 Err: fmt.Errorf("failed to decode response body, %w", err), 8508 Snapshot: snapshot.Bytes(), 8509 } 8510 return err 8511 } 8512 8513 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 8514 8515 if err != nil { 8516 var snapshot bytes.Buffer 8517 io.Copy(&snapshot, ringBuffer) 8518 err = &smithy.DeserializationError{ 8519 Err: fmt.Errorf("failed to decode response body, %w", err), 8520 Snapshot: snapshot.Bytes(), 8521 } 8522 return err 8523 } 8524 8525 errorBody.Seek(0, io.SeekStart) 8526 8527 return output 8528} 8529 8530func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 8531 output := &types.ServiceQuotaExceededException{} 8532 var buff [1024]byte 8533 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8534 8535 body := io.TeeReader(errorBody, ringBuffer) 8536 decoder := json.NewDecoder(body) 8537 decoder.UseNumber() 8538 var shape interface{} 8539 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8540 var snapshot bytes.Buffer 8541 io.Copy(&snapshot, ringBuffer) 8542 err = &smithy.DeserializationError{ 8543 Err: fmt.Errorf("failed to decode response body, %w", err), 8544 Snapshot: snapshot.Bytes(), 8545 } 8546 return err 8547 } 8548 8549 err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) 8550 8551 if err != nil { 8552 var snapshot bytes.Buffer 8553 io.Copy(&snapshot, ringBuffer) 8554 err = &smithy.DeserializationError{ 8555 Err: fmt.Errorf("failed to decode response body, %w", err), 8556 Snapshot: snapshot.Bytes(), 8557 } 8558 return err 8559 } 8560 8561 errorBody.Seek(0, io.SeekStart) 8562 8563 return output 8564} 8565 8566func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 8567 output := &types.ThrottlingException{} 8568 var buff [1024]byte 8569 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8570 8571 body := io.TeeReader(errorBody, ringBuffer) 8572 decoder := json.NewDecoder(body) 8573 decoder.UseNumber() 8574 var shape interface{} 8575 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8576 var snapshot bytes.Buffer 8577 io.Copy(&snapshot, ringBuffer) 8578 err = &smithy.DeserializationError{ 8579 Err: fmt.Errorf("failed to decode response body, %w", err), 8580 Snapshot: snapshot.Bytes(), 8581 } 8582 return err 8583 } 8584 8585 err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) 8586 8587 if err != nil { 8588 var snapshot bytes.Buffer 8589 io.Copy(&snapshot, ringBuffer) 8590 err = &smithy.DeserializationError{ 8591 Err: fmt.Errorf("failed to decode response body, %w", err), 8592 Snapshot: snapshot.Bytes(), 8593 } 8594 return err 8595 } 8596 8597 errorBody.Seek(0, io.SeekStart) 8598 8599 if err := awsRestjson1_deserializeOpHttpBindingsThrottlingException(output, response); err != nil { 8600 return &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid HTTP bindings, %w", err)} 8601 } 8602 8603 return output 8604} 8605 8606func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 8607 output := &types.ValidationException{} 8608 var buff [1024]byte 8609 ringBuffer := smithyio.NewRingBuffer(buff[:]) 8610 8611 body := io.TeeReader(errorBody, ringBuffer) 8612 decoder := json.NewDecoder(body) 8613 decoder.UseNumber() 8614 var shape interface{} 8615 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 8616 var snapshot bytes.Buffer 8617 io.Copy(&snapshot, ringBuffer) 8618 err = &smithy.DeserializationError{ 8619 Err: fmt.Errorf("failed to decode response body, %w", err), 8620 Snapshot: snapshot.Bytes(), 8621 } 8622 return err 8623 } 8624 8625 err := awsRestjson1_deserializeDocumentValidationException(&output, shape) 8626 8627 if err != nil { 8628 var snapshot bytes.Buffer 8629 io.Copy(&snapshot, ringBuffer) 8630 err = &smithy.DeserializationError{ 8631 Err: fmt.Errorf("failed to decode response body, %w", err), 8632 Snapshot: snapshot.Bytes(), 8633 } 8634 return err 8635 } 8636 8637 errorBody.Seek(0, io.SeekStart) 8638 8639 return output 8640} 8641 8642func awsRestjson1_deserializeDocumentAudioLogDestination(v **types.AudioLogDestination, value interface{}) error { 8643 if v == nil { 8644 return fmt.Errorf("unexpected nil of type %T", v) 8645 } 8646 if value == nil { 8647 return nil 8648 } 8649 8650 shape, ok := value.(map[string]interface{}) 8651 if !ok { 8652 return fmt.Errorf("unexpected JSON type %v", value) 8653 } 8654 8655 var sv *types.AudioLogDestination 8656 if *v == nil { 8657 sv = &types.AudioLogDestination{} 8658 } else { 8659 sv = *v 8660 } 8661 8662 for key, value := range shape { 8663 switch key { 8664 case "s3Bucket": 8665 if err := awsRestjson1_deserializeDocumentS3BucketLogDestination(&sv.S3Bucket, value); err != nil { 8666 return err 8667 } 8668 8669 default: 8670 _, _ = key, value 8671 8672 } 8673 } 8674 *v = sv 8675 return nil 8676} 8677 8678func awsRestjson1_deserializeDocumentAudioLogSetting(v **types.AudioLogSetting, value interface{}) error { 8679 if v == nil { 8680 return fmt.Errorf("unexpected nil of type %T", v) 8681 } 8682 if value == nil { 8683 return nil 8684 } 8685 8686 shape, ok := value.(map[string]interface{}) 8687 if !ok { 8688 return fmt.Errorf("unexpected JSON type %v", value) 8689 } 8690 8691 var sv *types.AudioLogSetting 8692 if *v == nil { 8693 sv = &types.AudioLogSetting{} 8694 } else { 8695 sv = *v 8696 } 8697 8698 for key, value := range shape { 8699 switch key { 8700 case "destination": 8701 if err := awsRestjson1_deserializeDocumentAudioLogDestination(&sv.Destination, value); err != nil { 8702 return err 8703 } 8704 8705 case "enabled": 8706 if value != nil { 8707 jtv, ok := value.(bool) 8708 if !ok { 8709 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 8710 } 8711 sv.Enabled = jtv 8712 } 8713 8714 default: 8715 _, _ = key, value 8716 8717 } 8718 } 8719 *v = sv 8720 return nil 8721} 8722 8723func awsRestjson1_deserializeDocumentAudioLogSettingsList(v *[]types.AudioLogSetting, value interface{}) error { 8724 if v == nil { 8725 return fmt.Errorf("unexpected nil of type %T", v) 8726 } 8727 if value == nil { 8728 return nil 8729 } 8730 8731 shape, ok := value.([]interface{}) 8732 if !ok { 8733 return fmt.Errorf("unexpected JSON type %v", value) 8734 } 8735 8736 var cv []types.AudioLogSetting 8737 if *v == nil { 8738 cv = []types.AudioLogSetting{} 8739 } else { 8740 cv = *v 8741 } 8742 8743 for _, value := range shape { 8744 var col types.AudioLogSetting 8745 destAddr := &col 8746 if err := awsRestjson1_deserializeDocumentAudioLogSetting(&destAddr, value); err != nil { 8747 return err 8748 } 8749 col = *destAddr 8750 cv = append(cv, col) 8751 8752 } 8753 *v = cv 8754 return nil 8755} 8756 8757func awsRestjson1_deserializeDocumentBotAliasHistoryEvent(v **types.BotAliasHistoryEvent, value interface{}) error { 8758 if v == nil { 8759 return fmt.Errorf("unexpected nil of type %T", v) 8760 } 8761 if value == nil { 8762 return nil 8763 } 8764 8765 shape, ok := value.(map[string]interface{}) 8766 if !ok { 8767 return fmt.Errorf("unexpected JSON type %v", value) 8768 } 8769 8770 var sv *types.BotAliasHistoryEvent 8771 if *v == nil { 8772 sv = &types.BotAliasHistoryEvent{} 8773 } else { 8774 sv = *v 8775 } 8776 8777 for key, value := range shape { 8778 switch key { 8779 case "botVersion": 8780 if value != nil { 8781 jtv, ok := value.(string) 8782 if !ok { 8783 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 8784 } 8785 sv.BotVersion = ptr.String(jtv) 8786 } 8787 8788 case "endDate": 8789 if value != nil { 8790 jtv, ok := value.(json.Number) 8791 if !ok { 8792 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 8793 } 8794 f64, err := jtv.Float64() 8795 if err != nil { 8796 return err 8797 } 8798 sv.EndDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8799 } 8800 8801 case "startDate": 8802 if value != nil { 8803 jtv, ok := value.(json.Number) 8804 if !ok { 8805 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 8806 } 8807 f64, err := jtv.Float64() 8808 if err != nil { 8809 return err 8810 } 8811 sv.StartDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 8812 } 8813 8814 default: 8815 _, _ = key, value 8816 8817 } 8818 } 8819 *v = sv 8820 return nil 8821} 8822 8823func awsRestjson1_deserializeDocumentBotAliasHistoryEventsList(v *[]types.BotAliasHistoryEvent, value interface{}) error { 8824 if v == nil { 8825 return fmt.Errorf("unexpected nil of type %T", v) 8826 } 8827 if value == nil { 8828 return nil 8829 } 8830 8831 shape, ok := value.([]interface{}) 8832 if !ok { 8833 return fmt.Errorf("unexpected JSON type %v", value) 8834 } 8835 8836 var cv []types.BotAliasHistoryEvent 8837 if *v == nil { 8838 cv = []types.BotAliasHistoryEvent{} 8839 } else { 8840 cv = *v 8841 } 8842 8843 for _, value := range shape { 8844 var col types.BotAliasHistoryEvent 8845 destAddr := &col 8846 if err := awsRestjson1_deserializeDocumentBotAliasHistoryEvent(&destAddr, value); err != nil { 8847 return err 8848 } 8849 col = *destAddr 8850 cv = append(cv, col) 8851 8852 } 8853 *v = cv 8854 return nil 8855} 8856 8857func awsRestjson1_deserializeDocumentBotAliasLocaleSettings(v **types.BotAliasLocaleSettings, value interface{}) error { 8858 if v == nil { 8859 return fmt.Errorf("unexpected nil of type %T", v) 8860 } 8861 if value == nil { 8862 return nil 8863 } 8864 8865 shape, ok := value.(map[string]interface{}) 8866 if !ok { 8867 return fmt.Errorf("unexpected JSON type %v", value) 8868 } 8869 8870 var sv *types.BotAliasLocaleSettings 8871 if *v == nil { 8872 sv = &types.BotAliasLocaleSettings{} 8873 } else { 8874 sv = *v 8875 } 8876 8877 for key, value := range shape { 8878 switch key { 8879 case "codeHookSpecification": 8880 if err := awsRestjson1_deserializeDocumentCodeHookSpecification(&sv.CodeHookSpecification, value); err != nil { 8881 return err 8882 } 8883 8884 case "enabled": 8885 if value != nil { 8886 jtv, ok := value.(bool) 8887 if !ok { 8888 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 8889 } 8890 sv.Enabled = jtv 8891 } 8892 8893 default: 8894 _, _ = key, value 8895 8896 } 8897 } 8898 *v = sv 8899 return nil 8900} 8901 8902func awsRestjson1_deserializeDocumentBotAliasLocaleSettingsMap(v *map[string]types.BotAliasLocaleSettings, value interface{}) error { 8903 if v == nil { 8904 return fmt.Errorf("unexpected nil of type %T", v) 8905 } 8906 if value == nil { 8907 return nil 8908 } 8909 8910 shape, ok := value.(map[string]interface{}) 8911 if !ok { 8912 return fmt.Errorf("unexpected JSON type %v", value) 8913 } 8914 8915 var mv map[string]types.BotAliasLocaleSettings 8916 if *v == nil { 8917 mv = map[string]types.BotAliasLocaleSettings{} 8918 } else { 8919 mv = *v 8920 } 8921 8922 for key, value := range shape { 8923 var parsedVal types.BotAliasLocaleSettings 8924 mapVar := parsedVal 8925 destAddr := &mapVar 8926 if err := awsRestjson1_deserializeDocumentBotAliasLocaleSettings(&destAddr, value); err != nil { 8927 return err 8928 } 8929 parsedVal = *destAddr 8930 mv[key] = parsedVal 8931 8932 } 8933 *v = mv 8934 return nil 8935} 8936 8937func awsRestjson1_deserializeDocumentBotAliasSummary(v **types.BotAliasSummary, value interface{}) error { 8938 if v == nil { 8939 return fmt.Errorf("unexpected nil of type %T", v) 8940 } 8941 if value == nil { 8942 return nil 8943 } 8944 8945 shape, ok := value.(map[string]interface{}) 8946 if !ok { 8947 return fmt.Errorf("unexpected JSON type %v", value) 8948 } 8949 8950 var sv *types.BotAliasSummary 8951 if *v == nil { 8952 sv = &types.BotAliasSummary{} 8953 } else { 8954 sv = *v 8955 } 8956 8957 for key, value := range shape { 8958 switch key { 8959 case "botAliasId": 8960 if value != nil { 8961 jtv, ok := value.(string) 8962 if !ok { 8963 return fmt.Errorf("expected BotAliasId to be of type string, got %T instead", value) 8964 } 8965 sv.BotAliasId = ptr.String(jtv) 8966 } 8967 8968 case "botAliasName": 8969 if value != nil { 8970 jtv, ok := value.(string) 8971 if !ok { 8972 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 8973 } 8974 sv.BotAliasName = ptr.String(jtv) 8975 } 8976 8977 case "botAliasStatus": 8978 if value != nil { 8979 jtv, ok := value.(string) 8980 if !ok { 8981 return fmt.Errorf("expected BotAliasStatus to be of type string, got %T instead", value) 8982 } 8983 sv.BotAliasStatus = types.BotAliasStatus(jtv) 8984 } 8985 8986 case "botVersion": 8987 if value != nil { 8988 jtv, ok := value.(string) 8989 if !ok { 8990 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 8991 } 8992 sv.BotVersion = ptr.String(jtv) 8993 } 8994 8995 case "creationDateTime": 8996 if value != nil { 8997 jtv, ok := value.(json.Number) 8998 if !ok { 8999 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9000 } 9001 f64, err := jtv.Float64() 9002 if err != nil { 9003 return err 9004 } 9005 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9006 } 9007 9008 case "description": 9009 if value != nil { 9010 jtv, ok := value.(string) 9011 if !ok { 9012 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 9013 } 9014 sv.Description = ptr.String(jtv) 9015 } 9016 9017 case "lastUpdatedDateTime": 9018 if value != nil { 9019 jtv, ok := value.(json.Number) 9020 if !ok { 9021 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9022 } 9023 f64, err := jtv.Float64() 9024 if err != nil { 9025 return err 9026 } 9027 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9028 } 9029 9030 default: 9031 _, _ = key, value 9032 9033 } 9034 } 9035 *v = sv 9036 return nil 9037} 9038 9039func awsRestjson1_deserializeDocumentBotAliasSummaryList(v *[]types.BotAliasSummary, value interface{}) error { 9040 if v == nil { 9041 return fmt.Errorf("unexpected nil of type %T", v) 9042 } 9043 if value == nil { 9044 return nil 9045 } 9046 9047 shape, ok := value.([]interface{}) 9048 if !ok { 9049 return fmt.Errorf("unexpected JSON type %v", value) 9050 } 9051 9052 var cv []types.BotAliasSummary 9053 if *v == nil { 9054 cv = []types.BotAliasSummary{} 9055 } else { 9056 cv = *v 9057 } 9058 9059 for _, value := range shape { 9060 var col types.BotAliasSummary 9061 destAddr := &col 9062 if err := awsRestjson1_deserializeDocumentBotAliasSummary(&destAddr, value); err != nil { 9063 return err 9064 } 9065 col = *destAddr 9066 cv = append(cv, col) 9067 9068 } 9069 *v = cv 9070 return nil 9071} 9072 9073func awsRestjson1_deserializeDocumentBotLocaleHistoryEvent(v **types.BotLocaleHistoryEvent, value interface{}) error { 9074 if v == nil { 9075 return fmt.Errorf("unexpected nil of type %T", v) 9076 } 9077 if value == nil { 9078 return nil 9079 } 9080 9081 shape, ok := value.(map[string]interface{}) 9082 if !ok { 9083 return fmt.Errorf("unexpected JSON type %v", value) 9084 } 9085 9086 var sv *types.BotLocaleHistoryEvent 9087 if *v == nil { 9088 sv = &types.BotLocaleHistoryEvent{} 9089 } else { 9090 sv = *v 9091 } 9092 9093 for key, value := range shape { 9094 switch key { 9095 case "event": 9096 if value != nil { 9097 jtv, ok := value.(string) 9098 if !ok { 9099 return fmt.Errorf("expected BotLocaleHistoryEventDescription to be of type string, got %T instead", value) 9100 } 9101 sv.Event = ptr.String(jtv) 9102 } 9103 9104 case "eventDate": 9105 if value != nil { 9106 jtv, ok := value.(json.Number) 9107 if !ok { 9108 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9109 } 9110 f64, err := jtv.Float64() 9111 if err != nil { 9112 return err 9113 } 9114 sv.EventDate = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9115 } 9116 9117 default: 9118 _, _ = key, value 9119 9120 } 9121 } 9122 *v = sv 9123 return nil 9124} 9125 9126func awsRestjson1_deserializeDocumentBotLocaleHistoryEventsList(v *[]types.BotLocaleHistoryEvent, value interface{}) error { 9127 if v == nil { 9128 return fmt.Errorf("unexpected nil of type %T", v) 9129 } 9130 if value == nil { 9131 return nil 9132 } 9133 9134 shape, ok := value.([]interface{}) 9135 if !ok { 9136 return fmt.Errorf("unexpected JSON type %v", value) 9137 } 9138 9139 var cv []types.BotLocaleHistoryEvent 9140 if *v == nil { 9141 cv = []types.BotLocaleHistoryEvent{} 9142 } else { 9143 cv = *v 9144 } 9145 9146 for _, value := range shape { 9147 var col types.BotLocaleHistoryEvent 9148 destAddr := &col 9149 if err := awsRestjson1_deserializeDocumentBotLocaleHistoryEvent(&destAddr, value); err != nil { 9150 return err 9151 } 9152 col = *destAddr 9153 cv = append(cv, col) 9154 9155 } 9156 *v = cv 9157 return nil 9158} 9159 9160func awsRestjson1_deserializeDocumentBotLocaleSummary(v **types.BotLocaleSummary, value interface{}) error { 9161 if v == nil { 9162 return fmt.Errorf("unexpected nil of type %T", v) 9163 } 9164 if value == nil { 9165 return nil 9166 } 9167 9168 shape, ok := value.(map[string]interface{}) 9169 if !ok { 9170 return fmt.Errorf("unexpected JSON type %v", value) 9171 } 9172 9173 var sv *types.BotLocaleSummary 9174 if *v == nil { 9175 sv = &types.BotLocaleSummary{} 9176 } else { 9177 sv = *v 9178 } 9179 9180 for key, value := range shape { 9181 switch key { 9182 case "botLocaleStatus": 9183 if value != nil { 9184 jtv, ok := value.(string) 9185 if !ok { 9186 return fmt.Errorf("expected BotLocaleStatus to be of type string, got %T instead", value) 9187 } 9188 sv.BotLocaleStatus = types.BotLocaleStatus(jtv) 9189 } 9190 9191 case "description": 9192 if value != nil { 9193 jtv, ok := value.(string) 9194 if !ok { 9195 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 9196 } 9197 sv.Description = ptr.String(jtv) 9198 } 9199 9200 case "lastBuildSubmittedDateTime": 9201 if value != nil { 9202 jtv, ok := value.(json.Number) 9203 if !ok { 9204 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9205 } 9206 f64, err := jtv.Float64() 9207 if err != nil { 9208 return err 9209 } 9210 sv.LastBuildSubmittedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9211 } 9212 9213 case "lastUpdatedDateTime": 9214 if value != nil { 9215 jtv, ok := value.(json.Number) 9216 if !ok { 9217 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9218 } 9219 f64, err := jtv.Float64() 9220 if err != nil { 9221 return err 9222 } 9223 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9224 } 9225 9226 case "localeId": 9227 if value != nil { 9228 jtv, ok := value.(string) 9229 if !ok { 9230 return fmt.Errorf("expected LocaleId to be of type string, got %T instead", value) 9231 } 9232 sv.LocaleId = ptr.String(jtv) 9233 } 9234 9235 case "localeName": 9236 if value != nil { 9237 jtv, ok := value.(string) 9238 if !ok { 9239 return fmt.Errorf("expected LocaleName to be of type string, got %T instead", value) 9240 } 9241 sv.LocaleName = ptr.String(jtv) 9242 } 9243 9244 default: 9245 _, _ = key, value 9246 9247 } 9248 } 9249 *v = sv 9250 return nil 9251} 9252 9253func awsRestjson1_deserializeDocumentBotLocaleSummaryList(v *[]types.BotLocaleSummary, value interface{}) error { 9254 if v == nil { 9255 return fmt.Errorf("unexpected nil of type %T", v) 9256 } 9257 if value == nil { 9258 return nil 9259 } 9260 9261 shape, ok := value.([]interface{}) 9262 if !ok { 9263 return fmt.Errorf("unexpected JSON type %v", value) 9264 } 9265 9266 var cv []types.BotLocaleSummary 9267 if *v == nil { 9268 cv = []types.BotLocaleSummary{} 9269 } else { 9270 cv = *v 9271 } 9272 9273 for _, value := range shape { 9274 var col types.BotLocaleSummary 9275 destAddr := &col 9276 if err := awsRestjson1_deserializeDocumentBotLocaleSummary(&destAddr, value); err != nil { 9277 return err 9278 } 9279 col = *destAddr 9280 cv = append(cv, col) 9281 9282 } 9283 *v = cv 9284 return nil 9285} 9286 9287func awsRestjson1_deserializeDocumentBotSummary(v **types.BotSummary, value interface{}) error { 9288 if v == nil { 9289 return fmt.Errorf("unexpected nil of type %T", v) 9290 } 9291 if value == nil { 9292 return nil 9293 } 9294 9295 shape, ok := value.(map[string]interface{}) 9296 if !ok { 9297 return fmt.Errorf("unexpected JSON type %v", value) 9298 } 9299 9300 var sv *types.BotSummary 9301 if *v == nil { 9302 sv = &types.BotSummary{} 9303 } else { 9304 sv = *v 9305 } 9306 9307 for key, value := range shape { 9308 switch key { 9309 case "botId": 9310 if value != nil { 9311 jtv, ok := value.(string) 9312 if !ok { 9313 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 9314 } 9315 sv.BotId = ptr.String(jtv) 9316 } 9317 9318 case "botName": 9319 if value != nil { 9320 jtv, ok := value.(string) 9321 if !ok { 9322 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 9323 } 9324 sv.BotName = ptr.String(jtv) 9325 } 9326 9327 case "botStatus": 9328 if value != nil { 9329 jtv, ok := value.(string) 9330 if !ok { 9331 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 9332 } 9333 sv.BotStatus = types.BotStatus(jtv) 9334 } 9335 9336 case "description": 9337 if value != nil { 9338 jtv, ok := value.(string) 9339 if !ok { 9340 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 9341 } 9342 sv.Description = ptr.String(jtv) 9343 } 9344 9345 case "lastUpdatedDateTime": 9346 if value != nil { 9347 jtv, ok := value.(json.Number) 9348 if !ok { 9349 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9350 } 9351 f64, err := jtv.Float64() 9352 if err != nil { 9353 return err 9354 } 9355 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9356 } 9357 9358 case "latestBotVersion": 9359 if value != nil { 9360 jtv, ok := value.(string) 9361 if !ok { 9362 return fmt.Errorf("expected NumericalBotVersion to be of type string, got %T instead", value) 9363 } 9364 sv.LatestBotVersion = ptr.String(jtv) 9365 } 9366 9367 default: 9368 _, _ = key, value 9369 9370 } 9371 } 9372 *v = sv 9373 return nil 9374} 9375 9376func awsRestjson1_deserializeDocumentBotSummaryList(v *[]types.BotSummary, value interface{}) error { 9377 if v == nil { 9378 return fmt.Errorf("unexpected nil of type %T", v) 9379 } 9380 if value == nil { 9381 return nil 9382 } 9383 9384 shape, ok := value.([]interface{}) 9385 if !ok { 9386 return fmt.Errorf("unexpected JSON type %v", value) 9387 } 9388 9389 var cv []types.BotSummary 9390 if *v == nil { 9391 cv = []types.BotSummary{} 9392 } else { 9393 cv = *v 9394 } 9395 9396 for _, value := range shape { 9397 var col types.BotSummary 9398 destAddr := &col 9399 if err := awsRestjson1_deserializeDocumentBotSummary(&destAddr, value); err != nil { 9400 return err 9401 } 9402 col = *destAddr 9403 cv = append(cv, col) 9404 9405 } 9406 *v = cv 9407 return nil 9408} 9409 9410func awsRestjson1_deserializeDocumentBotVersionLocaleDetails(v **types.BotVersionLocaleDetails, value interface{}) error { 9411 if v == nil { 9412 return fmt.Errorf("unexpected nil of type %T", v) 9413 } 9414 if value == nil { 9415 return nil 9416 } 9417 9418 shape, ok := value.(map[string]interface{}) 9419 if !ok { 9420 return fmt.Errorf("unexpected JSON type %v", value) 9421 } 9422 9423 var sv *types.BotVersionLocaleDetails 9424 if *v == nil { 9425 sv = &types.BotVersionLocaleDetails{} 9426 } else { 9427 sv = *v 9428 } 9429 9430 for key, value := range shape { 9431 switch key { 9432 case "sourceBotVersion": 9433 if value != nil { 9434 jtv, ok := value.(string) 9435 if !ok { 9436 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 9437 } 9438 sv.SourceBotVersion = ptr.String(jtv) 9439 } 9440 9441 default: 9442 _, _ = key, value 9443 9444 } 9445 } 9446 *v = sv 9447 return nil 9448} 9449 9450func awsRestjson1_deserializeDocumentBotVersionLocaleSpecification(v *map[string]types.BotVersionLocaleDetails, value interface{}) error { 9451 if v == nil { 9452 return fmt.Errorf("unexpected nil of type %T", v) 9453 } 9454 if value == nil { 9455 return nil 9456 } 9457 9458 shape, ok := value.(map[string]interface{}) 9459 if !ok { 9460 return fmt.Errorf("unexpected JSON type %v", value) 9461 } 9462 9463 var mv map[string]types.BotVersionLocaleDetails 9464 if *v == nil { 9465 mv = map[string]types.BotVersionLocaleDetails{} 9466 } else { 9467 mv = *v 9468 } 9469 9470 for key, value := range shape { 9471 var parsedVal types.BotVersionLocaleDetails 9472 mapVar := parsedVal 9473 destAddr := &mapVar 9474 if err := awsRestjson1_deserializeDocumentBotVersionLocaleDetails(&destAddr, value); err != nil { 9475 return err 9476 } 9477 parsedVal = *destAddr 9478 mv[key] = parsedVal 9479 9480 } 9481 *v = mv 9482 return nil 9483} 9484 9485func awsRestjson1_deserializeDocumentBotVersionSummary(v **types.BotVersionSummary, value interface{}) error { 9486 if v == nil { 9487 return fmt.Errorf("unexpected nil of type %T", v) 9488 } 9489 if value == nil { 9490 return nil 9491 } 9492 9493 shape, ok := value.(map[string]interface{}) 9494 if !ok { 9495 return fmt.Errorf("unexpected JSON type %v", value) 9496 } 9497 9498 var sv *types.BotVersionSummary 9499 if *v == nil { 9500 sv = &types.BotVersionSummary{} 9501 } else { 9502 sv = *v 9503 } 9504 9505 for key, value := range shape { 9506 switch key { 9507 case "botName": 9508 if value != nil { 9509 jtv, ok := value.(string) 9510 if !ok { 9511 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 9512 } 9513 sv.BotName = ptr.String(jtv) 9514 } 9515 9516 case "botStatus": 9517 if value != nil { 9518 jtv, ok := value.(string) 9519 if !ok { 9520 return fmt.Errorf("expected BotStatus to be of type string, got %T instead", value) 9521 } 9522 sv.BotStatus = types.BotStatus(jtv) 9523 } 9524 9525 case "botVersion": 9526 if value != nil { 9527 jtv, ok := value.(string) 9528 if !ok { 9529 return fmt.Errorf("expected BotVersion to be of type string, got %T instead", value) 9530 } 9531 sv.BotVersion = ptr.String(jtv) 9532 } 9533 9534 case "creationDateTime": 9535 if value != nil { 9536 jtv, ok := value.(json.Number) 9537 if !ok { 9538 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 9539 } 9540 f64, err := jtv.Float64() 9541 if err != nil { 9542 return err 9543 } 9544 sv.CreationDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 9545 } 9546 9547 case "description": 9548 if value != nil { 9549 jtv, ok := value.(string) 9550 if !ok { 9551 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 9552 } 9553 sv.Description = ptr.String(jtv) 9554 } 9555 9556 default: 9557 _, _ = key, value 9558 9559 } 9560 } 9561 *v = sv 9562 return nil 9563} 9564 9565func awsRestjson1_deserializeDocumentBotVersionSummaryList(v *[]types.BotVersionSummary, value interface{}) error { 9566 if v == nil { 9567 return fmt.Errorf("unexpected nil of type %T", v) 9568 } 9569 if value == nil { 9570 return nil 9571 } 9572 9573 shape, ok := value.([]interface{}) 9574 if !ok { 9575 return fmt.Errorf("unexpected JSON type %v", value) 9576 } 9577 9578 var cv []types.BotVersionSummary 9579 if *v == nil { 9580 cv = []types.BotVersionSummary{} 9581 } else { 9582 cv = *v 9583 } 9584 9585 for _, value := range shape { 9586 var col types.BotVersionSummary 9587 destAddr := &col 9588 if err := awsRestjson1_deserializeDocumentBotVersionSummary(&destAddr, value); err != nil { 9589 return err 9590 } 9591 col = *destAddr 9592 cv = append(cv, col) 9593 9594 } 9595 *v = cv 9596 return nil 9597} 9598 9599func awsRestjson1_deserializeDocumentBuiltInIntentSummary(v **types.BuiltInIntentSummary, value interface{}) error { 9600 if v == nil { 9601 return fmt.Errorf("unexpected nil of type %T", v) 9602 } 9603 if value == nil { 9604 return nil 9605 } 9606 9607 shape, ok := value.(map[string]interface{}) 9608 if !ok { 9609 return fmt.Errorf("unexpected JSON type %v", value) 9610 } 9611 9612 var sv *types.BuiltInIntentSummary 9613 if *v == nil { 9614 sv = &types.BuiltInIntentSummary{} 9615 } else { 9616 sv = *v 9617 } 9618 9619 for key, value := range shape { 9620 switch key { 9621 case "description": 9622 if value != nil { 9623 jtv, ok := value.(string) 9624 if !ok { 9625 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 9626 } 9627 sv.Description = ptr.String(jtv) 9628 } 9629 9630 case "intentSignature": 9631 if value != nil { 9632 jtv, ok := value.(string) 9633 if !ok { 9634 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 9635 } 9636 sv.IntentSignature = ptr.String(jtv) 9637 } 9638 9639 default: 9640 _, _ = key, value 9641 9642 } 9643 } 9644 *v = sv 9645 return nil 9646} 9647 9648func awsRestjson1_deserializeDocumentBuiltInIntentSummaryList(v *[]types.BuiltInIntentSummary, value interface{}) error { 9649 if v == nil { 9650 return fmt.Errorf("unexpected nil of type %T", v) 9651 } 9652 if value == nil { 9653 return nil 9654 } 9655 9656 shape, ok := value.([]interface{}) 9657 if !ok { 9658 return fmt.Errorf("unexpected JSON type %v", value) 9659 } 9660 9661 var cv []types.BuiltInIntentSummary 9662 if *v == nil { 9663 cv = []types.BuiltInIntentSummary{} 9664 } else { 9665 cv = *v 9666 } 9667 9668 for _, value := range shape { 9669 var col types.BuiltInIntentSummary 9670 destAddr := &col 9671 if err := awsRestjson1_deserializeDocumentBuiltInIntentSummary(&destAddr, value); err != nil { 9672 return err 9673 } 9674 col = *destAddr 9675 cv = append(cv, col) 9676 9677 } 9678 *v = cv 9679 return nil 9680} 9681 9682func awsRestjson1_deserializeDocumentBuiltInSlotTypeSummary(v **types.BuiltInSlotTypeSummary, value interface{}) error { 9683 if v == nil { 9684 return fmt.Errorf("unexpected nil of type %T", v) 9685 } 9686 if value == nil { 9687 return nil 9688 } 9689 9690 shape, ok := value.(map[string]interface{}) 9691 if !ok { 9692 return fmt.Errorf("unexpected JSON type %v", value) 9693 } 9694 9695 var sv *types.BuiltInSlotTypeSummary 9696 if *v == nil { 9697 sv = &types.BuiltInSlotTypeSummary{} 9698 } else { 9699 sv = *v 9700 } 9701 9702 for key, value := range shape { 9703 switch key { 9704 case "description": 9705 if value != nil { 9706 jtv, ok := value.(string) 9707 if !ok { 9708 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 9709 } 9710 sv.Description = ptr.String(jtv) 9711 } 9712 9713 case "slotTypeSignature": 9714 if value != nil { 9715 jtv, ok := value.(string) 9716 if !ok { 9717 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 9718 } 9719 sv.SlotTypeSignature = ptr.String(jtv) 9720 } 9721 9722 default: 9723 _, _ = key, value 9724 9725 } 9726 } 9727 *v = sv 9728 return nil 9729} 9730 9731func awsRestjson1_deserializeDocumentBuiltInSlotTypeSummaryList(v *[]types.BuiltInSlotTypeSummary, value interface{}) error { 9732 if v == nil { 9733 return fmt.Errorf("unexpected nil of type %T", v) 9734 } 9735 if value == nil { 9736 return nil 9737 } 9738 9739 shape, ok := value.([]interface{}) 9740 if !ok { 9741 return fmt.Errorf("unexpected JSON type %v", value) 9742 } 9743 9744 var cv []types.BuiltInSlotTypeSummary 9745 if *v == nil { 9746 cv = []types.BuiltInSlotTypeSummary{} 9747 } else { 9748 cv = *v 9749 } 9750 9751 for _, value := range shape { 9752 var col types.BuiltInSlotTypeSummary 9753 destAddr := &col 9754 if err := awsRestjson1_deserializeDocumentBuiltInSlotTypeSummary(&destAddr, value); err != nil { 9755 return err 9756 } 9757 col = *destAddr 9758 cv = append(cv, col) 9759 9760 } 9761 *v = cv 9762 return nil 9763} 9764 9765func awsRestjson1_deserializeDocumentButton(v **types.Button, value interface{}) error { 9766 if v == nil { 9767 return fmt.Errorf("unexpected nil of type %T", v) 9768 } 9769 if value == nil { 9770 return nil 9771 } 9772 9773 shape, ok := value.(map[string]interface{}) 9774 if !ok { 9775 return fmt.Errorf("unexpected JSON type %v", value) 9776 } 9777 9778 var sv *types.Button 9779 if *v == nil { 9780 sv = &types.Button{} 9781 } else { 9782 sv = *v 9783 } 9784 9785 for key, value := range shape { 9786 switch key { 9787 case "text": 9788 if value != nil { 9789 jtv, ok := value.(string) 9790 if !ok { 9791 return fmt.Errorf("expected ButtonText to be of type string, got %T instead", value) 9792 } 9793 sv.Text = ptr.String(jtv) 9794 } 9795 9796 case "value": 9797 if value != nil { 9798 jtv, ok := value.(string) 9799 if !ok { 9800 return fmt.Errorf("expected ButtonValue to be of type string, got %T instead", value) 9801 } 9802 sv.Value = ptr.String(jtv) 9803 } 9804 9805 default: 9806 _, _ = key, value 9807 9808 } 9809 } 9810 *v = sv 9811 return nil 9812} 9813 9814func awsRestjson1_deserializeDocumentButtonsList(v *[]types.Button, value interface{}) error { 9815 if v == nil { 9816 return fmt.Errorf("unexpected nil of type %T", v) 9817 } 9818 if value == nil { 9819 return nil 9820 } 9821 9822 shape, ok := value.([]interface{}) 9823 if !ok { 9824 return fmt.Errorf("unexpected JSON type %v", value) 9825 } 9826 9827 var cv []types.Button 9828 if *v == nil { 9829 cv = []types.Button{} 9830 } else { 9831 cv = *v 9832 } 9833 9834 for _, value := range shape { 9835 var col types.Button 9836 destAddr := &col 9837 if err := awsRestjson1_deserializeDocumentButton(&destAddr, value); err != nil { 9838 return err 9839 } 9840 col = *destAddr 9841 cv = append(cv, col) 9842 9843 } 9844 *v = cv 9845 return nil 9846} 9847 9848func awsRestjson1_deserializeDocumentCloudWatchLogGroupLogDestination(v **types.CloudWatchLogGroupLogDestination, value interface{}) error { 9849 if v == nil { 9850 return fmt.Errorf("unexpected nil of type %T", v) 9851 } 9852 if value == nil { 9853 return nil 9854 } 9855 9856 shape, ok := value.(map[string]interface{}) 9857 if !ok { 9858 return fmt.Errorf("unexpected JSON type %v", value) 9859 } 9860 9861 var sv *types.CloudWatchLogGroupLogDestination 9862 if *v == nil { 9863 sv = &types.CloudWatchLogGroupLogDestination{} 9864 } else { 9865 sv = *v 9866 } 9867 9868 for key, value := range shape { 9869 switch key { 9870 case "cloudWatchLogGroupArn": 9871 if value != nil { 9872 jtv, ok := value.(string) 9873 if !ok { 9874 return fmt.Errorf("expected CloudWatchLogGroupArn to be of type string, got %T instead", value) 9875 } 9876 sv.CloudWatchLogGroupArn = ptr.String(jtv) 9877 } 9878 9879 case "logPrefix": 9880 if value != nil { 9881 jtv, ok := value.(string) 9882 if !ok { 9883 return fmt.Errorf("expected LogPrefix to be of type string, got %T instead", value) 9884 } 9885 sv.LogPrefix = ptr.String(jtv) 9886 } 9887 9888 default: 9889 _, _ = key, value 9890 9891 } 9892 } 9893 *v = sv 9894 return nil 9895} 9896 9897func awsRestjson1_deserializeDocumentCodeHookSpecification(v **types.CodeHookSpecification, value interface{}) error { 9898 if v == nil { 9899 return fmt.Errorf("unexpected nil of type %T", v) 9900 } 9901 if value == nil { 9902 return nil 9903 } 9904 9905 shape, ok := value.(map[string]interface{}) 9906 if !ok { 9907 return fmt.Errorf("unexpected JSON type %v", value) 9908 } 9909 9910 var sv *types.CodeHookSpecification 9911 if *v == nil { 9912 sv = &types.CodeHookSpecification{} 9913 } else { 9914 sv = *v 9915 } 9916 9917 for key, value := range shape { 9918 switch key { 9919 case "lambdaCodeHook": 9920 if err := awsRestjson1_deserializeDocumentLambdaCodeHook(&sv.LambdaCodeHook, value); err != nil { 9921 return err 9922 } 9923 9924 default: 9925 _, _ = key, value 9926 9927 } 9928 } 9929 *v = sv 9930 return nil 9931} 9932 9933func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 9934 if v == nil { 9935 return fmt.Errorf("unexpected nil of type %T", v) 9936 } 9937 if value == nil { 9938 return nil 9939 } 9940 9941 shape, ok := value.(map[string]interface{}) 9942 if !ok { 9943 return fmt.Errorf("unexpected JSON type %v", value) 9944 } 9945 9946 var sv *types.ConflictException 9947 if *v == nil { 9948 sv = &types.ConflictException{} 9949 } else { 9950 sv = *v 9951 } 9952 9953 for key, value := range shape { 9954 switch key { 9955 case "message": 9956 if value != nil { 9957 jtv, ok := value.(string) 9958 if !ok { 9959 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 9960 } 9961 sv.Message = ptr.String(jtv) 9962 } 9963 9964 default: 9965 _, _ = key, value 9966 9967 } 9968 } 9969 *v = sv 9970 return nil 9971} 9972 9973func awsRestjson1_deserializeDocumentConversationLogSettings(v **types.ConversationLogSettings, value interface{}) error { 9974 if v == nil { 9975 return fmt.Errorf("unexpected nil of type %T", v) 9976 } 9977 if value == nil { 9978 return nil 9979 } 9980 9981 shape, ok := value.(map[string]interface{}) 9982 if !ok { 9983 return fmt.Errorf("unexpected JSON type %v", value) 9984 } 9985 9986 var sv *types.ConversationLogSettings 9987 if *v == nil { 9988 sv = &types.ConversationLogSettings{} 9989 } else { 9990 sv = *v 9991 } 9992 9993 for key, value := range shape { 9994 switch key { 9995 case "audioLogSettings": 9996 if err := awsRestjson1_deserializeDocumentAudioLogSettingsList(&sv.AudioLogSettings, value); err != nil { 9997 return err 9998 } 9999 10000 case "textLogSettings": 10001 if err := awsRestjson1_deserializeDocumentTextLogSettingsList(&sv.TextLogSettings, value); err != nil { 10002 return err 10003 } 10004 10005 default: 10006 _, _ = key, value 10007 10008 } 10009 } 10010 *v = sv 10011 return nil 10012} 10013 10014func awsRestjson1_deserializeDocumentCustomPayload(v **types.CustomPayload, value interface{}) error { 10015 if v == nil { 10016 return fmt.Errorf("unexpected nil of type %T", v) 10017 } 10018 if value == nil { 10019 return nil 10020 } 10021 10022 shape, ok := value.(map[string]interface{}) 10023 if !ok { 10024 return fmt.Errorf("unexpected JSON type %v", value) 10025 } 10026 10027 var sv *types.CustomPayload 10028 if *v == nil { 10029 sv = &types.CustomPayload{} 10030 } else { 10031 sv = *v 10032 } 10033 10034 for key, value := range shape { 10035 switch key { 10036 case "value": 10037 if value != nil { 10038 jtv, ok := value.(string) 10039 if !ok { 10040 return fmt.Errorf("expected CustomPayloadValue to be of type string, got %T instead", value) 10041 } 10042 sv.Value = ptr.String(jtv) 10043 } 10044 10045 default: 10046 _, _ = key, value 10047 10048 } 10049 } 10050 *v = sv 10051 return nil 10052} 10053 10054func awsRestjson1_deserializeDocumentDataPrivacy(v **types.DataPrivacy, value interface{}) error { 10055 if v == nil { 10056 return fmt.Errorf("unexpected nil of type %T", v) 10057 } 10058 if value == nil { 10059 return nil 10060 } 10061 10062 shape, ok := value.(map[string]interface{}) 10063 if !ok { 10064 return fmt.Errorf("unexpected JSON type %v", value) 10065 } 10066 10067 var sv *types.DataPrivacy 10068 if *v == nil { 10069 sv = &types.DataPrivacy{} 10070 } else { 10071 sv = *v 10072 } 10073 10074 for key, value := range shape { 10075 switch key { 10076 case "childDirected": 10077 if value != nil { 10078 jtv, ok := value.(bool) 10079 if !ok { 10080 return fmt.Errorf("expected ChildDirected to be of type *bool, got %T instead", value) 10081 } 10082 sv.ChildDirected = jtv 10083 } 10084 10085 default: 10086 _, _ = key, value 10087 10088 } 10089 } 10090 *v = sv 10091 return nil 10092} 10093 10094func awsRestjson1_deserializeDocumentDialogCodeHookSettings(v **types.DialogCodeHookSettings, value interface{}) error { 10095 if v == nil { 10096 return fmt.Errorf("unexpected nil of type %T", v) 10097 } 10098 if value == nil { 10099 return nil 10100 } 10101 10102 shape, ok := value.(map[string]interface{}) 10103 if !ok { 10104 return fmt.Errorf("unexpected JSON type %v", value) 10105 } 10106 10107 var sv *types.DialogCodeHookSettings 10108 if *v == nil { 10109 sv = &types.DialogCodeHookSettings{} 10110 } else { 10111 sv = *v 10112 } 10113 10114 for key, value := range shape { 10115 switch key { 10116 case "enabled": 10117 if value != nil { 10118 jtv, ok := value.(bool) 10119 if !ok { 10120 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 10121 } 10122 sv.Enabled = jtv 10123 } 10124 10125 default: 10126 _, _ = key, value 10127 10128 } 10129 } 10130 *v = sv 10131 return nil 10132} 10133 10134func awsRestjson1_deserializeDocumentFailureReasons(v *[]string, value interface{}) error { 10135 if v == nil { 10136 return fmt.Errorf("unexpected nil of type %T", v) 10137 } 10138 if value == nil { 10139 return nil 10140 } 10141 10142 shape, ok := value.([]interface{}) 10143 if !ok { 10144 return fmt.Errorf("unexpected JSON type %v", value) 10145 } 10146 10147 var cv []string 10148 if *v == nil { 10149 cv = []string{} 10150 } else { 10151 cv = *v 10152 } 10153 10154 for _, value := range shape { 10155 var col string 10156 if value != nil { 10157 jtv, ok := value.(string) 10158 if !ok { 10159 return fmt.Errorf("expected FailureReason to be of type string, got %T instead", value) 10160 } 10161 col = jtv 10162 } 10163 cv = append(cv, col) 10164 10165 } 10166 *v = cv 10167 return nil 10168} 10169 10170func awsRestjson1_deserializeDocumentFulfillmentCodeHookSettings(v **types.FulfillmentCodeHookSettings, value interface{}) error { 10171 if v == nil { 10172 return fmt.Errorf("unexpected nil of type %T", v) 10173 } 10174 if value == nil { 10175 return nil 10176 } 10177 10178 shape, ok := value.(map[string]interface{}) 10179 if !ok { 10180 return fmt.Errorf("unexpected JSON type %v", value) 10181 } 10182 10183 var sv *types.FulfillmentCodeHookSettings 10184 if *v == nil { 10185 sv = &types.FulfillmentCodeHookSettings{} 10186 } else { 10187 sv = *v 10188 } 10189 10190 for key, value := range shape { 10191 switch key { 10192 case "enabled": 10193 if value != nil { 10194 jtv, ok := value.(bool) 10195 if !ok { 10196 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 10197 } 10198 sv.Enabled = jtv 10199 } 10200 10201 default: 10202 _, _ = key, value 10203 10204 } 10205 } 10206 *v = sv 10207 return nil 10208} 10209 10210func awsRestjson1_deserializeDocumentImageResponseCard(v **types.ImageResponseCard, value interface{}) error { 10211 if v == nil { 10212 return fmt.Errorf("unexpected nil of type %T", v) 10213 } 10214 if value == nil { 10215 return nil 10216 } 10217 10218 shape, ok := value.(map[string]interface{}) 10219 if !ok { 10220 return fmt.Errorf("unexpected JSON type %v", value) 10221 } 10222 10223 var sv *types.ImageResponseCard 10224 if *v == nil { 10225 sv = &types.ImageResponseCard{} 10226 } else { 10227 sv = *v 10228 } 10229 10230 for key, value := range shape { 10231 switch key { 10232 case "buttons": 10233 if err := awsRestjson1_deserializeDocumentButtonsList(&sv.Buttons, value); err != nil { 10234 return err 10235 } 10236 10237 case "imageUrl": 10238 if value != nil { 10239 jtv, ok := value.(string) 10240 if !ok { 10241 return fmt.Errorf("expected AttachmentUrl to be of type string, got %T instead", value) 10242 } 10243 sv.ImageUrl = ptr.String(jtv) 10244 } 10245 10246 case "subtitle": 10247 if value != nil { 10248 jtv, ok := value.(string) 10249 if !ok { 10250 return fmt.Errorf("expected AttachmentTitle to be of type string, got %T instead", value) 10251 } 10252 sv.Subtitle = ptr.String(jtv) 10253 } 10254 10255 case "title": 10256 if value != nil { 10257 jtv, ok := value.(string) 10258 if !ok { 10259 return fmt.Errorf("expected AttachmentTitle to be of type string, got %T instead", value) 10260 } 10261 sv.Title = ptr.String(jtv) 10262 } 10263 10264 default: 10265 _, _ = key, value 10266 10267 } 10268 } 10269 *v = sv 10270 return nil 10271} 10272 10273func awsRestjson1_deserializeDocumentInputContext(v **types.InputContext, value interface{}) error { 10274 if v == nil { 10275 return fmt.Errorf("unexpected nil of type %T", v) 10276 } 10277 if value == nil { 10278 return nil 10279 } 10280 10281 shape, ok := value.(map[string]interface{}) 10282 if !ok { 10283 return fmt.Errorf("unexpected JSON type %v", value) 10284 } 10285 10286 var sv *types.InputContext 10287 if *v == nil { 10288 sv = &types.InputContext{} 10289 } else { 10290 sv = *v 10291 } 10292 10293 for key, value := range shape { 10294 switch key { 10295 case "name": 10296 if value != nil { 10297 jtv, ok := value.(string) 10298 if !ok { 10299 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 10300 } 10301 sv.Name = ptr.String(jtv) 10302 } 10303 10304 default: 10305 _, _ = key, value 10306 10307 } 10308 } 10309 *v = sv 10310 return nil 10311} 10312 10313func awsRestjson1_deserializeDocumentInputContextsList(v *[]types.InputContext, value interface{}) error { 10314 if v == nil { 10315 return fmt.Errorf("unexpected nil of type %T", v) 10316 } 10317 if value == nil { 10318 return nil 10319 } 10320 10321 shape, ok := value.([]interface{}) 10322 if !ok { 10323 return fmt.Errorf("unexpected JSON type %v", value) 10324 } 10325 10326 var cv []types.InputContext 10327 if *v == nil { 10328 cv = []types.InputContext{} 10329 } else { 10330 cv = *v 10331 } 10332 10333 for _, value := range shape { 10334 var col types.InputContext 10335 destAddr := &col 10336 if err := awsRestjson1_deserializeDocumentInputContext(&destAddr, value); err != nil { 10337 return err 10338 } 10339 col = *destAddr 10340 cv = append(cv, col) 10341 10342 } 10343 *v = cv 10344 return nil 10345} 10346 10347func awsRestjson1_deserializeDocumentIntentClosingSetting(v **types.IntentClosingSetting, value interface{}) error { 10348 if v == nil { 10349 return fmt.Errorf("unexpected nil of type %T", v) 10350 } 10351 if value == nil { 10352 return nil 10353 } 10354 10355 shape, ok := value.(map[string]interface{}) 10356 if !ok { 10357 return fmt.Errorf("unexpected JSON type %v", value) 10358 } 10359 10360 var sv *types.IntentClosingSetting 10361 if *v == nil { 10362 sv = &types.IntentClosingSetting{} 10363 } else { 10364 sv = *v 10365 } 10366 10367 for key, value := range shape { 10368 switch key { 10369 case "closingResponse": 10370 if err := awsRestjson1_deserializeDocumentResponseSpecification(&sv.ClosingResponse, value); err != nil { 10371 return err 10372 } 10373 10374 default: 10375 _, _ = key, value 10376 10377 } 10378 } 10379 *v = sv 10380 return nil 10381} 10382 10383func awsRestjson1_deserializeDocumentIntentConfirmationSetting(v **types.IntentConfirmationSetting, value interface{}) error { 10384 if v == nil { 10385 return fmt.Errorf("unexpected nil of type %T", v) 10386 } 10387 if value == nil { 10388 return nil 10389 } 10390 10391 shape, ok := value.(map[string]interface{}) 10392 if !ok { 10393 return fmt.Errorf("unexpected JSON type %v", value) 10394 } 10395 10396 var sv *types.IntentConfirmationSetting 10397 if *v == nil { 10398 sv = &types.IntentConfirmationSetting{} 10399 } else { 10400 sv = *v 10401 } 10402 10403 for key, value := range shape { 10404 switch key { 10405 case "declinationResponse": 10406 if err := awsRestjson1_deserializeDocumentResponseSpecification(&sv.DeclinationResponse, value); err != nil { 10407 return err 10408 } 10409 10410 case "promptSpecification": 10411 if err := awsRestjson1_deserializeDocumentPromptSpecification(&sv.PromptSpecification, value); err != nil { 10412 return err 10413 } 10414 10415 default: 10416 _, _ = key, value 10417 10418 } 10419 } 10420 *v = sv 10421 return nil 10422} 10423 10424func awsRestjson1_deserializeDocumentIntentSummary(v **types.IntentSummary, value interface{}) error { 10425 if v == nil { 10426 return fmt.Errorf("unexpected nil of type %T", v) 10427 } 10428 if value == nil { 10429 return nil 10430 } 10431 10432 shape, ok := value.(map[string]interface{}) 10433 if !ok { 10434 return fmt.Errorf("unexpected JSON type %v", value) 10435 } 10436 10437 var sv *types.IntentSummary 10438 if *v == nil { 10439 sv = &types.IntentSummary{} 10440 } else { 10441 sv = *v 10442 } 10443 10444 for key, value := range shape { 10445 switch key { 10446 case "description": 10447 if value != nil { 10448 jtv, ok := value.(string) 10449 if !ok { 10450 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 10451 } 10452 sv.Description = ptr.String(jtv) 10453 } 10454 10455 case "inputContexts": 10456 if err := awsRestjson1_deserializeDocumentInputContextsList(&sv.InputContexts, value); err != nil { 10457 return err 10458 } 10459 10460 case "intentId": 10461 if value != nil { 10462 jtv, ok := value.(string) 10463 if !ok { 10464 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 10465 } 10466 sv.IntentId = ptr.String(jtv) 10467 } 10468 10469 case "intentName": 10470 if value != nil { 10471 jtv, ok := value.(string) 10472 if !ok { 10473 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 10474 } 10475 sv.IntentName = ptr.String(jtv) 10476 } 10477 10478 case "lastUpdatedDateTime": 10479 if value != nil { 10480 jtv, ok := value.(json.Number) 10481 if !ok { 10482 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 10483 } 10484 f64, err := jtv.Float64() 10485 if err != nil { 10486 return err 10487 } 10488 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 10489 } 10490 10491 case "outputContexts": 10492 if err := awsRestjson1_deserializeDocumentOutputContextsList(&sv.OutputContexts, value); err != nil { 10493 return err 10494 } 10495 10496 case "parentIntentSignature": 10497 if value != nil { 10498 jtv, ok := value.(string) 10499 if !ok { 10500 return fmt.Errorf("expected IntentSignature to be of type string, got %T instead", value) 10501 } 10502 sv.ParentIntentSignature = ptr.String(jtv) 10503 } 10504 10505 default: 10506 _, _ = key, value 10507 10508 } 10509 } 10510 *v = sv 10511 return nil 10512} 10513 10514func awsRestjson1_deserializeDocumentIntentSummaryList(v *[]types.IntentSummary, value interface{}) error { 10515 if v == nil { 10516 return fmt.Errorf("unexpected nil of type %T", v) 10517 } 10518 if value == nil { 10519 return nil 10520 } 10521 10522 shape, ok := value.([]interface{}) 10523 if !ok { 10524 return fmt.Errorf("unexpected JSON type %v", value) 10525 } 10526 10527 var cv []types.IntentSummary 10528 if *v == nil { 10529 cv = []types.IntentSummary{} 10530 } else { 10531 cv = *v 10532 } 10533 10534 for _, value := range shape { 10535 var col types.IntentSummary 10536 destAddr := &col 10537 if err := awsRestjson1_deserializeDocumentIntentSummary(&destAddr, value); err != nil { 10538 return err 10539 } 10540 col = *destAddr 10541 cv = append(cv, col) 10542 10543 } 10544 *v = cv 10545 return nil 10546} 10547 10548func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { 10549 if v == nil { 10550 return fmt.Errorf("unexpected nil of type %T", v) 10551 } 10552 if value == nil { 10553 return nil 10554 } 10555 10556 shape, ok := value.(map[string]interface{}) 10557 if !ok { 10558 return fmt.Errorf("unexpected JSON type %v", value) 10559 } 10560 10561 var sv *types.InternalServerException 10562 if *v == nil { 10563 sv = &types.InternalServerException{} 10564 } else { 10565 sv = *v 10566 } 10567 10568 for key, value := range shape { 10569 switch key { 10570 case "message": 10571 if value != nil { 10572 jtv, ok := value.(string) 10573 if !ok { 10574 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 10575 } 10576 sv.Message = ptr.String(jtv) 10577 } 10578 10579 default: 10580 _, _ = key, value 10581 10582 } 10583 } 10584 *v = sv 10585 return nil 10586} 10587 10588func awsRestjson1_deserializeDocumentKendraConfiguration(v **types.KendraConfiguration, value interface{}) error { 10589 if v == nil { 10590 return fmt.Errorf("unexpected nil of type %T", v) 10591 } 10592 if value == nil { 10593 return nil 10594 } 10595 10596 shape, ok := value.(map[string]interface{}) 10597 if !ok { 10598 return fmt.Errorf("unexpected JSON type %v", value) 10599 } 10600 10601 var sv *types.KendraConfiguration 10602 if *v == nil { 10603 sv = &types.KendraConfiguration{} 10604 } else { 10605 sv = *v 10606 } 10607 10608 for key, value := range shape { 10609 switch key { 10610 case "kendraIndex": 10611 if value != nil { 10612 jtv, ok := value.(string) 10613 if !ok { 10614 return fmt.Errorf("expected KendraIndexArn to be of type string, got %T instead", value) 10615 } 10616 sv.KendraIndex = ptr.String(jtv) 10617 } 10618 10619 case "queryFilterString": 10620 if value != nil { 10621 jtv, ok := value.(string) 10622 if !ok { 10623 return fmt.Errorf("expected QueryFilterString to be of type string, got %T instead", value) 10624 } 10625 sv.QueryFilterString = ptr.String(jtv) 10626 } 10627 10628 case "queryFilterStringEnabled": 10629 if value != nil { 10630 jtv, ok := value.(bool) 10631 if !ok { 10632 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 10633 } 10634 sv.QueryFilterStringEnabled = jtv 10635 } 10636 10637 default: 10638 _, _ = key, value 10639 10640 } 10641 } 10642 *v = sv 10643 return nil 10644} 10645 10646func awsRestjson1_deserializeDocumentLambdaCodeHook(v **types.LambdaCodeHook, value interface{}) error { 10647 if v == nil { 10648 return fmt.Errorf("unexpected nil of type %T", v) 10649 } 10650 if value == nil { 10651 return nil 10652 } 10653 10654 shape, ok := value.(map[string]interface{}) 10655 if !ok { 10656 return fmt.Errorf("unexpected JSON type %v", value) 10657 } 10658 10659 var sv *types.LambdaCodeHook 10660 if *v == nil { 10661 sv = &types.LambdaCodeHook{} 10662 } else { 10663 sv = *v 10664 } 10665 10666 for key, value := range shape { 10667 switch key { 10668 case "codeHookInterfaceVersion": 10669 if value != nil { 10670 jtv, ok := value.(string) 10671 if !ok { 10672 return fmt.Errorf("expected CodeHookInterfaceVersion to be of type string, got %T instead", value) 10673 } 10674 sv.CodeHookInterfaceVersion = ptr.String(jtv) 10675 } 10676 10677 case "lambdaARN": 10678 if value != nil { 10679 jtv, ok := value.(string) 10680 if !ok { 10681 return fmt.Errorf("expected LambdaARN to be of type string, got %T instead", value) 10682 } 10683 sv.LambdaARN = ptr.String(jtv) 10684 } 10685 10686 default: 10687 _, _ = key, value 10688 10689 } 10690 } 10691 *v = sv 10692 return nil 10693} 10694 10695func awsRestjson1_deserializeDocumentMessage(v **types.Message, value interface{}) error { 10696 if v == nil { 10697 return fmt.Errorf("unexpected nil of type %T", v) 10698 } 10699 if value == nil { 10700 return nil 10701 } 10702 10703 shape, ok := value.(map[string]interface{}) 10704 if !ok { 10705 return fmt.Errorf("unexpected JSON type %v", value) 10706 } 10707 10708 var sv *types.Message 10709 if *v == nil { 10710 sv = &types.Message{} 10711 } else { 10712 sv = *v 10713 } 10714 10715 for key, value := range shape { 10716 switch key { 10717 case "customPayload": 10718 if err := awsRestjson1_deserializeDocumentCustomPayload(&sv.CustomPayload, value); err != nil { 10719 return err 10720 } 10721 10722 case "imageResponseCard": 10723 if err := awsRestjson1_deserializeDocumentImageResponseCard(&sv.ImageResponseCard, value); err != nil { 10724 return err 10725 } 10726 10727 case "plainTextMessage": 10728 if err := awsRestjson1_deserializeDocumentPlainTextMessage(&sv.PlainTextMessage, value); err != nil { 10729 return err 10730 } 10731 10732 case "ssmlMessage": 10733 if err := awsRestjson1_deserializeDocumentSSMLMessage(&sv.SsmlMessage, value); err != nil { 10734 return err 10735 } 10736 10737 default: 10738 _, _ = key, value 10739 10740 } 10741 } 10742 *v = sv 10743 return nil 10744} 10745 10746func awsRestjson1_deserializeDocumentMessageGroup(v **types.MessageGroup, value interface{}) error { 10747 if v == nil { 10748 return fmt.Errorf("unexpected nil of type %T", v) 10749 } 10750 if value == nil { 10751 return nil 10752 } 10753 10754 shape, ok := value.(map[string]interface{}) 10755 if !ok { 10756 return fmt.Errorf("unexpected JSON type %v", value) 10757 } 10758 10759 var sv *types.MessageGroup 10760 if *v == nil { 10761 sv = &types.MessageGroup{} 10762 } else { 10763 sv = *v 10764 } 10765 10766 for key, value := range shape { 10767 switch key { 10768 case "message": 10769 if err := awsRestjson1_deserializeDocumentMessage(&sv.Message, value); err != nil { 10770 return err 10771 } 10772 10773 case "variations": 10774 if err := awsRestjson1_deserializeDocumentMessageVariationsList(&sv.Variations, value); err != nil { 10775 return err 10776 } 10777 10778 default: 10779 _, _ = key, value 10780 10781 } 10782 } 10783 *v = sv 10784 return nil 10785} 10786 10787func awsRestjson1_deserializeDocumentMessageGroupsList(v *[]types.MessageGroup, value interface{}) error { 10788 if v == nil { 10789 return fmt.Errorf("unexpected nil of type %T", v) 10790 } 10791 if value == nil { 10792 return nil 10793 } 10794 10795 shape, ok := value.([]interface{}) 10796 if !ok { 10797 return fmt.Errorf("unexpected JSON type %v", value) 10798 } 10799 10800 var cv []types.MessageGroup 10801 if *v == nil { 10802 cv = []types.MessageGroup{} 10803 } else { 10804 cv = *v 10805 } 10806 10807 for _, value := range shape { 10808 var col types.MessageGroup 10809 destAddr := &col 10810 if err := awsRestjson1_deserializeDocumentMessageGroup(&destAddr, value); err != nil { 10811 return err 10812 } 10813 col = *destAddr 10814 cv = append(cv, col) 10815 10816 } 10817 *v = cv 10818 return nil 10819} 10820 10821func awsRestjson1_deserializeDocumentMessageVariationsList(v *[]types.Message, value interface{}) error { 10822 if v == nil { 10823 return fmt.Errorf("unexpected nil of type %T", v) 10824 } 10825 if value == nil { 10826 return nil 10827 } 10828 10829 shape, ok := value.([]interface{}) 10830 if !ok { 10831 return fmt.Errorf("unexpected JSON type %v", value) 10832 } 10833 10834 var cv []types.Message 10835 if *v == nil { 10836 cv = []types.Message{} 10837 } else { 10838 cv = *v 10839 } 10840 10841 for _, value := range shape { 10842 var col types.Message 10843 destAddr := &col 10844 if err := awsRestjson1_deserializeDocumentMessage(&destAddr, value); err != nil { 10845 return err 10846 } 10847 col = *destAddr 10848 cv = append(cv, col) 10849 10850 } 10851 *v = cv 10852 return nil 10853} 10854 10855func awsRestjson1_deserializeDocumentObfuscationSetting(v **types.ObfuscationSetting, value interface{}) error { 10856 if v == nil { 10857 return fmt.Errorf("unexpected nil of type %T", v) 10858 } 10859 if value == nil { 10860 return nil 10861 } 10862 10863 shape, ok := value.(map[string]interface{}) 10864 if !ok { 10865 return fmt.Errorf("unexpected JSON type %v", value) 10866 } 10867 10868 var sv *types.ObfuscationSetting 10869 if *v == nil { 10870 sv = &types.ObfuscationSetting{} 10871 } else { 10872 sv = *v 10873 } 10874 10875 for key, value := range shape { 10876 switch key { 10877 case "obfuscationSettingType": 10878 if value != nil { 10879 jtv, ok := value.(string) 10880 if !ok { 10881 return fmt.Errorf("expected ObfuscationSettingType to be of type string, got %T instead", value) 10882 } 10883 sv.ObfuscationSettingType = types.ObfuscationSettingType(jtv) 10884 } 10885 10886 default: 10887 _, _ = key, value 10888 10889 } 10890 } 10891 *v = sv 10892 return nil 10893} 10894 10895func awsRestjson1_deserializeDocumentOutputContext(v **types.OutputContext, value interface{}) error { 10896 if v == nil { 10897 return fmt.Errorf("unexpected nil of type %T", v) 10898 } 10899 if value == nil { 10900 return nil 10901 } 10902 10903 shape, ok := value.(map[string]interface{}) 10904 if !ok { 10905 return fmt.Errorf("unexpected JSON type %v", value) 10906 } 10907 10908 var sv *types.OutputContext 10909 if *v == nil { 10910 sv = &types.OutputContext{} 10911 } else { 10912 sv = *v 10913 } 10914 10915 for key, value := range shape { 10916 switch key { 10917 case "name": 10918 if value != nil { 10919 jtv, ok := value.(string) 10920 if !ok { 10921 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 10922 } 10923 sv.Name = ptr.String(jtv) 10924 } 10925 10926 case "timeToLiveInSeconds": 10927 if value != nil { 10928 jtv, ok := value.(json.Number) 10929 if !ok { 10930 return fmt.Errorf("expected ContextTimeToLiveInSeconds to be json.Number, got %T instead", value) 10931 } 10932 i64, err := jtv.Int64() 10933 if err != nil { 10934 return err 10935 } 10936 sv.TimeToLiveInSeconds = ptr.Int32(int32(i64)) 10937 } 10938 10939 case "turnsToLive": 10940 if value != nil { 10941 jtv, ok := value.(json.Number) 10942 if !ok { 10943 return fmt.Errorf("expected ContextTurnsToLive to be json.Number, got %T instead", value) 10944 } 10945 i64, err := jtv.Int64() 10946 if err != nil { 10947 return err 10948 } 10949 sv.TurnsToLive = ptr.Int32(int32(i64)) 10950 } 10951 10952 default: 10953 _, _ = key, value 10954 10955 } 10956 } 10957 *v = sv 10958 return nil 10959} 10960 10961func awsRestjson1_deserializeDocumentOutputContextsList(v *[]types.OutputContext, value interface{}) error { 10962 if v == nil { 10963 return fmt.Errorf("unexpected nil of type %T", v) 10964 } 10965 if value == nil { 10966 return nil 10967 } 10968 10969 shape, ok := value.([]interface{}) 10970 if !ok { 10971 return fmt.Errorf("unexpected JSON type %v", value) 10972 } 10973 10974 var cv []types.OutputContext 10975 if *v == nil { 10976 cv = []types.OutputContext{} 10977 } else { 10978 cv = *v 10979 } 10980 10981 for _, value := range shape { 10982 var col types.OutputContext 10983 destAddr := &col 10984 if err := awsRestjson1_deserializeDocumentOutputContext(&destAddr, value); err != nil { 10985 return err 10986 } 10987 col = *destAddr 10988 cv = append(cv, col) 10989 10990 } 10991 *v = cv 10992 return nil 10993} 10994 10995func awsRestjson1_deserializeDocumentPlainTextMessage(v **types.PlainTextMessage, value interface{}) error { 10996 if v == nil { 10997 return fmt.Errorf("unexpected nil of type %T", v) 10998 } 10999 if value == nil { 11000 return nil 11001 } 11002 11003 shape, ok := value.(map[string]interface{}) 11004 if !ok { 11005 return fmt.Errorf("unexpected JSON type %v", value) 11006 } 11007 11008 var sv *types.PlainTextMessage 11009 if *v == nil { 11010 sv = &types.PlainTextMessage{} 11011 } else { 11012 sv = *v 11013 } 11014 11015 for key, value := range shape { 11016 switch key { 11017 case "value": 11018 if value != nil { 11019 jtv, ok := value.(string) 11020 if !ok { 11021 return fmt.Errorf("expected PlainTextMessageValue to be of type string, got %T instead", value) 11022 } 11023 sv.Value = ptr.String(jtv) 11024 } 11025 11026 default: 11027 _, _ = key, value 11028 11029 } 11030 } 11031 *v = sv 11032 return nil 11033} 11034 11035func awsRestjson1_deserializeDocumentPreconditionFailedException(v **types.PreconditionFailedException, value interface{}) error { 11036 if v == nil { 11037 return fmt.Errorf("unexpected nil of type %T", v) 11038 } 11039 if value == nil { 11040 return nil 11041 } 11042 11043 shape, ok := value.(map[string]interface{}) 11044 if !ok { 11045 return fmt.Errorf("unexpected JSON type %v", value) 11046 } 11047 11048 var sv *types.PreconditionFailedException 11049 if *v == nil { 11050 sv = &types.PreconditionFailedException{} 11051 } else { 11052 sv = *v 11053 } 11054 11055 for key, value := range shape { 11056 switch key { 11057 case "message": 11058 if value != nil { 11059 jtv, ok := value.(string) 11060 if !ok { 11061 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 11062 } 11063 sv.Message = ptr.String(jtv) 11064 } 11065 11066 default: 11067 _, _ = key, value 11068 11069 } 11070 } 11071 *v = sv 11072 return nil 11073} 11074 11075func awsRestjson1_deserializeDocumentPromptSpecification(v **types.PromptSpecification, value interface{}) error { 11076 if v == nil { 11077 return fmt.Errorf("unexpected nil of type %T", v) 11078 } 11079 if value == nil { 11080 return nil 11081 } 11082 11083 shape, ok := value.(map[string]interface{}) 11084 if !ok { 11085 return fmt.Errorf("unexpected JSON type %v", value) 11086 } 11087 11088 var sv *types.PromptSpecification 11089 if *v == nil { 11090 sv = &types.PromptSpecification{} 11091 } else { 11092 sv = *v 11093 } 11094 11095 for key, value := range shape { 11096 switch key { 11097 case "allowInterrupt": 11098 if value != nil { 11099 jtv, ok := value.(bool) 11100 if !ok { 11101 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 11102 } 11103 sv.AllowInterrupt = ptr.Bool(jtv) 11104 } 11105 11106 case "maxRetries": 11107 if value != nil { 11108 jtv, ok := value.(json.Number) 11109 if !ok { 11110 return fmt.Errorf("expected PromptMaxRetries to be json.Number, got %T instead", value) 11111 } 11112 i64, err := jtv.Int64() 11113 if err != nil { 11114 return err 11115 } 11116 sv.MaxRetries = ptr.Int32(int32(i64)) 11117 } 11118 11119 case "messageGroups": 11120 if err := awsRestjson1_deserializeDocumentMessageGroupsList(&sv.MessageGroups, value); err != nil { 11121 return err 11122 } 11123 11124 default: 11125 _, _ = key, value 11126 11127 } 11128 } 11129 *v = sv 11130 return nil 11131} 11132 11133func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 11134 if v == nil { 11135 return fmt.Errorf("unexpected nil of type %T", v) 11136 } 11137 if value == nil { 11138 return nil 11139 } 11140 11141 shape, ok := value.(map[string]interface{}) 11142 if !ok { 11143 return fmt.Errorf("unexpected JSON type %v", value) 11144 } 11145 11146 var sv *types.ResourceNotFoundException 11147 if *v == nil { 11148 sv = &types.ResourceNotFoundException{} 11149 } else { 11150 sv = *v 11151 } 11152 11153 for key, value := range shape { 11154 switch key { 11155 case "message": 11156 if value != nil { 11157 jtv, ok := value.(string) 11158 if !ok { 11159 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 11160 } 11161 sv.Message = ptr.String(jtv) 11162 } 11163 11164 default: 11165 _, _ = key, value 11166 11167 } 11168 } 11169 *v = sv 11170 return nil 11171} 11172 11173func awsRestjson1_deserializeDocumentResponseSpecification(v **types.ResponseSpecification, value interface{}) error { 11174 if v == nil { 11175 return fmt.Errorf("unexpected nil of type %T", v) 11176 } 11177 if value == nil { 11178 return nil 11179 } 11180 11181 shape, ok := value.(map[string]interface{}) 11182 if !ok { 11183 return fmt.Errorf("unexpected JSON type %v", value) 11184 } 11185 11186 var sv *types.ResponseSpecification 11187 if *v == nil { 11188 sv = &types.ResponseSpecification{} 11189 } else { 11190 sv = *v 11191 } 11192 11193 for key, value := range shape { 11194 switch key { 11195 case "allowInterrupt": 11196 if value != nil { 11197 jtv, ok := value.(bool) 11198 if !ok { 11199 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 11200 } 11201 sv.AllowInterrupt = ptr.Bool(jtv) 11202 } 11203 11204 case "messageGroups": 11205 if err := awsRestjson1_deserializeDocumentMessageGroupsList(&sv.MessageGroups, value); err != nil { 11206 return err 11207 } 11208 11209 default: 11210 _, _ = key, value 11211 11212 } 11213 } 11214 *v = sv 11215 return nil 11216} 11217 11218func awsRestjson1_deserializeDocumentS3BucketLogDestination(v **types.S3BucketLogDestination, value interface{}) error { 11219 if v == nil { 11220 return fmt.Errorf("unexpected nil of type %T", v) 11221 } 11222 if value == nil { 11223 return nil 11224 } 11225 11226 shape, ok := value.(map[string]interface{}) 11227 if !ok { 11228 return fmt.Errorf("unexpected JSON type %v", value) 11229 } 11230 11231 var sv *types.S3BucketLogDestination 11232 if *v == nil { 11233 sv = &types.S3BucketLogDestination{} 11234 } else { 11235 sv = *v 11236 } 11237 11238 for key, value := range shape { 11239 switch key { 11240 case "kmsKeyArn": 11241 if value != nil { 11242 jtv, ok := value.(string) 11243 if !ok { 11244 return fmt.Errorf("expected KmsKeyArn to be of type string, got %T instead", value) 11245 } 11246 sv.KmsKeyArn = ptr.String(jtv) 11247 } 11248 11249 case "logPrefix": 11250 if value != nil { 11251 jtv, ok := value.(string) 11252 if !ok { 11253 return fmt.Errorf("expected LogPrefix to be of type string, got %T instead", value) 11254 } 11255 sv.LogPrefix = ptr.String(jtv) 11256 } 11257 11258 case "s3BucketArn": 11259 if value != nil { 11260 jtv, ok := value.(string) 11261 if !ok { 11262 return fmt.Errorf("expected S3BucketArn to be of type string, got %T instead", value) 11263 } 11264 sv.S3BucketArn = ptr.String(jtv) 11265 } 11266 11267 default: 11268 _, _ = key, value 11269 11270 } 11271 } 11272 *v = sv 11273 return nil 11274} 11275 11276func awsRestjson1_deserializeDocumentSampleUtterance(v **types.SampleUtterance, value interface{}) error { 11277 if v == nil { 11278 return fmt.Errorf("unexpected nil of type %T", v) 11279 } 11280 if value == nil { 11281 return nil 11282 } 11283 11284 shape, ok := value.(map[string]interface{}) 11285 if !ok { 11286 return fmt.Errorf("unexpected JSON type %v", value) 11287 } 11288 11289 var sv *types.SampleUtterance 11290 if *v == nil { 11291 sv = &types.SampleUtterance{} 11292 } else { 11293 sv = *v 11294 } 11295 11296 for key, value := range shape { 11297 switch key { 11298 case "utterance": 11299 if value != nil { 11300 jtv, ok := value.(string) 11301 if !ok { 11302 return fmt.Errorf("expected Utterance to be of type string, got %T instead", value) 11303 } 11304 sv.Utterance = ptr.String(jtv) 11305 } 11306 11307 default: 11308 _, _ = key, value 11309 11310 } 11311 } 11312 *v = sv 11313 return nil 11314} 11315 11316func awsRestjson1_deserializeDocumentSampleUtterancesList(v *[]types.SampleUtterance, value interface{}) error { 11317 if v == nil { 11318 return fmt.Errorf("unexpected nil of type %T", v) 11319 } 11320 if value == nil { 11321 return nil 11322 } 11323 11324 shape, ok := value.([]interface{}) 11325 if !ok { 11326 return fmt.Errorf("unexpected JSON type %v", value) 11327 } 11328 11329 var cv []types.SampleUtterance 11330 if *v == nil { 11331 cv = []types.SampleUtterance{} 11332 } else { 11333 cv = *v 11334 } 11335 11336 for _, value := range shape { 11337 var col types.SampleUtterance 11338 destAddr := &col 11339 if err := awsRestjson1_deserializeDocumentSampleUtterance(&destAddr, value); err != nil { 11340 return err 11341 } 11342 col = *destAddr 11343 cv = append(cv, col) 11344 11345 } 11346 *v = cv 11347 return nil 11348} 11349 11350func awsRestjson1_deserializeDocumentSampleValue(v **types.SampleValue, value interface{}) error { 11351 if v == nil { 11352 return fmt.Errorf("unexpected nil of type %T", v) 11353 } 11354 if value == nil { 11355 return nil 11356 } 11357 11358 shape, ok := value.(map[string]interface{}) 11359 if !ok { 11360 return fmt.Errorf("unexpected JSON type %v", value) 11361 } 11362 11363 var sv *types.SampleValue 11364 if *v == nil { 11365 sv = &types.SampleValue{} 11366 } else { 11367 sv = *v 11368 } 11369 11370 for key, value := range shape { 11371 switch key { 11372 case "value": 11373 if value != nil { 11374 jtv, ok := value.(string) 11375 if !ok { 11376 return fmt.Errorf("expected Value to be of type string, got %T instead", value) 11377 } 11378 sv.Value = ptr.String(jtv) 11379 } 11380 11381 default: 11382 _, _ = key, value 11383 11384 } 11385 } 11386 *v = sv 11387 return nil 11388} 11389 11390func awsRestjson1_deserializeDocumentSentimentAnalysisSettings(v **types.SentimentAnalysisSettings, value interface{}) error { 11391 if v == nil { 11392 return fmt.Errorf("unexpected nil of type %T", v) 11393 } 11394 if value == nil { 11395 return nil 11396 } 11397 11398 shape, ok := value.(map[string]interface{}) 11399 if !ok { 11400 return fmt.Errorf("unexpected JSON type %v", value) 11401 } 11402 11403 var sv *types.SentimentAnalysisSettings 11404 if *v == nil { 11405 sv = &types.SentimentAnalysisSettings{} 11406 } else { 11407 sv = *v 11408 } 11409 11410 for key, value := range shape { 11411 switch key { 11412 case "detectSentiment": 11413 if value != nil { 11414 jtv, ok := value.(bool) 11415 if !ok { 11416 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 11417 } 11418 sv.DetectSentiment = jtv 11419 } 11420 11421 default: 11422 _, _ = key, value 11423 11424 } 11425 } 11426 *v = sv 11427 return nil 11428} 11429 11430func awsRestjson1_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, 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 *types.ServiceQuotaExceededException 11444 if *v == nil { 11445 sv = &types.ServiceQuotaExceededException{} 11446 } else { 11447 sv = *v 11448 } 11449 11450 for key, value := range shape { 11451 switch key { 11452 case "message": 11453 if value != nil { 11454 jtv, ok := value.(string) 11455 if !ok { 11456 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 11457 } 11458 sv.Message = ptr.String(jtv) 11459 } 11460 11461 default: 11462 _, _ = key, value 11463 11464 } 11465 } 11466 *v = sv 11467 return nil 11468} 11469 11470func awsRestjson1_deserializeDocumentSlotDefaultValue(v **types.SlotDefaultValue, value interface{}) error { 11471 if v == nil { 11472 return fmt.Errorf("unexpected nil of type %T", v) 11473 } 11474 if value == nil { 11475 return nil 11476 } 11477 11478 shape, ok := value.(map[string]interface{}) 11479 if !ok { 11480 return fmt.Errorf("unexpected JSON type %v", value) 11481 } 11482 11483 var sv *types.SlotDefaultValue 11484 if *v == nil { 11485 sv = &types.SlotDefaultValue{} 11486 } else { 11487 sv = *v 11488 } 11489 11490 for key, value := range shape { 11491 switch key { 11492 case "defaultValue": 11493 if value != nil { 11494 jtv, ok := value.(string) 11495 if !ok { 11496 return fmt.Errorf("expected SlotDefaultValueString to be of type string, got %T instead", value) 11497 } 11498 sv.DefaultValue = ptr.String(jtv) 11499 } 11500 11501 default: 11502 _, _ = key, value 11503 11504 } 11505 } 11506 *v = sv 11507 return nil 11508} 11509 11510func awsRestjson1_deserializeDocumentSlotDefaultValueList(v *[]types.SlotDefaultValue, value interface{}) error { 11511 if v == nil { 11512 return fmt.Errorf("unexpected nil of type %T", v) 11513 } 11514 if value == nil { 11515 return nil 11516 } 11517 11518 shape, ok := value.([]interface{}) 11519 if !ok { 11520 return fmt.Errorf("unexpected JSON type %v", value) 11521 } 11522 11523 var cv []types.SlotDefaultValue 11524 if *v == nil { 11525 cv = []types.SlotDefaultValue{} 11526 } else { 11527 cv = *v 11528 } 11529 11530 for _, value := range shape { 11531 var col types.SlotDefaultValue 11532 destAddr := &col 11533 if err := awsRestjson1_deserializeDocumentSlotDefaultValue(&destAddr, value); err != nil { 11534 return err 11535 } 11536 col = *destAddr 11537 cv = append(cv, col) 11538 11539 } 11540 *v = cv 11541 return nil 11542} 11543 11544func awsRestjson1_deserializeDocumentSlotDefaultValueSpecification(v **types.SlotDefaultValueSpecification, value interface{}) error { 11545 if v == nil { 11546 return fmt.Errorf("unexpected nil of type %T", v) 11547 } 11548 if value == nil { 11549 return nil 11550 } 11551 11552 shape, ok := value.(map[string]interface{}) 11553 if !ok { 11554 return fmt.Errorf("unexpected JSON type %v", value) 11555 } 11556 11557 var sv *types.SlotDefaultValueSpecification 11558 if *v == nil { 11559 sv = &types.SlotDefaultValueSpecification{} 11560 } else { 11561 sv = *v 11562 } 11563 11564 for key, value := range shape { 11565 switch key { 11566 case "defaultValueList": 11567 if err := awsRestjson1_deserializeDocumentSlotDefaultValueList(&sv.DefaultValueList, value); err != nil { 11568 return err 11569 } 11570 11571 default: 11572 _, _ = key, value 11573 11574 } 11575 } 11576 *v = sv 11577 return nil 11578} 11579 11580func awsRestjson1_deserializeDocumentSlotPrioritiesList(v *[]types.SlotPriority, value interface{}) error { 11581 if v == nil { 11582 return fmt.Errorf("unexpected nil of type %T", v) 11583 } 11584 if value == nil { 11585 return nil 11586 } 11587 11588 shape, ok := value.([]interface{}) 11589 if !ok { 11590 return fmt.Errorf("unexpected JSON type %v", value) 11591 } 11592 11593 var cv []types.SlotPriority 11594 if *v == nil { 11595 cv = []types.SlotPriority{} 11596 } else { 11597 cv = *v 11598 } 11599 11600 for _, value := range shape { 11601 var col types.SlotPriority 11602 destAddr := &col 11603 if err := awsRestjson1_deserializeDocumentSlotPriority(&destAddr, value); err != nil { 11604 return err 11605 } 11606 col = *destAddr 11607 cv = append(cv, col) 11608 11609 } 11610 *v = cv 11611 return nil 11612} 11613 11614func awsRestjson1_deserializeDocumentSlotPriority(v **types.SlotPriority, value interface{}) error { 11615 if v == nil { 11616 return fmt.Errorf("unexpected nil of type %T", v) 11617 } 11618 if value == nil { 11619 return nil 11620 } 11621 11622 shape, ok := value.(map[string]interface{}) 11623 if !ok { 11624 return fmt.Errorf("unexpected JSON type %v", value) 11625 } 11626 11627 var sv *types.SlotPriority 11628 if *v == nil { 11629 sv = &types.SlotPriority{} 11630 } else { 11631 sv = *v 11632 } 11633 11634 for key, value := range shape { 11635 switch key { 11636 case "priority": 11637 if value != nil { 11638 jtv, ok := value.(json.Number) 11639 if !ok { 11640 return fmt.Errorf("expected PriorityValue to be json.Number, got %T instead", value) 11641 } 11642 i64, err := jtv.Int64() 11643 if err != nil { 11644 return err 11645 } 11646 sv.Priority = ptr.Int32(int32(i64)) 11647 } 11648 11649 case "slotId": 11650 if value != nil { 11651 jtv, ok := value.(string) 11652 if !ok { 11653 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11654 } 11655 sv.SlotId = ptr.String(jtv) 11656 } 11657 11658 default: 11659 _, _ = key, value 11660 11661 } 11662 } 11663 *v = sv 11664 return nil 11665} 11666 11667func awsRestjson1_deserializeDocumentSlotSummary(v **types.SlotSummary, value interface{}) error { 11668 if v == nil { 11669 return fmt.Errorf("unexpected nil of type %T", v) 11670 } 11671 if value == nil { 11672 return nil 11673 } 11674 11675 shape, ok := value.(map[string]interface{}) 11676 if !ok { 11677 return fmt.Errorf("unexpected JSON type %v", value) 11678 } 11679 11680 var sv *types.SlotSummary 11681 if *v == nil { 11682 sv = &types.SlotSummary{} 11683 } else { 11684 sv = *v 11685 } 11686 11687 for key, value := range shape { 11688 switch key { 11689 case "description": 11690 if value != nil { 11691 jtv, ok := value.(string) 11692 if !ok { 11693 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 11694 } 11695 sv.Description = ptr.String(jtv) 11696 } 11697 11698 case "lastUpdatedDateTime": 11699 if value != nil { 11700 jtv, ok := value.(json.Number) 11701 if !ok { 11702 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 11703 } 11704 f64, err := jtv.Float64() 11705 if err != nil { 11706 return err 11707 } 11708 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11709 } 11710 11711 case "slotConstraint": 11712 if value != nil { 11713 jtv, ok := value.(string) 11714 if !ok { 11715 return fmt.Errorf("expected SlotConstraint to be of type string, got %T instead", value) 11716 } 11717 sv.SlotConstraint = types.SlotConstraint(jtv) 11718 } 11719 11720 case "slotId": 11721 if value != nil { 11722 jtv, ok := value.(string) 11723 if !ok { 11724 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11725 } 11726 sv.SlotId = ptr.String(jtv) 11727 } 11728 11729 case "slotName": 11730 if value != nil { 11731 jtv, ok := value.(string) 11732 if !ok { 11733 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 11734 } 11735 sv.SlotName = ptr.String(jtv) 11736 } 11737 11738 case "slotTypeId": 11739 if value != nil { 11740 jtv, ok := value.(string) 11741 if !ok { 11742 return fmt.Errorf("expected BuiltInOrCustomSlotTypeId to be of type string, got %T instead", value) 11743 } 11744 sv.SlotTypeId = ptr.String(jtv) 11745 } 11746 11747 case "valueElicitationPromptSpecification": 11748 if err := awsRestjson1_deserializeDocumentPromptSpecification(&sv.ValueElicitationPromptSpecification, value); err != nil { 11749 return err 11750 } 11751 11752 default: 11753 _, _ = key, value 11754 11755 } 11756 } 11757 *v = sv 11758 return nil 11759} 11760 11761func awsRestjson1_deserializeDocumentSlotSummaryList(v *[]types.SlotSummary, value interface{}) error { 11762 if v == nil { 11763 return fmt.Errorf("unexpected nil of type %T", v) 11764 } 11765 if value == nil { 11766 return nil 11767 } 11768 11769 shape, ok := value.([]interface{}) 11770 if !ok { 11771 return fmt.Errorf("unexpected JSON type %v", value) 11772 } 11773 11774 var cv []types.SlotSummary 11775 if *v == nil { 11776 cv = []types.SlotSummary{} 11777 } else { 11778 cv = *v 11779 } 11780 11781 for _, value := range shape { 11782 var col types.SlotSummary 11783 destAddr := &col 11784 if err := awsRestjson1_deserializeDocumentSlotSummary(&destAddr, value); err != nil { 11785 return err 11786 } 11787 col = *destAddr 11788 cv = append(cv, col) 11789 11790 } 11791 *v = cv 11792 return nil 11793} 11794 11795func awsRestjson1_deserializeDocumentSlotTypeSummary(v **types.SlotTypeSummary, value interface{}) error { 11796 if v == nil { 11797 return fmt.Errorf("unexpected nil of type %T", v) 11798 } 11799 if value == nil { 11800 return nil 11801 } 11802 11803 shape, ok := value.(map[string]interface{}) 11804 if !ok { 11805 return fmt.Errorf("unexpected JSON type %v", value) 11806 } 11807 11808 var sv *types.SlotTypeSummary 11809 if *v == nil { 11810 sv = &types.SlotTypeSummary{} 11811 } else { 11812 sv = *v 11813 } 11814 11815 for key, value := range shape { 11816 switch key { 11817 case "description": 11818 if value != nil { 11819 jtv, ok := value.(string) 11820 if !ok { 11821 return fmt.Errorf("expected Description to be of type string, got %T instead", value) 11822 } 11823 sv.Description = ptr.String(jtv) 11824 } 11825 11826 case "lastUpdatedDateTime": 11827 if value != nil { 11828 jtv, ok := value.(json.Number) 11829 if !ok { 11830 return fmt.Errorf("expected Timestamp to be json.Number, got %T instead", value) 11831 } 11832 f64, err := jtv.Float64() 11833 if err != nil { 11834 return err 11835 } 11836 sv.LastUpdatedDateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 11837 } 11838 11839 case "parentSlotTypeSignature": 11840 if value != nil { 11841 jtv, ok := value.(string) 11842 if !ok { 11843 return fmt.Errorf("expected SlotTypeSignature to be of type string, got %T instead", value) 11844 } 11845 sv.ParentSlotTypeSignature = ptr.String(jtv) 11846 } 11847 11848 case "slotTypeId": 11849 if value != nil { 11850 jtv, ok := value.(string) 11851 if !ok { 11852 return fmt.Errorf("expected Id to be of type string, got %T instead", value) 11853 } 11854 sv.SlotTypeId = ptr.String(jtv) 11855 } 11856 11857 case "slotTypeName": 11858 if value != nil { 11859 jtv, ok := value.(string) 11860 if !ok { 11861 return fmt.Errorf("expected Name to be of type string, got %T instead", value) 11862 } 11863 sv.SlotTypeName = ptr.String(jtv) 11864 } 11865 11866 default: 11867 _, _ = key, value 11868 11869 } 11870 } 11871 *v = sv 11872 return nil 11873} 11874 11875func awsRestjson1_deserializeDocumentSlotTypeSummaryList(v *[]types.SlotTypeSummary, value interface{}) error { 11876 if v == nil { 11877 return fmt.Errorf("unexpected nil of type %T", v) 11878 } 11879 if value == nil { 11880 return nil 11881 } 11882 11883 shape, ok := value.([]interface{}) 11884 if !ok { 11885 return fmt.Errorf("unexpected JSON type %v", value) 11886 } 11887 11888 var cv []types.SlotTypeSummary 11889 if *v == nil { 11890 cv = []types.SlotTypeSummary{} 11891 } else { 11892 cv = *v 11893 } 11894 11895 for _, value := range shape { 11896 var col types.SlotTypeSummary 11897 destAddr := &col 11898 if err := awsRestjson1_deserializeDocumentSlotTypeSummary(&destAddr, value); err != nil { 11899 return err 11900 } 11901 col = *destAddr 11902 cv = append(cv, col) 11903 11904 } 11905 *v = cv 11906 return nil 11907} 11908 11909func awsRestjson1_deserializeDocumentSlotTypeValue(v **types.SlotTypeValue, value interface{}) error { 11910 if v == nil { 11911 return fmt.Errorf("unexpected nil of type %T", v) 11912 } 11913 if value == nil { 11914 return nil 11915 } 11916 11917 shape, ok := value.(map[string]interface{}) 11918 if !ok { 11919 return fmt.Errorf("unexpected JSON type %v", value) 11920 } 11921 11922 var sv *types.SlotTypeValue 11923 if *v == nil { 11924 sv = &types.SlotTypeValue{} 11925 } else { 11926 sv = *v 11927 } 11928 11929 for key, value := range shape { 11930 switch key { 11931 case "sampleValue": 11932 if err := awsRestjson1_deserializeDocumentSampleValue(&sv.SampleValue, value); err != nil { 11933 return err 11934 } 11935 11936 case "synonyms": 11937 if err := awsRestjson1_deserializeDocumentSynonymList(&sv.Synonyms, value); err != nil { 11938 return err 11939 } 11940 11941 default: 11942 _, _ = key, value 11943 11944 } 11945 } 11946 *v = sv 11947 return nil 11948} 11949 11950func awsRestjson1_deserializeDocumentSlotTypeValues(v *[]types.SlotTypeValue, value interface{}) error { 11951 if v == nil { 11952 return fmt.Errorf("unexpected nil of type %T", v) 11953 } 11954 if value == nil { 11955 return nil 11956 } 11957 11958 shape, ok := value.([]interface{}) 11959 if !ok { 11960 return fmt.Errorf("unexpected JSON type %v", value) 11961 } 11962 11963 var cv []types.SlotTypeValue 11964 if *v == nil { 11965 cv = []types.SlotTypeValue{} 11966 } else { 11967 cv = *v 11968 } 11969 11970 for _, value := range shape { 11971 var col types.SlotTypeValue 11972 destAddr := &col 11973 if err := awsRestjson1_deserializeDocumentSlotTypeValue(&destAddr, value); err != nil { 11974 return err 11975 } 11976 col = *destAddr 11977 cv = append(cv, col) 11978 11979 } 11980 *v = cv 11981 return nil 11982} 11983 11984func awsRestjson1_deserializeDocumentSlotValueElicitationSetting(v **types.SlotValueElicitationSetting, value interface{}) error { 11985 if v == nil { 11986 return fmt.Errorf("unexpected nil of type %T", v) 11987 } 11988 if value == nil { 11989 return nil 11990 } 11991 11992 shape, ok := value.(map[string]interface{}) 11993 if !ok { 11994 return fmt.Errorf("unexpected JSON type %v", value) 11995 } 11996 11997 var sv *types.SlotValueElicitationSetting 11998 if *v == nil { 11999 sv = &types.SlotValueElicitationSetting{} 12000 } else { 12001 sv = *v 12002 } 12003 12004 for key, value := range shape { 12005 switch key { 12006 case "defaultValueSpecification": 12007 if err := awsRestjson1_deserializeDocumentSlotDefaultValueSpecification(&sv.DefaultValueSpecification, value); err != nil { 12008 return err 12009 } 12010 12011 case "promptSpecification": 12012 if err := awsRestjson1_deserializeDocumentPromptSpecification(&sv.PromptSpecification, value); err != nil { 12013 return err 12014 } 12015 12016 case "sampleUtterances": 12017 if err := awsRestjson1_deserializeDocumentSampleUtterancesList(&sv.SampleUtterances, value); err != nil { 12018 return err 12019 } 12020 12021 case "slotConstraint": 12022 if value != nil { 12023 jtv, ok := value.(string) 12024 if !ok { 12025 return fmt.Errorf("expected SlotConstraint to be of type string, got %T instead", value) 12026 } 12027 sv.SlotConstraint = types.SlotConstraint(jtv) 12028 } 12029 12030 case "waitAndContinueSpecification": 12031 if err := awsRestjson1_deserializeDocumentWaitAndContinueSpecification(&sv.WaitAndContinueSpecification, value); err != nil { 12032 return err 12033 } 12034 12035 default: 12036 _, _ = key, value 12037 12038 } 12039 } 12040 *v = sv 12041 return nil 12042} 12043 12044func awsRestjson1_deserializeDocumentSlotValueRegexFilter(v **types.SlotValueRegexFilter, value interface{}) error { 12045 if v == nil { 12046 return fmt.Errorf("unexpected nil of type %T", v) 12047 } 12048 if value == nil { 12049 return nil 12050 } 12051 12052 shape, ok := value.(map[string]interface{}) 12053 if !ok { 12054 return fmt.Errorf("unexpected JSON type %v", value) 12055 } 12056 12057 var sv *types.SlotValueRegexFilter 12058 if *v == nil { 12059 sv = &types.SlotValueRegexFilter{} 12060 } else { 12061 sv = *v 12062 } 12063 12064 for key, value := range shape { 12065 switch key { 12066 case "pattern": 12067 if value != nil { 12068 jtv, ok := value.(string) 12069 if !ok { 12070 return fmt.Errorf("expected RegexPattern to be of type string, got %T instead", value) 12071 } 12072 sv.Pattern = ptr.String(jtv) 12073 } 12074 12075 default: 12076 _, _ = key, value 12077 12078 } 12079 } 12080 *v = sv 12081 return nil 12082} 12083 12084func awsRestjson1_deserializeDocumentSlotValueSelectionSetting(v **types.SlotValueSelectionSetting, value interface{}) error { 12085 if v == nil { 12086 return fmt.Errorf("unexpected nil of type %T", v) 12087 } 12088 if value == nil { 12089 return nil 12090 } 12091 12092 shape, ok := value.(map[string]interface{}) 12093 if !ok { 12094 return fmt.Errorf("unexpected JSON type %v", value) 12095 } 12096 12097 var sv *types.SlotValueSelectionSetting 12098 if *v == nil { 12099 sv = &types.SlotValueSelectionSetting{} 12100 } else { 12101 sv = *v 12102 } 12103 12104 for key, value := range shape { 12105 switch key { 12106 case "regexFilter": 12107 if err := awsRestjson1_deserializeDocumentSlotValueRegexFilter(&sv.RegexFilter, value); err != nil { 12108 return err 12109 } 12110 12111 case "resolutionStrategy": 12112 if value != nil { 12113 jtv, ok := value.(string) 12114 if !ok { 12115 return fmt.Errorf("expected SlotValueResolutionStrategy to be of type string, got %T instead", value) 12116 } 12117 sv.ResolutionStrategy = types.SlotValueResolutionStrategy(jtv) 12118 } 12119 12120 default: 12121 _, _ = key, value 12122 12123 } 12124 } 12125 *v = sv 12126 return nil 12127} 12128 12129func awsRestjson1_deserializeDocumentSSMLMessage(v **types.SSMLMessage, value interface{}) error { 12130 if v == nil { 12131 return fmt.Errorf("unexpected nil of type %T", v) 12132 } 12133 if value == nil { 12134 return nil 12135 } 12136 12137 shape, ok := value.(map[string]interface{}) 12138 if !ok { 12139 return fmt.Errorf("unexpected JSON type %v", value) 12140 } 12141 12142 var sv *types.SSMLMessage 12143 if *v == nil { 12144 sv = &types.SSMLMessage{} 12145 } else { 12146 sv = *v 12147 } 12148 12149 for key, value := range shape { 12150 switch key { 12151 case "value": 12152 if value != nil { 12153 jtv, ok := value.(string) 12154 if !ok { 12155 return fmt.Errorf("expected SSMLMessageValue to be of type string, got %T instead", value) 12156 } 12157 sv.Value = ptr.String(jtv) 12158 } 12159 12160 default: 12161 _, _ = key, value 12162 12163 } 12164 } 12165 *v = sv 12166 return nil 12167} 12168 12169func awsRestjson1_deserializeDocumentStillWaitingResponseSpecification(v **types.StillWaitingResponseSpecification, value interface{}) error { 12170 if v == nil { 12171 return fmt.Errorf("unexpected nil of type %T", v) 12172 } 12173 if value == nil { 12174 return nil 12175 } 12176 12177 shape, ok := value.(map[string]interface{}) 12178 if !ok { 12179 return fmt.Errorf("unexpected JSON type %v", value) 12180 } 12181 12182 var sv *types.StillWaitingResponseSpecification 12183 if *v == nil { 12184 sv = &types.StillWaitingResponseSpecification{} 12185 } else { 12186 sv = *v 12187 } 12188 12189 for key, value := range shape { 12190 switch key { 12191 case "allowInterrupt": 12192 if value != nil { 12193 jtv, ok := value.(bool) 12194 if !ok { 12195 return fmt.Errorf("expected BoxedBoolean to be of type *bool, got %T instead", value) 12196 } 12197 sv.AllowInterrupt = ptr.Bool(jtv) 12198 } 12199 12200 case "frequencyInSeconds": 12201 if value != nil { 12202 jtv, ok := value.(json.Number) 12203 if !ok { 12204 return fmt.Errorf("expected StillWaitingResponseFrequency to be json.Number, got %T instead", value) 12205 } 12206 i64, err := jtv.Int64() 12207 if err != nil { 12208 return err 12209 } 12210 sv.FrequencyInSeconds = ptr.Int32(int32(i64)) 12211 } 12212 12213 case "messageGroups": 12214 if err := awsRestjson1_deserializeDocumentMessageGroupsList(&sv.MessageGroups, value); err != nil { 12215 return err 12216 } 12217 12218 case "timeoutInSeconds": 12219 if value != nil { 12220 jtv, ok := value.(json.Number) 12221 if !ok { 12222 return fmt.Errorf("expected StillWaitingResponseTimeout to be json.Number, got %T instead", value) 12223 } 12224 i64, err := jtv.Int64() 12225 if err != nil { 12226 return err 12227 } 12228 sv.TimeoutInSeconds = ptr.Int32(int32(i64)) 12229 } 12230 12231 default: 12232 _, _ = key, value 12233 12234 } 12235 } 12236 *v = sv 12237 return nil 12238} 12239 12240func awsRestjson1_deserializeDocumentSynonymList(v *[]types.SampleValue, value interface{}) error { 12241 if v == nil { 12242 return fmt.Errorf("unexpected nil of type %T", v) 12243 } 12244 if value == nil { 12245 return nil 12246 } 12247 12248 shape, ok := value.([]interface{}) 12249 if !ok { 12250 return fmt.Errorf("unexpected JSON type %v", value) 12251 } 12252 12253 var cv []types.SampleValue 12254 if *v == nil { 12255 cv = []types.SampleValue{} 12256 } else { 12257 cv = *v 12258 } 12259 12260 for _, value := range shape { 12261 var col types.SampleValue 12262 destAddr := &col 12263 if err := awsRestjson1_deserializeDocumentSampleValue(&destAddr, value); err != nil { 12264 return err 12265 } 12266 col = *destAddr 12267 cv = append(cv, col) 12268 12269 } 12270 *v = cv 12271 return nil 12272} 12273 12274func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { 12275 if v == nil { 12276 return fmt.Errorf("unexpected nil of type %T", v) 12277 } 12278 if value == nil { 12279 return nil 12280 } 12281 12282 shape, ok := value.(map[string]interface{}) 12283 if !ok { 12284 return fmt.Errorf("unexpected JSON type %v", value) 12285 } 12286 12287 var mv map[string]string 12288 if *v == nil { 12289 mv = map[string]string{} 12290 } else { 12291 mv = *v 12292 } 12293 12294 for key, value := range shape { 12295 var parsedVal string 12296 if value != nil { 12297 jtv, ok := value.(string) 12298 if !ok { 12299 return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) 12300 } 12301 parsedVal = jtv 12302 } 12303 mv[key] = parsedVal 12304 12305 } 12306 *v = mv 12307 return nil 12308} 12309 12310func awsRestjson1_deserializeDocumentTextLogDestination(v **types.TextLogDestination, value interface{}) error { 12311 if v == nil { 12312 return fmt.Errorf("unexpected nil of type %T", v) 12313 } 12314 if value == nil { 12315 return nil 12316 } 12317 12318 shape, ok := value.(map[string]interface{}) 12319 if !ok { 12320 return fmt.Errorf("unexpected JSON type %v", value) 12321 } 12322 12323 var sv *types.TextLogDestination 12324 if *v == nil { 12325 sv = &types.TextLogDestination{} 12326 } else { 12327 sv = *v 12328 } 12329 12330 for key, value := range shape { 12331 switch key { 12332 case "cloudWatch": 12333 if err := awsRestjson1_deserializeDocumentCloudWatchLogGroupLogDestination(&sv.CloudWatch, value); err != nil { 12334 return err 12335 } 12336 12337 default: 12338 _, _ = key, value 12339 12340 } 12341 } 12342 *v = sv 12343 return nil 12344} 12345 12346func awsRestjson1_deserializeDocumentTextLogSetting(v **types.TextLogSetting, value interface{}) error { 12347 if v == nil { 12348 return fmt.Errorf("unexpected nil of type %T", v) 12349 } 12350 if value == nil { 12351 return nil 12352 } 12353 12354 shape, ok := value.(map[string]interface{}) 12355 if !ok { 12356 return fmt.Errorf("unexpected JSON type %v", value) 12357 } 12358 12359 var sv *types.TextLogSetting 12360 if *v == nil { 12361 sv = &types.TextLogSetting{} 12362 } else { 12363 sv = *v 12364 } 12365 12366 for key, value := range shape { 12367 switch key { 12368 case "destination": 12369 if err := awsRestjson1_deserializeDocumentTextLogDestination(&sv.Destination, value); err != nil { 12370 return err 12371 } 12372 12373 case "enabled": 12374 if value != nil { 12375 jtv, ok := value.(bool) 12376 if !ok { 12377 return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) 12378 } 12379 sv.Enabled = jtv 12380 } 12381 12382 default: 12383 _, _ = key, value 12384 12385 } 12386 } 12387 *v = sv 12388 return nil 12389} 12390 12391func awsRestjson1_deserializeDocumentTextLogSettingsList(v *[]types.TextLogSetting, value interface{}) error { 12392 if v == nil { 12393 return fmt.Errorf("unexpected nil of type %T", v) 12394 } 12395 if value == nil { 12396 return nil 12397 } 12398 12399 shape, ok := value.([]interface{}) 12400 if !ok { 12401 return fmt.Errorf("unexpected JSON type %v", value) 12402 } 12403 12404 var cv []types.TextLogSetting 12405 if *v == nil { 12406 cv = []types.TextLogSetting{} 12407 } else { 12408 cv = *v 12409 } 12410 12411 for _, value := range shape { 12412 var col types.TextLogSetting 12413 destAddr := &col 12414 if err := awsRestjson1_deserializeDocumentTextLogSetting(&destAddr, value); err != nil { 12415 return err 12416 } 12417 col = *destAddr 12418 cv = append(cv, col) 12419 12420 } 12421 *v = cv 12422 return nil 12423} 12424 12425func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { 12426 if v == nil { 12427 return fmt.Errorf("unexpected nil of type %T", v) 12428 } 12429 if value == nil { 12430 return nil 12431 } 12432 12433 shape, ok := value.(map[string]interface{}) 12434 if !ok { 12435 return fmt.Errorf("unexpected JSON type %v", value) 12436 } 12437 12438 var sv *types.ThrottlingException 12439 if *v == nil { 12440 sv = &types.ThrottlingException{} 12441 } else { 12442 sv = *v 12443 } 12444 12445 for key, value := range shape { 12446 switch key { 12447 case "message": 12448 if value != nil { 12449 jtv, ok := value.(string) 12450 if !ok { 12451 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 12452 } 12453 sv.Message = ptr.String(jtv) 12454 } 12455 12456 case "retryAfterSeconds": 12457 if value != nil { 12458 jtv, ok := value.(json.Number) 12459 if !ok { 12460 return fmt.Errorf("expected RetryAfterSeconds to be json.Number, got %T instead", value) 12461 } 12462 i64, err := jtv.Int64() 12463 if err != nil { 12464 return err 12465 } 12466 sv.RetryAfterSeconds = int32(i64) 12467 } 12468 12469 default: 12470 _, _ = key, value 12471 12472 } 12473 } 12474 *v = sv 12475 return nil 12476} 12477 12478func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { 12479 if v == nil { 12480 return fmt.Errorf("unexpected nil of type %T", v) 12481 } 12482 if value == nil { 12483 return nil 12484 } 12485 12486 shape, ok := value.(map[string]interface{}) 12487 if !ok { 12488 return fmt.Errorf("unexpected JSON type %v", value) 12489 } 12490 12491 var sv *types.ValidationException 12492 if *v == nil { 12493 sv = &types.ValidationException{} 12494 } else { 12495 sv = *v 12496 } 12497 12498 for key, value := range shape { 12499 switch key { 12500 case "message": 12501 if value != nil { 12502 jtv, ok := value.(string) 12503 if !ok { 12504 return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value) 12505 } 12506 sv.Message = ptr.String(jtv) 12507 } 12508 12509 default: 12510 _, _ = key, value 12511 12512 } 12513 } 12514 *v = sv 12515 return nil 12516} 12517 12518func awsRestjson1_deserializeDocumentVoiceSettings(v **types.VoiceSettings, value interface{}) error { 12519 if v == nil { 12520 return fmt.Errorf("unexpected nil of type %T", v) 12521 } 12522 if value == nil { 12523 return nil 12524 } 12525 12526 shape, ok := value.(map[string]interface{}) 12527 if !ok { 12528 return fmt.Errorf("unexpected JSON type %v", value) 12529 } 12530 12531 var sv *types.VoiceSettings 12532 if *v == nil { 12533 sv = &types.VoiceSettings{} 12534 } else { 12535 sv = *v 12536 } 12537 12538 for key, value := range shape { 12539 switch key { 12540 case "voiceId": 12541 if value != nil { 12542 jtv, ok := value.(string) 12543 if !ok { 12544 return fmt.Errorf("expected VoiceId to be of type string, got %T instead", value) 12545 } 12546 sv.VoiceId = ptr.String(jtv) 12547 } 12548 12549 default: 12550 _, _ = key, value 12551 12552 } 12553 } 12554 *v = sv 12555 return nil 12556} 12557 12558func awsRestjson1_deserializeDocumentWaitAndContinueSpecification(v **types.WaitAndContinueSpecification, value interface{}) error { 12559 if v == nil { 12560 return fmt.Errorf("unexpected nil of type %T", v) 12561 } 12562 if value == nil { 12563 return nil 12564 } 12565 12566 shape, ok := value.(map[string]interface{}) 12567 if !ok { 12568 return fmt.Errorf("unexpected JSON type %v", value) 12569 } 12570 12571 var sv *types.WaitAndContinueSpecification 12572 if *v == nil { 12573 sv = &types.WaitAndContinueSpecification{} 12574 } else { 12575 sv = *v 12576 } 12577 12578 for key, value := range shape { 12579 switch key { 12580 case "continueResponse": 12581 if err := awsRestjson1_deserializeDocumentResponseSpecification(&sv.ContinueResponse, value); err != nil { 12582 return err 12583 } 12584 12585 case "stillWaitingResponse": 12586 if err := awsRestjson1_deserializeDocumentStillWaitingResponseSpecification(&sv.StillWaitingResponse, value); err != nil { 12587 return err 12588 } 12589 12590 case "waitingResponse": 12591 if err := awsRestjson1_deserializeDocumentResponseSpecification(&sv.WaitingResponse, value); err != nil { 12592 return err 12593 } 12594 12595 default: 12596 _, _ = key, value 12597 12598 } 12599 } 12600 *v = sv 12601 return nil 12602} 12603