aws_sdk_waf/operation/create_web_acl/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_web_acl::_create_web_acl_output::CreateWebAclOutputBuilder;
3
4pub use crate::operation::create_web_acl::_create_web_acl_input::CreateWebAclInputBuilder;
5
6impl crate::operation::create_web_acl::builders::CreateWebAclInputBuilder {
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_web_acl::CreateWebAclOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_web_acl::CreateWebACLError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_web_acl();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateWebACL`.
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>Creates a <code>WebACL</code>, which contains the <code>Rules</code> that identify the CloudFront web requests that you want to allow, block, or count. AWS WAF evaluates <code>Rules</code> in order based on the value of <code>Priority</code> for each <code>Rule</code>.</p>
30/// <p>You also specify a default action, either <code>ALLOW</code> or <code>BLOCK</code>. If a web request doesn't match any of the <code>Rules</code> in a <code>WebACL</code>, AWS WAF responds to the request with the default action.</p>
31/// <p>To create and configure a <code>WebACL</code>, perform the following steps:</p>
32/// <ol>
33/// <li>
34/// <p>Create and update the <code>ByteMatchSet</code> objects and other 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>
35/// <li>
36/// <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>
37/// <li>
38/// <p>Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code> parameter of a <code>CreateWebACL</code> request.</p></li>
39/// <li>
40/// <p>Submit a <code>CreateWebACL</code> request.</p></li>
41/// <li>
42/// <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>
43/// <li>
44/// <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></li>
45/// </ol>
46/// <p>For more information about how to use the AWS WAF API, see the <a href="https://docs.aws.amazon.com/waf/latest/developerguide/">AWS WAF Developer Guide</a>.</p>
47#[derive(::std::clone::Clone, ::std::fmt::Debug)]
48pub struct CreateWebACLFluentBuilder {
49 handle: ::std::sync::Arc<crate::client::Handle>,
50 inner: crate::operation::create_web_acl::builders::CreateWebAclInputBuilder,
51 config_override: ::std::option::Option<crate::config::Builder>,
52}
53impl
54 crate::client::customize::internal::CustomizableSend<
55 crate::operation::create_web_acl::CreateWebAclOutput,
56 crate::operation::create_web_acl::CreateWebACLError,
57 > for CreateWebACLFluentBuilder
58{
59 fn send(
60 self,
61 config_override: crate::config::Builder,
62 ) -> crate::client::customize::internal::BoxFuture<
63 crate::client::customize::internal::SendResult<
64 crate::operation::create_web_acl::CreateWebAclOutput,
65 crate::operation::create_web_acl::CreateWebACLError,
66 >,
67 > {
68 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
69 }
70}
71impl CreateWebACLFluentBuilder {
72 /// Creates a new `CreateWebACLFluentBuilder`.
73 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
74 Self {
75 handle,
76 inner: ::std::default::Default::default(),
77 config_override: ::std::option::Option::None,
78 }
79 }
80 /// Access the CreateWebACL as a reference.
81 pub fn as_input(&self) -> &crate::operation::create_web_acl::builders::CreateWebAclInputBuilder {
82 &self.inner
83 }
84 /// Sends the request and returns the response.
85 ///
86 /// If an error occurs, an `SdkError` will be returned with additional details that
87 /// can be matched against.
88 ///
89 /// By default, any retryable failures will be retried twice. Retry behavior
90 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
91 /// set when configuring the client.
92 pub async fn send(
93 self,
94 ) -> ::std::result::Result<
95 crate::operation::create_web_acl::CreateWebAclOutput,
96 ::aws_smithy_runtime_api::client::result::SdkError<
97 crate::operation::create_web_acl::CreateWebACLError,
98 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
99 >,
100 > {
101 let input = self
102 .inner
103 .build()
104 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
105 let runtime_plugins = crate::operation::create_web_acl::CreateWebACL::operation_runtime_plugins(
106 self.handle.runtime_plugins.clone(),
107 &self.handle.conf,
108 self.config_override,
109 );
110 crate::operation::create_web_acl::CreateWebACL::orchestrate(&runtime_plugins, input).await
111 }
112
113 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
114 pub fn customize(
115 self,
116 ) -> crate::client::customize::CustomizableOperation<
117 crate::operation::create_web_acl::CreateWebAclOutput,
118 crate::operation::create_web_acl::CreateWebACLError,
119 Self,
120 > {
121 crate::client::customize::CustomizableOperation::new(self)
122 }
123 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
124 self.set_config_override(::std::option::Option::Some(config_override.into()));
125 self
126 }
127
128 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
129 self.config_override = config_override;
130 self
131 }
132 /// <p>A friendly name or description of the <code>WebACL</code>. You can't change <code>Name</code> after you create the <code>WebACL</code>.</p>
133 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.inner = self.inner.name(input.into());
135 self
136 }
137 /// <p>A friendly name or description of the <code>WebACL</code>. You can't change <code>Name</code> after you create the <code>WebACL</code>.</p>
138 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.inner = self.inner.set_name(input);
140 self
141 }
142 /// <p>A friendly name or description of the <code>WebACL</code>. You can't change <code>Name</code> after you create the <code>WebACL</code>.</p>
143 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_name()
145 }
146 /// <p>A friendly name or description for the metrics for this <code>WebACL</code>.The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change <code>MetricName</code> after you create the <code>WebACL</code>.</p>
147 pub fn metric_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148 self.inner = self.inner.metric_name(input.into());
149 self
150 }
151 /// <p>A friendly name or description for the metrics for this <code>WebACL</code>.The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change <code>MetricName</code> after you create the <code>WebACL</code>.</p>
152 pub fn set_metric_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153 self.inner = self.inner.set_metric_name(input);
154 self
155 }
156 /// <p>A friendly name or description for the metrics for this <code>WebACL</code>.The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change <code>MetricName</code> after you create the <code>WebACL</code>.</p>
157 pub fn get_metric_name(&self) -> &::std::option::Option<::std::string::String> {
158 self.inner.get_metric_name()
159 }
160 /// <p>The action that you want AWS WAF to take when a request doesn't match the criteria specified in any of the <code>Rule</code> objects that are associated with the <code>WebACL</code>.</p>
161 pub fn default_action(mut self, input: crate::types::WafAction) -> Self {
162 self.inner = self.inner.default_action(input);
163 self
164 }
165 /// <p>The action that you want AWS WAF to take when a request doesn't match the criteria specified in any of the <code>Rule</code> objects that are associated with the <code>WebACL</code>.</p>
166 pub fn set_default_action(mut self, input: ::std::option::Option<crate::types::WafAction>) -> Self {
167 self.inner = self.inner.set_default_action(input);
168 self
169 }
170 /// <p>The action that you want AWS WAF to take when a request doesn't match the criteria specified in any of the <code>Rule</code> objects that are associated with the <code>WebACL</code>.</p>
171 pub fn get_default_action(&self) -> &::std::option::Option<crate::types::WafAction> {
172 self.inner.get_default_action()
173 }
174 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
175 pub fn change_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176 self.inner = self.inner.change_token(input.into());
177 self
178 }
179 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
180 pub fn set_change_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181 self.inner = self.inner.set_change_token(input);
182 self
183 }
184 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
185 pub fn get_change_token(&self) -> &::std::option::Option<::std::string::String> {
186 self.inner.get_change_token()
187 }
188 ///
189 /// Appends an item to `Tags`.
190 ///
191 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
192 ///
193 /// <p></p>
194 pub fn tags(mut self, input: crate::types::Tag) -> Self {
195 self.inner = self.inner.tags(input);
196 self
197 }
198 /// <p></p>
199 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
200 self.inner = self.inner.set_tags(input);
201 self
202 }
203 /// <p></p>
204 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
205 self.inner.get_tags()
206 }
207}