aws_sdk_waf/operation/update_web_acl/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_web_acl::_update_web_acl_output::UpdateWebAclOutputBuilder;
3
4pub use crate::operation::update_web_acl::_update_web_acl_input::UpdateWebAclInputBuilder;
5
6impl crate::operation::update_web_acl::builders::UpdateWebAclInputBuilder {
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::update_web_acl::UpdateWebAclOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_web_acl::UpdateWebACLError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_web_acl();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdateWebACL`.
24///
25/// <note>
26/// <p>This is <b>AWS WAF Classic</b> documentation. For more information, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html">AWS WAF Classic</a> in the developer guide.</p>
27/// <p><b>For the latest version of AWS WAF</b>, use the AWS WAFV2 API and see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS WAF Developer Guide</a>. With the latest version, AWS WAF has a single set of endpoints for regional and global use.</p>
28/// </note>
29/// <p>Inserts or deletes <code>ActivatedRule</code> objects in a <code>WebACL</code>. Each <code>Rule</code> identifies web requests that you want to allow, block, or count. When you update a <code>WebACL</code>, you specify the following values:</p>
30/// <ul>
31/// <li>
32/// <p>A default action for the <code>WebACL</code>, either <code>ALLOW</code> or <code>BLOCK</code>. AWS WAF performs the default action if a request doesn't match the criteria in any of the <code>Rules</code> in a <code>WebACL</code>.</p></li>
33/// <li>
34/// <p>The <code>Rules</code> that you want to add or delete. If you want to replace one <code>Rule</code> with another, you delete the existing <code>Rule</code> and add the new one.</p></li>
35/// <li>
36/// <p>For each <code>Rule</code>, whether you want AWS WAF to allow requests, block requests, or count requests that match the conditions in the <code>Rule</code>.</p></li>
37/// <li>
38/// <p>The order in which you want AWS WAF to evaluate the <code>Rules</code> in a <code>WebACL</code>. If you add more than one <code>Rule</code> to a <code>WebACL</code>, AWS WAF evaluates each request against the <code>Rules</code> in order based on the value of <code>Priority</code>. (The <code>Rule</code> that has the lowest value for <code>Priority</code> is evaluated first.) When a web request matches all the predicates (such as <code>ByteMatchSets</code> and <code>IPSets</code>) in a <code>Rule</code>, AWS WAF immediately takes the corresponding action, allow or block, and doesn't evaluate the request against the remaining <code>Rules</code> in the <code>WebACL</code>, if any.</p></li>
39/// </ul>
40/// <p>To create and configure a <code>WebACL</code>, perform the following steps:</p>
41/// <ol>
42/// <li>
43/// <p>Create and update the predicates that you want to include in <code>Rules</code>. For more information, see <code>CreateByteMatchSet</code>, <code>UpdateByteMatchSet</code>, <code>CreateIPSet</code>, <code>UpdateIPSet</code>, <code>CreateSqlInjectionMatchSet</code>, and <code>UpdateSqlInjectionMatchSet</code>.</p></li>
44/// <li>
45/// <p>Create and update the <code>Rules</code> that you want to include in the <code>WebACL</code>. For more information, see <code>CreateRule</code> and <code>UpdateRule</code>.</p></li>
46/// <li>
47/// <p>Create a <code>WebACL</code>. See <code>CreateWebACL</code>.</p></li>
48/// <li>
49/// <p>Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code> parameter of an <code>UpdateWebACL</code> request.</p></li>
50/// <li>
51/// <p>Submit an <code>UpdateWebACL</code> request to specify the <code>Rules</code> that you want to include in the <code>WebACL</code>, to specify the default action, and to associate the <code>WebACL</code> with a CloudFront distribution.</p>
52/// <p>The <code>ActivatedRule</code> can be a rule group. If you specify a rule group as your <code>ActivatedRule</code> , you can exclude specific rules from that rule group.</p>
53/// <p>If you already have a rule group associated with a web ACL and want to submit an <code>UpdateWebACL</code> request to exclude certain rules from that rule group, you must first remove the rule group from the web ACL, the re-insert it again, specifying the excluded rules. For details, see <code>ActivatedRule$ExcludedRules</code> .</p></li>
54/// </ol>
55/// <p>Be aware that if you try to add a RATE_BASED rule to a web ACL without setting the rule type when first creating the rule, the <code>UpdateWebACL</code> request will fail because the request tries to add a REGULAR rule (the default rule type) with the specified ID, which does not exist.</p>
56/// <p>For more information about how to use the AWS WAF API to allow or block HTTP requests, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer Guide</a>.</p>
57#[derive(::std::clone::Clone, ::std::fmt::Debug)]
58pub struct UpdateWebACLFluentBuilder {
59 handle: ::std::sync::Arc<crate::client::Handle>,
60 inner: crate::operation::update_web_acl::builders::UpdateWebAclInputBuilder,
61 config_override: ::std::option::Option<crate::config::Builder>,
62}
63impl
64 crate::client::customize::internal::CustomizableSend<
65 crate::operation::update_web_acl::UpdateWebAclOutput,
66 crate::operation::update_web_acl::UpdateWebACLError,
67 > for UpdateWebACLFluentBuilder
68{
69 fn send(
70 self,
71 config_override: crate::config::Builder,
72 ) -> crate::client::customize::internal::BoxFuture<
73 crate::client::customize::internal::SendResult<
74 crate::operation::update_web_acl::UpdateWebAclOutput,
75 crate::operation::update_web_acl::UpdateWebACLError,
76 >,
77 > {
78 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
79 }
80}
81impl UpdateWebACLFluentBuilder {
82 /// Creates a new `UpdateWebACLFluentBuilder`.
83 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
84 Self {
85 handle,
86 inner: ::std::default::Default::default(),
87 config_override: ::std::option::Option::None,
88 }
89 }
90 /// Access the UpdateWebACL as a reference.
91 pub fn as_input(&self) -> &crate::operation::update_web_acl::builders::UpdateWebAclInputBuilder {
92 &self.inner
93 }
94 /// Sends the request and returns the response.
95 ///
96 /// If an error occurs, an `SdkError` will be returned with additional details that
97 /// can be matched against.
98 ///
99 /// By default, any retryable failures will be retried twice. Retry behavior
100 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
101 /// set when configuring the client.
102 pub async fn send(
103 self,
104 ) -> ::std::result::Result<
105 crate::operation::update_web_acl::UpdateWebAclOutput,
106 ::aws_smithy_runtime_api::client::result::SdkError<
107 crate::operation::update_web_acl::UpdateWebACLError,
108 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
109 >,
110 > {
111 let input = self
112 .inner
113 .build()
114 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
115 let runtime_plugins = crate::operation::update_web_acl::UpdateWebACL::operation_runtime_plugins(
116 self.handle.runtime_plugins.clone(),
117 &self.handle.conf,
118 self.config_override,
119 );
120 crate::operation::update_web_acl::UpdateWebACL::orchestrate(&runtime_plugins, input).await
121 }
122
123 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
124 pub fn customize(
125 self,
126 ) -> crate::client::customize::CustomizableOperation<
127 crate::operation::update_web_acl::UpdateWebAclOutput,
128 crate::operation::update_web_acl::UpdateWebACLError,
129 Self,
130 > {
131 crate::client::customize::CustomizableOperation::new(self)
132 }
133 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
134 self.set_config_override(::std::option::Option::Some(config_override.into()));
135 self
136 }
137
138 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
139 self.config_override = config_override;
140 self
141 }
142 /// <p>The <code>WebACLId</code> of the <code>WebACL</code> that you want to update. <code>WebACLId</code> is returned by <code>CreateWebACL</code> and by <code>ListWebACLs</code>.</p>
143 pub fn web_acl_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144 self.inner = self.inner.web_acl_id(input.into());
145 self
146 }
147 /// <p>The <code>WebACLId</code> of the <code>WebACL</code> that you want to update. <code>WebACLId</code> is returned by <code>CreateWebACL</code> and by <code>ListWebACLs</code>.</p>
148 pub fn set_web_acl_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149 self.inner = self.inner.set_web_acl_id(input);
150 self
151 }
152 /// <p>The <code>WebACLId</code> of the <code>WebACL</code> that you want to update. <code>WebACLId</code> is returned by <code>CreateWebACL</code> and by <code>ListWebACLs</code>.</p>
153 pub fn get_web_acl_id(&self) -> &::std::option::Option<::std::string::String> {
154 self.inner.get_web_acl_id()
155 }
156 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
157 pub fn change_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158 self.inner = self.inner.change_token(input.into());
159 self
160 }
161 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
162 pub fn set_change_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163 self.inner = self.inner.set_change_token(input);
164 self
165 }
166 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
167 pub fn get_change_token(&self) -> &::std::option::Option<::std::string::String> {
168 self.inner.get_change_token()
169 }
170 ///
171 /// Appends an item to `Updates`.
172 ///
173 /// To override the contents of this collection use [`set_updates`](Self::set_updates).
174 ///
175 /// <p>An array of updates to make to the <code>WebACL</code>.</p>
176 /// <p>An array of <code>WebACLUpdate</code> objects that you want to insert into or delete from a <code>WebACL</code>. For more information, see the applicable data types:</p>
177 /// <ul>
178 /// <li>
179 /// <p><code>WebACLUpdate</code>: Contains <code>Action</code> and <code>ActivatedRule</code></p></li>
180 /// <li>
181 /// <p><code>ActivatedRule</code>: Contains <code>Action</code>, <code>OverrideAction</code>, <code>Priority</code>, <code>RuleId</code>, and <code>Type</code>. <code>ActivatedRule|OverrideAction</code> applies only when updating or adding a <code>RuleGroup</code> to a <code>WebACL</code>. In this case, you do not use <code>ActivatedRule|Action</code>. For all other update requests, <code>ActivatedRule|Action</code> is used instead of <code>ActivatedRule|OverrideAction</code>.</p></li>
182 /// <li>
183 /// <p><code>WafAction</code>: Contains <code>Type</code></p></li>
184 /// </ul>
185 pub fn updates(mut self, input: crate::types::WebAclUpdate) -> Self {
186 self.inner = self.inner.updates(input);
187 self
188 }
189 /// <p>An array of updates to make to the <code>WebACL</code>.</p>
190 /// <p>An array of <code>WebACLUpdate</code> objects that you want to insert into or delete from a <code>WebACL</code>. For more information, see the applicable data types:</p>
191 /// <ul>
192 /// <li>
193 /// <p><code>WebACLUpdate</code>: Contains <code>Action</code> and <code>ActivatedRule</code></p></li>
194 /// <li>
195 /// <p><code>ActivatedRule</code>: Contains <code>Action</code>, <code>OverrideAction</code>, <code>Priority</code>, <code>RuleId</code>, and <code>Type</code>. <code>ActivatedRule|OverrideAction</code> applies only when updating or adding a <code>RuleGroup</code> to a <code>WebACL</code>. In this case, you do not use <code>ActivatedRule|Action</code>. For all other update requests, <code>ActivatedRule|Action</code> is used instead of <code>ActivatedRule|OverrideAction</code>.</p></li>
196 /// <li>
197 /// <p><code>WafAction</code>: Contains <code>Type</code></p></li>
198 /// </ul>
199 pub fn set_updates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::WebAclUpdate>>) -> Self {
200 self.inner = self.inner.set_updates(input);
201 self
202 }
203 /// <p>An array of updates to make to the <code>WebACL</code>.</p>
204 /// <p>An array of <code>WebACLUpdate</code> objects that you want to insert into or delete from a <code>WebACL</code>. For more information, see the applicable data types:</p>
205 /// <ul>
206 /// <li>
207 /// <p><code>WebACLUpdate</code>: Contains <code>Action</code> and <code>ActivatedRule</code></p></li>
208 /// <li>
209 /// <p><code>ActivatedRule</code>: Contains <code>Action</code>, <code>OverrideAction</code>, <code>Priority</code>, <code>RuleId</code>, and <code>Type</code>. <code>ActivatedRule|OverrideAction</code> applies only when updating or adding a <code>RuleGroup</code> to a <code>WebACL</code>. In this case, you do not use <code>ActivatedRule|Action</code>. For all other update requests, <code>ActivatedRule|Action</code> is used instead of <code>ActivatedRule|OverrideAction</code>.</p></li>
210 /// <li>
211 /// <p><code>WafAction</code>: Contains <code>Type</code></p></li>
212 /// </ul>
213 pub fn get_updates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::WebAclUpdate>> {
214 self.inner.get_updates()
215 }
216 /// <p>A default action for the web ACL, either ALLOW or BLOCK. AWS WAF performs the default action if a request doesn't match the criteria in any of the rules in a web ACL.</p>
217 pub fn default_action(mut self, input: crate::types::WafAction) -> Self {
218 self.inner = self.inner.default_action(input);
219 self
220 }
221 /// <p>A default action for the web ACL, either ALLOW or BLOCK. AWS WAF performs the default action if a request doesn't match the criteria in any of the rules in a web ACL.</p>
222 pub fn set_default_action(mut self, input: ::std::option::Option<crate::types::WafAction>) -> Self {
223 self.inner = self.inner.set_default_action(input);
224 self
225 }
226 /// <p>A default action for the web ACL, either ALLOW or BLOCK. AWS WAF performs the default action if a request doesn't match the criteria in any of the rules in a web ACL.</p>
227 pub fn get_default_action(&self) -> &::std::option::Option<crate::types::WafAction> {
228 self.inner.get_default_action()
229 }
230}