aws_sdk_appmesh/types/
_virtual_node_data.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object that represents a virtual node returned by a describe operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct VirtualNodeData {
7    /// <p>The name of the service mesh that the virtual node resides in.</p>
8    pub mesh_name: ::std::string::String,
9    /// <p>The name of the virtual node.</p>
10    pub virtual_node_name: ::std::string::String,
11    /// <p>The specifications of the virtual node.</p>
12    pub spec: ::std::option::Option<crate::types::VirtualNodeSpec>,
13    /// <p>The associated metadata for the virtual node.</p>
14    pub metadata: ::std::option::Option<crate::types::ResourceMetadata>,
15    /// <p>The current status for the virtual node.</p>
16    pub status: ::std::option::Option<crate::types::VirtualNodeStatus>,
17}
18impl VirtualNodeData {
19    /// <p>The name of the service mesh that the virtual node resides in.</p>
20    pub fn mesh_name(&self) -> &str {
21        use std::ops::Deref;
22        self.mesh_name.deref()
23    }
24    /// <p>The name of the virtual node.</p>
25    pub fn virtual_node_name(&self) -> &str {
26        use std::ops::Deref;
27        self.virtual_node_name.deref()
28    }
29    /// <p>The specifications of the virtual node.</p>
30    pub fn spec(&self) -> ::std::option::Option<&crate::types::VirtualNodeSpec> {
31        self.spec.as_ref()
32    }
33    /// <p>The associated metadata for the virtual node.</p>
34    pub fn metadata(&self) -> ::std::option::Option<&crate::types::ResourceMetadata> {
35        self.metadata.as_ref()
36    }
37    /// <p>The current status for the virtual node.</p>
38    pub fn status(&self) -> ::std::option::Option<&crate::types::VirtualNodeStatus> {
39        self.status.as_ref()
40    }
41}
42impl VirtualNodeData {
43    /// Creates a new builder-style object to manufacture [`VirtualNodeData`](crate::types::VirtualNodeData).
44    pub fn builder() -> crate::types::builders::VirtualNodeDataBuilder {
45        crate::types::builders::VirtualNodeDataBuilder::default()
46    }
47}
48
49/// A builder for [`VirtualNodeData`](crate::types::VirtualNodeData).
50#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
51#[non_exhaustive]
52pub struct VirtualNodeDataBuilder {
53    pub(crate) mesh_name: ::std::option::Option<::std::string::String>,
54    pub(crate) virtual_node_name: ::std::option::Option<::std::string::String>,
55    pub(crate) spec: ::std::option::Option<crate::types::VirtualNodeSpec>,
56    pub(crate) metadata: ::std::option::Option<crate::types::ResourceMetadata>,
57    pub(crate) status: ::std::option::Option<crate::types::VirtualNodeStatus>,
58}
59impl VirtualNodeDataBuilder {
60    /// <p>The name of the service mesh that the virtual node resides in.</p>
61    /// This field is required.
62    pub fn mesh_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
63        self.mesh_name = ::std::option::Option::Some(input.into());
64        self
65    }
66    /// <p>The name of the service mesh that the virtual node resides in.</p>
67    pub fn set_mesh_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
68        self.mesh_name = input;
69        self
70    }
71    /// <p>The name of the service mesh that the virtual node resides in.</p>
72    pub fn get_mesh_name(&self) -> &::std::option::Option<::std::string::String> {
73        &self.mesh_name
74    }
75    /// <p>The name of the virtual node.</p>
76    /// This field is required.
77    pub fn virtual_node_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.virtual_node_name = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// <p>The name of the virtual node.</p>
82    pub fn set_virtual_node_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.virtual_node_name = input;
84        self
85    }
86    /// <p>The name of the virtual node.</p>
87    pub fn get_virtual_node_name(&self) -> &::std::option::Option<::std::string::String> {
88        &self.virtual_node_name
89    }
90    /// <p>The specifications of the virtual node.</p>
91    /// This field is required.
92    pub fn spec(mut self, input: crate::types::VirtualNodeSpec) -> Self {
93        self.spec = ::std::option::Option::Some(input);
94        self
95    }
96    /// <p>The specifications of the virtual node.</p>
97    pub fn set_spec(mut self, input: ::std::option::Option<crate::types::VirtualNodeSpec>) -> Self {
98        self.spec = input;
99        self
100    }
101    /// <p>The specifications of the virtual node.</p>
102    pub fn get_spec(&self) -> &::std::option::Option<crate::types::VirtualNodeSpec> {
103        &self.spec
104    }
105    /// <p>The associated metadata for the virtual node.</p>
106    /// This field is required.
107    pub fn metadata(mut self, input: crate::types::ResourceMetadata) -> Self {
108        self.metadata = ::std::option::Option::Some(input);
109        self
110    }
111    /// <p>The associated metadata for the virtual node.</p>
112    pub fn set_metadata(mut self, input: ::std::option::Option<crate::types::ResourceMetadata>) -> Self {
113        self.metadata = input;
114        self
115    }
116    /// <p>The associated metadata for the virtual node.</p>
117    pub fn get_metadata(&self) -> &::std::option::Option<crate::types::ResourceMetadata> {
118        &self.metadata
119    }
120    /// <p>The current status for the virtual node.</p>
121    /// This field is required.
122    pub fn status(mut self, input: crate::types::VirtualNodeStatus) -> Self {
123        self.status = ::std::option::Option::Some(input);
124        self
125    }
126    /// <p>The current status for the virtual node.</p>
127    pub fn set_status(mut self, input: ::std::option::Option<crate::types::VirtualNodeStatus>) -> Self {
128        self.status = input;
129        self
130    }
131    /// <p>The current status for the virtual node.</p>
132    pub fn get_status(&self) -> &::std::option::Option<crate::types::VirtualNodeStatus> {
133        &self.status
134    }
135    /// Consumes the builder and constructs a [`VirtualNodeData`](crate::types::VirtualNodeData).
136    /// This method will fail if any of the following fields are not set:
137    /// - [`mesh_name`](crate::types::builders::VirtualNodeDataBuilder::mesh_name)
138    /// - [`virtual_node_name`](crate::types::builders::VirtualNodeDataBuilder::virtual_node_name)
139    pub fn build(self) -> ::std::result::Result<crate::types::VirtualNodeData, ::aws_smithy_types::error::operation::BuildError> {
140        ::std::result::Result::Ok(crate::types::VirtualNodeData {
141            mesh_name: self.mesh_name.ok_or_else(|| {
142                ::aws_smithy_types::error::operation::BuildError::missing_field(
143                    "mesh_name",
144                    "mesh_name was not specified but it is required when building VirtualNodeData",
145                )
146            })?,
147            virtual_node_name: self.virtual_node_name.ok_or_else(|| {
148                ::aws_smithy_types::error::operation::BuildError::missing_field(
149                    "virtual_node_name",
150                    "virtual_node_name was not specified but it is required when building VirtualNodeData",
151                )
152            })?,
153            spec: self.spec,
154            metadata: self.metadata,
155            status: self.status,
156        })
157    }
158}