aws_sdk_keyspaces/operation/update_keyspace/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_keyspace::_update_keyspace_output::UpdateKeyspaceOutputBuilder;
3
4pub use crate::operation::update_keyspace::_update_keyspace_input::UpdateKeyspaceInputBuilder;
5
6impl crate::operation::update_keyspace::builders::UpdateKeyspaceInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::update_keyspace::UpdateKeyspaceOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_keyspace::UpdateKeyspaceError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_keyspace();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateKeyspace`.
24///
25/// <p>Adds a new Amazon Web Services Region to the keyspace. You can add a new Region to a keyspace that is either a single or a multi-Region keyspace. Amazon Keyspaces is going to replicate all tables in the keyspace to the new Region. To successfully replicate all tables to the new Region, they must use client-side timestamps for conflict resolution. To enable client-side timestamps, specify <code>clientSideTimestamps.status = enabled</code> when invoking the API. For more information about client-side timestamps, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/client-side-timestamps.html">Client-side timestamps in Amazon Keyspaces</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
26/// <p>To add a Region to a keyspace using the <code>UpdateKeyspace</code> API, the IAM principal needs permissions for the following IAM actions:</p>
27/// <ul>
28/// <li>
29/// <p><code>cassandra:Alter</code></p></li>
30/// <li>
31/// <p><code>cassandra:AlterMultiRegionResource</code></p></li>
32/// <li>
33/// <p><code>cassandra:Create</code></p></li>
34/// <li>
35/// <p><code>cassandra:CreateMultiRegionResource</code></p></li>
36/// <li>
37/// <p><code>cassandra:Select</code></p></li>
38/// <li>
39/// <p><code>cassandra:SelectMultiRegionResource</code></p></li>
40/// <li>
41/// <p><code>cassandra:Modify</code></p></li>
42/// <li>
43/// <p><code>cassandra:ModifyMultiRegionResource</code></p></li>
44/// </ul>
45/// <p>If the keyspace contains a table that is configured in provisioned mode with auto scaling enabled, the following additional IAM actions need to be allowed.</p>
46/// <ul>
47/// <li>
48/// <p><code>application-autoscaling:RegisterScalableTarget</code></p></li>
49/// <li>
50/// <p><code>application-autoscaling:DeregisterScalableTarget</code></p></li>
51/// <li>
52/// <p><code>application-autoscaling:DescribeScalableTargets</code></p></li>
53/// <li>
54/// <p><code>application-autoscaling:PutScalingPolicy</code></p></li>
55/// <li>
56/// <p><code>application-autoscaling:DescribeScalingPolicies</code></p></li>
57/// </ul>
58/// <p>To use the <code>UpdateKeyspace</code> API, the IAM principal also needs permissions to create a service-linked role with the following elements:</p>
59/// <ul>
60/// <li>
61/// <p><code>iam:CreateServiceLinkedRole</code> - The <b>action</b> the principal can perform.</p></li>
62/// <li>
63/// <p><code>arn:aws:iam::*:role/aws-service-role/replication.cassandra.amazonaws.com/AWSServiceRoleForKeyspacesReplication</code> - The <b>resource</b> that the action can be performed on.</p></li>
64/// <li>
65/// <p><code>iam:AWSServiceName: replication.cassandra.amazonaws.com</code> - The only Amazon Web Services service that this role can be attached to is Amazon Keyspaces.</p></li>
66/// </ul>
67/// <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/howitworks_replication_permissions_addReplica.html">Configure the IAM permissions required to add an Amazon Web Services Region to a keyspace</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
68#[derive(::std::clone::Clone, ::std::fmt::Debug)]
69pub struct UpdateKeyspaceFluentBuilder {
70    handle: ::std::sync::Arc<crate::client::Handle>,
71    inner: crate::operation::update_keyspace::builders::UpdateKeyspaceInputBuilder,
72    config_override: ::std::option::Option<crate::config::Builder>,
73}
74impl
75    crate::client::customize::internal::CustomizableSend<
76        crate::operation::update_keyspace::UpdateKeyspaceOutput,
77        crate::operation::update_keyspace::UpdateKeyspaceError,
78    > for UpdateKeyspaceFluentBuilder
79{
80    fn send(
81        self,
82        config_override: crate::config::Builder,
83    ) -> crate::client::customize::internal::BoxFuture<
84        crate::client::customize::internal::SendResult<
85            crate::operation::update_keyspace::UpdateKeyspaceOutput,
86            crate::operation::update_keyspace::UpdateKeyspaceError,
87        >,
88    > {
89        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
90    }
91}
92impl UpdateKeyspaceFluentBuilder {
93    /// Creates a new `UpdateKeyspaceFluentBuilder`.
94    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
95        Self {
96            handle,
97            inner: ::std::default::Default::default(),
98            config_override: ::std::option::Option::None,
99        }
100    }
101    /// Access the UpdateKeyspace as a reference.
102    pub fn as_input(&self) -> &crate::operation::update_keyspace::builders::UpdateKeyspaceInputBuilder {
103        &self.inner
104    }
105    /// Sends the request and returns the response.
106    ///
107    /// If an error occurs, an `SdkError` will be returned with additional details that
108    /// can be matched against.
109    ///
110    /// By default, any retryable failures will be retried twice. Retry behavior
111    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
112    /// set when configuring the client.
113    pub async fn send(
114        self,
115    ) -> ::std::result::Result<
116        crate::operation::update_keyspace::UpdateKeyspaceOutput,
117        ::aws_smithy_runtime_api::client::result::SdkError<
118            crate::operation::update_keyspace::UpdateKeyspaceError,
119            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
120        >,
121    > {
122        let input = self
123            .inner
124            .build()
125            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
126        let runtime_plugins = crate::operation::update_keyspace::UpdateKeyspace::operation_runtime_plugins(
127            self.handle.runtime_plugins.clone(),
128            &self.handle.conf,
129            self.config_override,
130        );
131        crate::operation::update_keyspace::UpdateKeyspace::orchestrate(&runtime_plugins, input).await
132    }
133
134    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
135    pub fn customize(
136        self,
137    ) -> crate::client::customize::CustomizableOperation<
138        crate::operation::update_keyspace::UpdateKeyspaceOutput,
139        crate::operation::update_keyspace::UpdateKeyspaceError,
140        Self,
141    > {
142        crate::client::customize::CustomizableOperation::new(self)
143    }
144    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
145        self.set_config_override(::std::option::Option::Some(config_override.into()));
146        self
147    }
148
149    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
150        self.config_override = config_override;
151        self
152    }
153    /// <p>The name of the keyspace.</p>
154    pub fn keyspace_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155        self.inner = self.inner.keyspace_name(input.into());
156        self
157    }
158    /// <p>The name of the keyspace.</p>
159    pub fn set_keyspace_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.inner = self.inner.set_keyspace_name(input);
161        self
162    }
163    /// <p>The name of the keyspace.</p>
164    pub fn get_keyspace_name(&self) -> &::std::option::Option<::std::string::String> {
165        self.inner.get_keyspace_name()
166    }
167    /// <p>The replication specification of the keyspace includes:</p>
168    /// <ul>
169    /// <li>
170    /// <p><code>regionList</code> - the Amazon Web Services Regions where the keyspace is replicated in.</p></li>
171    /// <li>
172    /// <p><code>replicationStrategy</code> - the required value is <code>SINGLE_REGION</code> or <code>MULTI_REGION</code>.</p></li>
173    /// </ul>
174    pub fn replication_specification(mut self, input: crate::types::ReplicationSpecification) -> Self {
175        self.inner = self.inner.replication_specification(input);
176        self
177    }
178    /// <p>The replication specification of the keyspace includes:</p>
179    /// <ul>
180    /// <li>
181    /// <p><code>regionList</code> - the Amazon Web Services Regions where the keyspace is replicated in.</p></li>
182    /// <li>
183    /// <p><code>replicationStrategy</code> - the required value is <code>SINGLE_REGION</code> or <code>MULTI_REGION</code>.</p></li>
184    /// </ul>
185    pub fn set_replication_specification(mut self, input: ::std::option::Option<crate::types::ReplicationSpecification>) -> Self {
186        self.inner = self.inner.set_replication_specification(input);
187        self
188    }
189    /// <p>The replication specification of the keyspace includes:</p>
190    /// <ul>
191    /// <li>
192    /// <p><code>regionList</code> - the Amazon Web Services Regions where the keyspace is replicated in.</p></li>
193    /// <li>
194    /// <p><code>replicationStrategy</code> - the required value is <code>SINGLE_REGION</code> or <code>MULTI_REGION</code>.</p></li>
195    /// </ul>
196    pub fn get_replication_specification(&self) -> &::std::option::Option<crate::types::ReplicationSpecification> {
197        self.inner.get_replication_specification()
198    }
199    /// <p>The client-side timestamp setting of the table.</p>
200    /// <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/client-side-timestamps-how-it-works.html">How it works: Amazon Keyspaces client-side timestamps</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
201    pub fn client_side_timestamps(mut self, input: crate::types::ClientSideTimestamps) -> Self {
202        self.inner = self.inner.client_side_timestamps(input);
203        self
204    }
205    /// <p>The client-side timestamp setting of the table.</p>
206    /// <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/client-side-timestamps-how-it-works.html">How it works: Amazon Keyspaces client-side timestamps</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
207    pub fn set_client_side_timestamps(mut self, input: ::std::option::Option<crate::types::ClientSideTimestamps>) -> Self {
208        self.inner = self.inner.set_client_side_timestamps(input);
209        self
210    }
211    /// <p>The client-side timestamp setting of the table.</p>
212    /// <p>For more information, see <a href="https://docs.aws.amazon.com/keyspaces/latest/devguide/client-side-timestamps-how-it-works.html">How it works: Amazon Keyspaces client-side timestamps</a> in the <i>Amazon Keyspaces Developer Guide</i>.</p>
213    pub fn get_client_side_timestamps(&self) -> &::std::option::Option<crate::types::ClientSideTimestamps> {
214        self.inner.get_client_side_timestamps()
215    }
216}