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().unwrap_or_default()
19    }
20    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
21    pub fn client_request_token(&self) -> ::std::option::Option<&str> {
22        self.client_request_token.as_deref()
23    }
24    /// <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>
25    pub fn return_consumed_capacity(&self) -> ::std::option::Option<&crate::types::ReturnConsumedCapacity> {
26        self.return_consumed_capacity.as_ref()
27    }
28}
29impl ExecuteTransactionInput {
30    /// Creates a new builder-style object to manufacture [`ExecuteTransactionInput`](crate::operation::execute_transaction::ExecuteTransactionInput).
31    pub fn builder() -> crate::operation::execute_transaction::builders::ExecuteTransactionInputBuilder {
32        crate::operation::execute_transaction::builders::ExecuteTransactionInputBuilder::default()
33    }
34}
35
36/// A builder for [`ExecuteTransactionInput`](crate::operation::execute_transaction::ExecuteTransactionInput).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct ExecuteTransactionInputBuilder {
40    pub(crate) transact_statements: ::std::option::Option<::std::vec::Vec<crate::types::ParameterizedStatement>>,
41    pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
42    pub(crate) return_consumed_capacity: ::std::option::Option<crate::types::ReturnConsumedCapacity>,
43}
44impl ExecuteTransactionInputBuilder {
45    /// Appends an item to `transact_statements`.
46    ///
47    /// To override the contents of this collection use [`set_transact_statements`](Self::set_transact_statements).
48    ///
49    /// <p>The list of PartiQL statements representing the transaction to run.</p>
50    pub fn transact_statements(mut self, input: crate::types::ParameterizedStatement) -> Self {
51        let mut v = self.transact_statements.unwrap_or_default();
52        v.push(input);
53        self.transact_statements = ::std::option::Option::Some(v);
54        self
55    }
56    /// <p>The list of PartiQL statements representing the transaction to run.</p>
57    pub fn set_transact_statements(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ParameterizedStatement>>) -> Self {
58        self.transact_statements = input;
59        self
60    }
61    /// <p>The list of PartiQL statements representing the transaction to run.</p>
62    pub fn get_transact_statements(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ParameterizedStatement>> {
63        &self.transact_statements
64    }
65    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
66    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67        self.client_request_token = ::std::option::Option::Some(input.into());
68        self
69    }
70    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
71    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72        self.client_request_token = input;
73        self
74    }
75    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
76    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
77        &self.client_request_token
78    }
79    /// <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>
80    pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
81        self.return_consumed_capacity = ::std::option::Option::Some(input);
82        self
83    }
84    /// <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>
85    pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
86        self.return_consumed_capacity = input;
87        self
88    }
89    /// <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>
90    pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
91        &self.return_consumed_capacity
92    }
93    /// Consumes the builder and constructs a [`ExecuteTransactionInput`](crate::operation::execute_transaction::ExecuteTransactionInput).
94    pub fn build(
95        self,
96    ) -> ::std::result::Result<crate::operation::execute_transaction::ExecuteTransactionInput, ::aws_smithy_types::error::operation::BuildError> {
97        ::std::result::Result::Ok(crate::operation::execute_transaction::ExecuteTransactionInput {
98            transact_statements: self.transact_statements,
99            client_request_token: self.client_request_token,
100            return_consumed_capacity: self.return_consumed_capacity,
101        })
102    }
103}