1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Represents the output of a <code>BatchWriteItem</code> operation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct BatchWriteItemOutput {
    /// <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>
    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
    /// <ul>
    /// <li> <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>
    /// <ul>
    /// <li> <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>
    /// </ul> </li>
    /// <li> <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>
    /// <ul>
    /// <li> <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> <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>
    /// </ul> </li>
    /// </ul>
    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
    #[doc(hidden)]
    pub unprocessed_items: ::std::option::Option<
        ::std::collections::HashMap<
            ::std::string::String,
            ::std::vec::Vec<crate::types::WriteRequest>,
        >,
    >,
    /// <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>
    /// <p>Each entry consists of the following subelements:</p>
    /// <ul>
    /// <li> <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>
    /// <li> <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> <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p> </li>
    /// </ul>
    #[doc(hidden)]
    pub item_collection_metrics: ::std::option::Option<
        ::std::collections::HashMap<
            ::std::string::String,
            ::std::vec::Vec<crate::types::ItemCollectionMetrics>,
        >,
    >,
    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
    /// <p>Each element consists of:</p>
    /// <ul>
    /// <li> <p> <code>TableName</code> - The table that consumed the provisioned throughput.</p> </li>
    /// <li> <p> <code>CapacityUnits</code> - The total number of capacity units consumed.</p> </li>
    /// </ul>
    #[doc(hidden)]
    pub consumed_capacity: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
    _request_id: Option<String>,
}
impl BatchWriteItemOutput {
    /// <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>
    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
    /// <ul>
    /// <li> <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>
    /// <ul>
    /// <li> <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>
    /// </ul> </li>
    /// <li> <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>
    /// <ul>
    /// <li> <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> <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>
    /// </ul> </li>
    /// </ul>
    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
    pub fn unprocessed_items(
        &self,
    ) -> ::std::option::Option<
        &::std::collections::HashMap<
            ::std::string::String,
            ::std::vec::Vec<crate::types::WriteRequest>,
        >,
    > {
        self.unprocessed_items.as_ref()
    }
    /// <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>
    /// <p>Each entry consists of the following subelements:</p>
    /// <ul>
    /// <li> <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>
    /// <li> <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> <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p> </li>
    /// </ul>
    pub fn item_collection_metrics(
        &self,
    ) -> ::std::option::Option<
        &::std::collections::HashMap<
            ::std::string::String,
            ::std::vec::Vec<crate::types::ItemCollectionMetrics>,
        >,
    > {
        self.item_collection_metrics.as_ref()
    }
    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
    /// <p>Each element consists of:</p>
    /// <ul>
    /// <li> <p> <code>TableName</code> - The table that consumed the provisioned throughput.</p> </li>
    /// <li> <p> <code>CapacityUnits</code> - The total number of capacity units consumed.</p> </li>
    /// </ul>
    pub fn consumed_capacity(&self) -> ::std::option::Option<&[crate::types::ConsumedCapacity]> {
        self.consumed_capacity.as_deref()
    }
}
impl ::aws_http::request_id::RequestId for BatchWriteItemOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl BatchWriteItemOutput {
    /// Creates a new builder-style object to manufacture [`BatchWriteItemOutput`](crate::operation::batch_write_item::BatchWriteItemOutput).
    pub fn builder() -> crate::operation::batch_write_item::builders::BatchWriteItemOutputBuilder {
        crate::operation::batch_write_item::builders::BatchWriteItemOutputBuilder::default()
    }
}

/// A builder for [`BatchWriteItemOutput`](crate::operation::batch_write_item::BatchWriteItemOutput).
#[non_exhaustive]
#[derive(
    ::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug,
)]
pub struct BatchWriteItemOutputBuilder {
    pub(crate) unprocessed_items: ::std::option::Option<
        ::std::collections::HashMap<
            ::std::string::String,
            ::std::vec::Vec<crate::types::WriteRequest>,
        >,
    >,
    pub(crate) item_collection_metrics: ::std::option::Option<
        ::std::collections::HashMap<
            ::std::string::String,
            ::std::vec::Vec<crate::types::ItemCollectionMetrics>,
        >,
    >,
    pub(crate) consumed_capacity:
        ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
    _request_id: Option<String>,
}
impl BatchWriteItemOutputBuilder {
    /// Adds a key-value pair to `unprocessed_items`.
    ///
    /// To override the contents of this collection use [`set_unprocessed_items`](Self::set_unprocessed_items).
    ///
    /// <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>
    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
    /// <ul>
    /// <li> <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>
    /// <ul>
    /// <li> <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>
    /// </ul> </li>
    /// <li> <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>
    /// <ul>
    /// <li> <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> <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>
    /// </ul> </li>
    /// </ul>
    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
    pub fn unprocessed_items(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: ::std::vec::Vec<crate::types::WriteRequest>,
    ) -> Self {
        let mut hash_map = self.unprocessed_items.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.unprocessed_items = ::std::option::Option::Some(hash_map);
        self
    }
    /// <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>
    /// <p>Each <code>UnprocessedItems</code> entry consists of a table name and, for that table, a list of operations to perform (<code>DeleteRequest</code> or <code>PutRequest</code>).</p>
    /// <ul>
    /// <li> <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>
    /// <ul>
    /// <li> <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>
    /// </ul> </li>
    /// <li> <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>
    /// <ul>
    /// <li> <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> <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>
    /// </ul> </li>
    /// </ul>
    /// <p>If there are no unprocessed items remaining, the response contains an empty <code>UnprocessedItems</code> map.</p>
    pub fn set_unprocessed_items(
        mut self,
        input: ::std::option::Option<
            ::std::collections::HashMap<
                ::std::string::String,
                ::std::vec::Vec<crate::types::WriteRequest>,
            >,
        >,
    ) -> Self {
        self.unprocessed_items = input;
        self
    }
    /// Adds a key-value pair to `item_collection_metrics`.
    ///
    /// To override the contents of this collection use [`set_item_collection_metrics`](Self::set_item_collection_metrics).
    ///
    /// <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>
    /// <p>Each entry consists of the following subelements:</p>
    /// <ul>
    /// <li> <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>
    /// <li> <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> <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p> </li>
    /// </ul>
    pub fn item_collection_metrics(
        mut self,
        k: impl ::std::convert::Into<::std::string::String>,
        v: ::std::vec::Vec<crate::types::ItemCollectionMetrics>,
    ) -> Self {
        let mut hash_map = self.item_collection_metrics.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.item_collection_metrics = ::std::option::Option::Some(hash_map);
        self
    }
    /// <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>
    /// <p>Each entry consists of the following subelements:</p>
    /// <ul>
    /// <li> <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>
    /// <li> <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> <p>The estimate is subject to change over time; therefore, do not rely on the precision or accuracy of the estimate.</p> </li>
    /// </ul>
    pub fn set_item_collection_metrics(
        mut self,
        input: ::std::option::Option<
            ::std::collections::HashMap<
                ::std::string::String,
                ::std::vec::Vec<crate::types::ItemCollectionMetrics>,
            >,
        >,
    ) -> Self {
        self.item_collection_metrics = input;
        self
    }
    /// Appends an item to `consumed_capacity`.
    ///
    /// To override the contents of this collection use [`set_consumed_capacity`](Self::set_consumed_capacity).
    ///
    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
    /// <p>Each element consists of:</p>
    /// <ul>
    /// <li> <p> <code>TableName</code> - The table that consumed the provisioned throughput.</p> </li>
    /// <li> <p> <code>CapacityUnits</code> - The total number of capacity units consumed.</p> </li>
    /// </ul>
    pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
        let mut v = self.consumed_capacity.unwrap_or_default();
        v.push(input);
        self.consumed_capacity = ::std::option::Option::Some(v);
        self
    }
    /// <p>The capacity units consumed by the entire <code>BatchWriteItem</code> operation.</p>
    /// <p>Each element consists of:</p>
    /// <ul>
    /// <li> <p> <code>TableName</code> - The table that consumed the provisioned throughput.</p> </li>
    /// <li> <p> <code>CapacityUnits</code> - The total number of capacity units consumed.</p> </li>
    /// </ul>
    pub fn set_consumed_capacity(
        mut self,
        input: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
    ) -> Self {
        self.consumed_capacity = input;
        self
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`BatchWriteItemOutput`](crate::operation::batch_write_item::BatchWriteItemOutput).
    pub fn build(self) -> crate::operation::batch_write_item::BatchWriteItemOutput {
        crate::operation::batch_write_item::BatchWriteItemOutput {
            unprocessed_items: self.unprocessed_items,
            item_collection_metrics: self.item_collection_metrics,
            consumed_capacity: self.consumed_capacity,
            _request_id: self._request_id,
        }
    }
}