aws_sdk_waf/operation/update_size_constraint_set/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_size_constraint_set::_update_size_constraint_set_output::UpdateSizeConstraintSetOutputBuilder;
3
4pub use crate::operation::update_size_constraint_set::_update_size_constraint_set_input::UpdateSizeConstraintSetInputBuilder;
5
6impl crate::operation::update_size_constraint_set::builders::UpdateSizeConstraintSetInputBuilder {
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_size_constraint_set::UpdateSizeConstraintSetOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_size_constraint_set::UpdateSizeConstraintSetError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_size_constraint_set();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateSizeConstraintSet`.
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>SizeConstraint</code> objects (filters) in a <code>SizeConstraintSet</code>. For each <code>SizeConstraint</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>SizeConstraintSetUpdate</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 evaluate, such as the length of a query string or the length of the <code>User-Agent</code> header.</p></li>
35/// <li>
36/// <p>Whether to perform any transformations on the request, such as converting it to lowercase, before checking its length. Note that transformations of the request body are not supported because the AWS resource forwards only the first <code>8192</code> bytes of your request to AWS WAF.</p>
37/// <p>You can only specify a single type of TextTransformation.</p></li>
38/// <li>
39/// <p>A <code>ComparisonOperator</code> used for evaluating the selected part of the request against the specified <code>Size</code>, such as equals, greater than, less than, and so on.</p></li>
40/// <li>
41/// <p>The length, in bytes, that you want AWS WAF to watch for in selected part of the request. The length is computed after applying the transformation.</p></li>
42/// </ul>
43/// <p>For example, you can add a <code>SizeConstraintSetUpdate</code> object that matches web requests in which the length of the <code>User-Agent</code> header is greater than 100 bytes. You can then configure AWS WAF to block those requests.</p>
44/// <p>To create and configure a <code>SizeConstraintSet</code>, perform the following steps:</p>
45/// <ol>
46/// <li>
47/// <p>Create a <code>SizeConstraintSet.</code> For more information, see <code>CreateSizeConstraintSet</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>UpdateSizeConstraintSet</code> request.</p></li>
50/// <li>
51/// <p>Submit an <code>UpdateSizeConstraintSet</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>
52/// </ol>
53/// <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>
54#[derive(::std::clone::Clone, ::std::fmt::Debug)]
55pub struct UpdateSizeConstraintSetFluentBuilder {
56    handle: ::std::sync::Arc<crate::client::Handle>,
57    inner: crate::operation::update_size_constraint_set::builders::UpdateSizeConstraintSetInputBuilder,
58    config_override: ::std::option::Option<crate::config::Builder>,
59}
60impl
61    crate::client::customize::internal::CustomizableSend<
62        crate::operation::update_size_constraint_set::UpdateSizeConstraintSetOutput,
63        crate::operation::update_size_constraint_set::UpdateSizeConstraintSetError,
64    > for UpdateSizeConstraintSetFluentBuilder
65{
66    fn send(
67        self,
68        config_override: crate::config::Builder,
69    ) -> crate::client::customize::internal::BoxFuture<
70        crate::client::customize::internal::SendResult<
71            crate::operation::update_size_constraint_set::UpdateSizeConstraintSetOutput,
72            crate::operation::update_size_constraint_set::UpdateSizeConstraintSetError,
73        >,
74    > {
75        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
76    }
77}
78impl UpdateSizeConstraintSetFluentBuilder {
79    /// Creates a new `UpdateSizeConstraintSetFluentBuilder`.
80    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
81        Self {
82            handle,
83            inner: ::std::default::Default::default(),
84            config_override: ::std::option::Option::None,
85        }
86    }
87    /// Access the UpdateSizeConstraintSet as a reference.
88    pub fn as_input(&self) -> &crate::operation::update_size_constraint_set::builders::UpdateSizeConstraintSetInputBuilder {
89        &self.inner
90    }
91    /// Sends the request and returns the response.
92    ///
93    /// If an error occurs, an `SdkError` will be returned with additional details that
94    /// can be matched against.
95    ///
96    /// By default, any retryable failures will be retried twice. Retry behavior
97    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
98    /// set when configuring the client.
99    pub async fn send(
100        self,
101    ) -> ::std::result::Result<
102        crate::operation::update_size_constraint_set::UpdateSizeConstraintSetOutput,
103        ::aws_smithy_runtime_api::client::result::SdkError<
104            crate::operation::update_size_constraint_set::UpdateSizeConstraintSetError,
105            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
106        >,
107    > {
108        let input = self
109            .inner
110            .build()
111            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
112        let runtime_plugins = crate::operation::update_size_constraint_set::UpdateSizeConstraintSet::operation_runtime_plugins(
113            self.handle.runtime_plugins.clone(),
114            &self.handle.conf,
115            self.config_override,
116        );
117        crate::operation::update_size_constraint_set::UpdateSizeConstraintSet::orchestrate(&runtime_plugins, input).await
118    }
119
120    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
121    pub fn customize(
122        self,
123    ) -> crate::client::customize::CustomizableOperation<
124        crate::operation::update_size_constraint_set::UpdateSizeConstraintSetOutput,
125        crate::operation::update_size_constraint_set::UpdateSizeConstraintSetError,
126        Self,
127    > {
128        crate::client::customize::CustomizableOperation::new(self)
129    }
130    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
131        self.set_config_override(::std::option::Option::Some(config_override.into()));
132        self
133    }
134
135    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
136        self.config_override = config_override;
137        self
138    }
139    /// <p>The <code>SizeConstraintSetId</code> of the <code>SizeConstraintSet</code> that you want to update. <code>SizeConstraintSetId</code> is returned by <code>CreateSizeConstraintSet</code> and by <code>ListSizeConstraintSets</code>.</p>
140    pub fn size_constraint_set_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.size_constraint_set_id(input.into());
142        self
143    }
144    /// <p>The <code>SizeConstraintSetId</code> of the <code>SizeConstraintSet</code> that you want to update. <code>SizeConstraintSetId</code> is returned by <code>CreateSizeConstraintSet</code> and by <code>ListSizeConstraintSets</code>.</p>
145    pub fn set_size_constraint_set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_size_constraint_set_id(input);
147        self
148    }
149    /// <p>The <code>SizeConstraintSetId</code> of the <code>SizeConstraintSet</code> that you want to update. <code>SizeConstraintSetId</code> is returned by <code>CreateSizeConstraintSet</code> and by <code>ListSizeConstraintSets</code>.</p>
150    pub fn get_size_constraint_set_id(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_size_constraint_set_id()
152    }
153    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
154    pub fn change_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155        self.inner = self.inner.change_token(input.into());
156        self
157    }
158    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
159    pub fn set_change_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.inner = self.inner.set_change_token(input);
161        self
162    }
163    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
164    pub fn get_change_token(&self) -> &::std::option::Option<::std::string::String> {
165        self.inner.get_change_token()
166    }
167    ///
168    /// Appends an item to `Updates`.
169    ///
170    /// To override the contents of this collection use [`set_updates`](Self::set_updates).
171    ///
172    /// <p>An array of <code>SizeConstraintSetUpdate</code> objects that you want to insert into or delete from a <code>SizeConstraintSet</code>. For more information, see the applicable data types:</p>
173    /// <ul>
174    /// <li>
175    /// <p><code>SizeConstraintSetUpdate</code>: Contains <code>Action</code> and <code>SizeConstraint</code></p></li>
176    /// <li>
177    /// <p><code>SizeConstraint</code>: Contains <code>FieldToMatch</code>, <code>TextTransformation</code>, <code>ComparisonOperator</code>, and <code>Size</code></p></li>
178    /// <li>
179    /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
180    /// </ul>
181    pub fn updates(mut self, input: crate::types::SizeConstraintSetUpdate) -> Self {
182        self.inner = self.inner.updates(input);
183        self
184    }
185    /// <p>An array of <code>SizeConstraintSetUpdate</code> objects that you want to insert into or delete from a <code>SizeConstraintSet</code>. For more information, see the applicable data types:</p>
186    /// <ul>
187    /// <li>
188    /// <p><code>SizeConstraintSetUpdate</code>: Contains <code>Action</code> and <code>SizeConstraint</code></p></li>
189    /// <li>
190    /// <p><code>SizeConstraint</code>: Contains <code>FieldToMatch</code>, <code>TextTransformation</code>, <code>ComparisonOperator</code>, and <code>Size</code></p></li>
191    /// <li>
192    /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
193    /// </ul>
194    pub fn set_updates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SizeConstraintSetUpdate>>) -> Self {
195        self.inner = self.inner.set_updates(input);
196        self
197    }
198    /// <p>An array of <code>SizeConstraintSetUpdate</code> objects that you want to insert into or delete from a <code>SizeConstraintSet</code>. For more information, see the applicable data types:</p>
199    /// <ul>
200    /// <li>
201    /// <p><code>SizeConstraintSetUpdate</code>: Contains <code>Action</code> and <code>SizeConstraint</code></p></li>
202    /// <li>
203    /// <p><code>SizeConstraint</code>: Contains <code>FieldToMatch</code>, <code>TextTransformation</code>, <code>ComparisonOperator</code>, and <code>Size</code></p></li>
204    /// <li>
205    /// <p><code>FieldToMatch</code>: Contains <code>Data</code> and <code>Type</code></p></li>
206    /// </ul>
207    pub fn get_updates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SizeConstraintSetUpdate>> {
208        self.inner.get_updates()
209    }
210}