aws_sdk_iotwireless/types/
_ip.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>IP address used for resolving device location.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Ip {
7    /// <p>IP address information.</p>
8    pub ip_address: ::std::string::String,
9}
10impl Ip {
11    /// <p>IP address information.</p>
12    pub fn ip_address(&self) -> &str {
13        use std::ops::Deref;
14        self.ip_address.deref()
15    }
16}
17impl Ip {
18    /// Creates a new builder-style object to manufacture [`Ip`](crate::types::Ip).
19    pub fn builder() -> crate::types::builders::IpBuilder {
20        crate::types::builders::IpBuilder::default()
21    }
22}
23
24/// A builder for [`Ip`](crate::types::Ip).
25#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
26#[non_exhaustive]
27pub struct IpBuilder {
28    pub(crate) ip_address: ::std::option::Option<::std::string::String>,
29}
30impl IpBuilder {
31    /// <p>IP address information.</p>
32    /// This field is required.
33    pub fn ip_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
34        self.ip_address = ::std::option::Option::Some(input.into());
35        self
36    }
37    /// <p>IP address information.</p>
38    pub fn set_ip_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
39        self.ip_address = input;
40        self
41    }
42    /// <p>IP address information.</p>
43    pub fn get_ip_address(&self) -> &::std::option::Option<::std::string::String> {
44        &self.ip_address
45    }
46    /// Consumes the builder and constructs a [`Ip`](crate::types::Ip).
47    /// This method will fail if any of the following fields are not set:
48    /// - [`ip_address`](crate::types::builders::IpBuilder::ip_address)
49    pub fn build(self) -> ::std::result::Result<crate::types::Ip, ::aws_smithy_types::error::operation::BuildError> {
50        ::std::result::Result::Ok(crate::types::Ip {
51            ip_address: self.ip_address.ok_or_else(|| {
52                ::aws_smithy_types::error::operation::BuildError::missing_field(
53                    "ip_address",
54                    "ip_address was not specified but it is required when building Ip",
55                )
56            })?,
57        })
58    }
59}