aws_sdk_dynamodb/operation/execute_transaction/
_execute_transaction_input.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 ExecuteTransactionInput  {
6    /// <p>The list of PartiQL statements representing the transaction to run.</p>
7    pub transact_statements: ::std::option::Option<::std::vec::Vec::<crate::types::ParameterizedStatement>>,
8    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
9    pub client_request_token: ::std::option::Option<::std::string::String>,
10    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html">TransactGetItems</a> and <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html">TransactWriteItems</a>.</p>
11    pub return_consumed_capacity: ::std::option::Option<crate::types::ReturnConsumedCapacity>,
12}
13impl  ExecuteTransactionInput  {
14    /// <p>The list of PartiQL statements representing the transaction to run.</p>
15    /// 
16    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.transact_statements.is_none()`.
17    pub fn transact_statements(&self) -> &[crate::types::ParameterizedStatement] {
18        self.transact_statements.as_deref()
19        .unwrap_or_default()
20    }
21    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
22    pub fn client_request_token(&self) -> ::std::option::Option<&str> {
23        self.client_request_token.as_deref()
24    }
25    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html">TransactGetItems</a> and <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html">TransactWriteItems</a>.</p>
26    pub fn return_consumed_capacity(&self) -> ::std::option::Option<&crate::types::ReturnConsumedCapacity> {
27        self.return_consumed_capacity.as_ref()
28    }
29}
30static EXECUTETRANSACTIONINPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.dynamodb.synthetic#ExecuteTransactionInput", "com.amazonaws.dynamodb.synthetic", "ExecuteTransactionInput");
31static EXECUTETRANSACTIONINPUT_MEMBER_TRANSACT_STATEMENTS: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
32                            ::aws_smithy_schema::ShapeId::from_static(
33                                "com.amazonaws.dynamodb.synthetic#ExecuteTransactionInput$TransactStatements",
34                                "com.amazonaws.dynamodb.synthetic",
35                                "ExecuteTransactionInput",
36                            ),
37                            ::aws_smithy_schema::ShapeType::List,
38                            "TransactStatements",
39                            0,
40                        );
41static EXECUTETRANSACTIONINPUT_MEMBER_CLIENT_REQUEST_TOKEN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
42                            ::aws_smithy_schema::ShapeId::from_static(
43                                "com.amazonaws.dynamodb.synthetic#ExecuteTransactionInput$ClientRequestToken",
44                                "com.amazonaws.dynamodb.synthetic",
45                                "ExecuteTransactionInput",
46                            ),
47                            ::aws_smithy_schema::ShapeType::String,
48                            "ClientRequestToken",
49                            1,
50                        );
51static EXECUTETRANSACTIONINPUT_MEMBER_RETURN_CONSUMED_CAPACITY: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
52                            ::aws_smithy_schema::ShapeId::from_static(
53                                "com.amazonaws.dynamodb.synthetic#ExecuteTransactionInput$ReturnConsumedCapacity",
54                                "com.amazonaws.dynamodb.synthetic",
55                                "ExecuteTransactionInput",
56                            ),
57                            ::aws_smithy_schema::ShapeType::String,
58                            "ReturnConsumedCapacity",
59                            2,
60                        );
61static EXECUTETRANSACTIONINPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
62                            EXECUTETRANSACTIONINPUT_SCHEMA_ID,
63                            ::aws_smithy_schema::ShapeType::Structure,
64                            &[&EXECUTETRANSACTIONINPUT_MEMBER_TRANSACT_STATEMENTS, &EXECUTETRANSACTIONINPUT_MEMBER_CLIENT_REQUEST_TOKEN, &EXECUTETRANSACTIONINPUT_MEMBER_RETURN_CONSUMED_CAPACITY],
65                        );
66impl ExecuteTransactionInput {
67                /// The schema for this shape.
68                pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &EXECUTETRANSACTIONINPUT_SCHEMA;
69            }
70impl ::aws_smithy_schema::serde::SerializableStruct for ExecuteTransactionInput {
71                #[allow(unused_variables, clippy::diverging_sub_expression)]
72                fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
73                    if let Some(ref val) = self.transact_statements {
74                                
75                    ser.write_list(&EXECUTETRANSACTIONINPUT_MEMBER_TRANSACT_STATEMENTS, &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
76                        for item in val {
77                            ser.write_struct(crate::types::ParameterizedStatement::SCHEMA, item)?;
78                        }
79                        Ok(())
80                    })?;
81                    
82                            }
83if let Some(ref val) = self.client_request_token {
84                                ser.write_string(&EXECUTETRANSACTIONINPUT_MEMBER_CLIENT_REQUEST_TOKEN, val)?;
85                            }
86if let Some(ref val) = self.return_consumed_capacity {
87                                ser.write_string(&EXECUTETRANSACTIONINPUT_MEMBER_RETURN_CONSUMED_CAPACITY, val.as_str())?;
88                            }
89                    Ok(())
90                }
91            }
92impl ExecuteTransactionInput {
93                /// Deserializes this structure from a [`ShapeDeserializer`].
94                pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
95                    #[allow(unused_variables, unused_mut)]
96                    let mut builder = Self::builder();
97                    #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
98                    deserializer.read_struct(&EXECUTETRANSACTIONINPUT_SCHEMA, &mut |member, deser| {
99                        match member.member_index() {
100                            Some(0) => {
101                                    builder.transact_statements = Some({ let mut container = Vec::new(); deser.read_list(member, &mut |deser| { container.push(crate::types::ParameterizedStatement::deserialize(deser)?); Ok(()) })?; container });
102                                }
103Some(1) => {
104                                    builder.client_request_token = Some(deser.read_string(member)?);
105                                }
106Some(2) => {
107                                    builder.return_consumed_capacity = Some(crate::types::ReturnConsumedCapacity::from(deser.read_string(member)?.as_str()));
108                                }
109                            _ => {}
110                        }
111                        Ok(())
112                    })?;
113                    builder.transact_statements = builder.transact_statements.or(Some(Vec::new()));
114builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::Custom { message: e.to_string() })
115                }
116            }
117impl ExecuteTransactionInput {
118                        /// Deserializes this structure from a body deserializer and HTTP response.
119                        pub fn deserialize_with_response(
120                            deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
121                            _headers: &::aws_smithy_runtime_api::http::Headers,
122                            _status: u16,
123                            _body: &[u8],
124                        ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
125                            Self::deserialize(deserializer)
126                        }
127                    }
128impl ExecuteTransactionInput {
129    /// Creates a new builder-style object to manufacture [`ExecuteTransactionInput`](crate::operation::execute_transaction::ExecuteTransactionInput).
130    pub fn builder() -> crate::operation::execute_transaction::builders::ExecuteTransactionInputBuilder {
131        crate::operation::execute_transaction::builders::ExecuteTransactionInputBuilder::default()
132    }
133}
134
135/// A builder for [`ExecuteTransactionInput`](crate::operation::execute_transaction::ExecuteTransactionInput).
136#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
137#[non_exhaustive]
138pub struct ExecuteTransactionInputBuilder {
139    pub(crate) transact_statements: ::std::option::Option<::std::vec::Vec::<crate::types::ParameterizedStatement>>,
140    pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
141    pub(crate) return_consumed_capacity: ::std::option::Option<crate::types::ReturnConsumedCapacity>,
142}
143impl ExecuteTransactionInputBuilder {
144    /// Appends an item to `transact_statements`.
145    ///
146    /// To override the contents of this collection use [`set_transact_statements`](Self::set_transact_statements).
147    ///
148    /// <p>The list of PartiQL statements representing the transaction to run.</p>
149    pub fn transact_statements(mut self, input: crate::types::ParameterizedStatement) -> Self {
150        let mut v = self.transact_statements.unwrap_or_default();
151                        v.push(input);
152                        self.transact_statements = ::std::option::Option::Some(v);
153                        self
154    }
155    /// <p>The list of PartiQL statements representing the transaction to run.</p>
156    pub fn set_transact_statements(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::ParameterizedStatement>>) -> Self {
157        self.transact_statements = input; self
158    }
159    /// <p>The list of PartiQL statements representing the transaction to run.</p>
160    pub fn get_transact_statements(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::ParameterizedStatement>> {
161        &self.transact_statements
162    }
163    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
164    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
165        self.client_request_token = ::std::option::Option::Some(input.into());
166        self
167    }
168    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
169    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
170        self.client_request_token = input; self
171    }
172    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
173    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
174        &self.client_request_token
175    }
176    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html">TransactGetItems</a> and <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html">TransactWriteItems</a>.</p>
177    pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
178        self.return_consumed_capacity = ::std::option::Option::Some(input);
179        self
180    }
181    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html">TransactGetItems</a> and <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html">TransactWriteItems</a>.</p>
182    pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
183        self.return_consumed_capacity = input; self
184    }
185    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html">TransactGetItems</a> and <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html">TransactWriteItems</a>.</p>
186    pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
187        &self.return_consumed_capacity
188    }
189    /// Consumes the builder and constructs a [`ExecuteTransactionInput`](crate::operation::execute_transaction::ExecuteTransactionInput).
190    pub fn build(self) -> ::std::result::Result<crate::operation::execute_transaction::ExecuteTransactionInput, ::aws_smithy_types::error::operation::BuildError> {
191        ::std::result::Result::Ok(
192            crate::operation::execute_transaction::ExecuteTransactionInput {
193                transact_statements: self.transact_statements
194                ,
195                client_request_token: self.client_request_token
196                ,
197                return_consumed_capacity: self.return_consumed_capacity
198                ,
199            }
200        )
201    }
202}
203