aws_sdk_ec2/operation/allocate_ipam_pool_cidr/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::allocate_ipam_pool_cidr::_allocate_ipam_pool_cidr_output::AllocateIpamPoolCidrOutputBuilder;
3
4pub use crate::operation::allocate_ipam_pool_cidr::_allocate_ipam_pool_cidr_input::AllocateIpamPoolCidrInputBuilder;
5
6impl crate::operation::allocate_ipam_pool_cidr::builders::AllocateIpamPoolCidrInputBuilder {
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::allocate_ipam_pool_cidr::AllocateIpamPoolCidrOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.allocate_ipam_pool_cidr();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AllocateIpamPoolCidr`.
24///
25/// <p>Allocate a CIDR from an IPAM pool. The Region you use should be the IPAM pool locale. The locale is the Amazon Web Services Region where this IPAM pool is available for allocations.</p>
26/// <p>In IPAM, an allocation is a CIDR assignment from an IPAM pool to another IPAM pool or to a resource. For more information, see <a href="https://docs.aws.amazon.com/vpc/latest/ipam/allocate-cidrs-ipam.html">Allocate CIDRs</a> in the <i>Amazon VPC IPAM User Guide</i>.</p><note>
27/// <p>This action creates an allocation with strong consistency. The returned CIDR will not overlap with any other allocations from the same pool.</p>
28/// </note>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct AllocateIpamPoolCidrFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::allocate_ipam_pool_cidr::builders::AllocateIpamPoolCidrInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrOutput,
38        crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrError,
39    > for AllocateIpamPoolCidrFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrOutput,
47            crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl AllocateIpamPoolCidrFluentBuilder {
54    /// Creates a new `AllocateIpamPoolCidrFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the AllocateIpamPoolCidr as a reference.
63    pub fn as_input(&self) -> &crate::operation::allocate_ipam_pool_cidr::builders::AllocateIpamPoolCidrInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidr::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidr::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrOutput,
100        crate::operation::allocate_ipam_pool_cidr::AllocateIpamPoolCidrError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <p>A check for whether you have the required permissions for the action without actually making the request and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
115    pub fn dry_run(mut self, input: bool) -> Self {
116        self.inner = self.inner.dry_run(input);
117        self
118    }
119    /// <p>A check for whether you have the required permissions for the action without actually making the request and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
120    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
121        self.inner = self.inner.set_dry_run(input);
122        self
123    }
124    /// <p>A check for whether you have the required permissions for the action without actually making the request and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
125    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
126        self.inner.get_dry_run()
127    }
128    /// <p>The ID of the IPAM pool from which you would like to allocate a CIDR.</p>
129    pub fn ipam_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.inner = self.inner.ipam_pool_id(input.into());
131        self
132    }
133    /// <p>The ID of the IPAM pool from which you would like to allocate a CIDR.</p>
134    pub fn set_ipam_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.inner = self.inner.set_ipam_pool_id(input);
136        self
137    }
138    /// <p>The ID of the IPAM pool from which you would like to allocate a CIDR.</p>
139    pub fn get_ipam_pool_id(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_ipam_pool_id()
141    }
142    /// <p>The CIDR you would like to allocate from the IPAM pool. Note the following:</p>
143    /// <ul>
144    /// <li>
145    /// <p>If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.</p></li>
146    /// <li>
147    /// <p>If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.</p></li>
148    /// </ul>
149    /// <p>Possible values: Any available IPv4 or IPv6 CIDR.</p>
150    pub fn cidr(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.inner = self.inner.cidr(input.into());
152        self
153    }
154    /// <p>The CIDR you would like to allocate from the IPAM pool. Note the following:</p>
155    /// <ul>
156    /// <li>
157    /// <p>If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.</p></li>
158    /// <li>
159    /// <p>If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.</p></li>
160    /// </ul>
161    /// <p>Possible values: Any available IPv4 or IPv6 CIDR.</p>
162    pub fn set_cidr(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163        self.inner = self.inner.set_cidr(input);
164        self
165    }
166    /// <p>The CIDR you would like to allocate from the IPAM pool. Note the following:</p>
167    /// <ul>
168    /// <li>
169    /// <p>If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.</p></li>
170    /// <li>
171    /// <p>If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.</p></li>
172    /// </ul>
173    /// <p>Possible values: Any available IPv4 or IPv6 CIDR.</p>
174    pub fn get_cidr(&self) -> &::std::option::Option<::std::string::String> {
175        self.inner.get_cidr()
176    }
177    /// <p>The netmask length of the CIDR you would like to allocate from the IPAM pool. Note the following:</p>
178    /// <ul>
179    /// <li>
180    /// <p>If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.</p></li>
181    /// <li>
182    /// <p>If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.</p></li>
183    /// </ul>
184    /// <p>Possible netmask lengths for IPv4 addresses are 0 - 32. Possible netmask lengths for IPv6 addresses are 0 - 128.</p>
185    pub fn netmask_length(mut self, input: i32) -> Self {
186        self.inner = self.inner.netmask_length(input);
187        self
188    }
189    /// <p>The netmask length of the CIDR you would like to allocate from the IPAM pool. Note the following:</p>
190    /// <ul>
191    /// <li>
192    /// <p>If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.</p></li>
193    /// <li>
194    /// <p>If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.</p></li>
195    /// </ul>
196    /// <p>Possible netmask lengths for IPv4 addresses are 0 - 32. Possible netmask lengths for IPv6 addresses are 0 - 128.</p>
197    pub fn set_netmask_length(mut self, input: ::std::option::Option<i32>) -> Self {
198        self.inner = self.inner.set_netmask_length(input);
199        self
200    }
201    /// <p>The netmask length of the CIDR you would like to allocate from the IPAM pool. Note the following:</p>
202    /// <ul>
203    /// <li>
204    /// <p>If there is no DefaultNetmaskLength allocation rule set on the pool, you must specify either the NetmaskLength or the CIDR.</p></li>
205    /// <li>
206    /// <p>If the DefaultNetmaskLength allocation rule is set on the pool, you can specify either the NetmaskLength or the CIDR and the DefaultNetmaskLength allocation rule will be ignored.</p></li>
207    /// </ul>
208    /// <p>Possible netmask lengths for IPv4 addresses are 0 - 32. Possible netmask lengths for IPv6 addresses are 0 - 128.</p>
209    pub fn get_netmask_length(&self) -> &::std::option::Option<i32> {
210        self.inner.get_netmask_length()
211    }
212    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
213    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
214        self.inner = self.inner.client_token(input.into());
215        self
216    }
217    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
218    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219        self.inner = self.inner.set_client_token(input);
220        self
221    }
222    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
223    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
224        self.inner.get_client_token()
225    }
226    /// <p>A description for the allocation.</p>
227    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
228        self.inner = self.inner.description(input.into());
229        self
230    }
231    /// <p>A description for the allocation.</p>
232    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
233        self.inner = self.inner.set_description(input);
234        self
235    }
236    /// <p>A description for the allocation.</p>
237    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
238        self.inner.get_description()
239    }
240    /// <p>A preview of the next available CIDR in a pool.</p>
241    pub fn preview_next_cidr(mut self, input: bool) -> Self {
242        self.inner = self.inner.preview_next_cidr(input);
243        self
244    }
245    /// <p>A preview of the next available CIDR in a pool.</p>
246    pub fn set_preview_next_cidr(mut self, input: ::std::option::Option<bool>) -> Self {
247        self.inner = self.inner.set_preview_next_cidr(input);
248        self
249    }
250    /// <p>A preview of the next available CIDR in a pool.</p>
251    pub fn get_preview_next_cidr(&self) -> &::std::option::Option<bool> {
252        self.inner.get_preview_next_cidr()
253    }
254    ///
255    /// Appends an item to `AllowedCidrs`.
256    ///
257    /// To override the contents of this collection use [`set_allowed_cidrs`](Self::set_allowed_cidrs).
258    ///
259    /// <p>Include a particular CIDR range that can be returned by the pool. Allowed CIDRs are only allowed if using netmask length for allocation.</p>
260    pub fn allowed_cidrs(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
261        self.inner = self.inner.allowed_cidrs(input.into());
262        self
263    }
264    /// <p>Include a particular CIDR range that can be returned by the pool. Allowed CIDRs are only allowed if using netmask length for allocation.</p>
265    pub fn set_allowed_cidrs(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
266        self.inner = self.inner.set_allowed_cidrs(input);
267        self
268    }
269    /// <p>Include a particular CIDR range that can be returned by the pool. Allowed CIDRs are only allowed if using netmask length for allocation.</p>
270    pub fn get_allowed_cidrs(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
271        self.inner.get_allowed_cidrs()
272    }
273    ///
274    /// Appends an item to `DisallowedCidrs`.
275    ///
276    /// To override the contents of this collection use [`set_disallowed_cidrs`](Self::set_disallowed_cidrs).
277    ///
278    /// <p>Exclude a particular CIDR range from being returned by the pool. Disallowed CIDRs are only allowed if using netmask length for allocation.</p>
279    pub fn disallowed_cidrs(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
280        self.inner = self.inner.disallowed_cidrs(input.into());
281        self
282    }
283    /// <p>Exclude a particular CIDR range from being returned by the pool. Disallowed CIDRs are only allowed if using netmask length for allocation.</p>
284    pub fn set_disallowed_cidrs(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
285        self.inner = self.inner.set_disallowed_cidrs(input);
286        self
287    }
288    /// <p>Exclude a particular CIDR range from being returned by the pool. Disallowed CIDRs are only allowed if using netmask length for allocation.</p>
289    pub fn get_disallowed_cidrs(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
290        self.inner.get_disallowed_cidrs()
291    }
292}