aws_sdk_keyspaces/operation/get_keyspace/
_get_keyspace_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 GetKeyspaceOutput {
6    /// <p>The name of the keyspace.</p>
7    pub keyspace_name: ::std::string::String,
8    /// <p>Returns the ARN of the keyspace.</p>
9    pub resource_arn: ::std::string::String,
10    /// <p>Returns the replication strategy of the keyspace. The options are <code>SINGLE_REGION</code> or <code>MULTI_REGION</code>.</p>
11    pub replication_strategy: crate::types::Rs,
12    /// <p>If the <code>replicationStrategy</code> of the keyspace is <code>MULTI_REGION</code>, a list of replication Regions is returned.</p>
13    pub replication_regions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14    /// <p>A list of all Regions the keyspace is replicated in after the update keyspace operation and their status.</p>
15    pub replication_group_statuses: ::std::option::Option<::std::vec::Vec<crate::types::ReplicationGroupStatus>>,
16    _request_id: Option<String>,
17}
18impl GetKeyspaceOutput {
19    /// <p>The name of the keyspace.</p>
20    pub fn keyspace_name(&self) -> &str {
21        use std::ops::Deref;
22        self.keyspace_name.deref()
23    }
24    /// <p>Returns the ARN of the keyspace.</p>
25    pub fn resource_arn(&self) -> &str {
26        use std::ops::Deref;
27        self.resource_arn.deref()
28    }
29    /// <p>Returns the replication strategy of the keyspace. The options are <code>SINGLE_REGION</code> or <code>MULTI_REGION</code>.</p>
30    pub fn replication_strategy(&self) -> &crate::types::Rs {
31        &self.replication_strategy
32    }
33    /// <p>If the <code>replicationStrategy</code> of the keyspace is <code>MULTI_REGION</code>, a list of replication Regions is returned.</p>
34    ///
35    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.replication_regions.is_none()`.
36    pub fn replication_regions(&self) -> &[::std::string::String] {
37        self.replication_regions.as_deref().unwrap_or_default()
38    }
39    /// <p>A list of all Regions the keyspace is replicated in after the update keyspace operation and their status.</p>
40    ///
41    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.replication_group_statuses.is_none()`.
42    pub fn replication_group_statuses(&self) -> &[crate::types::ReplicationGroupStatus] {
43        self.replication_group_statuses.as_deref().unwrap_or_default()
44    }
45}
46impl ::aws_types::request_id::RequestId for GetKeyspaceOutput {
47    fn request_id(&self) -> Option<&str> {
48        self._request_id.as_deref()
49    }
50}
51impl GetKeyspaceOutput {
52    /// Creates a new builder-style object to manufacture [`GetKeyspaceOutput`](crate::operation::get_keyspace::GetKeyspaceOutput).
53    pub fn builder() -> crate::operation::get_keyspace::builders::GetKeyspaceOutputBuilder {
54        crate::operation::get_keyspace::builders::GetKeyspaceOutputBuilder::default()
55    }
56}
57
58/// A builder for [`GetKeyspaceOutput`](crate::operation::get_keyspace::GetKeyspaceOutput).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
60#[non_exhaustive]
61pub struct GetKeyspaceOutputBuilder {
62    pub(crate) keyspace_name: ::std::option::Option<::std::string::String>,
63    pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
64    pub(crate) replication_strategy: ::std::option::Option<crate::types::Rs>,
65    pub(crate) replication_regions: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
66    pub(crate) replication_group_statuses: ::std::option::Option<::std::vec::Vec<crate::types::ReplicationGroupStatus>>,
67    _request_id: Option<String>,
68}
69impl GetKeyspaceOutputBuilder {
70    /// <p>The name of the keyspace.</p>
71    /// This field is required.
72    pub fn keyspace_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
73        self.keyspace_name = ::std::option::Option::Some(input.into());
74        self
75    }
76    /// <p>The name of the keyspace.</p>
77    pub fn set_keyspace_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
78        self.keyspace_name = input;
79        self
80    }
81    /// <p>The name of the keyspace.</p>
82    pub fn get_keyspace_name(&self) -> &::std::option::Option<::std::string::String> {
83        &self.keyspace_name
84    }
85    /// <p>Returns the ARN of the keyspace.</p>
86    /// This field is required.
87    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
88        self.resource_arn = ::std::option::Option::Some(input.into());
89        self
90    }
91    /// <p>Returns the ARN of the keyspace.</p>
92    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
93        self.resource_arn = input;
94        self
95    }
96    /// <p>Returns the ARN of the keyspace.</p>
97    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
98        &self.resource_arn
99    }
100    /// <p>Returns the replication strategy of the keyspace. The options are <code>SINGLE_REGION</code> or <code>MULTI_REGION</code>.</p>
101    /// This field is required.
102    pub fn replication_strategy(mut self, input: crate::types::Rs) -> Self {
103        self.replication_strategy = ::std::option::Option::Some(input);
104        self
105    }
106    /// <p>Returns the replication strategy of the keyspace. The options are <code>SINGLE_REGION</code> or <code>MULTI_REGION</code>.</p>
107    pub fn set_replication_strategy(mut self, input: ::std::option::Option<crate::types::Rs>) -> Self {
108        self.replication_strategy = input;
109        self
110    }
111    /// <p>Returns the replication strategy of the keyspace. The options are <code>SINGLE_REGION</code> or <code>MULTI_REGION</code>.</p>
112    pub fn get_replication_strategy(&self) -> &::std::option::Option<crate::types::Rs> {
113        &self.replication_strategy
114    }
115    /// Appends an item to `replication_regions`.
116    ///
117    /// To override the contents of this collection use [`set_replication_regions`](Self::set_replication_regions).
118    ///
119    /// <p>If the <code>replicationStrategy</code> of the keyspace is <code>MULTI_REGION</code>, a list of replication Regions is returned.</p>
120    pub fn replication_regions(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        let mut v = self.replication_regions.unwrap_or_default();
122        v.push(input.into());
123        self.replication_regions = ::std::option::Option::Some(v);
124        self
125    }
126    /// <p>If the <code>replicationStrategy</code> of the keyspace is <code>MULTI_REGION</code>, a list of replication Regions is returned.</p>
127    pub fn set_replication_regions(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
128        self.replication_regions = input;
129        self
130    }
131    /// <p>If the <code>replicationStrategy</code> of the keyspace is <code>MULTI_REGION</code>, a list of replication Regions is returned.</p>
132    pub fn get_replication_regions(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
133        &self.replication_regions
134    }
135    /// Appends an item to `replication_group_statuses`.
136    ///
137    /// To override the contents of this collection use [`set_replication_group_statuses`](Self::set_replication_group_statuses).
138    ///
139    /// <p>A list of all Regions the keyspace is replicated in after the update keyspace operation and their status.</p>
140    pub fn replication_group_statuses(mut self, input: crate::types::ReplicationGroupStatus) -> Self {
141        let mut v = self.replication_group_statuses.unwrap_or_default();
142        v.push(input);
143        self.replication_group_statuses = ::std::option::Option::Some(v);
144        self
145    }
146    /// <p>A list of all Regions the keyspace is replicated in after the update keyspace operation and their status.</p>
147    pub fn set_replication_group_statuses(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ReplicationGroupStatus>>) -> Self {
148        self.replication_group_statuses = input;
149        self
150    }
151    /// <p>A list of all Regions the keyspace is replicated in after the update keyspace operation and their status.</p>
152    pub fn get_replication_group_statuses(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ReplicationGroupStatus>> {
153        &self.replication_group_statuses
154    }
155    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
156        self._request_id = Some(request_id.into());
157        self
158    }
159
160    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
161        self._request_id = request_id;
162        self
163    }
164    /// Consumes the builder and constructs a [`GetKeyspaceOutput`](crate::operation::get_keyspace::GetKeyspaceOutput).
165    /// This method will fail if any of the following fields are not set:
166    /// - [`keyspace_name`](crate::operation::get_keyspace::builders::GetKeyspaceOutputBuilder::keyspace_name)
167    /// - [`resource_arn`](crate::operation::get_keyspace::builders::GetKeyspaceOutputBuilder::resource_arn)
168    /// - [`replication_strategy`](crate::operation::get_keyspace::builders::GetKeyspaceOutputBuilder::replication_strategy)
169    pub fn build(self) -> ::std::result::Result<crate::operation::get_keyspace::GetKeyspaceOutput, ::aws_smithy_types::error::operation::BuildError> {
170        ::std::result::Result::Ok(crate::operation::get_keyspace::GetKeyspaceOutput {
171            keyspace_name: self.keyspace_name.ok_or_else(|| {
172                ::aws_smithy_types::error::operation::BuildError::missing_field(
173                    "keyspace_name",
174                    "keyspace_name was not specified but it is required when building GetKeyspaceOutput",
175                )
176            })?,
177            resource_arn: self.resource_arn.ok_or_else(|| {
178                ::aws_smithy_types::error::operation::BuildError::missing_field(
179                    "resource_arn",
180                    "resource_arn was not specified but it is required when building GetKeyspaceOutput",
181                )
182            })?,
183            replication_strategy: self.replication_strategy.ok_or_else(|| {
184                ::aws_smithy_types::error::operation::BuildError::missing_field(
185                    "replication_strategy",
186                    "replication_strategy was not specified but it is required when building GetKeyspaceOutput",
187                )
188            })?,
189            replication_regions: self.replication_regions,
190            replication_group_statuses: self.replication_group_statuses,
191            _request_id: self._request_id,
192        })
193    }
194}