aws_sdk_medialive/operation/create_node/
_create_node_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// A request to create a node
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateNodeInput {
7    /// The ID of the cluster.
8    pub cluster_id: ::std::option::Option<::std::string::String>,
9    /// The user-specified name of the Node to be created.
10    pub name: ::std::option::Option<::std::string::String>,
11    /// Documentation update needed
12    pub node_interface_mappings: ::std::option::Option<::std::vec::Vec<crate::types::NodeInterfaceMappingCreateRequest>>,
13    /// An ID that you assign to a create request. This ID ensures idempotency when creating resources.
14    pub request_id: ::std::option::Option<::std::string::String>,
15    /// The initial role of the Node in the Cluster. ACTIVE means the Node is available for encoding. BACKUP means the Node is a redundant Node and might get used if an ACTIVE Node fails.
16    pub role: ::std::option::Option<crate::types::NodeRole>,
17    /// A collection of key-value pairs.
18    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
19}
20impl CreateNodeInput {
21    /// The ID of the cluster.
22    pub fn cluster_id(&self) -> ::std::option::Option<&str> {
23        self.cluster_id.as_deref()
24    }
25    /// The user-specified name of the Node to be created.
26    pub fn name(&self) -> ::std::option::Option<&str> {
27        self.name.as_deref()
28    }
29    /// Documentation update needed
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 `.node_interface_mappings.is_none()`.
32    pub fn node_interface_mappings(&self) -> &[crate::types::NodeInterfaceMappingCreateRequest] {
33        self.node_interface_mappings.as_deref().unwrap_or_default()
34    }
35    /// An ID that you assign to a create request. This ID ensures idempotency when creating resources.
36    pub fn request_id(&self) -> ::std::option::Option<&str> {
37        self.request_id.as_deref()
38    }
39    /// The initial role of the Node in the Cluster. ACTIVE means the Node is available for encoding. BACKUP means the Node is a redundant Node and might get used if an ACTIVE Node fails.
40    pub fn role(&self) -> ::std::option::Option<&crate::types::NodeRole> {
41        self.role.as_ref()
42    }
43    /// A collection of key-value pairs.
44    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
45        self.tags.as_ref()
46    }
47}
48impl CreateNodeInput {
49    /// Creates a new builder-style object to manufacture [`CreateNodeInput`](crate::operation::create_node::CreateNodeInput).
50    pub fn builder() -> crate::operation::create_node::builders::CreateNodeInputBuilder {
51        crate::operation::create_node::builders::CreateNodeInputBuilder::default()
52    }
53}
54
55/// A builder for [`CreateNodeInput`](crate::operation::create_node::CreateNodeInput).
56#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
57#[non_exhaustive]
58pub struct CreateNodeInputBuilder {
59    pub(crate) cluster_id: ::std::option::Option<::std::string::String>,
60    pub(crate) name: ::std::option::Option<::std::string::String>,
61    pub(crate) node_interface_mappings: ::std::option::Option<::std::vec::Vec<crate::types::NodeInterfaceMappingCreateRequest>>,
62    pub(crate) request_id: ::std::option::Option<::std::string::String>,
63    pub(crate) role: ::std::option::Option<crate::types::NodeRole>,
64    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
65}
66impl CreateNodeInputBuilder {
67    /// The ID of the cluster.
68    /// This field is required.
69    pub fn cluster_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70        self.cluster_id = ::std::option::Option::Some(input.into());
71        self
72    }
73    /// The ID of the cluster.
74    pub fn set_cluster_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
75        self.cluster_id = input;
76        self
77    }
78    /// The ID of the cluster.
79    pub fn get_cluster_id(&self) -> &::std::option::Option<::std::string::String> {
80        &self.cluster_id
81    }
82    /// The user-specified name of the Node to be created.
83    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.name = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// The user-specified name of the Node to be created.
88    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.name = input;
90        self
91    }
92    /// The user-specified name of the Node to be created.
93    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
94        &self.name
95    }
96    /// Appends an item to `node_interface_mappings`.
97    ///
98    /// To override the contents of this collection use [`set_node_interface_mappings`](Self::set_node_interface_mappings).
99    ///
100    /// Documentation update needed
101    pub fn node_interface_mappings(mut self, input: crate::types::NodeInterfaceMappingCreateRequest) -> Self {
102        let mut v = self.node_interface_mappings.unwrap_or_default();
103        v.push(input);
104        self.node_interface_mappings = ::std::option::Option::Some(v);
105        self
106    }
107    /// Documentation update needed
108    pub fn set_node_interface_mappings(
109        mut self,
110        input: ::std::option::Option<::std::vec::Vec<crate::types::NodeInterfaceMappingCreateRequest>>,
111    ) -> Self {
112        self.node_interface_mappings = input;
113        self
114    }
115    /// Documentation update needed
116    pub fn get_node_interface_mappings(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::NodeInterfaceMappingCreateRequest>> {
117        &self.node_interface_mappings
118    }
119    /// An ID that you assign to a create request. This ID ensures idempotency when creating resources.
120    pub fn request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.request_id = ::std::option::Option::Some(input.into());
122        self
123    }
124    /// An ID that you assign to a create request. This ID ensures idempotency when creating resources.
125    pub fn set_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.request_id = input;
127        self
128    }
129    /// An ID that you assign to a create request. This ID ensures idempotency when creating resources.
130    pub fn get_request_id(&self) -> &::std::option::Option<::std::string::String> {
131        &self.request_id
132    }
133    /// The initial role of the Node in the Cluster. ACTIVE means the Node is available for encoding. BACKUP means the Node is a redundant Node and might get used if an ACTIVE Node fails.
134    pub fn role(mut self, input: crate::types::NodeRole) -> Self {
135        self.role = ::std::option::Option::Some(input);
136        self
137    }
138    /// The initial role of the Node in the Cluster. ACTIVE means the Node is available for encoding. BACKUP means the Node is a redundant Node and might get used if an ACTIVE Node fails.
139    pub fn set_role(mut self, input: ::std::option::Option<crate::types::NodeRole>) -> Self {
140        self.role = input;
141        self
142    }
143    /// The initial role of the Node in the Cluster. ACTIVE means the Node is available for encoding. BACKUP means the Node is a redundant Node and might get used if an ACTIVE Node fails.
144    pub fn get_role(&self) -> &::std::option::Option<crate::types::NodeRole> {
145        &self.role
146    }
147    /// Adds a key-value pair to `tags`.
148    ///
149    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
150    ///
151    /// A collection of key-value pairs.
152    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
153        let mut hash_map = self.tags.unwrap_or_default();
154        hash_map.insert(k.into(), v.into());
155        self.tags = ::std::option::Option::Some(hash_map);
156        self
157    }
158    /// A collection of key-value pairs.
159    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
160        self.tags = input;
161        self
162    }
163    /// A collection of key-value pairs.
164    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
165        &self.tags
166    }
167    /// Consumes the builder and constructs a [`CreateNodeInput`](crate::operation::create_node::CreateNodeInput).
168    pub fn build(self) -> ::std::result::Result<crate::operation::create_node::CreateNodeInput, ::aws_smithy_types::error::operation::BuildError> {
169        ::std::result::Result::Ok(crate::operation::create_node::CreateNodeInput {
170            cluster_id: self.cluster_id,
171            name: self.name,
172            node_interface_mappings: self.node_interface_mappings,
173            request_id: self.request_id,
174            role: self.role,
175            tags: self.tags,
176        })
177    }
178}