1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
// =================================================================
//
//                           * WARNING *
//
//                    This file is generated!
//
//  Changes made to this file will be overwritten. If changes are
//  required to the generated code, the service_crategen project
//  must be updated to generate the changes.
//
// =================================================================

use std::error::Error;
use std::fmt;
use std::io;

#[allow(warnings)]
use futures::future;
use futures::Future;
use rusoto_core::region;
use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
use rusoto_core::{Client, RusotoFuture};

use rusoto_core::credential::{CredentialsError, ProvideAwsCredentials};
use rusoto_core::request::HttpDispatchError;

use rusoto_core::signature::SignedRequest;
use serde_json;
use serde_json::from_slice;
use serde_json::Value as SerdeJsonValue;
/// <p>Represents an application source.</p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ApplicationSource {
    /// <p>The Amazon Resource Name (ARN) of a AWS CloudFormation stack.</p>
    #[serde(rename = "CloudFormationStackARN")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cloud_formation_stack_arn: Option<String>,
    /// <p>A set of tags (up to 50).</p>
    #[serde(rename = "TagFilters")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tag_filters: Option<Vec<TagFilter>>,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct CreateScalingPlanRequest {
    /// <p>A CloudFormation stack or set of tags. You can create one scaling plan per application source.</p>
    #[serde(rename = "ApplicationSource")]
    pub application_source: ApplicationSource,
    /// <p>The scaling instructions.</p>
    #[serde(rename = "ScalingInstructions")]
    pub scaling_instructions: Vec<ScalingInstruction>,
    /// <p>The name of the scaling plan. Names cannot contain vertical bars, colons, or forward slashes.</p>
    #[serde(rename = "ScalingPlanName")]
    pub scaling_plan_name: String,
}

#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct CreateScalingPlanResponse {
    /// <p>The version number of the scaling plan. This value is always 1.</p> <p>Currently, you cannot specify multiple scaling plan versions.</p>
    #[serde(rename = "ScalingPlanVersion")]
    pub scaling_plan_version: i64,
}

/// <p>Represents a CloudWatch metric of your choosing that can be used for predictive scaling. </p> <p>For predictive scaling to work with a customized load metric specification, AWS Auto Scaling needs access to the <code>Sum</code> and <code>Average</code> statistics that CloudWatch computes from metric data. Statistics are calculations used to aggregate data over specified time periods. For more information, see the <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html">Amazon CloudWatch User Guide</a>. </p> <p>When you choose a load metric, make sure that the required <code>Sum</code> and <code>Average</code> statistics for your metric are available in CloudWatch and that they provide relevant data for predictive scaling. The <code>Sum</code> statistic must represent the total load on the resource, and the <code>Average</code> statistic must represent the average load per capacity unit of the resource. For example, there is a metric that counts the number of requests processed by your Auto Scaling group. If the <code>Sum</code> statistic represents the total request count processed by the group, then the <code>Average</code> statistic for the specified metric must represent the average request count processed by each instance of the group.</p> <p>For information about terminology, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html">Amazon CloudWatch Concepts</a>. </p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CustomizedLoadMetricSpecification {
    /// <p>The dimensions of the metric.</p>
    #[serde(rename = "Dimensions")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dimensions: Option<Vec<MetricDimension>>,
    /// <p>The name of the metric.</p>
    #[serde(rename = "MetricName")]
    pub metric_name: String,
    /// <p>The namespace of the metric.</p>
    #[serde(rename = "Namespace")]
    pub namespace: String,
    /// <p>The statistic of the metric. Currently, the value must always be <code>Sum</code>. </p>
    #[serde(rename = "Statistic")]
    pub statistic: String,
    /// <p>The unit of the metric.</p>
    #[serde(rename = "Unit")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unit: Option<String>,
}

/// <p>Represents a CloudWatch metric of your choosing that can be used for dynamic scaling as part of a target tracking scaling policy. </p> <p>For information about terminology, see <a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html">Amazon CloudWatch Concepts</a>.</p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CustomizedScalingMetricSpecification {
    /// <p>The dimensions of the metric.</p>
    #[serde(rename = "Dimensions")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub dimensions: Option<Vec<MetricDimension>>,
    /// <p>The name of the metric.</p>
    #[serde(rename = "MetricName")]
    pub metric_name: String,
    /// <p>The namespace of the metric.</p>
    #[serde(rename = "Namespace")]
    pub namespace: String,
    /// <p>The statistic of the metric.</p>
    #[serde(rename = "Statistic")]
    pub statistic: String,
    /// <p>The unit of the metric. </p>
    #[serde(rename = "Unit")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub unit: Option<String>,
}

/// <p>Represents a single value in the forecast data used for predictive scaling.</p>
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct Datapoint {
    /// <p>The time stamp for the data point in UTC format.</p>
    #[serde(rename = "Timestamp")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<f64>,
    /// <p>The value of the data point.</p>
    #[serde(rename = "Value")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<f64>,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DeleteScalingPlanRequest {
    /// <p>The name of the scaling plan.</p>
    #[serde(rename = "ScalingPlanName")]
    pub scaling_plan_name: String,
    /// <p>The version number of the scaling plan.</p>
    #[serde(rename = "ScalingPlanVersion")]
    pub scaling_plan_version: i64,
}

#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DeleteScalingPlanResponse {}

#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeScalingPlanResourcesRequest {
    /// <p>The maximum number of scalable resources to return. The value must be between 1 and 50. The default value is 50.</p>
    #[serde(rename = "MaxResults")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
    /// <p>The token for the next set of results.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
    /// <p>The name of the scaling plan.</p>
    #[serde(rename = "ScalingPlanName")]
    pub scaling_plan_name: String,
    /// <p>The version number of the scaling plan.</p>
    #[serde(rename = "ScalingPlanVersion")]
    pub scaling_plan_version: i64,
}

#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeScalingPlanResourcesResponse {
    /// <p>The token required to get the next set of results. This value is <code>null</code> if there are no more results to return.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
    /// <p>Information about the scalable resources.</p>
    #[serde(rename = "ScalingPlanResources")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scaling_plan_resources: Option<Vec<ScalingPlanResource>>,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct DescribeScalingPlansRequest {
    /// <p>The sources for the applications (up to 10). If you specify scaling plan names, you cannot specify application sources.</p>
    #[serde(rename = "ApplicationSources")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub application_sources: Option<Vec<ApplicationSource>>,
    /// <p>The maximum number of scalable resources to return. This value can be between 1 and 50. The default value is 50.</p>
    #[serde(rename = "MaxResults")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_results: Option<i64>,
    /// <p>The token for the next set of results.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
    /// <p>The names of the scaling plans (up to 10). If you specify application sources, you cannot specify scaling plan names.</p>
    #[serde(rename = "ScalingPlanNames")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scaling_plan_names: Option<Vec<String>>,
    /// <p>The version number of the scaling plan. If you specify a scaling plan version, you must also specify a scaling plan name.</p>
    #[serde(rename = "ScalingPlanVersion")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scaling_plan_version: Option<i64>,
}

#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct DescribeScalingPlansResponse {
    /// <p>The token required to get the next set of results. This value is <code>null</code> if there are no more results to return.</p>
    #[serde(rename = "NextToken")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_token: Option<String>,
    /// <p>Information about the scaling plans.</p>
    #[serde(rename = "ScalingPlans")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scaling_plans: Option<Vec<ScalingPlan>>,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct GetScalingPlanResourceForecastDataRequest {
    /// <p>The exclusive end time of the time range for the forecast data to get. The maximum time duration between the start and end time is seven days. </p> <p>Although this parameter can accept a date and time that is more than two days in the future, the availability of forecast data has limits. AWS Auto Scaling only issues forecasts for periods of two days in advance.</p>
    #[serde(rename = "EndTime")]
    pub end_time: f64,
    /// <p><p>The type of forecast data to get.</p> <ul> <li> <p> <code>LoadForecast</code>: The load metric forecast. </p> </li> <li> <p> <code>CapacityForecast</code>: The capacity forecast. </p> </li> <li> <p> <code>ScheduledActionMinCapacity</code>: The minimum capacity for each scheduled scaling action. This data is calculated as the larger of two values: the capacity forecast or the minimum capacity in the scaling instruction.</p> </li> <li> <p> <code>ScheduledActionMaxCapacity</code>: The maximum capacity for each scheduled scaling action. The calculation used is determined by the predictive scaling maximum capacity behavior setting in the scaling instruction.</p> </li> </ul></p>
    #[serde(rename = "ForecastDataType")]
    pub forecast_data_type: String,
    /// <p><p>The ID of the resource. This string consists of the resource type and unique identifier. </p> <ul> <li> <p>Auto Scaling group - The resource type is <code>autoScalingGroup</code> and the unique identifier is the name of the Auto Scaling group. Example: <code>autoScalingGroup/my-asg</code>.</p> </li> <li> <p>ECS service - The resource type is <code>service</code> and the unique identifier is the cluster name and service name. Example: <code>service/default/sample-webapp</code>.</p> </li> <li> <p>Spot Fleet request - The resource type is <code>spot-fleet-request</code> and the unique identifier is the Spot Fleet request ID. Example: <code>spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE</code>.</p> </li> <li> <p>DynamoDB table - The resource type is <code>table</code> and the unique identifier is the resource ID. Example: <code>table/my-table</code>.</p> </li> <li> <p>DynamoDB global secondary index - The resource type is <code>index</code> and the unique identifier is the resource ID. Example: <code>table/my-table/index/my-table-index</code>.</p> </li> <li> <p>Aurora DB cluster - The resource type is <code>cluster</code> and the unique identifier is the cluster name. Example: <code>cluster:my-db-cluster</code>.</p> </li> </ul></p>
    #[serde(rename = "ResourceId")]
    pub resource_id: String,
    /// <p>The scalable dimension for the resource.</p>
    #[serde(rename = "ScalableDimension")]
    pub scalable_dimension: String,
    /// <p>The name of the scaling plan.</p>
    #[serde(rename = "ScalingPlanName")]
    pub scaling_plan_name: String,
    /// <p>The version number of the scaling plan.</p>
    #[serde(rename = "ScalingPlanVersion")]
    pub scaling_plan_version: i64,
    /// <p>The namespace of the AWS service.</p>
    #[serde(rename = "ServiceNamespace")]
    pub service_namespace: String,
    /// <p>The inclusive start time of the time range for the forecast data to get. The date and time can be at most 56 days before the current date and time. </p>
    #[serde(rename = "StartTime")]
    pub start_time: f64,
}

#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct GetScalingPlanResourceForecastDataResponse {
    /// <p>The data points to return.</p>
    #[serde(rename = "Datapoints")]
    pub datapoints: Vec<Datapoint>,
}

/// <p>Represents a dimension for a customized metric.</p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MetricDimension {
    /// <p>The name of the dimension.</p>
    #[serde(rename = "Name")]
    pub name: String,
    /// <p>The value of the dimension.</p>
    #[serde(rename = "Value")]
    pub value: String,
}

/// <p>Represents a predefined metric that can be used for predictive scaling. </p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PredefinedLoadMetricSpecification {
    /// <p>The metric type.</p>
    #[serde(rename = "PredefinedLoadMetricType")]
    pub predefined_load_metric_type: String,
    /// <p><p>Identifies the resource associated with the metric type. You can&#39;t specify a resource label unless the metric type is <code>ALBRequestCountPerTarget</code> and there is a target group for an Application Load Balancer attached to the Auto Scaling group.</p> <p>The format is app/&lt;load-balancer-name&gt;/&lt;load-balancer-id&gt;/targetgroup/&lt;target-group-name&gt;/&lt;target-group-id&gt;, where:</p> <ul> <li> <p>app/&lt;load-balancer-name&gt;/&lt;load-balancer-id&gt; is the final portion of the load balancer ARN.</p> </li> <li> <p>targetgroup/&lt;target-group-name&gt;/&lt;target-group-id&gt; is the final portion of the target group ARN.</p> </li> </ul></p>
    #[serde(rename = "ResourceLabel")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub resource_label: Option<String>,
}

/// <p>Represents a predefined metric that can be used for dynamic scaling as part of a target tracking scaling policy.</p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct PredefinedScalingMetricSpecification {
    /// <p>The metric type. The <code>ALBRequestCountPerTarget</code> metric type applies only to Auto Scaling groups, Spot Fleet requests, and ECS services.</p>
    #[serde(rename = "PredefinedScalingMetricType")]
    pub predefined_scaling_metric_type: String,
    /// <p><p>Identifies the resource associated with the metric type. You can&#39;t specify a resource label unless the metric type is <code>ALBRequestCountPerTarget</code> and there is a target group for an Application Load Balancer attached to the Auto Scaling group, Spot Fleet request, or ECS service.</p> <p>The format is app/&lt;load-balancer-name&gt;/&lt;load-balancer-id&gt;/targetgroup/&lt;target-group-name&gt;/&lt;target-group-id&gt;, where:</p> <ul> <li> <p>app/&lt;load-balancer-name&gt;/&lt;load-balancer-id&gt; is the final portion of the load balancer ARN.</p> </li> <li> <p>targetgroup/&lt;target-group-name&gt;/&lt;target-group-id&gt; is the final portion of the target group ARN.</p> </li> </ul></p>
    #[serde(rename = "ResourceLabel")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub resource_label: Option<String>,
}

/// <p>Describes a scaling instruction for a scalable resource.</p> <p>The scaling instruction is used in combination with a scaling plan, which is a set of instructions for configuring dynamic scaling and predictive scaling for the scalable resources in your application. Each scaling instruction applies to one resource.</p> <p>AWS Auto Scaling creates target tracking scaling policies based on the scaling instructions. Target tracking scaling policies adjust the capacity of your scalable resource as required to maintain resource utilization at the target value that you specified. </p> <p>AWS Auto Scaling also configures predictive scaling for your Amazon EC2 Auto Scaling groups using a subset of parameters, including the load metric, the scaling metric, the target value for the scaling metric, the predictive scaling mode (forecast and scale or forecast only), and the desired behavior when the forecast capacity exceeds the maximum capacity of the resource. With predictive scaling, AWS Auto Scaling generates forecasts with traffic predictions for the two days ahead and schedules scaling actions that proactively add and remove resource capacity to match the forecast. </p> <p>For more information, see the <a href="http://docs.aws.amazon.com/autoscaling/plans/userguide/what-is-aws-auto-scaling.html">AWS Auto Scaling User Guide</a>.</p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ScalingInstruction {
    /// <p>The customized load metric to use for predictive scaling. This parameter or a <b>PredefinedLoadMetricSpecification</b> is required when configuring predictive scaling, and cannot be used otherwise. </p>
    #[serde(rename = "CustomizedLoadMetricSpecification")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customized_load_metric_specification: Option<CustomizedLoadMetricSpecification>,
    /// <p>Controls whether dynamic scaling by AWS Auto Scaling is disabled. When dynamic scaling is enabled, AWS Auto Scaling creates target tracking scaling policies based on the specified target tracking configurations. </p> <p>The default is enabled (<code>false</code>). </p>
    #[serde(rename = "DisableDynamicScaling")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disable_dynamic_scaling: Option<bool>,
    /// <p>The maximum capacity of the resource. The exception to this upper limit is if you specify a non-default setting for <b>PredictiveScalingMaxCapacityBehavior</b>. </p>
    #[serde(rename = "MaxCapacity")]
    pub max_capacity: i64,
    /// <p>The minimum capacity of the resource. </p>
    #[serde(rename = "MinCapacity")]
    pub min_capacity: i64,
    /// <p>The predefined load metric to use for predictive scaling. This parameter or a <b>CustomizedLoadMetricSpecification</b> is required when configuring predictive scaling, and cannot be used otherwise. </p>
    #[serde(rename = "PredefinedLoadMetricSpecification")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub predefined_load_metric_specification: Option<PredefinedLoadMetricSpecification>,
    /// <p>Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity specified for the resource. The default value is <code>SetForecastCapacityToMaxCapacity</code>.</p> <p>The following are possible values:</p> <ul> <li> <p> <code>SetForecastCapacityToMaxCapacity</code> - AWS Auto Scaling cannot scale resource capacity higher than the maximum capacity. The maximum capacity is enforced as a hard limit. </p> </li> <li> <p> <code>SetMaxCapacityToForecastCapacity</code> - AWS Auto Scaling may scale resource capacity higher than the maximum capacity to equal but not exceed forecast capacity.</p> </li> <li> <p> <code>SetMaxCapacityAboveForecastCapacity</code> - AWS Auto Scaling may scale resource capacity higher than the maximum capacity by a specified buffer value. The intention is to give the target tracking scaling policy extra capacity if unexpected traffic occurs. </p> </li> </ul> <p>Only valid when configuring predictive scaling.</p>
    #[serde(rename = "PredictiveScalingMaxCapacityBehavior")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub predictive_scaling_max_capacity_behavior: Option<String>,
    /// <p>The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity. The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer, such that if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55.</p> <p>Only valid when configuring predictive scaling. Required if the <b>PredictiveScalingMaxCapacityBehavior</b> is set to <code>SetMaxCapacityAboveForecastCapacity</code>, and cannot be used otherwise.</p> <p>The range is 1-100.</p>
    #[serde(rename = "PredictiveScalingMaxCapacityBuffer")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub predictive_scaling_max_capacity_buffer: Option<i64>,
    /// <p>The predictive scaling mode. The default value is <code>ForecastAndScale</code>. Otherwise, AWS Auto Scaling forecasts capacity but does not create any scheduled scaling actions based on the capacity forecast. </p>
    #[serde(rename = "PredictiveScalingMode")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub predictive_scaling_mode: Option<String>,
    /// <p><p>The ID of the resource. This string consists of the resource type and unique identifier.</p> <ul> <li> <p>Auto Scaling group - The resource type is <code>autoScalingGroup</code> and the unique identifier is the name of the Auto Scaling group. Example: <code>autoScalingGroup/my-asg</code>.</p> </li> <li> <p>ECS service - The resource type is <code>service</code> and the unique identifier is the cluster name and service name. Example: <code>service/default/sample-webapp</code>.</p> </li> <li> <p>Spot Fleet request - The resource type is <code>spot-fleet-request</code> and the unique identifier is the Spot Fleet request ID. Example: <code>spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE</code>.</p> </li> <li> <p>DynamoDB table - The resource type is <code>table</code> and the unique identifier is the resource ID. Example: <code>table/my-table</code>.</p> </li> <li> <p>DynamoDB global secondary index - The resource type is <code>index</code> and the unique identifier is the resource ID. Example: <code>table/my-table/index/my-table-index</code>.</p> </li> <li> <p>Aurora DB cluster - The resource type is <code>cluster</code> and the unique identifier is the cluster name. Example: <code>cluster:my-db-cluster</code>.</p> </li> </ul></p>
    #[serde(rename = "ResourceId")]
    pub resource_id: String,
    /// <p><p>The scalable dimension associated with the resource.</p> <ul> <li> <p> <code>autoscaling:autoScalingGroup:DesiredCapacity</code> - The desired capacity of an Auto Scaling group.</p> </li> <li> <p> <code>ecs:service:DesiredCount</code> - The desired task count of an ECS service.</p> </li> <li> <p> <code>ec2:spot-fleet-request:TargetCapacity</code> - The target capacity of a Spot Fleet request.</p> </li> <li> <p> <code>dynamodb:table:ReadCapacityUnits</code> - The provisioned read capacity for a DynamoDB table.</p> </li> <li> <p> <code>dynamodb:table:WriteCapacityUnits</code> - The provisioned write capacity for a DynamoDB table.</p> </li> <li> <p> <code>dynamodb:index:ReadCapacityUnits</code> - The provisioned read capacity for a DynamoDB global secondary index.</p> </li> <li> <p> <code>dynamodb:index:WriteCapacityUnits</code> - The provisioned write capacity for a DynamoDB global secondary index.</p> </li> <li> <p> <code>rds:cluster:ReadReplicaCount</code> - The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition.</p> </li> </ul></p>
    #[serde(rename = "ScalableDimension")]
    pub scalable_dimension: String,
    /// <p>Controls whether a resource's externally created scaling policies are kept or replaced. </p> <p>The default value is <code>KeepExternalPolicies</code>. If the parameter is set to <code>ReplaceExternalPolicies</code>, any scaling policies that are external to AWS Auto Scaling are deleted and new target tracking scaling policies created. </p> <p>Only valid when configuring dynamic scaling. </p> <p>Condition: The number of existing policies to be replaced must be less than or equal to 50. If there are more than 50 policies to be replaced, AWS Auto Scaling keeps all existing policies and does not create new ones.</p>
    #[serde(rename = "ScalingPolicyUpdateBehavior")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scaling_policy_update_behavior: Option<String>,
    /// <p>The amount of time, in seconds, to buffer the run time of scheduled scaling actions when scaling out. For example, if the forecast says to add capacity at 10:00 AM, and the buffer time is 5 minutes, then the run time of the corresponding scheduled scaling action will be 9:55 AM. The intention is to give resources time to be provisioned. For example, it can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete. </p> <p>The value must be less than the forecast interval duration of 3600 seconds (60 minutes). The default is 300 seconds. </p> <p>Only valid when configuring predictive scaling. </p>
    #[serde(rename = "ScheduledActionBufferTime")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scheduled_action_buffer_time: Option<i64>,
    /// <p>The namespace of the AWS service.</p>
    #[serde(rename = "ServiceNamespace")]
    pub service_namespace: String,
    /// <p>The structure that defines new target tracking configurations (up to 10). Each of these structures includes a specific scaling metric and a target value for the metric, along with various parameters to use with dynamic scaling. </p> <p>With predictive scaling and dynamic scaling, the resource scales based on the target tracking configuration that provides the largest capacity for both scale in and scale out. </p> <p>Condition: The scaling metric must be unique across target tracking configurations.</p>
    #[serde(rename = "TargetTrackingConfigurations")]
    pub target_tracking_configurations: Vec<TargetTrackingConfiguration>,
}

/// <p>Represents a scaling plan.</p>
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ScalingPlan {
    /// <p>The application source.</p>
    #[serde(rename = "ApplicationSource")]
    pub application_source: ApplicationSource,
    /// <p>The Unix time stamp when the scaling plan was created.</p>
    #[serde(rename = "CreationTime")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub creation_time: Option<f64>,
    /// <p>The scaling instructions.</p>
    #[serde(rename = "ScalingInstructions")]
    pub scaling_instructions: Vec<ScalingInstruction>,
    /// <p>The name of the scaling plan.</p>
    #[serde(rename = "ScalingPlanName")]
    pub scaling_plan_name: String,
    /// <p>The version number of the scaling plan.</p>
    #[serde(rename = "ScalingPlanVersion")]
    pub scaling_plan_version: i64,
    /// <p><p>The status of the scaling plan.</p> <ul> <li> <p> <code>Active</code> - The scaling plan is active.</p> </li> <li> <p> <code>ActiveWithProblems</code> - The scaling plan is active, but the scaling configuration for one or more resources could not be applied.</p> </li> <li> <p> <code>CreationInProgress</code> - The scaling plan is being created.</p> </li> <li> <p> <code>CreationFailed</code> - The scaling plan could not be created.</p> </li> <li> <p> <code>DeletionInProgress</code> - The scaling plan is being deleted.</p> </li> <li> <p> <code>DeletionFailed</code> - The scaling plan could not be deleted.</p> </li> <li> <p> <code>UpdateInProgress</code> - The scaling plan is being updated.</p> </li> <li> <p> <code>UpdateFailed</code> - The scaling plan could not be updated.</p> </li> </ul></p>
    #[serde(rename = "StatusCode")]
    pub status_code: String,
    /// <p>A simple message about the current status of the scaling plan.</p>
    #[serde(rename = "StatusMessage")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status_message: Option<String>,
    /// <p>The Unix time stamp when the scaling plan entered the current status.</p>
    #[serde(rename = "StatusStartTime")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status_start_time: Option<f64>,
}

/// <p>Represents a scalable resource.</p>
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ScalingPlanResource {
    /// <p><p>The ID of the resource. This string consists of the resource type and unique identifier.</p> <ul> <li> <p>Auto Scaling group - The resource type is <code>autoScalingGroup</code> and the unique identifier is the name of the Auto Scaling group. Example: <code>autoScalingGroup/my-asg</code>.</p> </li> <li> <p>ECS service - The resource type is <code>service</code> and the unique identifier is the cluster name and service name. Example: <code>service/default/sample-webapp</code>.</p> </li> <li> <p>Spot Fleet request - The resource type is <code>spot-fleet-request</code> and the unique identifier is the Spot Fleet request ID. Example: <code>spot-fleet-request/sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE</code>.</p> </li> <li> <p>DynamoDB table - The resource type is <code>table</code> and the unique identifier is the resource ID. Example: <code>table/my-table</code>.</p> </li> <li> <p>DynamoDB global secondary index - The resource type is <code>index</code> and the unique identifier is the resource ID. Example: <code>table/my-table/index/my-table-index</code>.</p> </li> <li> <p>Aurora DB cluster - The resource type is <code>cluster</code> and the unique identifier is the cluster name. Example: <code>cluster:my-db-cluster</code>.</p> </li> </ul></p>
    #[serde(rename = "ResourceId")]
    pub resource_id: String,
    /// <p><p>The scalable dimension for the resource.</p> <ul> <li> <p> <code>autoscaling:autoScalingGroup:DesiredCapacity</code> - The desired capacity of an Auto Scaling group.</p> </li> <li> <p> <code>ecs:service:DesiredCount</code> - The desired task count of an ECS service.</p> </li> <li> <p> <code>ec2:spot-fleet-request:TargetCapacity</code> - The target capacity of a Spot Fleet request.</p> </li> <li> <p> <code>dynamodb:table:ReadCapacityUnits</code> - The provisioned read capacity for a DynamoDB table.</p> </li> <li> <p> <code>dynamodb:table:WriteCapacityUnits</code> - The provisioned write capacity for a DynamoDB table.</p> </li> <li> <p> <code>dynamodb:index:ReadCapacityUnits</code> - The provisioned read capacity for a DynamoDB global secondary index.</p> </li> <li> <p> <code>dynamodb:index:WriteCapacityUnits</code> - The provisioned write capacity for a DynamoDB global secondary index.</p> </li> <li> <p> <code>rds:cluster:ReadReplicaCount</code> - The count of Aurora Replicas in an Aurora DB cluster. Available for Aurora MySQL-compatible edition.</p> </li> </ul></p>
    #[serde(rename = "ScalableDimension")]
    pub scalable_dimension: String,
    /// <p>The name of the scaling plan.</p>
    #[serde(rename = "ScalingPlanName")]
    pub scaling_plan_name: String,
    /// <p>The version number of the scaling plan.</p>
    #[serde(rename = "ScalingPlanVersion")]
    pub scaling_plan_version: i64,
    /// <p>The scaling policies.</p>
    #[serde(rename = "ScalingPolicies")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scaling_policies: Option<Vec<ScalingPolicy>>,
    /// <p><p>The scaling status of the resource.</p> <ul> <li> <p> <code>Active</code> - The scaling configuration is active.</p> </li> <li> <p> <code>Inactive</code> - The scaling configuration is not active because the scaling plan is being created or the scaling configuration could not be applied. Check the status message for more information.</p> </li> <li> <p> <code>PartiallyActive</code> - The scaling configuration is partially active because the scaling plan is being created or deleted or the scaling configuration could not be fully applied. Check the status message for more information.</p> </li> </ul></p>
    #[serde(rename = "ScalingStatusCode")]
    pub scaling_status_code: String,
    /// <p>A simple message about the current scaling status of the resource.</p>
    #[serde(rename = "ScalingStatusMessage")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scaling_status_message: Option<String>,
    /// <p>The namespace of the AWS service.</p>
    #[serde(rename = "ServiceNamespace")]
    pub service_namespace: String,
}

/// <p>Represents a scaling policy.</p>
#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct ScalingPolicy {
    /// <p>The name of the scaling policy.</p>
    #[serde(rename = "PolicyName")]
    pub policy_name: String,
    /// <p>The type of scaling policy.</p>
    #[serde(rename = "PolicyType")]
    pub policy_type: String,
    /// <p>The target tracking scaling policy. </p>
    #[serde(rename = "TargetTrackingConfiguration")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub target_tracking_configuration: Option<TargetTrackingConfiguration>,
}

/// <p>Represents a tag.</p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TagFilter {
    /// <p>The tag key.</p>
    #[serde(rename = "Key")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    /// <p>The tag values (0 to 20).</p>
    #[serde(rename = "Values")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub values: Option<Vec<String>>,
}

/// <p>Describes a target tracking configuration. Used with <a>ScalingInstruction</a> and <a>ScalingPolicy</a>.</p>
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TargetTrackingConfiguration {
    /// <p>A customized metric.</p>
    #[serde(rename = "CustomizedScalingMetricSpecification")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub customized_scaling_metric_specification: Option<CustomizedScalingMetricSpecification>,
    /// <p>Indicates whether scale in by the target tracking scaling policy is disabled. If the value is <code>true</code>, scale in is disabled and the target tracking scaling policy doesn't remove capacity from the scalable resource. Otherwise, scale in is enabled and the target tracking scaling policy can remove capacity from the scalable resource. </p> <p>The default value is <code>false</code>.</p>
    #[serde(rename = "DisableScaleIn")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disable_scale_in: Option<bool>,
    /// <p>The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This value is used only if the resource is an Auto Scaling group.</p>
    #[serde(rename = "EstimatedInstanceWarmup")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub estimated_instance_warmup: Option<i64>,
    /// <p>A predefined metric.</p>
    #[serde(rename = "PredefinedScalingMetricSpecification")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub predefined_scaling_metric_specification: Option<PredefinedScalingMetricSpecification>,
    /// <p>The amount of time, in seconds, after a scale in activity completes before another scale in activity can start. This value is not used if the scalable resource is an Auto Scaling group.</p> <p>The cooldown period is used to block subsequent scale in requests until it has expired. The intention is to scale in conservatively to protect your application's availability. However, if another alarm triggers a scale-out policy during the cooldown period after a scale-in, AWS Auto Scaling scales out your scalable target immediately.</p>
    #[serde(rename = "ScaleInCooldown")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scale_in_cooldown: Option<i64>,
    /// <p>The amount of time, in seconds, after a scale-out activity completes before another scale-out activity can start. This value is not used if the scalable resource is an Auto Scaling group.</p> <p>While the cooldown period is in effect, the capacity that has been added by the previous scale-out event that initiated the cooldown is calculated as part of the desired capacity for the next scale out. The intention is to continuously (but not excessively) scale out.</p>
    #[serde(rename = "ScaleOutCooldown")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scale_out_cooldown: Option<i64>,
    /// <p>The target value for the metric. The range is 8.515920e-109 to 1.174271e+108 (Base 10) or 2e-360 to 2e360 (Base 2).</p>
    #[serde(rename = "TargetValue")]
    pub target_value: f64,
}

#[derive(Default, Debug, Clone, PartialEq, Serialize)]
pub struct UpdateScalingPlanRequest {
    /// <p>A CloudFormation stack or set of tags.</p>
    #[serde(rename = "ApplicationSource")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub application_source: Option<ApplicationSource>,
    /// <p>The scaling instructions.</p>
    #[serde(rename = "ScalingInstructions")]
    #[serde(skip_serializing_if = "Option::is_none")]
    pub scaling_instructions: Option<Vec<ScalingInstruction>>,
    /// <p>The name of the scaling plan.</p>
    #[serde(rename = "ScalingPlanName")]
    pub scaling_plan_name: String,
    /// <p>The version number of the scaling plan.</p>
    #[serde(rename = "ScalingPlanVersion")]
    pub scaling_plan_version: i64,
}

#[derive(Default, Debug, Clone, PartialEq, Deserialize)]
#[cfg_attr(test, derive(Serialize))]
pub struct UpdateScalingPlanResponse {}

/// Errors returned by CreateScalingPlan
#[derive(Debug, PartialEq)]
pub enum CreateScalingPlanError {
    /// <p>Concurrent updates caused an exception, for example, if you request an update to a scaling plan that already has a pending update.</p>
    ConcurrentUpdate(String),
    /// <p>The service encountered an internal error.</p>
    InternalService(String),
    /// <p>Your account exceeded a limit. This exception is thrown when a per-account resource limit is exceeded.</p>
    LimitExceeded(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An error occurred parsing the response payload.
    ParseError(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(BufferedHttpResponse),
}

impl CreateScalingPlanError {
    pub fn from_response(res: BufferedHttpResponse) -> CreateScalingPlanError {
        if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
            let raw_error_type = json
                .get("__type")
                .and_then(|e| e.as_str())
                .unwrap_or("Unknown");
            let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");

            let pieces: Vec<&str> = raw_error_type.split("#").collect();
            let error_type = pieces.last().expect("Expected error type");

            match *error_type {
                "ConcurrentUpdateException" => {
                    return CreateScalingPlanError::ConcurrentUpdate(String::from(error_message));
                }
                "InternalServiceException" => {
                    return CreateScalingPlanError::InternalService(String::from(error_message));
                }
                "LimitExceededException" => {
                    return CreateScalingPlanError::LimitExceeded(String::from(error_message));
                }
                "ValidationException" => {
                    return CreateScalingPlanError::Validation(error_message.to_string());
                }
                _ => {}
            }
        }
        return CreateScalingPlanError::Unknown(res);
    }
}

impl From<serde_json::error::Error> for CreateScalingPlanError {
    fn from(err: serde_json::error::Error) -> CreateScalingPlanError {
        CreateScalingPlanError::ParseError(err.description().to_string())
    }
}
impl From<CredentialsError> for CreateScalingPlanError {
    fn from(err: CredentialsError) -> CreateScalingPlanError {
        CreateScalingPlanError::Credentials(err)
    }
}
impl From<HttpDispatchError> for CreateScalingPlanError {
    fn from(err: HttpDispatchError) -> CreateScalingPlanError {
        CreateScalingPlanError::HttpDispatch(err)
    }
}
impl From<io::Error> for CreateScalingPlanError {
    fn from(err: io::Error) -> CreateScalingPlanError {
        CreateScalingPlanError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for CreateScalingPlanError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for CreateScalingPlanError {
    fn description(&self) -> &str {
        match *self {
            CreateScalingPlanError::ConcurrentUpdate(ref cause) => cause,
            CreateScalingPlanError::InternalService(ref cause) => cause,
            CreateScalingPlanError::LimitExceeded(ref cause) => cause,
            CreateScalingPlanError::Validation(ref cause) => cause,
            CreateScalingPlanError::Credentials(ref err) => err.description(),
            CreateScalingPlanError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            CreateScalingPlanError::ParseError(ref cause) => cause,
            CreateScalingPlanError::Unknown(_) => "unknown error",
        }
    }
}
/// Errors returned by DeleteScalingPlan
#[derive(Debug, PartialEq)]
pub enum DeleteScalingPlanError {
    /// <p>Concurrent updates caused an exception, for example, if you request an update to a scaling plan that already has a pending update.</p>
    ConcurrentUpdate(String),
    /// <p>The service encountered an internal error.</p>
    InternalService(String),
    /// <p>The specified object could not be found.</p>
    ObjectNotFound(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An error occurred parsing the response payload.
    ParseError(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(BufferedHttpResponse),
}

impl DeleteScalingPlanError {
    pub fn from_response(res: BufferedHttpResponse) -> DeleteScalingPlanError {
        if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
            let raw_error_type = json
                .get("__type")
                .and_then(|e| e.as_str())
                .unwrap_or("Unknown");
            let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");

            let pieces: Vec<&str> = raw_error_type.split("#").collect();
            let error_type = pieces.last().expect("Expected error type");

            match *error_type {
                "ConcurrentUpdateException" => {
                    return DeleteScalingPlanError::ConcurrentUpdate(String::from(error_message));
                }
                "InternalServiceException" => {
                    return DeleteScalingPlanError::InternalService(String::from(error_message));
                }
                "ObjectNotFoundException" => {
                    return DeleteScalingPlanError::ObjectNotFound(String::from(error_message));
                }
                "ValidationException" => {
                    return DeleteScalingPlanError::Validation(error_message.to_string());
                }
                _ => {}
            }
        }
        return DeleteScalingPlanError::Unknown(res);
    }
}

impl From<serde_json::error::Error> for DeleteScalingPlanError {
    fn from(err: serde_json::error::Error) -> DeleteScalingPlanError {
        DeleteScalingPlanError::ParseError(err.description().to_string())
    }
}
impl From<CredentialsError> for DeleteScalingPlanError {
    fn from(err: CredentialsError) -> DeleteScalingPlanError {
        DeleteScalingPlanError::Credentials(err)
    }
}
impl From<HttpDispatchError> for DeleteScalingPlanError {
    fn from(err: HttpDispatchError) -> DeleteScalingPlanError {
        DeleteScalingPlanError::HttpDispatch(err)
    }
}
impl From<io::Error> for DeleteScalingPlanError {
    fn from(err: io::Error) -> DeleteScalingPlanError {
        DeleteScalingPlanError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for DeleteScalingPlanError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for DeleteScalingPlanError {
    fn description(&self) -> &str {
        match *self {
            DeleteScalingPlanError::ConcurrentUpdate(ref cause) => cause,
            DeleteScalingPlanError::InternalService(ref cause) => cause,
            DeleteScalingPlanError::ObjectNotFound(ref cause) => cause,
            DeleteScalingPlanError::Validation(ref cause) => cause,
            DeleteScalingPlanError::Credentials(ref err) => err.description(),
            DeleteScalingPlanError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            DeleteScalingPlanError::ParseError(ref cause) => cause,
            DeleteScalingPlanError::Unknown(_) => "unknown error",
        }
    }
}
/// Errors returned by DescribeScalingPlanResources
#[derive(Debug, PartialEq)]
pub enum DescribeScalingPlanResourcesError {
    /// <p>Concurrent updates caused an exception, for example, if you request an update to a scaling plan that already has a pending update.</p>
    ConcurrentUpdate(String),
    /// <p>The service encountered an internal error.</p>
    InternalService(String),
    /// <p>The token provided is not valid.</p>
    InvalidNextToken(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An error occurred parsing the response payload.
    ParseError(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(BufferedHttpResponse),
}

impl DescribeScalingPlanResourcesError {
    pub fn from_response(res: BufferedHttpResponse) -> DescribeScalingPlanResourcesError {
        if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
            let raw_error_type = json
                .get("__type")
                .and_then(|e| e.as_str())
                .unwrap_or("Unknown");
            let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");

            let pieces: Vec<&str> = raw_error_type.split("#").collect();
            let error_type = pieces.last().expect("Expected error type");

            match *error_type {
                "ConcurrentUpdateException" => {
                    return DescribeScalingPlanResourcesError::ConcurrentUpdate(String::from(
                        error_message,
                    ));
                }
                "InternalServiceException" => {
                    return DescribeScalingPlanResourcesError::InternalService(String::from(
                        error_message,
                    ));
                }
                "InvalidNextTokenException" => {
                    return DescribeScalingPlanResourcesError::InvalidNextToken(String::from(
                        error_message,
                    ));
                }
                "ValidationException" => {
                    return DescribeScalingPlanResourcesError::Validation(error_message.to_string());
                }
                _ => {}
            }
        }
        return DescribeScalingPlanResourcesError::Unknown(res);
    }
}

impl From<serde_json::error::Error> for DescribeScalingPlanResourcesError {
    fn from(err: serde_json::error::Error) -> DescribeScalingPlanResourcesError {
        DescribeScalingPlanResourcesError::ParseError(err.description().to_string())
    }
}
impl From<CredentialsError> for DescribeScalingPlanResourcesError {
    fn from(err: CredentialsError) -> DescribeScalingPlanResourcesError {
        DescribeScalingPlanResourcesError::Credentials(err)
    }
}
impl From<HttpDispatchError> for DescribeScalingPlanResourcesError {
    fn from(err: HttpDispatchError) -> DescribeScalingPlanResourcesError {
        DescribeScalingPlanResourcesError::HttpDispatch(err)
    }
}
impl From<io::Error> for DescribeScalingPlanResourcesError {
    fn from(err: io::Error) -> DescribeScalingPlanResourcesError {
        DescribeScalingPlanResourcesError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for DescribeScalingPlanResourcesError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for DescribeScalingPlanResourcesError {
    fn description(&self) -> &str {
        match *self {
            DescribeScalingPlanResourcesError::ConcurrentUpdate(ref cause) => cause,
            DescribeScalingPlanResourcesError::InternalService(ref cause) => cause,
            DescribeScalingPlanResourcesError::InvalidNextToken(ref cause) => cause,
            DescribeScalingPlanResourcesError::Validation(ref cause) => cause,
            DescribeScalingPlanResourcesError::Credentials(ref err) => err.description(),
            DescribeScalingPlanResourcesError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            DescribeScalingPlanResourcesError::ParseError(ref cause) => cause,
            DescribeScalingPlanResourcesError::Unknown(_) => "unknown error",
        }
    }
}
/// Errors returned by DescribeScalingPlans
#[derive(Debug, PartialEq)]
pub enum DescribeScalingPlansError {
    /// <p>Concurrent updates caused an exception, for example, if you request an update to a scaling plan that already has a pending update.</p>
    ConcurrentUpdate(String),
    /// <p>The service encountered an internal error.</p>
    InternalService(String),
    /// <p>The token provided is not valid.</p>
    InvalidNextToken(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An error occurred parsing the response payload.
    ParseError(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(BufferedHttpResponse),
}

impl DescribeScalingPlansError {
    pub fn from_response(res: BufferedHttpResponse) -> DescribeScalingPlansError {
        if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
            let raw_error_type = json
                .get("__type")
                .and_then(|e| e.as_str())
                .unwrap_or("Unknown");
            let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");

            let pieces: Vec<&str> = raw_error_type.split("#").collect();
            let error_type = pieces.last().expect("Expected error type");

            match *error_type {
                "ConcurrentUpdateException" => {
                    return DescribeScalingPlansError::ConcurrentUpdate(String::from(error_message));
                }
                "InternalServiceException" => {
                    return DescribeScalingPlansError::InternalService(String::from(error_message));
                }
                "InvalidNextTokenException" => {
                    return DescribeScalingPlansError::InvalidNextToken(String::from(error_message));
                }
                "ValidationException" => {
                    return DescribeScalingPlansError::Validation(error_message.to_string());
                }
                _ => {}
            }
        }
        return DescribeScalingPlansError::Unknown(res);
    }
}

impl From<serde_json::error::Error> for DescribeScalingPlansError {
    fn from(err: serde_json::error::Error) -> DescribeScalingPlansError {
        DescribeScalingPlansError::ParseError(err.description().to_string())
    }
}
impl From<CredentialsError> for DescribeScalingPlansError {
    fn from(err: CredentialsError) -> DescribeScalingPlansError {
        DescribeScalingPlansError::Credentials(err)
    }
}
impl From<HttpDispatchError> for DescribeScalingPlansError {
    fn from(err: HttpDispatchError) -> DescribeScalingPlansError {
        DescribeScalingPlansError::HttpDispatch(err)
    }
}
impl From<io::Error> for DescribeScalingPlansError {
    fn from(err: io::Error) -> DescribeScalingPlansError {
        DescribeScalingPlansError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for DescribeScalingPlansError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for DescribeScalingPlansError {
    fn description(&self) -> &str {
        match *self {
            DescribeScalingPlansError::ConcurrentUpdate(ref cause) => cause,
            DescribeScalingPlansError::InternalService(ref cause) => cause,
            DescribeScalingPlansError::InvalidNextToken(ref cause) => cause,
            DescribeScalingPlansError::Validation(ref cause) => cause,
            DescribeScalingPlansError::Credentials(ref err) => err.description(),
            DescribeScalingPlansError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            DescribeScalingPlansError::ParseError(ref cause) => cause,
            DescribeScalingPlansError::Unknown(_) => "unknown error",
        }
    }
}
/// Errors returned by GetScalingPlanResourceForecastData
#[derive(Debug, PartialEq)]
pub enum GetScalingPlanResourceForecastDataError {
    /// <p>The service encountered an internal error.</p>
    InternalService(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An error occurred parsing the response payload.
    ParseError(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(BufferedHttpResponse),
}

impl GetScalingPlanResourceForecastDataError {
    pub fn from_response(res: BufferedHttpResponse) -> GetScalingPlanResourceForecastDataError {
        if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
            let raw_error_type = json
                .get("__type")
                .and_then(|e| e.as_str())
                .unwrap_or("Unknown");
            let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");

            let pieces: Vec<&str> = raw_error_type.split("#").collect();
            let error_type = pieces.last().expect("Expected error type");

            match *error_type {
                "InternalServiceException" => {
                    return GetScalingPlanResourceForecastDataError::InternalService(String::from(
                        error_message,
                    ));
                }
                "ValidationException" => {
                    return GetScalingPlanResourceForecastDataError::Validation(
                        error_message.to_string(),
                    );
                }
                _ => {}
            }
        }
        return GetScalingPlanResourceForecastDataError::Unknown(res);
    }
}

impl From<serde_json::error::Error> for GetScalingPlanResourceForecastDataError {
    fn from(err: serde_json::error::Error) -> GetScalingPlanResourceForecastDataError {
        GetScalingPlanResourceForecastDataError::ParseError(err.description().to_string())
    }
}
impl From<CredentialsError> for GetScalingPlanResourceForecastDataError {
    fn from(err: CredentialsError) -> GetScalingPlanResourceForecastDataError {
        GetScalingPlanResourceForecastDataError::Credentials(err)
    }
}
impl From<HttpDispatchError> for GetScalingPlanResourceForecastDataError {
    fn from(err: HttpDispatchError) -> GetScalingPlanResourceForecastDataError {
        GetScalingPlanResourceForecastDataError::HttpDispatch(err)
    }
}
impl From<io::Error> for GetScalingPlanResourceForecastDataError {
    fn from(err: io::Error) -> GetScalingPlanResourceForecastDataError {
        GetScalingPlanResourceForecastDataError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for GetScalingPlanResourceForecastDataError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for GetScalingPlanResourceForecastDataError {
    fn description(&self) -> &str {
        match *self {
            GetScalingPlanResourceForecastDataError::InternalService(ref cause) => cause,
            GetScalingPlanResourceForecastDataError::Validation(ref cause) => cause,
            GetScalingPlanResourceForecastDataError::Credentials(ref err) => err.description(),
            GetScalingPlanResourceForecastDataError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            GetScalingPlanResourceForecastDataError::ParseError(ref cause) => cause,
            GetScalingPlanResourceForecastDataError::Unknown(_) => "unknown error",
        }
    }
}
/// Errors returned by UpdateScalingPlan
#[derive(Debug, PartialEq)]
pub enum UpdateScalingPlanError {
    /// <p>Concurrent updates caused an exception, for example, if you request an update to a scaling plan that already has a pending update.</p>
    ConcurrentUpdate(String),
    /// <p>The service encountered an internal error.</p>
    InternalService(String),
    /// <p>The specified object could not be found.</p>
    ObjectNotFound(String),
    /// An error occurred dispatching the HTTP request
    HttpDispatch(HttpDispatchError),
    /// An error was encountered with AWS credentials.
    Credentials(CredentialsError),
    /// A validation error occurred.  Details from AWS are provided.
    Validation(String),
    /// An error occurred parsing the response payload.
    ParseError(String),
    /// An unknown error occurred.  The raw HTTP response is provided.
    Unknown(BufferedHttpResponse),
}

impl UpdateScalingPlanError {
    pub fn from_response(res: BufferedHttpResponse) -> UpdateScalingPlanError {
        if let Ok(json) = from_slice::<SerdeJsonValue>(&res.body) {
            let raw_error_type = json
                .get("__type")
                .and_then(|e| e.as_str())
                .unwrap_or("Unknown");
            let error_message = json.get("message").and_then(|m| m.as_str()).unwrap_or("");

            let pieces: Vec<&str> = raw_error_type.split("#").collect();
            let error_type = pieces.last().expect("Expected error type");

            match *error_type {
                "ConcurrentUpdateException" => {
                    return UpdateScalingPlanError::ConcurrentUpdate(String::from(error_message));
                }
                "InternalServiceException" => {
                    return UpdateScalingPlanError::InternalService(String::from(error_message));
                }
                "ObjectNotFoundException" => {
                    return UpdateScalingPlanError::ObjectNotFound(String::from(error_message));
                }
                "ValidationException" => {
                    return UpdateScalingPlanError::Validation(error_message.to_string());
                }
                _ => {}
            }
        }
        return UpdateScalingPlanError::Unknown(res);
    }
}

impl From<serde_json::error::Error> for UpdateScalingPlanError {
    fn from(err: serde_json::error::Error) -> UpdateScalingPlanError {
        UpdateScalingPlanError::ParseError(err.description().to_string())
    }
}
impl From<CredentialsError> for UpdateScalingPlanError {
    fn from(err: CredentialsError) -> UpdateScalingPlanError {
        UpdateScalingPlanError::Credentials(err)
    }
}
impl From<HttpDispatchError> for UpdateScalingPlanError {
    fn from(err: HttpDispatchError) -> UpdateScalingPlanError {
        UpdateScalingPlanError::HttpDispatch(err)
    }
}
impl From<io::Error> for UpdateScalingPlanError {
    fn from(err: io::Error) -> UpdateScalingPlanError {
        UpdateScalingPlanError::HttpDispatch(HttpDispatchError::from(err))
    }
}
impl fmt::Display for UpdateScalingPlanError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.description())
    }
}
impl Error for UpdateScalingPlanError {
    fn description(&self) -> &str {
        match *self {
            UpdateScalingPlanError::ConcurrentUpdate(ref cause) => cause,
            UpdateScalingPlanError::InternalService(ref cause) => cause,
            UpdateScalingPlanError::ObjectNotFound(ref cause) => cause,
            UpdateScalingPlanError::Validation(ref cause) => cause,
            UpdateScalingPlanError::Credentials(ref err) => err.description(),
            UpdateScalingPlanError::HttpDispatch(ref dispatch_error) => {
                dispatch_error.description()
            }
            UpdateScalingPlanError::ParseError(ref cause) => cause,
            UpdateScalingPlanError::Unknown(_) => "unknown error",
        }
    }
}
/// Trait representing the capabilities of the AWS Auto Scaling Plans API. AWS Auto Scaling Plans clients implement this trait.
pub trait AutoscalingPlans {
    /// <p>Creates a scaling plan.</p>
    fn create_scaling_plan(
        &self,
        input: CreateScalingPlanRequest,
    ) -> RusotoFuture<CreateScalingPlanResponse, CreateScalingPlanError>;

    /// <p>Deletes the specified scaling plan.</p> <p>Deleting a scaling plan deletes the underlying <a>ScalingInstruction</a> for all of the scalable resources that are covered by the plan.</p> <p>If the plan has launched resources or has scaling activities in progress, you must delete those resources separately.</p>
    fn delete_scaling_plan(
        &self,
        input: DeleteScalingPlanRequest,
    ) -> RusotoFuture<DeleteScalingPlanResponse, DeleteScalingPlanError>;

    /// <p>Describes the scalable resources in the specified scaling plan.</p>
    fn describe_scaling_plan_resources(
        &self,
        input: DescribeScalingPlanResourcesRequest,
    ) -> RusotoFuture<DescribeScalingPlanResourcesResponse, DescribeScalingPlanResourcesError>;

    /// <p>Describes one or more of your scaling plans.</p>
    fn describe_scaling_plans(
        &self,
        input: DescribeScalingPlansRequest,
    ) -> RusotoFuture<DescribeScalingPlansResponse, DescribeScalingPlansError>;

    /// <p>Retrieves the forecast data for a scalable resource.</p> <p>Capacity forecasts are represented as predicted values, or data points, that are calculated using historical data points from a specified CloudWatch load metric. Data points are available for up to 56 days. </p>
    fn get_scaling_plan_resource_forecast_data(
        &self,
        input: GetScalingPlanResourceForecastDataRequest,
    ) -> RusotoFuture<
        GetScalingPlanResourceForecastDataResponse,
        GetScalingPlanResourceForecastDataError,
    >;

    /// <p>Updates the specified scaling plan.</p> <p>You cannot update a scaling plan if it is in the process of being created, updated, or deleted.</p>
    fn update_scaling_plan(
        &self,
        input: UpdateScalingPlanRequest,
    ) -> RusotoFuture<UpdateScalingPlanResponse, UpdateScalingPlanError>;
}
/// A client for the AWS Auto Scaling Plans API.
#[derive(Clone)]
pub struct AutoscalingPlansClient {
    client: Client,
    region: region::Region,
}

impl AutoscalingPlansClient {
    /// Creates a client backed by the default tokio event loop.
    ///
    /// The client will use the default credentials provider and tls client.
    pub fn new(region: region::Region) -> AutoscalingPlansClient {
        AutoscalingPlansClient {
            client: Client::shared(),
            region: region,
        }
    }

    pub fn new_with<P, D>(
        request_dispatcher: D,
        credentials_provider: P,
        region: region::Region,
    ) -> AutoscalingPlansClient
    where
        P: ProvideAwsCredentials + Send + Sync + 'static,
        P::Future: Send,
        D: DispatchSignedRequest + Send + Sync + 'static,
        D::Future: Send,
    {
        AutoscalingPlansClient {
            client: Client::new_with(credentials_provider, request_dispatcher),
            region: region,
        }
    }
}

impl AutoscalingPlans for AutoscalingPlansClient {
    /// <p>Creates a scaling plan.</p>
    fn create_scaling_plan(
        &self,
        input: CreateScalingPlanRequest,
    ) -> RusotoFuture<CreateScalingPlanResponse, CreateScalingPlanError> {
        let mut request = SignedRequest::new("POST", "autoscaling-plans", &self.region, "/");
        request.set_endpoint_prefix("autoscaling".to_string());
        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header(
            "x-amz-target",
            "AnyScaleScalingPlannerFrontendService.CreateScalingPlan",
        );
        let encoded = serde_json::to_string(&input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        self.client.sign_and_dispatch(request, |response| {
            if response.status.is_success() {
                Box::new(response.buffer().from_err().map(|response| {
                    let mut body = response.body;

                    if body.is_empty() || body == b"null" {
                        body = b"{}".to_vec();
                    }

                    serde_json::from_str::<CreateScalingPlanResponse>(
                        String::from_utf8_lossy(body.as_ref()).as_ref(),
                    )
                    .unwrap()
                }))
            } else {
                Box::new(
                    response
                        .buffer()
                        .from_err()
                        .and_then(|response| Err(CreateScalingPlanError::from_response(response))),
                )
            }
        })
    }

    /// <p>Deletes the specified scaling plan.</p> <p>Deleting a scaling plan deletes the underlying <a>ScalingInstruction</a> for all of the scalable resources that are covered by the plan.</p> <p>If the plan has launched resources or has scaling activities in progress, you must delete those resources separately.</p>
    fn delete_scaling_plan(
        &self,
        input: DeleteScalingPlanRequest,
    ) -> RusotoFuture<DeleteScalingPlanResponse, DeleteScalingPlanError> {
        let mut request = SignedRequest::new("POST", "autoscaling-plans", &self.region, "/");
        request.set_endpoint_prefix("autoscaling".to_string());
        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header(
            "x-amz-target",
            "AnyScaleScalingPlannerFrontendService.DeleteScalingPlan",
        );
        let encoded = serde_json::to_string(&input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        self.client.sign_and_dispatch(request, |response| {
            if response.status.is_success() {
                Box::new(response.buffer().from_err().map(|response| {
                    let mut body = response.body;

                    if body.is_empty() || body == b"null" {
                        body = b"{}".to_vec();
                    }

                    serde_json::from_str::<DeleteScalingPlanResponse>(
                        String::from_utf8_lossy(body.as_ref()).as_ref(),
                    )
                    .unwrap()
                }))
            } else {
                Box::new(
                    response
                        .buffer()
                        .from_err()
                        .and_then(|response| Err(DeleteScalingPlanError::from_response(response))),
                )
            }
        })
    }

    /// <p>Describes the scalable resources in the specified scaling plan.</p>
    fn describe_scaling_plan_resources(
        &self,
        input: DescribeScalingPlanResourcesRequest,
    ) -> RusotoFuture<DescribeScalingPlanResourcesResponse, DescribeScalingPlanResourcesError> {
        let mut request = SignedRequest::new("POST", "autoscaling-plans", &self.region, "/");
        request.set_endpoint_prefix("autoscaling".to_string());
        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header(
            "x-amz-target",
            "AnyScaleScalingPlannerFrontendService.DescribeScalingPlanResources",
        );
        let encoded = serde_json::to_string(&input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        self.client.sign_and_dispatch(request, |response| {
            if response.status.is_success() {
                Box::new(response.buffer().from_err().map(|response| {
                    let mut body = response.body;

                    if body.is_empty() || body == b"null" {
                        body = b"{}".to_vec();
                    }

                    serde_json::from_str::<DescribeScalingPlanResourcesResponse>(
                        String::from_utf8_lossy(body.as_ref()).as_ref(),
                    )
                    .unwrap()
                }))
            } else {
                Box::new(response.buffer().from_err().and_then(|response| {
                    Err(DescribeScalingPlanResourcesError::from_response(response))
                }))
            }
        })
    }

    /// <p>Describes one or more of your scaling plans.</p>
    fn describe_scaling_plans(
        &self,
        input: DescribeScalingPlansRequest,
    ) -> RusotoFuture<DescribeScalingPlansResponse, DescribeScalingPlansError> {
        let mut request = SignedRequest::new("POST", "autoscaling-plans", &self.region, "/");
        request.set_endpoint_prefix("autoscaling".to_string());
        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header(
            "x-amz-target",
            "AnyScaleScalingPlannerFrontendService.DescribeScalingPlans",
        );
        let encoded = serde_json::to_string(&input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        self.client.sign_and_dispatch(request, |response| {
            if response.status.is_success() {
                Box::new(response.buffer().from_err().map(|response| {
                    let mut body = response.body;

                    if body.is_empty() || body == b"null" {
                        body = b"{}".to_vec();
                    }

                    serde_json::from_str::<DescribeScalingPlansResponse>(
                        String::from_utf8_lossy(body.as_ref()).as_ref(),
                    )
                    .unwrap()
                }))
            } else {
                Box::new(
                    response.buffer().from_err().and_then(|response| {
                        Err(DescribeScalingPlansError::from_response(response))
                    }),
                )
            }
        })
    }

    /// <p>Retrieves the forecast data for a scalable resource.</p> <p>Capacity forecasts are represented as predicted values, or data points, that are calculated using historical data points from a specified CloudWatch load metric. Data points are available for up to 56 days. </p>
    fn get_scaling_plan_resource_forecast_data(
        &self,
        input: GetScalingPlanResourceForecastDataRequest,
    ) -> RusotoFuture<
        GetScalingPlanResourceForecastDataResponse,
        GetScalingPlanResourceForecastDataError,
    > {
        let mut request = SignedRequest::new("POST", "autoscaling-plans", &self.region, "/");
        request.set_endpoint_prefix("autoscaling".to_string());
        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header(
            "x-amz-target",
            "AnyScaleScalingPlannerFrontendService.GetScalingPlanResourceForecastData",
        );
        let encoded = serde_json::to_string(&input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        self.client.sign_and_dispatch(request, |response| {
            if response.status.is_success() {
                Box::new(response.buffer().from_err().map(|response| {
                    let mut body = response.body;

                    if body.is_empty() || body == b"null" {
                        body = b"{}".to_vec();
                    }

                    serde_json::from_str::<GetScalingPlanResourceForecastDataResponse>(
                        String::from_utf8_lossy(body.as_ref()).as_ref(),
                    )
                    .unwrap()
                }))
            } else {
                Box::new(response.buffer().from_err().and_then(|response| {
                    Err(GetScalingPlanResourceForecastDataError::from_response(
                        response,
                    ))
                }))
            }
        })
    }

    /// <p>Updates the specified scaling plan.</p> <p>You cannot update a scaling plan if it is in the process of being created, updated, or deleted.</p>
    fn update_scaling_plan(
        &self,
        input: UpdateScalingPlanRequest,
    ) -> RusotoFuture<UpdateScalingPlanResponse, UpdateScalingPlanError> {
        let mut request = SignedRequest::new("POST", "autoscaling-plans", &self.region, "/");
        request.set_endpoint_prefix("autoscaling".to_string());
        request.set_content_type("application/x-amz-json-1.1".to_owned());
        request.add_header(
            "x-amz-target",
            "AnyScaleScalingPlannerFrontendService.UpdateScalingPlan",
        );
        let encoded = serde_json::to_string(&input).unwrap();
        request.set_payload(Some(encoded.into_bytes()));

        self.client.sign_and_dispatch(request, |response| {
            if response.status.is_success() {
                Box::new(response.buffer().from_err().map(|response| {
                    let mut body = response.body;

                    if body.is_empty() || body == b"null" {
                        body = b"{}".to_vec();
                    }

                    serde_json::from_str::<UpdateScalingPlanResponse>(
                        String::from_utf8_lossy(body.as_ref()).as_ref(),
                    )
                    .unwrap()
                }))
            } else {
                Box::new(
                    response
                        .buffer()
                        .from_err()
                        .and_then(|response| Err(UpdateScalingPlanError::from_response(response))),
                )
            }
        })
    }
}

#[cfg(test)]
mod protocol_tests {}