Skip to main content

aws_sdk_continuum/operation/create_environment/
_create_environment_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// Contains the identifier and ARN of the newly created environment.
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateEnvironmentOutput {
7    /// The unique identifier assigned to the environment.
8    pub environment_id: ::std::string::String,
9    /// The ARN of the created environment.
10    pub environment_arn: ::std::string::String,
11    /// The initial status of the environment. Always ACTIVE on successful creation.
12    pub status: crate::types::EnvironmentStatus,
13    /// The timestamp when the environment was created.
14    pub created_at: ::aws_smithy_types::DateTime,
15    _request_id: Option<String>,
16}
17impl CreateEnvironmentOutput {
18    /// The unique identifier assigned to the environment.
19    pub fn environment_id(&self) -> &str {
20        use std::ops::Deref;
21        self.environment_id.deref()
22    }
23    /// The ARN of the created environment.
24    pub fn environment_arn(&self) -> &str {
25        use std::ops::Deref;
26        self.environment_arn.deref()
27    }
28    /// The initial status of the environment. Always ACTIVE on successful creation.
29    pub fn status(&self) -> &crate::types::EnvironmentStatus {
30        &self.status
31    }
32    /// The timestamp when the environment was created.
33    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
34        &self.created_at
35    }
36}
37impl ::aws_types::request_id::RequestId for CreateEnvironmentOutput {
38    fn request_id(&self) -> Option<&str> {
39        self._request_id.as_deref()
40    }
41}
42impl CreateEnvironmentOutput {
43    /// Creates a new builder-style object to manufacture [`CreateEnvironmentOutput`](crate::operation::create_environment::CreateEnvironmentOutput).
44    pub fn builder() -> crate::operation::create_environment::builders::CreateEnvironmentOutputBuilder {
45        crate::operation::create_environment::builders::CreateEnvironmentOutputBuilder::default()
46    }
47}
48
49/// A builder for [`CreateEnvironmentOutput`](crate::operation::create_environment::CreateEnvironmentOutput).
50#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
51#[non_exhaustive]
52pub struct CreateEnvironmentOutputBuilder {
53    pub(crate) environment_id: ::std::option::Option<::std::string::String>,
54    pub(crate) environment_arn: ::std::option::Option<::std::string::String>,
55    pub(crate) status: ::std::option::Option<crate::types::EnvironmentStatus>,
56    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
57    _request_id: Option<String>,
58}
59impl CreateEnvironmentOutputBuilder {
60    /// The unique identifier assigned to the environment.
61    /// This field is required.
62    pub fn environment_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
63        self.environment_id = ::std::option::Option::Some(input.into());
64        self
65    }
66    /// The unique identifier assigned to the environment.
67    pub fn set_environment_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
68        self.environment_id = input;
69        self
70    }
71    /// The unique identifier assigned to the environment.
72    pub fn get_environment_id(&self) -> &::std::option::Option<::std::string::String> {
73        &self.environment_id
74    }
75    /// The ARN of the created environment.
76    /// This field is required.
77    pub fn environment_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.environment_arn = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// The ARN of the created environment.
82    pub fn set_environment_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.environment_arn = input;
84        self
85    }
86    /// The ARN of the created environment.
87    pub fn get_environment_arn(&self) -> &::std::option::Option<::std::string::String> {
88        &self.environment_arn
89    }
90    /// The initial status of the environment. Always ACTIVE on successful creation.
91    /// This field is required.
92    pub fn status(mut self, input: crate::types::EnvironmentStatus) -> Self {
93        self.status = ::std::option::Option::Some(input);
94        self
95    }
96    /// The initial status of the environment. Always ACTIVE on successful creation.
97    pub fn set_status(mut self, input: ::std::option::Option<crate::types::EnvironmentStatus>) -> Self {
98        self.status = input;
99        self
100    }
101    /// The initial status of the environment. Always ACTIVE on successful creation.
102    pub fn get_status(&self) -> &::std::option::Option<crate::types::EnvironmentStatus> {
103        &self.status
104    }
105    /// The timestamp when the environment was created.
106    /// This field is required.
107    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
108        self.created_at = ::std::option::Option::Some(input);
109        self
110    }
111    /// The timestamp when the environment was created.
112    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
113        self.created_at = input;
114        self
115    }
116    /// The timestamp when the environment was created.
117    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
118        &self.created_at
119    }
120    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
121        self._request_id = Some(request_id.into());
122        self
123    }
124
125    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
126        self._request_id = request_id;
127        self
128    }
129    /// Consumes the builder and constructs a [`CreateEnvironmentOutput`](crate::operation::create_environment::CreateEnvironmentOutput).
130    /// This method will fail if any of the following fields are not set:
131    /// - [`environment_id`](crate::operation::create_environment::builders::CreateEnvironmentOutputBuilder::environment_id)
132    /// - [`environment_arn`](crate::operation::create_environment::builders::CreateEnvironmentOutputBuilder::environment_arn)
133    /// - [`status`](crate::operation::create_environment::builders::CreateEnvironmentOutputBuilder::status)
134    /// - [`created_at`](crate::operation::create_environment::builders::CreateEnvironmentOutputBuilder::created_at)
135    pub fn build(
136        self,
137    ) -> ::std::result::Result<crate::operation::create_environment::CreateEnvironmentOutput, ::aws_smithy_types::error::operation::BuildError> {
138        ::std::result::Result::Ok(crate::operation::create_environment::CreateEnvironmentOutput {
139            environment_id: self.environment_id.ok_or_else(|| {
140                ::aws_smithy_types::error::operation::BuildError::missing_field(
141                    "environment_id",
142                    "environment_id was not specified but it is required when building CreateEnvironmentOutput",
143                )
144            })?,
145            environment_arn: self.environment_arn.ok_or_else(|| {
146                ::aws_smithy_types::error::operation::BuildError::missing_field(
147                    "environment_arn",
148                    "environment_arn was not specified but it is required when building CreateEnvironmentOutput",
149                )
150            })?,
151            status: self.status.ok_or_else(|| {
152                ::aws_smithy_types::error::operation::BuildError::missing_field(
153                    "status",
154                    "status was not specified but it is required when building CreateEnvironmentOutput",
155                )
156            })?,
157            created_at: self.created_at.ok_or_else(|| {
158                ::aws_smithy_types::error::operation::BuildError::missing_field(
159                    "created_at",
160                    "created_at was not specified but it is required when building CreateEnvironmentOutput",
161                )
162            })?,
163            _request_id: self._request_id,
164        })
165    }
166}