aws_sdk_ec2/operation/associate_address/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::associate_address::_associate_address_output::AssociateAddressOutputBuilder;
3
4pub use crate::operation::associate_address::_associate_address_input::AssociateAddressInputBuilder;
5
6impl crate::operation::associate_address::builders::AssociateAddressInputBuilder {
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::associate_address::AssociateAddressOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::associate_address::AssociateAddressError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.associate_address();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AssociateAddress`.
24///
25/// <p>Associates an Elastic IP address, or carrier IP address (for instances that are in subnets in Wavelength Zones) with an instance or a network interface. Before you can use an Elastic IP address, you must allocate it to your account.</p>
26/// <p>If the Elastic IP address is already associated with a different instance, it is disassociated from that instance and associated with the specified instance. If you associate an Elastic IP address with an instance that has an existing Elastic IP address, the existing address is disassociated from the instance, but remains allocated to your account.</p>
27/// <p>\[Subnets in Wavelength Zones\] You can associate an IP address from the telecommunication carrier to the instance or network interface.</p>
28/// <p>You cannot associate an Elastic IP address with an interface in a different network border group.</p><important>
29/// <p>This is an idempotent operation. If you perform the operation more than once, Amazon EC2 doesn't return an error, and you may be charged for each time the Elastic IP address is remapped to the same instance. For more information, see the <i>Elastic IP Addresses</i> section of <a href="http://aws.amazon.com/ec2/pricing/">Amazon EC2 Pricing</a>.</p>
30/// </important>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct AssociateAddressFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::associate_address::builders::AssociateAddressInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::associate_address::AssociateAddressOutput,
40        crate::operation::associate_address::AssociateAddressError,
41    > for AssociateAddressFluentBuilder
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::associate_address::AssociateAddressOutput,
49            crate::operation::associate_address::AssociateAddressError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl AssociateAddressFluentBuilder {
56    /// Creates a new `AssociateAddressFluentBuilder`.
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 AssociateAddress as a reference.
65    pub fn as_input(&self) -> &crate::operation::associate_address::builders::AssociateAddressInputBuilder {
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::associate_address::AssociateAddressOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::associate_address::AssociateAddressError,
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::associate_address::AssociateAddress::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::associate_address::AssociateAddress::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::associate_address::AssociateAddressOutput,
102        crate::operation::associate_address::AssociateAddressError,
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    /// <p>The allocation ID. This is required.</p>
117    pub fn allocation_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.inner = self.inner.allocation_id(input.into());
119        self
120    }
121    /// <p>The allocation ID. This is required.</p>
122    pub fn set_allocation_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.inner = self.inner.set_allocation_id(input);
124        self
125    }
126    /// <p>The allocation ID. This is required.</p>
127    pub fn get_allocation_id(&self) -> &::std::option::Option<::std::string::String> {
128        self.inner.get_allocation_id()
129    }
130    /// <p>The ID of the instance. The instance must have exactly one attached network interface. You can specify either the instance ID or the network interface ID, but not both.</p>
131    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.instance_id(input.into());
133        self
134    }
135    /// <p>The ID of the instance. The instance must have exactly one attached network interface. You can specify either the instance ID or the network interface ID, but not both.</p>
136    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.inner = self.inner.set_instance_id(input);
138        self
139    }
140    /// <p>The ID of the instance. The instance must have exactly one attached network interface. You can specify either the instance ID or the network interface ID, but not both.</p>
141    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
142        self.inner.get_instance_id()
143    }
144    /// <p>Deprecated.</p>
145    pub fn public_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.inner = self.inner.public_ip(input.into());
147        self
148    }
149    /// <p>Deprecated.</p>
150    pub fn set_public_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.inner = self.inner.set_public_ip(input);
152        self
153    }
154    /// <p>Deprecated.</p>
155    pub fn get_public_ip(&self) -> &::std::option::Option<::std::string::String> {
156        self.inner.get_public_ip()
157    }
158    /// <p>Checks 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>
159    pub fn dry_run(mut self, input: bool) -> Self {
160        self.inner = self.inner.dry_run(input);
161        self
162    }
163    /// <p>Checks 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>
164    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
165        self.inner = self.inner.set_dry_run(input);
166        self
167    }
168    /// <p>Checks 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>
169    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
170        self.inner.get_dry_run()
171    }
172    /// <p>The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.</p>
173    /// <p>You can specify either the instance ID or the network interface ID, but not both.</p>
174    pub fn network_interface_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175        self.inner = self.inner.network_interface_id(input.into());
176        self
177    }
178    /// <p>The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.</p>
179    /// <p>You can specify either the instance ID or the network interface ID, but not both.</p>
180    pub fn set_network_interface_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181        self.inner = self.inner.set_network_interface_id(input);
182        self
183    }
184    /// <p>The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.</p>
185    /// <p>You can specify either the instance ID or the network interface ID, but not both.</p>
186    pub fn get_network_interface_id(&self) -> &::std::option::Option<::std::string::String> {
187        self.inner.get_network_interface_id()
188    }
189    /// <p>The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.</p>
190    pub fn private_ip_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.private_ip_address(input.into());
192        self
193    }
194    /// <p>The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.</p>
195    pub fn set_private_ip_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196        self.inner = self.inner.set_private_ip_address(input);
197        self
198    }
199    /// <p>The primary or secondary private IP address to associate with the Elastic IP address. If no private IP address is specified, the Elastic IP address is associated with the primary private IP address.</p>
200    pub fn get_private_ip_address(&self) -> &::std::option::Option<::std::string::String> {
201        self.inner.get_private_ip_address()
202    }
203    /// <p>Reassociation is automatic, but you can specify false to ensure the operation fails if the Elastic IP address is already associated with another resource.</p>
204    pub fn allow_reassociation(mut self, input: bool) -> Self {
205        self.inner = self.inner.allow_reassociation(input);
206        self
207    }
208    /// <p>Reassociation is automatic, but you can specify false to ensure the operation fails if the Elastic IP address is already associated with another resource.</p>
209    pub fn set_allow_reassociation(mut self, input: ::std::option::Option<bool>) -> Self {
210        self.inner = self.inner.set_allow_reassociation(input);
211        self
212    }
213    /// <p>Reassociation is automatic, but you can specify false to ensure the operation fails if the Elastic IP address is already associated with another resource.</p>
214    pub fn get_allow_reassociation(&self) -> &::std::option::Option<bool> {
215        self.inner.get_allow_reassociation()
216    }
217}