aws_sdk_dsql/operation/get_cluster/
_get_cluster_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// Output Mixin
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GetClusterOutput {
7    /// <p>The ID of the retrieved cluster.</p>
8    pub identifier: ::std::string::String,
9    /// <p>The ARN of the retrieved cluster.</p>
10    pub arn: ::std::string::String,
11    /// <p>The status of the retrieved cluster.</p>
12    pub status: crate::types::ClusterStatus,
13    /// <p>The time of when the cluster was created.</p>
14    pub creation_time: ::aws_smithy_types::DateTime,
15    /// <p>Whether deletion protection is enabled in this cluster.</p>
16    pub deletion_protection_enabled: bool,
17    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
18    pub witness_region: ::std::option::Option<::std::string::String>,
19    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
20    pub linked_cluster_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
21    _request_id: Option<String>,
22}
23impl GetClusterOutput {
24    /// <p>The ID of the retrieved cluster.</p>
25    pub fn identifier(&self) -> &str {
26        use std::ops::Deref;
27        self.identifier.deref()
28    }
29    /// <p>The ARN of the retrieved cluster.</p>
30    pub fn arn(&self) -> &str {
31        use std::ops::Deref;
32        self.arn.deref()
33    }
34    /// <p>The status of the retrieved cluster.</p>
35    pub fn status(&self) -> &crate::types::ClusterStatus {
36        &self.status
37    }
38    /// <p>The time of when the cluster was created.</p>
39    pub fn creation_time(&self) -> &::aws_smithy_types::DateTime {
40        &self.creation_time
41    }
42    /// <p>Whether deletion protection is enabled in this cluster.</p>
43    pub fn deletion_protection_enabled(&self) -> bool {
44        self.deletion_protection_enabled
45    }
46    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
47    pub fn witness_region(&self) -> ::std::option::Option<&str> {
48        self.witness_region.as_deref()
49    }
50    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
51    ///
52    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.linked_cluster_arns.is_none()`.
53    pub fn linked_cluster_arns(&self) -> &[::std::string::String] {
54        self.linked_cluster_arns.as_deref().unwrap_or_default()
55    }
56}
57impl ::aws_types::request_id::RequestId for GetClusterOutput {
58    fn request_id(&self) -> Option<&str> {
59        self._request_id.as_deref()
60    }
61}
62impl GetClusterOutput {
63    /// Creates a new builder-style object to manufacture [`GetClusterOutput`](crate::operation::get_cluster::GetClusterOutput).
64    pub fn builder() -> crate::operation::get_cluster::builders::GetClusterOutputBuilder {
65        crate::operation::get_cluster::builders::GetClusterOutputBuilder::default()
66    }
67}
68
69/// A builder for [`GetClusterOutput`](crate::operation::get_cluster::GetClusterOutput).
70#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
71#[non_exhaustive]
72pub struct GetClusterOutputBuilder {
73    pub(crate) identifier: ::std::option::Option<::std::string::String>,
74    pub(crate) arn: ::std::option::Option<::std::string::String>,
75    pub(crate) status: ::std::option::Option<crate::types::ClusterStatus>,
76    pub(crate) creation_time: ::std::option::Option<::aws_smithy_types::DateTime>,
77    pub(crate) deletion_protection_enabled: ::std::option::Option<bool>,
78    pub(crate) witness_region: ::std::option::Option<::std::string::String>,
79    pub(crate) linked_cluster_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
80    _request_id: Option<String>,
81}
82impl GetClusterOutputBuilder {
83    /// <p>The ID of the retrieved cluster.</p>
84    /// This field is required.
85    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
86        self.identifier = ::std::option::Option::Some(input.into());
87        self
88    }
89    /// <p>The ID of the retrieved cluster.</p>
90    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
91        self.identifier = input;
92        self
93    }
94    /// <p>The ID of the retrieved cluster.</p>
95    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
96        &self.identifier
97    }
98    /// <p>The ARN of the retrieved cluster.</p>
99    /// This field is required.
100    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
101        self.arn = ::std::option::Option::Some(input.into());
102        self
103    }
104    /// <p>The ARN of the retrieved cluster.</p>
105    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
106        self.arn = input;
107        self
108    }
109    /// <p>The ARN of the retrieved cluster.</p>
110    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
111        &self.arn
112    }
113    /// <p>The status of the retrieved cluster.</p>
114    /// This field is required.
115    pub fn status(mut self, input: crate::types::ClusterStatus) -> Self {
116        self.status = ::std::option::Option::Some(input);
117        self
118    }
119    /// <p>The status of the retrieved cluster.</p>
120    pub fn set_status(mut self, input: ::std::option::Option<crate::types::ClusterStatus>) -> Self {
121        self.status = input;
122        self
123    }
124    /// <p>The status of the retrieved cluster.</p>
125    pub fn get_status(&self) -> &::std::option::Option<crate::types::ClusterStatus> {
126        &self.status
127    }
128    /// <p>The time of when the cluster was created.</p>
129    /// This field is required.
130    pub fn creation_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
131        self.creation_time = ::std::option::Option::Some(input);
132        self
133    }
134    /// <p>The time of when the cluster was created.</p>
135    pub fn set_creation_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
136        self.creation_time = input;
137        self
138    }
139    /// <p>The time of when the cluster was created.</p>
140    pub fn get_creation_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
141        &self.creation_time
142    }
143    /// <p>Whether deletion protection is enabled in this cluster.</p>
144    /// This field is required.
145    pub fn deletion_protection_enabled(mut self, input: bool) -> Self {
146        self.deletion_protection_enabled = ::std::option::Option::Some(input);
147        self
148    }
149    /// <p>Whether deletion protection is enabled in this cluster.</p>
150    pub fn set_deletion_protection_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
151        self.deletion_protection_enabled = input;
152        self
153    }
154    /// <p>Whether deletion protection is enabled in this cluster.</p>
155    pub fn get_deletion_protection_enabled(&self) -> &::std::option::Option<bool> {
156        &self.deletion_protection_enabled
157    }
158    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
159    pub fn witness_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.witness_region = ::std::option::Option::Some(input.into());
161        self
162    }
163    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
164    pub fn set_witness_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.witness_region = input;
166        self
167    }
168    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
169    pub fn get_witness_region(&self) -> &::std::option::Option<::std::string::String> {
170        &self.witness_region
171    }
172    /// Appends an item to `linked_cluster_arns`.
173    ///
174    /// To override the contents of this collection use [`set_linked_cluster_arns`](Self::set_linked_cluster_arns).
175    ///
176    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
177    pub fn linked_cluster_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178        let mut v = self.linked_cluster_arns.unwrap_or_default();
179        v.push(input.into());
180        self.linked_cluster_arns = ::std::option::Option::Some(v);
181        self
182    }
183    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
184    pub fn set_linked_cluster_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
185        self.linked_cluster_arns = input;
186        self
187    }
188    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
189    pub fn get_linked_cluster_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
190        &self.linked_cluster_arns
191    }
192    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
193        self._request_id = Some(request_id.into());
194        self
195    }
196
197    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
198        self._request_id = request_id;
199        self
200    }
201    /// Consumes the builder and constructs a [`GetClusterOutput`](crate::operation::get_cluster::GetClusterOutput).
202    /// This method will fail if any of the following fields are not set:
203    /// - [`identifier`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::identifier)
204    /// - [`arn`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::arn)
205    /// - [`status`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::status)
206    /// - [`creation_time`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::creation_time)
207    /// - [`deletion_protection_enabled`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::deletion_protection_enabled)
208    pub fn build(self) -> ::std::result::Result<crate::operation::get_cluster::GetClusterOutput, ::aws_smithy_types::error::operation::BuildError> {
209        ::std::result::Result::Ok(crate::operation::get_cluster::GetClusterOutput {
210            identifier: self.identifier.ok_or_else(|| {
211                ::aws_smithy_types::error::operation::BuildError::missing_field(
212                    "identifier",
213                    "identifier was not specified but it is required when building GetClusterOutput",
214                )
215            })?,
216            arn: self.arn.ok_or_else(|| {
217                ::aws_smithy_types::error::operation::BuildError::missing_field(
218                    "arn",
219                    "arn was not specified but it is required when building GetClusterOutput",
220                )
221            })?,
222            status: self.status.ok_or_else(|| {
223                ::aws_smithy_types::error::operation::BuildError::missing_field(
224                    "status",
225                    "status was not specified but it is required when building GetClusterOutput",
226                )
227            })?,
228            creation_time: self.creation_time.ok_or_else(|| {
229                ::aws_smithy_types::error::operation::BuildError::missing_field(
230                    "creation_time",
231                    "creation_time was not specified but it is required when building GetClusterOutput",
232                )
233            })?,
234            deletion_protection_enabled: self.deletion_protection_enabled.ok_or_else(|| {
235                ::aws_smithy_types::error::operation::BuildError::missing_field(
236                    "deletion_protection_enabled",
237                    "deletion_protection_enabled was not specified but it is required when building GetClusterOutput",
238                )
239            })?,
240            witness_region: self.witness_region,
241            linked_cluster_arns: self.linked_cluster_arns,
242            _request_id: self._request_id,
243        })
244    }
245}