aws_sdk_securityhub/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 an automation rule based on input parameters.</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    ///
112    /// Adds a key-value pair to `Tags`.
113    ///
114    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
115    ///
116    /// <p>User-defined tags associated with an automation rule.</p>
117    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.tags(k.into(), v.into());
119        self
120    }
121    /// <p>User-defined tags associated with an automation rule.</p>
122    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
123        self.inner = self.inner.set_tags(input);
124        self
125    }
126    /// <p>User-defined tags associated with an automation rule.</p>
127    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
128        self.inner.get_tags()
129    }
130    /// <p>Whether the rule is active after it is created. If this parameter is equal to <code>ENABLED</code>, Security Hub starts applying the rule to findings and finding updates after the rule is created. To change the value of this parameter after creating a rule, use <a href="https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_BatchUpdateAutomationRules.html"> <code>BatchUpdateAutomationRules</code> </a>.</p>
131    pub fn rule_status(mut self, input: crate::types::RuleStatus) -> Self {
132        self.inner = self.inner.rule_status(input);
133        self
134    }
135    /// <p>Whether the rule is active after it is created. If this parameter is equal to <code>ENABLED</code>, Security Hub starts applying the rule to findings and finding updates after the rule is created. To change the value of this parameter after creating a rule, use <a href="https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_BatchUpdateAutomationRules.html"> <code>BatchUpdateAutomationRules</code> </a>.</p>
136    pub fn set_rule_status(mut self, input: ::std::option::Option<crate::types::RuleStatus>) -> Self {
137        self.inner = self.inner.set_rule_status(input);
138        self
139    }
140    /// <p>Whether the rule is active after it is created. If this parameter is equal to <code>ENABLED</code>, Security Hub starts applying the rule to findings and finding updates after the rule is created. To change the value of this parameter after creating a rule, use <a href="https://docs.aws.amazon.com/securityhub/1.0/APIReference/API_BatchUpdateAutomationRules.html"> <code>BatchUpdateAutomationRules</code> </a>.</p>
141    pub fn get_rule_status(&self) -> &::std::option::Option<crate::types::RuleStatus> {
142        self.inner.get_rule_status()
143    }
144    /// <p>An integer ranging from 1 to 1000 that represents the order in which the rule action is applied to findings. Security Hub applies rules with lower values for this parameter first.</p>
145    pub fn rule_order(mut self, input: i32) -> Self {
146        self.inner = self.inner.rule_order(input);
147        self
148    }
149    /// <p>An integer ranging from 1 to 1000 that represents the order in which the rule action is applied to findings. Security Hub applies rules with lower values for this parameter first.</p>
150    pub fn set_rule_order(mut self, input: ::std::option::Option<i32>) -> Self {
151        self.inner = self.inner.set_rule_order(input);
152        self
153    }
154    /// <p>An integer ranging from 1 to 1000 that represents the order in which the rule action is applied to findings. Security Hub applies rules with lower values for this parameter first.</p>
155    pub fn get_rule_order(&self) -> &::std::option::Option<i32> {
156        self.inner.get_rule_order()
157    }
158    /// <p>The name of the rule.</p>
159    pub fn rule_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.rule_name(input.into());
161        self
162    }
163    /// <p>The name of the rule.</p>
164    pub fn set_rule_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.inner = self.inner.set_rule_name(input);
166        self
167    }
168    /// <p>The name of the rule.</p>
169    pub fn get_rule_name(&self) -> &::std::option::Option<::std::string::String> {
170        self.inner.get_rule_name()
171    }
172    /// <p>A description of the rule.</p>
173    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
174        self.inner = self.inner.description(input.into());
175        self
176    }
177    /// <p>A description of the rule.</p>
178    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
179        self.inner = self.inner.set_description(input);
180        self
181    }
182    /// <p>A description of the rule.</p>
183    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
184        self.inner.get_description()
185    }
186    /// <p>Specifies whether a rule is the last to be applied with respect to a finding that matches the rule criteria. This is useful when a finding matches the criteria for multiple rules, and each rule has different actions. If a rule is terminal, Security Hub applies the rule action to a finding that matches the rule criteria and doesn't evaluate other rules for the finding. By default, a rule isn't terminal.</p>
187    pub fn is_terminal(mut self, input: bool) -> Self {
188        self.inner = self.inner.is_terminal(input);
189        self
190    }
191    /// <p>Specifies whether a rule is the last to be applied with respect to a finding that matches the rule criteria. This is useful when a finding matches the criteria for multiple rules, and each rule has different actions. If a rule is terminal, Security Hub applies the rule action to a finding that matches the rule criteria and doesn't evaluate other rules for the finding. By default, a rule isn't terminal.</p>
192    pub fn set_is_terminal(mut self, input: ::std::option::Option<bool>) -> Self {
193        self.inner = self.inner.set_is_terminal(input);
194        self
195    }
196    /// <p>Specifies whether a rule is the last to be applied with respect to a finding that matches the rule criteria. This is useful when a finding matches the criteria for multiple rules, and each rule has different actions. If a rule is terminal, Security Hub applies the rule action to a finding that matches the rule criteria and doesn't evaluate other rules for the finding. By default, a rule isn't terminal.</p>
197    pub fn get_is_terminal(&self) -> &::std::option::Option<bool> {
198        self.inner.get_is_terminal()
199    }
200    /// <p>A set of ASFF finding field attributes and corresponding expected values that Security Hub uses to filter findings. If a rule is enabled and a finding matches the conditions specified in this parameter, Security Hub applies the rule action to the finding.</p>
201    pub fn criteria(mut self, input: crate::types::AutomationRulesFindingFilters) -> Self {
202        self.inner = self.inner.criteria(input);
203        self
204    }
205    /// <p>A set of ASFF finding field attributes and corresponding expected values that Security Hub uses to filter findings. If a rule is enabled and a finding matches the conditions specified in this parameter, Security Hub applies the rule action to the finding.</p>
206    pub fn set_criteria(mut self, input: ::std::option::Option<crate::types::AutomationRulesFindingFilters>) -> Self {
207        self.inner = self.inner.set_criteria(input);
208        self
209    }
210    /// <p>A set of ASFF finding field attributes and corresponding expected values that Security Hub uses to filter findings. If a rule is enabled and a finding matches the conditions specified in this parameter, Security Hub applies the rule action to the finding.</p>
211    pub fn get_criteria(&self) -> &::std::option::Option<crate::types::AutomationRulesFindingFilters> {
212        self.inner.get_criteria()
213    }
214    ///
215    /// Appends an item to `Actions`.
216    ///
217    /// To override the contents of this collection use [`set_actions`](Self::set_actions).
218    ///
219    /// <p>One or more actions to update finding fields if a finding matches the conditions specified in <code>Criteria</code>.</p>
220    pub fn actions(mut self, input: crate::types::AutomationRulesAction) -> Self {
221        self.inner = self.inner.actions(input);
222        self
223    }
224    /// <p>One or more actions to update finding fields if a finding matches the conditions specified in <code>Criteria</code>.</p>
225    pub fn set_actions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AutomationRulesAction>>) -> Self {
226        self.inner = self.inner.set_actions(input);
227        self
228    }
229    /// <p>One or more actions to update finding fields if a finding matches the conditions specified in <code>Criteria</code>.</p>
230    pub fn get_actions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AutomationRulesAction>> {
231        self.inner.get_actions()
232    }
233}