aws_sdk_iottwinmaker/operation/create_entity/
_create_entity_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateEntityInput {
6    /// <p>The ID of the workspace that contains the entity.</p>
7    pub workspace_id: ::std::option::Option<::std::string::String>,
8    /// <p>The ID of the entity.</p>
9    pub entity_id: ::std::option::Option<::std::string::String>,
10    /// <p>The name of the entity.</p>
11    pub entity_name: ::std::option::Option<::std::string::String>,
12    /// <p>The description of the entity.</p>
13    pub description: ::std::option::Option<::std::string::String>,
14    /// <p>An object that maps strings to the components in the entity. Each string in the mapping must be unique to this object.</p>
15    pub components: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ComponentRequest>>,
16    /// <p>This is an object that maps strings to <code>compositeComponent</code> updates in the request. Each key of the map represents the <code>componentPath</code> of the <code>compositeComponent</code>.</p>
17    pub composite_components: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentRequest>>,
18    /// <p>The ID of the entity's parent entity.</p>
19    pub parent_entity_id: ::std::option::Option<::std::string::String>,
20    /// <p>Metadata that you can use to manage the entity.</p>
21    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
22}
23impl CreateEntityInput {
24    /// <p>The ID of the workspace that contains the entity.</p>
25    pub fn workspace_id(&self) -> ::std::option::Option<&str> {
26        self.workspace_id.as_deref()
27    }
28    /// <p>The ID of the entity.</p>
29    pub fn entity_id(&self) -> ::std::option::Option<&str> {
30        self.entity_id.as_deref()
31    }
32    /// <p>The name of the entity.</p>
33    pub fn entity_name(&self) -> ::std::option::Option<&str> {
34        self.entity_name.as_deref()
35    }
36    /// <p>The description of the entity.</p>
37    pub fn description(&self) -> ::std::option::Option<&str> {
38        self.description.as_deref()
39    }
40    /// <p>An object that maps strings to the components in the entity. Each string in the mapping must be unique to this object.</p>
41    pub fn components(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::ComponentRequest>> {
42        self.components.as_ref()
43    }
44    /// <p>This is an object that maps strings to <code>compositeComponent</code> updates in the request. Each key of the map represents the <code>componentPath</code> of the <code>compositeComponent</code>.</p>
45    pub fn composite_components(
46        &self,
47    ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentRequest>> {
48        self.composite_components.as_ref()
49    }
50    /// <p>The ID of the entity's parent entity.</p>
51    pub fn parent_entity_id(&self) -> ::std::option::Option<&str> {
52        self.parent_entity_id.as_deref()
53    }
54    /// <p>Metadata that you can use to manage the entity.</p>
55    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
56        self.tags.as_ref()
57    }
58}
59impl CreateEntityInput {
60    /// Creates a new builder-style object to manufacture [`CreateEntityInput`](crate::operation::create_entity::CreateEntityInput).
61    pub fn builder() -> crate::operation::create_entity::builders::CreateEntityInputBuilder {
62        crate::operation::create_entity::builders::CreateEntityInputBuilder::default()
63    }
64}
65
66/// A builder for [`CreateEntityInput`](crate::operation::create_entity::CreateEntityInput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct CreateEntityInputBuilder {
70    pub(crate) workspace_id: ::std::option::Option<::std::string::String>,
71    pub(crate) entity_id: ::std::option::Option<::std::string::String>,
72    pub(crate) entity_name: ::std::option::Option<::std::string::String>,
73    pub(crate) description: ::std::option::Option<::std::string::String>,
74    pub(crate) components: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ComponentRequest>>,
75    pub(crate) composite_components:
76        ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentRequest>>,
77    pub(crate) parent_entity_id: ::std::option::Option<::std::string::String>,
78    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
79}
80impl CreateEntityInputBuilder {
81    /// <p>The ID of the workspace that contains the entity.</p>
82    /// This field is required.
83    pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.workspace_id = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The ID of the workspace that contains the entity.</p>
88    pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.workspace_id = input;
90        self
91    }
92    /// <p>The ID of the workspace that contains the entity.</p>
93    pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> {
94        &self.workspace_id
95    }
96    /// <p>The ID of the entity.</p>
97    pub fn entity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98        self.entity_id = ::std::option::Option::Some(input.into());
99        self
100    }
101    /// <p>The ID of the entity.</p>
102    pub fn set_entity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
103        self.entity_id = input;
104        self
105    }
106    /// <p>The ID of the entity.</p>
107    pub fn get_entity_id(&self) -> &::std::option::Option<::std::string::String> {
108        &self.entity_id
109    }
110    /// <p>The name of the entity.</p>
111    /// This field is required.
112    pub fn entity_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.entity_name = ::std::option::Option::Some(input.into());
114        self
115    }
116    /// <p>The name of the entity.</p>
117    pub fn set_entity_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.entity_name = input;
119        self
120    }
121    /// <p>The name of the entity.</p>
122    pub fn get_entity_name(&self) -> &::std::option::Option<::std::string::String> {
123        &self.entity_name
124    }
125    /// <p>The description of the entity.</p>
126    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.description = ::std::option::Option::Some(input.into());
128        self
129    }
130    /// <p>The description of the entity.</p>
131    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.description = input;
133        self
134    }
135    /// <p>The description of the entity.</p>
136    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
137        &self.description
138    }
139    /// Adds a key-value pair to `components`.
140    ///
141    /// To override the contents of this collection use [`set_components`](Self::set_components).
142    ///
143    /// <p>An object that maps strings to the components in the entity. Each string in the mapping must be unique to this object.</p>
144    pub fn components(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::ComponentRequest) -> Self {
145        let mut hash_map = self.components.unwrap_or_default();
146        hash_map.insert(k.into(), v);
147        self.components = ::std::option::Option::Some(hash_map);
148        self
149    }
150    /// <p>An object that maps strings to the components in the entity. Each string in the mapping must be unique to this object.</p>
151    pub fn set_components(
152        mut self,
153        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ComponentRequest>>,
154    ) -> Self {
155        self.components = input;
156        self
157    }
158    /// <p>An object that maps strings to the components in the entity. Each string in the mapping must be unique to this object.</p>
159    pub fn get_components(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ComponentRequest>> {
160        &self.components
161    }
162    /// Adds a key-value pair to `composite_components`.
163    ///
164    /// To override the contents of this collection use [`set_composite_components`](Self::set_composite_components).
165    ///
166    /// <p>This is an object that maps strings to <code>compositeComponent</code> updates in the request. Each key of the map represents the <code>componentPath</code> of the <code>compositeComponent</code>.</p>
167    pub fn composite_components(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::CompositeComponentRequest) -> Self {
168        let mut hash_map = self.composite_components.unwrap_or_default();
169        hash_map.insert(k.into(), v);
170        self.composite_components = ::std::option::Option::Some(hash_map);
171        self
172    }
173    /// <p>This is an object that maps strings to <code>compositeComponent</code> updates in the request. Each key of the map represents the <code>componentPath</code> of the <code>compositeComponent</code>.</p>
174    pub fn set_composite_components(
175        mut self,
176        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentRequest>>,
177    ) -> Self {
178        self.composite_components = input;
179        self
180    }
181    /// <p>This is an object that maps strings to <code>compositeComponent</code> updates in the request. Each key of the map represents the <code>componentPath</code> of the <code>compositeComponent</code>.</p>
182    pub fn get_composite_components(
183        &self,
184    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentRequest>> {
185        &self.composite_components
186    }
187    /// <p>The ID of the entity's parent entity.</p>
188    pub fn parent_entity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189        self.parent_entity_id = ::std::option::Option::Some(input.into());
190        self
191    }
192    /// <p>The ID of the entity's parent entity.</p>
193    pub fn set_parent_entity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194        self.parent_entity_id = input;
195        self
196    }
197    /// <p>The ID of the entity's parent entity.</p>
198    pub fn get_parent_entity_id(&self) -> &::std::option::Option<::std::string::String> {
199        &self.parent_entity_id
200    }
201    /// Adds a key-value pair to `tags`.
202    ///
203    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
204    ///
205    /// <p>Metadata that you can use to manage the entity.</p>
206    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
207        let mut hash_map = self.tags.unwrap_or_default();
208        hash_map.insert(k.into(), v.into());
209        self.tags = ::std::option::Option::Some(hash_map);
210        self
211    }
212    /// <p>Metadata that you can use to manage the entity.</p>
213    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
214        self.tags = input;
215        self
216    }
217    /// <p>Metadata that you can use to manage the entity.</p>
218    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
219        &self.tags
220    }
221    /// Consumes the builder and constructs a [`CreateEntityInput`](crate::operation::create_entity::CreateEntityInput).
222    pub fn build(
223        self,
224    ) -> ::std::result::Result<crate::operation::create_entity::CreateEntityInput, ::aws_smithy_types::error::operation::BuildError> {
225        ::std::result::Result::Ok(crate::operation::create_entity::CreateEntityInput {
226            workspace_id: self.workspace_id,
227            entity_id: self.entity_id,
228            entity_name: self.entity_name,
229            description: self.description,
230            components: self.components,
231            composite_components: self.composite_components,
232            parent_entity_id: self.parent_entity_id,
233            tags: self.tags,
234        })
235    }
236}