aws_sdk_iotsitewise/operation/create_project/
_create_project_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 CreateProjectOutput {
6    /// <p>The ID of the project.</p>
7    pub project_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 project, which has the following format.</p>
9    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:project/${ProjectId}</code></p>
10    pub project_arn: ::std::string::String,
11    _request_id: Option<String>,
12}
13impl CreateProjectOutput {
14    /// <p>The ID of the project.</p>
15    pub fn project_id(&self) -> &str {
16        use std::ops::Deref;
17        self.project_id.deref()
18    }
19    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the project, which has the following format.</p>
20    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:project/${ProjectId}</code></p>
21    pub fn project_arn(&self) -> &str {
22        use std::ops::Deref;
23        self.project_arn.deref()
24    }
25}
26impl ::aws_types::request_id::RequestId for CreateProjectOutput {
27    fn request_id(&self) -> Option<&str> {
28        self._request_id.as_deref()
29    }
30}
31impl CreateProjectOutput {
32    /// Creates a new builder-style object to manufacture [`CreateProjectOutput`](crate::operation::create_project::CreateProjectOutput).
33    pub fn builder() -> crate::operation::create_project::builders::CreateProjectOutputBuilder {
34        crate::operation::create_project::builders::CreateProjectOutputBuilder::default()
35    }
36}
37
38/// A builder for [`CreateProjectOutput`](crate::operation::create_project::CreateProjectOutput).
39#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
40#[non_exhaustive]
41pub struct CreateProjectOutputBuilder {
42    pub(crate) project_id: ::std::option::Option<::std::string::String>,
43    pub(crate) project_arn: ::std::option::Option<::std::string::String>,
44    _request_id: Option<String>,
45}
46impl CreateProjectOutputBuilder {
47    /// <p>The ID of the project.</p>
48    /// This field is required.
49    pub fn project_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
50        self.project_id = ::std::option::Option::Some(input.into());
51        self
52    }
53    /// <p>The ID of the project.</p>
54    pub fn set_project_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
55        self.project_id = input;
56        self
57    }
58    /// <p>The ID of the project.</p>
59    pub fn get_project_id(&self) -> &::std::option::Option<::std::string::String> {
60        &self.project_id
61    }
62    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the project, which has the following format.</p>
63    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:project/${ProjectId}</code></p>
64    /// This field is required.
65    pub fn project_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.project_arn = ::std::option::Option::Some(input.into());
67        self
68    }
69    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the project, which has the following format.</p>
70    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:project/${ProjectId}</code></p>
71    pub fn set_project_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72        self.project_arn = input;
73        self
74    }
75    /// <p>The <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">ARN</a> of the project, which has the following format.</p>
76    /// <p><code>arn:${Partition}:iotsitewise:${Region}:${Account}:project/${ProjectId}</code></p>
77    pub fn get_project_arn(&self) -> &::std::option::Option<::std::string::String> {
78        &self.project_arn
79    }
80    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
81        self._request_id = Some(request_id.into());
82        self
83    }
84
85    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
86        self._request_id = request_id;
87        self
88    }
89    /// Consumes the builder and constructs a [`CreateProjectOutput`](crate::operation::create_project::CreateProjectOutput).
90    /// This method will fail if any of the following fields are not set:
91    /// - [`project_id`](crate::operation::create_project::builders::CreateProjectOutputBuilder::project_id)
92    /// - [`project_arn`](crate::operation::create_project::builders::CreateProjectOutputBuilder::project_arn)
93    pub fn build(
94        self,
95    ) -> ::std::result::Result<crate::operation::create_project::CreateProjectOutput, ::aws_smithy_types::error::operation::BuildError> {
96        ::std::result::Result::Ok(crate::operation::create_project::CreateProjectOutput {
97            project_id: self.project_id.ok_or_else(|| {
98                ::aws_smithy_types::error::operation::BuildError::missing_field(
99                    "project_id",
100                    "project_id was not specified but it is required when building CreateProjectOutput",
101                )
102            })?,
103            project_arn: self.project_arn.ok_or_else(|| {
104                ::aws_smithy_types::error::operation::BuildError::missing_field(
105                    "project_arn",
106                    "project_arn was not specified but it is required when building CreateProjectOutput",
107                )
108            })?,
109            _request_id: self._request_id,
110        })
111    }
112}