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