aws_sdk_dynamodb/operation/transact_write_items/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::transact_write_items::_transact_write_items_output::TransactWriteItemsOutputBuilder;
3
4pub use crate::operation::transact_write_items::_transact_write_items_input::TransactWriteItemsInputBuilder;
5
6impl crate::operation::transact_write_items::builders::TransactWriteItemsInputBuilder {
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::transact_write_items::TransactWriteItemsOutput,
10                        ::aws_smithy_runtime_api::client::result::SdkError<
11                            crate::operation::transact_write_items::TransactWriteItemsError,
12                            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13                        >
14                    > {
15                        let mut fluent_builder = client.transact_write_items();
16                        fluent_builder.inner = self;
17                        fluent_builder.send().await
18                    }
19                }
20/// Fluent builder constructing a request to `TransactWriteItems`.
21/// 
22/// <p><code>TransactWriteItems</code> is a synchronous write operation that groups up to 100 action requests. These actions can target items in different tables, but not in different Amazon Web Services accounts or Regions, and no two actions can target the same item. For example, you cannot both <code>ConditionCheck</code> and <code>Update</code> the same item. The aggregate size of the items in the transaction cannot exceed 4 MB.</p>
23/// <p>The actions are completed atomically so that either all of them succeed, or all of them fail. They are defined by the following objects:</p>
24/// <ul>
25/// <li>
26/// <p><code>Put</code> &nbsp;— &nbsp; Initiates a <code>PutItem</code> operation to write a new item. This structure specifies the primary key of the item to be written, the name of the table to write it in, an optional condition expression that must be satisfied for the write to succeed, a list of the item's attributes, and a field indicating whether to retrieve the item's attributes if the condition is not met.</p></li>
27/// <li>
28/// <p><code>Update</code> &nbsp;— &nbsp; Initiates an <code>UpdateItem</code> operation to update an existing item. This structure specifies the primary key of the item to be updated, the name of the table where it resides, an optional condition expression that must be satisfied for the update to succeed, an expression that defines one or more attributes to be updated, and a field indicating whether to retrieve the item's attributes if the condition is not met.</p></li>
29/// <li>
30/// <p><code>Delete</code> &nbsp;— &nbsp; Initiates a <code>DeleteItem</code> operation to delete an existing item. This structure specifies the primary key of the item to be deleted, the name of the table where it resides, an optional condition expression that must be satisfied for the deletion to succeed, and a field indicating whether to retrieve the item's attributes if the condition is not met.</p></li>
31/// <li>
32/// <p><code>ConditionCheck</code> &nbsp;— &nbsp; Applies a condition to an item that is not being modified by the transaction. This structure specifies the primary key of the item to be checked, the name of the table where it resides, a condition expression that must be satisfied for the transaction to succeed, and a field indicating whether to retrieve the item's attributes if the condition is not met.</p></li>
33/// </ul>
34/// <p>DynamoDB rejects the entire <code>TransactWriteItems</code> request if any of the following is true:</p>
35/// <ul>
36/// <li>
37/// <p>A condition in one of the condition expressions is not met.</p></li>
38/// <li>
39/// <p>An ongoing operation is in the process of updating the same item.</p></li>
40/// <li>
41/// <p>There is insufficient provisioned capacity for the transaction to be completed.</p></li>
42/// <li>
43/// <p>An item size becomes too large (bigger than 400 KB), a local secondary index (LSI) becomes too large, or a similar validation error occurs because of changes made by the transaction.</p></li>
44/// <li>
45/// <p>The aggregate size of the items in the transaction exceeds 4 MB.</p></li>
46/// <li>
47/// <p>There is a user error, such as an invalid data format.</p></li>
48/// </ul>
49#[derive(::std::clone::Clone, ::std::fmt::Debug)]
50pub struct TransactWriteItemsFluentBuilder {
51                handle: ::std::sync::Arc<crate::client::Handle>,
52                inner: crate::operation::transact_write_items::builders::TransactWriteItemsInputBuilder,
53config_override: ::std::option::Option<crate::config::Builder>,
54            }
55impl
56                crate::client::customize::internal::CustomizableSend<
57                    crate::operation::transact_write_items::TransactWriteItemsOutput,
58                    crate::operation::transact_write_items::TransactWriteItemsError,
59                > for TransactWriteItemsFluentBuilder
60            {
61                fn send(
62                    self,
63                    config_override: crate::config::Builder,
64                ) -> crate::client::customize::internal::BoxFuture<
65                    crate::client::customize::internal::SendResult<
66                        crate::operation::transact_write_items::TransactWriteItemsOutput,
67                        crate::operation::transact_write_items::TransactWriteItemsError,
68                    >,
69                > {
70                    ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
71                }
72            }
73impl TransactWriteItemsFluentBuilder {
74    /// Creates a new `TransactWriteItemsFluentBuilder`.
75                    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
76                        Self {
77                            handle,
78                            inner: ::std::default::Default::default(),
79    config_override: ::std::option::Option::None,
80                        }
81                    }
82    /// Access the TransactWriteItems as a reference.
83                    pub fn as_input(&self) -> &crate::operation::transact_write_items::builders::TransactWriteItemsInputBuilder {
84                        &self.inner
85                    }
86    /// Sends the request and returns the response.
87                    ///
88                    /// If an error occurs, an `SdkError` will be returned with additional details that
89                    /// can be matched against.
90                    ///
91                    /// By default, any retryable failures will be retried twice. Retry behavior
92                    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
93                    /// set when configuring the client.
94                    pub async fn send(self) -> ::std::result::Result<crate::operation::transact_write_items::TransactWriteItemsOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::transact_write_items::TransactWriteItemsError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
95                        let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
96                        let runtime_plugins = crate::operation::transact_write_items::TransactWriteItems::operation_runtime_plugins(
97                            self.handle.runtime_plugins.clone(),
98                            &self.handle.conf,
99                            self.config_override,
100                        );
101                        crate::operation::transact_write_items::TransactWriteItems::orchestrate(&runtime_plugins, input).await
102                    }
103    
104                    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
105                    pub fn customize(
106                        self,
107                    ) -> crate::client::customize::CustomizableOperation<crate::operation::transact_write_items::TransactWriteItemsOutput, crate::operation::transact_write_items::TransactWriteItemsError, Self> {
108                        crate::client::customize::CustomizableOperation::new(self)
109                    }
110    pub(crate) fn config_override(
111                            mut self,
112                            config_override: impl ::std::convert::Into<crate::config::Builder>,
113                        ) -> Self {
114                            self.set_config_override(::std::option::Option::Some(config_override.into()));
115                            self
116                        }
117    
118                        pub(crate) fn set_config_override(
119                            &mut self,
120                            config_override: ::std::option::Option<crate::config::Builder>,
121                        ) -> &mut Self {
122                            self.config_override = config_override;
123                            self
124                        }
125    /// 
126    /// Appends an item to `TransactItems`.
127    /// 
128    /// To override the contents of this collection use [`set_transact_items`](Self::set_transact_items).
129    /// 
130    /// <p>An ordered array of up to 100 <code>TransactWriteItem</code> objects, each of which contains a <code>ConditionCheck</code>, <code>Put</code>, <code>Update</code>, or <code>Delete</code> object. These can operate on items in different tables, but the tables must reside in the same Amazon Web Services account and Region, and no two of them can operate on the same item.</p>
131    pub fn transact_items(mut self, input: crate::types::TransactWriteItem) -> Self {
132                        self.inner = self.inner.transact_items(input);
133                        self
134                    }
135    /// <p>An ordered array of up to 100 <code>TransactWriteItem</code> objects, each of which contains a <code>ConditionCheck</code>, <code>Put</code>, <code>Update</code>, or <code>Delete</code> object. These can operate on items in different tables, but the tables must reside in the same Amazon Web Services account and Region, and no two of them can operate on the same item.</p>
136    pub fn set_transact_items(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::TransactWriteItem>>) -> Self {
137                    self.inner = self.inner.set_transact_items(input);
138                    self
139                }
140    /// <p>An ordered array of up to 100 <code>TransactWriteItem</code> objects, each of which contains a <code>ConditionCheck</code>, <code>Put</code>, <code>Update</code>, or <code>Delete</code> object. These can operate on items in different tables, but the tables must reside in the same Amazon Web Services account and Region, and no two of them can operate on the same item.</p>
141    pub fn get_transact_items(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::TransactWriteItem>> {
142                    self.inner.get_transact_items()
143                }
144    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
145    /// <ul>
146    /// <li>
147    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
148    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
149    /// <li>
150    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
151    /// <li>
152    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
153    /// </ul>
154    pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
155                    self.inner = self.inner.return_consumed_capacity(input);
156                    self
157                }
158    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
159    /// <ul>
160    /// <li>
161    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
162    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
163    /// <li>
164    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
165    /// <li>
166    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
167    /// </ul>
168    pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
169                    self.inner = self.inner.set_return_consumed_capacity(input);
170                    self
171                }
172    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
173    /// <ul>
174    /// <li>
175    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
176    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
177    /// <li>
178    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
179    /// <li>
180    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
181    /// </ul>
182    pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
183                    self.inner.get_return_consumed_capacity()
184                }
185    /// <p>Determines whether item collection metrics are returned. If set to <code>SIZE</code>, the response includes statistics about item collections (if any), that were modified during the operation and are returned in the response. If set to <code>NONE</code> (the default), no statistics are returned.</p>
186    pub fn return_item_collection_metrics(mut self, input: crate::types::ReturnItemCollectionMetrics) -> Self {
187                    self.inner = self.inner.return_item_collection_metrics(input);
188                    self
189                }
190    /// <p>Determines whether item collection metrics are returned. If set to <code>SIZE</code>, the response includes statistics about item collections (if any), that were modified during the operation and are returned in the response. If set to <code>NONE</code> (the default), no statistics are returned.</p>
191    pub fn set_return_item_collection_metrics(mut self, input: ::std::option::Option<crate::types::ReturnItemCollectionMetrics>) -> Self {
192                    self.inner = self.inner.set_return_item_collection_metrics(input);
193                    self
194                }
195    /// <p>Determines whether item collection metrics are returned. If set to <code>SIZE</code>, the response includes statistics about item collections (if any), that were modified during the operation and are returned in the response. If set to <code>NONE</code> (the default), no statistics are returned.</p>
196    pub fn get_return_item_collection_metrics(&self) -> &::std::option::Option<crate::types::ReturnItemCollectionMetrics> {
197                    self.inner.get_return_item_collection_metrics()
198                }
199    /// <p>Providing a <code>ClientRequestToken</code> makes the call to <code>TransactWriteItems</code> idempotent, meaning that multiple identical calls have the same effect as one single call.</p>
200    /// <p>Although multiple identical calls using the same client request token produce the same result on the server (no side effects), the responses to the calls might not be the same. If the <code>ReturnConsumedCapacity</code> parameter is set, then the initial <code>TransactWriteItems</code> call returns the amount of write capacity units consumed in making the changes. Subsequent <code>TransactWriteItems</code> calls with the same client token return the number of read capacity units consumed in reading the item.</p>
201    /// <p>A client request token is valid for 10 minutes after the first request that uses it is completed. After 10 minutes, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 10 minutes, or the result might not be idempotent.</p>
202    /// <p>If you submit a request with the same client token but a change in other parameters within the 10-minute idempotency window, DynamoDB returns an <code>IdempotentParameterMismatch</code> exception.</p>
203    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
204                    self.inner = self.inner.client_request_token(input.into());
205                    self
206                }
207    /// <p>Providing a <code>ClientRequestToken</code> makes the call to <code>TransactWriteItems</code> idempotent, meaning that multiple identical calls have the same effect as one single call.</p>
208    /// <p>Although multiple identical calls using the same client request token produce the same result on the server (no side effects), the responses to the calls might not be the same. If the <code>ReturnConsumedCapacity</code> parameter is set, then the initial <code>TransactWriteItems</code> call returns the amount of write capacity units consumed in making the changes. Subsequent <code>TransactWriteItems</code> calls with the same client token return the number of read capacity units consumed in reading the item.</p>
209    /// <p>A client request token is valid for 10 minutes after the first request that uses it is completed. After 10 minutes, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 10 minutes, or the result might not be idempotent.</p>
210    /// <p>If you submit a request with the same client token but a change in other parameters within the 10-minute idempotency window, DynamoDB returns an <code>IdempotentParameterMismatch</code> exception.</p>
211    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
212                    self.inner = self.inner.set_client_request_token(input);
213                    self
214                }
215    /// <p>Providing a <code>ClientRequestToken</code> makes the call to <code>TransactWriteItems</code> idempotent, meaning that multiple identical calls have the same effect as one single call.</p>
216    /// <p>Although multiple identical calls using the same client request token produce the same result on the server (no side effects), the responses to the calls might not be the same. If the <code>ReturnConsumedCapacity</code> parameter is set, then the initial <code>TransactWriteItems</code> call returns the amount of write capacity units consumed in making the changes. Subsequent <code>TransactWriteItems</code> calls with the same client token return the number of read capacity units consumed in reading the item.</p>
217    /// <p>A client request token is valid for 10 minutes after the first request that uses it is completed. After 10 minutes, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 10 minutes, or the result might not be idempotent.</p>
218    /// <p>If you submit a request with the same client token but a change in other parameters within the 10-minute idempotency window, DynamoDB returns an <code>IdempotentParameterMismatch</code> exception.</p>
219    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
220                    self.inner.get_client_request_token()
221                }
222}
223