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