aws_sdk_appmesh/types/
_dns_service_discovery.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object that represents the DNS service discovery information for your virtual node.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DnsServiceDiscovery {
7    /// <p>Specifies the DNS service discovery hostname for the virtual node.</p>
8    pub hostname: ::std::string::String,
9    /// <p>Specifies the DNS response type for the virtual node.</p>
10    pub response_type: ::std::option::Option<crate::types::DnsResponseType>,
11    /// <p>The preferred IP version that this virtual node uses. Setting the IP preference on the virtual node only overrides the IP preference set for the mesh on this specific node.</p>
12    pub ip_preference: ::std::option::Option<crate::types::IpPreference>,
13}
14impl DnsServiceDiscovery {
15    /// <p>Specifies the DNS service discovery hostname for the virtual node.</p>
16    pub fn hostname(&self) -> &str {
17        use std::ops::Deref;
18        self.hostname.deref()
19    }
20    /// <p>Specifies the DNS response type for the virtual node.</p>
21    pub fn response_type(&self) -> ::std::option::Option<&crate::types::DnsResponseType> {
22        self.response_type.as_ref()
23    }
24    /// <p>The preferred IP version that this virtual node uses. Setting the IP preference on the virtual node only overrides the IP preference set for the mesh on this specific node.</p>
25    pub fn ip_preference(&self) -> ::std::option::Option<&crate::types::IpPreference> {
26        self.ip_preference.as_ref()
27    }
28}
29impl DnsServiceDiscovery {
30    /// Creates a new builder-style object to manufacture [`DnsServiceDiscovery`](crate::types::DnsServiceDiscovery).
31    pub fn builder() -> crate::types::builders::DnsServiceDiscoveryBuilder {
32        crate::types::builders::DnsServiceDiscoveryBuilder::default()
33    }
34}
35
36/// A builder for [`DnsServiceDiscovery`](crate::types::DnsServiceDiscovery).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct DnsServiceDiscoveryBuilder {
40    pub(crate) hostname: ::std::option::Option<::std::string::String>,
41    pub(crate) response_type: ::std::option::Option<crate::types::DnsResponseType>,
42    pub(crate) ip_preference: ::std::option::Option<crate::types::IpPreference>,
43}
44impl DnsServiceDiscoveryBuilder {
45    /// <p>Specifies the DNS service discovery hostname for the virtual node.</p>
46    /// This field is required.
47    pub fn hostname(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
48        self.hostname = ::std::option::Option::Some(input.into());
49        self
50    }
51    /// <p>Specifies the DNS service discovery hostname for the virtual node.</p>
52    pub fn set_hostname(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53        self.hostname = input;
54        self
55    }
56    /// <p>Specifies the DNS service discovery hostname for the virtual node.</p>
57    pub fn get_hostname(&self) -> &::std::option::Option<::std::string::String> {
58        &self.hostname
59    }
60    /// <p>Specifies the DNS response type for the virtual node.</p>
61    pub fn response_type(mut self, input: crate::types::DnsResponseType) -> Self {
62        self.response_type = ::std::option::Option::Some(input);
63        self
64    }
65    /// <p>Specifies the DNS response type for the virtual node.</p>
66    pub fn set_response_type(mut self, input: ::std::option::Option<crate::types::DnsResponseType>) -> Self {
67        self.response_type = input;
68        self
69    }
70    /// <p>Specifies the DNS response type for the virtual node.</p>
71    pub fn get_response_type(&self) -> &::std::option::Option<crate::types::DnsResponseType> {
72        &self.response_type
73    }
74    /// <p>The preferred IP version that this virtual node uses. Setting the IP preference on the virtual node only overrides the IP preference set for the mesh on this specific node.</p>
75    pub fn ip_preference(mut self, input: crate::types::IpPreference) -> Self {
76        self.ip_preference = ::std::option::Option::Some(input);
77        self
78    }
79    /// <p>The preferred IP version that this virtual node uses. Setting the IP preference on the virtual node only overrides the IP preference set for the mesh on this specific node.</p>
80    pub fn set_ip_preference(mut self, input: ::std::option::Option<crate::types::IpPreference>) -> Self {
81        self.ip_preference = input;
82        self
83    }
84    /// <p>The preferred IP version that this virtual node uses. Setting the IP preference on the virtual node only overrides the IP preference set for the mesh on this specific node.</p>
85    pub fn get_ip_preference(&self) -> &::std::option::Option<crate::types::IpPreference> {
86        &self.ip_preference
87    }
88    /// Consumes the builder and constructs a [`DnsServiceDiscovery`](crate::types::DnsServiceDiscovery).
89    /// This method will fail if any of the following fields are not set:
90    /// - [`hostname`](crate::types::builders::DnsServiceDiscoveryBuilder::hostname)
91    pub fn build(self) -> ::std::result::Result<crate::types::DnsServiceDiscovery, ::aws_smithy_types::error::operation::BuildError> {
92        ::std::result::Result::Ok(crate::types::DnsServiceDiscovery {
93            hostname: self.hostname.ok_or_else(|| {
94                ::aws_smithy_types::error::operation::BuildError::missing_field(
95                    "hostname",
96                    "hostname was not specified but it is required when building DnsServiceDiscovery",
97                )
98            })?,
99            response_type: self.response_type,
100            ip_preference: self.ip_preference,
101        })
102    }
103}