aws_sdk_waf/operation/update_byte_match_set/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_byte_match_set::_update_byte_match_set_output::UpdateByteMatchSetOutputBuilder;
3
4pub use crate::operation::update_byte_match_set::_update_byte_match_set_input::UpdateByteMatchSetInputBuilder;
5
6impl crate::operation::update_byte_match_set::builders::UpdateByteMatchSetInputBuilder {
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_byte_match_set::UpdateByteMatchSetOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_byte_match_set::UpdateByteMatchSetError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_byte_match_set();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdateByteMatchSet`.
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>ByteMatchTuple</code> objects (filters) in a <code>ByteMatchSet</code>. For each <code>ByteMatchTuple</code> object, you specify the following values:</p>
30/// <ul>
31/// <li>
32/// <p>Whether to insert or delete the object from the array. If you want to change a <code>ByteMatchSetUpdate</code> object, you delete the existing object and add a new one.</p></li>
33/// <li>
34/// <p>The part of a web request that you want AWS WAF to inspect, such as a query string or the value of the <code>User-Agent</code> header.</p></li>
35/// <li>
36/// <p>The bytes (typically a string that corresponds with ASCII characters) that you want AWS WAF to look for. For more information, including how you specify the values for the AWS WAF API and the AWS CLI or SDKs, see <code>TargetString</code> in the <code>ByteMatchTuple</code> data type.</p></li>
37/// <li>
38/// <p>Where to look, such as at the beginning or the end of a query string.</p></li>
39/// <li>
40/// <p>Whether to perform any conversions on the request, such as converting it to lowercase, before inspecting it for the specified string.</p></li>
41/// </ul>
42/// <p>For example, you can add a <code>ByteMatchSetUpdate</code> object that matches web requests in which <code>User-Agent</code> headers contain the string <code>BadBot</code>. You can then configure AWS WAF to block those requests.</p>
43/// <p>To create and configure a <code>ByteMatchSet</code>, perform the following steps:</p>
44/// <ol>
45/// <li>
46/// <p>Create a <code>ByteMatchSet.</code> For more information, see <code>CreateByteMatchSet</code>.</p></li>
47/// <li>
48/// <p>Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code> parameter of an <code>UpdateByteMatchSet</code> request.</p></li>
49/// <li>
50/// <p>Submit an <code>UpdateByteMatchSet</code> request to specify the part of the request that you want AWS WAF to inspect (for example, the header or the URI) and the value that you want AWS WAF to watch for.</p></li>
51/// </ol>
52/// <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>
53#[derive(::std::clone::Clone, ::std::fmt::Debug)]
54pub struct UpdateByteMatchSetFluentBuilder {
55 handle: ::std::sync::Arc<crate::client::Handle>,
56 inner: crate::operation::update_byte_match_set::builders::UpdateByteMatchSetInputBuilder,
57 config_override: ::std::option::Option<crate::config::Builder>,
58}
59impl
60 crate::client::customize::internal::CustomizableSend<
61 crate::operation::update_byte_match_set::UpdateByteMatchSetOutput,
62 crate::operation::update_byte_match_set::UpdateByteMatchSetError,
63 > for UpdateByteMatchSetFluentBuilder
64{
65 fn send(
66 self,
67 config_override: crate::config::Builder,
68 ) -> crate::client::customize::internal::BoxFuture<
69 crate::client::customize::internal::SendResult<
70 crate::operation::update_byte_match_set::UpdateByteMatchSetOutput,
71 crate::operation::update_byte_match_set::UpdateByteMatchSetError,
72 >,
73 > {
74 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
75 }
76}
77impl UpdateByteMatchSetFluentBuilder {
78 /// Creates a new `UpdateByteMatchSetFluentBuilder`.
79 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
80 Self {
81 handle,
82 inner: ::std::default::Default::default(),
83 config_override: ::std::option::Option::None,
84 }
85 }
86 /// Access the UpdateByteMatchSet as a reference.
87 pub fn as_input(&self) -> &crate::operation::update_byte_match_set::builders::UpdateByteMatchSetInputBuilder {
88 &self.inner
89 }
90 /// Sends the request and returns the response.
91 ///
92 /// If an error occurs, an `SdkError` will be returned with additional details that
93 /// can be matched against.
94 ///
95 /// By default, any retryable failures will be retried twice. Retry behavior
96 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
97 /// set when configuring the client.
98 pub async fn send(
99 self,
100 ) -> ::std::result::Result<
101 crate::operation::update_byte_match_set::UpdateByteMatchSetOutput,
102 ::aws_smithy_runtime_api::client::result::SdkError<
103 crate::operation::update_byte_match_set::UpdateByteMatchSetError,
104 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
105 >,
106 > {
107 let input = self
108 .inner
109 .build()
110 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
111 let runtime_plugins = crate::operation::update_byte_match_set::UpdateByteMatchSet::operation_runtime_plugins(
112 self.handle.runtime_plugins.clone(),
113 &self.handle.conf,
114 self.config_override,
115 );
116 crate::operation::update_byte_match_set::UpdateByteMatchSet::orchestrate(&runtime_plugins, input).await
117 }
118
119 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
120 pub fn customize(
121 self,
122 ) -> crate::client::customize::CustomizableOperation<
123 crate::operation::update_byte_match_set::UpdateByteMatchSetOutput,
124 crate::operation::update_byte_match_set::UpdateByteMatchSetError,
125 Self,
126 > {
127 crate::client::customize::CustomizableOperation::new(self)
128 }
129 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
130 self.set_config_override(::std::option::Option::Some(config_override.into()));
131 self
132 }
133
134 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
135 self.config_override = config_override;
136 self
137 }
138 /// <p>The <code>ByteMatchSetId</code> of the <code>ByteMatchSet</code> that you want to update. <code>ByteMatchSetId</code> is returned by <code>CreateByteMatchSet</code> and by <code>ListByteMatchSets</code>.</p>
139 pub fn byte_match_set_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140 self.inner = self.inner.byte_match_set_id(input.into());
141 self
142 }
143 /// <p>The <code>ByteMatchSetId</code> of the <code>ByteMatchSet</code> that you want to update. <code>ByteMatchSetId</code> is returned by <code>CreateByteMatchSet</code> and by <code>ListByteMatchSets</code>.</p>
144 pub fn set_byte_match_set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145 self.inner = self.inner.set_byte_match_set_id(input);
146 self
147 }
148 /// <p>The <code>ByteMatchSetId</code> of the <code>ByteMatchSet</code> that you want to update. <code>ByteMatchSetId</code> is returned by <code>CreateByteMatchSet</code> and by <code>ListByteMatchSets</code>.</p>
149 pub fn get_byte_match_set_id(&self) -> &::std::option::Option<::std::string::String> {
150 self.inner.get_byte_match_set_id()
151 }
152 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
153 pub fn change_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154 self.inner = self.inner.change_token(input.into());
155 self
156 }
157 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
158 pub fn set_change_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
159 self.inner = self.inner.set_change_token(input);
160 self
161 }
162 /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
163 pub fn get_change_token(&self) -> &::std::option::Option<::std::string::String> {
164 self.inner.get_change_token()
165 }
166 ///
167 /// Appends an item to `Updates`.
168 ///
169 /// To override the contents of this collection use [`set_updates`](Self::set_updates).
170 ///
171 /// <p>An array of <code>ByteMatchSetUpdate</code> objects that you want to insert into or delete from a <code>ByteMatchSet</code>. For more information, see the applicable data types:</p>
172 /// <ul>
173 /// <li>
174 /// <p><code>ByteMatchSetUpdate</code>: Contains <code>Action</code> and <code>ByteMatchTuple</code></p></li>
175 /// <li>
176 /// <p><code>ByteMatchTuple</code>: Contains <code>FieldToMatch</code>, <code>PositionalConstraint</code>, <code>TargetString</code>, and <code>TextTransformation</code></p></li>
177 /// <li>
178 /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
179 /// </ul>
180 pub fn updates(mut self, input: crate::types::ByteMatchSetUpdate) -> Self {
181 self.inner = self.inner.updates(input);
182 self
183 }
184 /// <p>An array of <code>ByteMatchSetUpdate</code> objects that you want to insert into or delete from a <code>ByteMatchSet</code>. For more information, see the applicable data types:</p>
185 /// <ul>
186 /// <li>
187 /// <p><code>ByteMatchSetUpdate</code>: Contains <code>Action</code> and <code>ByteMatchTuple</code></p></li>
188 /// <li>
189 /// <p><code>ByteMatchTuple</code>: Contains <code>FieldToMatch</code>, <code>PositionalConstraint</code>, <code>TargetString</code>, and <code>TextTransformation</code></p></li>
190 /// <li>
191 /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
192 /// </ul>
193 pub fn set_updates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ByteMatchSetUpdate>>) -> Self {
194 self.inner = self.inner.set_updates(input);
195 self
196 }
197 /// <p>An array of <code>ByteMatchSetUpdate</code> objects that you want to insert into or delete from a <code>ByteMatchSet</code>. For more information, see the applicable data types:</p>
198 /// <ul>
199 /// <li>
200 /// <p><code>ByteMatchSetUpdate</code>: Contains <code>Action</code> and <code>ByteMatchTuple</code></p></li>
201 /// <li>
202 /// <p><code>ByteMatchTuple</code>: Contains <code>FieldToMatch</code>, <code>PositionalConstraint</code>, <code>TargetString</code>, and <code>TextTransformation</code></p></li>
203 /// <li>
204 /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
205 /// </ul>
206 pub fn get_updates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ByteMatchSetUpdate>> {
207 self.inner.get_updates()
208 }
209}