aws_sdk_dynamodb/operation/batch_get_item/_batch_get_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>BatchGetItem</code> operation.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct BatchGetItemOutput {
7 /// <p>A map of table name or table ARN to a list of items. Each object in <code>Responses</code> consists of a table name or ARN, along with a map of attribute data consisting of the data type and attribute value.</p>
8 pub responses: ::std::option::Option<
9 ::std::collections::HashMap<
10 ::std::string::String,
11 ::std::vec::Vec<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
12 >,
13 >,
14 /// <p>A map of tables and their respective keys that were not processed with the current response. The <code>UnprocessedKeys</code> value is in the same form as <code>RequestItems</code>, so the value can be provided directly to a subsequent <code>BatchGetItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
15 /// <p>Each element consists of:</p>
16 /// <ul>
17 /// <li>
18 /// <p><code>Keys</code> - An array of primary key attribute values that define specific items in the table.</p></li>
19 /// <li>
20 /// <p><code>ProjectionExpression</code> - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a requested attribute is not found, it does not appear in the result.</p></li>
21 /// <li>
22 /// <p><code>ConsistentRead</code> - The consistency of a read operation. If set to <code>true</code>, then a strongly consistent read is used; otherwise, an eventually consistent read is used.</p></li>
23 /// </ul>
24 /// <p>If there are no unprocessed keys remaining, the response contains an empty <code>UnprocessedKeys</code> map.</p>
25 pub unprocessed_keys: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::KeysAndAttributes>>,
26 /// <p>The read capacity units consumed by the entire <code>BatchGetItem</code> operation.</p>
27 /// <p>Each element consists of:</p>
28 /// <ul>
29 /// <li>
30 /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
31 /// <li>
32 /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
33 /// </ul>
34 pub consumed_capacity: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
35 _request_id: Option<String>,
36}
37impl BatchGetItemOutput {
38 /// <p>A map of table name or table ARN to a list of items. Each object in <code>Responses</code> consists of a table name or ARN, along with a map of attribute data consisting of the data type and attribute value.</p>
39 pub fn responses(
40 &self,
41 ) -> ::std::option::Option<
42 &::std::collections::HashMap<
43 ::std::string::String,
44 ::std::vec::Vec<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
45 >,
46 > {
47 self.responses.as_ref()
48 }
49 /// <p>A map of tables and their respective keys that were not processed with the current response. The <code>UnprocessedKeys</code> value is in the same form as <code>RequestItems</code>, so the value can be provided directly to a subsequent <code>BatchGetItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
50 /// <p>Each element consists of:</p>
51 /// <ul>
52 /// <li>
53 /// <p><code>Keys</code> - An array of primary key attribute values that define specific items in the table.</p></li>
54 /// <li>
55 /// <p><code>ProjectionExpression</code> - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a requested attribute is not found, it does not appear in the result.</p></li>
56 /// <li>
57 /// <p><code>ConsistentRead</code> - The consistency of a read operation. If set to <code>true</code>, then a strongly consistent read is used; otherwise, an eventually consistent read is used.</p></li>
58 /// </ul>
59 /// <p>If there are no unprocessed keys remaining, the response contains an empty <code>UnprocessedKeys</code> map.</p>
60 pub fn unprocessed_keys(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::KeysAndAttributes>> {
61 self.unprocessed_keys.as_ref()
62 }
63 /// <p>The read capacity units consumed by the entire <code>BatchGetItem</code> operation.</p>
64 /// <p>Each element consists of:</p>
65 /// <ul>
66 /// <li>
67 /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
68 /// <li>
69 /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
70 /// </ul>
71 ///
72 /// 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()`.
73 pub fn consumed_capacity(&self) -> &[crate::types::ConsumedCapacity] {
74 self.consumed_capacity.as_deref().unwrap_or_default()
75 }
76}
77impl ::aws_types::request_id::RequestId for BatchGetItemOutput {
78 fn request_id(&self) -> Option<&str> {
79 self._request_id.as_deref()
80 }
81}
82impl BatchGetItemOutput {
83 /// Creates a new builder-style object to manufacture [`BatchGetItemOutput`](crate::operation::batch_get_item::BatchGetItemOutput).
84 pub fn builder() -> crate::operation::batch_get_item::builders::BatchGetItemOutputBuilder {
85 crate::operation::batch_get_item::builders::BatchGetItemOutputBuilder::default()
86 }
87}
88
89/// A builder for [`BatchGetItemOutput`](crate::operation::batch_get_item::BatchGetItemOutput).
90#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
91#[non_exhaustive]
92pub struct BatchGetItemOutputBuilder {
93 pub(crate) responses: ::std::option::Option<
94 ::std::collections::HashMap<
95 ::std::string::String,
96 ::std::vec::Vec<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
97 >,
98 >,
99 pub(crate) unprocessed_keys: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::KeysAndAttributes>>,
100 pub(crate) consumed_capacity: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>,
101 _request_id: Option<String>,
102}
103impl BatchGetItemOutputBuilder {
104 /// Adds a key-value pair to `responses`.
105 ///
106 /// To override the contents of this collection use [`set_responses`](Self::set_responses).
107 ///
108 /// <p>A map of table name or table ARN to a list of items. Each object in <code>Responses</code> consists of a table name or ARN, along with a map of attribute data consisting of the data type and attribute value.</p>
109 pub fn responses(
110 mut self,
111 k: impl ::std::convert::Into<::std::string::String>,
112 v: ::std::vec::Vec<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
113 ) -> Self {
114 let mut hash_map = self.responses.unwrap_or_default();
115 hash_map.insert(k.into(), v);
116 self.responses = ::std::option::Option::Some(hash_map);
117 self
118 }
119 /// <p>A map of table name or table ARN to a list of items. Each object in <code>Responses</code> consists of a table name or ARN, along with a map of attribute data consisting of the data type and attribute value.</p>
120 pub fn set_responses(
121 mut self,
122 input: ::std::option::Option<
123 ::std::collections::HashMap<
124 ::std::string::String,
125 ::std::vec::Vec<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
126 >,
127 >,
128 ) -> Self {
129 self.responses = input;
130 self
131 }
132 /// <p>A map of table name or table ARN to a list of items. Each object in <code>Responses</code> consists of a table name or ARN, along with a map of attribute data consisting of the data type and attribute value.</p>
133 pub fn get_responses(
134 &self,
135 ) -> &::std::option::Option<
136 ::std::collections::HashMap<
137 ::std::string::String,
138 ::std::vec::Vec<::std::collections::HashMap<::std::string::String, crate::types::AttributeValue>>,
139 >,
140 > {
141 &self.responses
142 }
143 /// Adds a key-value pair to `unprocessed_keys`.
144 ///
145 /// To override the contents of this collection use [`set_unprocessed_keys`](Self::set_unprocessed_keys).
146 ///
147 /// <p>A map of tables and their respective keys that were not processed with the current response. The <code>UnprocessedKeys</code> value is in the same form as <code>RequestItems</code>, so the value can be provided directly to a subsequent <code>BatchGetItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
148 /// <p>Each element consists of:</p>
149 /// <ul>
150 /// <li>
151 /// <p><code>Keys</code> - An array of primary key attribute values that define specific items in the table.</p></li>
152 /// <li>
153 /// <p><code>ProjectionExpression</code> - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a requested attribute is not found, it does not appear in the result.</p></li>
154 /// <li>
155 /// <p><code>ConsistentRead</code> - The consistency of a read operation. If set to <code>true</code>, then a strongly consistent read is used; otherwise, an eventually consistent read is used.</p></li>
156 /// </ul>
157 /// <p>If there are no unprocessed keys remaining, the response contains an empty <code>UnprocessedKeys</code> map.</p>
158 pub fn unprocessed_keys(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::KeysAndAttributes) -> Self {
159 let mut hash_map = self.unprocessed_keys.unwrap_or_default();
160 hash_map.insert(k.into(), v);
161 self.unprocessed_keys = ::std::option::Option::Some(hash_map);
162 self
163 }
164 /// <p>A map of tables and their respective keys that were not processed with the current response. The <code>UnprocessedKeys</code> value is in the same form as <code>RequestItems</code>, so the value can be provided directly to a subsequent <code>BatchGetItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
165 /// <p>Each element consists of:</p>
166 /// <ul>
167 /// <li>
168 /// <p><code>Keys</code> - An array of primary key attribute values that define specific items in the table.</p></li>
169 /// <li>
170 /// <p><code>ProjectionExpression</code> - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a requested attribute is not found, it does not appear in the result.</p></li>
171 /// <li>
172 /// <p><code>ConsistentRead</code> - The consistency of a read operation. If set to <code>true</code>, then a strongly consistent read is used; otherwise, an eventually consistent read is used.</p></li>
173 /// </ul>
174 /// <p>If there are no unprocessed keys remaining, the response contains an empty <code>UnprocessedKeys</code> map.</p>
175 pub fn set_unprocessed_keys(
176 mut self,
177 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::KeysAndAttributes>>,
178 ) -> Self {
179 self.unprocessed_keys = input;
180 self
181 }
182 /// <p>A map of tables and their respective keys that were not processed with the current response. The <code>UnprocessedKeys</code> value is in the same form as <code>RequestItems</code>, so the value can be provided directly to a subsequent <code>BatchGetItem</code> operation. For more information, see <code>RequestItems</code> in the Request Parameters section.</p>
183 /// <p>Each element consists of:</p>
184 /// <ul>
185 /// <li>
186 /// <p><code>Keys</code> - An array of primary key attribute values that define specific items in the table.</p></li>
187 /// <li>
188 /// <p><code>ProjectionExpression</code> - One or more attributes to be retrieved from the table or index. By default, all attributes are returned. If a requested attribute is not found, it does not appear in the result.</p></li>
189 /// <li>
190 /// <p><code>ConsistentRead</code> - The consistency of a read operation. If set to <code>true</code>, then a strongly consistent read is used; otherwise, an eventually consistent read is used.</p></li>
191 /// </ul>
192 /// <p>If there are no unprocessed keys remaining, the response contains an empty <code>UnprocessedKeys</code> map.</p>
193 pub fn get_unprocessed_keys(
194 &self,
195 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::KeysAndAttributes>> {
196 &self.unprocessed_keys
197 }
198 /// Appends an item to `consumed_capacity`.
199 ///
200 /// To override the contents of this collection use [`set_consumed_capacity`](Self::set_consumed_capacity).
201 ///
202 /// <p>The read capacity units consumed by the entire <code>BatchGetItem</code> operation.</p>
203 /// <p>Each element consists of:</p>
204 /// <ul>
205 /// <li>
206 /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
207 /// <li>
208 /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
209 /// </ul>
210 pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
211 let mut v = self.consumed_capacity.unwrap_or_default();
212 v.push(input);
213 self.consumed_capacity = ::std::option::Option::Some(v);
214 self
215 }
216 /// <p>The read capacity units consumed by the entire <code>BatchGetItem</code> operation.</p>
217 /// <p>Each element consists of:</p>
218 /// <ul>
219 /// <li>
220 /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
221 /// <li>
222 /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
223 /// </ul>
224 pub fn set_consumed_capacity(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>>) -> Self {
225 self.consumed_capacity = input;
226 self
227 }
228 /// <p>The read capacity units consumed by the entire <code>BatchGetItem</code> operation.</p>
229 /// <p>Each element consists of:</p>
230 /// <ul>
231 /// <li>
232 /// <p><code>TableName</code> - The table that consumed the provisioned throughput.</p></li>
233 /// <li>
234 /// <p><code>CapacityUnits</code> - The total number of capacity units consumed.</p></li>
235 /// </ul>
236 pub fn get_consumed_capacity(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ConsumedCapacity>> {
237 &self.consumed_capacity
238 }
239 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
240 self._request_id = Some(request_id.into());
241 self
242 }
243
244 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
245 self._request_id = request_id;
246 self
247 }
248 /// Consumes the builder and constructs a [`BatchGetItemOutput`](crate::operation::batch_get_item::BatchGetItemOutput).
249 pub fn build(self) -> crate::operation::batch_get_item::BatchGetItemOutput {
250 crate::operation::batch_get_item::BatchGetItemOutput {
251 responses: self.responses,
252 unprocessed_keys: self.unprocessed_keys,
253 consumed_capacity: self.consumed_capacity,
254 _request_id: self._request_id,
255 }
256 }
257}