Skip to main content

aws_sdk_iottwinmaker/operation/create_component_type/
_create_component_type_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 CreateComponentTypeInput {
6    /// <p>The ID of the workspace that contains the component type.</p>
7    pub workspace_id: ::std::option::Option<::std::string::String>,
8    /// <p>A Boolean value that specifies whether an entity can have more than one component of this type.</p>
9    pub is_singleton: ::std::option::Option<bool>,
10    /// <p>The ID of the component type.</p>
11    pub component_type_id: ::std::option::Option<::std::string::String>,
12    /// <p>The description of the component type.</p>
13    pub description: ::std::option::Option<::std::string::String>,
14    /// <p>An object that maps strings to the property definitions in the component type. Each string in the mapping must be unique to this object.</p>
15    pub property_definitions: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PropertyDefinitionRequest>>,
16    /// <p>Specifies the parent component type to extend.</p>
17    pub extends_from: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
18    /// <p>An object that maps strings to the functions in the component type. Each string in the mapping must be unique to this object.</p>
19    pub functions: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FunctionRequest>>,
20    /// <p>Metadata that you can use to manage the component type.</p>
21    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
22    /// <p></p>
23    pub property_groups: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PropertyGroupRequest>>,
24    /// <p>A friendly name for the component type.</p>
25    pub component_type_name: ::std::option::Option<::std::string::String>,
26    /// <p>This is an object that maps strings to <code>compositeComponentTypes</code> of the <code>componentType</code>. <code>CompositeComponentType</code> is referenced by <code>componentTypeId</code>.</p>
27    pub composite_component_types:
28        ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentTypeRequest>>,
29}
30impl CreateComponentTypeInput {
31    /// <p>The ID of the workspace that contains the component type.</p>
32    pub fn workspace_id(&self) -> ::std::option::Option<&str> {
33        self.workspace_id.as_deref()
34    }
35    /// <p>A Boolean value that specifies whether an entity can have more than one component of this type.</p>
36    pub fn is_singleton(&self) -> ::std::option::Option<bool> {
37        self.is_singleton
38    }
39    /// <p>The ID of the component type.</p>
40    pub fn component_type_id(&self) -> ::std::option::Option<&str> {
41        self.component_type_id.as_deref()
42    }
43    /// <p>The description of the component type.</p>
44    pub fn description(&self) -> ::std::option::Option<&str> {
45        self.description.as_deref()
46    }
47    /// <p>An object that maps strings to the property definitions in the component type. Each string in the mapping must be unique to this object.</p>
48    pub fn property_definitions(
49        &self,
50    ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::PropertyDefinitionRequest>> {
51        self.property_definitions.as_ref()
52    }
53    /// <p>Specifies the parent component type to extend.</p>
54    ///
55    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.extends_from.is_none()`.
56    pub fn extends_from(&self) -> &[::std::string::String] {
57        self.extends_from.as_deref().unwrap_or_default()
58    }
59    /// <p>An object that maps strings to the functions in the component type. Each string in the mapping must be unique to this object.</p>
60    pub fn functions(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::FunctionRequest>> {
61        self.functions.as_ref()
62    }
63    /// <p>Metadata that you can use to manage the component type.</p>
64    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
65        self.tags.as_ref()
66    }
67    /// <p></p>
68    pub fn property_groups(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::PropertyGroupRequest>> {
69        self.property_groups.as_ref()
70    }
71    /// <p>A friendly name for the component type.</p>
72    pub fn component_type_name(&self) -> ::std::option::Option<&str> {
73        self.component_type_name.as_deref()
74    }
75    /// <p>This is an object that maps strings to <code>compositeComponentTypes</code> of the <code>componentType</code>. <code>CompositeComponentType</code> is referenced by <code>componentTypeId</code>.</p>
76    pub fn composite_component_types(
77        &self,
78    ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentTypeRequest>> {
79        self.composite_component_types.as_ref()
80    }
81}
82impl CreateComponentTypeInput {
83    /// Creates a new builder-style object to manufacture [`CreateComponentTypeInput`](crate::operation::create_component_type::CreateComponentTypeInput).
84    pub fn builder() -> crate::operation::create_component_type::builders::CreateComponentTypeInputBuilder {
85        crate::operation::create_component_type::builders::CreateComponentTypeInputBuilder::default()
86    }
87}
88
89/// A builder for [`CreateComponentTypeInput`](crate::operation::create_component_type::CreateComponentTypeInput).
90#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
91#[non_exhaustive]
92pub struct CreateComponentTypeInputBuilder {
93    pub(crate) workspace_id: ::std::option::Option<::std::string::String>,
94    pub(crate) is_singleton: ::std::option::Option<bool>,
95    pub(crate) component_type_id: ::std::option::Option<::std::string::String>,
96    pub(crate) description: ::std::option::Option<::std::string::String>,
97    pub(crate) property_definitions:
98        ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PropertyDefinitionRequest>>,
99    pub(crate) extends_from: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
100    pub(crate) functions: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FunctionRequest>>,
101    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
102    pub(crate) property_groups: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PropertyGroupRequest>>,
103    pub(crate) component_type_name: ::std::option::Option<::std::string::String>,
104    pub(crate) composite_component_types:
105        ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentTypeRequest>>,
106}
107impl CreateComponentTypeInputBuilder {
108    /// <p>The ID of the workspace that contains the component type.</p>
109    /// This field is required.
110    pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        self.workspace_id = ::std::option::Option::Some(input.into());
112        self
113    }
114    /// <p>The ID of the workspace that contains the component type.</p>
115    pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.workspace_id = input;
117        self
118    }
119    /// <p>The ID of the workspace that contains the component type.</p>
120    pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> {
121        &self.workspace_id
122    }
123    /// <p>A Boolean value that specifies whether an entity can have more than one component of this type.</p>
124    pub fn is_singleton(mut self, input: bool) -> Self {
125        self.is_singleton = ::std::option::Option::Some(input);
126        self
127    }
128    /// <p>A Boolean value that specifies whether an entity can have more than one component of this type.</p>
129    pub fn set_is_singleton(mut self, input: ::std::option::Option<bool>) -> Self {
130        self.is_singleton = input;
131        self
132    }
133    /// <p>A Boolean value that specifies whether an entity can have more than one component of this type.</p>
134    pub fn get_is_singleton(&self) -> &::std::option::Option<bool> {
135        &self.is_singleton
136    }
137    /// <p>The ID of the component type.</p>
138    /// This field is required.
139    pub fn component_type_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        self.component_type_id = ::std::option::Option::Some(input.into());
141        self
142    }
143    /// <p>The ID of the component type.</p>
144    pub fn set_component_type_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145        self.component_type_id = input;
146        self
147    }
148    /// <p>The ID of the component type.</p>
149    pub fn get_component_type_id(&self) -> &::std::option::Option<::std::string::String> {
150        &self.component_type_id
151    }
152    /// <p>The description of the component type.</p>
153    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154        self.description = ::std::option::Option::Some(input.into());
155        self
156    }
157    /// <p>The description of the component type.</p>
158    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
159        self.description = input;
160        self
161    }
162    /// <p>The description of the component type.</p>
163    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
164        &self.description
165    }
166    /// Adds a key-value pair to `property_definitions`.
167    ///
168    /// To override the contents of this collection use [`set_property_definitions`](Self::set_property_definitions).
169    ///
170    /// <p>An object that maps strings to the property definitions in the component type. Each string in the mapping must be unique to this object.</p>
171    pub fn property_definitions(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::PropertyDefinitionRequest) -> Self {
172        let mut hash_map = self.property_definitions.unwrap_or_default();
173        hash_map.insert(k.into(), v);
174        self.property_definitions = ::std::option::Option::Some(hash_map);
175        self
176    }
177    /// <p>An object that maps strings to the property definitions in the component type. Each string in the mapping must be unique to this object.</p>
178    pub fn set_property_definitions(
179        mut self,
180        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PropertyDefinitionRequest>>,
181    ) -> Self {
182        self.property_definitions = input;
183        self
184    }
185    /// <p>An object that maps strings to the property definitions in the component type. Each string in the mapping must be unique to this object.</p>
186    pub fn get_property_definitions(
187        &self,
188    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PropertyDefinitionRequest>> {
189        &self.property_definitions
190    }
191    /// Appends an item to `extends_from`.
192    ///
193    /// To override the contents of this collection use [`set_extends_from`](Self::set_extends_from).
194    ///
195    /// <p>Specifies the parent component type to extend.</p>
196    pub fn extends_from(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
197        let mut v = self.extends_from.unwrap_or_default();
198        v.push(input.into());
199        self.extends_from = ::std::option::Option::Some(v);
200        self
201    }
202    /// <p>Specifies the parent component type to extend.</p>
203    pub fn set_extends_from(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
204        self.extends_from = input;
205        self
206    }
207    /// <p>Specifies the parent component type to extend.</p>
208    pub fn get_extends_from(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
209        &self.extends_from
210    }
211    /// Adds a key-value pair to `functions`.
212    ///
213    /// To override the contents of this collection use [`set_functions`](Self::set_functions).
214    ///
215    /// <p>An object that maps strings to the functions in the component type. Each string in the mapping must be unique to this object.</p>
216    pub fn functions(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::FunctionRequest) -> Self {
217        let mut hash_map = self.functions.unwrap_or_default();
218        hash_map.insert(k.into(), v);
219        self.functions = ::std::option::Option::Some(hash_map);
220        self
221    }
222    /// <p>An object that maps strings to the functions in the component type. Each string in the mapping must be unique to this object.</p>
223    pub fn set_functions(
224        mut self,
225        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FunctionRequest>>,
226    ) -> Self {
227        self.functions = input;
228        self
229    }
230    /// <p>An object that maps strings to the functions in the component type. Each string in the mapping must be unique to this object.</p>
231    pub fn get_functions(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FunctionRequest>> {
232        &self.functions
233    }
234    /// Adds a key-value pair to `tags`.
235    ///
236    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
237    ///
238    /// <p>Metadata that you can use to manage the component type.</p>
239    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
240        let mut hash_map = self.tags.unwrap_or_default();
241        hash_map.insert(k.into(), v.into());
242        self.tags = ::std::option::Option::Some(hash_map);
243        self
244    }
245    /// <p>Metadata that you can use to manage the component type.</p>
246    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
247        self.tags = input;
248        self
249    }
250    /// <p>Metadata that you can use to manage the component type.</p>
251    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
252        &self.tags
253    }
254    /// Adds a key-value pair to `property_groups`.
255    ///
256    /// To override the contents of this collection use [`set_property_groups`](Self::set_property_groups).
257    ///
258    /// <p></p>
259    pub fn property_groups(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::PropertyGroupRequest) -> Self {
260        let mut hash_map = self.property_groups.unwrap_or_default();
261        hash_map.insert(k.into(), v);
262        self.property_groups = ::std::option::Option::Some(hash_map);
263        self
264    }
265    /// <p></p>
266    pub fn set_property_groups(
267        mut self,
268        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PropertyGroupRequest>>,
269    ) -> Self {
270        self.property_groups = input;
271        self
272    }
273    /// <p></p>
274    pub fn get_property_groups(
275        &self,
276    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::PropertyGroupRequest>> {
277        &self.property_groups
278    }
279    /// <p>A friendly name for the component type.</p>
280    pub fn component_type_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
281        self.component_type_name = ::std::option::Option::Some(input.into());
282        self
283    }
284    /// <p>A friendly name for the component type.</p>
285    pub fn set_component_type_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
286        self.component_type_name = input;
287        self
288    }
289    /// <p>A friendly name for the component type.</p>
290    pub fn get_component_type_name(&self) -> &::std::option::Option<::std::string::String> {
291        &self.component_type_name
292    }
293    /// Adds a key-value pair to `composite_component_types`.
294    ///
295    /// To override the contents of this collection use [`set_composite_component_types`](Self::set_composite_component_types).
296    ///
297    /// <p>This is an object that maps strings to <code>compositeComponentTypes</code> of the <code>componentType</code>. <code>CompositeComponentType</code> is referenced by <code>componentTypeId</code>.</p>
298    pub fn composite_component_types(
299        mut self,
300        k: impl ::std::convert::Into<::std::string::String>,
301        v: crate::types::CompositeComponentTypeRequest,
302    ) -> Self {
303        let mut hash_map = self.composite_component_types.unwrap_or_default();
304        hash_map.insert(k.into(), v);
305        self.composite_component_types = ::std::option::Option::Some(hash_map);
306        self
307    }
308    /// <p>This is an object that maps strings to <code>compositeComponentTypes</code> of the <code>componentType</code>. <code>CompositeComponentType</code> is referenced by <code>componentTypeId</code>.</p>
309    pub fn set_composite_component_types(
310        mut self,
311        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentTypeRequest>>,
312    ) -> Self {
313        self.composite_component_types = input;
314        self
315    }
316    /// <p>This is an object that maps strings to <code>compositeComponentTypes</code> of the <code>componentType</code>. <code>CompositeComponentType</code> is referenced by <code>componentTypeId</code>.</p>
317    pub fn get_composite_component_types(
318        &self,
319    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::CompositeComponentTypeRequest>> {
320        &self.composite_component_types
321    }
322    /// Consumes the builder and constructs a [`CreateComponentTypeInput`](crate::operation::create_component_type::CreateComponentTypeInput).
323    pub fn build(
324        self,
325    ) -> ::std::result::Result<crate::operation::create_component_type::CreateComponentTypeInput, ::aws_smithy_types::error::operation::BuildError>
326    {
327        ::std::result::Result::Ok(crate::operation::create_component_type::CreateComponentTypeInput {
328            workspace_id: self.workspace_id,
329            is_singleton: self.is_singleton,
330            component_type_id: self.component_type_id,
331            description: self.description,
332            property_definitions: self.property_definitions,
333            extends_from: self.extends_from,
334            functions: self.functions,
335            tags: self.tags,
336            property_groups: self.property_groups,
337            component_type_name: self.component_type_name,
338            composite_component_types: self.composite_component_types,
339        })
340    }
341}