aws_sdk_iotsitewise/operation/create_asset/
_create_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 CreateAssetOutput {
6    /// <p>The ID of the asset, in UUID format. This ID uniquely identifies the asset within IoT SiteWise and can be used with other IoT SiteWise API operations.</p>
7    pub asset_id: ::std::string::String,
8    /// <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>
9    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
10    pub asset_arn: ::std::string::String,
11    /// <p>The status of the asset, which contains a state (<code>CREATING</code> after successfully calling this operation) and any error message.</p>
12    pub asset_status: ::std::option::Option<crate::types::AssetStatus>,
13    _request_id: Option<String>,
14}
15impl CreateAssetOutput {
16    /// <p>The ID of the asset, in UUID format. This ID uniquely identifies the asset within IoT SiteWise and can be used with other IoT SiteWise API operations.</p>
17    pub fn asset_id(&self) -> &str {
18        use std::ops::Deref;
19        self.asset_id.deref()
20    }
21    /// <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>
22    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
23    pub fn asset_arn(&self) -> &str {
24        use std::ops::Deref;
25        self.asset_arn.deref()
26    }
27    /// <p>The status of the asset, which contains a state (<code>CREATING</code> after successfully calling this operation) and any error message.</p>
28    pub fn asset_status(&self) -> ::std::option::Option<&crate::types::AssetStatus> {
29        self.asset_status.as_ref()
30    }
31}
32impl ::aws_types::request_id::RequestId for CreateAssetOutput {
33    fn request_id(&self) -> Option<&str> {
34        self._request_id.as_deref()
35    }
36}
37impl CreateAssetOutput {
38    /// Creates a new builder-style object to manufacture [`CreateAssetOutput`](crate::operation::create_asset::CreateAssetOutput).
39    pub fn builder() -> crate::operation::create_asset::builders::CreateAssetOutputBuilder {
40        crate::operation::create_asset::builders::CreateAssetOutputBuilder::default()
41    }
42}
43
44/// A builder for [`CreateAssetOutput`](crate::operation::create_asset::CreateAssetOutput).
45#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
46#[non_exhaustive]
47pub struct CreateAssetOutputBuilder {
48    pub(crate) asset_id: ::std::option::Option<::std::string::String>,
49    pub(crate) asset_arn: ::std::option::Option<::std::string::String>,
50    pub(crate) asset_status: ::std::option::Option<crate::types::AssetStatus>,
51    _request_id: Option<String>,
52}
53impl CreateAssetOutputBuilder {
54    /// <p>The ID of the asset, in UUID format. This ID uniquely identifies the asset within IoT SiteWise and can be used with other IoT SiteWise API operations.</p>
55    /// This field is required.
56    pub fn asset_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
57        self.asset_id = ::std::option::Option::Some(input.into());
58        self
59    }
60    /// <p>The ID of the asset, in UUID format. This ID uniquely identifies the asset within IoT SiteWise and can be used with other IoT SiteWise API operations.</p>
61    pub fn set_asset_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
62        self.asset_id = input;
63        self
64    }
65    /// <p>The ID of the asset, in UUID format. This ID uniquely identifies the asset within IoT SiteWise and can be used with other IoT SiteWise API operations.</p>
66    pub fn get_asset_id(&self) -> &::std::option::Option<::std::string::String> {
67        &self.asset_id
68    }
69    /// <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>
70    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
71    /// This field is required.
72    pub fn asset_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
73        self.asset_arn = ::std::option::Option::Some(input.into());
74        self
75    }
76    /// <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>
77    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
78    pub fn set_asset_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.asset_arn = input;
80        self
81    }
82    /// <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>
83    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId}</code></p>
84    pub fn get_asset_arn(&self) -> &::std::option::Option<::std::string::String> {
85        &self.asset_arn
86    }
87    /// <p>The status of the asset, which contains a state (<code>CREATING</code> after successfully calling this operation) and any error message.</p>
88    /// This field is required.
89    pub fn asset_status(mut self, input: crate::types::AssetStatus) -> Self {
90        self.asset_status = ::std::option::Option::Some(input);
91        self
92    }
93    /// <p>The status of the asset, which contains a state (<code>CREATING</code> after successfully calling this operation) and any error message.</p>
94    pub fn set_asset_status(mut self, input: ::std::option::Option<crate::types::AssetStatus>) -> Self {
95        self.asset_status = input;
96        self
97    }
98    /// <p>The status of the asset, which contains a state (<code>CREATING</code> after successfully calling this operation) and any error message.</p>
99    pub fn get_asset_status(&self) -> &::std::option::Option<crate::types::AssetStatus> {
100        &self.asset_status
101    }
102    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
103        self._request_id = Some(request_id.into());
104        self
105    }
106
107    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
108        self._request_id = request_id;
109        self
110    }
111    /// Consumes the builder and constructs a [`CreateAssetOutput`](crate::operation::create_asset::CreateAssetOutput).
112    /// This method will fail if any of the following fields are not set:
113    /// - [`asset_id`](crate::operation::create_asset::builders::CreateAssetOutputBuilder::asset_id)
114    /// - [`asset_arn`](crate::operation::create_asset::builders::CreateAssetOutputBuilder::asset_arn)
115    pub fn build(self) -> ::std::result::Result<crate::operation::create_asset::CreateAssetOutput, ::aws_smithy_types::error::operation::BuildError> {
116        ::std::result::Result::Ok(crate::operation::create_asset::CreateAssetOutput {
117            asset_id: self.asset_id.ok_or_else(|| {
118                ::aws_smithy_types::error::operation::BuildError::missing_field(
119                    "asset_id",
120                    "asset_id was not specified but it is required when building CreateAssetOutput",
121                )
122            })?,
123            asset_arn: self.asset_arn.ok_or_else(|| {
124                ::aws_smithy_types::error::operation::BuildError::missing_field(
125                    "asset_arn",
126                    "asset_arn was not specified but it is required when building CreateAssetOutput",
127                )
128            })?,
129            asset_status: self.asset_status,
130            _request_id: self._request_id,
131        })
132    }
133}