aws_sdk_autoscaling/operation/execute_policy/_execute_policy_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct ExecutePolicyInput {
6 /// <p>The name of the Auto Scaling group.</p>
7 pub auto_scaling_group_name: ::std::option::Option<::std::string::String>,
8 /// <p>The name or ARN of the policy.</p>
9 pub policy_name: ::std::option::Option<::std::string::String>,
10 /// <p>Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.</p>
11 /// <p>Valid only if the policy type is <code>SimpleScaling</code>. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scaling-cooldowns.html">Scaling cooldowns for Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
12 pub honor_cooldown: ::std::option::Option<bool>,
13 /// <p>The metric value to compare to <code>BreachThreshold</code>. This enables you to execute a policy of type <code>StepScaling</code> and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.</p>
14 /// <p>If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.</p>
15 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
16 pub metric_value: ::std::option::Option<f64>,
17 /// <p>The breach threshold for the alarm.</p>
18 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
19 pub breach_threshold: ::std::option::Option<f64>,
20}
21impl ExecutePolicyInput {
22 /// <p>The name of the Auto Scaling group.</p>
23 pub fn auto_scaling_group_name(&self) -> ::std::option::Option<&str> {
24 self.auto_scaling_group_name.as_deref()
25 }
26 /// <p>The name or ARN of the policy.</p>
27 pub fn policy_name(&self) -> ::std::option::Option<&str> {
28 self.policy_name.as_deref()
29 }
30 /// <p>Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.</p>
31 /// <p>Valid only if the policy type is <code>SimpleScaling</code>. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scaling-cooldowns.html">Scaling cooldowns for Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
32 pub fn honor_cooldown(&self) -> ::std::option::Option<bool> {
33 self.honor_cooldown
34 }
35 /// <p>The metric value to compare to <code>BreachThreshold</code>. This enables you to execute a policy of type <code>StepScaling</code> and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.</p>
36 /// <p>If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.</p>
37 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
38 pub fn metric_value(&self) -> ::std::option::Option<f64> {
39 self.metric_value
40 }
41 /// <p>The breach threshold for the alarm.</p>
42 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
43 pub fn breach_threshold(&self) -> ::std::option::Option<f64> {
44 self.breach_threshold
45 }
46}
47impl ExecutePolicyInput {
48 /// Creates a new builder-style object to manufacture [`ExecutePolicyInput`](crate::operation::execute_policy::ExecutePolicyInput).
49 pub fn builder() -> crate::operation::execute_policy::builders::ExecutePolicyInputBuilder {
50 crate::operation::execute_policy::builders::ExecutePolicyInputBuilder::default()
51 }
52}
53
54/// A builder for [`ExecutePolicyInput`](crate::operation::execute_policy::ExecutePolicyInput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct ExecutePolicyInputBuilder {
58 pub(crate) auto_scaling_group_name: ::std::option::Option<::std::string::String>,
59 pub(crate) policy_name: ::std::option::Option<::std::string::String>,
60 pub(crate) honor_cooldown: ::std::option::Option<bool>,
61 pub(crate) metric_value: ::std::option::Option<f64>,
62 pub(crate) breach_threshold: ::std::option::Option<f64>,
63}
64impl ExecutePolicyInputBuilder {
65 /// <p>The name of the Auto Scaling group.</p>
66 pub fn auto_scaling_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67 self.auto_scaling_group_name = ::std::option::Option::Some(input.into());
68 self
69 }
70 /// <p>The name of the Auto Scaling group.</p>
71 pub fn set_auto_scaling_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72 self.auto_scaling_group_name = input;
73 self
74 }
75 /// <p>The name of the Auto Scaling group.</p>
76 pub fn get_auto_scaling_group_name(&self) -> &::std::option::Option<::std::string::String> {
77 &self.auto_scaling_group_name
78 }
79 /// <p>The name or ARN of the policy.</p>
80 /// This field is required.
81 pub fn policy_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82 self.policy_name = ::std::option::Option::Some(input.into());
83 self
84 }
85 /// <p>The name or ARN of the policy.</p>
86 pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87 self.policy_name = input;
88 self
89 }
90 /// <p>The name or ARN of the policy.</p>
91 pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
92 &self.policy_name
93 }
94 /// <p>Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.</p>
95 /// <p>Valid only if the policy type is <code>SimpleScaling</code>. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scaling-cooldowns.html">Scaling cooldowns for Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
96 pub fn honor_cooldown(mut self, input: bool) -> Self {
97 self.honor_cooldown = ::std::option::Option::Some(input);
98 self
99 }
100 /// <p>Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.</p>
101 /// <p>Valid only if the policy type is <code>SimpleScaling</code>. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scaling-cooldowns.html">Scaling cooldowns for Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
102 pub fn set_honor_cooldown(mut self, input: ::std::option::Option<bool>) -> Self {
103 self.honor_cooldown = input;
104 self
105 }
106 /// <p>Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.</p>
107 /// <p>Valid only if the policy type is <code>SimpleScaling</code>. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-scaling-cooldowns.html">Scaling cooldowns for Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
108 pub fn get_honor_cooldown(&self) -> &::std::option::Option<bool> {
109 &self.honor_cooldown
110 }
111 /// <p>The metric value to compare to <code>BreachThreshold</code>. This enables you to execute a policy of type <code>StepScaling</code> and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.</p>
112 /// <p>If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.</p>
113 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
114 pub fn metric_value(mut self, input: f64) -> Self {
115 self.metric_value = ::std::option::Option::Some(input);
116 self
117 }
118 /// <p>The metric value to compare to <code>BreachThreshold</code>. This enables you to execute a policy of type <code>StepScaling</code> and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.</p>
119 /// <p>If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.</p>
120 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
121 pub fn set_metric_value(mut self, input: ::std::option::Option<f64>) -> Self {
122 self.metric_value = input;
123 self
124 }
125 /// <p>The metric value to compare to <code>BreachThreshold</code>. This enables you to execute a policy of type <code>StepScaling</code> and determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.</p>
126 /// <p>If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.</p>
127 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
128 pub fn get_metric_value(&self) -> &::std::option::Option<f64> {
129 &self.metric_value
130 }
131 /// <p>The breach threshold for the alarm.</p>
132 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
133 pub fn breach_threshold(mut self, input: f64) -> Self {
134 self.breach_threshold = ::std::option::Option::Some(input);
135 self
136 }
137 /// <p>The breach threshold for the alarm.</p>
138 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
139 pub fn set_breach_threshold(mut self, input: ::std::option::Option<f64>) -> Self {
140 self.breach_threshold = input;
141 self
142 }
143 /// <p>The breach threshold for the alarm.</p>
144 /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
145 pub fn get_breach_threshold(&self) -> &::std::option::Option<f64> {
146 &self.breach_threshold
147 }
148 /// Consumes the builder and constructs a [`ExecutePolicyInput`](crate::operation::execute_policy::ExecutePolicyInput).
149 pub fn build(
150 self,
151 ) -> ::std::result::Result<crate::operation::execute_policy::ExecutePolicyInput, ::aws_smithy_types::error::operation::BuildError> {
152 ::std::result::Result::Ok(crate::operation::execute_policy::ExecutePolicyInput {
153 auto_scaling_group_name: self.auto_scaling_group_name,
154 policy_name: self.policy_name,
155 honor_cooldown: self.honor_cooldown,
156 metric_value: self.metric_value,
157 breach_threshold: self.breach_threshold,
158 })
159 }
160}