aws_sdk_waf/operation/update_ip_set/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_ip_set::_update_ip_set_output::UpdateIpSetOutputBuilder;
3
4pub use crate::operation::update_ip_set::_update_ip_set_input::UpdateIpSetInputBuilder;
5
6impl crate::operation::update_ip_set::builders::UpdateIpSetInputBuilder {
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_ip_set::UpdateIpSetOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_ip_set::UpdateIPSetError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_ip_set();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateIPSet`.
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>IPSetDescriptor</code> objects in an <code>IPSet</code>. For each <code>IPSetDescriptor</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 an <code>IPSetDescriptor</code> object, you delete the existing object and add a new one.</p></li>
33/// <li>
34/// <p>The IP address version, <code>IPv4</code> or <code>IPv6</code>.</p></li>
35/// <li>
36/// <p>The IP address in CIDR notation, for example, <code>192.0.2.0/24</code> (for the range of IP addresses from <code>192.0.2.0</code> to <code>192.0.2.255</code>) or <code>192.0.2.44/32</code> (for the individual IP address <code>192.0.2.44</code>).</p></li>
37/// </ul>
38/// <p>AWS WAF supports IPv4 address ranges: /8 and any range between /16 through /32. AWS WAF supports IPv6 address ranges: /24, /32, /48, /56, /64, and /128. For more information about CIDR notation, see the Wikipedia entry <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">Classless Inter-Domain Routing</a>.</p>
39/// <p>IPv6 addresses can be represented using any of the following formats:</p>
40/// <ul>
41/// <li>
42/// <p>1111:0000:0000:0000:0000:0000:0000:0111/128</p></li>
43/// <li>
44/// <p>1111:0:0:0:0:0:0:0111/128</p></li>
45/// <li>
46/// <p>1111::0111/128</p></li>
47/// <li>
48/// <p>1111::111/128</p></li>
49/// </ul>
50/// <p>You use an <code>IPSet</code> to specify which web requests you want to allow or block based on the IP addresses that the requests originated from. For example, if you're receiving a lot of requests from one or a small number of IP addresses and you want to block the requests, you can create an <code>IPSet</code> that specifies those IP addresses, and then configure AWS WAF to block the requests.</p>
51/// <p>To create and configure an <code>IPSet</code>, perform the following steps:</p>
52/// <ol>
53/// <li>
54/// <p>Submit a <code>CreateIPSet</code> request.</p></li>
55/// <li>
56/// <p>Use <code>GetChangeToken</code> to get the change token that you provide in the <code>ChangeToken</code> parameter of an <code>UpdateIPSet</code> request.</p></li>
57/// <li>
58/// <p>Submit an <code>UpdateIPSet</code> request to specify the IP addresses that you want AWS WAF to watch for.</p></li>
59/// </ol>
60/// <p>When you update an <code>IPSet</code>, you specify the IP addresses that you want to add and/or the IP addresses that you want to delete. If you want to change an IP address, you delete the existing IP address and add the new one.</p>
61/// <p>You can insert a maximum of 1000 addresses in a single request.</p>
62/// <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>
63#[derive(::std::clone::Clone, ::std::fmt::Debug)]
64pub struct UpdateIPSetFluentBuilder {
65    handle: ::std::sync::Arc<crate::client::Handle>,
66    inner: crate::operation::update_ip_set::builders::UpdateIpSetInputBuilder,
67    config_override: ::std::option::Option<crate::config::Builder>,
68}
69impl
70    crate::client::customize::internal::CustomizableSend<
71        crate::operation::update_ip_set::UpdateIpSetOutput,
72        crate::operation::update_ip_set::UpdateIPSetError,
73    > for UpdateIPSetFluentBuilder
74{
75    fn send(
76        self,
77        config_override: crate::config::Builder,
78    ) -> crate::client::customize::internal::BoxFuture<
79        crate::client::customize::internal::SendResult<
80            crate::operation::update_ip_set::UpdateIpSetOutput,
81            crate::operation::update_ip_set::UpdateIPSetError,
82        >,
83    > {
84        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
85    }
86}
87impl UpdateIPSetFluentBuilder {
88    /// Creates a new `UpdateIPSetFluentBuilder`.
89    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
90        Self {
91            handle,
92            inner: ::std::default::Default::default(),
93            config_override: ::std::option::Option::None,
94        }
95    }
96    /// Access the UpdateIPSet as a reference.
97    pub fn as_input(&self) -> &crate::operation::update_ip_set::builders::UpdateIpSetInputBuilder {
98        &self.inner
99    }
100    /// Sends the request and returns the response.
101    ///
102    /// If an error occurs, an `SdkError` will be returned with additional details that
103    /// can be matched against.
104    ///
105    /// By default, any retryable failures will be retried twice. Retry behavior
106    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
107    /// set when configuring the client.
108    pub async fn send(
109        self,
110    ) -> ::std::result::Result<
111        crate::operation::update_ip_set::UpdateIpSetOutput,
112        ::aws_smithy_runtime_api::client::result::SdkError<
113            crate::operation::update_ip_set::UpdateIPSetError,
114            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
115        >,
116    > {
117        let input = self
118            .inner
119            .build()
120            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
121        let runtime_plugins = crate::operation::update_ip_set::UpdateIPSet::operation_runtime_plugins(
122            self.handle.runtime_plugins.clone(),
123            &self.handle.conf,
124            self.config_override,
125        );
126        crate::operation::update_ip_set::UpdateIPSet::orchestrate(&runtime_plugins, input).await
127    }
128
129    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
130    pub fn customize(
131        self,
132    ) -> crate::client::customize::CustomizableOperation<
133        crate::operation::update_ip_set::UpdateIpSetOutput,
134        crate::operation::update_ip_set::UpdateIPSetError,
135        Self,
136    > {
137        crate::client::customize::CustomizableOperation::new(self)
138    }
139    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
140        self.set_config_override(::std::option::Option::Some(config_override.into()));
141        self
142    }
143
144    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
145        self.config_override = config_override;
146        self
147    }
148    /// <p>The <code>IPSetId</code> of the <code>IPSet</code> that you want to update. <code>IPSetId</code> is returned by <code>CreateIPSet</code> and by <code>ListIPSets</code>.</p>
149    pub fn ip_set_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150        self.inner = self.inner.ip_set_id(input.into());
151        self
152    }
153    /// <p>The <code>IPSetId</code> of the <code>IPSet</code> that you want to update. <code>IPSetId</code> is returned by <code>CreateIPSet</code> and by <code>ListIPSets</code>.</p>
154    pub fn set_ip_set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155        self.inner = self.inner.set_ip_set_id(input);
156        self
157    }
158    /// <p>The <code>IPSetId</code> of the <code>IPSet</code> that you want to update. <code>IPSetId</code> is returned by <code>CreateIPSet</code> and by <code>ListIPSets</code>.</p>
159    pub fn get_ip_set_id(&self) -> &::std::option::Option<::std::string::String> {
160        self.inner.get_ip_set_id()
161    }
162    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
163    pub fn change_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.inner = self.inner.change_token(input.into());
165        self
166    }
167    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
168    pub fn set_change_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.inner = self.inner.set_change_token(input);
170        self
171    }
172    /// <p>The value returned by the most recent call to <code>GetChangeToken</code>.</p>
173    pub fn get_change_token(&self) -> &::std::option::Option<::std::string::String> {
174        self.inner.get_change_token()
175    }
176    ///
177    /// Appends an item to `Updates`.
178    ///
179    /// To override the contents of this collection use [`set_updates`](Self::set_updates).
180    ///
181    /// <p>An array of <code>IPSetUpdate</code> objects that you want to insert into or delete from an <code>IPSet</code>. For more information, see the applicable data types:</p>
182    /// <ul>
183    /// <li>
184    /// <p><code>IPSetUpdate</code>: Contains <code>Action</code> and <code>IPSetDescriptor</code></p></li>
185    /// <li>
186    /// <p><code>IPSetDescriptor</code>: Contains <code>Type</code> and <code>Value</code></p></li>
187    /// </ul>
188    /// <p>You can insert a maximum of 1000 addresses in a single request.</p>
189    pub fn updates(mut self, input: crate::types::IpSetUpdate) -> Self {
190        self.inner = self.inner.updates(input);
191        self
192    }
193    /// <p>An array of <code>IPSetUpdate</code> objects that you want to insert into or delete from an <code>IPSet</code>. For more information, see the applicable data types:</p>
194    /// <ul>
195    /// <li>
196    /// <p><code>IPSetUpdate</code>: Contains <code>Action</code> and <code>IPSetDescriptor</code></p></li>
197    /// <li>
198    /// <p><code>IPSetDescriptor</code>: Contains <code>Type</code> and <code>Value</code></p></li>
199    /// </ul>
200    /// <p>You can insert a maximum of 1000 addresses in a single request.</p>
201    pub fn set_updates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::IpSetUpdate>>) -> Self {
202        self.inner = self.inner.set_updates(input);
203        self
204    }
205    /// <p>An array of <code>IPSetUpdate</code> objects that you want to insert into or delete from an <code>IPSet</code>. For more information, see the applicable data types:</p>
206    /// <ul>
207    /// <li>
208    /// <p><code>IPSetUpdate</code>: Contains <code>Action</code> and <code>IPSetDescriptor</code></p></li>
209    /// <li>
210    /// <p><code>IPSetDescriptor</code>: Contains <code>Type</code> and <code>Value</code></p></li>
211    /// </ul>
212    /// <p>You can insert a maximum of 1000 addresses in a single request.</p>
213    pub fn get_updates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::IpSetUpdate>> {
214        self.inner.get_updates()
215    }
216}