aws_sdk_dynamodb/operation/update_global_table/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_global_table::_update_global_table_output::UpdateGlobalTableOutputBuilder;
3
4pub use crate::operation::update_global_table::_update_global_table_input::UpdateGlobalTableInputBuilder;
5
6impl crate::operation::update_global_table::builders::UpdateGlobalTableInputBuilder {
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_global_table::UpdateGlobalTableOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_global_table::UpdateGlobalTableError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_global_table();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateGlobalTable`.
24///
25/// <p>Adds or removes replicas in the specified global table. The global table must already exist to be able to use this operation. Any replica to be added must be empty, have the same name as the global table, have the same key schema, have DynamoDB Streams enabled, and have the same provisioned and maximum write capacity units.</p><important>
26/// <p>This documentation is for version 2017.11.29 (Legacy) of global tables, which should be avoided for new global tables. Customers should use <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GlobalTables.html">Global Tables version 2019.11.21 (Current)</a> when possible, because it provides greater flexibility, higher efficiency, and consumes less write capacity than 2017.11.29 (Legacy).</p>
27/// <p>To determine which version you're using, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.DetermineVersion.html">Determining the global table version you are using</a>. To update existing global tables from version 2017.11.29 (Legacy) to version 2019.11.21 (Current), see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/V2globaltables_upgrade.html">Upgrading global tables</a>.</p>
28/// </important> <note>
29/// <p>For global tables, this operation only applies to global tables using Version 2019.11.21 (Current version). If you are using global tables <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GlobalTables.html">Version 2019.11.21</a> you can use <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html">UpdateTable</a> instead.</p>
30/// <p>Although you can use <code>UpdateGlobalTable</code> to add replicas and remove replicas in a single request, for simplicity we recommend that you issue separate requests for adding or removing replicas.</p>
31/// </note>
32/// <p>If global secondary indexes are specified, then the following conditions must also be met:</p>
33/// <ul>
34/// <li>
35/// <p>The global secondary indexes must have the same name.</p></li>
36/// <li>
37/// <p>The global secondary indexes must have the same hash key and sort key (if present).</p></li>
38/// <li>
39/// <p>The global secondary indexes must have the same provisioned and maximum write capacity units.</p></li>
40/// </ul>
41#[derive(::std::clone::Clone, ::std::fmt::Debug)]
42pub struct UpdateGlobalTableFluentBuilder {
43    handle: ::std::sync::Arc<crate::client::Handle>,
44    inner: crate::operation::update_global_table::builders::UpdateGlobalTableInputBuilder,
45    config_override: ::std::option::Option<crate::config::Builder>,
46}
47impl
48    crate::client::customize::internal::CustomizableSend<
49        crate::operation::update_global_table::UpdateGlobalTableOutput,
50        crate::operation::update_global_table::UpdateGlobalTableError,
51    > for UpdateGlobalTableFluentBuilder
52{
53    fn send(
54        self,
55        config_override: crate::config::Builder,
56    ) -> crate::client::customize::internal::BoxFuture<
57        crate::client::customize::internal::SendResult<
58            crate::operation::update_global_table::UpdateGlobalTableOutput,
59            crate::operation::update_global_table::UpdateGlobalTableError,
60        >,
61    > {
62        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
63    }
64}
65impl UpdateGlobalTableFluentBuilder {
66    /// Creates a new `UpdateGlobalTableFluentBuilder`.
67    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
68        Self {
69            handle,
70            inner: ::std::default::Default::default(),
71            config_override: ::std::option::Option::None,
72        }
73    }
74    /// Access the UpdateGlobalTable as a reference.
75    pub fn as_input(&self) -> &crate::operation::update_global_table::builders::UpdateGlobalTableInputBuilder {
76        &self.inner
77    }
78    /// Sends the request and returns the response.
79    ///
80    /// If an error occurs, an `SdkError` will be returned with additional details that
81    /// can be matched against.
82    ///
83    /// By default, any retryable failures will be retried twice. Retry behavior
84    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
85    /// set when configuring the client.
86    pub async fn send(
87        self,
88    ) -> ::std::result::Result<
89        crate::operation::update_global_table::UpdateGlobalTableOutput,
90        ::aws_smithy_runtime_api::client::result::SdkError<
91            crate::operation::update_global_table::UpdateGlobalTableError,
92            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
93        >,
94    > {
95        let input = self
96            .inner
97            .build()
98            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
99        let runtime_plugins = crate::operation::update_global_table::UpdateGlobalTable::operation_runtime_plugins(
100            self.handle.runtime_plugins.clone(),
101            &self.handle.conf,
102            self.config_override,
103        );
104        crate::operation::update_global_table::UpdateGlobalTable::orchestrate(&runtime_plugins, input).await
105    }
106
107    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
108    pub fn customize(
109        self,
110    ) -> crate::client::customize::CustomizableOperation<
111        crate::operation::update_global_table::UpdateGlobalTableOutput,
112        crate::operation::update_global_table::UpdateGlobalTableError,
113        Self,
114    > {
115        crate::client::customize::CustomizableOperation::new(self)
116    }
117    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
118        self.set_config_override(::std::option::Option::Some(config_override.into()));
119        self
120    }
121
122    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
123        self.config_override = config_override;
124        self
125    }
126    /// <p>The global table name.</p>
127    pub fn global_table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.global_table_name(input.into());
129        self
130    }
131    /// <p>The global table name.</p>
132    pub fn set_global_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_global_table_name(input);
134        self
135    }
136    /// <p>The global table name.</p>
137    pub fn get_global_table_name(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_global_table_name()
139    }
140    ///
141    /// Appends an item to `ReplicaUpdates`.
142    ///
143    /// To override the contents of this collection use [`set_replica_updates`](Self::set_replica_updates).
144    ///
145    /// <p>A list of Regions that should be added or removed from the global table.</p>
146    pub fn replica_updates(mut self, input: crate::types::ReplicaUpdate) -> Self {
147        self.inner = self.inner.replica_updates(input);
148        self
149    }
150    /// <p>A list of Regions that should be added or removed from the global table.</p>
151    pub fn set_replica_updates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ReplicaUpdate>>) -> Self {
152        self.inner = self.inner.set_replica_updates(input);
153        self
154    }
155    /// <p>A list of Regions that should be added or removed from the global table.</p>
156    pub fn get_replica_updates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ReplicaUpdate>> {
157        self.inner.get_replica_updates()
158    }
159}