aws_sdk_autoscaling/operation/execute_policy/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::execute_policy::_execute_policy_output::ExecutePolicyOutputBuilder;
3
4pub use crate::operation::execute_policy::_execute_policy_input::ExecutePolicyInputBuilder;
5
6impl crate::operation::execute_policy::builders::ExecutePolicyInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::execute_policy::ExecutePolicyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::execute_policy::ExecutePolicyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.execute_policy();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ExecutePolicy`.
24///
25/// <p>Executes the specified policy. This can be useful for testing the design of your scaling policy.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct ExecutePolicyFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::execute_policy::builders::ExecutePolicyInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::execute_policy::ExecutePolicyOutput,
35        crate::operation::execute_policy::ExecutePolicyError,
36    > for ExecutePolicyFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::execute_policy::ExecutePolicyOutput,
44            crate::operation::execute_policy::ExecutePolicyError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl ExecutePolicyFluentBuilder {
51    /// Creates a new `ExecutePolicyFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the ExecutePolicy as a reference.
60    pub fn as_input(&self) -> &crate::operation::execute_policy::builders::ExecutePolicyInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::execute_policy::ExecutePolicyOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::execute_policy::ExecutePolicyError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::execute_policy::ExecutePolicy::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::execute_policy::ExecutePolicy::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::execute_policy::ExecutePolicyOutput,
97        crate::operation::execute_policy::ExecutePolicyError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The name of the Auto Scaling group.</p>
112    pub fn auto_scaling_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.auto_scaling_group_name(input.into());
114        self
115    }
116    /// <p>The name of the Auto Scaling group.</p>
117    pub fn set_auto_scaling_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_auto_scaling_group_name(input);
119        self
120    }
121    /// <p>The name of the Auto Scaling group.</p>
122    pub fn get_auto_scaling_group_name(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_auto_scaling_group_name()
124    }
125    /// <p>The name or ARN of the policy.</p>
126    pub fn policy_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.policy_name(input.into());
128        self
129    }
130    /// <p>The name or ARN of the policy.</p>
131    pub fn set_policy_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_policy_name(input);
133        self
134    }
135    /// <p>The name or ARN of the policy.</p>
136    pub fn get_policy_name(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_policy_name()
138    }
139    /// <p>Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.</p>
140    /// <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>
141    pub fn honor_cooldown(mut self, input: bool) -> Self {
142        self.inner = self.inner.honor_cooldown(input);
143        self
144    }
145    /// <p>Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.</p>
146    /// <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>
147    pub fn set_honor_cooldown(mut self, input: ::std::option::Option<bool>) -> Self {
148        self.inner = self.inner.set_honor_cooldown(input);
149        self
150    }
151    /// <p>Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.</p>
152    /// <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>
153    pub fn get_honor_cooldown(&self) -> &::std::option::Option<bool> {
154        self.inner.get_honor_cooldown()
155    }
156    /// <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>
157    /// <p>If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.</p>
158    /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
159    pub fn metric_value(mut self, input: f64) -> Self {
160        self.inner = self.inner.metric_value(input);
161        self
162    }
163    /// <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>
164    /// <p>If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.</p>
165    /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
166    pub fn set_metric_value(mut self, input: ::std::option::Option<f64>) -> Self {
167        self.inner = self.inner.set_metric_value(input);
168        self
169    }
170    /// <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>
171    /// <p>If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.</p>
172    /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
173    pub fn get_metric_value(&self) -> &::std::option::Option<f64> {
174        self.inner.get_metric_value()
175    }
176    /// <p>The breach threshold for the alarm.</p>
177    /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
178    pub fn breach_threshold(mut self, input: f64) -> Self {
179        self.inner = self.inner.breach_threshold(input);
180        self
181    }
182    /// <p>The breach threshold for the alarm.</p>
183    /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
184    pub fn set_breach_threshold(mut self, input: ::std::option::Option<f64>) -> Self {
185        self.inner = self.inner.set_breach_threshold(input);
186        self
187    }
188    /// <p>The breach threshold for the alarm.</p>
189    /// <p>Required if the policy type is <code>StepScaling</code> and not supported otherwise.</p>
190    pub fn get_breach_threshold(&self) -> &::std::option::Option<f64> {
191        self.inner.get_breach_threshold()
192    }
193}