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(self, client: &crate::Client) -> ::std::result::Result<
9 crate::operation::update_global_table::UpdateGlobalTableOutput,
10 ::aws_smithy_runtime_api::client::result::SdkError<
11 crate::operation::update_global_table::UpdateGlobalTableError,
12 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13 >
14 > {
15 let mut fluent_builder = client.update_global_table();
16 fluent_builder.inner = self;
17 fluent_builder.send().await
18 }
19 }
20/// Fluent builder constructing a request to `UpdateGlobalTable`.
21///
22/// <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>
23/// <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>
24/// <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>
25/// </important> <note>
26/// <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>
27/// <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>
28/// </note>
29/// <p>If global secondary indexes are specified, then the following conditions must also be met:</p>
30/// <ul>
31/// <li>
32/// <p>The global secondary indexes must have the same name.</p></li>
33/// <li>
34/// <p>The global secondary indexes must have the same hash key and sort key (if present).</p></li>
35/// <li>
36/// <p>The global secondary indexes must have the same provisioned and maximum write capacity units.</p></li>
37/// </ul>
38#[derive(::std::clone::Clone, ::std::fmt::Debug)]
39pub struct UpdateGlobalTableFluentBuilder {
40 handle: ::std::sync::Arc<crate::client::Handle>,
41 inner: crate::operation::update_global_table::builders::UpdateGlobalTableInputBuilder,
42config_override: ::std::option::Option<crate::config::Builder>,
43 }
44impl
45 crate::client::customize::internal::CustomizableSend<
46 crate::operation::update_global_table::UpdateGlobalTableOutput,
47 crate::operation::update_global_table::UpdateGlobalTableError,
48 > for UpdateGlobalTableFluentBuilder
49 {
50 fn send(
51 self,
52 config_override: crate::config::Builder,
53 ) -> crate::client::customize::internal::BoxFuture<
54 crate::client::customize::internal::SendResult<
55 crate::operation::update_global_table::UpdateGlobalTableOutput,
56 crate::operation::update_global_table::UpdateGlobalTableError,
57 >,
58 > {
59 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
60 }
61 }
62impl UpdateGlobalTableFluentBuilder {
63 /// Creates a new `UpdateGlobalTableFluentBuilder`.
64 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
65 Self {
66 handle,
67 inner: ::std::default::Default::default(),
68 config_override: ::std::option::Option::None,
69 }
70 }
71 /// Access the UpdateGlobalTable as a reference.
72 pub fn as_input(&self) -> &crate::operation::update_global_table::builders::UpdateGlobalTableInputBuilder {
73 &self.inner
74 }
75 /// Sends the request and returns the response.
76 ///
77 /// If an error occurs, an `SdkError` will be returned with additional details that
78 /// can be matched against.
79 ///
80 /// By default, any retryable failures will be retried twice. Retry behavior
81 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
82 /// set when configuring the client.
83 pub async fn send(self) -> ::std::result::Result<crate::operation::update_global_table::UpdateGlobalTableOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::update_global_table::UpdateGlobalTableError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
84 let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85 let runtime_plugins = crate::operation::update_global_table::UpdateGlobalTable::operation_runtime_plugins(
86 self.handle.runtime_plugins.clone(),
87 &self.handle.conf,
88 self.config_override,
89 );
90 crate::operation::update_global_table::UpdateGlobalTable::orchestrate(&runtime_plugins, input).await
91 }
92
93 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94 pub fn customize(
95 self,
96 ) -> crate::client::customize::CustomizableOperation<crate::operation::update_global_table::UpdateGlobalTableOutput, crate::operation::update_global_table::UpdateGlobalTableError, Self> {
97 crate::client::customize::CustomizableOperation::new(self)
98 }
99 pub(crate) fn config_override(
100 mut self,
101 config_override: impl ::std::convert::Into<crate::config::Builder>,
102 ) -> Self {
103 self.set_config_override(::std::option::Option::Some(config_override.into()));
104 self
105 }
106
107 pub(crate) fn set_config_override(
108 &mut self,
109 config_override: ::std::option::Option<crate::config::Builder>,
110 ) -> &mut Self {
111 self.config_override = config_override;
112 self
113 }
114 /// <p>The global table name.</p>
115 pub fn global_table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116 self.inner = self.inner.global_table_name(input.into());
117 self
118 }
119 /// <p>The global table name.</p>
120 pub fn set_global_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121 self.inner = self.inner.set_global_table_name(input);
122 self
123 }
124 /// <p>The global table name.</p>
125 pub fn get_global_table_name(&self) -> &::std::option::Option<::std::string::String> {
126 self.inner.get_global_table_name()
127 }
128 ///
129 /// Appends an item to `ReplicaUpdates`.
130 ///
131 /// To override the contents of this collection use [`set_replica_updates`](Self::set_replica_updates).
132 ///
133 /// <p>A list of Regions that should be added or removed from the global table.</p>
134 pub fn replica_updates(mut self, input: crate::types::ReplicaUpdate) -> Self {
135 self.inner = self.inner.replica_updates(input);
136 self
137 }
138 /// <p>A list of Regions that should be added or removed from the global table.</p>
139 pub fn set_replica_updates(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::ReplicaUpdate>>) -> Self {
140 self.inner = self.inner.set_replica_updates(input);
141 self
142 }
143 /// <p>A list of Regions that should be added or removed from the global table.</p>
144 pub fn get_replica_updates(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::ReplicaUpdate>> {
145 self.inner.get_replica_updates()
146 }
147}
148