aws_sdk_ec2/operation/assign_private_ip_addresses/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::assign_private_ip_addresses::_assign_private_ip_addresses_output::AssignPrivateIpAddressesOutputBuilder;
3
4pub use crate::operation::assign_private_ip_addresses::_assign_private_ip_addresses_input::AssignPrivateIpAddressesInputBuilder;
5
6impl crate::operation::assign_private_ip_addresses::builders::AssignPrivateIpAddressesInputBuilder {
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::assign_private_ip_addresses::AssignPrivateIpAddressesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.assign_private_ip_addresses();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AssignPrivateIpAddresses`.
24///
25/// <p>Assigns the specified secondary private IP addresses to the specified network interface.</p>
26/// <p>You can specify specific secondary IP addresses, or you can specify the number of secondary IP addresses to be automatically assigned from the subnet's CIDR block range. The number of secondary IP addresses that you can assign to an instance varies by instance type. For more information about Elastic IP addresses, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html">Elastic IP Addresses</a> in the <i>Amazon EC2 User Guide</i>.</p>
27/// <p>When you move a secondary private IP address to another network interface, any Elastic IP address that is associated with the IP address is also moved.</p>
28/// <p>Remapping an IP address is an asynchronous operation. When you move an IP address from one network interface to another, check <code>network/interfaces/macs/mac/local-ipv4s</code> in the instance metadata to confirm that the remapping is complete.</p>
29/// <p>You must specify either the IP addresses or the IP address count in the request.</p>
30/// <p>You can optionally use Prefix Delegation on the network interface. You must specify either the IPv4 Prefix Delegation prefixes, or the IPv4 Prefix Delegation count. For information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-prefix-eni.html"> Assigning prefixes to network interfaces</a> in the <i>Amazon EC2 User Guide</i>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct AssignPrivateIpAddressesFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::assign_private_ip_addresses::builders::AssignPrivateIpAddressesInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesOutput,
40        crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesError,
41    > for AssignPrivateIpAddressesFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesOutput,
49            crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl AssignPrivateIpAddressesFluentBuilder {
56    /// Creates a new `AssignPrivateIpAddressesFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the AssignPrivateIpAddresses as a reference.
65    pub fn as_input(&self) -> &crate::operation::assign_private_ip_addresses::builders::AssignPrivateIpAddressesInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins = crate::operation::assign_private_ip_addresses::AssignPrivateIpAddresses::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::assign_private_ip_addresses::AssignPrivateIpAddresses::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesOutput,
102        crate::operation::assign_private_ip_addresses::AssignPrivateIpAddressesError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    ///
117    /// Appends an item to `Ipv4Prefixes`.
118    ///
119    /// To override the contents of this collection use [`set_ipv4_prefixes`](Self::set_ipv4_prefixes).
120    ///
121    /// <p>One or more IPv4 prefixes assigned to the network interface. You can't use this option if you use the <code>Ipv4PrefixCount</code> option.</p>
122    pub fn ipv4_prefixes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.inner = self.inner.ipv4_prefixes(input.into());
124        self
125    }
126    /// <p>One or more IPv4 prefixes assigned to the network interface. You can't use this option if you use the <code>Ipv4PrefixCount</code> option.</p>
127    pub fn set_ipv4_prefixes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
128        self.inner = self.inner.set_ipv4_prefixes(input);
129        self
130    }
131    /// <p>One or more IPv4 prefixes assigned to the network interface. You can't use this option if you use the <code>Ipv4PrefixCount</code> option.</p>
132    pub fn get_ipv4_prefixes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
133        self.inner.get_ipv4_prefixes()
134    }
135    /// <p>The number of IPv4 prefixes that Amazon Web Services automatically assigns to the network interface. You can't use this option if you use the <code>Ipv4 Prefixes</code> option.</p>
136    pub fn ipv4_prefix_count(mut self, input: i32) -> Self {
137        self.inner = self.inner.ipv4_prefix_count(input);
138        self
139    }
140    /// <p>The number of IPv4 prefixes that Amazon Web Services automatically assigns to the network interface. You can't use this option if you use the <code>Ipv4 Prefixes</code> option.</p>
141    pub fn set_ipv4_prefix_count(mut self, input: ::std::option::Option<i32>) -> Self {
142        self.inner = self.inner.set_ipv4_prefix_count(input);
143        self
144    }
145    /// <p>The number of IPv4 prefixes that Amazon Web Services automatically assigns to the network interface. You can't use this option if you use the <code>Ipv4 Prefixes</code> option.</p>
146    pub fn get_ipv4_prefix_count(&self) -> &::std::option::Option<i32> {
147        self.inner.get_ipv4_prefix_count()
148    }
149    /// <p>The ID of the network interface.</p>
150    pub fn network_interface_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.inner = self.inner.network_interface_id(input.into());
152        self
153    }
154    /// <p>The ID of the network interface.</p>
155    pub fn set_network_interface_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.inner = self.inner.set_network_interface_id(input);
157        self
158    }
159    /// <p>The ID of the network interface.</p>
160    pub fn get_network_interface_id(&self) -> &::std::option::Option<::std::string::String> {
161        self.inner.get_network_interface_id()
162    }
163    ///
164    /// Appends an item to `PrivateIpAddresses`.
165    ///
166    /// To override the contents of this collection use [`set_private_ip_addresses`](Self::set_private_ip_addresses).
167    ///
168    /// <p>The IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.</p>
169    /// <p>If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.</p>
170    pub fn private_ip_addresses(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171        self.inner = self.inner.private_ip_addresses(input.into());
172        self
173    }
174    /// <p>The IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.</p>
175    /// <p>If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.</p>
176    pub fn set_private_ip_addresses(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
177        self.inner = self.inner.set_private_ip_addresses(input);
178        self
179    }
180    /// <p>The IP addresses to be assigned as a secondary private IP address to the network interface. You can't specify this parameter when also specifying a number of secondary IP addresses.</p>
181    /// <p>If you don't specify an IP address, Amazon EC2 automatically selects an IP address within the subnet range.</p>
182    pub fn get_private_ip_addresses(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
183        self.inner.get_private_ip_addresses()
184    }
185    /// <p>The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.</p>
186    pub fn secondary_private_ip_address_count(mut self, input: i32) -> Self {
187        self.inner = self.inner.secondary_private_ip_address_count(input);
188        self
189    }
190    /// <p>The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.</p>
191    pub fn set_secondary_private_ip_address_count(mut self, input: ::std::option::Option<i32>) -> Self {
192        self.inner = self.inner.set_secondary_private_ip_address_count(input);
193        self
194    }
195    /// <p>The number of secondary IP addresses to assign to the network interface. You can't specify this parameter when also specifying private IP addresses.</p>
196    pub fn get_secondary_private_ip_address_count(&self) -> &::std::option::Option<i32> {
197        self.inner.get_secondary_private_ip_address_count()
198    }
199    /// <p>Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.</p>
200    pub fn allow_reassignment(mut self, input: bool) -> Self {
201        self.inner = self.inner.allow_reassignment(input);
202        self
203    }
204    /// <p>Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.</p>
205    pub fn set_allow_reassignment(mut self, input: ::std::option::Option<bool>) -> Self {
206        self.inner = self.inner.set_allow_reassignment(input);
207        self
208    }
209    /// <p>Indicates whether to allow an IP address that is already assigned to another network interface or instance to be reassigned to the specified network interface.</p>
210    pub fn get_allow_reassignment(&self) -> &::std::option::Option<bool> {
211        self.inner.get_allow_reassignment()
212    }
213}