aws_sdk_dynamodb/operation/execute_statement/
_execute_statement_output.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 ExecuteStatementOutput  {
6    /// <p>If a read operation was used, this property will contain the result of the read operation; a map of attribute names and their values. For the write operations this value will be empty.</p>
7    pub items: ::std::option::Option<::std::vec::Vec::<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>>,
8    /// <p>If the response of a read request exceeds the response payload limit DynamoDB will set this value in the response. If set, you can use that this value in the subsequent request to get the remaining results.</p>
9    pub next_token: ::std::option::Option<::std::string::String>,
10    /// <p>The capacity units consumed by an operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the request asked for it. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/provisioned-capacity-mode.html">Provisioned capacity mode</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
11    pub consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
12    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request. If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved. If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
13    pub last_evaluated_key: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
14    _request_id: Option<String>,
15}
16impl  ExecuteStatementOutput  {
17    /// <p>If a read operation was used, this property will contain the result of the read operation; a map of attribute names and their values. For the write operations this value will be empty.</p>
18    /// 
19    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.items.is_none()`.
20    pub fn items(&self) -> &[::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>] {
21        self.items.as_deref()
22        .unwrap_or_default()
23    }
24    /// <p>If the response of a read request exceeds the response payload limit DynamoDB will set this value in the response. If set, you can use that this value in the subsequent request to get the remaining results.</p>
25    pub fn next_token(&self) -> ::std::option::Option<&str> {
26        self.next_token.as_deref()
27    }
28    /// <p>The capacity units consumed by an operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the request asked for it. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/provisioned-capacity-mode.html">Provisioned capacity mode</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
29    pub fn consumed_capacity(&self) -> ::std::option::Option<&crate::types::ConsumedCapacity> {
30        self.consumed_capacity.as_ref()
31    }
32    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request. If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved. If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
33    pub fn last_evaluated_key(&self) -> ::std::option::Option<&::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
34        self.last_evaluated_key.as_ref()
35    }
36}
37static EXECUTESTATEMENTOUTPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb.synthetic#ExecuteStatementOutput", "com.amazonaws.dynamodb.synthetic", "ExecuteStatementOutput");
38static EXECUTESTATEMENTOUTPUT_MEMBER_ITEMS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
39                            ::aws_smithy_schema::ShapeId::from_static(
40                                "com.amazonaws.dynamodb.synthetic#ExecuteStatementOutput$Items",
41                                "com.amazonaws.dynamodb.synthetic",
42                                "ExecuteStatementOutput",
43                            ),
44                            ::aws_smithy_schema::ShapeType::List,
45                            "Items",
46                            0,
47                        );
48static EXECUTESTATEMENTOUTPUT_MEMBER_NEXT_TOKEN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
49                            ::aws_smithy_schema::ShapeId::from_static(
50                                "com.amazonaws.dynamodb.synthetic#ExecuteStatementOutput$NextToken",
51                                "com.amazonaws.dynamodb.synthetic",
52                                "ExecuteStatementOutput",
53                            ),
54                            ::aws_smithy_schema::ShapeType::String,
55                            "NextToken",
56                            1,
57                        );
58static EXECUTESTATEMENTOUTPUT_MEMBER_CONSUMED_CAPACITY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
59                            ::aws_smithy_schema::ShapeId::from_static(
60                                "com.amazonaws.dynamodb.synthetic#ExecuteStatementOutput$ConsumedCapacity",
61                                "com.amazonaws.dynamodb.synthetic",
62                                "ExecuteStatementOutput",
63                            ),
64                            ::aws_smithy_schema::ShapeType::Structure,
65                            "ConsumedCapacity",
66                            2,
67                        );
68static EXECUTESTATEMENTOUTPUT_MEMBER_LAST_EVALUATED_KEY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
69                            ::aws_smithy_schema::ShapeId::from_static(
70                                "com.amazonaws.dynamodb.synthetic#ExecuteStatementOutput$LastEvaluatedKey",
71                                "com.amazonaws.dynamodb.synthetic",
72                                "ExecuteStatementOutput",
73                            ),
74                            ::aws_smithy_schema::ShapeType::Map,
75                            "LastEvaluatedKey",
76                            3,
77                        );
78static EXECUTESTATEMENTOUTPUT_MEMBER__REQUEST_ID: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
79                            ::aws_smithy_schema::ShapeId::from_static(
80                                "synthetic#request_id",
81                                "synthetic",
82                                "request_id",
83                            ),
84                            ::aws_smithy_schema::ShapeType::String,
85                            "request_id",
86                            4,
87                        ).with_http_header("x-amzn-requestid");
88static EXECUTESTATEMENTOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
89                            EXECUTESTATEMENTOUTPUT_SCHEMA_ID,
90                            ::aws_smithy_schema::ShapeType::Structure,
91                            &[&EXECUTESTATEMENTOUTPUT_MEMBER_ITEMS, &EXECUTESTATEMENTOUTPUT_MEMBER_NEXT_TOKEN, &EXECUTESTATEMENTOUTPUT_MEMBER_CONSUMED_CAPACITY, &EXECUTESTATEMENTOUTPUT_MEMBER_LAST_EVALUATED_KEY, &EXECUTESTATEMENTOUTPUT_MEMBER__REQUEST_ID],
92                        );
93impl ExecuteStatementOutput {
94                /// The schema for this shape.
95                pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &EXECUTESTATEMENTOUTPUT_SCHEMA;
96            }
97impl ::aws_smithy_schema::serde::SerializableStruct for ExecuteStatementOutput {
98                #[allow(unused_variables, clippy::diverging_sub_expression)]
99                fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
100                    if let Some(ref val) = self.items {
101                                
102                    ser.write_list(&EXECUTESTATEMENTOUTPUT_MEMBER_ITEMS, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
103                        for item in val {
104                            
105                    ser.write_map(&::aws_smithy_schema::prelude::DOCUMENT, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
106                        for (key, value) in item {
107                            ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
108                            ser.write_struct(crate::types::AttributeValue::SCHEMA, value)?;
109                        }
110                        Ok(())
111                    })?;
112                    
113                        }
114                        Ok(())
115                    })?;
116                    
117                            }
118if let Some(ref val) = self.next_token {
119                                ser.write_string(&EXECUTESTATEMENTOUTPUT_MEMBER_NEXT_TOKEN, val)?;
120                            }
121if let Some(ref val) = self.consumed_capacity {
122                                ser.write_struct(&EXECUTESTATEMENTOUTPUT_MEMBER_CONSUMED_CAPACITY, val)?;
123                            }
124if let Some(ref val) = self.last_evaluated_key {
125                                
126                    ser.write_map(&EXECUTESTATEMENTOUTPUT_MEMBER_LAST_EVALUATED_KEY, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
127                        for (key, value) in val {
128                            ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
129                            ser.write_struct(crate::types::AttributeValue::SCHEMA, value)?;
130                        }
131                        Ok(())
132                    })?;
133                    
134                            }
135                    Ok(())
136                }
137            }
138impl ExecuteStatementOutput {
139                /// Deserializes this structure from a [`ShapeDeserializer`].
140                pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
141                    #[allow(unused_variables, unused_mut)]
142                    let mut builder = Self::builder();
143                    #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
144                    deserializer.read_struct(&EXECUTESTATEMENTOUTPUT_SCHEMA, &mut |member, deser| {
145                        match member.member_index() {
146                            Some(0) => {
147                                    builder.items = Some({ let mut container = Vec::new(); deser.read_list(member, &mut |deser| { container.push({
148    let mut map = ::std::collections::HashMap::new();
149    deser.read_map(member, &mut |key, deser| {
150        let value = crate::types::AttributeValue::deserialize(deser)?;
151        map.insert(key, value);
152        Ok(())
153    })?;
154    map
155}); Ok(()) })?; container });
156                                }
157Some(1) => {
158                                    builder.next_token = Some(deser.read_string(member)?);
159                                }
160Some(2) => {
161                                    builder.consumed_capacity = Some(crate::types::ConsumedCapacity::deserialize(deser)?);
162                                }
163Some(3) => {
164                                    builder.last_evaluated_key = Some({ let mut container = std::collections::HashMap::new(); deser.read_map(member, &mut |key, deser| { container.insert(key, crate::types::AttributeValue::deserialize(deser)?); Ok(()) })?; container });
165                                }
166Some(4) => {
167                                builder._request_id = Some(deser.read_string(member)?);
168                            }
169                            _ => {}
170                        }
171                        Ok(())
172                    })?;
173                    Ok(builder.build())
174                }
175            }
176impl ExecuteStatementOutput {
177                /// Deserializes this structure from a body deserializer and HTTP response headers.
178                /// Header-bound members are read directly from headers, avoiding runtime
179                /// member iteration overhead. Body members are read via the deserializer.
180                pub fn deserialize_with_response(
181                    deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
182                    headers: &::aws_smithy_runtime_api::http::Headers,
183                    _status: u16,
184                    _body: &[u8],
185                ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
186                    #[allow(unused_variables, unused_mut)]
187                    let mut builder = Self::builder();
188if let Some(val) = headers.get("x-amzn-requestid") {
189                    builder._request_id = Some(val.to_string());
190                }
191#[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
192                    deserializer.read_struct(&EXECUTESTATEMENTOUTPUT_SCHEMA, &mut |member, deser| {
193                        match member.member_index() {
194                            Some(0) => { builder.items = Some({ let mut container = Vec::new(); deser.read_list(member, &mut |deser| { container.push({
195    let mut map = ::std::collections::HashMap::new();
196    deser.read_map(member, &mut |key, deser| {
197        let value = crate::types::AttributeValue::deserialize(deser)?;
198        map.insert(key, value);
199        Ok(())
200    })?;
201    map
202}); Ok(()) })?; container }); }
203Some(1) => { builder.next_token = Some(deser.read_string(member)?); }
204Some(2) => { builder.consumed_capacity = Some(crate::types::ConsumedCapacity::deserialize(deser)?); }
205Some(3) => { builder.last_evaluated_key = Some({ let mut container = std::collections::HashMap::new(); deser.read_map(member, &mut |key, deser| { container.insert(key, crate::types::AttributeValue::deserialize(deser)?); Ok(()) })?; container }); }
206                            _ => {}
207                        }
208                        Ok(())
209                    })?;
210                    Ok(builder.build())
211                    }
212                    }
213impl ::aws_types::request_id::RequestId for ExecuteStatementOutput {
214                                    fn request_id(&self) -> Option<&str> {
215                                        self._request_id.as_deref()
216                                    }
217                                }
218impl ExecuteStatementOutput {
219    /// Creates a new builder-style object to manufacture [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
220    pub fn builder() -> crate::operation::execute_statement::builders::ExecuteStatementOutputBuilder {
221        crate::operation::execute_statement::builders::ExecuteStatementOutputBuilder::default()
222    }
223}
224
225/// A builder for [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
226#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
227#[non_exhaustive]
228pub struct ExecuteStatementOutputBuilder {
229    pub(crate) items: ::std::option::Option<::std::vec::Vec::<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>>,
230    pub(crate) next_token: ::std::option::Option<::std::string::String>,
231    pub(crate) consumed_capacity: ::std::option::Option<crate::types::ConsumedCapacity>,
232    pub(crate) last_evaluated_key: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>,
233    _request_id: Option<String>,
234}
235impl ExecuteStatementOutputBuilder {
236    /// Appends an item to `items`.
237    ///
238    /// To override the contents of this collection use [`set_items`](Self::set_items).
239    ///
240    /// <p>If a read operation was used, this property will contain the result of the read operation; a map of attribute names and their values. For the write operations this value will be empty.</p>
241    pub fn items(mut self, input: ::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>) -> Self {
242        let mut v = self.items.unwrap_or_default();
243                        v.push(input);
244                        self.items = ::std::option::Option::Some(v);
245                        self
246    }
247    /// <p>If a read operation was used, this property will contain the result of the read operation; a map of attribute names and their values. For the write operations this value will be empty.</p>
248    pub fn set_items(mut self, input: ::std::option::Option<::std::vec::Vec::<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>>) -> Self {
249        self.items = input; self
250    }
251    /// <p>If a read operation was used, this property will contain the result of the read operation; a map of attribute names and their values. For the write operations this value will be empty.</p>
252    pub fn get_items(&self) -> &::std::option::Option<::std::vec::Vec::<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>> {
253        &self.items
254    }
255    /// <p>If the response of a read request exceeds the response payload limit DynamoDB will set this value in the response. If set, you can use that this value in the subsequent request to get the remaining results.</p>
256    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
257        self.next_token = ::std::option::Option::Some(input.into());
258        self
259    }
260    /// <p>If the response of a read request exceeds the response payload limit DynamoDB will set this value in the response. If set, you can use that this value in the subsequent request to get the remaining results.</p>
261    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
262        self.next_token = input; self
263    }
264    /// <p>If the response of a read request exceeds the response payload limit DynamoDB will set this value in the response. If set, you can use that this value in the subsequent request to get the remaining results.</p>
265    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
266        &self.next_token
267    }
268    /// <p>The capacity units consumed by an operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the request asked for it. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/provisioned-capacity-mode.html">Provisioned capacity mode</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
269    pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
270        self.consumed_capacity = ::std::option::Option::Some(input);
271        self
272    }
273    /// <p>The capacity units consumed by an operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the request asked for it. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/provisioned-capacity-mode.html">Provisioned capacity mode</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
274    pub fn set_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ConsumedCapacity>) -> Self {
275        self.consumed_capacity = input; self
276    }
277    /// <p>The capacity units consumed by an operation. The data returned includes the total provisioned throughput consumed, along with statistics for the table and any indexes involved in the operation. <code>ConsumedCapacity</code> is only returned if the request asked for it. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/provisioned-capacity-mode.html">Provisioned capacity mode</a> in the <i>Amazon DynamoDB Developer Guide</i>.</p>
278    pub fn get_consumed_capacity(&self) -> &::std::option::Option<crate::types::ConsumedCapacity> {
279        &self.consumed_capacity
280    }
281    /// Adds a key-value pair to `last_evaluated_key`.
282    ///
283    /// To override the contents of this collection use [`set_last_evaluated_key`](Self::set_last_evaluated_key).
284    ///
285    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request. If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved. If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
286    pub fn last_evaluated_key(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::AttributeValue) -> Self {
287        let mut hash_map = self.last_evaluated_key.unwrap_or_default();
288                        hash_map.insert(k.into(), v);
289                        self.last_evaluated_key = ::std::option::Option::Some(hash_map);
290                        self
291    }
292    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request. If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved. If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
293    pub fn set_last_evaluated_key(mut self, input: ::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>>) -> Self {
294        self.last_evaluated_key = input; self
295    }
296    /// <p>The primary key of the item where the operation stopped, inclusive of the previous result set. Use this value to start a new operation, excluding this value in the new request. If <code>LastEvaluatedKey</code> is empty, then the "last page" of results has been processed and there is no more data to be retrieved. If <code>LastEvaluatedKey</code> is not empty, it does not necessarily mean that there is more data in the result set. The only way to know when you have reached the end of the result set is when <code>LastEvaluatedKey</code> is empty.</p>
297    pub fn get_last_evaluated_key(&self) -> &::std::option::Option<::std::collections::HashMap::<::std::string::String, crate::types::AttributeValue>> {
298        &self.last_evaluated_key
299    }
300    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
301                                        self._request_id = Some(request_id.into());
302                                        self
303                                    }
304    
305                                    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
306                                        self._request_id = request_id;
307                                        self
308                                    }
309    /// Consumes the builder and constructs a [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
310    pub fn build(self) -> crate::operation::execute_statement::ExecuteStatementOutput {
311        crate::operation::execute_statement::ExecuteStatementOutput {
312            items: self.items
313            ,
314            next_token: self.next_token
315            ,
316            consumed_capacity: self.consumed_capacity
317            ,
318            last_evaluated_key: self.last_evaluated_key
319            ,
320            _request_id: self._request_id,
321        }
322    }
323}
324