aws_sdk_iotsitewise/operation/create_asset/
_create_asset_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 CreateAssetInput {
6    /// <p>A friendly name for the asset.</p>
7    pub asset_name: ::std::option::Option<::std::string::String>,
8    /// <p>The ID of the asset model from which to create the asset. This can be either the actual ID in UUID format, or else <code>externalId:</code> followed by the external ID, if it has one. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references">Referencing objects with external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
9    pub asset_model_id: ::std::option::Option<::std::string::String>,
10    /// <p>The ID to assign to the asset, if desired. IoT SiteWise automatically generates a unique ID for you, so this parameter is never required. However, if you prefer to supply your own ID instead, you can specify it here in UUID format. If you specify your own ID, it must be globally unique.</p>
11    pub asset_id: ::std::option::Option<::std::string::String>,
12    /// <p>An external ID to assign to the asset. The external ID must be unique within your Amazon Web Services account. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids">Using external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
13    pub asset_external_id: ::std::option::Option<::std::string::String>,
14    /// <p>A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.</p>
15    pub client_token: ::std::option::Option<::std::string::String>,
16    /// <p>A list of key-value pairs that contain metadata for the asset. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html">Tagging your IoT SiteWise resources</a> in the <i>IoT SiteWise User Guide</i>.</p>
17    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
18    /// <p>A description for the asset.</p>
19    pub asset_description: ::std::option::Option<::std::string::String>,
20}
21impl CreateAssetInput {
22    /// <p>A friendly name for the asset.</p>
23    pub fn asset_name(&self) -> ::std::option::Option<&str> {
24        self.asset_name.as_deref()
25    }
26    /// <p>The ID of the asset model from which to create the asset. This can be either the actual ID in UUID format, or else <code>externalId:</code> followed by the external ID, if it has one. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references">Referencing objects with external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
27    pub fn asset_model_id(&self) -> ::std::option::Option<&str> {
28        self.asset_model_id.as_deref()
29    }
30    /// <p>The ID to assign to the asset, if desired. IoT SiteWise automatically generates a unique ID for you, so this parameter is never required. However, if you prefer to supply your own ID instead, you can specify it here in UUID format. If you specify your own ID, it must be globally unique.</p>
31    pub fn asset_id(&self) -> ::std::option::Option<&str> {
32        self.asset_id.as_deref()
33    }
34    /// <p>An external ID to assign to the asset. The external ID must be unique within your Amazon Web Services account. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids">Using external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
35    pub fn asset_external_id(&self) -> ::std::option::Option<&str> {
36        self.asset_external_id.as_deref()
37    }
38    /// <p>A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.</p>
39    pub fn client_token(&self) -> ::std::option::Option<&str> {
40        self.client_token.as_deref()
41    }
42    /// <p>A list of key-value pairs that contain metadata for the asset. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html">Tagging your IoT SiteWise resources</a> in the <i>IoT SiteWise User Guide</i>.</p>
43    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
44        self.tags.as_ref()
45    }
46    /// <p>A description for the asset.</p>
47    pub fn asset_description(&self) -> ::std::option::Option<&str> {
48        self.asset_description.as_deref()
49    }
50}
51impl CreateAssetInput {
52    /// Creates a new builder-style object to manufacture [`CreateAssetInput`](crate::operation::create_asset::CreateAssetInput).
53    pub fn builder() -> crate::operation::create_asset::builders::CreateAssetInputBuilder {
54        crate::operation::create_asset::builders::CreateAssetInputBuilder::default()
55    }
56}
57
58/// A builder for [`CreateAssetInput`](crate::operation::create_asset::CreateAssetInput).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
60#[non_exhaustive]
61pub struct CreateAssetInputBuilder {
62    pub(crate) asset_name: ::std::option::Option<::std::string::String>,
63    pub(crate) asset_model_id: ::std::option::Option<::std::string::String>,
64    pub(crate) asset_id: ::std::option::Option<::std::string::String>,
65    pub(crate) asset_external_id: ::std::option::Option<::std::string::String>,
66    pub(crate) client_token: ::std::option::Option<::std::string::String>,
67    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
68    pub(crate) asset_description: ::std::option::Option<::std::string::String>,
69}
70impl CreateAssetInputBuilder {
71    /// <p>A friendly name for the asset.</p>
72    /// This field is required.
73    pub fn asset_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.asset_name = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <p>A friendly name for the asset.</p>
78    pub fn set_asset_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.asset_name = input;
80        self
81    }
82    /// <p>A friendly name for the asset.</p>
83    pub fn get_asset_name(&self) -> &::std::option::Option<::std::string::String> {
84        &self.asset_name
85    }
86    /// <p>The ID of the asset model from which to create the asset. This can be either the actual ID in UUID format, or else <code>externalId:</code> followed by the external ID, if it has one. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references">Referencing objects with external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
87    /// This field is required.
88    pub fn asset_model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.asset_model_id = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>The ID of the asset model from which to create the asset. This can be either the actual ID in UUID format, or else <code>externalId:</code> followed by the external ID, if it has one. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references">Referencing objects with external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
93    pub fn set_asset_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.asset_model_id = input;
95        self
96    }
97    /// <p>The ID of the asset model from which to create the asset. This can be either the actual ID in UUID format, or else <code>externalId:</code> followed by the external ID, if it has one. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references">Referencing objects with external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
98    pub fn get_asset_model_id(&self) -> &::std::option::Option<::std::string::String> {
99        &self.asset_model_id
100    }
101    /// <p>The ID to assign to the asset, if desired. IoT SiteWise automatically generates a unique ID for you, so this parameter is never required. However, if you prefer to supply your own ID instead, you can specify it here in UUID format. If you specify your own ID, it must be globally unique.</p>
102    pub fn asset_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.asset_id = ::std::option::Option::Some(input.into());
104        self
105    }
106    /// <p>The ID to assign to the asset, if desired. IoT SiteWise automatically generates a unique ID for you, so this parameter is never required. However, if you prefer to supply your own ID instead, you can specify it here in UUID format. If you specify your own ID, it must be globally unique.</p>
107    pub fn set_asset_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.asset_id = input;
109        self
110    }
111    /// <p>The ID to assign to the asset, if desired. IoT SiteWise automatically generates a unique ID for you, so this parameter is never required. However, if you prefer to supply your own ID instead, you can specify it here in UUID format. If you specify your own ID, it must be globally unique.</p>
112    pub fn get_asset_id(&self) -> &::std::option::Option<::std::string::String> {
113        &self.asset_id
114    }
115    /// <p>An external ID to assign to the asset. The external ID must be unique within your Amazon Web Services account. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids">Using external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
116    pub fn asset_external_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.asset_external_id = ::std::option::Option::Some(input.into());
118        self
119    }
120    /// <p>An external ID to assign to the asset. The external ID must be unique within your Amazon Web Services account. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids">Using external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
121    pub fn set_asset_external_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.asset_external_id = input;
123        self
124    }
125    /// <p>An external ID to assign to the asset. The external ID must be unique within your Amazon Web Services account. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids">Using external IDs</a> in the <i>IoT SiteWise User Guide</i>.</p>
126    pub fn get_asset_external_id(&self) -> &::std::option::Option<::std::string::String> {
127        &self.asset_external_id
128    }
129    /// <p>A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.</p>
130    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.client_token = ::std::option::Option::Some(input.into());
132        self
133    }
134    /// <p>A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.</p>
135    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.client_token = input;
137        self
138    }
139    /// <p>A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.</p>
140    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
141        &self.client_token
142    }
143    /// Adds a key-value pair to `tags`.
144    ///
145    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
146    ///
147    /// <p>A list of key-value pairs that contain metadata for the asset. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html">Tagging your IoT SiteWise resources</a> in the <i>IoT SiteWise User Guide</i>.</p>
148    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
149        let mut hash_map = self.tags.unwrap_or_default();
150        hash_map.insert(k.into(), v.into());
151        self.tags = ::std::option::Option::Some(hash_map);
152        self
153    }
154    /// <p>A list of key-value pairs that contain metadata for the asset. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html">Tagging your IoT SiteWise resources</a> in the <i>IoT SiteWise User Guide</i>.</p>
155    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
156        self.tags = input;
157        self
158    }
159    /// <p>A list of key-value pairs that contain metadata for the asset. For more information, see <a href="https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html">Tagging your IoT SiteWise resources</a> in the <i>IoT SiteWise User Guide</i>.</p>
160    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
161        &self.tags
162    }
163    /// <p>A description for the asset.</p>
164    pub fn asset_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
165        self.asset_description = ::std::option::Option::Some(input.into());
166        self
167    }
168    /// <p>A description for the asset.</p>
169    pub fn set_asset_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
170        self.asset_description = input;
171        self
172    }
173    /// <p>A description for the asset.</p>
174    pub fn get_asset_description(&self) -> &::std::option::Option<::std::string::String> {
175        &self.asset_description
176    }
177    /// Consumes the builder and constructs a [`CreateAssetInput`](crate::operation::create_asset::CreateAssetInput).
178    pub fn build(self) -> ::std::result::Result<crate::operation::create_asset::CreateAssetInput, ::aws_smithy_types::error::operation::BuildError> {
179        ::std::result::Result::Ok(crate::operation::create_asset::CreateAssetInput {
180            asset_name: self.asset_name,
181            asset_model_id: self.asset_model_id,
182            asset_id: self.asset_id,
183            asset_external_id: self.asset_external_id,
184            client_token: self.client_token,
185            tags: self.tags,
186            asset_description: self.asset_description,
187        })
188    }
189}