aws_sdk_wafv2/operation/create_ip_set/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_ip_set::_create_ip_set_output::CreateIpSetOutputBuilder;
3
4pub use crate::operation::create_ip_set::_create_ip_set_input::CreateIpSetInputBuilder;
5
6impl crate::operation::create_ip_set::builders::CreateIpSetInputBuilder {
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_ip_set::CreateIpSetOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_ip_set::CreateIPSetError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_ip_set();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateIPSet`.
24///
25/// <p>Creates an <code>IPSet</code>, which you use to identify web requests that originate from specific IP addresses or ranges of IP addresses. For example, if you're receiving a lot of requests from a ranges of IP addresses, you can configure WAF to block them using an IPSet that lists those IP addresses.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateIPSetFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::create_ip_set::builders::CreateIpSetInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33 crate::client::customize::internal::CustomizableSend<
34 crate::operation::create_ip_set::CreateIpSetOutput,
35 crate::operation::create_ip_set::CreateIPSetError,
36 > for CreateIPSetFluentBuilder
37{
38 fn send(
39 self,
40 config_override: crate::config::Builder,
41 ) -> crate::client::customize::internal::BoxFuture<
42 crate::client::customize::internal::SendResult<
43 crate::operation::create_ip_set::CreateIpSetOutput,
44 crate::operation::create_ip_set::CreateIPSetError,
45 >,
46 > {
47 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48 }
49}
50impl CreateIPSetFluentBuilder {
51 /// Creates a new `CreateIPSetFluentBuilder`.
52 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53 Self {
54 handle,
55 inner: ::std::default::Default::default(),
56 config_override: ::std::option::Option::None,
57 }
58 }
59 /// Access the CreateIPSet as a reference.
60 pub fn as_input(&self) -> &crate::operation::create_ip_set::builders::CreateIpSetInputBuilder {
61 &self.inner
62 }
63 /// Sends the request and returns the response.
64 ///
65 /// If an error occurs, an `SdkError` will be returned with additional details that
66 /// can be matched against.
67 ///
68 /// By default, any retryable failures will be retried twice. Retry behavior
69 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70 /// set when configuring the client.
71 pub async fn send(
72 self,
73 ) -> ::std::result::Result<
74 crate::operation::create_ip_set::CreateIpSetOutput,
75 ::aws_smithy_runtime_api::client::result::SdkError<
76 crate::operation::create_ip_set::CreateIPSetError,
77 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78 >,
79 > {
80 let input = self
81 .inner
82 .build()
83 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84 let runtime_plugins = crate::operation::create_ip_set::CreateIPSet::operation_runtime_plugins(
85 self.handle.runtime_plugins.clone(),
86 &self.handle.conf,
87 self.config_override,
88 );
89 crate::operation::create_ip_set::CreateIPSet::orchestrate(&runtime_plugins, input).await
90 }
91
92 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93 pub fn customize(
94 self,
95 ) -> crate::client::customize::CustomizableOperation<
96 crate::operation::create_ip_set::CreateIpSetOutput,
97 crate::operation::create_ip_set::CreateIPSetError,
98 Self,
99 > {
100 crate::client::customize::CustomizableOperation::new(self)
101 }
102 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103 self.set_config_override(::std::option::Option::Some(config_override.into()));
104 self
105 }
106
107 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108 self.config_override = config_override;
109 self
110 }
111 /// <p>The name of the IP set. You cannot change the name of an <code>IPSet</code> after you create it.</p>
112 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113 self.inner = self.inner.name(input.into());
114 self
115 }
116 /// <p>The name of the IP set. You cannot change the name of an <code>IPSet</code> after you create it.</p>
117 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118 self.inner = self.inner.set_name(input);
119 self
120 }
121 /// <p>The name of the IP set. You cannot change the name of an <code>IPSet</code> after you create it.</p>
122 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
123 self.inner.get_name()
124 }
125 /// <p>Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use <code>CLOUDFRONT</code>.</p>
126 /// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:</p>
127 /// <ul>
128 /// <li>
129 /// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>.</p></li>
130 /// <li>
131 /// <p>API and SDKs - For all calls, use the Region endpoint us-east-1.</p></li>
132 /// </ul>
133 pub fn scope(mut self, input: crate::types::Scope) -> Self {
134 self.inner = self.inner.scope(input);
135 self
136 }
137 /// <p>Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use <code>CLOUDFRONT</code>.</p>
138 /// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:</p>
139 /// <ul>
140 /// <li>
141 /// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>.</p></li>
142 /// <li>
143 /// <p>API and SDKs - For all calls, use the Region endpoint us-east-1.</p></li>
144 /// </ul>
145 pub fn set_scope(mut self, input: ::std::option::Option<crate::types::Scope>) -> Self {
146 self.inner = self.inner.set_scope(input);
147 self
148 }
149 /// <p>Specifies whether this is for a global resource type, such as a Amazon CloudFront distribution. For an Amplify application, use <code>CLOUDFRONT</code>.</p>
150 /// <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:</p>
151 /// <ul>
152 /// <li>
153 /// <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>.</p></li>
154 /// <li>
155 /// <p>API and SDKs - For all calls, use the Region endpoint us-east-1.</p></li>
156 /// </ul>
157 pub fn get_scope(&self) -> &::std::option::Option<crate::types::Scope> {
158 self.inner.get_scope()
159 }
160 /// <p>A description of the IP set that helps with identification.</p>
161 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162 self.inner = self.inner.description(input.into());
163 self
164 }
165 /// <p>A description of the IP set that helps with identification.</p>
166 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167 self.inner = self.inner.set_description(input);
168 self
169 }
170 /// <p>A description of the IP set that helps with identification.</p>
171 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
172 self.inner.get_description()
173 }
174 /// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>.</p>
175 pub fn ip_address_version(mut self, input: crate::types::IpAddressVersion) -> Self {
176 self.inner = self.inner.ip_address_version(input);
177 self
178 }
179 /// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>.</p>
180 pub fn set_ip_address_version(mut self, input: ::std::option::Option<crate::types::IpAddressVersion>) -> Self {
181 self.inner = self.inner.set_ip_address_version(input);
182 self
183 }
184 /// <p>The version of the IP addresses, either <code>IPV4</code> or <code>IPV6</code>.</p>
185 pub fn get_ip_address_version(&self) -> &::std::option::Option<crate::types::IpAddressVersion> {
186 self.inner.get_ip_address_version()
187 }
188 ///
189 /// Appends an item to `Addresses`.
190 ///
191 /// To override the contents of this collection use [`set_addresses`](Self::set_addresses).
192 ///
193 /// <p>Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses that you want WAF to inspect for in incoming requests. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for <code>/0</code>.</p>
194 /// <p>Example address strings:</p>
195 /// <ul>
196 /// <li>
197 /// <p>For requests that originated from the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>.</p></li>
198 /// <li>
199 /// <p>For requests that originated from IP addresses from 192.0.2.0 to 192.0.2.255, specify <code>192.0.2.0/24</code>.</p></li>
200 /// <li>
201 /// <p>For requests that originated from the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify <code>1111:0000:0000:0000:0000:0000:0000:0111/128</code>.</p></li>
202 /// <li>
203 /// <p>For requests that originated from IP addresses 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify <code>1111:0000:0000:0000:0000:0000:0000:0000/64</code>.</p></li>
204 /// </ul>
205 /// <p>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>
206 /// <p>Example JSON <code>Addresses</code> specifications:</p>
207 /// <ul>
208 /// <li>
209 /// <p>Empty array: <code>"Addresses": \[\]</code></p></li>
210 /// <li>
211 /// <p>Array with one address: <code>"Addresses": \["192.0.2.44/32"\]</code></p></li>
212 /// <li>
213 /// <p>Array with three addresses: <code>"Addresses": \["192.0.2.44/32", "192.0.2.0/24", "192.0.0.0/16"\]</code></p></li>
214 /// <li>
215 /// <p>INVALID specification: <code>"Addresses": \[""\]</code> INVALID</p></li>
216 /// </ul>
217 pub fn addresses(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
218 self.inner = self.inner.addresses(input.into());
219 self
220 }
221 /// <p>Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses that you want WAF to inspect for in incoming requests. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for <code>/0</code>.</p>
222 /// <p>Example address strings:</p>
223 /// <ul>
224 /// <li>
225 /// <p>For requests that originated from the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>.</p></li>
226 /// <li>
227 /// <p>For requests that originated from IP addresses from 192.0.2.0 to 192.0.2.255, specify <code>192.0.2.0/24</code>.</p></li>
228 /// <li>
229 /// <p>For requests that originated from the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify <code>1111:0000:0000:0000:0000:0000:0000:0111/128</code>.</p></li>
230 /// <li>
231 /// <p>For requests that originated from IP addresses 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify <code>1111:0000:0000:0000:0000:0000:0000:0000/64</code>.</p></li>
232 /// </ul>
233 /// <p>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>
234 /// <p>Example JSON <code>Addresses</code> specifications:</p>
235 /// <ul>
236 /// <li>
237 /// <p>Empty array: <code>"Addresses": \[\]</code></p></li>
238 /// <li>
239 /// <p>Array with one address: <code>"Addresses": \["192.0.2.44/32"\]</code></p></li>
240 /// <li>
241 /// <p>Array with three addresses: <code>"Addresses": \["192.0.2.44/32", "192.0.2.0/24", "192.0.0.0/16"\]</code></p></li>
242 /// <li>
243 /// <p>INVALID specification: <code>"Addresses": \[""\]</code> INVALID</p></li>
244 /// </ul>
245 pub fn set_addresses(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
246 self.inner = self.inner.set_addresses(input);
247 self
248 }
249 /// <p>Contains an array of strings that specifies zero or more IP addresses or blocks of IP addresses that you want WAF to inspect for in incoming requests. All addresses must be specified using Classless Inter-Domain Routing (CIDR) notation. WAF supports all IPv4 and IPv6 CIDR ranges except for <code>/0</code>.</p>
250 /// <p>Example address strings:</p>
251 /// <ul>
252 /// <li>
253 /// <p>For requests that originated from the IP address 192.0.2.44, specify <code>192.0.2.44/32</code>.</p></li>
254 /// <li>
255 /// <p>For requests that originated from IP addresses from 192.0.2.0 to 192.0.2.255, specify <code>192.0.2.0/24</code>.</p></li>
256 /// <li>
257 /// <p>For requests that originated from the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify <code>1111:0000:0000:0000:0000:0000:0000:0111/128</code>.</p></li>
258 /// <li>
259 /// <p>For requests that originated from IP addresses 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify <code>1111:0000:0000:0000:0000:0000:0000:0000/64</code>.</p></li>
260 /// </ul>
261 /// <p>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>
262 /// <p>Example JSON <code>Addresses</code> specifications:</p>
263 /// <ul>
264 /// <li>
265 /// <p>Empty array: <code>"Addresses": \[\]</code></p></li>
266 /// <li>
267 /// <p>Array with one address: <code>"Addresses": \["192.0.2.44/32"\]</code></p></li>
268 /// <li>
269 /// <p>Array with three addresses: <code>"Addresses": \["192.0.2.44/32", "192.0.2.0/24", "192.0.0.0/16"\]</code></p></li>
270 /// <li>
271 /// <p>INVALID specification: <code>"Addresses": \[""\]</code> INVALID</p></li>
272 /// </ul>
273 pub fn get_addresses(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
274 self.inner.get_addresses()
275 }
276 ///
277 /// Appends an item to `Tags`.
278 ///
279 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
280 ///
281 /// <p>An array of key:value pairs to associate with the resource.</p>
282 pub fn tags(mut self, input: crate::types::Tag) -> Self {
283 self.inner = self.inner.tags(input);
284 self
285 }
286 /// <p>An array of key:value pairs to associate with the resource.</p>
287 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
288 self.inner = self.inner.set_tags(input);
289 self
290 }
291 /// <p>An array of key:value pairs to associate with the resource.</p>
292 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
293 self.inner.get_tags()
294 }
295}