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/// <p>The output of a cluster.</p>
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>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
16    #[deprecated(
17        note = "The witnessRegion field is deprecated. To see the witnessRegion, use multiRegionProperties.witnessRegion instead.",
18        since = "5/13/2025"
19    )]
20    pub witness_region: ::std::option::Option<::std::string::String>,
21    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
22    #[deprecated(
23        note = "The linkedClusterArns field is deprecated. To see the peered cluster Arns, use multiRegionProperties.cluster instead.",
24        since = "5/13/2025"
25    )]
26    pub linked_cluster_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
27    /// <p>Whether deletion protection is enabled in this cluster.</p>
28    pub deletion_protection_enabled: bool,
29    /// <p>Returns the current multi-Region cluster configuration, including witness region and linked cluster information.</p>
30    pub multi_region_properties: ::std::option::Option<crate::types::MultiRegionProperties>,
31    /// <p>Map of tags.</p>
32    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
33    _request_id: Option<String>,
34}
35impl GetClusterOutput {
36    /// <p>The ID of the retrieved cluster.</p>
37    pub fn identifier(&self) -> &str {
38        use std::ops::Deref;
39        self.identifier.deref()
40    }
41    /// <p>The ARN of the retrieved cluster.</p>
42    pub fn arn(&self) -> &str {
43        use std::ops::Deref;
44        self.arn.deref()
45    }
46    /// <p>The status of the retrieved cluster.</p>
47    pub fn status(&self) -> &crate::types::ClusterStatus {
48        &self.status
49    }
50    /// <p>The time of when the cluster was created.</p>
51    pub fn creation_time(&self) -> &::aws_smithy_types::DateTime {
52        &self.creation_time
53    }
54    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
55    #[deprecated(
56        note = "The witnessRegion field is deprecated. To see the witnessRegion, use multiRegionProperties.witnessRegion instead.",
57        since = "5/13/2025"
58    )]
59    pub fn witness_region(&self) -> ::std::option::Option<&str> {
60        self.witness_region.as_deref()
61    }
62    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
63    ///
64    /// 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()`.
65    #[deprecated(
66        note = "The linkedClusterArns field is deprecated. To see the peered cluster Arns, use multiRegionProperties.cluster instead.",
67        since = "5/13/2025"
68    )]
69    pub fn linked_cluster_arns(&self) -> &[::std::string::String] {
70        self.linked_cluster_arns.as_deref().unwrap_or_default()
71    }
72    /// <p>Whether deletion protection is enabled in this cluster.</p>
73    pub fn deletion_protection_enabled(&self) -> bool {
74        self.deletion_protection_enabled
75    }
76    /// <p>Returns the current multi-Region cluster configuration, including witness region and linked cluster information.</p>
77    pub fn multi_region_properties(&self) -> ::std::option::Option<&crate::types::MultiRegionProperties> {
78        self.multi_region_properties.as_ref()
79    }
80    /// <p>Map of tags.</p>
81    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
82        self.tags.as_ref()
83    }
84}
85impl ::aws_types::request_id::RequestId for GetClusterOutput {
86    fn request_id(&self) -> Option<&str> {
87        self._request_id.as_deref()
88    }
89}
90impl GetClusterOutput {
91    /// Creates a new builder-style object to manufacture [`GetClusterOutput`](crate::operation::get_cluster::GetClusterOutput).
92    pub fn builder() -> crate::operation::get_cluster::builders::GetClusterOutputBuilder {
93        crate::operation::get_cluster::builders::GetClusterOutputBuilder::default()
94    }
95}
96
97/// A builder for [`GetClusterOutput`](crate::operation::get_cluster::GetClusterOutput).
98#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
99#[non_exhaustive]
100pub struct GetClusterOutputBuilder {
101    pub(crate) identifier: ::std::option::Option<::std::string::String>,
102    pub(crate) arn: ::std::option::Option<::std::string::String>,
103    pub(crate) status: ::std::option::Option<crate::types::ClusterStatus>,
104    pub(crate) creation_time: ::std::option::Option<::aws_smithy_types::DateTime>,
105    pub(crate) witness_region: ::std::option::Option<::std::string::String>,
106    pub(crate) linked_cluster_arns: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
107    pub(crate) deletion_protection_enabled: ::std::option::Option<bool>,
108    pub(crate) multi_region_properties: ::std::option::Option<crate::types::MultiRegionProperties>,
109    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
110    _request_id: Option<String>,
111}
112impl GetClusterOutputBuilder {
113    /// <p>The ID of the retrieved cluster.</p>
114    /// This field is required.
115    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.identifier = ::std::option::Option::Some(input.into());
117        self
118    }
119    /// <p>The ID of the retrieved cluster.</p>
120    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.identifier = input;
122        self
123    }
124    /// <p>The ID of the retrieved cluster.</p>
125    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
126        &self.identifier
127    }
128    /// <p>The ARN of the retrieved cluster.</p>
129    /// This field is required.
130    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.arn = ::std::option::Option::Some(input.into());
132        self
133    }
134    /// <p>The ARN of the retrieved cluster.</p>
135    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.arn = input;
137        self
138    }
139    /// <p>The ARN of the retrieved cluster.</p>
140    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
141        &self.arn
142    }
143    /// <p>The status of the retrieved cluster.</p>
144    /// This field is required.
145    pub fn status(mut self, input: crate::types::ClusterStatus) -> Self {
146        self.status = ::std::option::Option::Some(input);
147        self
148    }
149    /// <p>The status of the retrieved cluster.</p>
150    pub fn set_status(mut self, input: ::std::option::Option<crate::types::ClusterStatus>) -> Self {
151        self.status = input;
152        self
153    }
154    /// <p>The status of the retrieved cluster.</p>
155    pub fn get_status(&self) -> &::std::option::Option<crate::types::ClusterStatus> {
156        &self.status
157    }
158    /// <p>The time of when the cluster was created.</p>
159    /// This field is required.
160    pub fn creation_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
161        self.creation_time = ::std::option::Option::Some(input);
162        self
163    }
164    /// <p>The time of when the cluster was created.</p>
165    pub fn set_creation_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
166        self.creation_time = input;
167        self
168    }
169    /// <p>The time of when the cluster was created.</p>
170    pub fn get_creation_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
171        &self.creation_time
172    }
173    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
174    #[deprecated(
175        note = "The witnessRegion field is deprecated. To see the witnessRegion, use multiRegionProperties.witnessRegion instead.",
176        since = "5/13/2025"
177    )]
178    pub fn witness_region(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179        self.witness_region = ::std::option::Option::Some(input.into());
180        self
181    }
182    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
183    #[deprecated(
184        note = "The witnessRegion field is deprecated. To see the witnessRegion, use multiRegionProperties.witnessRegion instead.",
185        since = "5/13/2025"
186    )]
187    pub fn set_witness_region(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
188        self.witness_region = input;
189        self
190    }
191    /// <p>The witness Region of the cluster. Applicable only for multi-Region clusters.</p>
192    #[deprecated(
193        note = "The witnessRegion field is deprecated. To see the witnessRegion, use multiRegionProperties.witnessRegion instead.",
194        since = "5/13/2025"
195    )]
196    pub fn get_witness_region(&self) -> &::std::option::Option<::std::string::String> {
197        &self.witness_region
198    }
199    /// Appends an item to `linked_cluster_arns`.
200    ///
201    /// To override the contents of this collection use [`set_linked_cluster_arns`](Self::set_linked_cluster_arns).
202    ///
203    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
204    #[deprecated(
205        note = "The linkedClusterArns field is deprecated. To see the peered cluster Arns, use multiRegionProperties.cluster instead.",
206        since = "5/13/2025"
207    )]
208    pub fn linked_cluster_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209        let mut v = self.linked_cluster_arns.unwrap_or_default();
210        v.push(input.into());
211        self.linked_cluster_arns = ::std::option::Option::Some(v);
212        self
213    }
214    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
215    #[deprecated(
216        note = "The linkedClusterArns field is deprecated. To see the peered cluster Arns, use multiRegionProperties.cluster instead.",
217        since = "5/13/2025"
218    )]
219    pub fn set_linked_cluster_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
220        self.linked_cluster_arns = input;
221        self
222    }
223    /// <p>The ARNs of the clusters linked to the retrieved cluster.</p>
224    #[deprecated(
225        note = "The linkedClusterArns field is deprecated. To see the peered cluster Arns, use multiRegionProperties.cluster instead.",
226        since = "5/13/2025"
227    )]
228    pub fn get_linked_cluster_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
229        &self.linked_cluster_arns
230    }
231    /// <p>Whether deletion protection is enabled in this cluster.</p>
232    /// This field is required.
233    pub fn deletion_protection_enabled(mut self, input: bool) -> Self {
234        self.deletion_protection_enabled = ::std::option::Option::Some(input);
235        self
236    }
237    /// <p>Whether deletion protection is enabled in this cluster.</p>
238    pub fn set_deletion_protection_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
239        self.deletion_protection_enabled = input;
240        self
241    }
242    /// <p>Whether deletion protection is enabled in this cluster.</p>
243    pub fn get_deletion_protection_enabled(&self) -> &::std::option::Option<bool> {
244        &self.deletion_protection_enabled
245    }
246    /// <p>Returns the current multi-Region cluster configuration, including witness region and linked cluster information.</p>
247    pub fn multi_region_properties(mut self, input: crate::types::MultiRegionProperties) -> Self {
248        self.multi_region_properties = ::std::option::Option::Some(input);
249        self
250    }
251    /// <p>Returns the current multi-Region cluster configuration, including witness region and linked cluster information.</p>
252    pub fn set_multi_region_properties(mut self, input: ::std::option::Option<crate::types::MultiRegionProperties>) -> Self {
253        self.multi_region_properties = input;
254        self
255    }
256    /// <p>Returns the current multi-Region cluster configuration, including witness region and linked cluster information.</p>
257    pub fn get_multi_region_properties(&self) -> &::std::option::Option<crate::types::MultiRegionProperties> {
258        &self.multi_region_properties
259    }
260    /// Adds a key-value pair to `tags`.
261    ///
262    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
263    ///
264    /// <p>Map of tags.</p>
265    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
266        let mut hash_map = self.tags.unwrap_or_default();
267        hash_map.insert(k.into(), v.into());
268        self.tags = ::std::option::Option::Some(hash_map);
269        self
270    }
271    /// <p>Map of tags.</p>
272    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
273        self.tags = input;
274        self
275    }
276    /// <p>Map of tags.</p>
277    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
278        &self.tags
279    }
280    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
281        self._request_id = Some(request_id.into());
282        self
283    }
284
285    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
286        self._request_id = request_id;
287        self
288    }
289    /// Consumes the builder and constructs a [`GetClusterOutput`](crate::operation::get_cluster::GetClusterOutput).
290    /// This method will fail if any of the following fields are not set:
291    /// - [`identifier`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::identifier)
292    /// - [`arn`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::arn)
293    /// - [`status`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::status)
294    /// - [`creation_time`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::creation_time)
295    /// - [`deletion_protection_enabled`](crate::operation::get_cluster::builders::GetClusterOutputBuilder::deletion_protection_enabled)
296    pub fn build(self) -> ::std::result::Result<crate::operation::get_cluster::GetClusterOutput, ::aws_smithy_types::error::operation::BuildError> {
297        ::std::result::Result::Ok(crate::operation::get_cluster::GetClusterOutput {
298            identifier: self.identifier.ok_or_else(|| {
299                ::aws_smithy_types::error::operation::BuildError::missing_field(
300                    "identifier",
301                    "identifier was not specified but it is required when building GetClusterOutput",
302                )
303            })?,
304            arn: self.arn.ok_or_else(|| {
305                ::aws_smithy_types::error::operation::BuildError::missing_field(
306                    "arn",
307                    "arn was not specified but it is required when building GetClusterOutput",
308                )
309            })?,
310            status: self.status.ok_or_else(|| {
311                ::aws_smithy_types::error::operation::BuildError::missing_field(
312                    "status",
313                    "status was not specified but it is required when building GetClusterOutput",
314                )
315            })?,
316            creation_time: self.creation_time.ok_or_else(|| {
317                ::aws_smithy_types::error::operation::BuildError::missing_field(
318                    "creation_time",
319                    "creation_time was not specified but it is required when building GetClusterOutput",
320                )
321            })?,
322            witness_region: self.witness_region,
323            linked_cluster_arns: self.linked_cluster_arns,
324            deletion_protection_enabled: self.deletion_protection_enabled.ok_or_else(|| {
325                ::aws_smithy_types::error::operation::BuildError::missing_field(
326                    "deletion_protection_enabled",
327                    "deletion_protection_enabled was not specified but it is required when building GetClusterOutput",
328                )
329            })?,
330            multi_region_properties: self.multi_region_properties,
331            tags: self.tags,
332            _request_id: self._request_id,
333        })
334    }
335}