Skip to main content

aws_sdk_inspector/types/
_network_interface.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains information about the network interfaces interacting with an EC2 instance. This data type is used as one of the elements of the <code>AssetAttributes</code> data type.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct NetworkInterface {
7    /// <p>The ID of the network interface.</p>
8    pub network_interface_id: ::std::option::Option<::std::string::String>,
9    /// <p>The ID of a subnet associated with the network interface.</p>
10    pub subnet_id: ::std::option::Option<::std::string::String>,
11    /// <p>The ID of a VPC associated with the network interface.</p>
12    pub vpc_id: ::std::option::Option<::std::string::String>,
13    /// <p>The name of a private DNS associated with the network interface.</p>
14    pub private_dns_name: ::std::option::Option<::std::string::String>,
15    /// <p>The private IP address associated with the network interface.</p>
16    pub private_ip_address: ::std::option::Option<::std::string::String>,
17    /// <p>A list of the private IP addresses associated with the network interface. Includes the privateDnsName and privateIpAddress.</p>
18    pub private_ip_addresses: ::std::option::Option<::std::vec::Vec<crate::types::PrivateIp>>,
19    /// <p>The name of a public DNS associated with the network interface.</p>
20    pub public_dns_name: ::std::option::Option<::std::string::String>,
21    /// <p>The public IP address from which the network interface is reachable.</p>
22    pub public_ip: ::std::option::Option<::std::string::String>,
23    /// <p>The IP addresses associated with the network interface.</p>
24    pub ipv6_addresses: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
25    /// <p>A list of the security groups associated with the network interface. Includes the groupId and groupName.</p>
26    pub security_groups: ::std::option::Option<::std::vec::Vec<crate::types::SecurityGroup>>,
27}
28impl NetworkInterface {
29    /// <p>The ID of the network interface.</p>
30    pub fn network_interface_id(&self) -> ::std::option::Option<&str> {
31        self.network_interface_id.as_deref()
32    }
33    /// <p>The ID of a subnet associated with the network interface.</p>
34    pub fn subnet_id(&self) -> ::std::option::Option<&str> {
35        self.subnet_id.as_deref()
36    }
37    /// <p>The ID of a VPC associated with the network interface.</p>
38    pub fn vpc_id(&self) -> ::std::option::Option<&str> {
39        self.vpc_id.as_deref()
40    }
41    /// <p>The name of a private DNS associated with the network interface.</p>
42    pub fn private_dns_name(&self) -> ::std::option::Option<&str> {
43        self.private_dns_name.as_deref()
44    }
45    /// <p>The private IP address associated with the network interface.</p>
46    pub fn private_ip_address(&self) -> ::std::option::Option<&str> {
47        self.private_ip_address.as_deref()
48    }
49    /// <p>A list of the private IP addresses associated with the network interface. Includes the privateDnsName and privateIpAddress.</p>
50    ///
51    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.private_ip_addresses.is_none()`.
52    pub fn private_ip_addresses(&self) -> &[crate::types::PrivateIp] {
53        self.private_ip_addresses.as_deref().unwrap_or_default()
54    }
55    /// <p>The name of a public DNS associated with the network interface.</p>
56    pub fn public_dns_name(&self) -> ::std::option::Option<&str> {
57        self.public_dns_name.as_deref()
58    }
59    /// <p>The public IP address from which the network interface is reachable.</p>
60    pub fn public_ip(&self) -> ::std::option::Option<&str> {
61        self.public_ip.as_deref()
62    }
63    /// <p>The IP addresses associated with the network interface.</p>
64    ///
65    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.ipv6_addresses.is_none()`.
66    pub fn ipv6_addresses(&self) -> &[::std::string::String] {
67        self.ipv6_addresses.as_deref().unwrap_or_default()
68    }
69    /// <p>A list of the security groups associated with the network interface. Includes the groupId and groupName.</p>
70    ///
71    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.security_groups.is_none()`.
72    pub fn security_groups(&self) -> &[crate::types::SecurityGroup] {
73        self.security_groups.as_deref().unwrap_or_default()
74    }
75}
76impl NetworkInterface {
77    /// Creates a new builder-style object to manufacture [`NetworkInterface`](crate::types::NetworkInterface).
78    pub fn builder() -> crate::types::builders::NetworkInterfaceBuilder {
79        crate::types::builders::NetworkInterfaceBuilder::default()
80    }
81}
82
83/// A builder for [`NetworkInterface`](crate::types::NetworkInterface).
84#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
85#[non_exhaustive]
86pub struct NetworkInterfaceBuilder {
87    pub(crate) network_interface_id: ::std::option::Option<::std::string::String>,
88    pub(crate) subnet_id: ::std::option::Option<::std::string::String>,
89    pub(crate) vpc_id: ::std::option::Option<::std::string::String>,
90    pub(crate) private_dns_name: ::std::option::Option<::std::string::String>,
91    pub(crate) private_ip_address: ::std::option::Option<::std::string::String>,
92    pub(crate) private_ip_addresses: ::std::option::Option<::std::vec::Vec<crate::types::PrivateIp>>,
93    pub(crate) public_dns_name: ::std::option::Option<::std::string::String>,
94    pub(crate) public_ip: ::std::option::Option<::std::string::String>,
95    pub(crate) ipv6_addresses: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
96    pub(crate) security_groups: ::std::option::Option<::std::vec::Vec<crate::types::SecurityGroup>>,
97}
98impl NetworkInterfaceBuilder {
99    /// <p>The ID of the network interface.</p>
100    pub fn network_interface_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
101        self.network_interface_id = ::std::option::Option::Some(input.into());
102        self
103    }
104    /// <p>The ID of the network interface.</p>
105    pub fn set_network_interface_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
106        self.network_interface_id = input;
107        self
108    }
109    /// <p>The ID of the network interface.</p>
110    pub fn get_network_interface_id(&self) -> &::std::option::Option<::std::string::String> {
111        &self.network_interface_id
112    }
113    /// <p>The ID of a subnet associated with the network interface.</p>
114    pub fn subnet_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.subnet_id = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <p>The ID of a subnet associated with the network interface.</p>
119    pub fn set_subnet_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.subnet_id = input;
121        self
122    }
123    /// <p>The ID of a subnet associated with the network interface.</p>
124    pub fn get_subnet_id(&self) -> &::std::option::Option<::std::string::String> {
125        &self.subnet_id
126    }
127    /// <p>The ID of a VPC associated with the network interface.</p>
128    pub fn vpc_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.vpc_id = ::std::option::Option::Some(input.into());
130        self
131    }
132    /// <p>The ID of a VPC associated with the network interface.</p>
133    pub fn set_vpc_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.vpc_id = input;
135        self
136    }
137    /// <p>The ID of a VPC associated with the network interface.</p>
138    pub fn get_vpc_id(&self) -> &::std::option::Option<::std::string::String> {
139        &self.vpc_id
140    }
141    /// <p>The name of a private DNS associated with the network interface.</p>
142    pub fn private_dns_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.private_dns_name = ::std::option::Option::Some(input.into());
144        self
145    }
146    /// <p>The name of a private DNS associated with the network interface.</p>
147    pub fn set_private_dns_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.private_dns_name = input;
149        self
150    }
151    /// <p>The name of a private DNS associated with the network interface.</p>
152    pub fn get_private_dns_name(&self) -> &::std::option::Option<::std::string::String> {
153        &self.private_dns_name
154    }
155    /// <p>The private IP address associated with the network interface.</p>
156    pub fn private_ip_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157        self.private_ip_address = ::std::option::Option::Some(input.into());
158        self
159    }
160    /// <p>The private IP address associated with the network interface.</p>
161    pub fn set_private_ip_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162        self.private_ip_address = input;
163        self
164    }
165    /// <p>The private IP address associated with the network interface.</p>
166    pub fn get_private_ip_address(&self) -> &::std::option::Option<::std::string::String> {
167        &self.private_ip_address
168    }
169    /// Appends an item to `private_ip_addresses`.
170    ///
171    /// To override the contents of this collection use [`set_private_ip_addresses`](Self::set_private_ip_addresses).
172    ///
173    /// <p>A list of the private IP addresses associated with the network interface. Includes the privateDnsName and privateIpAddress.</p>
174    pub fn private_ip_addresses(mut self, input: crate::types::PrivateIp) -> Self {
175        let mut v = self.private_ip_addresses.unwrap_or_default();
176        v.push(input);
177        self.private_ip_addresses = ::std::option::Option::Some(v);
178        self
179    }
180    /// <p>A list of the private IP addresses associated with the network interface. Includes the privateDnsName and privateIpAddress.</p>
181    pub fn set_private_ip_addresses(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PrivateIp>>) -> Self {
182        self.private_ip_addresses = input;
183        self
184    }
185    /// <p>A list of the private IP addresses associated with the network interface. Includes the privateDnsName and privateIpAddress.</p>
186    pub fn get_private_ip_addresses(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PrivateIp>> {
187        &self.private_ip_addresses
188    }
189    /// <p>The name of a public DNS associated with the network interface.</p>
190    pub fn public_dns_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.public_dns_name = ::std::option::Option::Some(input.into());
192        self
193    }
194    /// <p>The name of a public DNS associated with the network interface.</p>
195    pub fn set_public_dns_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196        self.public_dns_name = input;
197        self
198    }
199    /// <p>The name of a public DNS associated with the network interface.</p>
200    pub fn get_public_dns_name(&self) -> &::std::option::Option<::std::string::String> {
201        &self.public_dns_name
202    }
203    /// <p>The public IP address from which the network interface is reachable.</p>
204    pub fn public_ip(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205        self.public_ip = ::std::option::Option::Some(input.into());
206        self
207    }
208    /// <p>The public IP address from which the network interface is reachable.</p>
209    pub fn set_public_ip(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210        self.public_ip = input;
211        self
212    }
213    /// <p>The public IP address from which the network interface is reachable.</p>
214    pub fn get_public_ip(&self) -> &::std::option::Option<::std::string::String> {
215        &self.public_ip
216    }
217    /// Appends an item to `ipv6_addresses`.
218    ///
219    /// To override the contents of this collection use [`set_ipv6_addresses`](Self::set_ipv6_addresses).
220    ///
221    /// <p>The IP addresses associated with the network interface.</p>
222    pub fn ipv6_addresses(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
223        let mut v = self.ipv6_addresses.unwrap_or_default();
224        v.push(input.into());
225        self.ipv6_addresses = ::std::option::Option::Some(v);
226        self
227    }
228    /// <p>The IP addresses associated with the network interface.</p>
229    pub fn set_ipv6_addresses(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
230        self.ipv6_addresses = input;
231        self
232    }
233    /// <p>The IP addresses associated with the network interface.</p>
234    pub fn get_ipv6_addresses(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
235        &self.ipv6_addresses
236    }
237    /// Appends an item to `security_groups`.
238    ///
239    /// To override the contents of this collection use [`set_security_groups`](Self::set_security_groups).
240    ///
241    /// <p>A list of the security groups associated with the network interface. Includes the groupId and groupName.</p>
242    pub fn security_groups(mut self, input: crate::types::SecurityGroup) -> Self {
243        let mut v = self.security_groups.unwrap_or_default();
244        v.push(input);
245        self.security_groups = ::std::option::Option::Some(v);
246        self
247    }
248    /// <p>A list of the security groups associated with the network interface. Includes the groupId and groupName.</p>
249    pub fn set_security_groups(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SecurityGroup>>) -> Self {
250        self.security_groups = input;
251        self
252    }
253    /// <p>A list of the security groups associated with the network interface. Includes the groupId and groupName.</p>
254    pub fn get_security_groups(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SecurityGroup>> {
255        &self.security_groups
256    }
257    /// Consumes the builder and constructs a [`NetworkInterface`](crate::types::NetworkInterface).
258    pub fn build(self) -> crate::types::NetworkInterface {
259        crate::types::NetworkInterface {
260            network_interface_id: self.network_interface_id,
261            subnet_id: self.subnet_id,
262            vpc_id: self.vpc_id,
263            private_dns_name: self.private_dns_name,
264            private_ip_address: self.private_ip_address,
265            private_ip_addresses: self.private_ip_addresses,
266            public_dns_name: self.public_dns_name,
267            public_ip: self.public_ip,
268            ipv6_addresses: self.ipv6_addresses,
269            security_groups: self.security_groups,
270        }
271    }
272}