aws_sdk_dynamodb/operation/execute_transaction/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::execute_transaction::_execute_transaction_output::ExecuteTransactionOutputBuilder;
3
4pub use crate::operation::execute_transaction::_execute_transaction_input::ExecuteTransactionInputBuilder;
5
6impl crate::operation::execute_transaction::builders::ExecuteTransactionInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result<
9 crate::operation::execute_transaction::ExecuteTransactionOutput,
10 ::aws_smithy_runtime_api::client::result::SdkError<
11 crate::operation::execute_transaction::ExecuteTransactionError,
12 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13 >
14 > {
15 let mut fluent_builder = client.execute_transaction();
16 fluent_builder.inner = self;
17 fluent_builder.send().await
18 }
19 }
20/// Fluent builder constructing a request to `ExecuteTransaction`.
21///
22/// <p>This operation allows you to perform transactional reads or writes on data stored in DynamoDB, using PartiQL.</p><note>
23/// <p>The entire transaction must consist of either read statements or write statements, you cannot mix both in one transaction. The EXISTS function is an exception and can be used to check the condition of specific attributes of the item in a similar manner to <code>ConditionCheck</code> in the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-apis.html#transaction-apis-txwriteitems">TransactWriteItems</a> API.</p>
24/// </note>
25#[derive(::std::clone::Clone, ::std::fmt::Debug)]
26pub struct ExecuteTransactionFluentBuilder {
27 handle: ::std::sync::Arc<crate::client::Handle>,
28 inner: crate::operation::execute_transaction::builders::ExecuteTransactionInputBuilder,
29config_override: ::std::option::Option<crate::config::Builder>,
30 }
31impl
32 crate::client::customize::internal::CustomizableSend<
33 crate::operation::execute_transaction::ExecuteTransactionOutput,
34 crate::operation::execute_transaction::ExecuteTransactionError,
35 > for ExecuteTransactionFluentBuilder
36 {
37 fn send(
38 self,
39 config_override: crate::config::Builder,
40 ) -> crate::client::customize::internal::BoxFuture<
41 crate::client::customize::internal::SendResult<
42 crate::operation::execute_transaction::ExecuteTransactionOutput,
43 crate::operation::execute_transaction::ExecuteTransactionError,
44 >,
45 > {
46 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
47 }
48 }
49impl ExecuteTransactionFluentBuilder {
50 /// Creates a new `ExecuteTransactionFluentBuilder`.
51 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
52 Self {
53 handle,
54 inner: ::std::default::Default::default(),
55 config_override: ::std::option::Option::None,
56 }
57 }
58 /// Access the ExecuteTransaction as a reference.
59 pub fn as_input(&self) -> &crate::operation::execute_transaction::builders::ExecuteTransactionInputBuilder {
60 &self.inner
61 }
62 /// Sends the request and returns the response.
63 ///
64 /// If an error occurs, an `SdkError` will be returned with additional details that
65 /// can be matched against.
66 ///
67 /// By default, any retryable failures will be retried twice. Retry behavior
68 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
69 /// set when configuring the client.
70 pub async fn send(self) -> ::std::result::Result<crate::operation::execute_transaction::ExecuteTransactionOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::execute_transaction::ExecuteTransactionError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
71 let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
72 let runtime_plugins = crate::operation::execute_transaction::ExecuteTransaction::operation_runtime_plugins(
73 self.handle.runtime_plugins.clone(),
74 &self.handle.conf,
75 self.config_override,
76 );
77 crate::operation::execute_transaction::ExecuteTransaction::orchestrate(&runtime_plugins, input).await
78 }
79
80 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
81 pub fn customize(
82 self,
83 ) -> crate::client::customize::CustomizableOperation<crate::operation::execute_transaction::ExecuteTransactionOutput, crate::operation::execute_transaction::ExecuteTransactionError, Self> {
84 crate::client::customize::CustomizableOperation::new(self)
85 }
86 pub(crate) fn config_override(
87 mut self,
88 config_override: impl ::std::convert::Into<crate::config::Builder>,
89 ) -> Self {
90 self.set_config_override(::std::option::Option::Some(config_override.into()));
91 self
92 }
93
94 pub(crate) fn set_config_override(
95 &mut self,
96 config_override: ::std::option::Option<crate::config::Builder>,
97 ) -> &mut Self {
98 self.config_override = config_override;
99 self
100 }
101 ///
102 /// Appends an item to `TransactStatements`.
103 ///
104 /// To override the contents of this collection use [`set_transact_statements`](Self::set_transact_statements).
105 ///
106 /// <p>The list of PartiQL statements representing the transaction to run.</p>
107 pub fn transact_statements(mut self, input: crate::types::ParameterizedStatement) -> Self {
108 self.inner = self.inner.transact_statements(input);
109 self
110 }
111 /// <p>The list of PartiQL statements representing the transaction to run.</p>
112 pub fn set_transact_statements(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::ParameterizedStatement>>) -> Self {
113 self.inner = self.inner.set_transact_statements(input);
114 self
115 }
116 /// <p>The list of PartiQL statements representing the transaction to run.</p>
117 pub fn get_transact_statements(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::ParameterizedStatement>> {
118 self.inner.get_transact_statements()
119 }
120 /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
121 pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122 self.inner = self.inner.client_request_token(input.into());
123 self
124 }
125 /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
126 pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127 self.inner = self.inner.set_client_request_token(input);
128 self
129 }
130 /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
131 pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
132 self.inner.get_client_request_token()
133 }
134 /// <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>
135 pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
136 self.inner = self.inner.return_consumed_capacity(input);
137 self
138 }
139 /// <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>
140 pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
141 self.inner = self.inner.set_return_consumed_capacity(input);
142 self
143 }
144 /// <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>
145 pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
146 self.inner.get_return_consumed_capacity()
147 }
148}
149