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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>This structure specifies the metrics and target utilization settings for a predictive scaling policy.</p>
/// <p>You must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the scaling metric.</p>
/// <p>Example</p>
/// <ul>
/// <li>
/// <p>You create a predictive scaling policy and specify <code>ALBRequestCount</code> as the value for the metric pair and <code>1000.0</code> as the target value. For this type of metric, you must provide the metric dimension for the corresponding target group, so you also provide a resource label for the Application Load Balancer target group that is attached to your Auto Scaling group.</p></li>
/// <li>
/// <p>The number of requests the target group receives per minute provides the load metric, and the request count averaged between the members of the target group provides the scaling metric. In CloudWatch, this refers to the <code>RequestCount</code> and <code>RequestCountPerTarget</code> metrics, respectively.</p></li>
/// <li>
/// <p>For optimal use of predictive scaling, you adhere to the best practice of using a dynamic scaling policy to automatically scale between the minimum capacity and maximum capacity in response to real-time changes in resource utilization.</p></li>
/// <li>
/// <p>Amazon EC2 Auto Scaling consumes data points for the load metric over the last 14 days and creates an hourly load forecast for predictive scaling. (A minimum of 24 hours of data is required.)</p></li>
/// <li>
/// <p>After creating the load forecast, Amazon EC2 Auto Scaling determines when to reduce or increase the capacity of your Auto Scaling group in each hour of the forecast period so that the average number of requests received by each instance is as close to 1000 requests per minute as possible at all times.</p></li>
/// </ul>
/// <p>For information about using custom metrics with predictive scaling, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/predictive-scaling-customized-metric-specification.html">Advanced predictive scaling policy configurations using custom metrics</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct PredictiveScalingMetricSpecification {
/// <p>Specifies the target utilization.</p><note>
/// <p>Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.</p>
/// </note>
pub target_value: ::std::option::Option<f64>,
/// <p>The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.</p>
pub predefined_metric_pair_specification: ::std::option::Option<crate::types::PredictiveScalingPredefinedMetricPair>,
/// <p>The predefined scaling metric specification.</p>
pub predefined_scaling_metric_specification: ::std::option::Option<crate::types::PredictiveScalingPredefinedScalingMetric>,
/// <p>The predefined load metric specification.</p>
pub predefined_load_metric_specification: ::std::option::Option<crate::types::PredictiveScalingPredefinedLoadMetric>,
/// <p>The customized scaling metric specification.</p>
pub customized_scaling_metric_specification: ::std::option::Option<crate::types::PredictiveScalingCustomizedScalingMetric>,
/// <p>The customized load metric specification.</p>
pub customized_load_metric_specification: ::std::option::Option<crate::types::PredictiveScalingCustomizedLoadMetric>,
/// <p>The customized capacity metric specification.</p>
pub customized_capacity_metric_specification: ::std::option::Option<crate::types::PredictiveScalingCustomizedCapacityMetric>,
}
impl PredictiveScalingMetricSpecification {
/// <p>Specifies the target utilization.</p><note>
/// <p>Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.</p>
/// </note>
pub fn target_value(&self) -> ::std::option::Option<f64> {
self.target_value
}
/// <p>The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.</p>
pub fn predefined_metric_pair_specification(&self) -> ::std::option::Option<&crate::types::PredictiveScalingPredefinedMetricPair> {
self.predefined_metric_pair_specification.as_ref()
}
/// <p>The predefined scaling metric specification.</p>
pub fn predefined_scaling_metric_specification(&self) -> ::std::option::Option<&crate::types::PredictiveScalingPredefinedScalingMetric> {
self.predefined_scaling_metric_specification.as_ref()
}
/// <p>The predefined load metric specification.</p>
pub fn predefined_load_metric_specification(&self) -> ::std::option::Option<&crate::types::PredictiveScalingPredefinedLoadMetric> {
self.predefined_load_metric_specification.as_ref()
}
/// <p>The customized scaling metric specification.</p>
pub fn customized_scaling_metric_specification(&self) -> ::std::option::Option<&crate::types::PredictiveScalingCustomizedScalingMetric> {
self.customized_scaling_metric_specification.as_ref()
}
/// <p>The customized load metric specification.</p>
pub fn customized_load_metric_specification(&self) -> ::std::option::Option<&crate::types::PredictiveScalingCustomizedLoadMetric> {
self.customized_load_metric_specification.as_ref()
}
/// <p>The customized capacity metric specification.</p>
pub fn customized_capacity_metric_specification(&self) -> ::std::option::Option<&crate::types::PredictiveScalingCustomizedCapacityMetric> {
self.customized_capacity_metric_specification.as_ref()
}
}
impl PredictiveScalingMetricSpecification {
/// Creates a new builder-style object to manufacture [`PredictiveScalingMetricSpecification`](crate::types::PredictiveScalingMetricSpecification).
pub fn builder() -> crate::types::builders::PredictiveScalingMetricSpecificationBuilder {
crate::types::builders::PredictiveScalingMetricSpecificationBuilder::default()
}
}
/// A builder for [`PredictiveScalingMetricSpecification`](crate::types::PredictiveScalingMetricSpecification).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct PredictiveScalingMetricSpecificationBuilder {
pub(crate) target_value: ::std::option::Option<f64>,
pub(crate) predefined_metric_pair_specification: ::std::option::Option<crate::types::PredictiveScalingPredefinedMetricPair>,
pub(crate) predefined_scaling_metric_specification: ::std::option::Option<crate::types::PredictiveScalingPredefinedScalingMetric>,
pub(crate) predefined_load_metric_specification: ::std::option::Option<crate::types::PredictiveScalingPredefinedLoadMetric>,
pub(crate) customized_scaling_metric_specification: ::std::option::Option<crate::types::PredictiveScalingCustomizedScalingMetric>,
pub(crate) customized_load_metric_specification: ::std::option::Option<crate::types::PredictiveScalingCustomizedLoadMetric>,
pub(crate) customized_capacity_metric_specification: ::std::option::Option<crate::types::PredictiveScalingCustomizedCapacityMetric>,
}
impl PredictiveScalingMetricSpecificationBuilder {
/// <p>Specifies the target utilization.</p><note>
/// <p>Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.</p>
/// </note>
/// This field is required.
pub fn target_value(mut self, input: f64) -> Self {
self.target_value = ::std::option::Option::Some(input);
self
}
/// <p>Specifies the target utilization.</p><note>
/// <p>Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.</p>
/// </note>
pub fn set_target_value(mut self, input: ::std::option::Option<f64>) -> Self {
self.target_value = input;
self
}
/// <p>Specifies the target utilization.</p><note>
/// <p>Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval.</p>
/// </note>
pub fn get_target_value(&self) -> &::std::option::Option<f64> {
&self.target_value
}
/// <p>The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.</p>
pub fn predefined_metric_pair_specification(mut self, input: crate::types::PredictiveScalingPredefinedMetricPair) -> Self {
self.predefined_metric_pair_specification = ::std::option::Option::Some(input);
self
}
/// <p>The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.</p>
pub fn set_predefined_metric_pair_specification(
mut self,
input: ::std::option::Option<crate::types::PredictiveScalingPredefinedMetricPair>,
) -> Self {
self.predefined_metric_pair_specification = input;
self
}
/// <p>The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.</p>
pub fn get_predefined_metric_pair_specification(&self) -> &::std::option::Option<crate::types::PredictiveScalingPredefinedMetricPair> {
&self.predefined_metric_pair_specification
}
/// <p>The predefined scaling metric specification.</p>
pub fn predefined_scaling_metric_specification(mut self, input: crate::types::PredictiveScalingPredefinedScalingMetric) -> Self {
self.predefined_scaling_metric_specification = ::std::option::Option::Some(input);
self
}
/// <p>The predefined scaling metric specification.</p>
pub fn set_predefined_scaling_metric_specification(
mut self,
input: ::std::option::Option<crate::types::PredictiveScalingPredefinedScalingMetric>,
) -> Self {
self.predefined_scaling_metric_specification = input;
self
}
/// <p>The predefined scaling metric specification.</p>
pub fn get_predefined_scaling_metric_specification(&self) -> &::std::option::Option<crate::types::PredictiveScalingPredefinedScalingMetric> {
&self.predefined_scaling_metric_specification
}
/// <p>The predefined load metric specification.</p>
pub fn predefined_load_metric_specification(mut self, input: crate::types::PredictiveScalingPredefinedLoadMetric) -> Self {
self.predefined_load_metric_specification = ::std::option::Option::Some(input);
self
}
/// <p>The predefined load metric specification.</p>
pub fn set_predefined_load_metric_specification(
mut self,
input: ::std::option::Option<crate::types::PredictiveScalingPredefinedLoadMetric>,
) -> Self {
self.predefined_load_metric_specification = input;
self
}
/// <p>The predefined load metric specification.</p>
pub fn get_predefined_load_metric_specification(&self) -> &::std::option::Option<crate::types::PredictiveScalingPredefinedLoadMetric> {
&self.predefined_load_metric_specification
}
/// <p>The customized scaling metric specification.</p>
pub fn customized_scaling_metric_specification(mut self, input: crate::types::PredictiveScalingCustomizedScalingMetric) -> Self {
self.customized_scaling_metric_specification = ::std::option::Option::Some(input);
self
}
/// <p>The customized scaling metric specification.</p>
pub fn set_customized_scaling_metric_specification(
mut self,
input: ::std::option::Option<crate::types::PredictiveScalingCustomizedScalingMetric>,
) -> Self {
self.customized_scaling_metric_specification = input;
self
}
/// <p>The customized scaling metric specification.</p>
pub fn get_customized_scaling_metric_specification(&self) -> &::std::option::Option<crate::types::PredictiveScalingCustomizedScalingMetric> {
&self.customized_scaling_metric_specification
}
/// <p>The customized load metric specification.</p>
pub fn customized_load_metric_specification(mut self, input: crate::types::PredictiveScalingCustomizedLoadMetric) -> Self {
self.customized_load_metric_specification = ::std::option::Option::Some(input);
self
}
/// <p>The customized load metric specification.</p>
pub fn set_customized_load_metric_specification(
mut self,
input: ::std::option::Option<crate::types::PredictiveScalingCustomizedLoadMetric>,
) -> Self {
self.customized_load_metric_specification = input;
self
}
/// <p>The customized load metric specification.</p>
pub fn get_customized_load_metric_specification(&self) -> &::std::option::Option<crate::types::PredictiveScalingCustomizedLoadMetric> {
&self.customized_load_metric_specification
}
/// <p>The customized capacity metric specification.</p>
pub fn customized_capacity_metric_specification(mut self, input: crate::types::PredictiveScalingCustomizedCapacityMetric) -> Self {
self.customized_capacity_metric_specification = ::std::option::Option::Some(input);
self
}
/// <p>The customized capacity metric specification.</p>
pub fn set_customized_capacity_metric_specification(
mut self,
input: ::std::option::Option<crate::types::PredictiveScalingCustomizedCapacityMetric>,
) -> Self {
self.customized_capacity_metric_specification = input;
self
}
/// <p>The customized capacity metric specification.</p>
pub fn get_customized_capacity_metric_specification(&self) -> &::std::option::Option<crate::types::PredictiveScalingCustomizedCapacityMetric> {
&self.customized_capacity_metric_specification
}
/// Consumes the builder and constructs a [`PredictiveScalingMetricSpecification`](crate::types::PredictiveScalingMetricSpecification).
pub fn build(self) -> crate::types::PredictiveScalingMetricSpecification {
crate::types::PredictiveScalingMetricSpecification {
target_value: self.target_value,
predefined_metric_pair_specification: self.predefined_metric_pair_specification,
predefined_scaling_metric_specification: self.predefined_scaling_metric_specification,
predefined_load_metric_specification: self.predefined_load_metric_specification,
customized_scaling_metric_specification: self.customized_scaling_metric_specification,
customized_load_metric_specification: self.customized_load_metric_specification,
customized_capacity_metric_specification: self.customized_capacity_metric_specification,
}
}
}