aws_sdk_appmesh/types/
_virtual_node_spec.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object that represents the specification of a virtual node.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct VirtualNodeSpec {
7    /// <p>The service discovery information for the virtual node. If your virtual node does not expect ingress traffic, you can omit this parameter. If you specify a <code>listener</code>, then you must specify service discovery information.</p>
8    pub service_discovery: ::std::option::Option<crate::types::ServiceDiscovery>,
9    /// <p>The listener that the virtual node is expected to receive inbound traffic from. You can specify one listener.</p>
10    pub listeners: ::std::option::Option<::std::vec::Vec<crate::types::Listener>>,
11    /// <p>The backends that the virtual node is expected to send outbound traffic to.</p>
12    pub backends: ::std::option::Option<::std::vec::Vec<crate::types::Backend>>,
13    /// <p>A reference to an object that represents the defaults for backends.</p>
14    pub backend_defaults: ::std::option::Option<crate::types::BackendDefaults>,
15    /// <p>The inbound and outbound access logging information for the virtual node.</p>
16    pub logging: ::std::option::Option<crate::types::Logging>,
17}
18impl VirtualNodeSpec {
19    /// <p>The service discovery information for the virtual node. If your virtual node does not expect ingress traffic, you can omit this parameter. If you specify a <code>listener</code>, then you must specify service discovery information.</p>
20    pub fn service_discovery(&self) -> ::std::option::Option<&crate::types::ServiceDiscovery> {
21        self.service_discovery.as_ref()
22    }
23    /// <p>The listener that the virtual node is expected to receive inbound traffic from. You can specify one listener.</p>
24    ///
25    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.listeners.is_none()`.
26    pub fn listeners(&self) -> &[crate::types::Listener] {
27        self.listeners.as_deref().unwrap_or_default()
28    }
29    /// <p>The backends that the virtual node is expected to send outbound traffic to.</p>
30    ///
31    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.backends.is_none()`.
32    pub fn backends(&self) -> &[crate::types::Backend] {
33        self.backends.as_deref().unwrap_or_default()
34    }
35    /// <p>A reference to an object that represents the defaults for backends.</p>
36    pub fn backend_defaults(&self) -> ::std::option::Option<&crate::types::BackendDefaults> {
37        self.backend_defaults.as_ref()
38    }
39    /// <p>The inbound and outbound access logging information for the virtual node.</p>
40    pub fn logging(&self) -> ::std::option::Option<&crate::types::Logging> {
41        self.logging.as_ref()
42    }
43}
44impl VirtualNodeSpec {
45    /// Creates a new builder-style object to manufacture [`VirtualNodeSpec`](crate::types::VirtualNodeSpec).
46    pub fn builder() -> crate::types::builders::VirtualNodeSpecBuilder {
47        crate::types::builders::VirtualNodeSpecBuilder::default()
48    }
49}
50
51/// A builder for [`VirtualNodeSpec`](crate::types::VirtualNodeSpec).
52#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
53#[non_exhaustive]
54pub struct VirtualNodeSpecBuilder {
55    pub(crate) service_discovery: ::std::option::Option<crate::types::ServiceDiscovery>,
56    pub(crate) listeners: ::std::option::Option<::std::vec::Vec<crate::types::Listener>>,
57    pub(crate) backends: ::std::option::Option<::std::vec::Vec<crate::types::Backend>>,
58    pub(crate) backend_defaults: ::std::option::Option<crate::types::BackendDefaults>,
59    pub(crate) logging: ::std::option::Option<crate::types::Logging>,
60}
61impl VirtualNodeSpecBuilder {
62    /// <p>The service discovery information for the virtual node. If your virtual node does not expect ingress traffic, you can omit this parameter. If you specify a <code>listener</code>, then you must specify service discovery information.</p>
63    pub fn service_discovery(mut self, input: crate::types::ServiceDiscovery) -> Self {
64        self.service_discovery = ::std::option::Option::Some(input);
65        self
66    }
67    /// <p>The service discovery information for the virtual node. If your virtual node does not expect ingress traffic, you can omit this parameter. If you specify a <code>listener</code>, then you must specify service discovery information.</p>
68    pub fn set_service_discovery(mut self, input: ::std::option::Option<crate::types::ServiceDiscovery>) -> Self {
69        self.service_discovery = input;
70        self
71    }
72    /// <p>The service discovery information for the virtual node. If your virtual node does not expect ingress traffic, you can omit this parameter. If you specify a <code>listener</code>, then you must specify service discovery information.</p>
73    pub fn get_service_discovery(&self) -> &::std::option::Option<crate::types::ServiceDiscovery> {
74        &self.service_discovery
75    }
76    /// Appends an item to `listeners`.
77    ///
78    /// To override the contents of this collection use [`set_listeners`](Self::set_listeners).
79    ///
80    /// <p>The listener that the virtual node is expected to receive inbound traffic from. You can specify one listener.</p>
81    pub fn listeners(mut self, input: crate::types::Listener) -> Self {
82        let mut v = self.listeners.unwrap_or_default();
83        v.push(input);
84        self.listeners = ::std::option::Option::Some(v);
85        self
86    }
87    /// <p>The listener that the virtual node is expected to receive inbound traffic from. You can specify one listener.</p>
88    pub fn set_listeners(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Listener>>) -> Self {
89        self.listeners = input;
90        self
91    }
92    /// <p>The listener that the virtual node is expected to receive inbound traffic from. You can specify one listener.</p>
93    pub fn get_listeners(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Listener>> {
94        &self.listeners
95    }
96    /// Appends an item to `backends`.
97    ///
98    /// To override the contents of this collection use [`set_backends`](Self::set_backends).
99    ///
100    /// <p>The backends that the virtual node is expected to send outbound traffic to.</p>
101    pub fn backends(mut self, input: crate::types::Backend) -> Self {
102        let mut v = self.backends.unwrap_or_default();
103        v.push(input);
104        self.backends = ::std::option::Option::Some(v);
105        self
106    }
107    /// <p>The backends that the virtual node is expected to send outbound traffic to.</p>
108    pub fn set_backends(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Backend>>) -> Self {
109        self.backends = input;
110        self
111    }
112    /// <p>The backends that the virtual node is expected to send outbound traffic to.</p>
113    pub fn get_backends(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Backend>> {
114        &self.backends
115    }
116    /// <p>A reference to an object that represents the defaults for backends.</p>
117    pub fn backend_defaults(mut self, input: crate::types::BackendDefaults) -> Self {
118        self.backend_defaults = ::std::option::Option::Some(input);
119        self
120    }
121    /// <p>A reference to an object that represents the defaults for backends.</p>
122    pub fn set_backend_defaults(mut self, input: ::std::option::Option<crate::types::BackendDefaults>) -> Self {
123        self.backend_defaults = input;
124        self
125    }
126    /// <p>A reference to an object that represents the defaults for backends.</p>
127    pub fn get_backend_defaults(&self) -> &::std::option::Option<crate::types::BackendDefaults> {
128        &self.backend_defaults
129    }
130    /// <p>The inbound and outbound access logging information for the virtual node.</p>
131    pub fn logging(mut self, input: crate::types::Logging) -> Self {
132        self.logging = ::std::option::Option::Some(input);
133        self
134    }
135    /// <p>The inbound and outbound access logging information for the virtual node.</p>
136    pub fn set_logging(mut self, input: ::std::option::Option<crate::types::Logging>) -> Self {
137        self.logging = input;
138        self
139    }
140    /// <p>The inbound and outbound access logging information for the virtual node.</p>
141    pub fn get_logging(&self) -> &::std::option::Option<crate::types::Logging> {
142        &self.logging
143    }
144    /// Consumes the builder and constructs a [`VirtualNodeSpec`](crate::types::VirtualNodeSpec).
145    pub fn build(self) -> crate::types::VirtualNodeSpec {
146        crate::types::VirtualNodeSpec {
147            service_discovery: self.service_discovery,
148            listeners: self.listeners,
149            backends: self.backends,
150            backend_defaults: self.backend_defaults,
151            logging: self.logging,
152        }
153    }
154}