aws_sdk_dynamodb/operation/execute_transaction/
_execute_transaction_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 ExecuteTransactionOutput  {
6    /// <p>The response to a PartiQL transaction.</p>
7    pub responses: ::std::option::Option<::std::vec::Vec::<crate::types::ItemResponse>>,
8    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
9    pub consumed_capacity: ::std::option::Option<::std::vec::Vec::<crate::types::ConsumedCapacity>>,
10    _request_id: Option<String>,
11}
12impl  ExecuteTransactionOutput  {
13    /// <p>The response to a PartiQL transaction.</p>
14    /// 
15    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.responses.is_none()`.
16    pub fn responses(&self) -> &[crate::types::ItemResponse] {
17        self.responses.as_deref()
18        .unwrap_or_default()
19    }
20    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
21    /// 
22    /// 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()`.
23    pub fn consumed_capacity(&self) -> &[crate::types::ConsumedCapacity] {
24        self.consumed_capacity.as_deref()
25        .unwrap_or_default()
26    }
27}
28static EXECUTETRANSACTIONOUTPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb.synthetic#ExecuteTransactionOutput", "com.amazonaws.dynamodb.synthetic", "ExecuteTransactionOutput");
29static EXECUTETRANSACTIONOUTPUT_MEMBER_RESPONSES: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
30                            ::aws_smithy_schema::ShapeId::from_static(
31                                "com.amazonaws.dynamodb.synthetic#ExecuteTransactionOutput$Responses",
32                                "com.amazonaws.dynamodb.synthetic",
33                                "ExecuteTransactionOutput",
34                            ),
35                            ::aws_smithy_schema::ShapeType::List,
36                            "Responses",
37                            0,
38                        );
39static EXECUTETRANSACTIONOUTPUT_MEMBER_CONSUMED_CAPACITY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
40                            ::aws_smithy_schema::ShapeId::from_static(
41                                "com.amazonaws.dynamodb.synthetic#ExecuteTransactionOutput$ConsumedCapacity",
42                                "com.amazonaws.dynamodb.synthetic",
43                                "ExecuteTransactionOutput",
44                            ),
45                            ::aws_smithy_schema::ShapeType::List,
46                            "ConsumedCapacity",
47                            1,
48                        );
49static EXECUTETRANSACTIONOUTPUT_MEMBER__REQUEST_ID: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
50                            ::aws_smithy_schema::ShapeId::from_static(
51                                "synthetic#request_id",
52                                "synthetic",
53                                "request_id",
54                            ),
55                            ::aws_smithy_schema::ShapeType::String,
56                            "request_id",
57                            2,
58                        ).with_http_header("x-amzn-requestid");
59static EXECUTETRANSACTIONOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
60                            EXECUTETRANSACTIONOUTPUT_SCHEMA_ID,
61                            ::aws_smithy_schema::ShapeType::Structure,
62                            &[&EXECUTETRANSACTIONOUTPUT_MEMBER_RESPONSES, &EXECUTETRANSACTIONOUTPUT_MEMBER_CONSUMED_CAPACITY, &EXECUTETRANSACTIONOUTPUT_MEMBER__REQUEST_ID],
63                        );
64impl ExecuteTransactionOutput {
65                /// The schema for this shape.
66                pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &EXECUTETRANSACTIONOUTPUT_SCHEMA;
67            }
68impl ::aws_smithy_schema::serde::SerializableStruct for ExecuteTransactionOutput {
69                #[allow(unused_variables, clippy::diverging_sub_expression)]
70                fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
71                    if let Some(ref val) = self.responses {
72                                
73                    ser.write_list(&EXECUTETRANSACTIONOUTPUT_MEMBER_RESPONSES, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
74                        for item in val {
75                            ser.write_struct(crate::types::ItemResponse::SCHEMA, item)?;
76                        }
77                        Ok(())
78                    })?;
79                    
80                            }
81if let Some(ref val) = self.consumed_capacity {
82                                
83                    ser.write_list(&EXECUTETRANSACTIONOUTPUT_MEMBER_CONSUMED_CAPACITY, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
84                        for item in val {
85                            ser.write_struct(crate::types::ConsumedCapacity::SCHEMA, item)?;
86                        }
87                        Ok(())
88                    })?;
89                    
90                            }
91                    Ok(())
92                }
93            }
94impl ExecuteTransactionOutput {
95                /// Deserializes this structure from a [`ShapeDeserializer`].
96                pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
97                    #[allow(unused_variables, unused_mut)]
98                    let mut builder = Self::builder();
99                    #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
100                    deserializer.read_struct(&EXECUTETRANSACTIONOUTPUT_SCHEMA, &mut |member, deser| {
101                        match member.member_index() {
102                            Some(0) => {
103                                    builder.responses = Some({ let mut container = Vec::new(); deser.read_list(member, &mut |deser| { container.push(crate::types::ItemResponse::deserialize(deser)?); Ok(()) })?; container });
104                                }
105Some(1) => {
106                                    builder.consumed_capacity = Some({ let mut container = Vec::new(); deser.read_list(member, &mut |deser| { container.push(crate::types::ConsumedCapacity::deserialize(deser)?); Ok(()) })?; container });
107                                }
108Some(2) => {
109                                builder._request_id = Some(deser.read_string(member)?);
110                            }
111                            _ => {}
112                        }
113                        Ok(())
114                    })?;
115                    Ok(builder.build())
116                }
117            }
118impl ExecuteTransactionOutput {
119                /// Deserializes this structure from a body deserializer and HTTP response headers.
120                /// Header-bound members are read directly from headers, avoiding runtime
121                /// member iteration overhead. Body members are read via the deserializer.
122                pub fn deserialize_with_response(
123                    deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
124                    headers: &::aws_smithy_runtime_api::http::Headers,
125                    _status: u16,
126                    _body: &[u8],
127                ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
128                    #[allow(unused_variables, unused_mut)]
129                    let mut builder = Self::builder();
130if let Some(val) = headers.get("x-amzn-requestid") {
131                    builder._request_id = Some(val.to_string());
132                }
133#[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
134                    deserializer.read_struct(&EXECUTETRANSACTIONOUTPUT_SCHEMA, &mut |member, deser| {
135                        match member.member_index() {
136                            Some(0) => { builder.responses = Some({ let mut container = Vec::new(); deser.read_list(member, &mut |deser| { container.push(crate::types::ItemResponse::deserialize(deser)?); Ok(()) })?; container }); }
137Some(1) => { builder.consumed_capacity = Some({ let mut container = Vec::new(); deser.read_list(member, &mut |deser| { container.push(crate::types::ConsumedCapacity::deserialize(deser)?); Ok(()) })?; container }); }
138                            _ => {}
139                        }
140                        Ok(())
141                    })?;
142                    Ok(builder.build())
143                    }
144                    }
145impl ::aws_types::request_id::RequestId for ExecuteTransactionOutput {
146                                    fn request_id(&self) -> Option<&str> {
147                                        self._request_id.as_deref()
148                                    }
149                                }
150impl ExecuteTransactionOutput {
151    /// Creates a new builder-style object to manufacture [`ExecuteTransactionOutput`](crate::operation::execute_transaction::ExecuteTransactionOutput).
152    pub fn builder() -> crate::operation::execute_transaction::builders::ExecuteTransactionOutputBuilder {
153        crate::operation::execute_transaction::builders::ExecuteTransactionOutputBuilder::default()
154    }
155}
156
157/// A builder for [`ExecuteTransactionOutput`](crate::operation::execute_transaction::ExecuteTransactionOutput).
158#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
159#[non_exhaustive]
160pub struct ExecuteTransactionOutputBuilder {
161    pub(crate) responses: ::std::option::Option<::std::vec::Vec::<crate::types::ItemResponse>>,
162    pub(crate) consumed_capacity: ::std::option::Option<::std::vec::Vec::<crate::types::ConsumedCapacity>>,
163    _request_id: Option<String>,
164}
165impl ExecuteTransactionOutputBuilder {
166    /// Appends an item to `responses`.
167    ///
168    /// To override the contents of this collection use [`set_responses`](Self::set_responses).
169    ///
170    /// <p>The response to a PartiQL transaction.</p>
171    pub fn responses(mut self, input: crate::types::ItemResponse) -> Self {
172        let mut v = self.responses.unwrap_or_default();
173                        v.push(input);
174                        self.responses = ::std::option::Option::Some(v);
175                        self
176    }
177    /// <p>The response to a PartiQL transaction.</p>
178    pub fn set_responses(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::ItemResponse>>) -> Self {
179        self.responses = input; self
180    }
181    /// <p>The response to a PartiQL transaction.</p>
182    pub fn get_responses(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::ItemResponse>> {
183        &self.responses
184    }
185    /// Appends an item to `consumed_capacity`.
186    ///
187    /// To override the contents of this collection use [`set_consumed_capacity`](Self::set_consumed_capacity).
188    ///
189    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
190    pub fn consumed_capacity(mut self, input: crate::types::ConsumedCapacity) -> Self {
191        let mut v = self.consumed_capacity.unwrap_or_default();
192                        v.push(input);
193                        self.consumed_capacity = ::std::option::Option::Some(v);
194                        self
195    }
196    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
197    pub fn set_consumed_capacity(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::ConsumedCapacity>>) -> Self {
198        self.consumed_capacity = input; self
199    }
200    /// <p>The capacity units consumed by the entire operation. The values of the list are ordered according to the ordering of the statements.</p>
201    pub fn get_consumed_capacity(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::ConsumedCapacity>> {
202        &self.consumed_capacity
203    }
204    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
205                                        self._request_id = Some(request_id.into());
206                                        self
207                                    }
208    
209                                    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
210                                        self._request_id = request_id;
211                                        self
212                                    }
213    /// Consumes the builder and constructs a [`ExecuteTransactionOutput`](crate::operation::execute_transaction::ExecuteTransactionOutput).
214    pub fn build(self) -> crate::operation::execute_transaction::ExecuteTransactionOutput {
215        crate::operation::execute_transaction::ExecuteTransactionOutput {
216            responses: self.responses
217            ,
218            consumed_capacity: self.consumed_capacity
219            ,
220            _request_id: self._request_id,
221        }
222    }
223}
224