aws_sdk_dynamodb/operation/batch_write_item/
_batch_write_item_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the output of a <code>BatchWriteItem</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct BatchWriteItemOutput {
7    /// <p>A map of tables and requests against those tables that were not processed. The <code>UnprocessedItems</code> value is in the same form as <code>RequestItems</code>, so you can provide this value directly to a subsequent <code>BatchWriteItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
8    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name or table ARN and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
9    /// <ul>
10    /// <li>
11    /// <p><code>DeleteRequest</code> - Perform a <code>DeleteItem</code> operation on the specified item. The item to be deleted is identified by a <code>Key</code> subelement:</p>
12    /// <ul>
13    /// <li>
14    /// <p><code>Key</code> - A map of primary key attribute values that uniquely identify the item. Each entry in this map consists of an attribute name and an attribute value.</p></li>
15    /// </ul></li>
16    /// <li>
17    /// <p><code>PutRequest</code> - Perform a <code>PutItem</code> operation on the specified item. The item to be put is identified by an <code>Item</code> subelement:</p>
18    /// <ul>
19    /// <li>
20    /// <p><code>Item</code> - A map of attributes and their values. Each entry in this map consists of an attribute name and an attribute value. Attribute values must not be null; string and binary type attributes must have lengths greater than zero; and set type attributes must not be empty. Requests that contain empty values will be rejected with a <code>ValidationException</code> exception.</p>
21    /// <p>If you specify any attributes that are part of an index key, then the data types for those attributes must match those of the schema in the table's attribute definition.</p></li>
22    /// </ul></li>
23    /// </ul>
24    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
25    pub unprocessed_items: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::WriteRequest>>>,
26    /// <p>A list of tables that were processed by <code>BatchWriteItem</code> and, for each table, information about any item collections that were affected by individual <code>DeleteItem</code> or <code>PutItem</code> operations.</p>
27    /// <p>Each entry consists of the following subelements:</p>
28    /// <ul>
29    /// <li>
30    /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item.</p></li>
31    /// <li>
32    /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, expressed in GB. This is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on the table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
33    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
34    /// </ul>
35    pub item_collection_metrics:
36        ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::ItemCollectionMetrics>>>,
37    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
38    /// <p>Each element consists of:</p>
39    /// <ul>
40    /// <li>
41    /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
42    /// <li>
43    /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
44    /// </ul>
45    pub consumed_capacity: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
46    _request_id: Option<String>,
47}
48impl BatchWriteItemOutput {
49    /// <p>A map of tables and requests against those tables that were not processed. The <code>UnprocessedItems</code> value is in the same form as <code>RequestItems</code>, so you can provide this value directly to a subsequent <code>BatchWriteItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
50    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name or table ARN and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
51    /// <ul>
52    /// <li>
53    /// <p><code>DeleteRequest</code> - Perform a <code>DeleteItem</code> operation on the specified item. The item to be deleted is identified by a <code>Key</code> subelement:</p>
54    /// <ul>
55    /// <li>
56    /// <p><code>Key</code> - A map of primary key attribute values that uniquely identify the item. Each entry in this map consists of an attribute name and an attribute value.</p></li>
57    /// </ul></li>
58    /// <li>
59    /// <p><code>PutRequest</code> - Perform a <code>PutItem</code> operation on the specified item. The item to be put is identified by an <code>Item</code> subelement:</p>
60    /// <ul>
61    /// <li>
62    /// <p><code>Item</code> - A map of attributes and their values. Each entry in this map consists of an attribute name and an attribute value. Attribute values must not be null; string and binary type attributes must have lengths greater than zero; and set type attributes must not be empty. Requests that contain empty values will be rejected with a <code>ValidationException</code> exception.</p>
63    /// <p>If you specify any attributes that are part of an index key, then the data types for those attributes must match those of the schema in the table's attribute definition.</p></li>
64    /// </ul></li>
65    /// </ul>
66    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
67    pub fn unprocessed_items(
68        &self,
69    ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::WriteRequest>>> {
70        self.unprocessed_items.as_ref()
71    }
72    /// <p>A list of tables that were processed by <code>BatchWriteItem</code> and, for each table, information about any item collections that were affected by individual <code>DeleteItem</code> or <code>PutItem</code> operations.</p>
73    /// <p>Each entry consists of the following subelements:</p>
74    /// <ul>
75    /// <li>
76    /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item.</p></li>
77    /// <li>
78    /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, expressed in GB. This is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on the table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
79    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
80    /// </ul>
81    pub fn item_collection_metrics(
82        &self,
83    ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::ItemCollectionMetrics>>> {
84        self.item_collection_metrics.as_ref()
85    }
86    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
87    /// <p>Each element consists of:</p>
88    /// <ul>
89    /// <li>
90    /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
91    /// <li>
92    /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
93    /// </ul>
94    ///
95    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.consumed_capacity.is_none()`.
96    pub fn consumed_capacity(&self) -> &[crate::types::ConsumedCapacity] {
97        self.consumed_capacity.as_deref().unwrap_or_default()
98    }
99}
100impl ::aws_types::request_id::RequestId for BatchWriteItemOutput {
101    fn request_id(&self) -> Option<&str> {
102        self._request_id.as_deref()
103    }
104}
105impl BatchWriteItemOutput {
106    /// Creates a new builder-style object to manufacture [`BatchWriteItemOutput`](crate::operation::batch_write_item::BatchWriteItemOutput).
107    pub fn builder() -> crate::operation::batch_write_item::builders::BatchWriteItemOutputBuilder {
108        crate::operation::batch_write_item::builders::BatchWriteItemOutputBuilder::default()
109    }
110}
111
112/// A builder for [`BatchWriteItemOutput`](crate::operation::batch_write_item::BatchWriteItemOutput).
113#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
114#[non_exhaustive]
115pub struct BatchWriteItemOutputBuilder {
116    pub(crate) unprocessed_items:
117        ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::WriteRequest>>>,
118    pub(crate) item_collection_metrics:
119        ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::ItemCollectionMetrics>>>,
120    pub(crate) consumed_capacity: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
121    _request_id: Option<String>,
122}
123impl BatchWriteItemOutputBuilder {
124    /// Adds a key-value pair to `unprocessed_items`.
125    ///
126    /// To override the contents of this collection use [`set_unprocessed_items`](Self::set_unprocessed_items).
127    ///
128    /// <p>A map of tables and requests against those tables that were not processed. The <code>UnprocessedItems</code> value is in the same form as <code>RequestItems</code>, so you can provide this value directly to a subsequent <code>BatchWriteItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
129    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name or table ARN and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
130    /// <ul>
131    /// <li>
132    /// <p><code>DeleteRequest</code> - Perform a <code>DeleteItem</code> operation on the specified item. The item to be deleted is identified by a <code>Key</code> subelement:</p>
133    /// <ul>
134    /// <li>
135    /// <p><code>Key</code> - A map of primary key attribute values that uniquely identify the item. Each entry in this map consists of an attribute name and an attribute value.</p></li>
136    /// </ul></li>
137    /// <li>
138    /// <p><code>PutRequest</code> - Perform a <code>PutItem</code> operation on the specified item. The item to be put is identified by an <code>Item</code> subelement:</p>
139    /// <ul>
140    /// <li>
141    /// <p><code>Item</code> - A map of attributes and their values. Each entry in this map consists of an attribute name and an attribute value. Attribute values must not be null; string and binary type attributes must have lengths greater than zero; and set type attributes must not be empty. Requests that contain empty values will be rejected with a <code>ValidationException</code> exception.</p>
142    /// <p>If you specify any attributes that are part of an index key, then the data types for those attributes must match those of the schema in the table's attribute definition.</p></li>
143    /// </ul></li>
144    /// </ul>
145    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
146    pub fn unprocessed_items(mut self, k: impl ::std::convert::Into<::std::string::String>, v: ::std::vec::Vec<crate::types::WriteRequest>) -> Self {
147        let mut hash_map = self.unprocessed_items.unwrap_or_default();
148        hash_map.insert(k.into(), v);
149        self.unprocessed_items = ::std::option::Option::Some(hash_map);
150        self
151    }
152    /// <p>A map of tables and requests against those tables that were not processed. The <code>UnprocessedItems</code> value is in the same form as <code>RequestItems</code>, so you can provide this value directly to a subsequent <code>BatchWriteItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
153    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name or table ARN and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
154    /// <ul>
155    /// <li>
156    /// <p><code>DeleteRequest</code> - Perform a <code>DeleteItem</code> operation on the specified item. The item to be deleted is identified by a <code>Key</code> subelement:</p>
157    /// <ul>
158    /// <li>
159    /// <p><code>Key</code> - A map of primary key attribute values that uniquely identify the item. Each entry in this map consists of an attribute name and an attribute value.</p></li>
160    /// </ul></li>
161    /// <li>
162    /// <p><code>PutRequest</code> - Perform a <code>PutItem</code> operation on the specified item. The item to be put is identified by an <code>Item</code> subelement:</p>
163    /// <ul>
164    /// <li>
165    /// <p><code>Item</code> - A map of attributes and their values. Each entry in this map consists of an attribute name and an attribute value. Attribute values must not be null; string and binary type attributes must have lengths greater than zero; and set type attributes must not be empty. Requests that contain empty values will be rejected with a <code>ValidationException</code> exception.</p>
166    /// <p>If you specify any attributes that are part of an index key, then the data types for those attributes must match those of the schema in the table's attribute definition.</p></li>
167    /// </ul></li>
168    /// </ul>
169    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
170    pub fn set_unprocessed_items(
171        mut self,
172        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::WriteRequest>>>,
173    ) -> Self {
174        self.unprocessed_items = input;
175        self
176    }
177    /// <p>A map of tables and requests against those tables that were not processed. The <code>UnprocessedItems</code> value is in the same form as <code>RequestItems</code>, so you can provide this value directly to a subsequent <code>BatchWriteItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
178    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name or table ARN and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
179    /// <ul>
180    /// <li>
181    /// <p><code>DeleteRequest</code> - Perform a <code>DeleteItem</code> operation on the specified item. The item to be deleted is identified by a <code>Key</code> subelement:</p>
182    /// <ul>
183    /// <li>
184    /// <p><code>Key</code> - A map of primary key attribute values that uniquely identify the item. Each entry in this map consists of an attribute name and an attribute value.</p></li>
185    /// </ul></li>
186    /// <li>
187    /// <p><code>PutRequest</code> - Perform a <code>PutItem</code> operation on the specified item. The item to be put is identified by an <code>Item</code> subelement:</p>
188    /// <ul>
189    /// <li>
190    /// <p><code>Item</code> - A map of attributes and their values. Each entry in this map consists of an attribute name and an attribute value. Attribute values must not be null; string and binary type attributes must have lengths greater than zero; and set type attributes must not be empty. Requests that contain empty values will be rejected with a <code>ValidationException</code> exception.</p>
191    /// <p>If you specify any attributes that are part of an index key, then the data types for those attributes must match those of the schema in the table's attribute definition.</p></li>
192    /// </ul></li>
193    /// </ul>
194    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
195    pub fn get_unprocessed_items(
196        &self,
197    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::WriteRequest>>> {
198        &self.unprocessed_items
199    }
200    /// Adds a key-value pair to `item_collection_metrics`.
201    ///
202    /// To override the contents of this collection use [`set_item_collection_metrics`](Self::set_item_collection_metrics).
203    ///
204    /// <p>A list of tables that were processed by <code>BatchWriteItem</code> and, for each table, information about any item collections that were affected by individual <code>DeleteItem</code> or <code>PutItem</code> operations.</p>
205    /// <p>Each entry consists of the following subelements:</p>
206    /// <ul>
207    /// <li>
208    /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item.</p></li>
209    /// <li>
210    /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, expressed in GB. This is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on the table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
211    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
212    /// </ul>
213    pub fn item_collection_metrics(
214        mut self,
215        k: impl ::std::convert::Into<::std::string::String>,
216        v: ::std::vec::Vec<crate::types::ItemCollectionMetrics>,
217    ) -> Self {
218        let mut hash_map = self.item_collection_metrics.unwrap_or_default();
219        hash_map.insert(k.into(), v);
220        self.item_collection_metrics = ::std::option::Option::Some(hash_map);
221        self
222    }
223    /// <p>A list of tables that were processed by <code>BatchWriteItem</code> and, for each table, information about any item collections that were affected by individual <code>DeleteItem</code> or <code>PutItem</code> operations.</p>
224    /// <p>Each entry consists of the following subelements:</p>
225    /// <ul>
226    /// <li>
227    /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item.</p></li>
228    /// <li>
229    /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, expressed in GB. This is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on the table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
230    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
231    /// </ul>
232    pub fn set_item_collection_metrics(
233        mut self,
234        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::ItemCollectionMetrics>>>,
235    ) -> Self {
236        self.item_collection_metrics = input;
237        self
238    }
239    /// <p>A list of tables that were processed by <code>BatchWriteItem</code> and, for each table, information about any item collections that were affected by individual <code>DeleteItem</code> or <code>PutItem</code> operations.</p>
240    /// <p>Each entry consists of the following subelements:</p>
241    /// <ul>
242    /// <li>
243    /// <p><code>ItemCollectionKey</code> - The partition key value of the item collection. This is the same as the partition key value of the item.</p></li>
244    /// <li>
245    /// <p><code>SizeEstimateRangeGB</code> - An estimate of item collection size, expressed in GB. This is a two-element array containing a lower bound and an upper bound for the estimate. The estimate includes the size of all the items in the table, plus the size of all attributes projected into all of the local secondary indexes on the table. Use this estimate to measure whether a local secondary index is approaching its size limit.</p>
246    /// <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p></li>
247    /// </ul>
248    pub fn get_item_collection_metrics(
249        &self,
250    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::ItemCollectionMetrics>>> {
251        &self.item_collection_metrics
252    }
253    /// Appends an item to `consumed_capacity`.
254    ///
255    /// To override the contents of this collection use [`set_consumed_capacity`](Self::set_consumed_capacity).
256    ///
257    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
258    /// <p>Each element consists of:</p>
259    /// <ul>
260    /// <li>
261    /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
262    /// <li>
263    /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
264    /// </ul>
265    pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
266        let mut v = self.consumed_capacity.unwrap_or_default();
267        v.push(input);
268        self.consumed_capacity = ::std::option::Option::Some(v);
269        self
270    }
271    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
272    /// <p>Each element consists of:</p>
273    /// <ul>
274    /// <li>
275    /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
276    /// <li>
277    /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
278    /// </ul>
279    pub fn set_consumed_capacity(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>) -> Self {
280        self.consumed_capacity = input;
281        self
282    }
283    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
284    /// <p>Each element consists of:</p>
285    /// <ul>
286    /// <li>
287    /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
288    /// <li>
289    /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
290    /// </ul>
291    pub fn get_consumed_capacity(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>> {
292        &self.consumed_capacity
293    }
294    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
295        self._request_id = Some(request_id.into());
296        self
297    }
298
299    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
300        self._request_id = request_id;
301        self
302    }
303    /// Consumes the builder and constructs a [`BatchWriteItemOutput`](crate::operation::batch_write_item::BatchWriteItemOutput).
304    pub fn build(self) -> crate::operation::batch_write_item::BatchWriteItemOutput {
305        crate::operation::batch_write_item::BatchWriteItemOutput {
306            unprocessed_items: self.unprocessed_items,
307            item_collection_metrics: self.item_collection_metrics,
308            consumed_capacity: self.consumed_capacity,
309            _request_id: self._request_id,
310        }
311    }
312}