aws_sdk_dynamodb/operation/transact_write_items/
_transact_write_items_input.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 TransactWriteItemsInput {
6    /// <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>
7    pub transact_items: ::std::option::Option<::std::vec::Vec<crate::types::TransactWriteItem>>,
8    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
9    /// <ul>
10    /// <li>
11    /// <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>
12    /// <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>
13    /// <li>
14    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
15    /// <li>
16    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
17    /// </ul>
18    pub return_consumed_capacity: ::std::option::Option<crate::types::ReturnConsumedCapacity>,
19    /// <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>
20    pub return_item_collection_metrics: ::std::option::Option<crate::types::ReturnItemCollectionMetrics>,
21    /// <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>
22    /// <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>
23    /// <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>
24    /// <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>
25    pub client_request_token: ::std::option::Option<::std::string::String>,
26}
27impl TransactWriteItemsInput {
28    /// <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>
29    ///
30    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.transact_items.is_none()`.
31    pub fn transact_items(&self) -> &[crate::types::TransactWriteItem] {
32        self.transact_items.as_deref().unwrap_or_default()
33    }
34    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
35    /// <ul>
36    /// <li>
37    /// <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>
38    /// <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>
39    /// <li>
40    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
41    /// <li>
42    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
43    /// </ul>
44    pub fn return_consumed_capacity(&self) -> ::std::option::Option<&crate::types::ReturnConsumedCapacity> {
45        self.return_consumed_capacity.as_ref()
46    }
47    /// <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>
48    pub fn return_item_collection_metrics(&self) -> ::std::option::Option<&crate::types::ReturnItemCollectionMetrics> {
49        self.return_item_collection_metrics.as_ref()
50    }
51    /// <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>
52    /// <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>
53    /// <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>
54    /// <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>
55    pub fn client_request_token(&self) -> ::std::option::Option<&str> {
56        self.client_request_token.as_deref()
57    }
58}
59impl TransactWriteItemsInput {
60    /// Creates a new builder-style object to manufacture [`TransactWriteItemsInput`](crate::operation::transact_write_items::TransactWriteItemsInput).
61    pub fn builder() -> crate::operation::transact_write_items::builders::TransactWriteItemsInputBuilder {
62        crate::operation::transact_write_items::builders::TransactWriteItemsInputBuilder::default()
63    }
64}
65
66/// A builder for [`TransactWriteItemsInput`](crate::operation::transact_write_items::TransactWriteItemsInput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct TransactWriteItemsInputBuilder {
70    pub(crate) transact_items: ::std::option::Option<::std::vec::Vec<crate::types::TransactWriteItem>>,
71    pub(crate) return_consumed_capacity: ::std::option::Option<crate::types::ReturnConsumedCapacity>,
72    pub(crate) return_item_collection_metrics: ::std::option::Option<crate::types::ReturnItemCollectionMetrics>,
73    pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
74}
75impl TransactWriteItemsInputBuilder {
76    /// Appends an item to `transact_items`.
77    ///
78    /// To override the contents of this collection use [`set_transact_items`](Self::set_transact_items).
79    ///
80    /// <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>
81    pub fn transact_items(mut self, input: crate::types::TransactWriteItem) -> Self {
82        let mut v = self.transact_items.unwrap_or_default();
83        v.push(input);
84        self.transact_items = ::std::option::Option::Some(v);
85        self
86    }
87    /// <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>
88    pub fn set_transact_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TransactWriteItem>>) -> Self {
89        self.transact_items = input;
90        self
91    }
92    /// <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>
93    pub fn get_transact_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TransactWriteItem>> {
94        &self.transact_items
95    }
96    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
97    /// <ul>
98    /// <li>
99    /// <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>
100    /// <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>
101    /// <li>
102    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
103    /// <li>
104    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
105    /// </ul>
106    pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
107        self.return_consumed_capacity = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
111    /// <ul>
112    /// <li>
113    /// <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>
114    /// <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>
115    /// <li>
116    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
117    /// <li>
118    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
119    /// </ul>
120    pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
121        self.return_consumed_capacity = input;
122        self
123    }
124    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
125    /// <ul>
126    /// <li>
127    /// <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>
128    /// <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>
129    /// <li>
130    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
131    /// <li>
132    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
133    /// </ul>
134    pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
135        &self.return_consumed_capacity
136    }
137    /// <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>
138    pub fn return_item_collection_metrics(mut self, input: crate::types::ReturnItemCollectionMetrics) -> Self {
139        self.return_item_collection_metrics = ::std::option::Option::Some(input);
140        self
141    }
142    /// <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>
143    pub fn set_return_item_collection_metrics(mut self, input: ::std::option::Option<crate::types::ReturnItemCollectionMetrics>) -> Self {
144        self.return_item_collection_metrics = input;
145        self
146    }
147    /// <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>
148    pub fn get_return_item_collection_metrics(&self) -> &::std::option::Option<crate::types::ReturnItemCollectionMetrics> {
149        &self.return_item_collection_metrics
150    }
151    /// <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>
152    /// <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>
153    /// <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>
154    /// <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>
155    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.client_request_token = ::std::option::Option::Some(input.into());
157        self
158    }
159    /// <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>
160    /// <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>
161    /// <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>
162    /// <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>
163    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
164        self.client_request_token = input;
165        self
166    }
167    /// <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>
168    /// <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>
169    /// <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>
170    /// <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>
171    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
172        &self.client_request_token
173    }
174    /// Consumes the builder and constructs a [`TransactWriteItemsInput`](crate::operation::transact_write_items::TransactWriteItemsInput).
175    pub fn build(
176        self,
177    ) -> ::std::result::Result<crate::operation::transact_write_items::TransactWriteItemsInput, ::aws_smithy_types::error::operation::BuildError>
178    {
179        ::std::result::Result::Ok(crate::operation::transact_write_items::TransactWriteItemsInput {
180            transact_items: self.transact_items,
181            return_consumed_capacity: self.return_consumed_capacity,
182            return_item_collection_metrics: self.return_item_collection_metrics,
183            client_request_token: self.client_request_token,
184        })
185    }
186}