aws_sdk_ec2/operation/modify_network_interface_attribute/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::modify_network_interface_attribute::_modify_network_interface_attribute_output::ModifyNetworkInterfaceAttributeOutputBuilder;
3
4pub use crate::operation::modify_network_interface_attribute::_modify_network_interface_attribute_input::ModifyNetworkInterfaceAttributeInputBuilder;
5
6impl crate::operation::modify_network_interface_attribute::builders::ModifyNetworkInterfaceAttributeInputBuilder {
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::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.modify_network_interface_attribute();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ModifyNetworkInterfaceAttribute`.
24///
25/// <p>Modifies the specified network interface attribute. You can specify only one attribute at a time. You can use this action to attach and detach security groups from an existing EC2 instance.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct ModifyNetworkInterfaceAttributeFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::modify_network_interface_attribute::builders::ModifyNetworkInterfaceAttributeInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeOutput,
35        crate::operation::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeError,
36    > for ModifyNetworkInterfaceAttributeFluentBuilder
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::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeOutput,
44            crate::operation::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl ModifyNetworkInterfaceAttributeFluentBuilder {
51    /// Creates a new `ModifyNetworkInterfaceAttributeFluentBuilder`.
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 ModifyNetworkInterfaceAttribute as a reference.
60    pub fn as_input(&self) -> &crate::operation::modify_network_interface_attribute::builders::ModifyNetworkInterfaceAttributeInputBuilder {
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::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeError,
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::modify_network_interface_attribute::ModifyNetworkInterfaceAttribute::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::modify_network_interface_attribute::ModifyNetworkInterfaceAttribute::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::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeOutput,
97        crate::operation::modify_network_interface_attribute::ModifyNetworkInterfaceAttributeError,
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>Updates the ENA Express configuration for the network interface that’s attached to the instance.</p>
112    pub fn ena_srd_specification(mut self, input: crate::types::EnaSrdSpecification) -> Self {
113        self.inner = self.inner.ena_srd_specification(input);
114        self
115    }
116    /// <p>Updates the ENA Express configuration for the network interface that’s attached to the instance.</p>
117    pub fn set_ena_srd_specification(mut self, input: ::std::option::Option<crate::types::EnaSrdSpecification>) -> Self {
118        self.inner = self.inner.set_ena_srd_specification(input);
119        self
120    }
121    /// <p>Updates the ENA Express configuration for the network interface that’s attached to the instance.</p>
122    pub fn get_ena_srd_specification(&self) -> &::std::option::Option<crate::types::EnaSrdSpecification> {
123        self.inner.get_ena_srd_specification()
124    }
125    /// <p>If you’re modifying a network interface in a dual-stack or IPv6-only subnet, you have the option to assign a primary IPv6 IP address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if the instance that this ENI will be attached to relies on its IPv6 address not changing. Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.</p>
126    pub fn enable_primary_ipv6(mut self, input: bool) -> Self {
127        self.inner = self.inner.enable_primary_ipv6(input);
128        self
129    }
130    /// <p>If you’re modifying a network interface in a dual-stack or IPv6-only subnet, you have the option to assign a primary IPv6 IP address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if the instance that this ENI will be attached to relies on its IPv6 address not changing. Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.</p>
131    pub fn set_enable_primary_ipv6(mut self, input: ::std::option::Option<bool>) -> Self {
132        self.inner = self.inner.set_enable_primary_ipv6(input);
133        self
134    }
135    /// <p>If you’re modifying a network interface in a dual-stack or IPv6-only subnet, you have the option to assign a primary IPv6 IP address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if the instance that this ENI will be attached to relies on its IPv6 address not changing. Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.</p>
136    pub fn get_enable_primary_ipv6(&self) -> &::std::option::Option<bool> {
137        self.inner.get_enable_primary_ipv6()
138    }
139    /// <p>A connection tracking specification.</p>
140    pub fn connection_tracking_specification(mut self, input: crate::types::ConnectionTrackingSpecificationRequest) -> Self {
141        self.inner = self.inner.connection_tracking_specification(input);
142        self
143    }
144    /// <p>A connection tracking specification.</p>
145    pub fn set_connection_tracking_specification(
146        mut self,
147        input: ::std::option::Option<crate::types::ConnectionTrackingSpecificationRequest>,
148    ) -> Self {
149        self.inner = self.inner.set_connection_tracking_specification(input);
150        self
151    }
152    /// <p>A connection tracking specification.</p>
153    pub fn get_connection_tracking_specification(&self) -> &::std::option::Option<crate::types::ConnectionTrackingSpecificationRequest> {
154        self.inner.get_connection_tracking_specification()
155    }
156    /// <p>Indicates whether to assign a public IPv4 address to a network interface. This option can be enabled for any network interface but will only apply to the primary network interface (eth0).</p>
157    pub fn associate_public_ip_address(mut self, input: bool) -> Self {
158        self.inner = self.inner.associate_public_ip_address(input);
159        self
160    }
161    /// <p>Indicates whether to assign a public IPv4 address to a network interface. This option can be enabled for any network interface but will only apply to the primary network interface (eth0).</p>
162    pub fn set_associate_public_ip_address(mut self, input: ::std::option::Option<bool>) -> Self {
163        self.inner = self.inner.set_associate_public_ip_address(input);
164        self
165    }
166    /// <p>Indicates whether to assign a public IPv4 address to a network interface. This option can be enabled for any network interface but will only apply to the primary network interface (eth0).</p>
167    pub fn get_associate_public_ip_address(&self) -> &::std::option::Option<bool> {
168        self.inner.get_associate_public_ip_address()
169    }
170    /// <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>
171    pub fn dry_run(mut self, input: bool) -> Self {
172        self.inner = self.inner.dry_run(input);
173        self
174    }
175    /// <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>
176    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
177        self.inner = self.inner.set_dry_run(input);
178        self
179    }
180    /// <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>
181    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
182        self.inner.get_dry_run()
183    }
184    /// <p>The ID of the network interface.</p>
185    pub fn network_interface_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186        self.inner = self.inner.network_interface_id(input.into());
187        self
188    }
189    /// <p>The ID of the network interface.</p>
190    pub fn set_network_interface_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
191        self.inner = self.inner.set_network_interface_id(input);
192        self
193    }
194    /// <p>The ID of the network interface.</p>
195    pub fn get_network_interface_id(&self) -> &::std::option::Option<::std::string::String> {
196        self.inner.get_network_interface_id()
197    }
198    /// <p>A description for the network interface.</p>
199    pub fn description(mut self, input: crate::types::AttributeValue) -> Self {
200        self.inner = self.inner.description(input);
201        self
202    }
203    /// <p>A description for the network interface.</p>
204    pub fn set_description(mut self, input: ::std::option::Option<crate::types::AttributeValue>) -> Self {
205        self.inner = self.inner.set_description(input);
206        self
207    }
208    /// <p>A description for the network interface.</p>
209    pub fn get_description(&self) -> &::std::option::Option<crate::types::AttributeValue> {
210        self.inner.get_description()
211    }
212    /// <p>Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is <code>true</code>, source/destination checks are enabled; otherwise, they are disabled. The default value is <code>true</code>. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.</p>
213    pub fn source_dest_check(mut self, input: crate::types::AttributeBooleanValue) -> Self {
214        self.inner = self.inner.source_dest_check(input);
215        self
216    }
217    /// <p>Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is <code>true</code>, source/destination checks are enabled; otherwise, they are disabled. The default value is <code>true</code>. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.</p>
218    pub fn set_source_dest_check(mut self, input: ::std::option::Option<crate::types::AttributeBooleanValue>) -> Self {
219        self.inner = self.inner.set_source_dest_check(input);
220        self
221    }
222    /// <p>Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives. If the value is <code>true</code>, source/destination checks are enabled; otherwise, they are disabled. The default value is <code>true</code>. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls.</p>
223    pub fn get_source_dest_check(&self) -> &::std::option::Option<crate::types::AttributeBooleanValue> {
224        self.inner.get_source_dest_check()
225    }
226    ///
227    /// Appends an item to `Groups`.
228    ///
229    /// To override the contents of this collection use [`set_groups`](Self::set_groups).
230    ///
231    /// <p>Changes the security groups for the network interface. The new set of groups you specify replaces the current set. You must specify at least one group, even if it's just the default security group in the VPC. You must specify the ID of the security group, not the name.</p>
232    pub fn groups(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
233        self.inner = self.inner.groups(input.into());
234        self
235    }
236    /// <p>Changes the security groups for the network interface. The new set of groups you specify replaces the current set. You must specify at least one group, even if it's just the default security group in the VPC. You must specify the ID of the security group, not the name.</p>
237    pub fn set_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
238        self.inner = self.inner.set_groups(input);
239        self
240    }
241    /// <p>Changes the security groups for the network interface. The new set of groups you specify replaces the current set. You must specify at least one group, even if it's just the default security group in the VPC. You must specify the ID of the security group, not the name.</p>
242    pub fn get_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
243        self.inner.get_groups()
244    }
245    /// <p>Information about the interface attachment. If modifying the <code>delete on termination</code> attribute, you must specify the ID of the interface attachment.</p>
246    pub fn attachment(mut self, input: crate::types::NetworkInterfaceAttachmentChanges) -> Self {
247        self.inner = self.inner.attachment(input);
248        self
249    }
250    /// <p>Information about the interface attachment. If modifying the <code>delete on termination</code> attribute, you must specify the ID of the interface attachment.</p>
251    pub fn set_attachment(mut self, input: ::std::option::Option<crate::types::NetworkInterfaceAttachmentChanges>) -> Self {
252        self.inner = self.inner.set_attachment(input);
253        self
254    }
255    /// <p>Information about the interface attachment. If modifying the <code>delete on termination</code> attribute, you must specify the ID of the interface attachment.</p>
256    pub fn get_attachment(&self) -> &::std::option::Option<crate::types::NetworkInterfaceAttachmentChanges> {
257        self.inner.get_attachment()
258    }
259}