aws_sdk_computeoptimizerautomation/operation/create_automation_rule/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_automation_rule::_create_automation_rule_output::CreateAutomationRuleOutputBuilder;
3
4pub use crate::operation::create_automation_rule::_create_automation_rule_input::CreateAutomationRuleInputBuilder;
5
6impl crate::operation::create_automation_rule::builders::CreateAutomationRuleInputBuilder {
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::create_automation_rule::CreateAutomationRuleOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_automation_rule::CreateAutomationRuleError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_automation_rule();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateAutomationRule`.
24///
25/// <p>Creates a new automation rule to apply recommended actions to resources based on specified criteria.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateAutomationRuleFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_automation_rule::builders::CreateAutomationRuleInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_automation_rule::CreateAutomationRuleOutput,
35        crate::operation::create_automation_rule::CreateAutomationRuleError,
36    > for CreateAutomationRuleFluentBuilder
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::create_automation_rule::CreateAutomationRuleOutput,
44            crate::operation::create_automation_rule::CreateAutomationRuleError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateAutomationRuleFluentBuilder {
51    /// Creates a new `CreateAutomationRuleFluentBuilder`.
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 CreateAutomationRule as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_automation_rule::builders::CreateAutomationRuleInputBuilder {
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::create_automation_rule::CreateAutomationRuleOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_automation_rule::CreateAutomationRuleError,
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::create_automation_rule::CreateAutomationRule::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_automation_rule::CreateAutomationRule::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::create_automation_rule::CreateAutomationRuleOutput,
97        crate::operation::create_automation_rule::CreateAutomationRuleError,
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 automation rule.</p>
112    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.name(input.into());
114        self
115    }
116    /// <p>The name of the automation rule.</p>
117    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_name(input);
119        self
120    }
121    /// <p>The name of the automation rule.</p>
122    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_name()
124    }
125    /// <p>A description of the automation rule.</p>
126    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.description(input.into());
128        self
129    }
130    /// <p>A description of the automation rule.</p>
131    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_description(input);
133        self
134    }
135    /// <p>A description of the automation rule.</p>
136    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_description()
138    }
139    /// <p>The type of rule.</p><note>
140    /// <p>Only the management account or a delegated administrator can set the ruleType to be OrganizationRule.</p>
141    /// </note>
142    pub fn rule_type(mut self, input: crate::types::RuleType) -> Self {
143        self.inner = self.inner.rule_type(input);
144        self
145    }
146    /// <p>The type of rule.</p><note>
147    /// <p>Only the management account or a delegated administrator can set the ruleType to be OrganizationRule.</p>
148    /// </note>
149    pub fn set_rule_type(mut self, input: ::std::option::Option<crate::types::RuleType>) -> Self {
150        self.inner = self.inner.set_rule_type(input);
151        self
152    }
153    /// <p>The type of rule.</p><note>
154    /// <p>Only the management account or a delegated administrator can set the ruleType to be OrganizationRule.</p>
155    /// </note>
156    pub fn get_rule_type(&self) -> &::std::option::Option<crate::types::RuleType> {
157        self.inner.get_rule_type()
158    }
159    /// <p>Configuration for organization-level rules. Required for OrganizationRule type.</p>
160    pub fn organization_configuration(mut self, input: crate::types::OrganizationConfiguration) -> Self {
161        self.inner = self.inner.organization_configuration(input);
162        self
163    }
164    /// <p>Configuration for organization-level rules. Required for OrganizationRule type.</p>
165    pub fn set_organization_configuration(mut self, input: ::std::option::Option<crate::types::OrganizationConfiguration>) -> Self {
166        self.inner = self.inner.set_organization_configuration(input);
167        self
168    }
169    /// <p>Configuration for organization-level rules. Required for OrganizationRule type.</p>
170    pub fn get_organization_configuration(&self) -> &::std::option::Option<crate::types::OrganizationConfiguration> {
171        self.inner.get_organization_configuration()
172    }
173    /// <p>A string representation of a decimal number between 0 and 1 (having up to 30 digits after the decimal point) that determines the priority of the rule. When multiple rules match the same recommended action, Compute Optimizer assigns the action to the rule with the lowest priority value (highest priority), even if that rule is scheduled to run later than other matching rules.</p>
174    pub fn priority(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175        self.inner = self.inner.priority(input.into());
176        self
177    }
178    /// <p>A string representation of a decimal number between 0 and 1 (having up to 30 digits after the decimal point) that determines the priority of the rule. When multiple rules match the same recommended action, Compute Optimizer assigns the action to the rule with the lowest priority value (highest priority), even if that rule is scheduled to run later than other matching rules.</p>
179    pub fn set_priority(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180        self.inner = self.inner.set_priority(input);
181        self
182    }
183    /// <p>A string representation of a decimal number between 0 and 1 (having up to 30 digits after the decimal point) that determines the priority of the rule. When multiple rules match the same recommended action, Compute Optimizer assigns the action to the rule with the lowest priority value (highest priority), even if that rule is scheduled to run later than other matching rules.</p>
184    pub fn get_priority(&self) -> &::std::option::Option<::std::string::String> {
185        self.inner.get_priority()
186    }
187    ///
188    /// Appends an item to `recommendedActionTypes`.
189    ///
190    /// To override the contents of this collection use [`set_recommended_action_types`](Self::set_recommended_action_types).
191    ///
192    /// <p>The types of recommended actions this rule will automate.</p>
193    pub fn recommended_action_types(mut self, input: crate::types::RecommendedActionType) -> Self {
194        self.inner = self.inner.recommended_action_types(input);
195        self
196    }
197    /// <p>The types of recommended actions this rule will automate.</p>
198    pub fn set_recommended_action_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RecommendedActionType>>) -> Self {
199        self.inner = self.inner.set_recommended_action_types(input);
200        self
201    }
202    /// <p>The types of recommended actions this rule will automate.</p>
203    pub fn get_recommended_action_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RecommendedActionType>> {
204        self.inner.get_recommended_action_types()
205    }
206    /// <p>A set of conditions that specify which recommended action qualify for implementation. When a rule is active and a recommended action matches these criteria, Compute Optimizer implements the action at the scheduled run time.</p>
207    pub fn criteria(mut self, input: crate::types::Criteria) -> Self {
208        self.inner = self.inner.criteria(input);
209        self
210    }
211    /// <p>A set of conditions that specify which recommended action qualify for implementation. When a rule is active and a recommended action matches these criteria, Compute Optimizer implements the action at the scheduled run time.</p>
212    pub fn set_criteria(mut self, input: ::std::option::Option<crate::types::Criteria>) -> Self {
213        self.inner = self.inner.set_criteria(input);
214        self
215    }
216    /// <p>A set of conditions that specify which recommended action qualify for implementation. When a rule is active and a recommended action matches these criteria, Compute Optimizer implements the action at the scheduled run time.</p>
217    pub fn get_criteria(&self) -> &::std::option::Option<crate::types::Criteria> {
218        self.inner.get_criteria()
219    }
220    /// <p>The schedule for when the rule should run.</p>
221    pub fn schedule(mut self, input: crate::types::Schedule) -> Self {
222        self.inner = self.inner.schedule(input);
223        self
224    }
225    /// <p>The schedule for when the rule should run.</p>
226    pub fn set_schedule(mut self, input: ::std::option::Option<crate::types::Schedule>) -> Self {
227        self.inner = self.inner.set_schedule(input);
228        self
229    }
230    /// <p>The schedule for when the rule should run.</p>
231    pub fn get_schedule(&self) -> &::std::option::Option<crate::types::Schedule> {
232        self.inner.get_schedule()
233    }
234    /// <p>The status of the rule</p>
235    pub fn status(mut self, input: crate::types::RuleStatus) -> Self {
236        self.inner = self.inner.status(input);
237        self
238    }
239    /// <p>The status of the rule</p>
240    pub fn set_status(mut self, input: ::std::option::Option<crate::types::RuleStatus>) -> Self {
241        self.inner = self.inner.set_status(input);
242        self
243    }
244    /// <p>The status of the rule</p>
245    pub fn get_status(&self) -> &::std::option::Option<crate::types::RuleStatus> {
246        self.inner.get_status()
247    }
248    ///
249    /// Appends an item to `tags`.
250    ///
251    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
252    ///
253    /// <p>The tags to associate with the rule.</p>
254    pub fn tags(mut self, input: crate::types::Tag) -> Self {
255        self.inner = self.inner.tags(input);
256        self
257    }
258    /// <p>The tags to associate with the rule.</p>
259    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
260        self.inner = self.inner.set_tags(input);
261        self
262    }
263    /// <p>The tags to associate with the rule.</p>
264    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
265        self.inner.get_tags()
266    }
267    /// <p>A unique identifier to ensure idempotency of the request.</p>
268    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
269        self.inner = self.inner.client_token(input.into());
270        self
271    }
272    /// <p>A unique identifier to ensure idempotency of the request.</p>
273    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
274        self.inner = self.inner.set_client_token(input);
275        self
276    }
277    /// <p>A unique identifier to ensure idempotency of the request.</p>
278    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
279        self.inner.get_client_token()
280    }
281}