aws_sdk_iottwinmaker/operation/create_entity/
_create_entity_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 CreateEntityOutput {
6    /// <p>The ID of the entity.</p>
7    pub entity_id: ::std::string::String,
8    /// <p>The ARN of the entity.</p>
9    pub arn: ::std::string::String,
10    /// <p>The date and time when the entity was created.</p>
11    pub creation_date_time: ::aws_smithy_types::DateTime,
12    /// <p>The current state of the entity.</p>
13    pub state: crate::types::State,
14    _request_id: Option<String>,
15}
16impl CreateEntityOutput {
17    /// <p>The ID of the entity.</p>
18    pub fn entity_id(&self) -> &str {
19        use std::ops::Deref;
20        self.entity_id.deref()
21    }
22    /// <p>The ARN of the entity.</p>
23    pub fn arn(&self) -> &str {
24        use std::ops::Deref;
25        self.arn.deref()
26    }
27    /// <p>The date and time when the entity was created.</p>
28    pub fn creation_date_time(&self) -> &::aws_smithy_types::DateTime {
29        &self.creation_date_time
30    }
31    /// <p>The current state of the entity.</p>
32    pub fn state(&self) -> &crate::types::State {
33        &self.state
34    }
35}
36impl ::aws_types::request_id::RequestId for CreateEntityOutput {
37    fn request_id(&self) -> Option<&str> {
38        self._request_id.as_deref()
39    }
40}
41impl CreateEntityOutput {
42    /// Creates a new builder-style object to manufacture [`CreateEntityOutput`](crate::operation::create_entity::CreateEntityOutput).
43    pub fn builder() -> crate::operation::create_entity::builders::CreateEntityOutputBuilder {
44        crate::operation::create_entity::builders::CreateEntityOutputBuilder::default()
45    }
46}
47
48/// A builder for [`CreateEntityOutput`](crate::operation::create_entity::CreateEntityOutput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateEntityOutputBuilder {
52    pub(crate) entity_id: ::std::option::Option<::std::string::String>,
53    pub(crate) arn: ::std::option::Option<::std::string::String>,
54    pub(crate) creation_date_time: ::std::option::Option<::aws_smithy_types::DateTime>,
55    pub(crate) state: ::std::option::Option<crate::types::State>,
56    _request_id: Option<String>,
57}
58impl CreateEntityOutputBuilder {
59    /// <p>The ID of the entity.</p>
60    /// This field is required.
61    pub fn entity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.entity_id = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The ID of the entity.</p>
66    pub fn set_entity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.entity_id = input;
68        self
69    }
70    /// <p>The ID of the entity.</p>
71    pub fn get_entity_id(&self) -> &::std::option::Option<::std::string::String> {
72        &self.entity_id
73    }
74    /// <p>The ARN of the entity.</p>
75    /// This field is required.
76    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        self.arn = ::std::option::Option::Some(input.into());
78        self
79    }
80    /// <p>The ARN of the entity.</p>
81    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82        self.arn = input;
83        self
84    }
85    /// <p>The ARN of the entity.</p>
86    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
87        &self.arn
88    }
89    /// <p>The date and time when the entity was created.</p>
90    /// This field is required.
91    pub fn creation_date_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
92        self.creation_date_time = ::std::option::Option::Some(input);
93        self
94    }
95    /// <p>The date and time when the entity was created.</p>
96    pub fn set_creation_date_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
97        self.creation_date_time = input;
98        self
99    }
100    /// <p>The date and time when the entity was created.</p>
101    pub fn get_creation_date_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
102        &self.creation_date_time
103    }
104    /// <p>The current state of the entity.</p>
105    /// This field is required.
106    pub fn state(mut self, input: crate::types::State) -> Self {
107        self.state = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>The current state of the entity.</p>
111    pub fn set_state(mut self, input: ::std::option::Option<crate::types::State>) -> Self {
112        self.state = input;
113        self
114    }
115    /// <p>The current state of the entity.</p>
116    pub fn get_state(&self) -> &::std::option::Option<crate::types::State> {
117        &self.state
118    }
119    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
120        self._request_id = Some(request_id.into());
121        self
122    }
123
124    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
125        self._request_id = request_id;
126        self
127    }
128    /// Consumes the builder and constructs a [`CreateEntityOutput`](crate::operation::create_entity::CreateEntityOutput).
129    /// This method will fail if any of the following fields are not set:
130    /// - [`entity_id`](crate::operation::create_entity::builders::CreateEntityOutputBuilder::entity_id)
131    /// - [`arn`](crate::operation::create_entity::builders::CreateEntityOutputBuilder::arn)
132    /// - [`creation_date_time`](crate::operation::create_entity::builders::CreateEntityOutputBuilder::creation_date_time)
133    /// - [`state`](crate::operation::create_entity::builders::CreateEntityOutputBuilder::state)
134    pub fn build(
135        self,
136    ) -> ::std::result::Result<crate::operation::create_entity::CreateEntityOutput, ::aws_smithy_types::error::operation::BuildError> {
137        ::std::result::Result::Ok(crate::operation::create_entity::CreateEntityOutput {
138            entity_id: self.entity_id.ok_or_else(|| {
139                ::aws_smithy_types::error::operation::BuildError::missing_field(
140                    "entity_id",
141                    "entity_id was not specified but it is required when building CreateEntityOutput",
142                )
143            })?,
144            arn: self.arn.ok_or_else(|| {
145                ::aws_smithy_types::error::operation::BuildError::missing_field(
146                    "arn",
147                    "arn was not specified but it is required when building CreateEntityOutput",
148                )
149            })?,
150            creation_date_time: self.creation_date_time.ok_or_else(|| {
151                ::aws_smithy_types::error::operation::BuildError::missing_field(
152                    "creation_date_time",
153                    "creation_date_time was not specified but it is required when building CreateEntityOutput",
154                )
155            })?,
156            state: self.state.ok_or_else(|| {
157                ::aws_smithy_types::error::operation::BuildError::missing_field(
158                    "state",
159                    "state was not specified but it is required when building CreateEntityOutput",
160                )
161            })?,
162            _request_id: self._request_id,
163        })
164    }
165}