1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package devopsguru 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/devopsguru/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithytime "github.com/aws/smithy-go/time" 17 smithyhttp "github.com/aws/smithy-go/transport/http" 18 "io" 19 "math" 20 "strconv" 21 "strings" 22) 23 24type awsRestjson1_deserializeOpAddNotificationChannel struct { 25} 26 27func (*awsRestjson1_deserializeOpAddNotificationChannel) ID() string { 28 return "OperationDeserializer" 29} 30 31func (m *awsRestjson1_deserializeOpAddNotificationChannel) 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_deserializeOpErrorAddNotificationChannel(response, &metadata) 46 } 47 output := &AddNotificationChannelOutput{} 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_deserializeOpDocumentAddNotificationChannelOutput(&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_deserializeOpErrorAddNotificationChannel(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("AccessDeniedException", errorCode): 123 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 124 125 case strings.EqualFold("ConflictException", errorCode): 126 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 127 128 case strings.EqualFold("InternalServerException", errorCode): 129 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 130 131 case strings.EqualFold("ResourceNotFoundException", errorCode): 132 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 133 134 case strings.EqualFold("ServiceQuotaExceededException", errorCode): 135 return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) 136 137 case strings.EqualFold("ThrottlingException", errorCode): 138 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 139 140 case strings.EqualFold("ValidationException", errorCode): 141 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 142 143 default: 144 genericError := &smithy.GenericAPIError{ 145 Code: errorCode, 146 Message: errorMessage, 147 } 148 return genericError 149 150 } 151} 152 153func awsRestjson1_deserializeOpDocumentAddNotificationChannelOutput(v **AddNotificationChannelOutput, value interface{}) error { 154 if v == nil { 155 return fmt.Errorf("unexpected nil of type %T", v) 156 } 157 if value == nil { 158 return nil 159 } 160 161 shape, ok := value.(map[string]interface{}) 162 if !ok { 163 return fmt.Errorf("unexpected JSON type %v", value) 164 } 165 166 var sv *AddNotificationChannelOutput 167 if *v == nil { 168 sv = &AddNotificationChannelOutput{} 169 } else { 170 sv = *v 171 } 172 173 for key, value := range shape { 174 switch key { 175 case "Id": 176 if value != nil { 177 jtv, ok := value.(string) 178 if !ok { 179 return fmt.Errorf("expected NotificationChannelId to be of type string, got %T instead", value) 180 } 181 sv.Id = ptr.String(jtv) 182 } 183 184 default: 185 _, _ = key, value 186 187 } 188 } 189 *v = sv 190 return nil 191} 192 193type awsRestjson1_deserializeOpDescribeAccountHealth struct { 194} 195 196func (*awsRestjson1_deserializeOpDescribeAccountHealth) ID() string { 197 return "OperationDeserializer" 198} 199 200func (m *awsRestjson1_deserializeOpDescribeAccountHealth) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 201 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 202) { 203 out, metadata, err = next.HandleDeserialize(ctx, in) 204 if err != nil { 205 return out, metadata, err 206 } 207 208 response, ok := out.RawResponse.(*smithyhttp.Response) 209 if !ok { 210 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 211 } 212 213 if response.StatusCode < 200 || response.StatusCode >= 300 { 214 return out, metadata, awsRestjson1_deserializeOpErrorDescribeAccountHealth(response, &metadata) 215 } 216 output := &DescribeAccountHealthOutput{} 217 out.Result = output 218 219 var buff [1024]byte 220 ringBuffer := smithyio.NewRingBuffer(buff[:]) 221 222 body := io.TeeReader(response.Body, ringBuffer) 223 224 decoder := json.NewDecoder(body) 225 decoder.UseNumber() 226 var shape interface{} 227 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 228 var snapshot bytes.Buffer 229 io.Copy(&snapshot, ringBuffer) 230 err = &smithy.DeserializationError{ 231 Err: fmt.Errorf("failed to decode response body, %w", err), 232 Snapshot: snapshot.Bytes(), 233 } 234 return out, metadata, err 235 } 236 237 err = awsRestjson1_deserializeOpDocumentDescribeAccountHealthOutput(&output, shape) 238 if err != nil { 239 var snapshot bytes.Buffer 240 io.Copy(&snapshot, ringBuffer) 241 return out, metadata, &smithy.DeserializationError{ 242 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 243 Snapshot: snapshot.Bytes(), 244 } 245 } 246 247 return out, metadata, err 248} 249 250func awsRestjson1_deserializeOpErrorDescribeAccountHealth(response *smithyhttp.Response, metadata *middleware.Metadata) error { 251 var errorBuffer bytes.Buffer 252 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 253 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 254 } 255 errorBody := bytes.NewReader(errorBuffer.Bytes()) 256 257 errorCode := "UnknownError" 258 errorMessage := errorCode 259 260 code := response.Header.Get("X-Amzn-ErrorType") 261 if len(code) != 0 { 262 errorCode = restjson.SanitizeErrorCode(code) 263 } 264 265 var buff [1024]byte 266 ringBuffer := smithyio.NewRingBuffer(buff[:]) 267 268 body := io.TeeReader(errorBody, ringBuffer) 269 decoder := json.NewDecoder(body) 270 decoder.UseNumber() 271 code, message, err := restjson.GetErrorInfo(decoder) 272 if err != nil { 273 var snapshot bytes.Buffer 274 io.Copy(&snapshot, ringBuffer) 275 err = &smithy.DeserializationError{ 276 Err: fmt.Errorf("failed to decode response body, %w", err), 277 Snapshot: snapshot.Bytes(), 278 } 279 return err 280 } 281 282 errorBody.Seek(0, io.SeekStart) 283 if len(code) != 0 { 284 errorCode = restjson.SanitizeErrorCode(code) 285 } 286 if len(message) != 0 { 287 errorMessage = message 288 } 289 290 switch { 291 case strings.EqualFold("AccessDeniedException", errorCode): 292 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 293 294 case strings.EqualFold("InternalServerException", errorCode): 295 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 296 297 case strings.EqualFold("ThrottlingException", errorCode): 298 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 299 300 case strings.EqualFold("ValidationException", errorCode): 301 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 302 303 default: 304 genericError := &smithy.GenericAPIError{ 305 Code: errorCode, 306 Message: errorMessage, 307 } 308 return genericError 309 310 } 311} 312 313func awsRestjson1_deserializeOpDocumentDescribeAccountHealthOutput(v **DescribeAccountHealthOutput, value interface{}) error { 314 if v == nil { 315 return fmt.Errorf("unexpected nil of type %T", v) 316 } 317 if value == nil { 318 return nil 319 } 320 321 shape, ok := value.(map[string]interface{}) 322 if !ok { 323 return fmt.Errorf("unexpected JSON type %v", value) 324 } 325 326 var sv *DescribeAccountHealthOutput 327 if *v == nil { 328 sv = &DescribeAccountHealthOutput{} 329 } else { 330 sv = *v 331 } 332 333 for key, value := range shape { 334 switch key { 335 case "MetricsAnalyzed": 336 if value != nil { 337 jtv, ok := value.(json.Number) 338 if !ok { 339 return fmt.Errorf("expected NumMetricsAnalyzed to be json.Number, got %T instead", value) 340 } 341 i64, err := jtv.Int64() 342 if err != nil { 343 return err 344 } 345 sv.MetricsAnalyzed = int32(i64) 346 } 347 348 case "OpenProactiveInsights": 349 if value != nil { 350 jtv, ok := value.(json.Number) 351 if !ok { 352 return fmt.Errorf("expected NumOpenProactiveInsights to be json.Number, got %T instead", value) 353 } 354 i64, err := jtv.Int64() 355 if err != nil { 356 return err 357 } 358 sv.OpenProactiveInsights = int32(i64) 359 } 360 361 case "OpenReactiveInsights": 362 if value != nil { 363 jtv, ok := value.(json.Number) 364 if !ok { 365 return fmt.Errorf("expected NumOpenReactiveInsights to be json.Number, got %T instead", value) 366 } 367 i64, err := jtv.Int64() 368 if err != nil { 369 return err 370 } 371 sv.OpenReactiveInsights = int32(i64) 372 } 373 374 case "ResourceHours": 375 if value != nil { 376 jtv, ok := value.(json.Number) 377 if !ok { 378 return fmt.Errorf("expected ResourceHours to be json.Number, got %T instead", value) 379 } 380 i64, err := jtv.Int64() 381 if err != nil { 382 return err 383 } 384 sv.ResourceHours = ptr.Int64(i64) 385 } 386 387 default: 388 _, _ = key, value 389 390 } 391 } 392 *v = sv 393 return nil 394} 395 396type awsRestjson1_deserializeOpDescribeAccountOverview struct { 397} 398 399func (*awsRestjson1_deserializeOpDescribeAccountOverview) ID() string { 400 return "OperationDeserializer" 401} 402 403func (m *awsRestjson1_deserializeOpDescribeAccountOverview) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 404 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 405) { 406 out, metadata, err = next.HandleDeserialize(ctx, in) 407 if err != nil { 408 return out, metadata, err 409 } 410 411 response, ok := out.RawResponse.(*smithyhttp.Response) 412 if !ok { 413 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 414 } 415 416 if response.StatusCode < 200 || response.StatusCode >= 300 { 417 return out, metadata, awsRestjson1_deserializeOpErrorDescribeAccountOverview(response, &metadata) 418 } 419 output := &DescribeAccountOverviewOutput{} 420 out.Result = output 421 422 var buff [1024]byte 423 ringBuffer := smithyio.NewRingBuffer(buff[:]) 424 425 body := io.TeeReader(response.Body, ringBuffer) 426 427 decoder := json.NewDecoder(body) 428 decoder.UseNumber() 429 var shape interface{} 430 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 431 var snapshot bytes.Buffer 432 io.Copy(&snapshot, ringBuffer) 433 err = &smithy.DeserializationError{ 434 Err: fmt.Errorf("failed to decode response body, %w", err), 435 Snapshot: snapshot.Bytes(), 436 } 437 return out, metadata, err 438 } 439 440 err = awsRestjson1_deserializeOpDocumentDescribeAccountOverviewOutput(&output, shape) 441 if err != nil { 442 var snapshot bytes.Buffer 443 io.Copy(&snapshot, ringBuffer) 444 return out, metadata, &smithy.DeserializationError{ 445 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 446 Snapshot: snapshot.Bytes(), 447 } 448 } 449 450 return out, metadata, err 451} 452 453func awsRestjson1_deserializeOpErrorDescribeAccountOverview(response *smithyhttp.Response, metadata *middleware.Metadata) error { 454 var errorBuffer bytes.Buffer 455 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 456 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 457 } 458 errorBody := bytes.NewReader(errorBuffer.Bytes()) 459 460 errorCode := "UnknownError" 461 errorMessage := errorCode 462 463 code := response.Header.Get("X-Amzn-ErrorType") 464 if len(code) != 0 { 465 errorCode = restjson.SanitizeErrorCode(code) 466 } 467 468 var buff [1024]byte 469 ringBuffer := smithyio.NewRingBuffer(buff[:]) 470 471 body := io.TeeReader(errorBody, ringBuffer) 472 decoder := json.NewDecoder(body) 473 decoder.UseNumber() 474 code, message, err := restjson.GetErrorInfo(decoder) 475 if err != nil { 476 var snapshot bytes.Buffer 477 io.Copy(&snapshot, ringBuffer) 478 err = &smithy.DeserializationError{ 479 Err: fmt.Errorf("failed to decode response body, %w", err), 480 Snapshot: snapshot.Bytes(), 481 } 482 return err 483 } 484 485 errorBody.Seek(0, io.SeekStart) 486 if len(code) != 0 { 487 errorCode = restjson.SanitizeErrorCode(code) 488 } 489 if len(message) != 0 { 490 errorMessage = message 491 } 492 493 switch { 494 case strings.EqualFold("AccessDeniedException", errorCode): 495 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 496 497 case strings.EqualFold("InternalServerException", errorCode): 498 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 499 500 case strings.EqualFold("ThrottlingException", errorCode): 501 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 502 503 case strings.EqualFold("ValidationException", errorCode): 504 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 505 506 default: 507 genericError := &smithy.GenericAPIError{ 508 Code: errorCode, 509 Message: errorMessage, 510 } 511 return genericError 512 513 } 514} 515 516func awsRestjson1_deserializeOpDocumentDescribeAccountOverviewOutput(v **DescribeAccountOverviewOutput, value interface{}) error { 517 if v == nil { 518 return fmt.Errorf("unexpected nil of type %T", v) 519 } 520 if value == nil { 521 return nil 522 } 523 524 shape, ok := value.(map[string]interface{}) 525 if !ok { 526 return fmt.Errorf("unexpected JSON type %v", value) 527 } 528 529 var sv *DescribeAccountOverviewOutput 530 if *v == nil { 531 sv = &DescribeAccountOverviewOutput{} 532 } else { 533 sv = *v 534 } 535 536 for key, value := range shape { 537 switch key { 538 case "MeanTimeToRecoverInMilliseconds": 539 if value != nil { 540 jtv, ok := value.(json.Number) 541 if !ok { 542 return fmt.Errorf("expected MeanTimeToRecoverInMilliseconds to be json.Number, got %T instead", value) 543 } 544 i64, err := jtv.Int64() 545 if err != nil { 546 return err 547 } 548 sv.MeanTimeToRecoverInMilliseconds = ptr.Int64(i64) 549 } 550 551 case "ProactiveInsights": 552 if value != nil { 553 jtv, ok := value.(json.Number) 554 if !ok { 555 return fmt.Errorf("expected NumProactiveInsights to be json.Number, got %T instead", value) 556 } 557 i64, err := jtv.Int64() 558 if err != nil { 559 return err 560 } 561 sv.ProactiveInsights = int32(i64) 562 } 563 564 case "ReactiveInsights": 565 if value != nil { 566 jtv, ok := value.(json.Number) 567 if !ok { 568 return fmt.Errorf("expected NumReactiveInsights to be json.Number, got %T instead", value) 569 } 570 i64, err := jtv.Int64() 571 if err != nil { 572 return err 573 } 574 sv.ReactiveInsights = int32(i64) 575 } 576 577 default: 578 _, _ = key, value 579 580 } 581 } 582 *v = sv 583 return nil 584} 585 586type awsRestjson1_deserializeOpDescribeAnomaly struct { 587} 588 589func (*awsRestjson1_deserializeOpDescribeAnomaly) ID() string { 590 return "OperationDeserializer" 591} 592 593func (m *awsRestjson1_deserializeOpDescribeAnomaly) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 594 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 595) { 596 out, metadata, err = next.HandleDeserialize(ctx, in) 597 if err != nil { 598 return out, metadata, err 599 } 600 601 response, ok := out.RawResponse.(*smithyhttp.Response) 602 if !ok { 603 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 604 } 605 606 if response.StatusCode < 200 || response.StatusCode >= 300 { 607 return out, metadata, awsRestjson1_deserializeOpErrorDescribeAnomaly(response, &metadata) 608 } 609 output := &DescribeAnomalyOutput{} 610 out.Result = output 611 612 var buff [1024]byte 613 ringBuffer := smithyio.NewRingBuffer(buff[:]) 614 615 body := io.TeeReader(response.Body, ringBuffer) 616 617 decoder := json.NewDecoder(body) 618 decoder.UseNumber() 619 var shape interface{} 620 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 621 var snapshot bytes.Buffer 622 io.Copy(&snapshot, ringBuffer) 623 err = &smithy.DeserializationError{ 624 Err: fmt.Errorf("failed to decode response body, %w", err), 625 Snapshot: snapshot.Bytes(), 626 } 627 return out, metadata, err 628 } 629 630 err = awsRestjson1_deserializeOpDocumentDescribeAnomalyOutput(&output, shape) 631 if err != nil { 632 var snapshot bytes.Buffer 633 io.Copy(&snapshot, ringBuffer) 634 return out, metadata, &smithy.DeserializationError{ 635 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 636 Snapshot: snapshot.Bytes(), 637 } 638 } 639 640 return out, metadata, err 641} 642 643func awsRestjson1_deserializeOpErrorDescribeAnomaly(response *smithyhttp.Response, metadata *middleware.Metadata) error { 644 var errorBuffer bytes.Buffer 645 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 646 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 647 } 648 errorBody := bytes.NewReader(errorBuffer.Bytes()) 649 650 errorCode := "UnknownError" 651 errorMessage := errorCode 652 653 code := response.Header.Get("X-Amzn-ErrorType") 654 if len(code) != 0 { 655 errorCode = restjson.SanitizeErrorCode(code) 656 } 657 658 var buff [1024]byte 659 ringBuffer := smithyio.NewRingBuffer(buff[:]) 660 661 body := io.TeeReader(errorBody, ringBuffer) 662 decoder := json.NewDecoder(body) 663 decoder.UseNumber() 664 code, message, err := restjson.GetErrorInfo(decoder) 665 if err != nil { 666 var snapshot bytes.Buffer 667 io.Copy(&snapshot, ringBuffer) 668 err = &smithy.DeserializationError{ 669 Err: fmt.Errorf("failed to decode response body, %w", err), 670 Snapshot: snapshot.Bytes(), 671 } 672 return err 673 } 674 675 errorBody.Seek(0, io.SeekStart) 676 if len(code) != 0 { 677 errorCode = restjson.SanitizeErrorCode(code) 678 } 679 if len(message) != 0 { 680 errorMessage = message 681 } 682 683 switch { 684 case strings.EqualFold("AccessDeniedException", errorCode): 685 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 686 687 case strings.EqualFold("InternalServerException", errorCode): 688 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 689 690 case strings.EqualFold("ResourceNotFoundException", errorCode): 691 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 692 693 case strings.EqualFold("ThrottlingException", errorCode): 694 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 695 696 case strings.EqualFold("ValidationException", errorCode): 697 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 698 699 default: 700 genericError := &smithy.GenericAPIError{ 701 Code: errorCode, 702 Message: errorMessage, 703 } 704 return genericError 705 706 } 707} 708 709func awsRestjson1_deserializeOpDocumentDescribeAnomalyOutput(v **DescribeAnomalyOutput, value interface{}) error { 710 if v == nil { 711 return fmt.Errorf("unexpected nil of type %T", v) 712 } 713 if value == nil { 714 return nil 715 } 716 717 shape, ok := value.(map[string]interface{}) 718 if !ok { 719 return fmt.Errorf("unexpected JSON type %v", value) 720 } 721 722 var sv *DescribeAnomalyOutput 723 if *v == nil { 724 sv = &DescribeAnomalyOutput{} 725 } else { 726 sv = *v 727 } 728 729 for key, value := range shape { 730 switch key { 731 case "ProactiveAnomaly": 732 if err := awsRestjson1_deserializeDocumentProactiveAnomaly(&sv.ProactiveAnomaly, value); err != nil { 733 return err 734 } 735 736 case "ReactiveAnomaly": 737 if err := awsRestjson1_deserializeDocumentReactiveAnomaly(&sv.ReactiveAnomaly, value); err != nil { 738 return err 739 } 740 741 default: 742 _, _ = key, value 743 744 } 745 } 746 *v = sv 747 return nil 748} 749 750type awsRestjson1_deserializeOpDescribeFeedback struct { 751} 752 753func (*awsRestjson1_deserializeOpDescribeFeedback) ID() string { 754 return "OperationDeserializer" 755} 756 757func (m *awsRestjson1_deserializeOpDescribeFeedback) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 758 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 759) { 760 out, metadata, err = next.HandleDeserialize(ctx, in) 761 if err != nil { 762 return out, metadata, err 763 } 764 765 response, ok := out.RawResponse.(*smithyhttp.Response) 766 if !ok { 767 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 768 } 769 770 if response.StatusCode < 200 || response.StatusCode >= 300 { 771 return out, metadata, awsRestjson1_deserializeOpErrorDescribeFeedback(response, &metadata) 772 } 773 output := &DescribeFeedbackOutput{} 774 out.Result = output 775 776 var buff [1024]byte 777 ringBuffer := smithyio.NewRingBuffer(buff[:]) 778 779 body := io.TeeReader(response.Body, ringBuffer) 780 781 decoder := json.NewDecoder(body) 782 decoder.UseNumber() 783 var shape interface{} 784 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 785 var snapshot bytes.Buffer 786 io.Copy(&snapshot, ringBuffer) 787 err = &smithy.DeserializationError{ 788 Err: fmt.Errorf("failed to decode response body, %w", err), 789 Snapshot: snapshot.Bytes(), 790 } 791 return out, metadata, err 792 } 793 794 err = awsRestjson1_deserializeOpDocumentDescribeFeedbackOutput(&output, shape) 795 if err != nil { 796 var snapshot bytes.Buffer 797 io.Copy(&snapshot, ringBuffer) 798 return out, metadata, &smithy.DeserializationError{ 799 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 800 Snapshot: snapshot.Bytes(), 801 } 802 } 803 804 return out, metadata, err 805} 806 807func awsRestjson1_deserializeOpErrorDescribeFeedback(response *smithyhttp.Response, metadata *middleware.Metadata) error { 808 var errorBuffer bytes.Buffer 809 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 810 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 811 } 812 errorBody := bytes.NewReader(errorBuffer.Bytes()) 813 814 errorCode := "UnknownError" 815 errorMessage := errorCode 816 817 code := response.Header.Get("X-Amzn-ErrorType") 818 if len(code) != 0 { 819 errorCode = restjson.SanitizeErrorCode(code) 820 } 821 822 var buff [1024]byte 823 ringBuffer := smithyio.NewRingBuffer(buff[:]) 824 825 body := io.TeeReader(errorBody, ringBuffer) 826 decoder := json.NewDecoder(body) 827 decoder.UseNumber() 828 code, message, err := restjson.GetErrorInfo(decoder) 829 if err != nil { 830 var snapshot bytes.Buffer 831 io.Copy(&snapshot, ringBuffer) 832 err = &smithy.DeserializationError{ 833 Err: fmt.Errorf("failed to decode response body, %w", err), 834 Snapshot: snapshot.Bytes(), 835 } 836 return err 837 } 838 839 errorBody.Seek(0, io.SeekStart) 840 if len(code) != 0 { 841 errorCode = restjson.SanitizeErrorCode(code) 842 } 843 if len(message) != 0 { 844 errorMessage = message 845 } 846 847 switch { 848 case strings.EqualFold("AccessDeniedException", errorCode): 849 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 850 851 case strings.EqualFold("InternalServerException", errorCode): 852 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 853 854 case strings.EqualFold("ResourceNotFoundException", errorCode): 855 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 856 857 case strings.EqualFold("ThrottlingException", errorCode): 858 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 859 860 case strings.EqualFold("ValidationException", errorCode): 861 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 862 863 default: 864 genericError := &smithy.GenericAPIError{ 865 Code: errorCode, 866 Message: errorMessage, 867 } 868 return genericError 869 870 } 871} 872 873func awsRestjson1_deserializeOpDocumentDescribeFeedbackOutput(v **DescribeFeedbackOutput, value interface{}) error { 874 if v == nil { 875 return fmt.Errorf("unexpected nil of type %T", v) 876 } 877 if value == nil { 878 return nil 879 } 880 881 shape, ok := value.(map[string]interface{}) 882 if !ok { 883 return fmt.Errorf("unexpected JSON type %v", value) 884 } 885 886 var sv *DescribeFeedbackOutput 887 if *v == nil { 888 sv = &DescribeFeedbackOutput{} 889 } else { 890 sv = *v 891 } 892 893 for key, value := range shape { 894 switch key { 895 case "InsightFeedback": 896 if err := awsRestjson1_deserializeDocumentInsightFeedback(&sv.InsightFeedback, value); err != nil { 897 return err 898 } 899 900 default: 901 _, _ = key, value 902 903 } 904 } 905 *v = sv 906 return nil 907} 908 909type awsRestjson1_deserializeOpDescribeInsight struct { 910} 911 912func (*awsRestjson1_deserializeOpDescribeInsight) ID() string { 913 return "OperationDeserializer" 914} 915 916func (m *awsRestjson1_deserializeOpDescribeInsight) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 917 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 918) { 919 out, metadata, err = next.HandleDeserialize(ctx, in) 920 if err != nil { 921 return out, metadata, err 922 } 923 924 response, ok := out.RawResponse.(*smithyhttp.Response) 925 if !ok { 926 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 927 } 928 929 if response.StatusCode < 200 || response.StatusCode >= 300 { 930 return out, metadata, awsRestjson1_deserializeOpErrorDescribeInsight(response, &metadata) 931 } 932 output := &DescribeInsightOutput{} 933 out.Result = output 934 935 var buff [1024]byte 936 ringBuffer := smithyio.NewRingBuffer(buff[:]) 937 938 body := io.TeeReader(response.Body, ringBuffer) 939 940 decoder := json.NewDecoder(body) 941 decoder.UseNumber() 942 var shape interface{} 943 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 944 var snapshot bytes.Buffer 945 io.Copy(&snapshot, ringBuffer) 946 err = &smithy.DeserializationError{ 947 Err: fmt.Errorf("failed to decode response body, %w", err), 948 Snapshot: snapshot.Bytes(), 949 } 950 return out, metadata, err 951 } 952 953 err = awsRestjson1_deserializeOpDocumentDescribeInsightOutput(&output, shape) 954 if err != nil { 955 var snapshot bytes.Buffer 956 io.Copy(&snapshot, ringBuffer) 957 return out, metadata, &smithy.DeserializationError{ 958 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 959 Snapshot: snapshot.Bytes(), 960 } 961 } 962 963 return out, metadata, err 964} 965 966func awsRestjson1_deserializeOpErrorDescribeInsight(response *smithyhttp.Response, metadata *middleware.Metadata) error { 967 var errorBuffer bytes.Buffer 968 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 969 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 970 } 971 errorBody := bytes.NewReader(errorBuffer.Bytes()) 972 973 errorCode := "UnknownError" 974 errorMessage := errorCode 975 976 code := response.Header.Get("X-Amzn-ErrorType") 977 if len(code) != 0 { 978 errorCode = restjson.SanitizeErrorCode(code) 979 } 980 981 var buff [1024]byte 982 ringBuffer := smithyio.NewRingBuffer(buff[:]) 983 984 body := io.TeeReader(errorBody, ringBuffer) 985 decoder := json.NewDecoder(body) 986 decoder.UseNumber() 987 code, message, err := restjson.GetErrorInfo(decoder) 988 if err != nil { 989 var snapshot bytes.Buffer 990 io.Copy(&snapshot, ringBuffer) 991 err = &smithy.DeserializationError{ 992 Err: fmt.Errorf("failed to decode response body, %w", err), 993 Snapshot: snapshot.Bytes(), 994 } 995 return err 996 } 997 998 errorBody.Seek(0, io.SeekStart) 999 if len(code) != 0 { 1000 errorCode = restjson.SanitizeErrorCode(code) 1001 } 1002 if len(message) != 0 { 1003 errorMessage = message 1004 } 1005 1006 switch { 1007 case strings.EqualFold("AccessDeniedException", errorCode): 1008 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1009 1010 case strings.EqualFold("InternalServerException", errorCode): 1011 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1012 1013 case strings.EqualFold("ResourceNotFoundException", errorCode): 1014 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1015 1016 case strings.EqualFold("ThrottlingException", errorCode): 1017 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1018 1019 case strings.EqualFold("ValidationException", errorCode): 1020 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1021 1022 default: 1023 genericError := &smithy.GenericAPIError{ 1024 Code: errorCode, 1025 Message: errorMessage, 1026 } 1027 return genericError 1028 1029 } 1030} 1031 1032func awsRestjson1_deserializeOpDocumentDescribeInsightOutput(v **DescribeInsightOutput, value interface{}) error { 1033 if v == nil { 1034 return fmt.Errorf("unexpected nil of type %T", v) 1035 } 1036 if value == nil { 1037 return nil 1038 } 1039 1040 shape, ok := value.(map[string]interface{}) 1041 if !ok { 1042 return fmt.Errorf("unexpected JSON type %v", value) 1043 } 1044 1045 var sv *DescribeInsightOutput 1046 if *v == nil { 1047 sv = &DescribeInsightOutput{} 1048 } else { 1049 sv = *v 1050 } 1051 1052 for key, value := range shape { 1053 switch key { 1054 case "ProactiveInsight": 1055 if err := awsRestjson1_deserializeDocumentProactiveInsight(&sv.ProactiveInsight, value); err != nil { 1056 return err 1057 } 1058 1059 case "ReactiveInsight": 1060 if err := awsRestjson1_deserializeDocumentReactiveInsight(&sv.ReactiveInsight, value); err != nil { 1061 return err 1062 } 1063 1064 default: 1065 _, _ = key, value 1066 1067 } 1068 } 1069 *v = sv 1070 return nil 1071} 1072 1073type awsRestjson1_deserializeOpDescribeResourceCollectionHealth struct { 1074} 1075 1076func (*awsRestjson1_deserializeOpDescribeResourceCollectionHealth) ID() string { 1077 return "OperationDeserializer" 1078} 1079 1080func (m *awsRestjson1_deserializeOpDescribeResourceCollectionHealth) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1081 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1082) { 1083 out, metadata, err = next.HandleDeserialize(ctx, in) 1084 if err != nil { 1085 return out, metadata, err 1086 } 1087 1088 response, ok := out.RawResponse.(*smithyhttp.Response) 1089 if !ok { 1090 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1091 } 1092 1093 if response.StatusCode < 200 || response.StatusCode >= 300 { 1094 return out, metadata, awsRestjson1_deserializeOpErrorDescribeResourceCollectionHealth(response, &metadata) 1095 } 1096 output := &DescribeResourceCollectionHealthOutput{} 1097 out.Result = output 1098 1099 var buff [1024]byte 1100 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1101 1102 body := io.TeeReader(response.Body, ringBuffer) 1103 1104 decoder := json.NewDecoder(body) 1105 decoder.UseNumber() 1106 var shape interface{} 1107 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1108 var snapshot bytes.Buffer 1109 io.Copy(&snapshot, ringBuffer) 1110 err = &smithy.DeserializationError{ 1111 Err: fmt.Errorf("failed to decode response body, %w", err), 1112 Snapshot: snapshot.Bytes(), 1113 } 1114 return out, metadata, err 1115 } 1116 1117 err = awsRestjson1_deserializeOpDocumentDescribeResourceCollectionHealthOutput(&output, shape) 1118 if err != nil { 1119 var snapshot bytes.Buffer 1120 io.Copy(&snapshot, ringBuffer) 1121 return out, metadata, &smithy.DeserializationError{ 1122 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1123 Snapshot: snapshot.Bytes(), 1124 } 1125 } 1126 1127 return out, metadata, err 1128} 1129 1130func awsRestjson1_deserializeOpErrorDescribeResourceCollectionHealth(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1131 var errorBuffer bytes.Buffer 1132 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1133 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1134 } 1135 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1136 1137 errorCode := "UnknownError" 1138 errorMessage := errorCode 1139 1140 code := response.Header.Get("X-Amzn-ErrorType") 1141 if len(code) != 0 { 1142 errorCode = restjson.SanitizeErrorCode(code) 1143 } 1144 1145 var buff [1024]byte 1146 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1147 1148 body := io.TeeReader(errorBody, ringBuffer) 1149 decoder := json.NewDecoder(body) 1150 decoder.UseNumber() 1151 code, message, err := restjson.GetErrorInfo(decoder) 1152 if err != nil { 1153 var snapshot bytes.Buffer 1154 io.Copy(&snapshot, ringBuffer) 1155 err = &smithy.DeserializationError{ 1156 Err: fmt.Errorf("failed to decode response body, %w", err), 1157 Snapshot: snapshot.Bytes(), 1158 } 1159 return err 1160 } 1161 1162 errorBody.Seek(0, io.SeekStart) 1163 if len(code) != 0 { 1164 errorCode = restjson.SanitizeErrorCode(code) 1165 } 1166 if len(message) != 0 { 1167 errorMessage = message 1168 } 1169 1170 switch { 1171 case strings.EqualFold("AccessDeniedException", errorCode): 1172 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1173 1174 case strings.EqualFold("InternalServerException", errorCode): 1175 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1176 1177 case strings.EqualFold("ThrottlingException", errorCode): 1178 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1179 1180 case strings.EqualFold("ValidationException", errorCode): 1181 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1182 1183 default: 1184 genericError := &smithy.GenericAPIError{ 1185 Code: errorCode, 1186 Message: errorMessage, 1187 } 1188 return genericError 1189 1190 } 1191} 1192 1193func awsRestjson1_deserializeOpDocumentDescribeResourceCollectionHealthOutput(v **DescribeResourceCollectionHealthOutput, value interface{}) error { 1194 if v == nil { 1195 return fmt.Errorf("unexpected nil of type %T", v) 1196 } 1197 if value == nil { 1198 return nil 1199 } 1200 1201 shape, ok := value.(map[string]interface{}) 1202 if !ok { 1203 return fmt.Errorf("unexpected JSON type %v", value) 1204 } 1205 1206 var sv *DescribeResourceCollectionHealthOutput 1207 if *v == nil { 1208 sv = &DescribeResourceCollectionHealthOutput{} 1209 } else { 1210 sv = *v 1211 } 1212 1213 for key, value := range shape { 1214 switch key { 1215 case "CloudFormation": 1216 if err := awsRestjson1_deserializeDocumentCloudFormationHealths(&sv.CloudFormation, value); err != nil { 1217 return err 1218 } 1219 1220 case "NextToken": 1221 if value != nil { 1222 jtv, ok := value.(string) 1223 if !ok { 1224 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 1225 } 1226 sv.NextToken = ptr.String(jtv) 1227 } 1228 1229 case "Service": 1230 if err := awsRestjson1_deserializeDocumentServiceHealths(&sv.Service, value); err != nil { 1231 return err 1232 } 1233 1234 default: 1235 _, _ = key, value 1236 1237 } 1238 } 1239 *v = sv 1240 return nil 1241} 1242 1243type awsRestjson1_deserializeOpDescribeServiceIntegration struct { 1244} 1245 1246func (*awsRestjson1_deserializeOpDescribeServiceIntegration) ID() string { 1247 return "OperationDeserializer" 1248} 1249 1250func (m *awsRestjson1_deserializeOpDescribeServiceIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1251 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1252) { 1253 out, metadata, err = next.HandleDeserialize(ctx, in) 1254 if err != nil { 1255 return out, metadata, err 1256 } 1257 1258 response, ok := out.RawResponse.(*smithyhttp.Response) 1259 if !ok { 1260 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1261 } 1262 1263 if response.StatusCode < 200 || response.StatusCode >= 300 { 1264 return out, metadata, awsRestjson1_deserializeOpErrorDescribeServiceIntegration(response, &metadata) 1265 } 1266 output := &DescribeServiceIntegrationOutput{} 1267 out.Result = output 1268 1269 var buff [1024]byte 1270 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1271 1272 body := io.TeeReader(response.Body, ringBuffer) 1273 1274 decoder := json.NewDecoder(body) 1275 decoder.UseNumber() 1276 var shape interface{} 1277 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1278 var snapshot bytes.Buffer 1279 io.Copy(&snapshot, ringBuffer) 1280 err = &smithy.DeserializationError{ 1281 Err: fmt.Errorf("failed to decode response body, %w", err), 1282 Snapshot: snapshot.Bytes(), 1283 } 1284 return out, metadata, err 1285 } 1286 1287 err = awsRestjson1_deserializeOpDocumentDescribeServiceIntegrationOutput(&output, shape) 1288 if err != nil { 1289 var snapshot bytes.Buffer 1290 io.Copy(&snapshot, ringBuffer) 1291 return out, metadata, &smithy.DeserializationError{ 1292 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1293 Snapshot: snapshot.Bytes(), 1294 } 1295 } 1296 1297 return out, metadata, err 1298} 1299 1300func awsRestjson1_deserializeOpErrorDescribeServiceIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1301 var errorBuffer bytes.Buffer 1302 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1303 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1304 } 1305 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1306 1307 errorCode := "UnknownError" 1308 errorMessage := errorCode 1309 1310 code := response.Header.Get("X-Amzn-ErrorType") 1311 if len(code) != 0 { 1312 errorCode = restjson.SanitizeErrorCode(code) 1313 } 1314 1315 var buff [1024]byte 1316 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1317 1318 body := io.TeeReader(errorBody, ringBuffer) 1319 decoder := json.NewDecoder(body) 1320 decoder.UseNumber() 1321 code, message, err := restjson.GetErrorInfo(decoder) 1322 if err != nil { 1323 var snapshot bytes.Buffer 1324 io.Copy(&snapshot, ringBuffer) 1325 err = &smithy.DeserializationError{ 1326 Err: fmt.Errorf("failed to decode response body, %w", err), 1327 Snapshot: snapshot.Bytes(), 1328 } 1329 return err 1330 } 1331 1332 errorBody.Seek(0, io.SeekStart) 1333 if len(code) != 0 { 1334 errorCode = restjson.SanitizeErrorCode(code) 1335 } 1336 if len(message) != 0 { 1337 errorMessage = message 1338 } 1339 1340 switch { 1341 case strings.EqualFold("AccessDeniedException", errorCode): 1342 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1343 1344 case strings.EqualFold("InternalServerException", errorCode): 1345 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1346 1347 case strings.EqualFold("ThrottlingException", errorCode): 1348 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1349 1350 case strings.EqualFold("ValidationException", errorCode): 1351 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1352 1353 default: 1354 genericError := &smithy.GenericAPIError{ 1355 Code: errorCode, 1356 Message: errorMessage, 1357 } 1358 return genericError 1359 1360 } 1361} 1362 1363func awsRestjson1_deserializeOpDocumentDescribeServiceIntegrationOutput(v **DescribeServiceIntegrationOutput, value interface{}) error { 1364 if v == nil { 1365 return fmt.Errorf("unexpected nil of type %T", v) 1366 } 1367 if value == nil { 1368 return nil 1369 } 1370 1371 shape, ok := value.(map[string]interface{}) 1372 if !ok { 1373 return fmt.Errorf("unexpected JSON type %v", value) 1374 } 1375 1376 var sv *DescribeServiceIntegrationOutput 1377 if *v == nil { 1378 sv = &DescribeServiceIntegrationOutput{} 1379 } else { 1380 sv = *v 1381 } 1382 1383 for key, value := range shape { 1384 switch key { 1385 case "ServiceIntegration": 1386 if err := awsRestjson1_deserializeDocumentServiceIntegrationConfig(&sv.ServiceIntegration, value); err != nil { 1387 return err 1388 } 1389 1390 default: 1391 _, _ = key, value 1392 1393 } 1394 } 1395 *v = sv 1396 return nil 1397} 1398 1399type awsRestjson1_deserializeOpGetCostEstimation struct { 1400} 1401 1402func (*awsRestjson1_deserializeOpGetCostEstimation) ID() string { 1403 return "OperationDeserializer" 1404} 1405 1406func (m *awsRestjson1_deserializeOpGetCostEstimation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1407 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1408) { 1409 out, metadata, err = next.HandleDeserialize(ctx, in) 1410 if err != nil { 1411 return out, metadata, err 1412 } 1413 1414 response, ok := out.RawResponse.(*smithyhttp.Response) 1415 if !ok { 1416 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1417 } 1418 1419 if response.StatusCode < 200 || response.StatusCode >= 300 { 1420 return out, metadata, awsRestjson1_deserializeOpErrorGetCostEstimation(response, &metadata) 1421 } 1422 output := &GetCostEstimationOutput{} 1423 out.Result = output 1424 1425 var buff [1024]byte 1426 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1427 1428 body := io.TeeReader(response.Body, ringBuffer) 1429 1430 decoder := json.NewDecoder(body) 1431 decoder.UseNumber() 1432 var shape interface{} 1433 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1434 var snapshot bytes.Buffer 1435 io.Copy(&snapshot, ringBuffer) 1436 err = &smithy.DeserializationError{ 1437 Err: fmt.Errorf("failed to decode response body, %w", err), 1438 Snapshot: snapshot.Bytes(), 1439 } 1440 return out, metadata, err 1441 } 1442 1443 err = awsRestjson1_deserializeOpDocumentGetCostEstimationOutput(&output, shape) 1444 if err != nil { 1445 var snapshot bytes.Buffer 1446 io.Copy(&snapshot, ringBuffer) 1447 return out, metadata, &smithy.DeserializationError{ 1448 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1449 Snapshot: snapshot.Bytes(), 1450 } 1451 } 1452 1453 return out, metadata, err 1454} 1455 1456func awsRestjson1_deserializeOpErrorGetCostEstimation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1457 var errorBuffer bytes.Buffer 1458 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1459 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1460 } 1461 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1462 1463 errorCode := "UnknownError" 1464 errorMessage := errorCode 1465 1466 code := response.Header.Get("X-Amzn-ErrorType") 1467 if len(code) != 0 { 1468 errorCode = restjson.SanitizeErrorCode(code) 1469 } 1470 1471 var buff [1024]byte 1472 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1473 1474 body := io.TeeReader(errorBody, ringBuffer) 1475 decoder := json.NewDecoder(body) 1476 decoder.UseNumber() 1477 code, message, err := restjson.GetErrorInfo(decoder) 1478 if err != nil { 1479 var snapshot bytes.Buffer 1480 io.Copy(&snapshot, ringBuffer) 1481 err = &smithy.DeserializationError{ 1482 Err: fmt.Errorf("failed to decode response body, %w", err), 1483 Snapshot: snapshot.Bytes(), 1484 } 1485 return err 1486 } 1487 1488 errorBody.Seek(0, io.SeekStart) 1489 if len(code) != 0 { 1490 errorCode = restjson.SanitizeErrorCode(code) 1491 } 1492 if len(message) != 0 { 1493 errorMessage = message 1494 } 1495 1496 switch { 1497 case strings.EqualFold("AccessDeniedException", errorCode): 1498 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1499 1500 case strings.EqualFold("InternalServerException", errorCode): 1501 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1502 1503 case strings.EqualFold("ResourceNotFoundException", errorCode): 1504 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1505 1506 case strings.EqualFold("ThrottlingException", errorCode): 1507 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1508 1509 case strings.EqualFold("ValidationException", errorCode): 1510 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1511 1512 default: 1513 genericError := &smithy.GenericAPIError{ 1514 Code: errorCode, 1515 Message: errorMessage, 1516 } 1517 return genericError 1518 1519 } 1520} 1521 1522func awsRestjson1_deserializeOpDocumentGetCostEstimationOutput(v **GetCostEstimationOutput, value interface{}) error { 1523 if v == nil { 1524 return fmt.Errorf("unexpected nil of type %T", v) 1525 } 1526 if value == nil { 1527 return nil 1528 } 1529 1530 shape, ok := value.(map[string]interface{}) 1531 if !ok { 1532 return fmt.Errorf("unexpected JSON type %v", value) 1533 } 1534 1535 var sv *GetCostEstimationOutput 1536 if *v == nil { 1537 sv = &GetCostEstimationOutput{} 1538 } else { 1539 sv = *v 1540 } 1541 1542 for key, value := range shape { 1543 switch key { 1544 case "Costs": 1545 if err := awsRestjson1_deserializeDocumentServiceResourceCosts(&sv.Costs, value); err != nil { 1546 return err 1547 } 1548 1549 case "NextToken": 1550 if value != nil { 1551 jtv, ok := value.(string) 1552 if !ok { 1553 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 1554 } 1555 sv.NextToken = ptr.String(jtv) 1556 } 1557 1558 case "ResourceCollection": 1559 if err := awsRestjson1_deserializeDocumentCostEstimationResourceCollectionFilter(&sv.ResourceCollection, value); err != nil { 1560 return err 1561 } 1562 1563 case "Status": 1564 if value != nil { 1565 jtv, ok := value.(string) 1566 if !ok { 1567 return fmt.Errorf("expected CostEstimationStatus to be of type string, got %T instead", value) 1568 } 1569 sv.Status = types.CostEstimationStatus(jtv) 1570 } 1571 1572 case "TimeRange": 1573 if err := awsRestjson1_deserializeDocumentCostEstimationTimeRange(&sv.TimeRange, value); err != nil { 1574 return err 1575 } 1576 1577 case "TotalCost": 1578 if value != nil { 1579 switch jtv := value.(type) { 1580 case json.Number: 1581 f64, err := jtv.Float64() 1582 if err != nil { 1583 return err 1584 } 1585 sv.TotalCost = f64 1586 1587 case string: 1588 var f64 float64 1589 switch { 1590 case strings.EqualFold(jtv, "NaN"): 1591 f64 = math.NaN() 1592 1593 case strings.EqualFold(jtv, "Infinity"): 1594 f64 = math.Inf(1) 1595 1596 case strings.EqualFold(jtv, "-Infinity"): 1597 f64 = math.Inf(-1) 1598 1599 default: 1600 return fmt.Errorf("unknown JSON number value: %s", jtv) 1601 1602 } 1603 sv.TotalCost = f64 1604 1605 default: 1606 return fmt.Errorf("expected Cost to be a JSON Number, got %T instead", value) 1607 1608 } 1609 } 1610 1611 default: 1612 _, _ = key, value 1613 1614 } 1615 } 1616 *v = sv 1617 return nil 1618} 1619 1620type awsRestjson1_deserializeOpGetResourceCollection struct { 1621} 1622 1623func (*awsRestjson1_deserializeOpGetResourceCollection) ID() string { 1624 return "OperationDeserializer" 1625} 1626 1627func (m *awsRestjson1_deserializeOpGetResourceCollection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1628 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1629) { 1630 out, metadata, err = next.HandleDeserialize(ctx, in) 1631 if err != nil { 1632 return out, metadata, err 1633 } 1634 1635 response, ok := out.RawResponse.(*smithyhttp.Response) 1636 if !ok { 1637 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1638 } 1639 1640 if response.StatusCode < 200 || response.StatusCode >= 300 { 1641 return out, metadata, awsRestjson1_deserializeOpErrorGetResourceCollection(response, &metadata) 1642 } 1643 output := &GetResourceCollectionOutput{} 1644 out.Result = output 1645 1646 var buff [1024]byte 1647 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1648 1649 body := io.TeeReader(response.Body, ringBuffer) 1650 1651 decoder := json.NewDecoder(body) 1652 decoder.UseNumber() 1653 var shape interface{} 1654 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1655 var snapshot bytes.Buffer 1656 io.Copy(&snapshot, ringBuffer) 1657 err = &smithy.DeserializationError{ 1658 Err: fmt.Errorf("failed to decode response body, %w", err), 1659 Snapshot: snapshot.Bytes(), 1660 } 1661 return out, metadata, err 1662 } 1663 1664 err = awsRestjson1_deserializeOpDocumentGetResourceCollectionOutput(&output, shape) 1665 if err != nil { 1666 var snapshot bytes.Buffer 1667 io.Copy(&snapshot, ringBuffer) 1668 return out, metadata, &smithy.DeserializationError{ 1669 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1670 Snapshot: snapshot.Bytes(), 1671 } 1672 } 1673 1674 return out, metadata, err 1675} 1676 1677func awsRestjson1_deserializeOpErrorGetResourceCollection(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1678 var errorBuffer bytes.Buffer 1679 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1680 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1681 } 1682 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1683 1684 errorCode := "UnknownError" 1685 errorMessage := errorCode 1686 1687 code := response.Header.Get("X-Amzn-ErrorType") 1688 if len(code) != 0 { 1689 errorCode = restjson.SanitizeErrorCode(code) 1690 } 1691 1692 var buff [1024]byte 1693 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1694 1695 body := io.TeeReader(errorBody, ringBuffer) 1696 decoder := json.NewDecoder(body) 1697 decoder.UseNumber() 1698 code, message, err := restjson.GetErrorInfo(decoder) 1699 if err != nil { 1700 var snapshot bytes.Buffer 1701 io.Copy(&snapshot, ringBuffer) 1702 err = &smithy.DeserializationError{ 1703 Err: fmt.Errorf("failed to decode response body, %w", err), 1704 Snapshot: snapshot.Bytes(), 1705 } 1706 return err 1707 } 1708 1709 errorBody.Seek(0, io.SeekStart) 1710 if len(code) != 0 { 1711 errorCode = restjson.SanitizeErrorCode(code) 1712 } 1713 if len(message) != 0 { 1714 errorMessage = message 1715 } 1716 1717 switch { 1718 case strings.EqualFold("AccessDeniedException", errorCode): 1719 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1720 1721 case strings.EqualFold("InternalServerException", errorCode): 1722 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1723 1724 case strings.EqualFold("ResourceNotFoundException", errorCode): 1725 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1726 1727 case strings.EqualFold("ThrottlingException", errorCode): 1728 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1729 1730 case strings.EqualFold("ValidationException", errorCode): 1731 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1732 1733 default: 1734 genericError := &smithy.GenericAPIError{ 1735 Code: errorCode, 1736 Message: errorMessage, 1737 } 1738 return genericError 1739 1740 } 1741} 1742 1743func awsRestjson1_deserializeOpDocumentGetResourceCollectionOutput(v **GetResourceCollectionOutput, value interface{}) error { 1744 if v == nil { 1745 return fmt.Errorf("unexpected nil of type %T", v) 1746 } 1747 if value == nil { 1748 return nil 1749 } 1750 1751 shape, ok := value.(map[string]interface{}) 1752 if !ok { 1753 return fmt.Errorf("unexpected JSON type %v", value) 1754 } 1755 1756 var sv *GetResourceCollectionOutput 1757 if *v == nil { 1758 sv = &GetResourceCollectionOutput{} 1759 } else { 1760 sv = *v 1761 } 1762 1763 for key, value := range shape { 1764 switch key { 1765 case "NextToken": 1766 if value != nil { 1767 jtv, ok := value.(string) 1768 if !ok { 1769 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 1770 } 1771 sv.NextToken = ptr.String(jtv) 1772 } 1773 1774 case "ResourceCollection": 1775 if err := awsRestjson1_deserializeDocumentResourceCollectionFilter(&sv.ResourceCollection, value); err != nil { 1776 return err 1777 } 1778 1779 default: 1780 _, _ = key, value 1781 1782 } 1783 } 1784 *v = sv 1785 return nil 1786} 1787 1788type awsRestjson1_deserializeOpListAnomaliesForInsight struct { 1789} 1790 1791func (*awsRestjson1_deserializeOpListAnomaliesForInsight) ID() string { 1792 return "OperationDeserializer" 1793} 1794 1795func (m *awsRestjson1_deserializeOpListAnomaliesForInsight) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1796 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1797) { 1798 out, metadata, err = next.HandleDeserialize(ctx, in) 1799 if err != nil { 1800 return out, metadata, err 1801 } 1802 1803 response, ok := out.RawResponse.(*smithyhttp.Response) 1804 if !ok { 1805 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1806 } 1807 1808 if response.StatusCode < 200 || response.StatusCode >= 300 { 1809 return out, metadata, awsRestjson1_deserializeOpErrorListAnomaliesForInsight(response, &metadata) 1810 } 1811 output := &ListAnomaliesForInsightOutput{} 1812 out.Result = output 1813 1814 var buff [1024]byte 1815 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1816 1817 body := io.TeeReader(response.Body, ringBuffer) 1818 1819 decoder := json.NewDecoder(body) 1820 decoder.UseNumber() 1821 var shape interface{} 1822 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1823 var snapshot bytes.Buffer 1824 io.Copy(&snapshot, ringBuffer) 1825 err = &smithy.DeserializationError{ 1826 Err: fmt.Errorf("failed to decode response body, %w", err), 1827 Snapshot: snapshot.Bytes(), 1828 } 1829 return out, metadata, err 1830 } 1831 1832 err = awsRestjson1_deserializeOpDocumentListAnomaliesForInsightOutput(&output, shape) 1833 if err != nil { 1834 var snapshot bytes.Buffer 1835 io.Copy(&snapshot, ringBuffer) 1836 return out, metadata, &smithy.DeserializationError{ 1837 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 1838 Snapshot: snapshot.Bytes(), 1839 } 1840 } 1841 1842 return out, metadata, err 1843} 1844 1845func awsRestjson1_deserializeOpErrorListAnomaliesForInsight(response *smithyhttp.Response, metadata *middleware.Metadata) error { 1846 var errorBuffer bytes.Buffer 1847 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 1848 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 1849 } 1850 errorBody := bytes.NewReader(errorBuffer.Bytes()) 1851 1852 errorCode := "UnknownError" 1853 errorMessage := errorCode 1854 1855 code := response.Header.Get("X-Amzn-ErrorType") 1856 if len(code) != 0 { 1857 errorCode = restjson.SanitizeErrorCode(code) 1858 } 1859 1860 var buff [1024]byte 1861 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1862 1863 body := io.TeeReader(errorBody, ringBuffer) 1864 decoder := json.NewDecoder(body) 1865 decoder.UseNumber() 1866 code, message, err := restjson.GetErrorInfo(decoder) 1867 if err != nil { 1868 var snapshot bytes.Buffer 1869 io.Copy(&snapshot, ringBuffer) 1870 err = &smithy.DeserializationError{ 1871 Err: fmt.Errorf("failed to decode response body, %w", err), 1872 Snapshot: snapshot.Bytes(), 1873 } 1874 return err 1875 } 1876 1877 errorBody.Seek(0, io.SeekStart) 1878 if len(code) != 0 { 1879 errorCode = restjson.SanitizeErrorCode(code) 1880 } 1881 if len(message) != 0 { 1882 errorMessage = message 1883 } 1884 1885 switch { 1886 case strings.EqualFold("AccessDeniedException", errorCode): 1887 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 1888 1889 case strings.EqualFold("InternalServerException", errorCode): 1890 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 1891 1892 case strings.EqualFold("ResourceNotFoundException", errorCode): 1893 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 1894 1895 case strings.EqualFold("ThrottlingException", errorCode): 1896 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 1897 1898 case strings.EqualFold("ValidationException", errorCode): 1899 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 1900 1901 default: 1902 genericError := &smithy.GenericAPIError{ 1903 Code: errorCode, 1904 Message: errorMessage, 1905 } 1906 return genericError 1907 1908 } 1909} 1910 1911func awsRestjson1_deserializeOpDocumentListAnomaliesForInsightOutput(v **ListAnomaliesForInsightOutput, value interface{}) error { 1912 if v == nil { 1913 return fmt.Errorf("unexpected nil of type %T", v) 1914 } 1915 if value == nil { 1916 return nil 1917 } 1918 1919 shape, ok := value.(map[string]interface{}) 1920 if !ok { 1921 return fmt.Errorf("unexpected JSON type %v", value) 1922 } 1923 1924 var sv *ListAnomaliesForInsightOutput 1925 if *v == nil { 1926 sv = &ListAnomaliesForInsightOutput{} 1927 } else { 1928 sv = *v 1929 } 1930 1931 for key, value := range shape { 1932 switch key { 1933 case "NextToken": 1934 if value != nil { 1935 jtv, ok := value.(string) 1936 if !ok { 1937 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 1938 } 1939 sv.NextToken = ptr.String(jtv) 1940 } 1941 1942 case "ProactiveAnomalies": 1943 if err := awsRestjson1_deserializeDocumentProactiveAnomalies(&sv.ProactiveAnomalies, value); err != nil { 1944 return err 1945 } 1946 1947 case "ReactiveAnomalies": 1948 if err := awsRestjson1_deserializeDocumentReactiveAnomalies(&sv.ReactiveAnomalies, value); err != nil { 1949 return err 1950 } 1951 1952 default: 1953 _, _ = key, value 1954 1955 } 1956 } 1957 *v = sv 1958 return nil 1959} 1960 1961type awsRestjson1_deserializeOpListEvents struct { 1962} 1963 1964func (*awsRestjson1_deserializeOpListEvents) ID() string { 1965 return "OperationDeserializer" 1966} 1967 1968func (m *awsRestjson1_deserializeOpListEvents) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 1969 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 1970) { 1971 out, metadata, err = next.HandleDeserialize(ctx, in) 1972 if err != nil { 1973 return out, metadata, err 1974 } 1975 1976 response, ok := out.RawResponse.(*smithyhttp.Response) 1977 if !ok { 1978 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 1979 } 1980 1981 if response.StatusCode < 200 || response.StatusCode >= 300 { 1982 return out, metadata, awsRestjson1_deserializeOpErrorListEvents(response, &metadata) 1983 } 1984 output := &ListEventsOutput{} 1985 out.Result = output 1986 1987 var buff [1024]byte 1988 ringBuffer := smithyio.NewRingBuffer(buff[:]) 1989 1990 body := io.TeeReader(response.Body, ringBuffer) 1991 1992 decoder := json.NewDecoder(body) 1993 decoder.UseNumber() 1994 var shape interface{} 1995 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 1996 var snapshot bytes.Buffer 1997 io.Copy(&snapshot, ringBuffer) 1998 err = &smithy.DeserializationError{ 1999 Err: fmt.Errorf("failed to decode response body, %w", err), 2000 Snapshot: snapshot.Bytes(), 2001 } 2002 return out, metadata, err 2003 } 2004 2005 err = awsRestjson1_deserializeOpDocumentListEventsOutput(&output, shape) 2006 if err != nil { 2007 var snapshot bytes.Buffer 2008 io.Copy(&snapshot, ringBuffer) 2009 return out, metadata, &smithy.DeserializationError{ 2010 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2011 Snapshot: snapshot.Bytes(), 2012 } 2013 } 2014 2015 return out, metadata, err 2016} 2017 2018func awsRestjson1_deserializeOpErrorListEvents(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2019 var errorBuffer bytes.Buffer 2020 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2021 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2022 } 2023 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2024 2025 errorCode := "UnknownError" 2026 errorMessage := errorCode 2027 2028 code := response.Header.Get("X-Amzn-ErrorType") 2029 if len(code) != 0 { 2030 errorCode = restjson.SanitizeErrorCode(code) 2031 } 2032 2033 var buff [1024]byte 2034 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2035 2036 body := io.TeeReader(errorBody, ringBuffer) 2037 decoder := json.NewDecoder(body) 2038 decoder.UseNumber() 2039 code, message, err := restjson.GetErrorInfo(decoder) 2040 if err != nil { 2041 var snapshot bytes.Buffer 2042 io.Copy(&snapshot, ringBuffer) 2043 err = &smithy.DeserializationError{ 2044 Err: fmt.Errorf("failed to decode response body, %w", err), 2045 Snapshot: snapshot.Bytes(), 2046 } 2047 return err 2048 } 2049 2050 errorBody.Seek(0, io.SeekStart) 2051 if len(code) != 0 { 2052 errorCode = restjson.SanitizeErrorCode(code) 2053 } 2054 if len(message) != 0 { 2055 errorMessage = message 2056 } 2057 2058 switch { 2059 case strings.EqualFold("AccessDeniedException", errorCode): 2060 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2061 2062 case strings.EqualFold("InternalServerException", errorCode): 2063 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2064 2065 case strings.EqualFold("ResourceNotFoundException", errorCode): 2066 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2067 2068 case strings.EqualFold("ThrottlingException", errorCode): 2069 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2070 2071 case strings.EqualFold("ValidationException", errorCode): 2072 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2073 2074 default: 2075 genericError := &smithy.GenericAPIError{ 2076 Code: errorCode, 2077 Message: errorMessage, 2078 } 2079 return genericError 2080 2081 } 2082} 2083 2084func awsRestjson1_deserializeOpDocumentListEventsOutput(v **ListEventsOutput, value interface{}) error { 2085 if v == nil { 2086 return fmt.Errorf("unexpected nil of type %T", v) 2087 } 2088 if value == nil { 2089 return nil 2090 } 2091 2092 shape, ok := value.(map[string]interface{}) 2093 if !ok { 2094 return fmt.Errorf("unexpected JSON type %v", value) 2095 } 2096 2097 var sv *ListEventsOutput 2098 if *v == nil { 2099 sv = &ListEventsOutput{} 2100 } else { 2101 sv = *v 2102 } 2103 2104 for key, value := range shape { 2105 switch key { 2106 case "Events": 2107 if err := awsRestjson1_deserializeDocumentEvents(&sv.Events, value); err != nil { 2108 return err 2109 } 2110 2111 case "NextToken": 2112 if value != nil { 2113 jtv, ok := value.(string) 2114 if !ok { 2115 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 2116 } 2117 sv.NextToken = ptr.String(jtv) 2118 } 2119 2120 default: 2121 _, _ = key, value 2122 2123 } 2124 } 2125 *v = sv 2126 return nil 2127} 2128 2129type awsRestjson1_deserializeOpListInsights struct { 2130} 2131 2132func (*awsRestjson1_deserializeOpListInsights) ID() string { 2133 return "OperationDeserializer" 2134} 2135 2136func (m *awsRestjson1_deserializeOpListInsights) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2137 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2138) { 2139 out, metadata, err = next.HandleDeserialize(ctx, in) 2140 if err != nil { 2141 return out, metadata, err 2142 } 2143 2144 response, ok := out.RawResponse.(*smithyhttp.Response) 2145 if !ok { 2146 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2147 } 2148 2149 if response.StatusCode < 200 || response.StatusCode >= 300 { 2150 return out, metadata, awsRestjson1_deserializeOpErrorListInsights(response, &metadata) 2151 } 2152 output := &ListInsightsOutput{} 2153 out.Result = output 2154 2155 var buff [1024]byte 2156 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2157 2158 body := io.TeeReader(response.Body, ringBuffer) 2159 2160 decoder := json.NewDecoder(body) 2161 decoder.UseNumber() 2162 var shape interface{} 2163 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2164 var snapshot bytes.Buffer 2165 io.Copy(&snapshot, ringBuffer) 2166 err = &smithy.DeserializationError{ 2167 Err: fmt.Errorf("failed to decode response body, %w", err), 2168 Snapshot: snapshot.Bytes(), 2169 } 2170 return out, metadata, err 2171 } 2172 2173 err = awsRestjson1_deserializeOpDocumentListInsightsOutput(&output, shape) 2174 if err != nil { 2175 var snapshot bytes.Buffer 2176 io.Copy(&snapshot, ringBuffer) 2177 return out, metadata, &smithy.DeserializationError{ 2178 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2179 Snapshot: snapshot.Bytes(), 2180 } 2181 } 2182 2183 return out, metadata, err 2184} 2185 2186func awsRestjson1_deserializeOpErrorListInsights(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2187 var errorBuffer bytes.Buffer 2188 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2189 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2190 } 2191 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2192 2193 errorCode := "UnknownError" 2194 errorMessage := errorCode 2195 2196 code := response.Header.Get("X-Amzn-ErrorType") 2197 if len(code) != 0 { 2198 errorCode = restjson.SanitizeErrorCode(code) 2199 } 2200 2201 var buff [1024]byte 2202 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2203 2204 body := io.TeeReader(errorBody, ringBuffer) 2205 decoder := json.NewDecoder(body) 2206 decoder.UseNumber() 2207 code, message, err := restjson.GetErrorInfo(decoder) 2208 if err != nil { 2209 var snapshot bytes.Buffer 2210 io.Copy(&snapshot, ringBuffer) 2211 err = &smithy.DeserializationError{ 2212 Err: fmt.Errorf("failed to decode response body, %w", err), 2213 Snapshot: snapshot.Bytes(), 2214 } 2215 return err 2216 } 2217 2218 errorBody.Seek(0, io.SeekStart) 2219 if len(code) != 0 { 2220 errorCode = restjson.SanitizeErrorCode(code) 2221 } 2222 if len(message) != 0 { 2223 errorMessage = message 2224 } 2225 2226 switch { 2227 case strings.EqualFold("AccessDeniedException", errorCode): 2228 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2229 2230 case strings.EqualFold("InternalServerException", errorCode): 2231 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2232 2233 case strings.EqualFold("ThrottlingException", errorCode): 2234 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2235 2236 case strings.EqualFold("ValidationException", errorCode): 2237 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2238 2239 default: 2240 genericError := &smithy.GenericAPIError{ 2241 Code: errorCode, 2242 Message: errorMessage, 2243 } 2244 return genericError 2245 2246 } 2247} 2248 2249func awsRestjson1_deserializeOpDocumentListInsightsOutput(v **ListInsightsOutput, value interface{}) error { 2250 if v == nil { 2251 return fmt.Errorf("unexpected nil of type %T", v) 2252 } 2253 if value == nil { 2254 return nil 2255 } 2256 2257 shape, ok := value.(map[string]interface{}) 2258 if !ok { 2259 return fmt.Errorf("unexpected JSON type %v", value) 2260 } 2261 2262 var sv *ListInsightsOutput 2263 if *v == nil { 2264 sv = &ListInsightsOutput{} 2265 } else { 2266 sv = *v 2267 } 2268 2269 for key, value := range shape { 2270 switch key { 2271 case "NextToken": 2272 if value != nil { 2273 jtv, ok := value.(string) 2274 if !ok { 2275 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 2276 } 2277 sv.NextToken = ptr.String(jtv) 2278 } 2279 2280 case "ProactiveInsights": 2281 if err := awsRestjson1_deserializeDocumentProactiveInsights(&sv.ProactiveInsights, value); err != nil { 2282 return err 2283 } 2284 2285 case "ReactiveInsights": 2286 if err := awsRestjson1_deserializeDocumentReactiveInsights(&sv.ReactiveInsights, value); err != nil { 2287 return err 2288 } 2289 2290 default: 2291 _, _ = key, value 2292 2293 } 2294 } 2295 *v = sv 2296 return nil 2297} 2298 2299type awsRestjson1_deserializeOpListNotificationChannels struct { 2300} 2301 2302func (*awsRestjson1_deserializeOpListNotificationChannels) ID() string { 2303 return "OperationDeserializer" 2304} 2305 2306func (m *awsRestjson1_deserializeOpListNotificationChannels) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2307 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2308) { 2309 out, metadata, err = next.HandleDeserialize(ctx, in) 2310 if err != nil { 2311 return out, metadata, err 2312 } 2313 2314 response, ok := out.RawResponse.(*smithyhttp.Response) 2315 if !ok { 2316 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2317 } 2318 2319 if response.StatusCode < 200 || response.StatusCode >= 300 { 2320 return out, metadata, awsRestjson1_deserializeOpErrorListNotificationChannels(response, &metadata) 2321 } 2322 output := &ListNotificationChannelsOutput{} 2323 out.Result = output 2324 2325 var buff [1024]byte 2326 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2327 2328 body := io.TeeReader(response.Body, ringBuffer) 2329 2330 decoder := json.NewDecoder(body) 2331 decoder.UseNumber() 2332 var shape interface{} 2333 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2334 var snapshot bytes.Buffer 2335 io.Copy(&snapshot, ringBuffer) 2336 err = &smithy.DeserializationError{ 2337 Err: fmt.Errorf("failed to decode response body, %w", err), 2338 Snapshot: snapshot.Bytes(), 2339 } 2340 return out, metadata, err 2341 } 2342 2343 err = awsRestjson1_deserializeOpDocumentListNotificationChannelsOutput(&output, shape) 2344 if err != nil { 2345 var snapshot bytes.Buffer 2346 io.Copy(&snapshot, ringBuffer) 2347 return out, metadata, &smithy.DeserializationError{ 2348 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2349 Snapshot: snapshot.Bytes(), 2350 } 2351 } 2352 2353 return out, metadata, err 2354} 2355 2356func awsRestjson1_deserializeOpErrorListNotificationChannels(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2357 var errorBuffer bytes.Buffer 2358 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2359 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2360 } 2361 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2362 2363 errorCode := "UnknownError" 2364 errorMessage := errorCode 2365 2366 code := response.Header.Get("X-Amzn-ErrorType") 2367 if len(code) != 0 { 2368 errorCode = restjson.SanitizeErrorCode(code) 2369 } 2370 2371 var buff [1024]byte 2372 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2373 2374 body := io.TeeReader(errorBody, ringBuffer) 2375 decoder := json.NewDecoder(body) 2376 decoder.UseNumber() 2377 code, message, err := restjson.GetErrorInfo(decoder) 2378 if err != nil { 2379 var snapshot bytes.Buffer 2380 io.Copy(&snapshot, ringBuffer) 2381 err = &smithy.DeserializationError{ 2382 Err: fmt.Errorf("failed to decode response body, %w", err), 2383 Snapshot: snapshot.Bytes(), 2384 } 2385 return err 2386 } 2387 2388 errorBody.Seek(0, io.SeekStart) 2389 if len(code) != 0 { 2390 errorCode = restjson.SanitizeErrorCode(code) 2391 } 2392 if len(message) != 0 { 2393 errorMessage = message 2394 } 2395 2396 switch { 2397 case strings.EqualFold("AccessDeniedException", errorCode): 2398 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2399 2400 case strings.EqualFold("InternalServerException", errorCode): 2401 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2402 2403 case strings.EqualFold("ThrottlingException", errorCode): 2404 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2405 2406 case strings.EqualFold("ValidationException", errorCode): 2407 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2408 2409 default: 2410 genericError := &smithy.GenericAPIError{ 2411 Code: errorCode, 2412 Message: errorMessage, 2413 } 2414 return genericError 2415 2416 } 2417} 2418 2419func awsRestjson1_deserializeOpDocumentListNotificationChannelsOutput(v **ListNotificationChannelsOutput, value interface{}) error { 2420 if v == nil { 2421 return fmt.Errorf("unexpected nil of type %T", v) 2422 } 2423 if value == nil { 2424 return nil 2425 } 2426 2427 shape, ok := value.(map[string]interface{}) 2428 if !ok { 2429 return fmt.Errorf("unexpected JSON type %v", value) 2430 } 2431 2432 var sv *ListNotificationChannelsOutput 2433 if *v == nil { 2434 sv = &ListNotificationChannelsOutput{} 2435 } else { 2436 sv = *v 2437 } 2438 2439 for key, value := range shape { 2440 switch key { 2441 case "Channels": 2442 if err := awsRestjson1_deserializeDocumentChannels(&sv.Channels, value); err != nil { 2443 return err 2444 } 2445 2446 case "NextToken": 2447 if value != nil { 2448 jtv, ok := value.(string) 2449 if !ok { 2450 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 2451 } 2452 sv.NextToken = ptr.String(jtv) 2453 } 2454 2455 default: 2456 _, _ = key, value 2457 2458 } 2459 } 2460 *v = sv 2461 return nil 2462} 2463 2464type awsRestjson1_deserializeOpListRecommendations struct { 2465} 2466 2467func (*awsRestjson1_deserializeOpListRecommendations) ID() string { 2468 return "OperationDeserializer" 2469} 2470 2471func (m *awsRestjson1_deserializeOpListRecommendations) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2472 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2473) { 2474 out, metadata, err = next.HandleDeserialize(ctx, in) 2475 if err != nil { 2476 return out, metadata, err 2477 } 2478 2479 response, ok := out.RawResponse.(*smithyhttp.Response) 2480 if !ok { 2481 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2482 } 2483 2484 if response.StatusCode < 200 || response.StatusCode >= 300 { 2485 return out, metadata, awsRestjson1_deserializeOpErrorListRecommendations(response, &metadata) 2486 } 2487 output := &ListRecommendationsOutput{} 2488 out.Result = output 2489 2490 var buff [1024]byte 2491 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2492 2493 body := io.TeeReader(response.Body, ringBuffer) 2494 2495 decoder := json.NewDecoder(body) 2496 decoder.UseNumber() 2497 var shape interface{} 2498 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2499 var snapshot bytes.Buffer 2500 io.Copy(&snapshot, ringBuffer) 2501 err = &smithy.DeserializationError{ 2502 Err: fmt.Errorf("failed to decode response body, %w", err), 2503 Snapshot: snapshot.Bytes(), 2504 } 2505 return out, metadata, err 2506 } 2507 2508 err = awsRestjson1_deserializeOpDocumentListRecommendationsOutput(&output, shape) 2509 if err != nil { 2510 var snapshot bytes.Buffer 2511 io.Copy(&snapshot, ringBuffer) 2512 return out, metadata, &smithy.DeserializationError{ 2513 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2514 Snapshot: snapshot.Bytes(), 2515 } 2516 } 2517 2518 return out, metadata, err 2519} 2520 2521func awsRestjson1_deserializeOpErrorListRecommendations(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2522 var errorBuffer bytes.Buffer 2523 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2524 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2525 } 2526 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2527 2528 errorCode := "UnknownError" 2529 errorMessage := errorCode 2530 2531 code := response.Header.Get("X-Amzn-ErrorType") 2532 if len(code) != 0 { 2533 errorCode = restjson.SanitizeErrorCode(code) 2534 } 2535 2536 var buff [1024]byte 2537 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2538 2539 body := io.TeeReader(errorBody, ringBuffer) 2540 decoder := json.NewDecoder(body) 2541 decoder.UseNumber() 2542 code, message, err := restjson.GetErrorInfo(decoder) 2543 if err != nil { 2544 var snapshot bytes.Buffer 2545 io.Copy(&snapshot, ringBuffer) 2546 err = &smithy.DeserializationError{ 2547 Err: fmt.Errorf("failed to decode response body, %w", err), 2548 Snapshot: snapshot.Bytes(), 2549 } 2550 return err 2551 } 2552 2553 errorBody.Seek(0, io.SeekStart) 2554 if len(code) != 0 { 2555 errorCode = restjson.SanitizeErrorCode(code) 2556 } 2557 if len(message) != 0 { 2558 errorMessage = message 2559 } 2560 2561 switch { 2562 case strings.EqualFold("AccessDeniedException", errorCode): 2563 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2564 2565 case strings.EqualFold("InternalServerException", errorCode): 2566 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2567 2568 case strings.EqualFold("ResourceNotFoundException", errorCode): 2569 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2570 2571 case strings.EqualFold("ThrottlingException", errorCode): 2572 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2573 2574 case strings.EqualFold("ValidationException", errorCode): 2575 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2576 2577 default: 2578 genericError := &smithy.GenericAPIError{ 2579 Code: errorCode, 2580 Message: errorMessage, 2581 } 2582 return genericError 2583 2584 } 2585} 2586 2587func awsRestjson1_deserializeOpDocumentListRecommendationsOutput(v **ListRecommendationsOutput, value interface{}) error { 2588 if v == nil { 2589 return fmt.Errorf("unexpected nil of type %T", v) 2590 } 2591 if value == nil { 2592 return nil 2593 } 2594 2595 shape, ok := value.(map[string]interface{}) 2596 if !ok { 2597 return fmt.Errorf("unexpected JSON type %v", value) 2598 } 2599 2600 var sv *ListRecommendationsOutput 2601 if *v == nil { 2602 sv = &ListRecommendationsOutput{} 2603 } else { 2604 sv = *v 2605 } 2606 2607 for key, value := range shape { 2608 switch key { 2609 case "NextToken": 2610 if value != nil { 2611 jtv, ok := value.(string) 2612 if !ok { 2613 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 2614 } 2615 sv.NextToken = ptr.String(jtv) 2616 } 2617 2618 case "Recommendations": 2619 if err := awsRestjson1_deserializeDocumentRecommendations(&sv.Recommendations, value); err != nil { 2620 return err 2621 } 2622 2623 default: 2624 _, _ = key, value 2625 2626 } 2627 } 2628 *v = sv 2629 return nil 2630} 2631 2632type awsRestjson1_deserializeOpPutFeedback struct { 2633} 2634 2635func (*awsRestjson1_deserializeOpPutFeedback) ID() string { 2636 return "OperationDeserializer" 2637} 2638 2639func (m *awsRestjson1_deserializeOpPutFeedback) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2640 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2641) { 2642 out, metadata, err = next.HandleDeserialize(ctx, in) 2643 if err != nil { 2644 return out, metadata, err 2645 } 2646 2647 response, ok := out.RawResponse.(*smithyhttp.Response) 2648 if !ok { 2649 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2650 } 2651 2652 if response.StatusCode < 200 || response.StatusCode >= 300 { 2653 return out, metadata, awsRestjson1_deserializeOpErrorPutFeedback(response, &metadata) 2654 } 2655 output := &PutFeedbackOutput{} 2656 out.Result = output 2657 2658 return out, metadata, err 2659} 2660 2661func awsRestjson1_deserializeOpErrorPutFeedback(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2662 var errorBuffer bytes.Buffer 2663 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2664 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2665 } 2666 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2667 2668 errorCode := "UnknownError" 2669 errorMessage := errorCode 2670 2671 code := response.Header.Get("X-Amzn-ErrorType") 2672 if len(code) != 0 { 2673 errorCode = restjson.SanitizeErrorCode(code) 2674 } 2675 2676 var buff [1024]byte 2677 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2678 2679 body := io.TeeReader(errorBody, ringBuffer) 2680 decoder := json.NewDecoder(body) 2681 decoder.UseNumber() 2682 code, message, err := restjson.GetErrorInfo(decoder) 2683 if err != nil { 2684 var snapshot bytes.Buffer 2685 io.Copy(&snapshot, ringBuffer) 2686 err = &smithy.DeserializationError{ 2687 Err: fmt.Errorf("failed to decode response body, %w", err), 2688 Snapshot: snapshot.Bytes(), 2689 } 2690 return err 2691 } 2692 2693 errorBody.Seek(0, io.SeekStart) 2694 if len(code) != 0 { 2695 errorCode = restjson.SanitizeErrorCode(code) 2696 } 2697 if len(message) != 0 { 2698 errorMessage = message 2699 } 2700 2701 switch { 2702 case strings.EqualFold("AccessDeniedException", errorCode): 2703 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2704 2705 case strings.EqualFold("ConflictException", errorCode): 2706 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2707 2708 case strings.EqualFold("InternalServerException", errorCode): 2709 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2710 2711 case strings.EqualFold("ResourceNotFoundException", errorCode): 2712 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2713 2714 case strings.EqualFold("ThrottlingException", errorCode): 2715 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2716 2717 case strings.EqualFold("ValidationException", errorCode): 2718 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2719 2720 default: 2721 genericError := &smithy.GenericAPIError{ 2722 Code: errorCode, 2723 Message: errorMessage, 2724 } 2725 return genericError 2726 2727 } 2728} 2729 2730type awsRestjson1_deserializeOpRemoveNotificationChannel struct { 2731} 2732 2733func (*awsRestjson1_deserializeOpRemoveNotificationChannel) ID() string { 2734 return "OperationDeserializer" 2735} 2736 2737func (m *awsRestjson1_deserializeOpRemoveNotificationChannel) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2738 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2739) { 2740 out, metadata, err = next.HandleDeserialize(ctx, in) 2741 if err != nil { 2742 return out, metadata, err 2743 } 2744 2745 response, ok := out.RawResponse.(*smithyhttp.Response) 2746 if !ok { 2747 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2748 } 2749 2750 if response.StatusCode < 200 || response.StatusCode >= 300 { 2751 return out, metadata, awsRestjson1_deserializeOpErrorRemoveNotificationChannel(response, &metadata) 2752 } 2753 output := &RemoveNotificationChannelOutput{} 2754 out.Result = output 2755 2756 return out, metadata, err 2757} 2758 2759func awsRestjson1_deserializeOpErrorRemoveNotificationChannel(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2760 var errorBuffer bytes.Buffer 2761 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2762 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2763 } 2764 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2765 2766 errorCode := "UnknownError" 2767 errorMessage := errorCode 2768 2769 code := response.Header.Get("X-Amzn-ErrorType") 2770 if len(code) != 0 { 2771 errorCode = restjson.SanitizeErrorCode(code) 2772 } 2773 2774 var buff [1024]byte 2775 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2776 2777 body := io.TeeReader(errorBody, ringBuffer) 2778 decoder := json.NewDecoder(body) 2779 decoder.UseNumber() 2780 code, message, err := restjson.GetErrorInfo(decoder) 2781 if err != nil { 2782 var snapshot bytes.Buffer 2783 io.Copy(&snapshot, ringBuffer) 2784 err = &smithy.DeserializationError{ 2785 Err: fmt.Errorf("failed to decode response body, %w", err), 2786 Snapshot: snapshot.Bytes(), 2787 } 2788 return err 2789 } 2790 2791 errorBody.Seek(0, io.SeekStart) 2792 if len(code) != 0 { 2793 errorCode = restjson.SanitizeErrorCode(code) 2794 } 2795 if len(message) != 0 { 2796 errorMessage = message 2797 } 2798 2799 switch { 2800 case strings.EqualFold("AccessDeniedException", errorCode): 2801 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2802 2803 case strings.EqualFold("ConflictException", errorCode): 2804 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 2805 2806 case strings.EqualFold("InternalServerException", errorCode): 2807 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2808 2809 case strings.EqualFold("ResourceNotFoundException", errorCode): 2810 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 2811 2812 case strings.EqualFold("ThrottlingException", errorCode): 2813 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2814 2815 case strings.EqualFold("ValidationException", errorCode): 2816 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2817 2818 default: 2819 genericError := &smithy.GenericAPIError{ 2820 Code: errorCode, 2821 Message: errorMessage, 2822 } 2823 return genericError 2824 2825 } 2826} 2827 2828type awsRestjson1_deserializeOpSearchInsights struct { 2829} 2830 2831func (*awsRestjson1_deserializeOpSearchInsights) ID() string { 2832 return "OperationDeserializer" 2833} 2834 2835func (m *awsRestjson1_deserializeOpSearchInsights) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 2836 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 2837) { 2838 out, metadata, err = next.HandleDeserialize(ctx, in) 2839 if err != nil { 2840 return out, metadata, err 2841 } 2842 2843 response, ok := out.RawResponse.(*smithyhttp.Response) 2844 if !ok { 2845 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 2846 } 2847 2848 if response.StatusCode < 200 || response.StatusCode >= 300 { 2849 return out, metadata, awsRestjson1_deserializeOpErrorSearchInsights(response, &metadata) 2850 } 2851 output := &SearchInsightsOutput{} 2852 out.Result = output 2853 2854 var buff [1024]byte 2855 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2856 2857 body := io.TeeReader(response.Body, ringBuffer) 2858 2859 decoder := json.NewDecoder(body) 2860 decoder.UseNumber() 2861 var shape interface{} 2862 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 2863 var snapshot bytes.Buffer 2864 io.Copy(&snapshot, ringBuffer) 2865 err = &smithy.DeserializationError{ 2866 Err: fmt.Errorf("failed to decode response body, %w", err), 2867 Snapshot: snapshot.Bytes(), 2868 } 2869 return out, metadata, err 2870 } 2871 2872 err = awsRestjson1_deserializeOpDocumentSearchInsightsOutput(&output, shape) 2873 if err != nil { 2874 var snapshot bytes.Buffer 2875 io.Copy(&snapshot, ringBuffer) 2876 return out, metadata, &smithy.DeserializationError{ 2877 Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), 2878 Snapshot: snapshot.Bytes(), 2879 } 2880 } 2881 2882 return out, metadata, err 2883} 2884 2885func awsRestjson1_deserializeOpErrorSearchInsights(response *smithyhttp.Response, metadata *middleware.Metadata) error { 2886 var errorBuffer bytes.Buffer 2887 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 2888 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 2889 } 2890 errorBody := bytes.NewReader(errorBuffer.Bytes()) 2891 2892 errorCode := "UnknownError" 2893 errorMessage := errorCode 2894 2895 code := response.Header.Get("X-Amzn-ErrorType") 2896 if len(code) != 0 { 2897 errorCode = restjson.SanitizeErrorCode(code) 2898 } 2899 2900 var buff [1024]byte 2901 ringBuffer := smithyio.NewRingBuffer(buff[:]) 2902 2903 body := io.TeeReader(errorBody, ringBuffer) 2904 decoder := json.NewDecoder(body) 2905 decoder.UseNumber() 2906 code, message, err := restjson.GetErrorInfo(decoder) 2907 if err != nil { 2908 var snapshot bytes.Buffer 2909 io.Copy(&snapshot, ringBuffer) 2910 err = &smithy.DeserializationError{ 2911 Err: fmt.Errorf("failed to decode response body, %w", err), 2912 Snapshot: snapshot.Bytes(), 2913 } 2914 return err 2915 } 2916 2917 errorBody.Seek(0, io.SeekStart) 2918 if len(code) != 0 { 2919 errorCode = restjson.SanitizeErrorCode(code) 2920 } 2921 if len(message) != 0 { 2922 errorMessage = message 2923 } 2924 2925 switch { 2926 case strings.EqualFold("AccessDeniedException", errorCode): 2927 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 2928 2929 case strings.EqualFold("InternalServerException", errorCode): 2930 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 2931 2932 case strings.EqualFold("ThrottlingException", errorCode): 2933 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 2934 2935 case strings.EqualFold("ValidationException", errorCode): 2936 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 2937 2938 default: 2939 genericError := &smithy.GenericAPIError{ 2940 Code: errorCode, 2941 Message: errorMessage, 2942 } 2943 return genericError 2944 2945 } 2946} 2947 2948func awsRestjson1_deserializeOpDocumentSearchInsightsOutput(v **SearchInsightsOutput, value interface{}) error { 2949 if v == nil { 2950 return fmt.Errorf("unexpected nil of type %T", v) 2951 } 2952 if value == nil { 2953 return nil 2954 } 2955 2956 shape, ok := value.(map[string]interface{}) 2957 if !ok { 2958 return fmt.Errorf("unexpected JSON type %v", value) 2959 } 2960 2961 var sv *SearchInsightsOutput 2962 if *v == nil { 2963 sv = &SearchInsightsOutput{} 2964 } else { 2965 sv = *v 2966 } 2967 2968 for key, value := range shape { 2969 switch key { 2970 case "NextToken": 2971 if value != nil { 2972 jtv, ok := value.(string) 2973 if !ok { 2974 return fmt.Errorf("expected UuidNextToken to be of type string, got %T instead", value) 2975 } 2976 sv.NextToken = ptr.String(jtv) 2977 } 2978 2979 case "ProactiveInsights": 2980 if err := awsRestjson1_deserializeDocumentProactiveInsights(&sv.ProactiveInsights, value); err != nil { 2981 return err 2982 } 2983 2984 case "ReactiveInsights": 2985 if err := awsRestjson1_deserializeDocumentReactiveInsights(&sv.ReactiveInsights, value); err != nil { 2986 return err 2987 } 2988 2989 default: 2990 _, _ = key, value 2991 2992 } 2993 } 2994 *v = sv 2995 return nil 2996} 2997 2998type awsRestjson1_deserializeOpStartCostEstimation struct { 2999} 3000 3001func (*awsRestjson1_deserializeOpStartCostEstimation) ID() string { 3002 return "OperationDeserializer" 3003} 3004 3005func (m *awsRestjson1_deserializeOpStartCostEstimation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3006 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3007) { 3008 out, metadata, err = next.HandleDeserialize(ctx, in) 3009 if err != nil { 3010 return out, metadata, err 3011 } 3012 3013 response, ok := out.RawResponse.(*smithyhttp.Response) 3014 if !ok { 3015 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3016 } 3017 3018 if response.StatusCode < 200 || response.StatusCode >= 300 { 3019 return out, metadata, awsRestjson1_deserializeOpErrorStartCostEstimation(response, &metadata) 3020 } 3021 output := &StartCostEstimationOutput{} 3022 out.Result = output 3023 3024 return out, metadata, err 3025} 3026 3027func awsRestjson1_deserializeOpErrorStartCostEstimation(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3028 var errorBuffer bytes.Buffer 3029 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3030 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3031 } 3032 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3033 3034 errorCode := "UnknownError" 3035 errorMessage := errorCode 3036 3037 code := response.Header.Get("X-Amzn-ErrorType") 3038 if len(code) != 0 { 3039 errorCode = restjson.SanitizeErrorCode(code) 3040 } 3041 3042 var buff [1024]byte 3043 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3044 3045 body := io.TeeReader(errorBody, ringBuffer) 3046 decoder := json.NewDecoder(body) 3047 decoder.UseNumber() 3048 code, message, err := restjson.GetErrorInfo(decoder) 3049 if err != nil { 3050 var snapshot bytes.Buffer 3051 io.Copy(&snapshot, ringBuffer) 3052 err = &smithy.DeserializationError{ 3053 Err: fmt.Errorf("failed to decode response body, %w", err), 3054 Snapshot: snapshot.Bytes(), 3055 } 3056 return err 3057 } 3058 3059 errorBody.Seek(0, io.SeekStart) 3060 if len(code) != 0 { 3061 errorCode = restjson.SanitizeErrorCode(code) 3062 } 3063 if len(message) != 0 { 3064 errorMessage = message 3065 } 3066 3067 switch { 3068 case strings.EqualFold("AccessDeniedException", errorCode): 3069 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3070 3071 case strings.EqualFold("ConflictException", errorCode): 3072 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 3073 3074 case strings.EqualFold("InternalServerException", errorCode): 3075 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3076 3077 case strings.EqualFold("ResourceNotFoundException", errorCode): 3078 return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) 3079 3080 case strings.EqualFold("ThrottlingException", errorCode): 3081 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3082 3083 case strings.EqualFold("ValidationException", errorCode): 3084 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3085 3086 default: 3087 genericError := &smithy.GenericAPIError{ 3088 Code: errorCode, 3089 Message: errorMessage, 3090 } 3091 return genericError 3092 3093 } 3094} 3095 3096type awsRestjson1_deserializeOpUpdateResourceCollection struct { 3097} 3098 3099func (*awsRestjson1_deserializeOpUpdateResourceCollection) ID() string { 3100 return "OperationDeserializer" 3101} 3102 3103func (m *awsRestjson1_deserializeOpUpdateResourceCollection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3104 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3105) { 3106 out, metadata, err = next.HandleDeserialize(ctx, in) 3107 if err != nil { 3108 return out, metadata, err 3109 } 3110 3111 response, ok := out.RawResponse.(*smithyhttp.Response) 3112 if !ok { 3113 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3114 } 3115 3116 if response.StatusCode < 200 || response.StatusCode >= 300 { 3117 return out, metadata, awsRestjson1_deserializeOpErrorUpdateResourceCollection(response, &metadata) 3118 } 3119 output := &UpdateResourceCollectionOutput{} 3120 out.Result = output 3121 3122 return out, metadata, err 3123} 3124 3125func awsRestjson1_deserializeOpErrorUpdateResourceCollection(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3126 var errorBuffer bytes.Buffer 3127 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3128 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3129 } 3130 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3131 3132 errorCode := "UnknownError" 3133 errorMessage := errorCode 3134 3135 code := response.Header.Get("X-Amzn-ErrorType") 3136 if len(code) != 0 { 3137 errorCode = restjson.SanitizeErrorCode(code) 3138 } 3139 3140 var buff [1024]byte 3141 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3142 3143 body := io.TeeReader(errorBody, ringBuffer) 3144 decoder := json.NewDecoder(body) 3145 decoder.UseNumber() 3146 code, message, err := restjson.GetErrorInfo(decoder) 3147 if err != nil { 3148 var snapshot bytes.Buffer 3149 io.Copy(&snapshot, ringBuffer) 3150 err = &smithy.DeserializationError{ 3151 Err: fmt.Errorf("failed to decode response body, %w", err), 3152 Snapshot: snapshot.Bytes(), 3153 } 3154 return err 3155 } 3156 3157 errorBody.Seek(0, io.SeekStart) 3158 if len(code) != 0 { 3159 errorCode = restjson.SanitizeErrorCode(code) 3160 } 3161 if len(message) != 0 { 3162 errorMessage = message 3163 } 3164 3165 switch { 3166 case strings.EqualFold("AccessDeniedException", errorCode): 3167 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3168 3169 case strings.EqualFold("ConflictException", errorCode): 3170 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 3171 3172 case strings.EqualFold("InternalServerException", errorCode): 3173 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3174 3175 case strings.EqualFold("ThrottlingException", errorCode): 3176 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3177 3178 case strings.EqualFold("ValidationException", errorCode): 3179 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3180 3181 default: 3182 genericError := &smithy.GenericAPIError{ 3183 Code: errorCode, 3184 Message: errorMessage, 3185 } 3186 return genericError 3187 3188 } 3189} 3190 3191type awsRestjson1_deserializeOpUpdateServiceIntegration struct { 3192} 3193 3194func (*awsRestjson1_deserializeOpUpdateServiceIntegration) ID() string { 3195 return "OperationDeserializer" 3196} 3197 3198func (m *awsRestjson1_deserializeOpUpdateServiceIntegration) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 3199 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 3200) { 3201 out, metadata, err = next.HandleDeserialize(ctx, in) 3202 if err != nil { 3203 return out, metadata, err 3204 } 3205 3206 response, ok := out.RawResponse.(*smithyhttp.Response) 3207 if !ok { 3208 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 3209 } 3210 3211 if response.StatusCode < 200 || response.StatusCode >= 300 { 3212 return out, metadata, awsRestjson1_deserializeOpErrorUpdateServiceIntegration(response, &metadata) 3213 } 3214 output := &UpdateServiceIntegrationOutput{} 3215 out.Result = output 3216 3217 return out, metadata, err 3218} 3219 3220func awsRestjson1_deserializeOpErrorUpdateServiceIntegration(response *smithyhttp.Response, metadata *middleware.Metadata) error { 3221 var errorBuffer bytes.Buffer 3222 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 3223 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 3224 } 3225 errorBody := bytes.NewReader(errorBuffer.Bytes()) 3226 3227 errorCode := "UnknownError" 3228 errorMessage := errorCode 3229 3230 code := response.Header.Get("X-Amzn-ErrorType") 3231 if len(code) != 0 { 3232 errorCode = restjson.SanitizeErrorCode(code) 3233 } 3234 3235 var buff [1024]byte 3236 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3237 3238 body := io.TeeReader(errorBody, ringBuffer) 3239 decoder := json.NewDecoder(body) 3240 decoder.UseNumber() 3241 code, message, err := restjson.GetErrorInfo(decoder) 3242 if err != nil { 3243 var snapshot bytes.Buffer 3244 io.Copy(&snapshot, ringBuffer) 3245 err = &smithy.DeserializationError{ 3246 Err: fmt.Errorf("failed to decode response body, %w", err), 3247 Snapshot: snapshot.Bytes(), 3248 } 3249 return err 3250 } 3251 3252 errorBody.Seek(0, io.SeekStart) 3253 if len(code) != 0 { 3254 errorCode = restjson.SanitizeErrorCode(code) 3255 } 3256 if len(message) != 0 { 3257 errorMessage = message 3258 } 3259 3260 switch { 3261 case strings.EqualFold("AccessDeniedException", errorCode): 3262 return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) 3263 3264 case strings.EqualFold("ConflictException", errorCode): 3265 return awsRestjson1_deserializeErrorConflictException(response, errorBody) 3266 3267 case strings.EqualFold("InternalServerException", errorCode): 3268 return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) 3269 3270 case strings.EqualFold("ThrottlingException", errorCode): 3271 return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) 3272 3273 case strings.EqualFold("ValidationException", errorCode): 3274 return awsRestjson1_deserializeErrorValidationException(response, errorBody) 3275 3276 default: 3277 genericError := &smithy.GenericAPIError{ 3278 Code: errorCode, 3279 Message: errorMessage, 3280 } 3281 return genericError 3282 3283 } 3284} 3285 3286func awsRestjson1_deserializeOpHttpBindingsInternalServerException(v *types.InternalServerException, response *smithyhttp.Response) error { 3287 if v == nil { 3288 return fmt.Errorf("unsupported deserialization for nil %T", v) 3289 } 3290 3291 if headerValues := response.Header.Values("Retry-After"); len(headerValues) != 0 { 3292 headerValues[0] = strings.TrimSpace(headerValues[0]) 3293 vv, err := strconv.ParseInt(headerValues[0], 0, 32) 3294 if err != nil { 3295 return err 3296 } 3297 v.RetryAfterSeconds = int32(vv) 3298 } 3299 3300 return nil 3301} 3302func awsRestjson1_deserializeOpHttpBindingsThrottlingException(v *types.ThrottlingException, response *smithyhttp.Response) error { 3303 if v == nil { 3304 return fmt.Errorf("unsupported deserialization for nil %T", v) 3305 } 3306 3307 if headerValues := response.Header.Values("Retry-After"); len(headerValues) != 0 { 3308 headerValues[0] = strings.TrimSpace(headerValues[0]) 3309 vv, err := strconv.ParseInt(headerValues[0], 0, 32) 3310 if err != nil { 3311 return err 3312 } 3313 v.RetryAfterSeconds = int32(vv) 3314 } 3315 3316 return nil 3317} 3318func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3319 output := &types.AccessDeniedException{} 3320 var buff [1024]byte 3321 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3322 3323 body := io.TeeReader(errorBody, ringBuffer) 3324 decoder := json.NewDecoder(body) 3325 decoder.UseNumber() 3326 var shape interface{} 3327 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3328 var snapshot bytes.Buffer 3329 io.Copy(&snapshot, ringBuffer) 3330 err = &smithy.DeserializationError{ 3331 Err: fmt.Errorf("failed to decode response body, %w", err), 3332 Snapshot: snapshot.Bytes(), 3333 } 3334 return err 3335 } 3336 3337 err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) 3338 3339 if err != nil { 3340 var snapshot bytes.Buffer 3341 io.Copy(&snapshot, ringBuffer) 3342 err = &smithy.DeserializationError{ 3343 Err: fmt.Errorf("failed to decode response body, %w", err), 3344 Snapshot: snapshot.Bytes(), 3345 } 3346 return err 3347 } 3348 3349 errorBody.Seek(0, io.SeekStart) 3350 3351 return output 3352} 3353 3354func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3355 output := &types.ConflictException{} 3356 var buff [1024]byte 3357 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3358 3359 body := io.TeeReader(errorBody, ringBuffer) 3360 decoder := json.NewDecoder(body) 3361 decoder.UseNumber() 3362 var shape interface{} 3363 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3364 var snapshot bytes.Buffer 3365 io.Copy(&snapshot, ringBuffer) 3366 err = &smithy.DeserializationError{ 3367 Err: fmt.Errorf("failed to decode response body, %w", err), 3368 Snapshot: snapshot.Bytes(), 3369 } 3370 return err 3371 } 3372 3373 err := awsRestjson1_deserializeDocumentConflictException(&output, shape) 3374 3375 if err != nil { 3376 var snapshot bytes.Buffer 3377 io.Copy(&snapshot, ringBuffer) 3378 err = &smithy.DeserializationError{ 3379 Err: fmt.Errorf("failed to decode response body, %w", err), 3380 Snapshot: snapshot.Bytes(), 3381 } 3382 return err 3383 } 3384 3385 errorBody.Seek(0, io.SeekStart) 3386 3387 return output 3388} 3389 3390func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3391 output := &types.InternalServerException{} 3392 var buff [1024]byte 3393 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3394 3395 body := io.TeeReader(errorBody, ringBuffer) 3396 decoder := json.NewDecoder(body) 3397 decoder.UseNumber() 3398 var shape interface{} 3399 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3400 var snapshot bytes.Buffer 3401 io.Copy(&snapshot, ringBuffer) 3402 err = &smithy.DeserializationError{ 3403 Err: fmt.Errorf("failed to decode response body, %w", err), 3404 Snapshot: snapshot.Bytes(), 3405 } 3406 return err 3407 } 3408 3409 err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) 3410 3411 if err != nil { 3412 var snapshot bytes.Buffer 3413 io.Copy(&snapshot, ringBuffer) 3414 err = &smithy.DeserializationError{ 3415 Err: fmt.Errorf("failed to decode response body, %w", err), 3416 Snapshot: snapshot.Bytes(), 3417 } 3418 return err 3419 } 3420 3421 errorBody.Seek(0, io.SeekStart) 3422 3423 if err := awsRestjson1_deserializeOpHttpBindingsInternalServerException(output, response); err != nil { 3424 return &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid HTTP bindings, %w", err)} 3425 } 3426 3427 return output 3428} 3429 3430func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3431 output := &types.ResourceNotFoundException{} 3432 var buff [1024]byte 3433 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3434 3435 body := io.TeeReader(errorBody, ringBuffer) 3436 decoder := json.NewDecoder(body) 3437 decoder.UseNumber() 3438 var shape interface{} 3439 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3440 var snapshot bytes.Buffer 3441 io.Copy(&snapshot, ringBuffer) 3442 err = &smithy.DeserializationError{ 3443 Err: fmt.Errorf("failed to decode response body, %w", err), 3444 Snapshot: snapshot.Bytes(), 3445 } 3446 return err 3447 } 3448 3449 err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) 3450 3451 if err != nil { 3452 var snapshot bytes.Buffer 3453 io.Copy(&snapshot, ringBuffer) 3454 err = &smithy.DeserializationError{ 3455 Err: fmt.Errorf("failed to decode response body, %w", err), 3456 Snapshot: snapshot.Bytes(), 3457 } 3458 return err 3459 } 3460 3461 errorBody.Seek(0, io.SeekStart) 3462 3463 return output 3464} 3465 3466func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3467 output := &types.ServiceQuotaExceededException{} 3468 var buff [1024]byte 3469 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3470 3471 body := io.TeeReader(errorBody, ringBuffer) 3472 decoder := json.NewDecoder(body) 3473 decoder.UseNumber() 3474 var shape interface{} 3475 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3476 var snapshot bytes.Buffer 3477 io.Copy(&snapshot, ringBuffer) 3478 err = &smithy.DeserializationError{ 3479 Err: fmt.Errorf("failed to decode response body, %w", err), 3480 Snapshot: snapshot.Bytes(), 3481 } 3482 return err 3483 } 3484 3485 err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) 3486 3487 if err != nil { 3488 var snapshot bytes.Buffer 3489 io.Copy(&snapshot, ringBuffer) 3490 err = &smithy.DeserializationError{ 3491 Err: fmt.Errorf("failed to decode response body, %w", err), 3492 Snapshot: snapshot.Bytes(), 3493 } 3494 return err 3495 } 3496 3497 errorBody.Seek(0, io.SeekStart) 3498 3499 return output 3500} 3501 3502func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3503 output := &types.ThrottlingException{} 3504 var buff [1024]byte 3505 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3506 3507 body := io.TeeReader(errorBody, ringBuffer) 3508 decoder := json.NewDecoder(body) 3509 decoder.UseNumber() 3510 var shape interface{} 3511 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3512 var snapshot bytes.Buffer 3513 io.Copy(&snapshot, ringBuffer) 3514 err = &smithy.DeserializationError{ 3515 Err: fmt.Errorf("failed to decode response body, %w", err), 3516 Snapshot: snapshot.Bytes(), 3517 } 3518 return err 3519 } 3520 3521 err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) 3522 3523 if err != nil { 3524 var snapshot bytes.Buffer 3525 io.Copy(&snapshot, ringBuffer) 3526 err = &smithy.DeserializationError{ 3527 Err: fmt.Errorf("failed to decode response body, %w", err), 3528 Snapshot: snapshot.Bytes(), 3529 } 3530 return err 3531 } 3532 3533 errorBody.Seek(0, io.SeekStart) 3534 3535 if err := awsRestjson1_deserializeOpHttpBindingsThrottlingException(output, response); err != nil { 3536 return &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response error with invalid HTTP bindings, %w", err)} 3537 } 3538 3539 return output 3540} 3541 3542func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 3543 output := &types.ValidationException{} 3544 var buff [1024]byte 3545 ringBuffer := smithyio.NewRingBuffer(buff[:]) 3546 3547 body := io.TeeReader(errorBody, ringBuffer) 3548 decoder := json.NewDecoder(body) 3549 decoder.UseNumber() 3550 var shape interface{} 3551 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 3552 var snapshot bytes.Buffer 3553 io.Copy(&snapshot, ringBuffer) 3554 err = &smithy.DeserializationError{ 3555 Err: fmt.Errorf("failed to decode response body, %w", err), 3556 Snapshot: snapshot.Bytes(), 3557 } 3558 return err 3559 } 3560 3561 err := awsRestjson1_deserializeDocumentValidationException(&output, shape) 3562 3563 if err != nil { 3564 var snapshot bytes.Buffer 3565 io.Copy(&snapshot, ringBuffer) 3566 err = &smithy.DeserializationError{ 3567 Err: fmt.Errorf("failed to decode response body, %w", err), 3568 Snapshot: snapshot.Bytes(), 3569 } 3570 return err 3571 } 3572 3573 errorBody.Seek(0, io.SeekStart) 3574 3575 return output 3576} 3577 3578func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { 3579 if v == nil { 3580 return fmt.Errorf("unexpected nil of type %T", v) 3581 } 3582 if value == nil { 3583 return nil 3584 } 3585 3586 shape, ok := value.(map[string]interface{}) 3587 if !ok { 3588 return fmt.Errorf("unexpected JSON type %v", value) 3589 } 3590 3591 var sv *types.AccessDeniedException 3592 if *v == nil { 3593 sv = &types.AccessDeniedException{} 3594 } else { 3595 sv = *v 3596 } 3597 3598 for key, value := range shape { 3599 switch key { 3600 case "Message": 3601 if value != nil { 3602 jtv, ok := value.(string) 3603 if !ok { 3604 return fmt.Errorf("expected ErrorMessageString to be of type string, got %T instead", value) 3605 } 3606 sv.Message = ptr.String(jtv) 3607 } 3608 3609 default: 3610 _, _ = key, value 3611 3612 } 3613 } 3614 *v = sv 3615 return nil 3616} 3617 3618func awsRestjson1_deserializeDocumentAnomalyReportedTimeRange(v **types.AnomalyReportedTimeRange, value interface{}) error { 3619 if v == nil { 3620 return fmt.Errorf("unexpected nil of type %T", v) 3621 } 3622 if value == nil { 3623 return nil 3624 } 3625 3626 shape, ok := value.(map[string]interface{}) 3627 if !ok { 3628 return fmt.Errorf("unexpected JSON type %v", value) 3629 } 3630 3631 var sv *types.AnomalyReportedTimeRange 3632 if *v == nil { 3633 sv = &types.AnomalyReportedTimeRange{} 3634 } else { 3635 sv = *v 3636 } 3637 3638 for key, value := range shape { 3639 switch key { 3640 case "CloseTime": 3641 if value != nil { 3642 switch jtv := value.(type) { 3643 case json.Number: 3644 f64, err := jtv.Float64() 3645 if err != nil { 3646 return err 3647 } 3648 sv.CloseTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3649 3650 default: 3651 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 3652 3653 } 3654 } 3655 3656 case "OpenTime": 3657 if value != nil { 3658 switch jtv := value.(type) { 3659 case json.Number: 3660 f64, err := jtv.Float64() 3661 if err != nil { 3662 return err 3663 } 3664 sv.OpenTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3665 3666 default: 3667 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 3668 3669 } 3670 } 3671 3672 default: 3673 _, _ = key, value 3674 3675 } 3676 } 3677 *v = sv 3678 return nil 3679} 3680 3681func awsRestjson1_deserializeDocumentAnomalySourceDetails(v **types.AnomalySourceDetails, value interface{}) error { 3682 if v == nil { 3683 return fmt.Errorf("unexpected nil of type %T", v) 3684 } 3685 if value == nil { 3686 return nil 3687 } 3688 3689 shape, ok := value.(map[string]interface{}) 3690 if !ok { 3691 return fmt.Errorf("unexpected JSON type %v", value) 3692 } 3693 3694 var sv *types.AnomalySourceDetails 3695 if *v == nil { 3696 sv = &types.AnomalySourceDetails{} 3697 } else { 3698 sv = *v 3699 } 3700 3701 for key, value := range shape { 3702 switch key { 3703 case "CloudWatchMetrics": 3704 if err := awsRestjson1_deserializeDocumentCloudWatchMetricsDetails(&sv.CloudWatchMetrics, value); err != nil { 3705 return err 3706 } 3707 3708 default: 3709 _, _ = key, value 3710 3711 } 3712 } 3713 *v = sv 3714 return nil 3715} 3716 3717func awsRestjson1_deserializeDocumentAnomalyTimeRange(v **types.AnomalyTimeRange, value interface{}) error { 3718 if v == nil { 3719 return fmt.Errorf("unexpected nil of type %T", v) 3720 } 3721 if value == nil { 3722 return nil 3723 } 3724 3725 shape, ok := value.(map[string]interface{}) 3726 if !ok { 3727 return fmt.Errorf("unexpected JSON type %v", value) 3728 } 3729 3730 var sv *types.AnomalyTimeRange 3731 if *v == nil { 3732 sv = &types.AnomalyTimeRange{} 3733 } else { 3734 sv = *v 3735 } 3736 3737 for key, value := range shape { 3738 switch key { 3739 case "EndTime": 3740 if value != nil { 3741 switch jtv := value.(type) { 3742 case json.Number: 3743 f64, err := jtv.Float64() 3744 if err != nil { 3745 return err 3746 } 3747 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3748 3749 default: 3750 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 3751 3752 } 3753 } 3754 3755 case "StartTime": 3756 if value != nil { 3757 switch jtv := value.(type) { 3758 case json.Number: 3759 f64, err := jtv.Float64() 3760 if err != nil { 3761 return err 3762 } 3763 sv.StartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 3764 3765 default: 3766 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 3767 3768 } 3769 } 3770 3771 default: 3772 _, _ = key, value 3773 3774 } 3775 } 3776 *v = sv 3777 return nil 3778} 3779 3780func awsRestjson1_deserializeDocumentChannels(v *[]types.NotificationChannel, value interface{}) error { 3781 if v == nil { 3782 return fmt.Errorf("unexpected nil of type %T", v) 3783 } 3784 if value == nil { 3785 return nil 3786 } 3787 3788 shape, ok := value.([]interface{}) 3789 if !ok { 3790 return fmt.Errorf("unexpected JSON type %v", value) 3791 } 3792 3793 var cv []types.NotificationChannel 3794 if *v == nil { 3795 cv = []types.NotificationChannel{} 3796 } else { 3797 cv = *v 3798 } 3799 3800 for _, value := range shape { 3801 var col types.NotificationChannel 3802 destAddr := &col 3803 if err := awsRestjson1_deserializeDocumentNotificationChannel(&destAddr, value); err != nil { 3804 return err 3805 } 3806 col = *destAddr 3807 cv = append(cv, col) 3808 3809 } 3810 *v = cv 3811 return nil 3812} 3813 3814func awsRestjson1_deserializeDocumentCloudFormationCollection(v **types.CloudFormationCollection, value interface{}) error { 3815 if v == nil { 3816 return fmt.Errorf("unexpected nil of type %T", v) 3817 } 3818 if value == nil { 3819 return nil 3820 } 3821 3822 shape, ok := value.(map[string]interface{}) 3823 if !ok { 3824 return fmt.Errorf("unexpected JSON type %v", value) 3825 } 3826 3827 var sv *types.CloudFormationCollection 3828 if *v == nil { 3829 sv = &types.CloudFormationCollection{} 3830 } else { 3831 sv = *v 3832 } 3833 3834 for key, value := range shape { 3835 switch key { 3836 case "StackNames": 3837 if err := awsRestjson1_deserializeDocumentStackNames(&sv.StackNames, value); err != nil { 3838 return err 3839 } 3840 3841 default: 3842 _, _ = key, value 3843 3844 } 3845 } 3846 *v = sv 3847 return nil 3848} 3849 3850func awsRestjson1_deserializeDocumentCloudFormationCollectionFilter(v **types.CloudFormationCollectionFilter, value interface{}) error { 3851 if v == nil { 3852 return fmt.Errorf("unexpected nil of type %T", v) 3853 } 3854 if value == nil { 3855 return nil 3856 } 3857 3858 shape, ok := value.(map[string]interface{}) 3859 if !ok { 3860 return fmt.Errorf("unexpected JSON type %v", value) 3861 } 3862 3863 var sv *types.CloudFormationCollectionFilter 3864 if *v == nil { 3865 sv = &types.CloudFormationCollectionFilter{} 3866 } else { 3867 sv = *v 3868 } 3869 3870 for key, value := range shape { 3871 switch key { 3872 case "StackNames": 3873 if err := awsRestjson1_deserializeDocumentStackNames(&sv.StackNames, value); err != nil { 3874 return err 3875 } 3876 3877 default: 3878 _, _ = key, value 3879 3880 } 3881 } 3882 *v = sv 3883 return nil 3884} 3885 3886func awsRestjson1_deserializeDocumentCloudFormationCostEstimationResourceCollectionFilter(v **types.CloudFormationCostEstimationResourceCollectionFilter, value interface{}) error { 3887 if v == nil { 3888 return fmt.Errorf("unexpected nil of type %T", v) 3889 } 3890 if value == nil { 3891 return nil 3892 } 3893 3894 shape, ok := value.(map[string]interface{}) 3895 if !ok { 3896 return fmt.Errorf("unexpected JSON type %v", value) 3897 } 3898 3899 var sv *types.CloudFormationCostEstimationResourceCollectionFilter 3900 if *v == nil { 3901 sv = &types.CloudFormationCostEstimationResourceCollectionFilter{} 3902 } else { 3903 sv = *v 3904 } 3905 3906 for key, value := range shape { 3907 switch key { 3908 case "StackNames": 3909 if err := awsRestjson1_deserializeDocumentCostEstimationStackNames(&sv.StackNames, value); err != nil { 3910 return err 3911 } 3912 3913 default: 3914 _, _ = key, value 3915 3916 } 3917 } 3918 *v = sv 3919 return nil 3920} 3921 3922func awsRestjson1_deserializeDocumentCloudFormationHealth(v **types.CloudFormationHealth, value interface{}) error { 3923 if v == nil { 3924 return fmt.Errorf("unexpected nil of type %T", v) 3925 } 3926 if value == nil { 3927 return nil 3928 } 3929 3930 shape, ok := value.(map[string]interface{}) 3931 if !ok { 3932 return fmt.Errorf("unexpected JSON type %v", value) 3933 } 3934 3935 var sv *types.CloudFormationHealth 3936 if *v == nil { 3937 sv = &types.CloudFormationHealth{} 3938 } else { 3939 sv = *v 3940 } 3941 3942 for key, value := range shape { 3943 switch key { 3944 case "Insight": 3945 if err := awsRestjson1_deserializeDocumentInsightHealth(&sv.Insight, value); err != nil { 3946 return err 3947 } 3948 3949 case "StackName": 3950 if value != nil { 3951 jtv, ok := value.(string) 3952 if !ok { 3953 return fmt.Errorf("expected StackName to be of type string, got %T instead", value) 3954 } 3955 sv.StackName = ptr.String(jtv) 3956 } 3957 3958 default: 3959 _, _ = key, value 3960 3961 } 3962 } 3963 *v = sv 3964 return nil 3965} 3966 3967func awsRestjson1_deserializeDocumentCloudFormationHealths(v *[]types.CloudFormationHealth, value interface{}) error { 3968 if v == nil { 3969 return fmt.Errorf("unexpected nil of type %T", v) 3970 } 3971 if value == nil { 3972 return nil 3973 } 3974 3975 shape, ok := value.([]interface{}) 3976 if !ok { 3977 return fmt.Errorf("unexpected JSON type %v", value) 3978 } 3979 3980 var cv []types.CloudFormationHealth 3981 if *v == nil { 3982 cv = []types.CloudFormationHealth{} 3983 } else { 3984 cv = *v 3985 } 3986 3987 for _, value := range shape { 3988 var col types.CloudFormationHealth 3989 destAddr := &col 3990 if err := awsRestjson1_deserializeDocumentCloudFormationHealth(&destAddr, value); err != nil { 3991 return err 3992 } 3993 col = *destAddr 3994 cv = append(cv, col) 3995 3996 } 3997 *v = cv 3998 return nil 3999} 4000 4001func awsRestjson1_deserializeDocumentCloudWatchMetricsDetail(v **types.CloudWatchMetricsDetail, value interface{}) error { 4002 if v == nil { 4003 return fmt.Errorf("unexpected nil of type %T", v) 4004 } 4005 if value == nil { 4006 return nil 4007 } 4008 4009 shape, ok := value.(map[string]interface{}) 4010 if !ok { 4011 return fmt.Errorf("unexpected JSON type %v", value) 4012 } 4013 4014 var sv *types.CloudWatchMetricsDetail 4015 if *v == nil { 4016 sv = &types.CloudWatchMetricsDetail{} 4017 } else { 4018 sv = *v 4019 } 4020 4021 for key, value := range shape { 4022 switch key { 4023 case "Dimensions": 4024 if err := awsRestjson1_deserializeDocumentCloudWatchMetricsDimensions(&sv.Dimensions, value); err != nil { 4025 return err 4026 } 4027 4028 case "MetricName": 4029 if value != nil { 4030 jtv, ok := value.(string) 4031 if !ok { 4032 return fmt.Errorf("expected CloudWatchMetricsMetricName to be of type string, got %T instead", value) 4033 } 4034 sv.MetricName = ptr.String(jtv) 4035 } 4036 4037 case "Namespace": 4038 if value != nil { 4039 jtv, ok := value.(string) 4040 if !ok { 4041 return fmt.Errorf("expected CloudWatchMetricsNamespace to be of type string, got %T instead", value) 4042 } 4043 sv.Namespace = ptr.String(jtv) 4044 } 4045 4046 case "Period": 4047 if value != nil { 4048 jtv, ok := value.(json.Number) 4049 if !ok { 4050 return fmt.Errorf("expected CloudWatchMetricsPeriod to be json.Number, got %T instead", value) 4051 } 4052 i64, err := jtv.Int64() 4053 if err != nil { 4054 return err 4055 } 4056 sv.Period = int32(i64) 4057 } 4058 4059 case "Stat": 4060 if value != nil { 4061 jtv, ok := value.(string) 4062 if !ok { 4063 return fmt.Errorf("expected CloudWatchMetricsStat to be of type string, got %T instead", value) 4064 } 4065 sv.Stat = types.CloudWatchMetricsStat(jtv) 4066 } 4067 4068 case "Unit": 4069 if value != nil { 4070 jtv, ok := value.(string) 4071 if !ok { 4072 return fmt.Errorf("expected CloudWatchMetricsUnit to be of type string, got %T instead", value) 4073 } 4074 sv.Unit = ptr.String(jtv) 4075 } 4076 4077 default: 4078 _, _ = key, value 4079 4080 } 4081 } 4082 *v = sv 4083 return nil 4084} 4085 4086func awsRestjson1_deserializeDocumentCloudWatchMetricsDetails(v *[]types.CloudWatchMetricsDetail, value interface{}) error { 4087 if v == nil { 4088 return fmt.Errorf("unexpected nil of type %T", v) 4089 } 4090 if value == nil { 4091 return nil 4092 } 4093 4094 shape, ok := value.([]interface{}) 4095 if !ok { 4096 return fmt.Errorf("unexpected JSON type %v", value) 4097 } 4098 4099 var cv []types.CloudWatchMetricsDetail 4100 if *v == nil { 4101 cv = []types.CloudWatchMetricsDetail{} 4102 } else { 4103 cv = *v 4104 } 4105 4106 for _, value := range shape { 4107 var col types.CloudWatchMetricsDetail 4108 destAddr := &col 4109 if err := awsRestjson1_deserializeDocumentCloudWatchMetricsDetail(&destAddr, value); err != nil { 4110 return err 4111 } 4112 col = *destAddr 4113 cv = append(cv, col) 4114 4115 } 4116 *v = cv 4117 return nil 4118} 4119 4120func awsRestjson1_deserializeDocumentCloudWatchMetricsDimension(v **types.CloudWatchMetricsDimension, value interface{}) error { 4121 if v == nil { 4122 return fmt.Errorf("unexpected nil of type %T", v) 4123 } 4124 if value == nil { 4125 return nil 4126 } 4127 4128 shape, ok := value.(map[string]interface{}) 4129 if !ok { 4130 return fmt.Errorf("unexpected JSON type %v", value) 4131 } 4132 4133 var sv *types.CloudWatchMetricsDimension 4134 if *v == nil { 4135 sv = &types.CloudWatchMetricsDimension{} 4136 } else { 4137 sv = *v 4138 } 4139 4140 for key, value := range shape { 4141 switch key { 4142 case "Name": 4143 if value != nil { 4144 jtv, ok := value.(string) 4145 if !ok { 4146 return fmt.Errorf("expected CloudWatchMetricsDimensionName to be of type string, got %T instead", value) 4147 } 4148 sv.Name = ptr.String(jtv) 4149 } 4150 4151 case "Value": 4152 if value != nil { 4153 jtv, ok := value.(string) 4154 if !ok { 4155 return fmt.Errorf("expected CloudWatchMetricsDimensionValue to be of type string, got %T instead", value) 4156 } 4157 sv.Value = ptr.String(jtv) 4158 } 4159 4160 default: 4161 _, _ = key, value 4162 4163 } 4164 } 4165 *v = sv 4166 return nil 4167} 4168 4169func awsRestjson1_deserializeDocumentCloudWatchMetricsDimensions(v *[]types.CloudWatchMetricsDimension, value interface{}) error { 4170 if v == nil { 4171 return fmt.Errorf("unexpected nil of type %T", v) 4172 } 4173 if value == nil { 4174 return nil 4175 } 4176 4177 shape, ok := value.([]interface{}) 4178 if !ok { 4179 return fmt.Errorf("unexpected JSON type %v", value) 4180 } 4181 4182 var cv []types.CloudWatchMetricsDimension 4183 if *v == nil { 4184 cv = []types.CloudWatchMetricsDimension{} 4185 } else { 4186 cv = *v 4187 } 4188 4189 for _, value := range shape { 4190 var col types.CloudWatchMetricsDimension 4191 destAddr := &col 4192 if err := awsRestjson1_deserializeDocumentCloudWatchMetricsDimension(&destAddr, value); err != nil { 4193 return err 4194 } 4195 col = *destAddr 4196 cv = append(cv, col) 4197 4198 } 4199 *v = cv 4200 return nil 4201} 4202 4203func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { 4204 if v == nil { 4205 return fmt.Errorf("unexpected nil of type %T", v) 4206 } 4207 if value == nil { 4208 return nil 4209 } 4210 4211 shape, ok := value.(map[string]interface{}) 4212 if !ok { 4213 return fmt.Errorf("unexpected JSON type %v", value) 4214 } 4215 4216 var sv *types.ConflictException 4217 if *v == nil { 4218 sv = &types.ConflictException{} 4219 } else { 4220 sv = *v 4221 } 4222 4223 for key, value := range shape { 4224 switch key { 4225 case "Message": 4226 if value != nil { 4227 jtv, ok := value.(string) 4228 if !ok { 4229 return fmt.Errorf("expected ErrorMessageString to be of type string, got %T instead", value) 4230 } 4231 sv.Message = ptr.String(jtv) 4232 } 4233 4234 case "ResourceId": 4235 if value != nil { 4236 jtv, ok := value.(string) 4237 if !ok { 4238 return fmt.Errorf("expected ResourceIdString to be of type string, got %T instead", value) 4239 } 4240 sv.ResourceId = ptr.String(jtv) 4241 } 4242 4243 case "ResourceType": 4244 if value != nil { 4245 jtv, ok := value.(string) 4246 if !ok { 4247 return fmt.Errorf("expected ResourceIdType to be of type string, got %T instead", value) 4248 } 4249 sv.ResourceType = ptr.String(jtv) 4250 } 4251 4252 default: 4253 _, _ = key, value 4254 4255 } 4256 } 4257 *v = sv 4258 return nil 4259} 4260 4261func awsRestjson1_deserializeDocumentCostEstimationResourceCollectionFilter(v **types.CostEstimationResourceCollectionFilter, value interface{}) error { 4262 if v == nil { 4263 return fmt.Errorf("unexpected nil of type %T", v) 4264 } 4265 if value == nil { 4266 return nil 4267 } 4268 4269 shape, ok := value.(map[string]interface{}) 4270 if !ok { 4271 return fmt.Errorf("unexpected JSON type %v", value) 4272 } 4273 4274 var sv *types.CostEstimationResourceCollectionFilter 4275 if *v == nil { 4276 sv = &types.CostEstimationResourceCollectionFilter{} 4277 } else { 4278 sv = *v 4279 } 4280 4281 for key, value := range shape { 4282 switch key { 4283 case "CloudFormation": 4284 if err := awsRestjson1_deserializeDocumentCloudFormationCostEstimationResourceCollectionFilter(&sv.CloudFormation, value); err != nil { 4285 return err 4286 } 4287 4288 default: 4289 _, _ = key, value 4290 4291 } 4292 } 4293 *v = sv 4294 return nil 4295} 4296 4297func awsRestjson1_deserializeDocumentCostEstimationStackNames(v *[]string, value interface{}) error { 4298 if v == nil { 4299 return fmt.Errorf("unexpected nil of type %T", v) 4300 } 4301 if value == nil { 4302 return nil 4303 } 4304 4305 shape, ok := value.([]interface{}) 4306 if !ok { 4307 return fmt.Errorf("unexpected JSON type %v", value) 4308 } 4309 4310 var cv []string 4311 if *v == nil { 4312 cv = []string{} 4313 } else { 4314 cv = *v 4315 } 4316 4317 for _, value := range shape { 4318 var col string 4319 if value != nil { 4320 jtv, ok := value.(string) 4321 if !ok { 4322 return fmt.Errorf("expected StackName to be of type string, got %T instead", value) 4323 } 4324 col = jtv 4325 } 4326 cv = append(cv, col) 4327 4328 } 4329 *v = cv 4330 return nil 4331} 4332 4333func awsRestjson1_deserializeDocumentCostEstimationTimeRange(v **types.CostEstimationTimeRange, value interface{}) error { 4334 if v == nil { 4335 return fmt.Errorf("unexpected nil of type %T", v) 4336 } 4337 if value == nil { 4338 return nil 4339 } 4340 4341 shape, ok := value.(map[string]interface{}) 4342 if !ok { 4343 return fmt.Errorf("unexpected JSON type %v", value) 4344 } 4345 4346 var sv *types.CostEstimationTimeRange 4347 if *v == nil { 4348 sv = &types.CostEstimationTimeRange{} 4349 } else { 4350 sv = *v 4351 } 4352 4353 for key, value := range shape { 4354 switch key { 4355 case "EndTime": 4356 if value != nil { 4357 switch jtv := value.(type) { 4358 case json.Number: 4359 f64, err := jtv.Float64() 4360 if err != nil { 4361 return err 4362 } 4363 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4364 4365 default: 4366 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4367 4368 } 4369 } 4370 4371 case "StartTime": 4372 if value != nil { 4373 switch jtv := value.(type) { 4374 case json.Number: 4375 f64, err := jtv.Float64() 4376 if err != nil { 4377 return err 4378 } 4379 sv.StartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4380 4381 default: 4382 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4383 4384 } 4385 } 4386 4387 default: 4388 _, _ = key, value 4389 4390 } 4391 } 4392 *v = sv 4393 return nil 4394} 4395 4396func awsRestjson1_deserializeDocumentEvent(v **types.Event, value interface{}) error { 4397 if v == nil { 4398 return fmt.Errorf("unexpected nil of type %T", v) 4399 } 4400 if value == nil { 4401 return nil 4402 } 4403 4404 shape, ok := value.(map[string]interface{}) 4405 if !ok { 4406 return fmt.Errorf("unexpected JSON type %v", value) 4407 } 4408 4409 var sv *types.Event 4410 if *v == nil { 4411 sv = &types.Event{} 4412 } else { 4413 sv = *v 4414 } 4415 4416 for key, value := range shape { 4417 switch key { 4418 case "DataSource": 4419 if value != nil { 4420 jtv, ok := value.(string) 4421 if !ok { 4422 return fmt.Errorf("expected EventDataSource to be of type string, got %T instead", value) 4423 } 4424 sv.DataSource = types.EventDataSource(jtv) 4425 } 4426 4427 case "EventClass": 4428 if value != nil { 4429 jtv, ok := value.(string) 4430 if !ok { 4431 return fmt.Errorf("expected EventClass to be of type string, got %T instead", value) 4432 } 4433 sv.EventClass = types.EventClass(jtv) 4434 } 4435 4436 case "EventSource": 4437 if value != nil { 4438 jtv, ok := value.(string) 4439 if !ok { 4440 return fmt.Errorf("expected EventSource to be of type string, got %T instead", value) 4441 } 4442 sv.EventSource = ptr.String(jtv) 4443 } 4444 4445 case "Id": 4446 if value != nil { 4447 jtv, ok := value.(string) 4448 if !ok { 4449 return fmt.Errorf("expected EventId to be of type string, got %T instead", value) 4450 } 4451 sv.Id = ptr.String(jtv) 4452 } 4453 4454 case "Name": 4455 if value != nil { 4456 jtv, ok := value.(string) 4457 if !ok { 4458 return fmt.Errorf("expected EventName to be of type string, got %T instead", value) 4459 } 4460 sv.Name = ptr.String(jtv) 4461 } 4462 4463 case "ResourceCollection": 4464 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 4465 return err 4466 } 4467 4468 case "Resources": 4469 if err := awsRestjson1_deserializeDocumentEventResources(&sv.Resources, value); err != nil { 4470 return err 4471 } 4472 4473 case "Time": 4474 if value != nil { 4475 switch jtv := value.(type) { 4476 case json.Number: 4477 f64, err := jtv.Float64() 4478 if err != nil { 4479 return err 4480 } 4481 sv.Time = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4482 4483 default: 4484 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4485 4486 } 4487 } 4488 4489 default: 4490 _, _ = key, value 4491 4492 } 4493 } 4494 *v = sv 4495 return nil 4496} 4497 4498func awsRestjson1_deserializeDocumentEventResource(v **types.EventResource, value interface{}) error { 4499 if v == nil { 4500 return fmt.Errorf("unexpected nil of type %T", v) 4501 } 4502 if value == nil { 4503 return nil 4504 } 4505 4506 shape, ok := value.(map[string]interface{}) 4507 if !ok { 4508 return fmt.Errorf("unexpected JSON type %v", value) 4509 } 4510 4511 var sv *types.EventResource 4512 if *v == nil { 4513 sv = &types.EventResource{} 4514 } else { 4515 sv = *v 4516 } 4517 4518 for key, value := range shape { 4519 switch key { 4520 case "Arn": 4521 if value != nil { 4522 jtv, ok := value.(string) 4523 if !ok { 4524 return fmt.Errorf("expected EventResourceArn to be of type string, got %T instead", value) 4525 } 4526 sv.Arn = ptr.String(jtv) 4527 } 4528 4529 case "Name": 4530 if value != nil { 4531 jtv, ok := value.(string) 4532 if !ok { 4533 return fmt.Errorf("expected EventResourceName to be of type string, got %T instead", value) 4534 } 4535 sv.Name = ptr.String(jtv) 4536 } 4537 4538 case "Type": 4539 if value != nil { 4540 jtv, ok := value.(string) 4541 if !ok { 4542 return fmt.Errorf("expected EventResourceType to be of type string, got %T instead", value) 4543 } 4544 sv.Type = ptr.String(jtv) 4545 } 4546 4547 default: 4548 _, _ = key, value 4549 4550 } 4551 } 4552 *v = sv 4553 return nil 4554} 4555 4556func awsRestjson1_deserializeDocumentEventResources(v *[]types.EventResource, value interface{}) error { 4557 if v == nil { 4558 return fmt.Errorf("unexpected nil of type %T", v) 4559 } 4560 if value == nil { 4561 return nil 4562 } 4563 4564 shape, ok := value.([]interface{}) 4565 if !ok { 4566 return fmt.Errorf("unexpected JSON type %v", value) 4567 } 4568 4569 var cv []types.EventResource 4570 if *v == nil { 4571 cv = []types.EventResource{} 4572 } else { 4573 cv = *v 4574 } 4575 4576 for _, value := range shape { 4577 var col types.EventResource 4578 destAddr := &col 4579 if err := awsRestjson1_deserializeDocumentEventResource(&destAddr, value); err != nil { 4580 return err 4581 } 4582 col = *destAddr 4583 cv = append(cv, col) 4584 4585 } 4586 *v = cv 4587 return nil 4588} 4589 4590func awsRestjson1_deserializeDocumentEvents(v *[]types.Event, value interface{}) error { 4591 if v == nil { 4592 return fmt.Errorf("unexpected nil of type %T", v) 4593 } 4594 if value == nil { 4595 return nil 4596 } 4597 4598 shape, ok := value.([]interface{}) 4599 if !ok { 4600 return fmt.Errorf("unexpected JSON type %v", value) 4601 } 4602 4603 var cv []types.Event 4604 if *v == nil { 4605 cv = []types.Event{} 4606 } else { 4607 cv = *v 4608 } 4609 4610 for _, value := range shape { 4611 var col types.Event 4612 destAddr := &col 4613 if err := awsRestjson1_deserializeDocumentEvent(&destAddr, value); err != nil { 4614 return err 4615 } 4616 col = *destAddr 4617 cv = append(cv, col) 4618 4619 } 4620 *v = cv 4621 return nil 4622} 4623 4624func awsRestjson1_deserializeDocumentInsightFeedback(v **types.InsightFeedback, value interface{}) error { 4625 if v == nil { 4626 return fmt.Errorf("unexpected nil of type %T", v) 4627 } 4628 if value == nil { 4629 return nil 4630 } 4631 4632 shape, ok := value.(map[string]interface{}) 4633 if !ok { 4634 return fmt.Errorf("unexpected JSON type %v", value) 4635 } 4636 4637 var sv *types.InsightFeedback 4638 if *v == nil { 4639 sv = &types.InsightFeedback{} 4640 } else { 4641 sv = *v 4642 } 4643 4644 for key, value := range shape { 4645 switch key { 4646 case "Feedback": 4647 if value != nil { 4648 jtv, ok := value.(string) 4649 if !ok { 4650 return fmt.Errorf("expected InsightFeedbackOption to be of type string, got %T instead", value) 4651 } 4652 sv.Feedback = types.InsightFeedbackOption(jtv) 4653 } 4654 4655 case "Id": 4656 if value != nil { 4657 jtv, ok := value.(string) 4658 if !ok { 4659 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 4660 } 4661 sv.Id = ptr.String(jtv) 4662 } 4663 4664 default: 4665 _, _ = key, value 4666 4667 } 4668 } 4669 *v = sv 4670 return nil 4671} 4672 4673func awsRestjson1_deserializeDocumentInsightHealth(v **types.InsightHealth, value interface{}) error { 4674 if v == nil { 4675 return fmt.Errorf("unexpected nil of type %T", v) 4676 } 4677 if value == nil { 4678 return nil 4679 } 4680 4681 shape, ok := value.(map[string]interface{}) 4682 if !ok { 4683 return fmt.Errorf("unexpected JSON type %v", value) 4684 } 4685 4686 var sv *types.InsightHealth 4687 if *v == nil { 4688 sv = &types.InsightHealth{} 4689 } else { 4690 sv = *v 4691 } 4692 4693 for key, value := range shape { 4694 switch key { 4695 case "MeanTimeToRecoverInMilliseconds": 4696 if value != nil { 4697 jtv, ok := value.(json.Number) 4698 if !ok { 4699 return fmt.Errorf("expected MeanTimeToRecoverInMilliseconds to be json.Number, got %T instead", value) 4700 } 4701 i64, err := jtv.Int64() 4702 if err != nil { 4703 return err 4704 } 4705 sv.MeanTimeToRecoverInMilliseconds = ptr.Int64(i64) 4706 } 4707 4708 case "OpenProactiveInsights": 4709 if value != nil { 4710 jtv, ok := value.(json.Number) 4711 if !ok { 4712 return fmt.Errorf("expected NumOpenProactiveInsights to be json.Number, got %T instead", value) 4713 } 4714 i64, err := jtv.Int64() 4715 if err != nil { 4716 return err 4717 } 4718 sv.OpenProactiveInsights = int32(i64) 4719 } 4720 4721 case "OpenReactiveInsights": 4722 if value != nil { 4723 jtv, ok := value.(json.Number) 4724 if !ok { 4725 return fmt.Errorf("expected NumOpenReactiveInsights to be json.Number, got %T instead", value) 4726 } 4727 i64, err := jtv.Int64() 4728 if err != nil { 4729 return err 4730 } 4731 sv.OpenReactiveInsights = int32(i64) 4732 } 4733 4734 default: 4735 _, _ = key, value 4736 4737 } 4738 } 4739 *v = sv 4740 return nil 4741} 4742 4743func awsRestjson1_deserializeDocumentInsightTimeRange(v **types.InsightTimeRange, value interface{}) error { 4744 if v == nil { 4745 return fmt.Errorf("unexpected nil of type %T", v) 4746 } 4747 if value == nil { 4748 return nil 4749 } 4750 4751 shape, ok := value.(map[string]interface{}) 4752 if !ok { 4753 return fmt.Errorf("unexpected JSON type %v", value) 4754 } 4755 4756 var sv *types.InsightTimeRange 4757 if *v == nil { 4758 sv = &types.InsightTimeRange{} 4759 } else { 4760 sv = *v 4761 } 4762 4763 for key, value := range shape { 4764 switch key { 4765 case "EndTime": 4766 if value != nil { 4767 switch jtv := value.(type) { 4768 case json.Number: 4769 f64, err := jtv.Float64() 4770 if err != nil { 4771 return err 4772 } 4773 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4774 4775 default: 4776 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4777 4778 } 4779 } 4780 4781 case "StartTime": 4782 if value != nil { 4783 switch jtv := value.(type) { 4784 case json.Number: 4785 f64, err := jtv.Float64() 4786 if err != nil { 4787 return err 4788 } 4789 sv.StartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 4790 4791 default: 4792 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 4793 4794 } 4795 } 4796 4797 default: 4798 _, _ = key, value 4799 4800 } 4801 } 4802 *v = sv 4803 return nil 4804} 4805 4806func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { 4807 if v == nil { 4808 return fmt.Errorf("unexpected nil of type %T", v) 4809 } 4810 if value == nil { 4811 return nil 4812 } 4813 4814 shape, ok := value.(map[string]interface{}) 4815 if !ok { 4816 return fmt.Errorf("unexpected JSON type %v", value) 4817 } 4818 4819 var sv *types.InternalServerException 4820 if *v == nil { 4821 sv = &types.InternalServerException{} 4822 } else { 4823 sv = *v 4824 } 4825 4826 for key, value := range shape { 4827 switch key { 4828 case "Message": 4829 if value != nil { 4830 jtv, ok := value.(string) 4831 if !ok { 4832 return fmt.Errorf("expected ErrorMessageString to be of type string, got %T instead", value) 4833 } 4834 sv.Message = ptr.String(jtv) 4835 } 4836 4837 case "RetryAfterSeconds": 4838 if value != nil { 4839 jtv, ok := value.(json.Number) 4840 if !ok { 4841 return fmt.Errorf("expected RetryAfterSeconds to be json.Number, got %T instead", value) 4842 } 4843 i64, err := jtv.Int64() 4844 if err != nil { 4845 return err 4846 } 4847 sv.RetryAfterSeconds = int32(i64) 4848 } 4849 4850 default: 4851 _, _ = key, value 4852 4853 } 4854 } 4855 *v = sv 4856 return nil 4857} 4858 4859func awsRestjson1_deserializeDocumentNotificationChannel(v **types.NotificationChannel, value interface{}) error { 4860 if v == nil { 4861 return fmt.Errorf("unexpected nil of type %T", v) 4862 } 4863 if value == nil { 4864 return nil 4865 } 4866 4867 shape, ok := value.(map[string]interface{}) 4868 if !ok { 4869 return fmt.Errorf("unexpected JSON type %v", value) 4870 } 4871 4872 var sv *types.NotificationChannel 4873 if *v == nil { 4874 sv = &types.NotificationChannel{} 4875 } else { 4876 sv = *v 4877 } 4878 4879 for key, value := range shape { 4880 switch key { 4881 case "Config": 4882 if err := awsRestjson1_deserializeDocumentNotificationChannelConfig(&sv.Config, value); err != nil { 4883 return err 4884 } 4885 4886 case "Id": 4887 if value != nil { 4888 jtv, ok := value.(string) 4889 if !ok { 4890 return fmt.Errorf("expected NotificationChannelId to be of type string, got %T instead", value) 4891 } 4892 sv.Id = ptr.String(jtv) 4893 } 4894 4895 default: 4896 _, _ = key, value 4897 4898 } 4899 } 4900 *v = sv 4901 return nil 4902} 4903 4904func awsRestjson1_deserializeDocumentNotificationChannelConfig(v **types.NotificationChannelConfig, value interface{}) error { 4905 if v == nil { 4906 return fmt.Errorf("unexpected nil of type %T", v) 4907 } 4908 if value == nil { 4909 return nil 4910 } 4911 4912 shape, ok := value.(map[string]interface{}) 4913 if !ok { 4914 return fmt.Errorf("unexpected JSON type %v", value) 4915 } 4916 4917 var sv *types.NotificationChannelConfig 4918 if *v == nil { 4919 sv = &types.NotificationChannelConfig{} 4920 } else { 4921 sv = *v 4922 } 4923 4924 for key, value := range shape { 4925 switch key { 4926 case "Sns": 4927 if err := awsRestjson1_deserializeDocumentSnsChannelConfig(&sv.Sns, value); err != nil { 4928 return err 4929 } 4930 4931 default: 4932 _, _ = key, value 4933 4934 } 4935 } 4936 *v = sv 4937 return nil 4938} 4939 4940func awsRestjson1_deserializeDocumentOpsCenterIntegration(v **types.OpsCenterIntegration, value interface{}) error { 4941 if v == nil { 4942 return fmt.Errorf("unexpected nil of type %T", v) 4943 } 4944 if value == nil { 4945 return nil 4946 } 4947 4948 shape, ok := value.(map[string]interface{}) 4949 if !ok { 4950 return fmt.Errorf("unexpected JSON type %v", value) 4951 } 4952 4953 var sv *types.OpsCenterIntegration 4954 if *v == nil { 4955 sv = &types.OpsCenterIntegration{} 4956 } else { 4957 sv = *v 4958 } 4959 4960 for key, value := range shape { 4961 switch key { 4962 case "OptInStatus": 4963 if value != nil { 4964 jtv, ok := value.(string) 4965 if !ok { 4966 return fmt.Errorf("expected OptInStatus to be of type string, got %T instead", value) 4967 } 4968 sv.OptInStatus = types.OptInStatus(jtv) 4969 } 4970 4971 default: 4972 _, _ = key, value 4973 4974 } 4975 } 4976 *v = sv 4977 return nil 4978} 4979 4980func awsRestjson1_deserializeDocumentPredictionTimeRange(v **types.PredictionTimeRange, value interface{}) error { 4981 if v == nil { 4982 return fmt.Errorf("unexpected nil of type %T", v) 4983 } 4984 if value == nil { 4985 return nil 4986 } 4987 4988 shape, ok := value.(map[string]interface{}) 4989 if !ok { 4990 return fmt.Errorf("unexpected JSON type %v", value) 4991 } 4992 4993 var sv *types.PredictionTimeRange 4994 if *v == nil { 4995 sv = &types.PredictionTimeRange{} 4996 } else { 4997 sv = *v 4998 } 4999 5000 for key, value := range shape { 5001 switch key { 5002 case "EndTime": 5003 if value != nil { 5004 switch jtv := value.(type) { 5005 case json.Number: 5006 f64, err := jtv.Float64() 5007 if err != nil { 5008 return err 5009 } 5010 sv.EndTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5011 5012 default: 5013 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5014 5015 } 5016 } 5017 5018 case "StartTime": 5019 if value != nil { 5020 switch jtv := value.(type) { 5021 case json.Number: 5022 f64, err := jtv.Float64() 5023 if err != nil { 5024 return err 5025 } 5026 sv.StartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5027 5028 default: 5029 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5030 5031 } 5032 } 5033 5034 default: 5035 _, _ = key, value 5036 5037 } 5038 } 5039 *v = sv 5040 return nil 5041} 5042 5043func awsRestjson1_deserializeDocumentProactiveAnomalies(v *[]types.ProactiveAnomalySummary, value interface{}) error { 5044 if v == nil { 5045 return fmt.Errorf("unexpected nil of type %T", v) 5046 } 5047 if value == nil { 5048 return nil 5049 } 5050 5051 shape, ok := value.([]interface{}) 5052 if !ok { 5053 return fmt.Errorf("unexpected JSON type %v", value) 5054 } 5055 5056 var cv []types.ProactiveAnomalySummary 5057 if *v == nil { 5058 cv = []types.ProactiveAnomalySummary{} 5059 } else { 5060 cv = *v 5061 } 5062 5063 for _, value := range shape { 5064 var col types.ProactiveAnomalySummary 5065 destAddr := &col 5066 if err := awsRestjson1_deserializeDocumentProactiveAnomalySummary(&destAddr, value); err != nil { 5067 return err 5068 } 5069 col = *destAddr 5070 cv = append(cv, col) 5071 5072 } 5073 *v = cv 5074 return nil 5075} 5076 5077func awsRestjson1_deserializeDocumentProactiveAnomaly(v **types.ProactiveAnomaly, value interface{}) error { 5078 if v == nil { 5079 return fmt.Errorf("unexpected nil of type %T", v) 5080 } 5081 if value == nil { 5082 return nil 5083 } 5084 5085 shape, ok := value.(map[string]interface{}) 5086 if !ok { 5087 return fmt.Errorf("unexpected JSON type %v", value) 5088 } 5089 5090 var sv *types.ProactiveAnomaly 5091 if *v == nil { 5092 sv = &types.ProactiveAnomaly{} 5093 } else { 5094 sv = *v 5095 } 5096 5097 for key, value := range shape { 5098 switch key { 5099 case "AnomalyReportedTimeRange": 5100 if err := awsRestjson1_deserializeDocumentAnomalyReportedTimeRange(&sv.AnomalyReportedTimeRange, value); err != nil { 5101 return err 5102 } 5103 5104 case "AnomalyTimeRange": 5105 if err := awsRestjson1_deserializeDocumentAnomalyTimeRange(&sv.AnomalyTimeRange, value); err != nil { 5106 return err 5107 } 5108 5109 case "AssociatedInsightId": 5110 if value != nil { 5111 jtv, ok := value.(string) 5112 if !ok { 5113 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 5114 } 5115 sv.AssociatedInsightId = ptr.String(jtv) 5116 } 5117 5118 case "Id": 5119 if value != nil { 5120 jtv, ok := value.(string) 5121 if !ok { 5122 return fmt.Errorf("expected AnomalyId to be of type string, got %T instead", value) 5123 } 5124 sv.Id = ptr.String(jtv) 5125 } 5126 5127 case "Limit": 5128 if value != nil { 5129 switch jtv := value.(type) { 5130 case json.Number: 5131 f64, err := jtv.Float64() 5132 if err != nil { 5133 return err 5134 } 5135 sv.Limit = ptr.Float64(f64) 5136 5137 case string: 5138 var f64 float64 5139 switch { 5140 case strings.EqualFold(jtv, "NaN"): 5141 f64 = math.NaN() 5142 5143 case strings.EqualFold(jtv, "Infinity"): 5144 f64 = math.Inf(1) 5145 5146 case strings.EqualFold(jtv, "-Infinity"): 5147 f64 = math.Inf(-1) 5148 5149 default: 5150 return fmt.Errorf("unknown JSON number value: %s", jtv) 5151 5152 } 5153 sv.Limit = ptr.Float64(f64) 5154 5155 default: 5156 return fmt.Errorf("expected AnomalyLimit to be a JSON Number, got %T instead", value) 5157 5158 } 5159 } 5160 5161 case "PredictionTimeRange": 5162 if err := awsRestjson1_deserializeDocumentPredictionTimeRange(&sv.PredictionTimeRange, value); err != nil { 5163 return err 5164 } 5165 5166 case "ResourceCollection": 5167 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 5168 return err 5169 } 5170 5171 case "Severity": 5172 if value != nil { 5173 jtv, ok := value.(string) 5174 if !ok { 5175 return fmt.Errorf("expected AnomalySeverity to be of type string, got %T instead", value) 5176 } 5177 sv.Severity = types.AnomalySeverity(jtv) 5178 } 5179 5180 case "SourceDetails": 5181 if err := awsRestjson1_deserializeDocumentAnomalySourceDetails(&sv.SourceDetails, value); err != nil { 5182 return err 5183 } 5184 5185 case "Status": 5186 if value != nil { 5187 jtv, ok := value.(string) 5188 if !ok { 5189 return fmt.Errorf("expected AnomalyStatus to be of type string, got %T instead", value) 5190 } 5191 sv.Status = types.AnomalyStatus(jtv) 5192 } 5193 5194 case "UpdateTime": 5195 if value != nil { 5196 switch jtv := value.(type) { 5197 case json.Number: 5198 f64, err := jtv.Float64() 5199 if err != nil { 5200 return err 5201 } 5202 sv.UpdateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5203 5204 default: 5205 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5206 5207 } 5208 } 5209 5210 default: 5211 _, _ = key, value 5212 5213 } 5214 } 5215 *v = sv 5216 return nil 5217} 5218 5219func awsRestjson1_deserializeDocumentProactiveAnomalySummary(v **types.ProactiveAnomalySummary, value interface{}) error { 5220 if v == nil { 5221 return fmt.Errorf("unexpected nil of type %T", v) 5222 } 5223 if value == nil { 5224 return nil 5225 } 5226 5227 shape, ok := value.(map[string]interface{}) 5228 if !ok { 5229 return fmt.Errorf("unexpected JSON type %v", value) 5230 } 5231 5232 var sv *types.ProactiveAnomalySummary 5233 if *v == nil { 5234 sv = &types.ProactiveAnomalySummary{} 5235 } else { 5236 sv = *v 5237 } 5238 5239 for key, value := range shape { 5240 switch key { 5241 case "AnomalyReportedTimeRange": 5242 if err := awsRestjson1_deserializeDocumentAnomalyReportedTimeRange(&sv.AnomalyReportedTimeRange, value); err != nil { 5243 return err 5244 } 5245 5246 case "AnomalyTimeRange": 5247 if err := awsRestjson1_deserializeDocumentAnomalyTimeRange(&sv.AnomalyTimeRange, value); err != nil { 5248 return err 5249 } 5250 5251 case "AssociatedInsightId": 5252 if value != nil { 5253 jtv, ok := value.(string) 5254 if !ok { 5255 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 5256 } 5257 sv.AssociatedInsightId = ptr.String(jtv) 5258 } 5259 5260 case "Id": 5261 if value != nil { 5262 jtv, ok := value.(string) 5263 if !ok { 5264 return fmt.Errorf("expected AnomalyId to be of type string, got %T instead", value) 5265 } 5266 sv.Id = ptr.String(jtv) 5267 } 5268 5269 case "Limit": 5270 if value != nil { 5271 switch jtv := value.(type) { 5272 case json.Number: 5273 f64, err := jtv.Float64() 5274 if err != nil { 5275 return err 5276 } 5277 sv.Limit = ptr.Float64(f64) 5278 5279 case string: 5280 var f64 float64 5281 switch { 5282 case strings.EqualFold(jtv, "NaN"): 5283 f64 = math.NaN() 5284 5285 case strings.EqualFold(jtv, "Infinity"): 5286 f64 = math.Inf(1) 5287 5288 case strings.EqualFold(jtv, "-Infinity"): 5289 f64 = math.Inf(-1) 5290 5291 default: 5292 return fmt.Errorf("unknown JSON number value: %s", jtv) 5293 5294 } 5295 sv.Limit = ptr.Float64(f64) 5296 5297 default: 5298 return fmt.Errorf("expected AnomalyLimit to be a JSON Number, got %T instead", value) 5299 5300 } 5301 } 5302 5303 case "PredictionTimeRange": 5304 if err := awsRestjson1_deserializeDocumentPredictionTimeRange(&sv.PredictionTimeRange, value); err != nil { 5305 return err 5306 } 5307 5308 case "ResourceCollection": 5309 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 5310 return err 5311 } 5312 5313 case "Severity": 5314 if value != nil { 5315 jtv, ok := value.(string) 5316 if !ok { 5317 return fmt.Errorf("expected AnomalySeverity to be of type string, got %T instead", value) 5318 } 5319 sv.Severity = types.AnomalySeverity(jtv) 5320 } 5321 5322 case "SourceDetails": 5323 if err := awsRestjson1_deserializeDocumentAnomalySourceDetails(&sv.SourceDetails, value); err != nil { 5324 return err 5325 } 5326 5327 case "Status": 5328 if value != nil { 5329 jtv, ok := value.(string) 5330 if !ok { 5331 return fmt.Errorf("expected AnomalyStatus to be of type string, got %T instead", value) 5332 } 5333 sv.Status = types.AnomalyStatus(jtv) 5334 } 5335 5336 case "UpdateTime": 5337 if value != nil { 5338 switch jtv := value.(type) { 5339 case json.Number: 5340 f64, err := jtv.Float64() 5341 if err != nil { 5342 return err 5343 } 5344 sv.UpdateTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 5345 5346 default: 5347 return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) 5348 5349 } 5350 } 5351 5352 default: 5353 _, _ = key, value 5354 5355 } 5356 } 5357 *v = sv 5358 return nil 5359} 5360 5361func awsRestjson1_deserializeDocumentProactiveInsight(v **types.ProactiveInsight, value interface{}) error { 5362 if v == nil { 5363 return fmt.Errorf("unexpected nil of type %T", v) 5364 } 5365 if value == nil { 5366 return nil 5367 } 5368 5369 shape, ok := value.(map[string]interface{}) 5370 if !ok { 5371 return fmt.Errorf("unexpected JSON type %v", value) 5372 } 5373 5374 var sv *types.ProactiveInsight 5375 if *v == nil { 5376 sv = &types.ProactiveInsight{} 5377 } else { 5378 sv = *v 5379 } 5380 5381 for key, value := range shape { 5382 switch key { 5383 case "Id": 5384 if value != nil { 5385 jtv, ok := value.(string) 5386 if !ok { 5387 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 5388 } 5389 sv.Id = ptr.String(jtv) 5390 } 5391 5392 case "InsightTimeRange": 5393 if err := awsRestjson1_deserializeDocumentInsightTimeRange(&sv.InsightTimeRange, value); err != nil { 5394 return err 5395 } 5396 5397 case "Name": 5398 if value != nil { 5399 jtv, ok := value.(string) 5400 if !ok { 5401 return fmt.Errorf("expected InsightName to be of type string, got %T instead", value) 5402 } 5403 sv.Name = ptr.String(jtv) 5404 } 5405 5406 case "PredictionTimeRange": 5407 if err := awsRestjson1_deserializeDocumentPredictionTimeRange(&sv.PredictionTimeRange, value); err != nil { 5408 return err 5409 } 5410 5411 case "ResourceCollection": 5412 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 5413 return err 5414 } 5415 5416 case "Severity": 5417 if value != nil { 5418 jtv, ok := value.(string) 5419 if !ok { 5420 return fmt.Errorf("expected InsightSeverity to be of type string, got %T instead", value) 5421 } 5422 sv.Severity = types.InsightSeverity(jtv) 5423 } 5424 5425 case "SsmOpsItemId": 5426 if value != nil { 5427 jtv, ok := value.(string) 5428 if !ok { 5429 return fmt.Errorf("expected SsmOpsItemId to be of type string, got %T instead", value) 5430 } 5431 sv.SsmOpsItemId = ptr.String(jtv) 5432 } 5433 5434 case "Status": 5435 if value != nil { 5436 jtv, ok := value.(string) 5437 if !ok { 5438 return fmt.Errorf("expected InsightStatus to be of type string, got %T instead", value) 5439 } 5440 sv.Status = types.InsightStatus(jtv) 5441 } 5442 5443 default: 5444 _, _ = key, value 5445 5446 } 5447 } 5448 *v = sv 5449 return nil 5450} 5451 5452func awsRestjson1_deserializeDocumentProactiveInsights(v *[]types.ProactiveInsightSummary, value interface{}) error { 5453 if v == nil { 5454 return fmt.Errorf("unexpected nil of type %T", v) 5455 } 5456 if value == nil { 5457 return nil 5458 } 5459 5460 shape, ok := value.([]interface{}) 5461 if !ok { 5462 return fmt.Errorf("unexpected JSON type %v", value) 5463 } 5464 5465 var cv []types.ProactiveInsightSummary 5466 if *v == nil { 5467 cv = []types.ProactiveInsightSummary{} 5468 } else { 5469 cv = *v 5470 } 5471 5472 for _, value := range shape { 5473 var col types.ProactiveInsightSummary 5474 destAddr := &col 5475 if err := awsRestjson1_deserializeDocumentProactiveInsightSummary(&destAddr, value); err != nil { 5476 return err 5477 } 5478 col = *destAddr 5479 cv = append(cv, col) 5480 5481 } 5482 *v = cv 5483 return nil 5484} 5485 5486func awsRestjson1_deserializeDocumentProactiveInsightSummary(v **types.ProactiveInsightSummary, value interface{}) error { 5487 if v == nil { 5488 return fmt.Errorf("unexpected nil of type %T", v) 5489 } 5490 if value == nil { 5491 return nil 5492 } 5493 5494 shape, ok := value.(map[string]interface{}) 5495 if !ok { 5496 return fmt.Errorf("unexpected JSON type %v", value) 5497 } 5498 5499 var sv *types.ProactiveInsightSummary 5500 if *v == nil { 5501 sv = &types.ProactiveInsightSummary{} 5502 } else { 5503 sv = *v 5504 } 5505 5506 for key, value := range shape { 5507 switch key { 5508 case "Id": 5509 if value != nil { 5510 jtv, ok := value.(string) 5511 if !ok { 5512 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 5513 } 5514 sv.Id = ptr.String(jtv) 5515 } 5516 5517 case "InsightTimeRange": 5518 if err := awsRestjson1_deserializeDocumentInsightTimeRange(&sv.InsightTimeRange, value); err != nil { 5519 return err 5520 } 5521 5522 case "Name": 5523 if value != nil { 5524 jtv, ok := value.(string) 5525 if !ok { 5526 return fmt.Errorf("expected InsightName to be of type string, got %T instead", value) 5527 } 5528 sv.Name = ptr.String(jtv) 5529 } 5530 5531 case "PredictionTimeRange": 5532 if err := awsRestjson1_deserializeDocumentPredictionTimeRange(&sv.PredictionTimeRange, value); err != nil { 5533 return err 5534 } 5535 5536 case "ResourceCollection": 5537 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 5538 return err 5539 } 5540 5541 case "ServiceCollection": 5542 if err := awsRestjson1_deserializeDocumentServiceCollection(&sv.ServiceCollection, value); err != nil { 5543 return err 5544 } 5545 5546 case "Severity": 5547 if value != nil { 5548 jtv, ok := value.(string) 5549 if !ok { 5550 return fmt.Errorf("expected InsightSeverity to be of type string, got %T instead", value) 5551 } 5552 sv.Severity = types.InsightSeverity(jtv) 5553 } 5554 5555 case "Status": 5556 if value != nil { 5557 jtv, ok := value.(string) 5558 if !ok { 5559 return fmt.Errorf("expected InsightStatus to be of type string, got %T instead", value) 5560 } 5561 sv.Status = types.InsightStatus(jtv) 5562 } 5563 5564 default: 5565 _, _ = key, value 5566 5567 } 5568 } 5569 *v = sv 5570 return nil 5571} 5572 5573func awsRestjson1_deserializeDocumentReactiveAnomalies(v *[]types.ReactiveAnomalySummary, value interface{}) error { 5574 if v == nil { 5575 return fmt.Errorf("unexpected nil of type %T", v) 5576 } 5577 if value == nil { 5578 return nil 5579 } 5580 5581 shape, ok := value.([]interface{}) 5582 if !ok { 5583 return fmt.Errorf("unexpected JSON type %v", value) 5584 } 5585 5586 var cv []types.ReactiveAnomalySummary 5587 if *v == nil { 5588 cv = []types.ReactiveAnomalySummary{} 5589 } else { 5590 cv = *v 5591 } 5592 5593 for _, value := range shape { 5594 var col types.ReactiveAnomalySummary 5595 destAddr := &col 5596 if err := awsRestjson1_deserializeDocumentReactiveAnomalySummary(&destAddr, value); err != nil { 5597 return err 5598 } 5599 col = *destAddr 5600 cv = append(cv, col) 5601 5602 } 5603 *v = cv 5604 return nil 5605} 5606 5607func awsRestjson1_deserializeDocumentReactiveAnomaly(v **types.ReactiveAnomaly, value interface{}) error { 5608 if v == nil { 5609 return fmt.Errorf("unexpected nil of type %T", v) 5610 } 5611 if value == nil { 5612 return nil 5613 } 5614 5615 shape, ok := value.(map[string]interface{}) 5616 if !ok { 5617 return fmt.Errorf("unexpected JSON type %v", value) 5618 } 5619 5620 var sv *types.ReactiveAnomaly 5621 if *v == nil { 5622 sv = &types.ReactiveAnomaly{} 5623 } else { 5624 sv = *v 5625 } 5626 5627 for key, value := range shape { 5628 switch key { 5629 case "AnomalyReportedTimeRange": 5630 if err := awsRestjson1_deserializeDocumentAnomalyReportedTimeRange(&sv.AnomalyReportedTimeRange, value); err != nil { 5631 return err 5632 } 5633 5634 case "AnomalyTimeRange": 5635 if err := awsRestjson1_deserializeDocumentAnomalyTimeRange(&sv.AnomalyTimeRange, value); err != nil { 5636 return err 5637 } 5638 5639 case "AssociatedInsightId": 5640 if value != nil { 5641 jtv, ok := value.(string) 5642 if !ok { 5643 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 5644 } 5645 sv.AssociatedInsightId = ptr.String(jtv) 5646 } 5647 5648 case "Id": 5649 if value != nil { 5650 jtv, ok := value.(string) 5651 if !ok { 5652 return fmt.Errorf("expected AnomalyId to be of type string, got %T instead", value) 5653 } 5654 sv.Id = ptr.String(jtv) 5655 } 5656 5657 case "ResourceCollection": 5658 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 5659 return err 5660 } 5661 5662 case "Severity": 5663 if value != nil { 5664 jtv, ok := value.(string) 5665 if !ok { 5666 return fmt.Errorf("expected AnomalySeverity to be of type string, got %T instead", value) 5667 } 5668 sv.Severity = types.AnomalySeverity(jtv) 5669 } 5670 5671 case "SourceDetails": 5672 if err := awsRestjson1_deserializeDocumentAnomalySourceDetails(&sv.SourceDetails, value); err != nil { 5673 return err 5674 } 5675 5676 case "Status": 5677 if value != nil { 5678 jtv, ok := value.(string) 5679 if !ok { 5680 return fmt.Errorf("expected AnomalyStatus to be of type string, got %T instead", value) 5681 } 5682 sv.Status = types.AnomalyStatus(jtv) 5683 } 5684 5685 default: 5686 _, _ = key, value 5687 5688 } 5689 } 5690 *v = sv 5691 return nil 5692} 5693 5694func awsRestjson1_deserializeDocumentReactiveAnomalySummary(v **types.ReactiveAnomalySummary, value interface{}) error { 5695 if v == nil { 5696 return fmt.Errorf("unexpected nil of type %T", v) 5697 } 5698 if value == nil { 5699 return nil 5700 } 5701 5702 shape, ok := value.(map[string]interface{}) 5703 if !ok { 5704 return fmt.Errorf("unexpected JSON type %v", value) 5705 } 5706 5707 var sv *types.ReactiveAnomalySummary 5708 if *v == nil { 5709 sv = &types.ReactiveAnomalySummary{} 5710 } else { 5711 sv = *v 5712 } 5713 5714 for key, value := range shape { 5715 switch key { 5716 case "AnomalyReportedTimeRange": 5717 if err := awsRestjson1_deserializeDocumentAnomalyReportedTimeRange(&sv.AnomalyReportedTimeRange, value); err != nil { 5718 return err 5719 } 5720 5721 case "AnomalyTimeRange": 5722 if err := awsRestjson1_deserializeDocumentAnomalyTimeRange(&sv.AnomalyTimeRange, value); err != nil { 5723 return err 5724 } 5725 5726 case "AssociatedInsightId": 5727 if value != nil { 5728 jtv, ok := value.(string) 5729 if !ok { 5730 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 5731 } 5732 sv.AssociatedInsightId = ptr.String(jtv) 5733 } 5734 5735 case "Id": 5736 if value != nil { 5737 jtv, ok := value.(string) 5738 if !ok { 5739 return fmt.Errorf("expected AnomalyId to be of type string, got %T instead", value) 5740 } 5741 sv.Id = ptr.String(jtv) 5742 } 5743 5744 case "ResourceCollection": 5745 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 5746 return err 5747 } 5748 5749 case "Severity": 5750 if value != nil { 5751 jtv, ok := value.(string) 5752 if !ok { 5753 return fmt.Errorf("expected AnomalySeverity to be of type string, got %T instead", value) 5754 } 5755 sv.Severity = types.AnomalySeverity(jtv) 5756 } 5757 5758 case "SourceDetails": 5759 if err := awsRestjson1_deserializeDocumentAnomalySourceDetails(&sv.SourceDetails, value); err != nil { 5760 return err 5761 } 5762 5763 case "Status": 5764 if value != nil { 5765 jtv, ok := value.(string) 5766 if !ok { 5767 return fmt.Errorf("expected AnomalyStatus to be of type string, got %T instead", value) 5768 } 5769 sv.Status = types.AnomalyStatus(jtv) 5770 } 5771 5772 default: 5773 _, _ = key, value 5774 5775 } 5776 } 5777 *v = sv 5778 return nil 5779} 5780 5781func awsRestjson1_deserializeDocumentReactiveInsight(v **types.ReactiveInsight, value interface{}) error { 5782 if v == nil { 5783 return fmt.Errorf("unexpected nil of type %T", v) 5784 } 5785 if value == nil { 5786 return nil 5787 } 5788 5789 shape, ok := value.(map[string]interface{}) 5790 if !ok { 5791 return fmt.Errorf("unexpected JSON type %v", value) 5792 } 5793 5794 var sv *types.ReactiveInsight 5795 if *v == nil { 5796 sv = &types.ReactiveInsight{} 5797 } else { 5798 sv = *v 5799 } 5800 5801 for key, value := range shape { 5802 switch key { 5803 case "Id": 5804 if value != nil { 5805 jtv, ok := value.(string) 5806 if !ok { 5807 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 5808 } 5809 sv.Id = ptr.String(jtv) 5810 } 5811 5812 case "InsightTimeRange": 5813 if err := awsRestjson1_deserializeDocumentInsightTimeRange(&sv.InsightTimeRange, value); err != nil { 5814 return err 5815 } 5816 5817 case "Name": 5818 if value != nil { 5819 jtv, ok := value.(string) 5820 if !ok { 5821 return fmt.Errorf("expected InsightName to be of type string, got %T instead", value) 5822 } 5823 sv.Name = ptr.String(jtv) 5824 } 5825 5826 case "ResourceCollection": 5827 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 5828 return err 5829 } 5830 5831 case "Severity": 5832 if value != nil { 5833 jtv, ok := value.(string) 5834 if !ok { 5835 return fmt.Errorf("expected InsightSeverity to be of type string, got %T instead", value) 5836 } 5837 sv.Severity = types.InsightSeverity(jtv) 5838 } 5839 5840 case "SsmOpsItemId": 5841 if value != nil { 5842 jtv, ok := value.(string) 5843 if !ok { 5844 return fmt.Errorf("expected SsmOpsItemId to be of type string, got %T instead", value) 5845 } 5846 sv.SsmOpsItemId = ptr.String(jtv) 5847 } 5848 5849 case "Status": 5850 if value != nil { 5851 jtv, ok := value.(string) 5852 if !ok { 5853 return fmt.Errorf("expected InsightStatus to be of type string, got %T instead", value) 5854 } 5855 sv.Status = types.InsightStatus(jtv) 5856 } 5857 5858 default: 5859 _, _ = key, value 5860 5861 } 5862 } 5863 *v = sv 5864 return nil 5865} 5866 5867func awsRestjson1_deserializeDocumentReactiveInsights(v *[]types.ReactiveInsightSummary, value interface{}) error { 5868 if v == nil { 5869 return fmt.Errorf("unexpected nil of type %T", v) 5870 } 5871 if value == nil { 5872 return nil 5873 } 5874 5875 shape, ok := value.([]interface{}) 5876 if !ok { 5877 return fmt.Errorf("unexpected JSON type %v", value) 5878 } 5879 5880 var cv []types.ReactiveInsightSummary 5881 if *v == nil { 5882 cv = []types.ReactiveInsightSummary{} 5883 } else { 5884 cv = *v 5885 } 5886 5887 for _, value := range shape { 5888 var col types.ReactiveInsightSummary 5889 destAddr := &col 5890 if err := awsRestjson1_deserializeDocumentReactiveInsightSummary(&destAddr, value); err != nil { 5891 return err 5892 } 5893 col = *destAddr 5894 cv = append(cv, col) 5895 5896 } 5897 *v = cv 5898 return nil 5899} 5900 5901func awsRestjson1_deserializeDocumentReactiveInsightSummary(v **types.ReactiveInsightSummary, value interface{}) error { 5902 if v == nil { 5903 return fmt.Errorf("unexpected nil of type %T", v) 5904 } 5905 if value == nil { 5906 return nil 5907 } 5908 5909 shape, ok := value.(map[string]interface{}) 5910 if !ok { 5911 return fmt.Errorf("unexpected JSON type %v", value) 5912 } 5913 5914 var sv *types.ReactiveInsightSummary 5915 if *v == nil { 5916 sv = &types.ReactiveInsightSummary{} 5917 } else { 5918 sv = *v 5919 } 5920 5921 for key, value := range shape { 5922 switch key { 5923 case "Id": 5924 if value != nil { 5925 jtv, ok := value.(string) 5926 if !ok { 5927 return fmt.Errorf("expected InsightId to be of type string, got %T instead", value) 5928 } 5929 sv.Id = ptr.String(jtv) 5930 } 5931 5932 case "InsightTimeRange": 5933 if err := awsRestjson1_deserializeDocumentInsightTimeRange(&sv.InsightTimeRange, value); err != nil { 5934 return err 5935 } 5936 5937 case "Name": 5938 if value != nil { 5939 jtv, ok := value.(string) 5940 if !ok { 5941 return fmt.Errorf("expected InsightName to be of type string, got %T instead", value) 5942 } 5943 sv.Name = ptr.String(jtv) 5944 } 5945 5946 case "ResourceCollection": 5947 if err := awsRestjson1_deserializeDocumentResourceCollection(&sv.ResourceCollection, value); err != nil { 5948 return err 5949 } 5950 5951 case "ServiceCollection": 5952 if err := awsRestjson1_deserializeDocumentServiceCollection(&sv.ServiceCollection, value); err != nil { 5953 return err 5954 } 5955 5956 case "Severity": 5957 if value != nil { 5958 jtv, ok := value.(string) 5959 if !ok { 5960 return fmt.Errorf("expected InsightSeverity to be of type string, got %T instead", value) 5961 } 5962 sv.Severity = types.InsightSeverity(jtv) 5963 } 5964 5965 case "Status": 5966 if value != nil { 5967 jtv, ok := value.(string) 5968 if !ok { 5969 return fmt.Errorf("expected InsightStatus to be of type string, got %T instead", value) 5970 } 5971 sv.Status = types.InsightStatus(jtv) 5972 } 5973 5974 default: 5975 _, _ = key, value 5976 5977 } 5978 } 5979 *v = sv 5980 return nil 5981} 5982 5983func awsRestjson1_deserializeDocumentRecommendation(v **types.Recommendation, value interface{}) error { 5984 if v == nil { 5985 return fmt.Errorf("unexpected nil of type %T", v) 5986 } 5987 if value == nil { 5988 return nil 5989 } 5990 5991 shape, ok := value.(map[string]interface{}) 5992 if !ok { 5993 return fmt.Errorf("unexpected JSON type %v", value) 5994 } 5995 5996 var sv *types.Recommendation 5997 if *v == nil { 5998 sv = &types.Recommendation{} 5999 } else { 6000 sv = *v 6001 } 6002 6003 for key, value := range shape { 6004 switch key { 6005 case "Description": 6006 if value != nil { 6007 jtv, ok := value.(string) 6008 if !ok { 6009 return fmt.Errorf("expected RecommendationDescription to be of type string, got %T instead", value) 6010 } 6011 sv.Description = ptr.String(jtv) 6012 } 6013 6014 case "Link": 6015 if value != nil { 6016 jtv, ok := value.(string) 6017 if !ok { 6018 return fmt.Errorf("expected RecommendationLink to be of type string, got %T instead", value) 6019 } 6020 sv.Link = ptr.String(jtv) 6021 } 6022 6023 case "Name": 6024 if value != nil { 6025 jtv, ok := value.(string) 6026 if !ok { 6027 return fmt.Errorf("expected RecommendationName to be of type string, got %T instead", value) 6028 } 6029 sv.Name = ptr.String(jtv) 6030 } 6031 6032 case "Reason": 6033 if value != nil { 6034 jtv, ok := value.(string) 6035 if !ok { 6036 return fmt.Errorf("expected RecommendationReason to be of type string, got %T instead", value) 6037 } 6038 sv.Reason = ptr.String(jtv) 6039 } 6040 6041 case "RelatedAnomalies": 6042 if err := awsRestjson1_deserializeDocumentRecommendationRelatedAnomalies(&sv.RelatedAnomalies, value); err != nil { 6043 return err 6044 } 6045 6046 case "RelatedEvents": 6047 if err := awsRestjson1_deserializeDocumentRecommendationRelatedEvents(&sv.RelatedEvents, value); err != nil { 6048 return err 6049 } 6050 6051 default: 6052 _, _ = key, value 6053 6054 } 6055 } 6056 *v = sv 6057 return nil 6058} 6059 6060func awsRestjson1_deserializeDocumentRecommendationRelatedAnomalies(v *[]types.RecommendationRelatedAnomaly, value interface{}) error { 6061 if v == nil { 6062 return fmt.Errorf("unexpected nil of type %T", v) 6063 } 6064 if value == nil { 6065 return nil 6066 } 6067 6068 shape, ok := value.([]interface{}) 6069 if !ok { 6070 return fmt.Errorf("unexpected JSON type %v", value) 6071 } 6072 6073 var cv []types.RecommendationRelatedAnomaly 6074 if *v == nil { 6075 cv = []types.RecommendationRelatedAnomaly{} 6076 } else { 6077 cv = *v 6078 } 6079 6080 for _, value := range shape { 6081 var col types.RecommendationRelatedAnomaly 6082 destAddr := &col 6083 if err := awsRestjson1_deserializeDocumentRecommendationRelatedAnomaly(&destAddr, value); err != nil { 6084 return err 6085 } 6086 col = *destAddr 6087 cv = append(cv, col) 6088 6089 } 6090 *v = cv 6091 return nil 6092} 6093 6094func awsRestjson1_deserializeDocumentRecommendationRelatedAnomaly(v **types.RecommendationRelatedAnomaly, value interface{}) error { 6095 if v == nil { 6096 return fmt.Errorf("unexpected nil of type %T", v) 6097 } 6098 if value == nil { 6099 return nil 6100 } 6101 6102 shape, ok := value.(map[string]interface{}) 6103 if !ok { 6104 return fmt.Errorf("unexpected JSON type %v", value) 6105 } 6106 6107 var sv *types.RecommendationRelatedAnomaly 6108 if *v == nil { 6109 sv = &types.RecommendationRelatedAnomaly{} 6110 } else { 6111 sv = *v 6112 } 6113 6114 for key, value := range shape { 6115 switch key { 6116 case "Resources": 6117 if err := awsRestjson1_deserializeDocumentRecommendationRelatedAnomalyResources(&sv.Resources, value); err != nil { 6118 return err 6119 } 6120 6121 case "SourceDetails": 6122 if err := awsRestjson1_deserializeDocumentRelatedAnomalySourceDetails(&sv.SourceDetails, value); err != nil { 6123 return err 6124 } 6125 6126 default: 6127 _, _ = key, value 6128 6129 } 6130 } 6131 *v = sv 6132 return nil 6133} 6134 6135func awsRestjson1_deserializeDocumentRecommendationRelatedAnomalyResource(v **types.RecommendationRelatedAnomalyResource, value interface{}) error { 6136 if v == nil { 6137 return fmt.Errorf("unexpected nil of type %T", v) 6138 } 6139 if value == nil { 6140 return nil 6141 } 6142 6143 shape, ok := value.(map[string]interface{}) 6144 if !ok { 6145 return fmt.Errorf("unexpected JSON type %v", value) 6146 } 6147 6148 var sv *types.RecommendationRelatedAnomalyResource 6149 if *v == nil { 6150 sv = &types.RecommendationRelatedAnomalyResource{} 6151 } else { 6152 sv = *v 6153 } 6154 6155 for key, value := range shape { 6156 switch key { 6157 case "Name": 6158 if value != nil { 6159 jtv, ok := value.(string) 6160 if !ok { 6161 return fmt.Errorf("expected RecommendationRelatedAnomalyResourceName to be of type string, got %T instead", value) 6162 } 6163 sv.Name = ptr.String(jtv) 6164 } 6165 6166 case "Type": 6167 if value != nil { 6168 jtv, ok := value.(string) 6169 if !ok { 6170 return fmt.Errorf("expected RecommendationRelatedAnomalyResourceType to be of type string, got %T instead", value) 6171 } 6172 sv.Type = ptr.String(jtv) 6173 } 6174 6175 default: 6176 _, _ = key, value 6177 6178 } 6179 } 6180 *v = sv 6181 return nil 6182} 6183 6184func awsRestjson1_deserializeDocumentRecommendationRelatedAnomalyResources(v *[]types.RecommendationRelatedAnomalyResource, value interface{}) error { 6185 if v == nil { 6186 return fmt.Errorf("unexpected nil of type %T", v) 6187 } 6188 if value == nil { 6189 return nil 6190 } 6191 6192 shape, ok := value.([]interface{}) 6193 if !ok { 6194 return fmt.Errorf("unexpected JSON type %v", value) 6195 } 6196 6197 var cv []types.RecommendationRelatedAnomalyResource 6198 if *v == nil { 6199 cv = []types.RecommendationRelatedAnomalyResource{} 6200 } else { 6201 cv = *v 6202 } 6203 6204 for _, value := range shape { 6205 var col types.RecommendationRelatedAnomalyResource 6206 destAddr := &col 6207 if err := awsRestjson1_deserializeDocumentRecommendationRelatedAnomalyResource(&destAddr, value); err != nil { 6208 return err 6209 } 6210 col = *destAddr 6211 cv = append(cv, col) 6212 6213 } 6214 *v = cv 6215 return nil 6216} 6217 6218func awsRestjson1_deserializeDocumentRecommendationRelatedAnomalySourceDetail(v **types.RecommendationRelatedAnomalySourceDetail, value interface{}) error { 6219 if v == nil { 6220 return fmt.Errorf("unexpected nil of type %T", v) 6221 } 6222 if value == nil { 6223 return nil 6224 } 6225 6226 shape, ok := value.(map[string]interface{}) 6227 if !ok { 6228 return fmt.Errorf("unexpected JSON type %v", value) 6229 } 6230 6231 var sv *types.RecommendationRelatedAnomalySourceDetail 6232 if *v == nil { 6233 sv = &types.RecommendationRelatedAnomalySourceDetail{} 6234 } else { 6235 sv = *v 6236 } 6237 6238 for key, value := range shape { 6239 switch key { 6240 case "CloudWatchMetrics": 6241 if err := awsRestjson1_deserializeDocumentRecommendationRelatedCloudWatchMetricsSourceDetails(&sv.CloudWatchMetrics, value); err != nil { 6242 return err 6243 } 6244 6245 default: 6246 _, _ = key, value 6247 6248 } 6249 } 6250 *v = sv 6251 return nil 6252} 6253 6254func awsRestjson1_deserializeDocumentRecommendationRelatedCloudWatchMetricsSourceDetail(v **types.RecommendationRelatedCloudWatchMetricsSourceDetail, value interface{}) error { 6255 if v == nil { 6256 return fmt.Errorf("unexpected nil of type %T", v) 6257 } 6258 if value == nil { 6259 return nil 6260 } 6261 6262 shape, ok := value.(map[string]interface{}) 6263 if !ok { 6264 return fmt.Errorf("unexpected JSON type %v", value) 6265 } 6266 6267 var sv *types.RecommendationRelatedCloudWatchMetricsSourceDetail 6268 if *v == nil { 6269 sv = &types.RecommendationRelatedCloudWatchMetricsSourceDetail{} 6270 } else { 6271 sv = *v 6272 } 6273 6274 for key, value := range shape { 6275 switch key { 6276 case "MetricName": 6277 if value != nil { 6278 jtv, ok := value.(string) 6279 if !ok { 6280 return fmt.Errorf("expected RecommendationRelatedCloudWatchMetricsSourceMetricName to be of type string, got %T instead", value) 6281 } 6282 sv.MetricName = ptr.String(jtv) 6283 } 6284 6285 case "Namespace": 6286 if value != nil { 6287 jtv, ok := value.(string) 6288 if !ok { 6289 return fmt.Errorf("expected RecommendationRelatedCloudWatchMetricsSourceNamespace to be of type string, got %T instead", value) 6290 } 6291 sv.Namespace = ptr.String(jtv) 6292 } 6293 6294 default: 6295 _, _ = key, value 6296 6297 } 6298 } 6299 *v = sv 6300 return nil 6301} 6302 6303func awsRestjson1_deserializeDocumentRecommendationRelatedCloudWatchMetricsSourceDetails(v *[]types.RecommendationRelatedCloudWatchMetricsSourceDetail, value interface{}) error { 6304 if v == nil { 6305 return fmt.Errorf("unexpected nil of type %T", v) 6306 } 6307 if value == nil { 6308 return nil 6309 } 6310 6311 shape, ok := value.([]interface{}) 6312 if !ok { 6313 return fmt.Errorf("unexpected JSON type %v", value) 6314 } 6315 6316 var cv []types.RecommendationRelatedCloudWatchMetricsSourceDetail 6317 if *v == nil { 6318 cv = []types.RecommendationRelatedCloudWatchMetricsSourceDetail{} 6319 } else { 6320 cv = *v 6321 } 6322 6323 for _, value := range shape { 6324 var col types.RecommendationRelatedCloudWatchMetricsSourceDetail 6325 destAddr := &col 6326 if err := awsRestjson1_deserializeDocumentRecommendationRelatedCloudWatchMetricsSourceDetail(&destAddr, value); err != nil { 6327 return err 6328 } 6329 col = *destAddr 6330 cv = append(cv, col) 6331 6332 } 6333 *v = cv 6334 return nil 6335} 6336 6337func awsRestjson1_deserializeDocumentRecommendationRelatedEvent(v **types.RecommendationRelatedEvent, value interface{}) error { 6338 if v == nil { 6339 return fmt.Errorf("unexpected nil of type %T", v) 6340 } 6341 if value == nil { 6342 return nil 6343 } 6344 6345 shape, ok := value.(map[string]interface{}) 6346 if !ok { 6347 return fmt.Errorf("unexpected JSON type %v", value) 6348 } 6349 6350 var sv *types.RecommendationRelatedEvent 6351 if *v == nil { 6352 sv = &types.RecommendationRelatedEvent{} 6353 } else { 6354 sv = *v 6355 } 6356 6357 for key, value := range shape { 6358 switch key { 6359 case "Name": 6360 if value != nil { 6361 jtv, ok := value.(string) 6362 if !ok { 6363 return fmt.Errorf("expected RecommendationRelatedEventName to be of type string, got %T instead", value) 6364 } 6365 sv.Name = ptr.String(jtv) 6366 } 6367 6368 case "Resources": 6369 if err := awsRestjson1_deserializeDocumentRecommendationRelatedEventResources(&sv.Resources, value); err != nil { 6370 return err 6371 } 6372 6373 default: 6374 _, _ = key, value 6375 6376 } 6377 } 6378 *v = sv 6379 return nil 6380} 6381 6382func awsRestjson1_deserializeDocumentRecommendationRelatedEventResource(v **types.RecommendationRelatedEventResource, value interface{}) error { 6383 if v == nil { 6384 return fmt.Errorf("unexpected nil of type %T", v) 6385 } 6386 if value == nil { 6387 return nil 6388 } 6389 6390 shape, ok := value.(map[string]interface{}) 6391 if !ok { 6392 return fmt.Errorf("unexpected JSON type %v", value) 6393 } 6394 6395 var sv *types.RecommendationRelatedEventResource 6396 if *v == nil { 6397 sv = &types.RecommendationRelatedEventResource{} 6398 } else { 6399 sv = *v 6400 } 6401 6402 for key, value := range shape { 6403 switch key { 6404 case "Name": 6405 if value != nil { 6406 jtv, ok := value.(string) 6407 if !ok { 6408 return fmt.Errorf("expected RecommendationRelatedEventResourceName to be of type string, got %T instead", value) 6409 } 6410 sv.Name = ptr.String(jtv) 6411 } 6412 6413 case "Type": 6414 if value != nil { 6415 jtv, ok := value.(string) 6416 if !ok { 6417 return fmt.Errorf("expected RecommendationRelatedEventResourceType to be of type string, got %T instead", value) 6418 } 6419 sv.Type = ptr.String(jtv) 6420 } 6421 6422 default: 6423 _, _ = key, value 6424 6425 } 6426 } 6427 *v = sv 6428 return nil 6429} 6430 6431func awsRestjson1_deserializeDocumentRecommendationRelatedEventResources(v *[]types.RecommendationRelatedEventResource, value interface{}) error { 6432 if v == nil { 6433 return fmt.Errorf("unexpected nil of type %T", v) 6434 } 6435 if value == nil { 6436 return nil 6437 } 6438 6439 shape, ok := value.([]interface{}) 6440 if !ok { 6441 return fmt.Errorf("unexpected JSON type %v", value) 6442 } 6443 6444 var cv []types.RecommendationRelatedEventResource 6445 if *v == nil { 6446 cv = []types.RecommendationRelatedEventResource{} 6447 } else { 6448 cv = *v 6449 } 6450 6451 for _, value := range shape { 6452 var col types.RecommendationRelatedEventResource 6453 destAddr := &col 6454 if err := awsRestjson1_deserializeDocumentRecommendationRelatedEventResource(&destAddr, value); err != nil { 6455 return err 6456 } 6457 col = *destAddr 6458 cv = append(cv, col) 6459 6460 } 6461 *v = cv 6462 return nil 6463} 6464 6465func awsRestjson1_deserializeDocumentRecommendationRelatedEvents(v *[]types.RecommendationRelatedEvent, value interface{}) error { 6466 if v == nil { 6467 return fmt.Errorf("unexpected nil of type %T", v) 6468 } 6469 if value == nil { 6470 return nil 6471 } 6472 6473 shape, ok := value.([]interface{}) 6474 if !ok { 6475 return fmt.Errorf("unexpected JSON type %v", value) 6476 } 6477 6478 var cv []types.RecommendationRelatedEvent 6479 if *v == nil { 6480 cv = []types.RecommendationRelatedEvent{} 6481 } else { 6482 cv = *v 6483 } 6484 6485 for _, value := range shape { 6486 var col types.RecommendationRelatedEvent 6487 destAddr := &col 6488 if err := awsRestjson1_deserializeDocumentRecommendationRelatedEvent(&destAddr, value); err != nil { 6489 return err 6490 } 6491 col = *destAddr 6492 cv = append(cv, col) 6493 6494 } 6495 *v = cv 6496 return nil 6497} 6498 6499func awsRestjson1_deserializeDocumentRecommendations(v *[]types.Recommendation, value interface{}) error { 6500 if v == nil { 6501 return fmt.Errorf("unexpected nil of type %T", v) 6502 } 6503 if value == nil { 6504 return nil 6505 } 6506 6507 shape, ok := value.([]interface{}) 6508 if !ok { 6509 return fmt.Errorf("unexpected JSON type %v", value) 6510 } 6511 6512 var cv []types.Recommendation 6513 if *v == nil { 6514 cv = []types.Recommendation{} 6515 } else { 6516 cv = *v 6517 } 6518 6519 for _, value := range shape { 6520 var col types.Recommendation 6521 destAddr := &col 6522 if err := awsRestjson1_deserializeDocumentRecommendation(&destAddr, value); err != nil { 6523 return err 6524 } 6525 col = *destAddr 6526 cv = append(cv, col) 6527 6528 } 6529 *v = cv 6530 return nil 6531} 6532 6533func awsRestjson1_deserializeDocumentRelatedAnomalySourceDetails(v *[]types.RecommendationRelatedAnomalySourceDetail, value interface{}) error { 6534 if v == nil { 6535 return fmt.Errorf("unexpected nil of type %T", v) 6536 } 6537 if value == nil { 6538 return nil 6539 } 6540 6541 shape, ok := value.([]interface{}) 6542 if !ok { 6543 return fmt.Errorf("unexpected JSON type %v", value) 6544 } 6545 6546 var cv []types.RecommendationRelatedAnomalySourceDetail 6547 if *v == nil { 6548 cv = []types.RecommendationRelatedAnomalySourceDetail{} 6549 } else { 6550 cv = *v 6551 } 6552 6553 for _, value := range shape { 6554 var col types.RecommendationRelatedAnomalySourceDetail 6555 destAddr := &col 6556 if err := awsRestjson1_deserializeDocumentRecommendationRelatedAnomalySourceDetail(&destAddr, value); err != nil { 6557 return err 6558 } 6559 col = *destAddr 6560 cv = append(cv, col) 6561 6562 } 6563 *v = cv 6564 return nil 6565} 6566 6567func awsRestjson1_deserializeDocumentResourceCollection(v **types.ResourceCollection, value interface{}) error { 6568 if v == nil { 6569 return fmt.Errorf("unexpected nil of type %T", v) 6570 } 6571 if value == nil { 6572 return nil 6573 } 6574 6575 shape, ok := value.(map[string]interface{}) 6576 if !ok { 6577 return fmt.Errorf("unexpected JSON type %v", value) 6578 } 6579 6580 var sv *types.ResourceCollection 6581 if *v == nil { 6582 sv = &types.ResourceCollection{} 6583 } else { 6584 sv = *v 6585 } 6586 6587 for key, value := range shape { 6588 switch key { 6589 case "CloudFormation": 6590 if err := awsRestjson1_deserializeDocumentCloudFormationCollection(&sv.CloudFormation, value); err != nil { 6591 return err 6592 } 6593 6594 default: 6595 _, _ = key, value 6596 6597 } 6598 } 6599 *v = sv 6600 return nil 6601} 6602 6603func awsRestjson1_deserializeDocumentResourceCollectionFilter(v **types.ResourceCollectionFilter, value interface{}) error { 6604 if v == nil { 6605 return fmt.Errorf("unexpected nil of type %T", v) 6606 } 6607 if value == nil { 6608 return nil 6609 } 6610 6611 shape, ok := value.(map[string]interface{}) 6612 if !ok { 6613 return fmt.Errorf("unexpected JSON type %v", value) 6614 } 6615 6616 var sv *types.ResourceCollectionFilter 6617 if *v == nil { 6618 sv = &types.ResourceCollectionFilter{} 6619 } else { 6620 sv = *v 6621 } 6622 6623 for key, value := range shape { 6624 switch key { 6625 case "CloudFormation": 6626 if err := awsRestjson1_deserializeDocumentCloudFormationCollectionFilter(&sv.CloudFormation, value); err != nil { 6627 return err 6628 } 6629 6630 default: 6631 _, _ = key, value 6632 6633 } 6634 } 6635 *v = sv 6636 return nil 6637} 6638 6639func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { 6640 if v == nil { 6641 return fmt.Errorf("unexpected nil of type %T", v) 6642 } 6643 if value == nil { 6644 return nil 6645 } 6646 6647 shape, ok := value.(map[string]interface{}) 6648 if !ok { 6649 return fmt.Errorf("unexpected JSON type %v", value) 6650 } 6651 6652 var sv *types.ResourceNotFoundException 6653 if *v == nil { 6654 sv = &types.ResourceNotFoundException{} 6655 } else { 6656 sv = *v 6657 } 6658 6659 for key, value := range shape { 6660 switch key { 6661 case "Message": 6662 if value != nil { 6663 jtv, ok := value.(string) 6664 if !ok { 6665 return fmt.Errorf("expected ErrorMessageString to be of type string, got %T instead", value) 6666 } 6667 sv.Message = ptr.String(jtv) 6668 } 6669 6670 case "ResourceId": 6671 if value != nil { 6672 jtv, ok := value.(string) 6673 if !ok { 6674 return fmt.Errorf("expected ResourceIdString to be of type string, got %T instead", value) 6675 } 6676 sv.ResourceId = ptr.String(jtv) 6677 } 6678 6679 case "ResourceType": 6680 if value != nil { 6681 jtv, ok := value.(string) 6682 if !ok { 6683 return fmt.Errorf("expected ResourceIdType to be of type string, got %T instead", value) 6684 } 6685 sv.ResourceType = ptr.String(jtv) 6686 } 6687 6688 default: 6689 _, _ = key, value 6690 6691 } 6692 } 6693 *v = sv 6694 return nil 6695} 6696 6697func awsRestjson1_deserializeDocumentServiceCollection(v **types.ServiceCollection, value interface{}) error { 6698 if v == nil { 6699 return fmt.Errorf("unexpected nil of type %T", v) 6700 } 6701 if value == nil { 6702 return nil 6703 } 6704 6705 shape, ok := value.(map[string]interface{}) 6706 if !ok { 6707 return fmt.Errorf("unexpected JSON type %v", value) 6708 } 6709 6710 var sv *types.ServiceCollection 6711 if *v == nil { 6712 sv = &types.ServiceCollection{} 6713 } else { 6714 sv = *v 6715 } 6716 6717 for key, value := range shape { 6718 switch key { 6719 case "ServiceNames": 6720 if err := awsRestjson1_deserializeDocumentServiceNames(&sv.ServiceNames, value); err != nil { 6721 return err 6722 } 6723 6724 default: 6725 _, _ = key, value 6726 6727 } 6728 } 6729 *v = sv 6730 return nil 6731} 6732 6733func awsRestjson1_deserializeDocumentServiceHealth(v **types.ServiceHealth, value interface{}) error { 6734 if v == nil { 6735 return fmt.Errorf("unexpected nil of type %T", v) 6736 } 6737 if value == nil { 6738 return nil 6739 } 6740 6741 shape, ok := value.(map[string]interface{}) 6742 if !ok { 6743 return fmt.Errorf("unexpected JSON type %v", value) 6744 } 6745 6746 var sv *types.ServiceHealth 6747 if *v == nil { 6748 sv = &types.ServiceHealth{} 6749 } else { 6750 sv = *v 6751 } 6752 6753 for key, value := range shape { 6754 switch key { 6755 case "Insight": 6756 if err := awsRestjson1_deserializeDocumentServiceInsightHealth(&sv.Insight, value); err != nil { 6757 return err 6758 } 6759 6760 case "ServiceName": 6761 if value != nil { 6762 jtv, ok := value.(string) 6763 if !ok { 6764 return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) 6765 } 6766 sv.ServiceName = types.ServiceName(jtv) 6767 } 6768 6769 default: 6770 _, _ = key, value 6771 6772 } 6773 } 6774 *v = sv 6775 return nil 6776} 6777 6778func awsRestjson1_deserializeDocumentServiceHealths(v *[]types.ServiceHealth, value interface{}) error { 6779 if v == nil { 6780 return fmt.Errorf("unexpected nil of type %T", v) 6781 } 6782 if value == nil { 6783 return nil 6784 } 6785 6786 shape, ok := value.([]interface{}) 6787 if !ok { 6788 return fmt.Errorf("unexpected JSON type %v", value) 6789 } 6790 6791 var cv []types.ServiceHealth 6792 if *v == nil { 6793 cv = []types.ServiceHealth{} 6794 } else { 6795 cv = *v 6796 } 6797 6798 for _, value := range shape { 6799 var col types.ServiceHealth 6800 destAddr := &col 6801 if err := awsRestjson1_deserializeDocumentServiceHealth(&destAddr, value); err != nil { 6802 return err 6803 } 6804 col = *destAddr 6805 cv = append(cv, col) 6806 6807 } 6808 *v = cv 6809 return nil 6810} 6811 6812func awsRestjson1_deserializeDocumentServiceInsightHealth(v **types.ServiceInsightHealth, value interface{}) error { 6813 if v == nil { 6814 return fmt.Errorf("unexpected nil of type %T", v) 6815 } 6816 if value == nil { 6817 return nil 6818 } 6819 6820 shape, ok := value.(map[string]interface{}) 6821 if !ok { 6822 return fmt.Errorf("unexpected JSON type %v", value) 6823 } 6824 6825 var sv *types.ServiceInsightHealth 6826 if *v == nil { 6827 sv = &types.ServiceInsightHealth{} 6828 } else { 6829 sv = *v 6830 } 6831 6832 for key, value := range shape { 6833 switch key { 6834 case "OpenProactiveInsights": 6835 if value != nil { 6836 jtv, ok := value.(json.Number) 6837 if !ok { 6838 return fmt.Errorf("expected NumOpenProactiveInsights to be json.Number, got %T instead", value) 6839 } 6840 i64, err := jtv.Int64() 6841 if err != nil { 6842 return err 6843 } 6844 sv.OpenProactiveInsights = int32(i64) 6845 } 6846 6847 case "OpenReactiveInsights": 6848 if value != nil { 6849 jtv, ok := value.(json.Number) 6850 if !ok { 6851 return fmt.Errorf("expected NumOpenReactiveInsights to be json.Number, got %T instead", value) 6852 } 6853 i64, err := jtv.Int64() 6854 if err != nil { 6855 return err 6856 } 6857 sv.OpenReactiveInsights = int32(i64) 6858 } 6859 6860 default: 6861 _, _ = key, value 6862 6863 } 6864 } 6865 *v = sv 6866 return nil 6867} 6868 6869func awsRestjson1_deserializeDocumentServiceIntegrationConfig(v **types.ServiceIntegrationConfig, value interface{}) error { 6870 if v == nil { 6871 return fmt.Errorf("unexpected nil of type %T", v) 6872 } 6873 if value == nil { 6874 return nil 6875 } 6876 6877 shape, ok := value.(map[string]interface{}) 6878 if !ok { 6879 return fmt.Errorf("unexpected JSON type %v", value) 6880 } 6881 6882 var sv *types.ServiceIntegrationConfig 6883 if *v == nil { 6884 sv = &types.ServiceIntegrationConfig{} 6885 } else { 6886 sv = *v 6887 } 6888 6889 for key, value := range shape { 6890 switch key { 6891 case "OpsCenter": 6892 if err := awsRestjson1_deserializeDocumentOpsCenterIntegration(&sv.OpsCenter, value); err != nil { 6893 return err 6894 } 6895 6896 default: 6897 _, _ = key, value 6898 6899 } 6900 } 6901 *v = sv 6902 return nil 6903} 6904 6905func awsRestjson1_deserializeDocumentServiceNames(v *[]types.ServiceName, value interface{}) error { 6906 if v == nil { 6907 return fmt.Errorf("unexpected nil of type %T", v) 6908 } 6909 if value == nil { 6910 return nil 6911 } 6912 6913 shape, ok := value.([]interface{}) 6914 if !ok { 6915 return fmt.Errorf("unexpected JSON type %v", value) 6916 } 6917 6918 var cv []types.ServiceName 6919 if *v == nil { 6920 cv = []types.ServiceName{} 6921 } else { 6922 cv = *v 6923 } 6924 6925 for _, value := range shape { 6926 var col types.ServiceName 6927 if value != nil { 6928 jtv, ok := value.(string) 6929 if !ok { 6930 return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) 6931 } 6932 col = types.ServiceName(jtv) 6933 } 6934 cv = append(cv, col) 6935 6936 } 6937 *v = cv 6938 return nil 6939} 6940 6941func awsRestjson1_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error { 6942 if v == nil { 6943 return fmt.Errorf("unexpected nil of type %T", v) 6944 } 6945 if value == nil { 6946 return nil 6947 } 6948 6949 shape, ok := value.(map[string]interface{}) 6950 if !ok { 6951 return fmt.Errorf("unexpected JSON type %v", value) 6952 } 6953 6954 var sv *types.ServiceQuotaExceededException 6955 if *v == nil { 6956 sv = &types.ServiceQuotaExceededException{} 6957 } else { 6958 sv = *v 6959 } 6960 6961 for key, value := range shape { 6962 switch key { 6963 case "Message": 6964 if value != nil { 6965 jtv, ok := value.(string) 6966 if !ok { 6967 return fmt.Errorf("expected ErrorMessageString to be of type string, got %T instead", value) 6968 } 6969 sv.Message = ptr.String(jtv) 6970 } 6971 6972 default: 6973 _, _ = key, value 6974 6975 } 6976 } 6977 *v = sv 6978 return nil 6979} 6980 6981func awsRestjson1_deserializeDocumentServiceResourceCost(v **types.ServiceResourceCost, value interface{}) error { 6982 if v == nil { 6983 return fmt.Errorf("unexpected nil of type %T", v) 6984 } 6985 if value == nil { 6986 return nil 6987 } 6988 6989 shape, ok := value.(map[string]interface{}) 6990 if !ok { 6991 return fmt.Errorf("unexpected JSON type %v", value) 6992 } 6993 6994 var sv *types.ServiceResourceCost 6995 if *v == nil { 6996 sv = &types.ServiceResourceCost{} 6997 } else { 6998 sv = *v 6999 } 7000 7001 for key, value := range shape { 7002 switch key { 7003 case "Cost": 7004 if value != nil { 7005 switch jtv := value.(type) { 7006 case json.Number: 7007 f64, err := jtv.Float64() 7008 if err != nil { 7009 return err 7010 } 7011 sv.Cost = f64 7012 7013 case string: 7014 var f64 float64 7015 switch { 7016 case strings.EqualFold(jtv, "NaN"): 7017 f64 = math.NaN() 7018 7019 case strings.EqualFold(jtv, "Infinity"): 7020 f64 = math.Inf(1) 7021 7022 case strings.EqualFold(jtv, "-Infinity"): 7023 f64 = math.Inf(-1) 7024 7025 default: 7026 return fmt.Errorf("unknown JSON number value: %s", jtv) 7027 7028 } 7029 sv.Cost = f64 7030 7031 default: 7032 return fmt.Errorf("expected Cost to be a JSON Number, got %T instead", value) 7033 7034 } 7035 } 7036 7037 case "Count": 7038 if value != nil { 7039 jtv, ok := value.(json.Number) 7040 if !ok { 7041 return fmt.Errorf("expected CostEstimationServiceResourceCount to be json.Number, got %T instead", value) 7042 } 7043 i64, err := jtv.Int64() 7044 if err != nil { 7045 return err 7046 } 7047 sv.Count = int32(i64) 7048 } 7049 7050 case "State": 7051 if value != nil { 7052 jtv, ok := value.(string) 7053 if !ok { 7054 return fmt.Errorf("expected CostEstimationServiceResourceState to be of type string, got %T instead", value) 7055 } 7056 sv.State = types.CostEstimationServiceResourceState(jtv) 7057 } 7058 7059 case "Type": 7060 if value != nil { 7061 jtv, ok := value.(string) 7062 if !ok { 7063 return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value) 7064 } 7065 sv.Type = ptr.String(jtv) 7066 } 7067 7068 case "UnitCost": 7069 if value != nil { 7070 switch jtv := value.(type) { 7071 case json.Number: 7072 f64, err := jtv.Float64() 7073 if err != nil { 7074 return err 7075 } 7076 sv.UnitCost = f64 7077 7078 case string: 7079 var f64 float64 7080 switch { 7081 case strings.EqualFold(jtv, "NaN"): 7082 f64 = math.NaN() 7083 7084 case strings.EqualFold(jtv, "Infinity"): 7085 f64 = math.Inf(1) 7086 7087 case strings.EqualFold(jtv, "-Infinity"): 7088 f64 = math.Inf(-1) 7089 7090 default: 7091 return fmt.Errorf("unknown JSON number value: %s", jtv) 7092 7093 } 7094 sv.UnitCost = f64 7095 7096 default: 7097 return fmt.Errorf("expected Cost to be a JSON Number, got %T instead", value) 7098 7099 } 7100 } 7101 7102 default: 7103 _, _ = key, value 7104 7105 } 7106 } 7107 *v = sv 7108 return nil 7109} 7110 7111func awsRestjson1_deserializeDocumentServiceResourceCosts(v *[]types.ServiceResourceCost, value interface{}) error { 7112 if v == nil { 7113 return fmt.Errorf("unexpected nil of type %T", v) 7114 } 7115 if value == nil { 7116 return nil 7117 } 7118 7119 shape, ok := value.([]interface{}) 7120 if !ok { 7121 return fmt.Errorf("unexpected JSON type %v", value) 7122 } 7123 7124 var cv []types.ServiceResourceCost 7125 if *v == nil { 7126 cv = []types.ServiceResourceCost{} 7127 } else { 7128 cv = *v 7129 } 7130 7131 for _, value := range shape { 7132 var col types.ServiceResourceCost 7133 destAddr := &col 7134 if err := awsRestjson1_deserializeDocumentServiceResourceCost(&destAddr, value); err != nil { 7135 return err 7136 } 7137 col = *destAddr 7138 cv = append(cv, col) 7139 7140 } 7141 *v = cv 7142 return nil 7143} 7144 7145func awsRestjson1_deserializeDocumentSnsChannelConfig(v **types.SnsChannelConfig, value interface{}) error { 7146 if v == nil { 7147 return fmt.Errorf("unexpected nil of type %T", v) 7148 } 7149 if value == nil { 7150 return nil 7151 } 7152 7153 shape, ok := value.(map[string]interface{}) 7154 if !ok { 7155 return fmt.Errorf("unexpected JSON type %v", value) 7156 } 7157 7158 var sv *types.SnsChannelConfig 7159 if *v == nil { 7160 sv = &types.SnsChannelConfig{} 7161 } else { 7162 sv = *v 7163 } 7164 7165 for key, value := range shape { 7166 switch key { 7167 case "TopicArn": 7168 if value != nil { 7169 jtv, ok := value.(string) 7170 if !ok { 7171 return fmt.Errorf("expected TopicArn to be of type string, got %T instead", value) 7172 } 7173 sv.TopicArn = ptr.String(jtv) 7174 } 7175 7176 default: 7177 _, _ = key, value 7178 7179 } 7180 } 7181 *v = sv 7182 return nil 7183} 7184 7185func awsRestjson1_deserializeDocumentStackNames(v *[]string, value interface{}) error { 7186 if v == nil { 7187 return fmt.Errorf("unexpected nil of type %T", v) 7188 } 7189 if value == nil { 7190 return nil 7191 } 7192 7193 shape, ok := value.([]interface{}) 7194 if !ok { 7195 return fmt.Errorf("unexpected JSON type %v", value) 7196 } 7197 7198 var cv []string 7199 if *v == nil { 7200 cv = []string{} 7201 } else { 7202 cv = *v 7203 } 7204 7205 for _, value := range shape { 7206 var col string 7207 if value != nil { 7208 jtv, ok := value.(string) 7209 if !ok { 7210 return fmt.Errorf("expected StackName to be of type string, got %T instead", value) 7211 } 7212 col = jtv 7213 } 7214 cv = append(cv, col) 7215 7216 } 7217 *v = cv 7218 return nil 7219} 7220 7221func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { 7222 if v == nil { 7223 return fmt.Errorf("unexpected nil of type %T", v) 7224 } 7225 if value == nil { 7226 return nil 7227 } 7228 7229 shape, ok := value.(map[string]interface{}) 7230 if !ok { 7231 return fmt.Errorf("unexpected JSON type %v", value) 7232 } 7233 7234 var sv *types.ThrottlingException 7235 if *v == nil { 7236 sv = &types.ThrottlingException{} 7237 } else { 7238 sv = *v 7239 } 7240 7241 for key, value := range shape { 7242 switch key { 7243 case "Message": 7244 if value != nil { 7245 jtv, ok := value.(string) 7246 if !ok { 7247 return fmt.Errorf("expected ErrorMessageString to be of type string, got %T instead", value) 7248 } 7249 sv.Message = ptr.String(jtv) 7250 } 7251 7252 case "QuotaCode": 7253 if value != nil { 7254 jtv, ok := value.(string) 7255 if !ok { 7256 return fmt.Errorf("expected ErrorQuotaCodeString to be of type string, got %T instead", value) 7257 } 7258 sv.QuotaCode = ptr.String(jtv) 7259 } 7260 7261 case "RetryAfterSeconds": 7262 if value != nil { 7263 jtv, ok := value.(json.Number) 7264 if !ok { 7265 return fmt.Errorf("expected RetryAfterSeconds to be json.Number, got %T instead", value) 7266 } 7267 i64, err := jtv.Int64() 7268 if err != nil { 7269 return err 7270 } 7271 sv.RetryAfterSeconds = int32(i64) 7272 } 7273 7274 case "ServiceCode": 7275 if value != nil { 7276 jtv, ok := value.(string) 7277 if !ok { 7278 return fmt.Errorf("expected ErrorServiceCodeString to be of type string, got %T instead", value) 7279 } 7280 sv.ServiceCode = ptr.String(jtv) 7281 } 7282 7283 default: 7284 _, _ = key, value 7285 7286 } 7287 } 7288 *v = sv 7289 return nil 7290} 7291 7292func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { 7293 if v == nil { 7294 return fmt.Errorf("unexpected nil of type %T", v) 7295 } 7296 if value == nil { 7297 return nil 7298 } 7299 7300 shape, ok := value.(map[string]interface{}) 7301 if !ok { 7302 return fmt.Errorf("unexpected JSON type %v", value) 7303 } 7304 7305 var sv *types.ValidationException 7306 if *v == nil { 7307 sv = &types.ValidationException{} 7308 } else { 7309 sv = *v 7310 } 7311 7312 for key, value := range shape { 7313 switch key { 7314 case "Fields": 7315 if err := awsRestjson1_deserializeDocumentValidationExceptionFields(&sv.Fields, value); err != nil { 7316 return err 7317 } 7318 7319 case "Message": 7320 if value != nil { 7321 jtv, ok := value.(string) 7322 if !ok { 7323 return fmt.Errorf("expected ErrorMessageString to be of type string, got %T instead", value) 7324 } 7325 sv.Message = ptr.String(jtv) 7326 } 7327 7328 case "Reason": 7329 if value != nil { 7330 jtv, ok := value.(string) 7331 if !ok { 7332 return fmt.Errorf("expected ValidationExceptionReason to be of type string, got %T instead", value) 7333 } 7334 sv.Reason = types.ValidationExceptionReason(jtv) 7335 } 7336 7337 default: 7338 _, _ = key, value 7339 7340 } 7341 } 7342 *v = sv 7343 return nil 7344} 7345 7346func awsRestjson1_deserializeDocumentValidationExceptionField(v **types.ValidationExceptionField, value interface{}) error { 7347 if v == nil { 7348 return fmt.Errorf("unexpected nil of type %T", v) 7349 } 7350 if value == nil { 7351 return nil 7352 } 7353 7354 shape, ok := value.(map[string]interface{}) 7355 if !ok { 7356 return fmt.Errorf("unexpected JSON type %v", value) 7357 } 7358 7359 var sv *types.ValidationExceptionField 7360 if *v == nil { 7361 sv = &types.ValidationExceptionField{} 7362 } else { 7363 sv = *v 7364 } 7365 7366 for key, value := range shape { 7367 switch key { 7368 case "Message": 7369 if value != nil { 7370 jtv, ok := value.(string) 7371 if !ok { 7372 return fmt.Errorf("expected ErrorMessageString to be of type string, got %T instead", value) 7373 } 7374 sv.Message = ptr.String(jtv) 7375 } 7376 7377 case "Name": 7378 if value != nil { 7379 jtv, ok := value.(string) 7380 if !ok { 7381 return fmt.Errorf("expected ErrorNameString to be of type string, got %T instead", value) 7382 } 7383 sv.Name = ptr.String(jtv) 7384 } 7385 7386 default: 7387 _, _ = key, value 7388 7389 } 7390 } 7391 *v = sv 7392 return nil 7393} 7394 7395func awsRestjson1_deserializeDocumentValidationExceptionFields(v *[]types.ValidationExceptionField, value interface{}) error { 7396 if v == nil { 7397 return fmt.Errorf("unexpected nil of type %T", v) 7398 } 7399 if value == nil { 7400 return nil 7401 } 7402 7403 shape, ok := value.([]interface{}) 7404 if !ok { 7405 return fmt.Errorf("unexpected JSON type %v", value) 7406 } 7407 7408 var cv []types.ValidationExceptionField 7409 if *v == nil { 7410 cv = []types.ValidationExceptionField{} 7411 } else { 7412 cv = *v 7413 } 7414 7415 for _, value := range shape { 7416 var col types.ValidationExceptionField 7417 destAddr := &col 7418 if err := awsRestjson1_deserializeDocumentValidationExceptionField(&destAddr, value); err != nil { 7419 return err 7420 } 7421 col = *destAddr 7422 cv = append(cv, col) 7423 7424 } 7425 *v = cv 7426 return nil 7427} 7428