1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package autoscalingplans 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/autoscalingplans/types" 12 smithy "github.com/aws/smithy-go" 13 smithyio "github.com/aws/smithy-go/io" 14 "github.com/aws/smithy-go/middleware" 15 "github.com/aws/smithy-go/ptr" 16 smithytime "github.com/aws/smithy-go/time" 17 smithyhttp "github.com/aws/smithy-go/transport/http" 18 "io" 19 "math" 20 "strings" 21) 22 23type awsAwsjson11_deserializeOpCreateScalingPlan struct { 24} 25 26func (*awsAwsjson11_deserializeOpCreateScalingPlan) ID() string { 27 return "OperationDeserializer" 28} 29 30func (m *awsAwsjson11_deserializeOpCreateScalingPlan) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 31 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 32) { 33 out, metadata, err = next.HandleDeserialize(ctx, in) 34 if err != nil { 35 return out, metadata, err 36 } 37 38 response, ok := out.RawResponse.(*smithyhttp.Response) 39 if !ok { 40 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 41 } 42 43 if response.StatusCode < 200 || response.StatusCode >= 300 { 44 return out, metadata, awsAwsjson11_deserializeOpErrorCreateScalingPlan(response, &metadata) 45 } 46 output := &CreateScalingPlanOutput{} 47 out.Result = output 48 49 var buff [1024]byte 50 ringBuffer := smithyio.NewRingBuffer(buff[:]) 51 52 body := io.TeeReader(response.Body, ringBuffer) 53 decoder := json.NewDecoder(body) 54 decoder.UseNumber() 55 var shape interface{} 56 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 57 var snapshot bytes.Buffer 58 io.Copy(&snapshot, ringBuffer) 59 err = &smithy.DeserializationError{ 60 Err: fmt.Errorf("failed to decode response body, %w", err), 61 Snapshot: snapshot.Bytes(), 62 } 63 return out, metadata, err 64 } 65 66 err = awsAwsjson11_deserializeOpDocumentCreateScalingPlanOutput(&output, shape) 67 if err != nil { 68 var snapshot bytes.Buffer 69 io.Copy(&snapshot, ringBuffer) 70 err = &smithy.DeserializationError{ 71 Err: fmt.Errorf("failed to decode response body, %w", err), 72 Snapshot: snapshot.Bytes(), 73 } 74 return out, metadata, err 75 } 76 77 return out, metadata, err 78} 79 80func awsAwsjson11_deserializeOpErrorCreateScalingPlan(response *smithyhttp.Response, metadata *middleware.Metadata) error { 81 var errorBuffer bytes.Buffer 82 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 83 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 84 } 85 errorBody := bytes.NewReader(errorBuffer.Bytes()) 86 87 errorCode := "UnknownError" 88 errorMessage := errorCode 89 90 code := response.Header.Get("X-Amzn-ErrorType") 91 if len(code) != 0 { 92 errorCode = restjson.SanitizeErrorCode(code) 93 } 94 95 var buff [1024]byte 96 ringBuffer := smithyio.NewRingBuffer(buff[:]) 97 98 body := io.TeeReader(errorBody, ringBuffer) 99 decoder := json.NewDecoder(body) 100 decoder.UseNumber() 101 code, message, err := restjson.GetErrorInfo(decoder) 102 if err != nil { 103 var snapshot bytes.Buffer 104 io.Copy(&snapshot, ringBuffer) 105 err = &smithy.DeserializationError{ 106 Err: fmt.Errorf("failed to decode response body, %w", err), 107 Snapshot: snapshot.Bytes(), 108 } 109 return err 110 } 111 112 errorBody.Seek(0, io.SeekStart) 113 if len(code) != 0 { 114 errorCode = restjson.SanitizeErrorCode(code) 115 } 116 if len(message) != 0 { 117 errorMessage = message 118 } 119 120 switch { 121 case strings.EqualFold("ConcurrentUpdateException", errorCode): 122 return awsAwsjson11_deserializeErrorConcurrentUpdateException(response, errorBody) 123 124 case strings.EqualFold("InternalServiceException", errorCode): 125 return awsAwsjson11_deserializeErrorInternalServiceException(response, errorBody) 126 127 case strings.EqualFold("LimitExceededException", errorCode): 128 return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) 129 130 case strings.EqualFold("ValidationException", errorCode): 131 return awsAwsjson11_deserializeErrorValidationException(response, errorBody) 132 133 default: 134 genericError := &smithy.GenericAPIError{ 135 Code: errorCode, 136 Message: errorMessage, 137 } 138 return genericError 139 140 } 141} 142 143type awsAwsjson11_deserializeOpDeleteScalingPlan struct { 144} 145 146func (*awsAwsjson11_deserializeOpDeleteScalingPlan) ID() string { 147 return "OperationDeserializer" 148} 149 150func (m *awsAwsjson11_deserializeOpDeleteScalingPlan) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 151 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 152) { 153 out, metadata, err = next.HandleDeserialize(ctx, in) 154 if err != nil { 155 return out, metadata, err 156 } 157 158 response, ok := out.RawResponse.(*smithyhttp.Response) 159 if !ok { 160 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 161 } 162 163 if response.StatusCode < 200 || response.StatusCode >= 300 { 164 return out, metadata, awsAwsjson11_deserializeOpErrorDeleteScalingPlan(response, &metadata) 165 } 166 output := &DeleteScalingPlanOutput{} 167 out.Result = output 168 169 var buff [1024]byte 170 ringBuffer := smithyio.NewRingBuffer(buff[:]) 171 172 body := io.TeeReader(response.Body, ringBuffer) 173 decoder := json.NewDecoder(body) 174 decoder.UseNumber() 175 var shape interface{} 176 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 177 var snapshot bytes.Buffer 178 io.Copy(&snapshot, ringBuffer) 179 err = &smithy.DeserializationError{ 180 Err: fmt.Errorf("failed to decode response body, %w", err), 181 Snapshot: snapshot.Bytes(), 182 } 183 return out, metadata, err 184 } 185 186 err = awsAwsjson11_deserializeOpDocumentDeleteScalingPlanOutput(&output, shape) 187 if err != nil { 188 var snapshot bytes.Buffer 189 io.Copy(&snapshot, ringBuffer) 190 err = &smithy.DeserializationError{ 191 Err: fmt.Errorf("failed to decode response body, %w", err), 192 Snapshot: snapshot.Bytes(), 193 } 194 return out, metadata, err 195 } 196 197 return out, metadata, err 198} 199 200func awsAwsjson11_deserializeOpErrorDeleteScalingPlan(response *smithyhttp.Response, metadata *middleware.Metadata) error { 201 var errorBuffer bytes.Buffer 202 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 203 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 204 } 205 errorBody := bytes.NewReader(errorBuffer.Bytes()) 206 207 errorCode := "UnknownError" 208 errorMessage := errorCode 209 210 code := response.Header.Get("X-Amzn-ErrorType") 211 if len(code) != 0 { 212 errorCode = restjson.SanitizeErrorCode(code) 213 } 214 215 var buff [1024]byte 216 ringBuffer := smithyio.NewRingBuffer(buff[:]) 217 218 body := io.TeeReader(errorBody, ringBuffer) 219 decoder := json.NewDecoder(body) 220 decoder.UseNumber() 221 code, message, err := restjson.GetErrorInfo(decoder) 222 if err != nil { 223 var snapshot bytes.Buffer 224 io.Copy(&snapshot, ringBuffer) 225 err = &smithy.DeserializationError{ 226 Err: fmt.Errorf("failed to decode response body, %w", err), 227 Snapshot: snapshot.Bytes(), 228 } 229 return err 230 } 231 232 errorBody.Seek(0, io.SeekStart) 233 if len(code) != 0 { 234 errorCode = restjson.SanitizeErrorCode(code) 235 } 236 if len(message) != 0 { 237 errorMessage = message 238 } 239 240 switch { 241 case strings.EqualFold("ConcurrentUpdateException", errorCode): 242 return awsAwsjson11_deserializeErrorConcurrentUpdateException(response, errorBody) 243 244 case strings.EqualFold("InternalServiceException", errorCode): 245 return awsAwsjson11_deserializeErrorInternalServiceException(response, errorBody) 246 247 case strings.EqualFold("ObjectNotFoundException", errorCode): 248 return awsAwsjson11_deserializeErrorObjectNotFoundException(response, errorBody) 249 250 case strings.EqualFold("ValidationException", errorCode): 251 return awsAwsjson11_deserializeErrorValidationException(response, errorBody) 252 253 default: 254 genericError := &smithy.GenericAPIError{ 255 Code: errorCode, 256 Message: errorMessage, 257 } 258 return genericError 259 260 } 261} 262 263type awsAwsjson11_deserializeOpDescribeScalingPlanResources struct { 264} 265 266func (*awsAwsjson11_deserializeOpDescribeScalingPlanResources) ID() string { 267 return "OperationDeserializer" 268} 269 270func (m *awsAwsjson11_deserializeOpDescribeScalingPlanResources) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 271 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 272) { 273 out, metadata, err = next.HandleDeserialize(ctx, in) 274 if err != nil { 275 return out, metadata, err 276 } 277 278 response, ok := out.RawResponse.(*smithyhttp.Response) 279 if !ok { 280 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 281 } 282 283 if response.StatusCode < 200 || response.StatusCode >= 300 { 284 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeScalingPlanResources(response, &metadata) 285 } 286 output := &DescribeScalingPlanResourcesOutput{} 287 out.Result = output 288 289 var buff [1024]byte 290 ringBuffer := smithyio.NewRingBuffer(buff[:]) 291 292 body := io.TeeReader(response.Body, ringBuffer) 293 decoder := json.NewDecoder(body) 294 decoder.UseNumber() 295 var shape interface{} 296 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 297 var snapshot bytes.Buffer 298 io.Copy(&snapshot, ringBuffer) 299 err = &smithy.DeserializationError{ 300 Err: fmt.Errorf("failed to decode response body, %w", err), 301 Snapshot: snapshot.Bytes(), 302 } 303 return out, metadata, err 304 } 305 306 err = awsAwsjson11_deserializeOpDocumentDescribeScalingPlanResourcesOutput(&output, shape) 307 if err != nil { 308 var snapshot bytes.Buffer 309 io.Copy(&snapshot, ringBuffer) 310 err = &smithy.DeserializationError{ 311 Err: fmt.Errorf("failed to decode response body, %w", err), 312 Snapshot: snapshot.Bytes(), 313 } 314 return out, metadata, err 315 } 316 317 return out, metadata, err 318} 319 320func awsAwsjson11_deserializeOpErrorDescribeScalingPlanResources(response *smithyhttp.Response, metadata *middleware.Metadata) error { 321 var errorBuffer bytes.Buffer 322 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 323 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 324 } 325 errorBody := bytes.NewReader(errorBuffer.Bytes()) 326 327 errorCode := "UnknownError" 328 errorMessage := errorCode 329 330 code := response.Header.Get("X-Amzn-ErrorType") 331 if len(code) != 0 { 332 errorCode = restjson.SanitizeErrorCode(code) 333 } 334 335 var buff [1024]byte 336 ringBuffer := smithyio.NewRingBuffer(buff[:]) 337 338 body := io.TeeReader(errorBody, ringBuffer) 339 decoder := json.NewDecoder(body) 340 decoder.UseNumber() 341 code, message, err := restjson.GetErrorInfo(decoder) 342 if err != nil { 343 var snapshot bytes.Buffer 344 io.Copy(&snapshot, ringBuffer) 345 err = &smithy.DeserializationError{ 346 Err: fmt.Errorf("failed to decode response body, %w", err), 347 Snapshot: snapshot.Bytes(), 348 } 349 return err 350 } 351 352 errorBody.Seek(0, io.SeekStart) 353 if len(code) != 0 { 354 errorCode = restjson.SanitizeErrorCode(code) 355 } 356 if len(message) != 0 { 357 errorMessage = message 358 } 359 360 switch { 361 case strings.EqualFold("ConcurrentUpdateException", errorCode): 362 return awsAwsjson11_deserializeErrorConcurrentUpdateException(response, errorBody) 363 364 case strings.EqualFold("InternalServiceException", errorCode): 365 return awsAwsjson11_deserializeErrorInternalServiceException(response, errorBody) 366 367 case strings.EqualFold("InvalidNextTokenException", errorCode): 368 return awsAwsjson11_deserializeErrorInvalidNextTokenException(response, errorBody) 369 370 case strings.EqualFold("ValidationException", errorCode): 371 return awsAwsjson11_deserializeErrorValidationException(response, errorBody) 372 373 default: 374 genericError := &smithy.GenericAPIError{ 375 Code: errorCode, 376 Message: errorMessage, 377 } 378 return genericError 379 380 } 381} 382 383type awsAwsjson11_deserializeOpDescribeScalingPlans struct { 384} 385 386func (*awsAwsjson11_deserializeOpDescribeScalingPlans) ID() string { 387 return "OperationDeserializer" 388} 389 390func (m *awsAwsjson11_deserializeOpDescribeScalingPlans) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 391 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 392) { 393 out, metadata, err = next.HandleDeserialize(ctx, in) 394 if err != nil { 395 return out, metadata, err 396 } 397 398 response, ok := out.RawResponse.(*smithyhttp.Response) 399 if !ok { 400 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 401 } 402 403 if response.StatusCode < 200 || response.StatusCode >= 300 { 404 return out, metadata, awsAwsjson11_deserializeOpErrorDescribeScalingPlans(response, &metadata) 405 } 406 output := &DescribeScalingPlansOutput{} 407 out.Result = output 408 409 var buff [1024]byte 410 ringBuffer := smithyio.NewRingBuffer(buff[:]) 411 412 body := io.TeeReader(response.Body, ringBuffer) 413 decoder := json.NewDecoder(body) 414 decoder.UseNumber() 415 var shape interface{} 416 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 417 var snapshot bytes.Buffer 418 io.Copy(&snapshot, ringBuffer) 419 err = &smithy.DeserializationError{ 420 Err: fmt.Errorf("failed to decode response body, %w", err), 421 Snapshot: snapshot.Bytes(), 422 } 423 return out, metadata, err 424 } 425 426 err = awsAwsjson11_deserializeOpDocumentDescribeScalingPlansOutput(&output, shape) 427 if err != nil { 428 var snapshot bytes.Buffer 429 io.Copy(&snapshot, ringBuffer) 430 err = &smithy.DeserializationError{ 431 Err: fmt.Errorf("failed to decode response body, %w", err), 432 Snapshot: snapshot.Bytes(), 433 } 434 return out, metadata, err 435 } 436 437 return out, metadata, err 438} 439 440func awsAwsjson11_deserializeOpErrorDescribeScalingPlans(response *smithyhttp.Response, metadata *middleware.Metadata) error { 441 var errorBuffer bytes.Buffer 442 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 443 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 444 } 445 errorBody := bytes.NewReader(errorBuffer.Bytes()) 446 447 errorCode := "UnknownError" 448 errorMessage := errorCode 449 450 code := response.Header.Get("X-Amzn-ErrorType") 451 if len(code) != 0 { 452 errorCode = restjson.SanitizeErrorCode(code) 453 } 454 455 var buff [1024]byte 456 ringBuffer := smithyio.NewRingBuffer(buff[:]) 457 458 body := io.TeeReader(errorBody, ringBuffer) 459 decoder := json.NewDecoder(body) 460 decoder.UseNumber() 461 code, message, err := restjson.GetErrorInfo(decoder) 462 if err != nil { 463 var snapshot bytes.Buffer 464 io.Copy(&snapshot, ringBuffer) 465 err = &smithy.DeserializationError{ 466 Err: fmt.Errorf("failed to decode response body, %w", err), 467 Snapshot: snapshot.Bytes(), 468 } 469 return err 470 } 471 472 errorBody.Seek(0, io.SeekStart) 473 if len(code) != 0 { 474 errorCode = restjson.SanitizeErrorCode(code) 475 } 476 if len(message) != 0 { 477 errorMessage = message 478 } 479 480 switch { 481 case strings.EqualFold("ConcurrentUpdateException", errorCode): 482 return awsAwsjson11_deserializeErrorConcurrentUpdateException(response, errorBody) 483 484 case strings.EqualFold("InternalServiceException", errorCode): 485 return awsAwsjson11_deserializeErrorInternalServiceException(response, errorBody) 486 487 case strings.EqualFold("InvalidNextTokenException", errorCode): 488 return awsAwsjson11_deserializeErrorInvalidNextTokenException(response, errorBody) 489 490 case strings.EqualFold("ValidationException", errorCode): 491 return awsAwsjson11_deserializeErrorValidationException(response, errorBody) 492 493 default: 494 genericError := &smithy.GenericAPIError{ 495 Code: errorCode, 496 Message: errorMessage, 497 } 498 return genericError 499 500 } 501} 502 503type awsAwsjson11_deserializeOpGetScalingPlanResourceForecastData struct { 504} 505 506func (*awsAwsjson11_deserializeOpGetScalingPlanResourceForecastData) ID() string { 507 return "OperationDeserializer" 508} 509 510func (m *awsAwsjson11_deserializeOpGetScalingPlanResourceForecastData) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 511 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 512) { 513 out, metadata, err = next.HandleDeserialize(ctx, in) 514 if err != nil { 515 return out, metadata, err 516 } 517 518 response, ok := out.RawResponse.(*smithyhttp.Response) 519 if !ok { 520 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 521 } 522 523 if response.StatusCode < 200 || response.StatusCode >= 300 { 524 return out, metadata, awsAwsjson11_deserializeOpErrorGetScalingPlanResourceForecastData(response, &metadata) 525 } 526 output := &GetScalingPlanResourceForecastDataOutput{} 527 out.Result = output 528 529 var buff [1024]byte 530 ringBuffer := smithyio.NewRingBuffer(buff[:]) 531 532 body := io.TeeReader(response.Body, ringBuffer) 533 decoder := json.NewDecoder(body) 534 decoder.UseNumber() 535 var shape interface{} 536 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 537 var snapshot bytes.Buffer 538 io.Copy(&snapshot, ringBuffer) 539 err = &smithy.DeserializationError{ 540 Err: fmt.Errorf("failed to decode response body, %w", err), 541 Snapshot: snapshot.Bytes(), 542 } 543 return out, metadata, err 544 } 545 546 err = awsAwsjson11_deserializeOpDocumentGetScalingPlanResourceForecastDataOutput(&output, shape) 547 if err != nil { 548 var snapshot bytes.Buffer 549 io.Copy(&snapshot, ringBuffer) 550 err = &smithy.DeserializationError{ 551 Err: fmt.Errorf("failed to decode response body, %w", err), 552 Snapshot: snapshot.Bytes(), 553 } 554 return out, metadata, err 555 } 556 557 return out, metadata, err 558} 559 560func awsAwsjson11_deserializeOpErrorGetScalingPlanResourceForecastData(response *smithyhttp.Response, metadata *middleware.Metadata) error { 561 var errorBuffer bytes.Buffer 562 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 563 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 564 } 565 errorBody := bytes.NewReader(errorBuffer.Bytes()) 566 567 errorCode := "UnknownError" 568 errorMessage := errorCode 569 570 code := response.Header.Get("X-Amzn-ErrorType") 571 if len(code) != 0 { 572 errorCode = restjson.SanitizeErrorCode(code) 573 } 574 575 var buff [1024]byte 576 ringBuffer := smithyio.NewRingBuffer(buff[:]) 577 578 body := io.TeeReader(errorBody, ringBuffer) 579 decoder := json.NewDecoder(body) 580 decoder.UseNumber() 581 code, message, err := restjson.GetErrorInfo(decoder) 582 if err != nil { 583 var snapshot bytes.Buffer 584 io.Copy(&snapshot, ringBuffer) 585 err = &smithy.DeserializationError{ 586 Err: fmt.Errorf("failed to decode response body, %w", err), 587 Snapshot: snapshot.Bytes(), 588 } 589 return err 590 } 591 592 errorBody.Seek(0, io.SeekStart) 593 if len(code) != 0 { 594 errorCode = restjson.SanitizeErrorCode(code) 595 } 596 if len(message) != 0 { 597 errorMessage = message 598 } 599 600 switch { 601 case strings.EqualFold("InternalServiceException", errorCode): 602 return awsAwsjson11_deserializeErrorInternalServiceException(response, errorBody) 603 604 case strings.EqualFold("ValidationException", errorCode): 605 return awsAwsjson11_deserializeErrorValidationException(response, errorBody) 606 607 default: 608 genericError := &smithy.GenericAPIError{ 609 Code: errorCode, 610 Message: errorMessage, 611 } 612 return genericError 613 614 } 615} 616 617type awsAwsjson11_deserializeOpUpdateScalingPlan struct { 618} 619 620func (*awsAwsjson11_deserializeOpUpdateScalingPlan) ID() string { 621 return "OperationDeserializer" 622} 623 624func (m *awsAwsjson11_deserializeOpUpdateScalingPlan) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( 625 out middleware.DeserializeOutput, metadata middleware.Metadata, err error, 626) { 627 out, metadata, err = next.HandleDeserialize(ctx, in) 628 if err != nil { 629 return out, metadata, err 630 } 631 632 response, ok := out.RawResponse.(*smithyhttp.Response) 633 if !ok { 634 return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} 635 } 636 637 if response.StatusCode < 200 || response.StatusCode >= 300 { 638 return out, metadata, awsAwsjson11_deserializeOpErrorUpdateScalingPlan(response, &metadata) 639 } 640 output := &UpdateScalingPlanOutput{} 641 out.Result = output 642 643 var buff [1024]byte 644 ringBuffer := smithyio.NewRingBuffer(buff[:]) 645 646 body := io.TeeReader(response.Body, ringBuffer) 647 decoder := json.NewDecoder(body) 648 decoder.UseNumber() 649 var shape interface{} 650 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 651 var snapshot bytes.Buffer 652 io.Copy(&snapshot, ringBuffer) 653 err = &smithy.DeserializationError{ 654 Err: fmt.Errorf("failed to decode response body, %w", err), 655 Snapshot: snapshot.Bytes(), 656 } 657 return out, metadata, err 658 } 659 660 err = awsAwsjson11_deserializeOpDocumentUpdateScalingPlanOutput(&output, shape) 661 if err != nil { 662 var snapshot bytes.Buffer 663 io.Copy(&snapshot, ringBuffer) 664 err = &smithy.DeserializationError{ 665 Err: fmt.Errorf("failed to decode response body, %w", err), 666 Snapshot: snapshot.Bytes(), 667 } 668 return out, metadata, err 669 } 670 671 return out, metadata, err 672} 673 674func awsAwsjson11_deserializeOpErrorUpdateScalingPlan(response *smithyhttp.Response, metadata *middleware.Metadata) error { 675 var errorBuffer bytes.Buffer 676 if _, err := io.Copy(&errorBuffer, response.Body); err != nil { 677 return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} 678 } 679 errorBody := bytes.NewReader(errorBuffer.Bytes()) 680 681 errorCode := "UnknownError" 682 errorMessage := errorCode 683 684 code := response.Header.Get("X-Amzn-ErrorType") 685 if len(code) != 0 { 686 errorCode = restjson.SanitizeErrorCode(code) 687 } 688 689 var buff [1024]byte 690 ringBuffer := smithyio.NewRingBuffer(buff[:]) 691 692 body := io.TeeReader(errorBody, ringBuffer) 693 decoder := json.NewDecoder(body) 694 decoder.UseNumber() 695 code, message, err := restjson.GetErrorInfo(decoder) 696 if err != nil { 697 var snapshot bytes.Buffer 698 io.Copy(&snapshot, ringBuffer) 699 err = &smithy.DeserializationError{ 700 Err: fmt.Errorf("failed to decode response body, %w", err), 701 Snapshot: snapshot.Bytes(), 702 } 703 return err 704 } 705 706 errorBody.Seek(0, io.SeekStart) 707 if len(code) != 0 { 708 errorCode = restjson.SanitizeErrorCode(code) 709 } 710 if len(message) != 0 { 711 errorMessage = message 712 } 713 714 switch { 715 case strings.EqualFold("ConcurrentUpdateException", errorCode): 716 return awsAwsjson11_deserializeErrorConcurrentUpdateException(response, errorBody) 717 718 case strings.EqualFold("InternalServiceException", errorCode): 719 return awsAwsjson11_deserializeErrorInternalServiceException(response, errorBody) 720 721 case strings.EqualFold("ObjectNotFoundException", errorCode): 722 return awsAwsjson11_deserializeErrorObjectNotFoundException(response, errorBody) 723 724 case strings.EqualFold("ValidationException", errorCode): 725 return awsAwsjson11_deserializeErrorValidationException(response, errorBody) 726 727 default: 728 genericError := &smithy.GenericAPIError{ 729 Code: errorCode, 730 Message: errorMessage, 731 } 732 return genericError 733 734 } 735} 736 737func awsAwsjson11_deserializeErrorConcurrentUpdateException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 738 var buff [1024]byte 739 ringBuffer := smithyio.NewRingBuffer(buff[:]) 740 741 body := io.TeeReader(errorBody, ringBuffer) 742 decoder := json.NewDecoder(body) 743 decoder.UseNumber() 744 var shape interface{} 745 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 746 var snapshot bytes.Buffer 747 io.Copy(&snapshot, ringBuffer) 748 err = &smithy.DeserializationError{ 749 Err: fmt.Errorf("failed to decode response body, %w", err), 750 Snapshot: snapshot.Bytes(), 751 } 752 return err 753 } 754 755 output := &types.ConcurrentUpdateException{} 756 err := awsAwsjson11_deserializeDocumentConcurrentUpdateException(&output, shape) 757 758 if err != nil { 759 var snapshot bytes.Buffer 760 io.Copy(&snapshot, ringBuffer) 761 err = &smithy.DeserializationError{ 762 Err: fmt.Errorf("failed to decode response body, %w", err), 763 Snapshot: snapshot.Bytes(), 764 } 765 return err 766 } 767 768 errorBody.Seek(0, io.SeekStart) 769 return output 770} 771 772func awsAwsjson11_deserializeErrorInternalServiceException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 773 var buff [1024]byte 774 ringBuffer := smithyio.NewRingBuffer(buff[:]) 775 776 body := io.TeeReader(errorBody, ringBuffer) 777 decoder := json.NewDecoder(body) 778 decoder.UseNumber() 779 var shape interface{} 780 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 781 var snapshot bytes.Buffer 782 io.Copy(&snapshot, ringBuffer) 783 err = &smithy.DeserializationError{ 784 Err: fmt.Errorf("failed to decode response body, %w", err), 785 Snapshot: snapshot.Bytes(), 786 } 787 return err 788 } 789 790 output := &types.InternalServiceException{} 791 err := awsAwsjson11_deserializeDocumentInternalServiceException(&output, shape) 792 793 if err != nil { 794 var snapshot bytes.Buffer 795 io.Copy(&snapshot, ringBuffer) 796 err = &smithy.DeserializationError{ 797 Err: fmt.Errorf("failed to decode response body, %w", err), 798 Snapshot: snapshot.Bytes(), 799 } 800 return err 801 } 802 803 errorBody.Seek(0, io.SeekStart) 804 return output 805} 806 807func awsAwsjson11_deserializeErrorInvalidNextTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 808 var buff [1024]byte 809 ringBuffer := smithyio.NewRingBuffer(buff[:]) 810 811 body := io.TeeReader(errorBody, ringBuffer) 812 decoder := json.NewDecoder(body) 813 decoder.UseNumber() 814 var shape interface{} 815 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 816 var snapshot bytes.Buffer 817 io.Copy(&snapshot, ringBuffer) 818 err = &smithy.DeserializationError{ 819 Err: fmt.Errorf("failed to decode response body, %w", err), 820 Snapshot: snapshot.Bytes(), 821 } 822 return err 823 } 824 825 output := &types.InvalidNextTokenException{} 826 err := awsAwsjson11_deserializeDocumentInvalidNextTokenException(&output, shape) 827 828 if err != nil { 829 var snapshot bytes.Buffer 830 io.Copy(&snapshot, ringBuffer) 831 err = &smithy.DeserializationError{ 832 Err: fmt.Errorf("failed to decode response body, %w", err), 833 Snapshot: snapshot.Bytes(), 834 } 835 return err 836 } 837 838 errorBody.Seek(0, io.SeekStart) 839 return output 840} 841 842func awsAwsjson11_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 843 var buff [1024]byte 844 ringBuffer := smithyio.NewRingBuffer(buff[:]) 845 846 body := io.TeeReader(errorBody, ringBuffer) 847 decoder := json.NewDecoder(body) 848 decoder.UseNumber() 849 var shape interface{} 850 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 851 var snapshot bytes.Buffer 852 io.Copy(&snapshot, ringBuffer) 853 err = &smithy.DeserializationError{ 854 Err: fmt.Errorf("failed to decode response body, %w", err), 855 Snapshot: snapshot.Bytes(), 856 } 857 return err 858 } 859 860 output := &types.LimitExceededException{} 861 err := awsAwsjson11_deserializeDocumentLimitExceededException(&output, shape) 862 863 if err != nil { 864 var snapshot bytes.Buffer 865 io.Copy(&snapshot, ringBuffer) 866 err = &smithy.DeserializationError{ 867 Err: fmt.Errorf("failed to decode response body, %w", err), 868 Snapshot: snapshot.Bytes(), 869 } 870 return err 871 } 872 873 errorBody.Seek(0, io.SeekStart) 874 return output 875} 876 877func awsAwsjson11_deserializeErrorObjectNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 878 var buff [1024]byte 879 ringBuffer := smithyio.NewRingBuffer(buff[:]) 880 881 body := io.TeeReader(errorBody, ringBuffer) 882 decoder := json.NewDecoder(body) 883 decoder.UseNumber() 884 var shape interface{} 885 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 886 var snapshot bytes.Buffer 887 io.Copy(&snapshot, ringBuffer) 888 err = &smithy.DeserializationError{ 889 Err: fmt.Errorf("failed to decode response body, %w", err), 890 Snapshot: snapshot.Bytes(), 891 } 892 return err 893 } 894 895 output := &types.ObjectNotFoundException{} 896 err := awsAwsjson11_deserializeDocumentObjectNotFoundException(&output, shape) 897 898 if err != nil { 899 var snapshot bytes.Buffer 900 io.Copy(&snapshot, ringBuffer) 901 err = &smithy.DeserializationError{ 902 Err: fmt.Errorf("failed to decode response body, %w", err), 903 Snapshot: snapshot.Bytes(), 904 } 905 return err 906 } 907 908 errorBody.Seek(0, io.SeekStart) 909 return output 910} 911 912func awsAwsjson11_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { 913 var buff [1024]byte 914 ringBuffer := smithyio.NewRingBuffer(buff[:]) 915 916 body := io.TeeReader(errorBody, ringBuffer) 917 decoder := json.NewDecoder(body) 918 decoder.UseNumber() 919 var shape interface{} 920 if err := decoder.Decode(&shape); err != nil && err != io.EOF { 921 var snapshot bytes.Buffer 922 io.Copy(&snapshot, ringBuffer) 923 err = &smithy.DeserializationError{ 924 Err: fmt.Errorf("failed to decode response body, %w", err), 925 Snapshot: snapshot.Bytes(), 926 } 927 return err 928 } 929 930 output := &types.ValidationException{} 931 err := awsAwsjson11_deserializeDocumentValidationException(&output, shape) 932 933 if err != nil { 934 var snapshot bytes.Buffer 935 io.Copy(&snapshot, ringBuffer) 936 err = &smithy.DeserializationError{ 937 Err: fmt.Errorf("failed to decode response body, %w", err), 938 Snapshot: snapshot.Bytes(), 939 } 940 return err 941 } 942 943 errorBody.Seek(0, io.SeekStart) 944 return output 945} 946 947func awsAwsjson11_deserializeDocumentApplicationSource(v **types.ApplicationSource, value interface{}) error { 948 if v == nil { 949 return fmt.Errorf("unexpected nil of type %T", v) 950 } 951 if value == nil { 952 return nil 953 } 954 955 shape, ok := value.(map[string]interface{}) 956 if !ok { 957 return fmt.Errorf("unexpected JSON type %v", value) 958 } 959 960 var sv *types.ApplicationSource 961 if *v == nil { 962 sv = &types.ApplicationSource{} 963 } else { 964 sv = *v 965 } 966 967 for key, value := range shape { 968 switch key { 969 case "CloudFormationStackARN": 970 if value != nil { 971 jtv, ok := value.(string) 972 if !ok { 973 return fmt.Errorf("expected XmlString to be of type string, got %T instead", value) 974 } 975 sv.CloudFormationStackARN = ptr.String(jtv) 976 } 977 978 case "TagFilters": 979 if err := awsAwsjson11_deserializeDocumentTagFilters(&sv.TagFilters, value); err != nil { 980 return err 981 } 982 983 default: 984 _, _ = key, value 985 986 } 987 } 988 *v = sv 989 return nil 990} 991 992func awsAwsjson11_deserializeDocumentConcurrentUpdateException(v **types.ConcurrentUpdateException, value interface{}) error { 993 if v == nil { 994 return fmt.Errorf("unexpected nil of type %T", v) 995 } 996 if value == nil { 997 return nil 998 } 999 1000 shape, ok := value.(map[string]interface{}) 1001 if !ok { 1002 return fmt.Errorf("unexpected JSON type %v", value) 1003 } 1004 1005 var sv *types.ConcurrentUpdateException 1006 if *v == nil { 1007 sv = &types.ConcurrentUpdateException{} 1008 } else { 1009 sv = *v 1010 } 1011 1012 for key, value := range shape { 1013 switch key { 1014 case "Message": 1015 if value != nil { 1016 jtv, ok := value.(string) 1017 if !ok { 1018 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1019 } 1020 sv.Message = ptr.String(jtv) 1021 } 1022 1023 default: 1024 _, _ = key, value 1025 1026 } 1027 } 1028 *v = sv 1029 return nil 1030} 1031 1032func awsAwsjson11_deserializeDocumentCustomizedLoadMetricSpecification(v **types.CustomizedLoadMetricSpecification, value interface{}) error { 1033 if v == nil { 1034 return fmt.Errorf("unexpected nil of type %T", v) 1035 } 1036 if value == nil { 1037 return nil 1038 } 1039 1040 shape, ok := value.(map[string]interface{}) 1041 if !ok { 1042 return fmt.Errorf("unexpected JSON type %v", value) 1043 } 1044 1045 var sv *types.CustomizedLoadMetricSpecification 1046 if *v == nil { 1047 sv = &types.CustomizedLoadMetricSpecification{} 1048 } else { 1049 sv = *v 1050 } 1051 1052 for key, value := range shape { 1053 switch key { 1054 case "Dimensions": 1055 if err := awsAwsjson11_deserializeDocumentMetricDimensions(&sv.Dimensions, value); err != nil { 1056 return err 1057 } 1058 1059 case "MetricName": 1060 if value != nil { 1061 jtv, ok := value.(string) 1062 if !ok { 1063 return fmt.Errorf("expected MetricName to be of type string, got %T instead", value) 1064 } 1065 sv.MetricName = ptr.String(jtv) 1066 } 1067 1068 case "Namespace": 1069 if value != nil { 1070 jtv, ok := value.(string) 1071 if !ok { 1072 return fmt.Errorf("expected MetricNamespace to be of type string, got %T instead", value) 1073 } 1074 sv.Namespace = ptr.String(jtv) 1075 } 1076 1077 case "Statistic": 1078 if value != nil { 1079 jtv, ok := value.(string) 1080 if !ok { 1081 return fmt.Errorf("expected MetricStatistic to be of type string, got %T instead", value) 1082 } 1083 sv.Statistic = types.MetricStatistic(jtv) 1084 } 1085 1086 case "Unit": 1087 if value != nil { 1088 jtv, ok := value.(string) 1089 if !ok { 1090 return fmt.Errorf("expected MetricUnit to be of type string, got %T instead", value) 1091 } 1092 sv.Unit = ptr.String(jtv) 1093 } 1094 1095 default: 1096 _, _ = key, value 1097 1098 } 1099 } 1100 *v = sv 1101 return nil 1102} 1103 1104func awsAwsjson11_deserializeDocumentCustomizedScalingMetricSpecification(v **types.CustomizedScalingMetricSpecification, value interface{}) error { 1105 if v == nil { 1106 return fmt.Errorf("unexpected nil of type %T", v) 1107 } 1108 if value == nil { 1109 return nil 1110 } 1111 1112 shape, ok := value.(map[string]interface{}) 1113 if !ok { 1114 return fmt.Errorf("unexpected JSON type %v", value) 1115 } 1116 1117 var sv *types.CustomizedScalingMetricSpecification 1118 if *v == nil { 1119 sv = &types.CustomizedScalingMetricSpecification{} 1120 } else { 1121 sv = *v 1122 } 1123 1124 for key, value := range shape { 1125 switch key { 1126 case "Dimensions": 1127 if err := awsAwsjson11_deserializeDocumentMetricDimensions(&sv.Dimensions, value); err != nil { 1128 return err 1129 } 1130 1131 case "MetricName": 1132 if value != nil { 1133 jtv, ok := value.(string) 1134 if !ok { 1135 return fmt.Errorf("expected MetricName to be of type string, got %T instead", value) 1136 } 1137 sv.MetricName = ptr.String(jtv) 1138 } 1139 1140 case "Namespace": 1141 if value != nil { 1142 jtv, ok := value.(string) 1143 if !ok { 1144 return fmt.Errorf("expected MetricNamespace to be of type string, got %T instead", value) 1145 } 1146 sv.Namespace = ptr.String(jtv) 1147 } 1148 1149 case "Statistic": 1150 if value != nil { 1151 jtv, ok := value.(string) 1152 if !ok { 1153 return fmt.Errorf("expected MetricStatistic to be of type string, got %T instead", value) 1154 } 1155 sv.Statistic = types.MetricStatistic(jtv) 1156 } 1157 1158 case "Unit": 1159 if value != nil { 1160 jtv, ok := value.(string) 1161 if !ok { 1162 return fmt.Errorf("expected MetricUnit to be of type string, got %T instead", value) 1163 } 1164 sv.Unit = ptr.String(jtv) 1165 } 1166 1167 default: 1168 _, _ = key, value 1169 1170 } 1171 } 1172 *v = sv 1173 return nil 1174} 1175 1176func awsAwsjson11_deserializeDocumentDatapoint(v **types.Datapoint, value interface{}) error { 1177 if v == nil { 1178 return fmt.Errorf("unexpected nil of type %T", v) 1179 } 1180 if value == nil { 1181 return nil 1182 } 1183 1184 shape, ok := value.(map[string]interface{}) 1185 if !ok { 1186 return fmt.Errorf("unexpected JSON type %v", value) 1187 } 1188 1189 var sv *types.Datapoint 1190 if *v == nil { 1191 sv = &types.Datapoint{} 1192 } else { 1193 sv = *v 1194 } 1195 1196 for key, value := range shape { 1197 switch key { 1198 case "Timestamp": 1199 if value != nil { 1200 switch jtv := value.(type) { 1201 case json.Number: 1202 f64, err := jtv.Float64() 1203 if err != nil { 1204 return err 1205 } 1206 sv.Timestamp = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1207 1208 default: 1209 return fmt.Errorf("expected TimestampType to be a JSON Number, got %T instead", value) 1210 1211 } 1212 } 1213 1214 case "Value": 1215 if value != nil { 1216 switch jtv := value.(type) { 1217 case json.Number: 1218 f64, err := jtv.Float64() 1219 if err != nil { 1220 return err 1221 } 1222 sv.Value = ptr.Float64(f64) 1223 1224 case string: 1225 var f64 float64 1226 switch { 1227 case strings.EqualFold(jtv, "NaN"): 1228 f64 = math.NaN() 1229 1230 case strings.EqualFold(jtv, "Infinity"): 1231 f64 = math.Inf(1) 1232 1233 case strings.EqualFold(jtv, "-Infinity"): 1234 f64 = math.Inf(-1) 1235 1236 default: 1237 return fmt.Errorf("unknown JSON number value: %s", jtv) 1238 1239 } 1240 sv.Value = ptr.Float64(f64) 1241 1242 default: 1243 return fmt.Errorf("expected MetricScale to be a JSON Number, got %T instead", value) 1244 1245 } 1246 } 1247 1248 default: 1249 _, _ = key, value 1250 1251 } 1252 } 1253 *v = sv 1254 return nil 1255} 1256 1257func awsAwsjson11_deserializeDocumentDatapoints(v *[]types.Datapoint, value interface{}) error { 1258 if v == nil { 1259 return fmt.Errorf("unexpected nil of type %T", v) 1260 } 1261 if value == nil { 1262 return nil 1263 } 1264 1265 shape, ok := value.([]interface{}) 1266 if !ok { 1267 return fmt.Errorf("unexpected JSON type %v", value) 1268 } 1269 1270 var cv []types.Datapoint 1271 if *v == nil { 1272 cv = []types.Datapoint{} 1273 } else { 1274 cv = *v 1275 } 1276 1277 for _, value := range shape { 1278 var col types.Datapoint 1279 destAddr := &col 1280 if err := awsAwsjson11_deserializeDocumentDatapoint(&destAddr, value); err != nil { 1281 return err 1282 } 1283 col = *destAddr 1284 cv = append(cv, col) 1285 1286 } 1287 *v = cv 1288 return nil 1289} 1290 1291func awsAwsjson11_deserializeDocumentInternalServiceException(v **types.InternalServiceException, value interface{}) error { 1292 if v == nil { 1293 return fmt.Errorf("unexpected nil of type %T", v) 1294 } 1295 if value == nil { 1296 return nil 1297 } 1298 1299 shape, ok := value.(map[string]interface{}) 1300 if !ok { 1301 return fmt.Errorf("unexpected JSON type %v", value) 1302 } 1303 1304 var sv *types.InternalServiceException 1305 if *v == nil { 1306 sv = &types.InternalServiceException{} 1307 } else { 1308 sv = *v 1309 } 1310 1311 for key, value := range shape { 1312 switch key { 1313 case "Message": 1314 if value != nil { 1315 jtv, ok := value.(string) 1316 if !ok { 1317 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1318 } 1319 sv.Message = ptr.String(jtv) 1320 } 1321 1322 default: 1323 _, _ = key, value 1324 1325 } 1326 } 1327 *v = sv 1328 return nil 1329} 1330 1331func awsAwsjson11_deserializeDocumentInvalidNextTokenException(v **types.InvalidNextTokenException, value interface{}) error { 1332 if v == nil { 1333 return fmt.Errorf("unexpected nil of type %T", v) 1334 } 1335 if value == nil { 1336 return nil 1337 } 1338 1339 shape, ok := value.(map[string]interface{}) 1340 if !ok { 1341 return fmt.Errorf("unexpected JSON type %v", value) 1342 } 1343 1344 var sv *types.InvalidNextTokenException 1345 if *v == nil { 1346 sv = &types.InvalidNextTokenException{} 1347 } else { 1348 sv = *v 1349 } 1350 1351 for key, value := range shape { 1352 switch key { 1353 case "Message": 1354 if value != nil { 1355 jtv, ok := value.(string) 1356 if !ok { 1357 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1358 } 1359 sv.Message = ptr.String(jtv) 1360 } 1361 1362 default: 1363 _, _ = key, value 1364 1365 } 1366 } 1367 *v = sv 1368 return nil 1369} 1370 1371func awsAwsjson11_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { 1372 if v == nil { 1373 return fmt.Errorf("unexpected nil of type %T", v) 1374 } 1375 if value == nil { 1376 return nil 1377 } 1378 1379 shape, ok := value.(map[string]interface{}) 1380 if !ok { 1381 return fmt.Errorf("unexpected JSON type %v", value) 1382 } 1383 1384 var sv *types.LimitExceededException 1385 if *v == nil { 1386 sv = &types.LimitExceededException{} 1387 } else { 1388 sv = *v 1389 } 1390 1391 for key, value := range shape { 1392 switch key { 1393 case "Message": 1394 if value != nil { 1395 jtv, ok := value.(string) 1396 if !ok { 1397 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1398 } 1399 sv.Message = ptr.String(jtv) 1400 } 1401 1402 default: 1403 _, _ = key, value 1404 1405 } 1406 } 1407 *v = sv 1408 return nil 1409} 1410 1411func awsAwsjson11_deserializeDocumentMetricDimension(v **types.MetricDimension, value interface{}) error { 1412 if v == nil { 1413 return fmt.Errorf("unexpected nil of type %T", v) 1414 } 1415 if value == nil { 1416 return nil 1417 } 1418 1419 shape, ok := value.(map[string]interface{}) 1420 if !ok { 1421 return fmt.Errorf("unexpected JSON type %v", value) 1422 } 1423 1424 var sv *types.MetricDimension 1425 if *v == nil { 1426 sv = &types.MetricDimension{} 1427 } else { 1428 sv = *v 1429 } 1430 1431 for key, value := range shape { 1432 switch key { 1433 case "Name": 1434 if value != nil { 1435 jtv, ok := value.(string) 1436 if !ok { 1437 return fmt.Errorf("expected MetricDimensionName to be of type string, got %T instead", value) 1438 } 1439 sv.Name = ptr.String(jtv) 1440 } 1441 1442 case "Value": 1443 if value != nil { 1444 jtv, ok := value.(string) 1445 if !ok { 1446 return fmt.Errorf("expected MetricDimensionValue to be of type string, got %T instead", value) 1447 } 1448 sv.Value = ptr.String(jtv) 1449 } 1450 1451 default: 1452 _, _ = key, value 1453 1454 } 1455 } 1456 *v = sv 1457 return nil 1458} 1459 1460func awsAwsjson11_deserializeDocumentMetricDimensions(v *[]types.MetricDimension, value interface{}) error { 1461 if v == nil { 1462 return fmt.Errorf("unexpected nil of type %T", v) 1463 } 1464 if value == nil { 1465 return nil 1466 } 1467 1468 shape, ok := value.([]interface{}) 1469 if !ok { 1470 return fmt.Errorf("unexpected JSON type %v", value) 1471 } 1472 1473 var cv []types.MetricDimension 1474 if *v == nil { 1475 cv = []types.MetricDimension{} 1476 } else { 1477 cv = *v 1478 } 1479 1480 for _, value := range shape { 1481 var col types.MetricDimension 1482 destAddr := &col 1483 if err := awsAwsjson11_deserializeDocumentMetricDimension(&destAddr, value); err != nil { 1484 return err 1485 } 1486 col = *destAddr 1487 cv = append(cv, col) 1488 1489 } 1490 *v = cv 1491 return nil 1492} 1493 1494func awsAwsjson11_deserializeDocumentObjectNotFoundException(v **types.ObjectNotFoundException, value interface{}) error { 1495 if v == nil { 1496 return fmt.Errorf("unexpected nil of type %T", v) 1497 } 1498 if value == nil { 1499 return nil 1500 } 1501 1502 shape, ok := value.(map[string]interface{}) 1503 if !ok { 1504 return fmt.Errorf("unexpected JSON type %v", value) 1505 } 1506 1507 var sv *types.ObjectNotFoundException 1508 if *v == nil { 1509 sv = &types.ObjectNotFoundException{} 1510 } else { 1511 sv = *v 1512 } 1513 1514 for key, value := range shape { 1515 switch key { 1516 case "Message": 1517 if value != nil { 1518 jtv, ok := value.(string) 1519 if !ok { 1520 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 1521 } 1522 sv.Message = ptr.String(jtv) 1523 } 1524 1525 default: 1526 _, _ = key, value 1527 1528 } 1529 } 1530 *v = sv 1531 return nil 1532} 1533 1534func awsAwsjson11_deserializeDocumentPredefinedLoadMetricSpecification(v **types.PredefinedLoadMetricSpecification, value interface{}) error { 1535 if v == nil { 1536 return fmt.Errorf("unexpected nil of type %T", v) 1537 } 1538 if value == nil { 1539 return nil 1540 } 1541 1542 shape, ok := value.(map[string]interface{}) 1543 if !ok { 1544 return fmt.Errorf("unexpected JSON type %v", value) 1545 } 1546 1547 var sv *types.PredefinedLoadMetricSpecification 1548 if *v == nil { 1549 sv = &types.PredefinedLoadMetricSpecification{} 1550 } else { 1551 sv = *v 1552 } 1553 1554 for key, value := range shape { 1555 switch key { 1556 case "PredefinedLoadMetricType": 1557 if value != nil { 1558 jtv, ok := value.(string) 1559 if !ok { 1560 return fmt.Errorf("expected LoadMetricType to be of type string, got %T instead", value) 1561 } 1562 sv.PredefinedLoadMetricType = types.LoadMetricType(jtv) 1563 } 1564 1565 case "ResourceLabel": 1566 if value != nil { 1567 jtv, ok := value.(string) 1568 if !ok { 1569 return fmt.Errorf("expected ResourceLabel to be of type string, got %T instead", value) 1570 } 1571 sv.ResourceLabel = ptr.String(jtv) 1572 } 1573 1574 default: 1575 _, _ = key, value 1576 1577 } 1578 } 1579 *v = sv 1580 return nil 1581} 1582 1583func awsAwsjson11_deserializeDocumentPredefinedScalingMetricSpecification(v **types.PredefinedScalingMetricSpecification, value interface{}) error { 1584 if v == nil { 1585 return fmt.Errorf("unexpected nil of type %T", v) 1586 } 1587 if value == nil { 1588 return nil 1589 } 1590 1591 shape, ok := value.(map[string]interface{}) 1592 if !ok { 1593 return fmt.Errorf("unexpected JSON type %v", value) 1594 } 1595 1596 var sv *types.PredefinedScalingMetricSpecification 1597 if *v == nil { 1598 sv = &types.PredefinedScalingMetricSpecification{} 1599 } else { 1600 sv = *v 1601 } 1602 1603 for key, value := range shape { 1604 switch key { 1605 case "PredefinedScalingMetricType": 1606 if value != nil { 1607 jtv, ok := value.(string) 1608 if !ok { 1609 return fmt.Errorf("expected ScalingMetricType to be of type string, got %T instead", value) 1610 } 1611 sv.PredefinedScalingMetricType = types.ScalingMetricType(jtv) 1612 } 1613 1614 case "ResourceLabel": 1615 if value != nil { 1616 jtv, ok := value.(string) 1617 if !ok { 1618 return fmt.Errorf("expected ResourceLabel to be of type string, got %T instead", value) 1619 } 1620 sv.ResourceLabel = ptr.String(jtv) 1621 } 1622 1623 default: 1624 _, _ = key, value 1625 1626 } 1627 } 1628 *v = sv 1629 return nil 1630} 1631 1632func awsAwsjson11_deserializeDocumentScalingInstruction(v **types.ScalingInstruction, value interface{}) error { 1633 if v == nil { 1634 return fmt.Errorf("unexpected nil of type %T", v) 1635 } 1636 if value == nil { 1637 return nil 1638 } 1639 1640 shape, ok := value.(map[string]interface{}) 1641 if !ok { 1642 return fmt.Errorf("unexpected JSON type %v", value) 1643 } 1644 1645 var sv *types.ScalingInstruction 1646 if *v == nil { 1647 sv = &types.ScalingInstruction{} 1648 } else { 1649 sv = *v 1650 } 1651 1652 for key, value := range shape { 1653 switch key { 1654 case "CustomizedLoadMetricSpecification": 1655 if err := awsAwsjson11_deserializeDocumentCustomizedLoadMetricSpecification(&sv.CustomizedLoadMetricSpecification, value); err != nil { 1656 return err 1657 } 1658 1659 case "DisableDynamicScaling": 1660 if value != nil { 1661 jtv, ok := value.(bool) 1662 if !ok { 1663 return fmt.Errorf("expected DisableDynamicScaling to be of type *bool, got %T instead", value) 1664 } 1665 sv.DisableDynamicScaling = ptr.Bool(jtv) 1666 } 1667 1668 case "MaxCapacity": 1669 if value != nil { 1670 jtv, ok := value.(json.Number) 1671 if !ok { 1672 return fmt.Errorf("expected ResourceCapacity to be json.Number, got %T instead", value) 1673 } 1674 i64, err := jtv.Int64() 1675 if err != nil { 1676 return err 1677 } 1678 sv.MaxCapacity = ptr.Int32(int32(i64)) 1679 } 1680 1681 case "MinCapacity": 1682 if value != nil { 1683 jtv, ok := value.(json.Number) 1684 if !ok { 1685 return fmt.Errorf("expected ResourceCapacity to be json.Number, got %T instead", value) 1686 } 1687 i64, err := jtv.Int64() 1688 if err != nil { 1689 return err 1690 } 1691 sv.MinCapacity = ptr.Int32(int32(i64)) 1692 } 1693 1694 case "PredefinedLoadMetricSpecification": 1695 if err := awsAwsjson11_deserializeDocumentPredefinedLoadMetricSpecification(&sv.PredefinedLoadMetricSpecification, value); err != nil { 1696 return err 1697 } 1698 1699 case "PredictiveScalingMaxCapacityBehavior": 1700 if value != nil { 1701 jtv, ok := value.(string) 1702 if !ok { 1703 return fmt.Errorf("expected PredictiveScalingMaxCapacityBehavior to be of type string, got %T instead", value) 1704 } 1705 sv.PredictiveScalingMaxCapacityBehavior = types.PredictiveScalingMaxCapacityBehavior(jtv) 1706 } 1707 1708 case "PredictiveScalingMaxCapacityBuffer": 1709 if value != nil { 1710 jtv, ok := value.(json.Number) 1711 if !ok { 1712 return fmt.Errorf("expected ResourceCapacity to be json.Number, got %T instead", value) 1713 } 1714 i64, err := jtv.Int64() 1715 if err != nil { 1716 return err 1717 } 1718 sv.PredictiveScalingMaxCapacityBuffer = ptr.Int32(int32(i64)) 1719 } 1720 1721 case "PredictiveScalingMode": 1722 if value != nil { 1723 jtv, ok := value.(string) 1724 if !ok { 1725 return fmt.Errorf("expected PredictiveScalingMode to be of type string, got %T instead", value) 1726 } 1727 sv.PredictiveScalingMode = types.PredictiveScalingMode(jtv) 1728 } 1729 1730 case "ResourceId": 1731 if value != nil { 1732 jtv, ok := value.(string) 1733 if !ok { 1734 return fmt.Errorf("expected ResourceIdMaxLen1600 to be of type string, got %T instead", value) 1735 } 1736 sv.ResourceId = ptr.String(jtv) 1737 } 1738 1739 case "ScalableDimension": 1740 if value != nil { 1741 jtv, ok := value.(string) 1742 if !ok { 1743 return fmt.Errorf("expected ScalableDimension to be of type string, got %T instead", value) 1744 } 1745 sv.ScalableDimension = types.ScalableDimension(jtv) 1746 } 1747 1748 case "ScalingPolicyUpdateBehavior": 1749 if value != nil { 1750 jtv, ok := value.(string) 1751 if !ok { 1752 return fmt.Errorf("expected ScalingPolicyUpdateBehavior to be of type string, got %T instead", value) 1753 } 1754 sv.ScalingPolicyUpdateBehavior = types.ScalingPolicyUpdateBehavior(jtv) 1755 } 1756 1757 case "ScheduledActionBufferTime": 1758 if value != nil { 1759 jtv, ok := value.(json.Number) 1760 if !ok { 1761 return fmt.Errorf("expected ScheduledActionBufferTime to be json.Number, got %T instead", value) 1762 } 1763 i64, err := jtv.Int64() 1764 if err != nil { 1765 return err 1766 } 1767 sv.ScheduledActionBufferTime = ptr.Int32(int32(i64)) 1768 } 1769 1770 case "ServiceNamespace": 1771 if value != nil { 1772 jtv, ok := value.(string) 1773 if !ok { 1774 return fmt.Errorf("expected ServiceNamespace to be of type string, got %T instead", value) 1775 } 1776 sv.ServiceNamespace = types.ServiceNamespace(jtv) 1777 } 1778 1779 case "TargetTrackingConfigurations": 1780 if err := awsAwsjson11_deserializeDocumentTargetTrackingConfigurations(&sv.TargetTrackingConfigurations, value); err != nil { 1781 return err 1782 } 1783 1784 default: 1785 _, _ = key, value 1786 1787 } 1788 } 1789 *v = sv 1790 return nil 1791} 1792 1793func awsAwsjson11_deserializeDocumentScalingInstructions(v *[]types.ScalingInstruction, value interface{}) error { 1794 if v == nil { 1795 return fmt.Errorf("unexpected nil of type %T", v) 1796 } 1797 if value == nil { 1798 return nil 1799 } 1800 1801 shape, ok := value.([]interface{}) 1802 if !ok { 1803 return fmt.Errorf("unexpected JSON type %v", value) 1804 } 1805 1806 var cv []types.ScalingInstruction 1807 if *v == nil { 1808 cv = []types.ScalingInstruction{} 1809 } else { 1810 cv = *v 1811 } 1812 1813 for _, value := range shape { 1814 var col types.ScalingInstruction 1815 destAddr := &col 1816 if err := awsAwsjson11_deserializeDocumentScalingInstruction(&destAddr, value); err != nil { 1817 return err 1818 } 1819 col = *destAddr 1820 cv = append(cv, col) 1821 1822 } 1823 *v = cv 1824 return nil 1825} 1826 1827func awsAwsjson11_deserializeDocumentScalingPlan(v **types.ScalingPlan, value interface{}) error { 1828 if v == nil { 1829 return fmt.Errorf("unexpected nil of type %T", v) 1830 } 1831 if value == nil { 1832 return nil 1833 } 1834 1835 shape, ok := value.(map[string]interface{}) 1836 if !ok { 1837 return fmt.Errorf("unexpected JSON type %v", value) 1838 } 1839 1840 var sv *types.ScalingPlan 1841 if *v == nil { 1842 sv = &types.ScalingPlan{} 1843 } else { 1844 sv = *v 1845 } 1846 1847 for key, value := range shape { 1848 switch key { 1849 case "ApplicationSource": 1850 if err := awsAwsjson11_deserializeDocumentApplicationSource(&sv.ApplicationSource, value); err != nil { 1851 return err 1852 } 1853 1854 case "CreationTime": 1855 if value != nil { 1856 switch jtv := value.(type) { 1857 case json.Number: 1858 f64, err := jtv.Float64() 1859 if err != nil { 1860 return err 1861 } 1862 sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1863 1864 default: 1865 return fmt.Errorf("expected TimestampType to be a JSON Number, got %T instead", value) 1866 1867 } 1868 } 1869 1870 case "ScalingInstructions": 1871 if err := awsAwsjson11_deserializeDocumentScalingInstructions(&sv.ScalingInstructions, value); err != nil { 1872 return err 1873 } 1874 1875 case "ScalingPlanName": 1876 if value != nil { 1877 jtv, ok := value.(string) 1878 if !ok { 1879 return fmt.Errorf("expected ScalingPlanName to be of type string, got %T instead", value) 1880 } 1881 sv.ScalingPlanName = ptr.String(jtv) 1882 } 1883 1884 case "ScalingPlanVersion": 1885 if value != nil { 1886 jtv, ok := value.(json.Number) 1887 if !ok { 1888 return fmt.Errorf("expected ScalingPlanVersion to be json.Number, got %T instead", value) 1889 } 1890 i64, err := jtv.Int64() 1891 if err != nil { 1892 return err 1893 } 1894 sv.ScalingPlanVersion = ptr.Int64(i64) 1895 } 1896 1897 case "StatusCode": 1898 if value != nil { 1899 jtv, ok := value.(string) 1900 if !ok { 1901 return fmt.Errorf("expected ScalingPlanStatusCode to be of type string, got %T instead", value) 1902 } 1903 sv.StatusCode = types.ScalingPlanStatusCode(jtv) 1904 } 1905 1906 case "StatusMessage": 1907 if value != nil { 1908 jtv, ok := value.(string) 1909 if !ok { 1910 return fmt.Errorf("expected XmlString to be of type string, got %T instead", value) 1911 } 1912 sv.StatusMessage = ptr.String(jtv) 1913 } 1914 1915 case "StatusStartTime": 1916 if value != nil { 1917 switch jtv := value.(type) { 1918 case json.Number: 1919 f64, err := jtv.Float64() 1920 if err != nil { 1921 return err 1922 } 1923 sv.StatusStartTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) 1924 1925 default: 1926 return fmt.Errorf("expected TimestampType to be a JSON Number, got %T instead", value) 1927 1928 } 1929 } 1930 1931 default: 1932 _, _ = key, value 1933 1934 } 1935 } 1936 *v = sv 1937 return nil 1938} 1939 1940func awsAwsjson11_deserializeDocumentScalingPlanResource(v **types.ScalingPlanResource, value interface{}) error { 1941 if v == nil { 1942 return fmt.Errorf("unexpected nil of type %T", v) 1943 } 1944 if value == nil { 1945 return nil 1946 } 1947 1948 shape, ok := value.(map[string]interface{}) 1949 if !ok { 1950 return fmt.Errorf("unexpected JSON type %v", value) 1951 } 1952 1953 var sv *types.ScalingPlanResource 1954 if *v == nil { 1955 sv = &types.ScalingPlanResource{} 1956 } else { 1957 sv = *v 1958 } 1959 1960 for key, value := range shape { 1961 switch key { 1962 case "ResourceId": 1963 if value != nil { 1964 jtv, ok := value.(string) 1965 if !ok { 1966 return fmt.Errorf("expected ResourceIdMaxLen1600 to be of type string, got %T instead", value) 1967 } 1968 sv.ResourceId = ptr.String(jtv) 1969 } 1970 1971 case "ScalableDimension": 1972 if value != nil { 1973 jtv, ok := value.(string) 1974 if !ok { 1975 return fmt.Errorf("expected ScalableDimension to be of type string, got %T instead", value) 1976 } 1977 sv.ScalableDimension = types.ScalableDimension(jtv) 1978 } 1979 1980 case "ScalingPlanName": 1981 if value != nil { 1982 jtv, ok := value.(string) 1983 if !ok { 1984 return fmt.Errorf("expected ScalingPlanName to be of type string, got %T instead", value) 1985 } 1986 sv.ScalingPlanName = ptr.String(jtv) 1987 } 1988 1989 case "ScalingPlanVersion": 1990 if value != nil { 1991 jtv, ok := value.(json.Number) 1992 if !ok { 1993 return fmt.Errorf("expected ScalingPlanVersion to be json.Number, got %T instead", value) 1994 } 1995 i64, err := jtv.Int64() 1996 if err != nil { 1997 return err 1998 } 1999 sv.ScalingPlanVersion = ptr.Int64(i64) 2000 } 2001 2002 case "ScalingPolicies": 2003 if err := awsAwsjson11_deserializeDocumentScalingPolicies(&sv.ScalingPolicies, value); err != nil { 2004 return err 2005 } 2006 2007 case "ScalingStatusCode": 2008 if value != nil { 2009 jtv, ok := value.(string) 2010 if !ok { 2011 return fmt.Errorf("expected ScalingStatusCode to be of type string, got %T instead", value) 2012 } 2013 sv.ScalingStatusCode = types.ScalingStatusCode(jtv) 2014 } 2015 2016 case "ScalingStatusMessage": 2017 if value != nil { 2018 jtv, ok := value.(string) 2019 if !ok { 2020 return fmt.Errorf("expected XmlString to be of type string, got %T instead", value) 2021 } 2022 sv.ScalingStatusMessage = ptr.String(jtv) 2023 } 2024 2025 case "ServiceNamespace": 2026 if value != nil { 2027 jtv, ok := value.(string) 2028 if !ok { 2029 return fmt.Errorf("expected ServiceNamespace to be of type string, got %T instead", value) 2030 } 2031 sv.ServiceNamespace = types.ServiceNamespace(jtv) 2032 } 2033 2034 default: 2035 _, _ = key, value 2036 2037 } 2038 } 2039 *v = sv 2040 return nil 2041} 2042 2043func awsAwsjson11_deserializeDocumentScalingPlanResources(v *[]types.ScalingPlanResource, value interface{}) error { 2044 if v == nil { 2045 return fmt.Errorf("unexpected nil of type %T", v) 2046 } 2047 if value == nil { 2048 return nil 2049 } 2050 2051 shape, ok := value.([]interface{}) 2052 if !ok { 2053 return fmt.Errorf("unexpected JSON type %v", value) 2054 } 2055 2056 var cv []types.ScalingPlanResource 2057 if *v == nil { 2058 cv = []types.ScalingPlanResource{} 2059 } else { 2060 cv = *v 2061 } 2062 2063 for _, value := range shape { 2064 var col types.ScalingPlanResource 2065 destAddr := &col 2066 if err := awsAwsjson11_deserializeDocumentScalingPlanResource(&destAddr, value); err != nil { 2067 return err 2068 } 2069 col = *destAddr 2070 cv = append(cv, col) 2071 2072 } 2073 *v = cv 2074 return nil 2075} 2076 2077func awsAwsjson11_deserializeDocumentScalingPlans(v *[]types.ScalingPlan, value interface{}) error { 2078 if v == nil { 2079 return fmt.Errorf("unexpected nil of type %T", v) 2080 } 2081 if value == nil { 2082 return nil 2083 } 2084 2085 shape, ok := value.([]interface{}) 2086 if !ok { 2087 return fmt.Errorf("unexpected JSON type %v", value) 2088 } 2089 2090 var cv []types.ScalingPlan 2091 if *v == nil { 2092 cv = []types.ScalingPlan{} 2093 } else { 2094 cv = *v 2095 } 2096 2097 for _, value := range shape { 2098 var col types.ScalingPlan 2099 destAddr := &col 2100 if err := awsAwsjson11_deserializeDocumentScalingPlan(&destAddr, value); err != nil { 2101 return err 2102 } 2103 col = *destAddr 2104 cv = append(cv, col) 2105 2106 } 2107 *v = cv 2108 return nil 2109} 2110 2111func awsAwsjson11_deserializeDocumentScalingPolicies(v *[]types.ScalingPolicy, value interface{}) error { 2112 if v == nil { 2113 return fmt.Errorf("unexpected nil of type %T", v) 2114 } 2115 if value == nil { 2116 return nil 2117 } 2118 2119 shape, ok := value.([]interface{}) 2120 if !ok { 2121 return fmt.Errorf("unexpected JSON type %v", value) 2122 } 2123 2124 var cv []types.ScalingPolicy 2125 if *v == nil { 2126 cv = []types.ScalingPolicy{} 2127 } else { 2128 cv = *v 2129 } 2130 2131 for _, value := range shape { 2132 var col types.ScalingPolicy 2133 destAddr := &col 2134 if err := awsAwsjson11_deserializeDocumentScalingPolicy(&destAddr, value); err != nil { 2135 return err 2136 } 2137 col = *destAddr 2138 cv = append(cv, col) 2139 2140 } 2141 *v = cv 2142 return nil 2143} 2144 2145func awsAwsjson11_deserializeDocumentScalingPolicy(v **types.ScalingPolicy, value interface{}) error { 2146 if v == nil { 2147 return fmt.Errorf("unexpected nil of type %T", v) 2148 } 2149 if value == nil { 2150 return nil 2151 } 2152 2153 shape, ok := value.(map[string]interface{}) 2154 if !ok { 2155 return fmt.Errorf("unexpected JSON type %v", value) 2156 } 2157 2158 var sv *types.ScalingPolicy 2159 if *v == nil { 2160 sv = &types.ScalingPolicy{} 2161 } else { 2162 sv = *v 2163 } 2164 2165 for key, value := range shape { 2166 switch key { 2167 case "PolicyName": 2168 if value != nil { 2169 jtv, ok := value.(string) 2170 if !ok { 2171 return fmt.Errorf("expected PolicyName to be of type string, got %T instead", value) 2172 } 2173 sv.PolicyName = ptr.String(jtv) 2174 } 2175 2176 case "PolicyType": 2177 if value != nil { 2178 jtv, ok := value.(string) 2179 if !ok { 2180 return fmt.Errorf("expected PolicyType to be of type string, got %T instead", value) 2181 } 2182 sv.PolicyType = types.PolicyType(jtv) 2183 } 2184 2185 case "TargetTrackingConfiguration": 2186 if err := awsAwsjson11_deserializeDocumentTargetTrackingConfiguration(&sv.TargetTrackingConfiguration, value); err != nil { 2187 return err 2188 } 2189 2190 default: 2191 _, _ = key, value 2192 2193 } 2194 } 2195 *v = sv 2196 return nil 2197} 2198 2199func awsAwsjson11_deserializeDocumentTagFilter(v **types.TagFilter, value interface{}) error { 2200 if v == nil { 2201 return fmt.Errorf("unexpected nil of type %T", v) 2202 } 2203 if value == nil { 2204 return nil 2205 } 2206 2207 shape, ok := value.(map[string]interface{}) 2208 if !ok { 2209 return fmt.Errorf("unexpected JSON type %v", value) 2210 } 2211 2212 var sv *types.TagFilter 2213 if *v == nil { 2214 sv = &types.TagFilter{} 2215 } else { 2216 sv = *v 2217 } 2218 2219 for key, value := range shape { 2220 switch key { 2221 case "Key": 2222 if value != nil { 2223 jtv, ok := value.(string) 2224 if !ok { 2225 return fmt.Errorf("expected XmlStringMaxLen128 to be of type string, got %T instead", value) 2226 } 2227 sv.Key = ptr.String(jtv) 2228 } 2229 2230 case "Values": 2231 if err := awsAwsjson11_deserializeDocumentTagValues(&sv.Values, value); err != nil { 2232 return err 2233 } 2234 2235 default: 2236 _, _ = key, value 2237 2238 } 2239 } 2240 *v = sv 2241 return nil 2242} 2243 2244func awsAwsjson11_deserializeDocumentTagFilters(v *[]types.TagFilter, value interface{}) error { 2245 if v == nil { 2246 return fmt.Errorf("unexpected nil of type %T", v) 2247 } 2248 if value == nil { 2249 return nil 2250 } 2251 2252 shape, ok := value.([]interface{}) 2253 if !ok { 2254 return fmt.Errorf("unexpected JSON type %v", value) 2255 } 2256 2257 var cv []types.TagFilter 2258 if *v == nil { 2259 cv = []types.TagFilter{} 2260 } else { 2261 cv = *v 2262 } 2263 2264 for _, value := range shape { 2265 var col types.TagFilter 2266 destAddr := &col 2267 if err := awsAwsjson11_deserializeDocumentTagFilter(&destAddr, value); err != nil { 2268 return err 2269 } 2270 col = *destAddr 2271 cv = append(cv, col) 2272 2273 } 2274 *v = cv 2275 return nil 2276} 2277 2278func awsAwsjson11_deserializeDocumentTagValues(v *[]string, value interface{}) error { 2279 if v == nil { 2280 return fmt.Errorf("unexpected nil of type %T", v) 2281 } 2282 if value == nil { 2283 return nil 2284 } 2285 2286 shape, ok := value.([]interface{}) 2287 if !ok { 2288 return fmt.Errorf("unexpected JSON type %v", value) 2289 } 2290 2291 var cv []string 2292 if *v == nil { 2293 cv = []string{} 2294 } else { 2295 cv = *v 2296 } 2297 2298 for _, value := range shape { 2299 var col string 2300 if value != nil { 2301 jtv, ok := value.(string) 2302 if !ok { 2303 return fmt.Errorf("expected XmlStringMaxLen256 to be of type string, got %T instead", value) 2304 } 2305 col = jtv 2306 } 2307 cv = append(cv, col) 2308 2309 } 2310 *v = cv 2311 return nil 2312} 2313 2314func awsAwsjson11_deserializeDocumentTargetTrackingConfiguration(v **types.TargetTrackingConfiguration, value interface{}) error { 2315 if v == nil { 2316 return fmt.Errorf("unexpected nil of type %T", v) 2317 } 2318 if value == nil { 2319 return nil 2320 } 2321 2322 shape, ok := value.(map[string]interface{}) 2323 if !ok { 2324 return fmt.Errorf("unexpected JSON type %v", value) 2325 } 2326 2327 var sv *types.TargetTrackingConfiguration 2328 if *v == nil { 2329 sv = &types.TargetTrackingConfiguration{} 2330 } else { 2331 sv = *v 2332 } 2333 2334 for key, value := range shape { 2335 switch key { 2336 case "CustomizedScalingMetricSpecification": 2337 if err := awsAwsjson11_deserializeDocumentCustomizedScalingMetricSpecification(&sv.CustomizedScalingMetricSpecification, value); err != nil { 2338 return err 2339 } 2340 2341 case "DisableScaleIn": 2342 if value != nil { 2343 jtv, ok := value.(bool) 2344 if !ok { 2345 return fmt.Errorf("expected DisableScaleIn to be of type *bool, got %T instead", value) 2346 } 2347 sv.DisableScaleIn = ptr.Bool(jtv) 2348 } 2349 2350 case "EstimatedInstanceWarmup": 2351 if value != nil { 2352 jtv, ok := value.(json.Number) 2353 if !ok { 2354 return fmt.Errorf("expected Cooldown to be json.Number, got %T instead", value) 2355 } 2356 i64, err := jtv.Int64() 2357 if err != nil { 2358 return err 2359 } 2360 sv.EstimatedInstanceWarmup = ptr.Int32(int32(i64)) 2361 } 2362 2363 case "PredefinedScalingMetricSpecification": 2364 if err := awsAwsjson11_deserializeDocumentPredefinedScalingMetricSpecification(&sv.PredefinedScalingMetricSpecification, value); err != nil { 2365 return err 2366 } 2367 2368 case "ScaleInCooldown": 2369 if value != nil { 2370 jtv, ok := value.(json.Number) 2371 if !ok { 2372 return fmt.Errorf("expected Cooldown to be json.Number, got %T instead", value) 2373 } 2374 i64, err := jtv.Int64() 2375 if err != nil { 2376 return err 2377 } 2378 sv.ScaleInCooldown = ptr.Int32(int32(i64)) 2379 } 2380 2381 case "ScaleOutCooldown": 2382 if value != nil { 2383 jtv, ok := value.(json.Number) 2384 if !ok { 2385 return fmt.Errorf("expected Cooldown to be json.Number, got %T instead", value) 2386 } 2387 i64, err := jtv.Int64() 2388 if err != nil { 2389 return err 2390 } 2391 sv.ScaleOutCooldown = ptr.Int32(int32(i64)) 2392 } 2393 2394 case "TargetValue": 2395 if value != nil { 2396 switch jtv := value.(type) { 2397 case json.Number: 2398 f64, err := jtv.Float64() 2399 if err != nil { 2400 return err 2401 } 2402 sv.TargetValue = ptr.Float64(f64) 2403 2404 case string: 2405 var f64 float64 2406 switch { 2407 case strings.EqualFold(jtv, "NaN"): 2408 f64 = math.NaN() 2409 2410 case strings.EqualFold(jtv, "Infinity"): 2411 f64 = math.Inf(1) 2412 2413 case strings.EqualFold(jtv, "-Infinity"): 2414 f64 = math.Inf(-1) 2415 2416 default: 2417 return fmt.Errorf("unknown JSON number value: %s", jtv) 2418 2419 } 2420 sv.TargetValue = ptr.Float64(f64) 2421 2422 default: 2423 return fmt.Errorf("expected MetricScale to be a JSON Number, got %T instead", value) 2424 2425 } 2426 } 2427 2428 default: 2429 _, _ = key, value 2430 2431 } 2432 } 2433 *v = sv 2434 return nil 2435} 2436 2437func awsAwsjson11_deserializeDocumentTargetTrackingConfigurations(v *[]types.TargetTrackingConfiguration, value interface{}) error { 2438 if v == nil { 2439 return fmt.Errorf("unexpected nil of type %T", v) 2440 } 2441 if value == nil { 2442 return nil 2443 } 2444 2445 shape, ok := value.([]interface{}) 2446 if !ok { 2447 return fmt.Errorf("unexpected JSON type %v", value) 2448 } 2449 2450 var cv []types.TargetTrackingConfiguration 2451 if *v == nil { 2452 cv = []types.TargetTrackingConfiguration{} 2453 } else { 2454 cv = *v 2455 } 2456 2457 for _, value := range shape { 2458 var col types.TargetTrackingConfiguration 2459 destAddr := &col 2460 if err := awsAwsjson11_deserializeDocumentTargetTrackingConfiguration(&destAddr, value); err != nil { 2461 return err 2462 } 2463 col = *destAddr 2464 cv = append(cv, col) 2465 2466 } 2467 *v = cv 2468 return nil 2469} 2470 2471func awsAwsjson11_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { 2472 if v == nil { 2473 return fmt.Errorf("unexpected nil of type %T", v) 2474 } 2475 if value == nil { 2476 return nil 2477 } 2478 2479 shape, ok := value.(map[string]interface{}) 2480 if !ok { 2481 return fmt.Errorf("unexpected JSON type %v", value) 2482 } 2483 2484 var sv *types.ValidationException 2485 if *v == nil { 2486 sv = &types.ValidationException{} 2487 } else { 2488 sv = *v 2489 } 2490 2491 for key, value := range shape { 2492 switch key { 2493 case "Message": 2494 if value != nil { 2495 jtv, ok := value.(string) 2496 if !ok { 2497 return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) 2498 } 2499 sv.Message = ptr.String(jtv) 2500 } 2501 2502 default: 2503 _, _ = key, value 2504 2505 } 2506 } 2507 *v = sv 2508 return nil 2509} 2510 2511func awsAwsjson11_deserializeOpDocumentCreateScalingPlanOutput(v **CreateScalingPlanOutput, value interface{}) error { 2512 if v == nil { 2513 return fmt.Errorf("unexpected nil of type %T", v) 2514 } 2515 if value == nil { 2516 return nil 2517 } 2518 2519 shape, ok := value.(map[string]interface{}) 2520 if !ok { 2521 return fmt.Errorf("unexpected JSON type %v", value) 2522 } 2523 2524 var sv *CreateScalingPlanOutput 2525 if *v == nil { 2526 sv = &CreateScalingPlanOutput{} 2527 } else { 2528 sv = *v 2529 } 2530 2531 for key, value := range shape { 2532 switch key { 2533 case "ScalingPlanVersion": 2534 if value != nil { 2535 jtv, ok := value.(json.Number) 2536 if !ok { 2537 return fmt.Errorf("expected ScalingPlanVersion to be json.Number, got %T instead", value) 2538 } 2539 i64, err := jtv.Int64() 2540 if err != nil { 2541 return err 2542 } 2543 sv.ScalingPlanVersion = ptr.Int64(i64) 2544 } 2545 2546 default: 2547 _, _ = key, value 2548 2549 } 2550 } 2551 *v = sv 2552 return nil 2553} 2554 2555func awsAwsjson11_deserializeOpDocumentDeleteScalingPlanOutput(v **DeleteScalingPlanOutput, value interface{}) error { 2556 if v == nil { 2557 return fmt.Errorf("unexpected nil of type %T", v) 2558 } 2559 if value == nil { 2560 return nil 2561 } 2562 2563 shape, ok := value.(map[string]interface{}) 2564 if !ok { 2565 return fmt.Errorf("unexpected JSON type %v", value) 2566 } 2567 2568 var sv *DeleteScalingPlanOutput 2569 if *v == nil { 2570 sv = &DeleteScalingPlanOutput{} 2571 } else { 2572 sv = *v 2573 } 2574 2575 for key, value := range shape { 2576 switch key { 2577 default: 2578 _, _ = key, value 2579 2580 } 2581 } 2582 *v = sv 2583 return nil 2584} 2585 2586func awsAwsjson11_deserializeOpDocumentDescribeScalingPlanResourcesOutput(v **DescribeScalingPlanResourcesOutput, value interface{}) error { 2587 if v == nil { 2588 return fmt.Errorf("unexpected nil of type %T", v) 2589 } 2590 if value == nil { 2591 return nil 2592 } 2593 2594 shape, ok := value.(map[string]interface{}) 2595 if !ok { 2596 return fmt.Errorf("unexpected JSON type %v", value) 2597 } 2598 2599 var sv *DescribeScalingPlanResourcesOutput 2600 if *v == nil { 2601 sv = &DescribeScalingPlanResourcesOutput{} 2602 } else { 2603 sv = *v 2604 } 2605 2606 for key, value := range shape { 2607 switch key { 2608 case "NextToken": 2609 if value != nil { 2610 jtv, ok := value.(string) 2611 if !ok { 2612 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 2613 } 2614 sv.NextToken = ptr.String(jtv) 2615 } 2616 2617 case "ScalingPlanResources": 2618 if err := awsAwsjson11_deserializeDocumentScalingPlanResources(&sv.ScalingPlanResources, value); err != nil { 2619 return err 2620 } 2621 2622 default: 2623 _, _ = key, value 2624 2625 } 2626 } 2627 *v = sv 2628 return nil 2629} 2630 2631func awsAwsjson11_deserializeOpDocumentDescribeScalingPlansOutput(v **DescribeScalingPlansOutput, value interface{}) error { 2632 if v == nil { 2633 return fmt.Errorf("unexpected nil of type %T", v) 2634 } 2635 if value == nil { 2636 return nil 2637 } 2638 2639 shape, ok := value.(map[string]interface{}) 2640 if !ok { 2641 return fmt.Errorf("unexpected JSON type %v", value) 2642 } 2643 2644 var sv *DescribeScalingPlansOutput 2645 if *v == nil { 2646 sv = &DescribeScalingPlansOutput{} 2647 } else { 2648 sv = *v 2649 } 2650 2651 for key, value := range shape { 2652 switch key { 2653 case "NextToken": 2654 if value != nil { 2655 jtv, ok := value.(string) 2656 if !ok { 2657 return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) 2658 } 2659 sv.NextToken = ptr.String(jtv) 2660 } 2661 2662 case "ScalingPlans": 2663 if err := awsAwsjson11_deserializeDocumentScalingPlans(&sv.ScalingPlans, value); err != nil { 2664 return err 2665 } 2666 2667 default: 2668 _, _ = key, value 2669 2670 } 2671 } 2672 *v = sv 2673 return nil 2674} 2675 2676func awsAwsjson11_deserializeOpDocumentGetScalingPlanResourceForecastDataOutput(v **GetScalingPlanResourceForecastDataOutput, value interface{}) error { 2677 if v == nil { 2678 return fmt.Errorf("unexpected nil of type %T", v) 2679 } 2680 if value == nil { 2681 return nil 2682 } 2683 2684 shape, ok := value.(map[string]interface{}) 2685 if !ok { 2686 return fmt.Errorf("unexpected JSON type %v", value) 2687 } 2688 2689 var sv *GetScalingPlanResourceForecastDataOutput 2690 if *v == nil { 2691 sv = &GetScalingPlanResourceForecastDataOutput{} 2692 } else { 2693 sv = *v 2694 } 2695 2696 for key, value := range shape { 2697 switch key { 2698 case "Datapoints": 2699 if err := awsAwsjson11_deserializeDocumentDatapoints(&sv.Datapoints, value); err != nil { 2700 return err 2701 } 2702 2703 default: 2704 _, _ = key, value 2705 2706 } 2707 } 2708 *v = sv 2709 return nil 2710} 2711 2712func awsAwsjson11_deserializeOpDocumentUpdateScalingPlanOutput(v **UpdateScalingPlanOutput, value interface{}) error { 2713 if v == nil { 2714 return fmt.Errorf("unexpected nil of type %T", v) 2715 } 2716 if value == nil { 2717 return nil 2718 } 2719 2720 shape, ok := value.(map[string]interface{}) 2721 if !ok { 2722 return fmt.Errorf("unexpected JSON type %v", value) 2723 } 2724 2725 var sv *UpdateScalingPlanOutput 2726 if *v == nil { 2727 sv = &UpdateScalingPlanOutput{} 2728 } else { 2729 sv = *v 2730 } 2731 2732 for key, value := range shape { 2733 switch key { 2734 default: 2735 _, _ = key, value 2736 2737 } 2738 } 2739 *v = sv 2740 return nil 2741} 2742