aws_sdk_appmesh/types/
_dns_service_discovery.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DnsServiceDiscovery {
7 pub hostname: ::std::string::String,
9 pub response_type: ::std::option::Option<crate::types::DnsResponseType>,
11 pub ip_preference: ::std::option::Option<crate::types::IpPreference>,
13}
14impl DnsServiceDiscovery {
15 pub fn hostname(&self) -> &str {
17 use std::ops::Deref;
18 self.hostname.deref()
19 }
20 pub fn response_type(&self) -> ::std::option::Option<&crate::types::DnsResponseType> {
22 self.response_type.as_ref()
23 }
24 pub fn ip_preference(&self) -> ::std::option::Option<&crate::types::IpPreference> {
26 self.ip_preference.as_ref()
27 }
28}
29impl DnsServiceDiscovery {
30 pub fn builder() -> crate::types::builders::DnsServiceDiscoveryBuilder {
32 crate::types::builders::DnsServiceDiscoveryBuilder::default()
33 }
34}
35
36#[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 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 pub fn set_hostname(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53 self.hostname = input;
54 self
55 }
56 pub fn get_hostname(&self) -> &::std::option::Option<::std::string::String> {
58 &self.hostname
59 }
60 pub fn response_type(mut self, input: crate::types::DnsResponseType) -> Self {
62 self.response_type = ::std::option::Option::Some(input);
63 self
64 }
65 pub fn set_response_type(mut self, input: ::std::option::Option<crate::types::DnsResponseType>) -> Self {
67 self.response_type = input;
68 self
69 }
70 pub fn get_response_type(&self) -> &::std::option::Option<crate::types::DnsResponseType> {
72 &self.response_type
73 }
74 pub fn ip_preference(mut self, input: crate::types::IpPreference) -> Self {
76 self.ip_preference = ::std::option::Option::Some(input);
77 self
78 }
79 pub fn set_ip_preference(mut self, input: ::std::option::Option<crate::types::IpPreference>) -> Self {
81 self.ip_preference = input;
82 self
83 }
84 pub fn get_ip_preference(&self) -> &::std::option::Option<crate::types::IpPreference> {
86 &self.ip_preference
87 }
88 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}