aws_sdk_ec2/operation/associate_address/
_associate_address_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct AssociateAddressInput {
6    /// <p>The allocation ID. This is required.</p>
7    pub allocation_id: ::std::option::Option<::std::string::String>,
8    /// <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>
9    pub instance_id: ::std::option::Option<::std::string::String>,
10    /// <p>Deprecated.</p>
11    pub public_ip: ::std::option::Option<::std::string::String>,
12    /// <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>
13    pub dry_run: ::std::option::Option<bool>,
14    /// <p>The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.</p>
15    /// <p>You can specify either the instance ID or the network interface ID, but not both.</p>
16    pub network_interface_id: ::std::option::Option<::std::string::String>,
17    /// <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>
18    pub private_ip_address: ::std::option::Option<::std::string::String>,
19    /// <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>
20    pub allow_reassociation: ::std::option::Option<bool>,
21}
22impl AssociateAddressInput {
23    /// <p>The allocation ID. This is required.</p>
24    pub fn allocation_id(&self) -> ::std::option::Option<&str> {
25        self.allocation_id.as_deref()
26    }
27    /// <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>
28    pub fn instance_id(&self) -> ::std::option::Option<&str> {
29        self.instance_id.as_deref()
30    }
31    /// <p>Deprecated.</p>
32    pub fn public_ip(&self) -> ::std::option::Option<&str> {
33        self.public_ip.as_deref()
34    }
35    /// <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>
36    pub fn dry_run(&self) -> ::std::option::Option<bool> {
37        self.dry_run
38    }
39    /// <p>The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.</p>
40    /// <p>You can specify either the instance ID or the network interface ID, but not both.</p>
41    pub fn network_interface_id(&self) -> ::std::option::Option<&str> {
42        self.network_interface_id.as_deref()
43    }
44    /// <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>
45    pub fn private_ip_address(&self) -> ::std::option::Option<&str> {
46        self.private_ip_address.as_deref()
47    }
48    /// <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>
49    pub fn allow_reassociation(&self) -> ::std::option::Option<bool> {
50        self.allow_reassociation
51    }
52}
53impl AssociateAddressInput {
54    /// Creates a new builder-style object to manufacture [`AssociateAddressInput`](crate::operation::associate_address::AssociateAddressInput).
55    pub fn builder() -> crate::operation::associate_address::builders::AssociateAddressInputBuilder {
56        crate::operation::associate_address::builders::AssociateAddressInputBuilder::default()
57    }
58}
59
60/// A builder for [`AssociateAddressInput`](crate::operation::associate_address::AssociateAddressInput).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
62#[non_exhaustive]
63pub struct AssociateAddressInputBuilder {
64    pub(crate) allocation_id: ::std::option::Option<::std::string::String>,
65    pub(crate) instance_id: ::std::option::Option<::std::string::String>,
66    pub(crate) public_ip: ::std::option::Option<::std::string::String>,
67    pub(crate) dry_run: ::std::option::Option<bool>,
68    pub(crate) network_interface_id: ::std::option::Option<::std::string::String>,
69    pub(crate) private_ip_address: ::std::option::Option<::std::string::String>,
70    pub(crate) allow_reassociation: ::std::option::Option<bool>,
71}
72impl AssociateAddressInputBuilder {
73    /// <p>The allocation ID. This is required.</p>
74    pub fn allocation_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
75        self.allocation_id = ::std::option::Option::Some(input.into());
76        self
77    }
78    /// <p>The allocation ID. This is required.</p>
79    pub fn set_allocation_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80        self.allocation_id = input;
81        self
82    }
83    /// <p>The allocation ID. This is required.</p>
84    pub fn get_allocation_id(&self) -> &::std::option::Option<::std::string::String> {
85        &self.allocation_id
86    }
87    /// <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>
88    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.instance_id = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <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>
93    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.instance_id = input;
95        self
96    }
97    /// <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>
98    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
99        &self.instance_id
100    }
101    /// <p>Deprecated.</p>
102    pub fn public_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.public_ip = ::std::option::Option::Some(input.into());
104        self
105    }
106    /// <p>Deprecated.</p>
107    pub fn set_public_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.public_ip = input;
109        self
110    }
111    /// <p>Deprecated.</p>
112    pub fn get_public_ip(&self) -> &::std::option::Option<::std::string::String> {
113        &self.public_ip
114    }
115    /// <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>
116    pub fn dry_run(mut self, input: bool) -> Self {
117        self.dry_run = ::std::option::Option::Some(input);
118        self
119    }
120    /// <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>
121    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
122        self.dry_run = input;
123        self
124    }
125    /// <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>
126    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
127        &self.dry_run
128    }
129    /// <p>The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.</p>
130    /// <p>You can specify either the instance ID or the network interface ID, but not both.</p>
131    pub fn network_interface_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.network_interface_id = ::std::option::Option::Some(input.into());
133        self
134    }
135    /// <p>The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.</p>
136    /// <p>You can specify either the instance ID or the network interface ID, but not both.</p>
137    pub fn set_network_interface_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.network_interface_id = input;
139        self
140    }
141    /// <p>The ID of the network interface. If the instance has more than one network interface, you must specify a network interface ID.</p>
142    /// <p>You can specify either the instance ID or the network interface ID, but not both.</p>
143    pub fn get_network_interface_id(&self) -> &::std::option::Option<::std::string::String> {
144        &self.network_interface_id
145    }
146    /// <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>
147    pub fn private_ip_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.private_ip_address = ::std::option::Option::Some(input.into());
149        self
150    }
151    /// <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>
152    pub fn set_private_ip_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.private_ip_address = input;
154        self
155    }
156    /// <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>
157    pub fn get_private_ip_address(&self) -> &::std::option::Option<::std::string::String> {
158        &self.private_ip_address
159    }
160    /// <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>
161    pub fn allow_reassociation(mut self, input: bool) -> Self {
162        self.allow_reassociation = ::std::option::Option::Some(input);
163        self
164    }
165    /// <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>
166    pub fn set_allow_reassociation(mut self, input: ::std::option::Option<bool>) -> Self {
167        self.allow_reassociation = input;
168        self
169    }
170    /// <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>
171    pub fn get_allow_reassociation(&self) -> &::std::option::Option<bool> {
172        &self.allow_reassociation
173    }
174    /// Consumes the builder and constructs a [`AssociateAddressInput`](crate::operation::associate_address::AssociateAddressInput).
175    pub fn build(
176        self,
177    ) -> ::std::result::Result<crate::operation::associate_address::AssociateAddressInput, ::aws_smithy_types::error::operation::BuildError> {
178        ::std::result::Result::Ok(crate::operation::associate_address::AssociateAddressInput {
179            allocation_id: self.allocation_id,
180            instance_id: self.instance_id,
181            public_ip: self.public_ip,
182            dry_run: self.dry_run,
183            network_interface_id: self.network_interface_id,
184            private_ip_address: self.private_ip_address,
185            allow_reassociation: self.allow_reassociation,
186        })
187    }
188}