aws_sdk_iotsitewise/operation/describe_asset/
_describe_asset_output.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 DescribeAssetOutput {
6    /// <p>The ID of the asset, in UUID format.</p>
7    pub asset_id: ::std::string::String,
8    /// <p>The external ID of the asset, if any.</p>
9    pub asset_external_id: ::std::option::Option<::std::string::String>,
10    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the asset, which has the following format.</p>
11    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
12    pub asset_arn: ::std::string::String,
13    /// <p>The name of the asset.</p>
14    pub asset_name: ::std::string::String,
15    /// <p>The ID of the asset model that was used to create the asset.</p>
16    pub asset_model_id: ::std::string::String,
17    /// <p>The list of asset properties for the asset.</p>
18    /// <p>This object doesn't include properties that you define in composite models. You can find composite model properties in the <code>assetCompositeModels</code> object.</p>
19    pub asset_properties: ::std::vec::Vec<crate::types::AssetProperty>,
20    /// <p>A list of asset hierarchies that each contain a <code>hierarchyId</code>. A hierarchy specifies allowed parent/child asset relationships.</p>
21    pub asset_hierarchies: ::std::vec::Vec<crate::types::AssetHierarchy>,
22    /// <p>The composite models for the asset.</p>
23    pub asset_composite_models: ::std::option::Option<::std::vec::Vec<crate::types::AssetCompositeModel>>,
24    /// <p>The date the asset was created, in Unix epoch time.</p>
25    pub asset_creation_date: ::aws_smithy_types::DateTime,
26    /// <p>The date the asset was last updated, in Unix epoch time.</p>
27    pub asset_last_update_date: ::aws_smithy_types::DateTime,
28    /// <p>The current status of the asset, which contains a state and any error message.</p>
29    pub asset_status: ::std::option::Option<crate::types::AssetStatus>,
30    /// <p>A description for the asset.</p>
31    pub asset_description: ::std::option::Option<::std::string::String>,
32    /// <p>The list of the immediate child custom composite model summaries for the asset.</p>
33    pub asset_composite_model_summaries: ::std::option::Option<::std::vec::Vec<crate::types::AssetCompositeModelSummary>>,
34    _request_id: Option<String>,
35}
36impl DescribeAssetOutput {
37    /// <p>The ID of the asset, in UUID format.</p>
38    pub fn asset_id(&self) -> &str {
39        use std::ops::Deref;
40        self.asset_id.deref()
41    }
42    /// <p>The external ID of the asset, if any.</p>
43    pub fn asset_external_id(&self) -> ::std::option::Option<&str> {
44        self.asset_external_id.as_deref()
45    }
46    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the asset, which has the following format.</p>
47    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
48    pub fn asset_arn(&self) -> &str {
49        use std::ops::Deref;
50        self.asset_arn.deref()
51    }
52    /// <p>The name of the asset.</p>
53    pub fn asset_name(&self) -> &str {
54        use std::ops::Deref;
55        self.asset_name.deref()
56    }
57    /// <p>The ID of the asset model that was used to create the asset.</p>
58    pub fn asset_model_id(&self) -> &str {
59        use std::ops::Deref;
60        self.asset_model_id.deref()
61    }
62    /// <p>The list of asset properties for the asset.</p>
63    /// <p>This object doesn't include properties that you define in composite models. You can find composite model properties in the <code>assetCompositeModels</code> object.</p>
64    pub fn asset_properties(&self) -> &[crate::types::AssetProperty] {
65        use std::ops::Deref;
66        self.asset_properties.deref()
67    }
68    /// <p>A list of asset hierarchies that each contain a <code>hierarchyId</code>. A hierarchy specifies allowed parent/child asset relationships.</p>
69    pub fn asset_hierarchies(&self) -> &[crate::types::AssetHierarchy] {
70        use std::ops::Deref;
71        self.asset_hierarchies.deref()
72    }
73    /// <p>The composite models for the asset.</p>
74    ///
75    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.asset_composite_models.is_none()`.
76    pub fn asset_composite_models(&self) -> &[crate::types::AssetCompositeModel] {
77        self.asset_composite_models.as_deref().unwrap_or_default()
78    }
79    /// <p>The date the asset was created, in Unix epoch time.</p>
80    pub fn asset_creation_date(&self) -> &::aws_smithy_types::DateTime {
81        &self.asset_creation_date
82    }
83    /// <p>The date the asset was last updated, in Unix epoch time.</p>
84    pub fn asset_last_update_date(&self) -> &::aws_smithy_types::DateTime {
85        &self.asset_last_update_date
86    }
87    /// <p>The current status of the asset, which contains a state and any error message.</p>
88    pub fn asset_status(&self) -> ::std::option::Option<&crate::types::AssetStatus> {
89        self.asset_status.as_ref()
90    }
91    /// <p>A description for the asset.</p>
92    pub fn asset_description(&self) -> ::std::option::Option<&str> {
93        self.asset_description.as_deref()
94    }
95    /// <p>The list of the immediate child custom composite model summaries for the asset.</p>
96    ///
97    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.asset_composite_model_summaries.is_none()`.
98    pub fn asset_composite_model_summaries(&self) -> &[crate::types::AssetCompositeModelSummary] {
99        self.asset_composite_model_summaries.as_deref().unwrap_or_default()
100    }
101}
102impl ::aws_types::request_id::RequestId for DescribeAssetOutput {
103    fn request_id(&self) -> Option<&str> {
104        self._request_id.as_deref()
105    }
106}
107impl DescribeAssetOutput {
108    /// Creates a new builder-style object to manufacture [`DescribeAssetOutput`](crate::operation::describe_asset::DescribeAssetOutput).
109    pub fn builder() -> crate::operation::describe_asset::builders::DescribeAssetOutputBuilder {
110        crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::default()
111    }
112}
113
114/// A builder for [`DescribeAssetOutput`](crate::operation::describe_asset::DescribeAssetOutput).
115#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
116#[non_exhaustive]
117pub struct DescribeAssetOutputBuilder {
118    pub(crate) asset_id: ::std::option::Option<::std::string::String>,
119    pub(crate) asset_external_id: ::std::option::Option<::std::string::String>,
120    pub(crate) asset_arn: ::std::option::Option<::std::string::String>,
121    pub(crate) asset_name: ::std::option::Option<::std::string::String>,
122    pub(crate) asset_model_id: ::std::option::Option<::std::string::String>,
123    pub(crate) asset_properties: ::std::option::Option<::std::vec::Vec<crate::types::AssetProperty>>,
124    pub(crate) asset_hierarchies: ::std::option::Option<::std::vec::Vec<crate::types::AssetHierarchy>>,
125    pub(crate) asset_composite_models: ::std::option::Option<::std::vec::Vec<crate::types::AssetCompositeModel>>,
126    pub(crate) asset_creation_date: ::std::option::Option<::aws_smithy_types::DateTime>,
127    pub(crate) asset_last_update_date: ::std::option::Option<::aws_smithy_types::DateTime>,
128    pub(crate) asset_status: ::std::option::Option<crate::types::AssetStatus>,
129    pub(crate) asset_description: ::std::option::Option<::std::string::String>,
130    pub(crate) asset_composite_model_summaries: ::std::option::Option<::std::vec::Vec<crate::types::AssetCompositeModelSummary>>,
131    _request_id: Option<String>,
132}
133impl DescribeAssetOutputBuilder {
134    /// <p>The ID of the asset, in UUID format.</p>
135    /// This field is required.
136    pub fn asset_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.asset_id = ::std::option::Option::Some(input.into());
138        self
139    }
140    /// <p>The ID of the asset, in UUID format.</p>
141    pub fn set_asset_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.asset_id = input;
143        self
144    }
145    /// <p>The ID of the asset, in UUID format.</p>
146    pub fn get_asset_id(&self) -> &::std::option::Option<::std::string::String> {
147        &self.asset_id
148    }
149    /// <p>The external ID of the asset, if any.</p>
150    pub fn asset_external_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.asset_external_id = ::std::option::Option::Some(input.into());
152        self
153    }
154    /// <p>The external ID of the asset, if any.</p>
155    pub fn set_asset_external_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.asset_external_id = input;
157        self
158    }
159    /// <p>The external ID of the asset, if any.</p>
160    pub fn get_asset_external_id(&self) -> &::std::option::Option<::std::string::String> {
161        &self.asset_external_id
162    }
163    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the asset, which has the following format.</p>
164    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
165    /// This field is required.
166    pub fn asset_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.asset_arn = ::std::option::Option::Some(input.into());
168        self
169    }
170    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the asset, which has the following format.</p>
171    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
172    pub fn set_asset_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
173        self.asset_arn = input;
174        self
175    }
176    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the asset, which has the following format.</p>
177    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
178    pub fn get_asset_arn(&self) -> &::std::option::Option<::std::string::String> {
179        &self.asset_arn
180    }
181    /// <p>The name of the asset.</p>
182    /// This field is required.
183    pub fn asset_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184        self.asset_name = ::std::option::Option::Some(input.into());
185        self
186    }
187    /// <p>The name of the asset.</p>
188    pub fn set_asset_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189        self.asset_name = input;
190        self
191    }
192    /// <p>The name of the asset.</p>
193    pub fn get_asset_name(&self) -> &::std::option::Option<::std::string::String> {
194        &self.asset_name
195    }
196    /// <p>The ID of the asset model that was used to create the asset.</p>
197    /// This field is required.
198    pub fn asset_model_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
199        self.asset_model_id = ::std::option::Option::Some(input.into());
200        self
201    }
202    /// <p>The ID of the asset model that was used to create the asset.</p>
203    pub fn set_asset_model_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
204        self.asset_model_id = input;
205        self
206    }
207    /// <p>The ID of the asset model that was used to create the asset.</p>
208    pub fn get_asset_model_id(&self) -> &::std::option::Option<::std::string::String> {
209        &self.asset_model_id
210    }
211    /// Appends an item to `asset_properties`.
212    ///
213    /// To override the contents of this collection use [`set_asset_properties`](Self::set_asset_properties).
214    ///
215    /// <p>The list of asset properties for the asset.</p>
216    /// <p>This object doesn't include properties that you define in composite models. You can find composite model properties in the <code>assetCompositeModels</code> object.</p>
217    pub fn asset_properties(mut self, input: crate::types::AssetProperty) -> Self {
218        let mut v = self.asset_properties.unwrap_or_default();
219        v.push(input);
220        self.asset_properties = ::std::option::Option::Some(v);
221        self
222    }
223    /// <p>The list of asset properties for the asset.</p>
224    /// <p>This object doesn't include properties that you define in composite models. You can find composite model properties in the <code>assetCompositeModels</code> object.</p>
225    pub fn set_asset_properties(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AssetProperty>>) -> Self {
226        self.asset_properties = input;
227        self
228    }
229    /// <p>The list of asset properties for the asset.</p>
230    /// <p>This object doesn't include properties that you define in composite models. You can find composite model properties in the <code>assetCompositeModels</code> object.</p>
231    pub fn get_asset_properties(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AssetProperty>> {
232        &self.asset_properties
233    }
234    /// Appends an item to `asset_hierarchies`.
235    ///
236    /// To override the contents of this collection use [`set_asset_hierarchies`](Self::set_asset_hierarchies).
237    ///
238    /// <p>A list of asset hierarchies that each contain a <code>hierarchyId</code>. A hierarchy specifies allowed parent/child asset relationships.</p>
239    pub fn asset_hierarchies(mut self, input: crate::types::AssetHierarchy) -> Self {
240        let mut v = self.asset_hierarchies.unwrap_or_default();
241        v.push(input);
242        self.asset_hierarchies = ::std::option::Option::Some(v);
243        self
244    }
245    /// <p>A list of asset hierarchies that each contain a <code>hierarchyId</code>. A hierarchy specifies allowed parent/child asset relationships.</p>
246    pub fn set_asset_hierarchies(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AssetHierarchy>>) -> Self {
247        self.asset_hierarchies = input;
248        self
249    }
250    /// <p>A list of asset hierarchies that each contain a <code>hierarchyId</code>. A hierarchy specifies allowed parent/child asset relationships.</p>
251    pub fn get_asset_hierarchies(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AssetHierarchy>> {
252        &self.asset_hierarchies
253    }
254    /// Appends an item to `asset_composite_models`.
255    ///
256    /// To override the contents of this collection use [`set_asset_composite_models`](Self::set_asset_composite_models).
257    ///
258    /// <p>The composite models for the asset.</p>
259    pub fn asset_composite_models(mut self, input: crate::types::AssetCompositeModel) -> Self {
260        let mut v = self.asset_composite_models.unwrap_or_default();
261        v.push(input);
262        self.asset_composite_models = ::std::option::Option::Some(v);
263        self
264    }
265    /// <p>The composite models for the asset.</p>
266    pub fn set_asset_composite_models(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AssetCompositeModel>>) -> Self {
267        self.asset_composite_models = input;
268        self
269    }
270    /// <p>The composite models for the asset.</p>
271    pub fn get_asset_composite_models(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AssetCompositeModel>> {
272        &self.asset_composite_models
273    }
274    /// <p>The date the asset was created, in Unix epoch time.</p>
275    /// This field is required.
276    pub fn asset_creation_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
277        self.asset_creation_date = ::std::option::Option::Some(input);
278        self
279    }
280    /// <p>The date the asset was created, in Unix epoch time.</p>
281    pub fn set_asset_creation_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
282        self.asset_creation_date = input;
283        self
284    }
285    /// <p>The date the asset was created, in Unix epoch time.</p>
286    pub fn get_asset_creation_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
287        &self.asset_creation_date
288    }
289    /// <p>The date the asset was last updated, in Unix epoch time.</p>
290    /// This field is required.
291    pub fn asset_last_update_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
292        self.asset_last_update_date = ::std::option::Option::Some(input);
293        self
294    }
295    /// <p>The date the asset was last updated, in Unix epoch time.</p>
296    pub fn set_asset_last_update_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
297        self.asset_last_update_date = input;
298        self
299    }
300    /// <p>The date the asset was last updated, in Unix epoch time.</p>
301    pub fn get_asset_last_update_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
302        &self.asset_last_update_date
303    }
304    /// <p>The current status of the asset, which contains a state and any error message.</p>
305    /// This field is required.
306    pub fn asset_status(mut self, input: crate::types::AssetStatus) -> Self {
307        self.asset_status = ::std::option::Option::Some(input);
308        self
309    }
310    /// <p>The current status of the asset, which contains a state and any error message.</p>
311    pub fn set_asset_status(mut self, input: ::std::option::Option<crate::types::AssetStatus>) -> Self {
312        self.asset_status = input;
313        self
314    }
315    /// <p>The current status of the asset, which contains a state and any error message.</p>
316    pub fn get_asset_status(&self) -> &::std::option::Option<crate::types::AssetStatus> {
317        &self.asset_status
318    }
319    /// <p>A description for the asset.</p>
320    pub fn asset_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
321        self.asset_description = ::std::option::Option::Some(input.into());
322        self
323    }
324    /// <p>A description for the asset.</p>
325    pub fn set_asset_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
326        self.asset_description = input;
327        self
328    }
329    /// <p>A description for the asset.</p>
330    pub fn get_asset_description(&self) -> &::std::option::Option<::std::string::String> {
331        &self.asset_description
332    }
333    /// Appends an item to `asset_composite_model_summaries`.
334    ///
335    /// To override the contents of this collection use [`set_asset_composite_model_summaries`](Self::set_asset_composite_model_summaries).
336    ///
337    /// <p>The list of the immediate child custom composite model summaries for the asset.</p>
338    pub fn asset_composite_model_summaries(mut self, input: crate::types::AssetCompositeModelSummary) -> Self {
339        let mut v = self.asset_composite_model_summaries.unwrap_or_default();
340        v.push(input);
341        self.asset_composite_model_summaries = ::std::option::Option::Some(v);
342        self
343    }
344    /// <p>The list of the immediate child custom composite model summaries for the asset.</p>
345    pub fn set_asset_composite_model_summaries(
346        mut self,
347        input: ::std::option::Option<::std::vec::Vec<crate::types::AssetCompositeModelSummary>>,
348    ) -> Self {
349        self.asset_composite_model_summaries = input;
350        self
351    }
352    /// <p>The list of the immediate child custom composite model summaries for the asset.</p>
353    pub fn get_asset_composite_model_summaries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AssetCompositeModelSummary>> {
354        &self.asset_composite_model_summaries
355    }
356    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
357        self._request_id = Some(request_id.into());
358        self
359    }
360
361    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
362        self._request_id = request_id;
363        self
364    }
365    /// Consumes the builder and constructs a [`DescribeAssetOutput`](crate::operation::describe_asset::DescribeAssetOutput).
366    /// This method will fail if any of the following fields are not set:
367    /// - [`asset_id`](crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::asset_id)
368    /// - [`asset_arn`](crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::asset_arn)
369    /// - [`asset_name`](crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::asset_name)
370    /// - [`asset_model_id`](crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::asset_model_id)
371    /// - [`asset_properties`](crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::asset_properties)
372    /// - [`asset_hierarchies`](crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::asset_hierarchies)
373    /// - [`asset_creation_date`](crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::asset_creation_date)
374    /// - [`asset_last_update_date`](crate::operation::describe_asset::builders::DescribeAssetOutputBuilder::asset_last_update_date)
375    pub fn build(
376        self,
377    ) -> ::std::result::Result<crate::operation::describe_asset::DescribeAssetOutput, ::aws_smithy_types::error::operation::BuildError> {
378        ::std::result::Result::Ok(crate::operation::describe_asset::DescribeAssetOutput {
379            asset_id: self.asset_id.ok_or_else(|| {
380                ::aws_smithy_types::error::operation::BuildError::missing_field(
381                    "asset_id",
382                    "asset_id was not specified but it is required when building DescribeAssetOutput",
383                )
384            })?,
385            asset_external_id: self.asset_external_id,
386            asset_arn: self.asset_arn.ok_or_else(|| {
387                ::aws_smithy_types::error::operation::BuildError::missing_field(
388                    "asset_arn",
389                    "asset_arn was not specified but it is required when building DescribeAssetOutput",
390                )
391            })?,
392            asset_name: self.asset_name.ok_or_else(|| {
393                ::aws_smithy_types::error::operation::BuildError::missing_field(
394                    "asset_name",
395                    "asset_name was not specified but it is required when building DescribeAssetOutput",
396                )
397            })?,
398            asset_model_id: self.asset_model_id.ok_or_else(|| {
399                ::aws_smithy_types::error::operation::BuildError::missing_field(
400                    "asset_model_id",
401                    "asset_model_id was not specified but it is required when building DescribeAssetOutput",
402                )
403            })?,
404            asset_properties: self.asset_properties.ok_or_else(|| {
405                ::aws_smithy_types::error::operation::BuildError::missing_field(
406                    "asset_properties",
407                    "asset_properties was not specified but it is required when building DescribeAssetOutput",
408                )
409            })?,
410            asset_hierarchies: self.asset_hierarchies.ok_or_else(|| {
411                ::aws_smithy_types::error::operation::BuildError::missing_field(
412                    "asset_hierarchies",
413                    "asset_hierarchies was not specified but it is required when building DescribeAssetOutput",
414                )
415            })?,
416            asset_composite_models: self.asset_composite_models,
417            asset_creation_date: self.asset_creation_date.ok_or_else(|| {
418                ::aws_smithy_types::error::operation::BuildError::missing_field(
419                    "asset_creation_date",
420                    "asset_creation_date was not specified but it is required when building DescribeAssetOutput",
421                )
422            })?,
423            asset_last_update_date: self.asset_last_update_date.ok_or_else(|| {
424                ::aws_smithy_types::error::operation::BuildError::missing_field(
425                    "asset_last_update_date",
426                    "asset_last_update_date was not specified but it is required when building DescribeAssetOutput",
427                )
428            })?,
429            asset_status: self.asset_status,
430            asset_description: self.asset_description,
431            asset_composite_model_summaries: self.asset_composite_model_summaries,
432            _request_id: self._request_id,
433        })
434    }
435}