aws_sdk_dynamodb/operation/batch_execute_statement/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::batch_execute_statement::_batch_execute_statement_output::BatchExecuteStatementOutputBuilder;
3
4pub use crate::operation::batch_execute_statement::_batch_execute_statement_input::BatchExecuteStatementInputBuilder;
5
6impl crate::operation::batch_execute_statement::builders::BatchExecuteStatementInputBuilder {
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::batch_execute_statement::BatchExecuteStatementOutput,
10                        ::aws_smithy_runtime_api::client::result::SdkError<
11                            crate::operation::batch_execute_statement::BatchExecuteStatementError,
12                            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13                        >
14                    > {
15                        let mut fluent_builder = client.batch_execute_statement();
16                        fluent_builder.inner = self;
17                        fluent_builder.send().await
18                    }
19                }
20/// Fluent builder constructing a request to `BatchExecuteStatement`.
21/// 
22/// <p>This operation allows you to perform batch reads or writes on data stored in DynamoDB, using PartiQL. Each read statement in a <code>BatchExecuteStatement</code> must specify an equality condition on all key attributes. This enforces that each <code>SELECT</code> statement in a batch returns at most a single item. For more information, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.multiplestatements.batching.html">Running batch operations with PartiQL for DynamoDB </a>.</p><note>
23/// <p>The entire batch must consist of either read statements or write statements, you cannot mix both in one batch.</p>
24/// </note> <important>
25/// <p>A HTTP 200 response does not mean that all statements in the BatchExecuteStatement succeeded. Error details for individual statements can be found under the <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchStatementResponse.html#DDB-Type-BatchStatementResponse-Error">Error</a> field of the <code>BatchStatementResponse</code> for each statement.</p>
26/// </important>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct BatchExecuteStatementFluentBuilder {
29                handle: ::std::sync::Arc<crate::client::Handle>,
30                inner: crate::operation::batch_execute_statement::builders::BatchExecuteStatementInputBuilder,
31config_override: ::std::option::Option<crate::config::Builder>,
32            }
33impl
34                crate::client::customize::internal::CustomizableSend<
35                    crate::operation::batch_execute_statement::BatchExecuteStatementOutput,
36                    crate::operation::batch_execute_statement::BatchExecuteStatementError,
37                > for BatchExecuteStatementFluentBuilder
38            {
39                fn send(
40                    self,
41                    config_override: crate::config::Builder,
42                ) -> crate::client::customize::internal::BoxFuture<
43                    crate::client::customize::internal::SendResult<
44                        crate::operation::batch_execute_statement::BatchExecuteStatementOutput,
45                        crate::operation::batch_execute_statement::BatchExecuteStatementError,
46                    >,
47                > {
48                    ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49                }
50            }
51impl BatchExecuteStatementFluentBuilder {
52    /// Creates a new `BatchExecuteStatementFluentBuilder`.
53                    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54                        Self {
55                            handle,
56                            inner: ::std::default::Default::default(),
57    config_override: ::std::option::Option::None,
58                        }
59                    }
60    /// Access the BatchExecuteStatement as a reference.
61                    pub fn as_input(&self) -> &crate::operation::batch_execute_statement::builders::BatchExecuteStatementInputBuilder {
62                        &self.inner
63                    }
64    /// Sends the request and returns the response.
65                    ///
66                    /// If an error occurs, an `SdkError` will be returned with additional details that
67                    /// can be matched against.
68                    ///
69                    /// By default, any retryable failures will be retried twice. Retry behavior
70                    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71                    /// set when configuring the client. Note: retries are enabled by default when using
72                    /// `aws_config::load_from_env()` or when using `BehaviorVersion::v2025_01_17()` or later.
73                    pub async fn send(self) -> ::std::result::Result<crate::operation::batch_execute_statement::BatchExecuteStatementOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::batch_execute_statement::BatchExecuteStatementError, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> {
74                        let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
75                        let runtime_plugins = crate::operation::batch_execute_statement::BatchExecuteStatement::operation_runtime_plugins(
76                            self.handle.runtime_plugins.clone(),
77                            &self.handle.conf,
78                            self.config_override,
79                        );
80                        crate::operation::batch_execute_statement::BatchExecuteStatement::orchestrate(&runtime_plugins, input).await
81                    }
82    
83                    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
84                    pub fn customize(
85                        self,
86                    ) -> crate::client::customize::CustomizableOperation<crate::operation::batch_execute_statement::BatchExecuteStatementOutput, crate::operation::batch_execute_statement::BatchExecuteStatementError, Self> {
87                        crate::client::customize::CustomizableOperation::new(self)
88                    }
89    pub(crate) fn config_override(
90                            mut self,
91                            config_override: impl ::std::convert::Into<crate::config::Builder>,
92                        ) -> Self {
93                            self.set_config_override(::std::option::Option::Some(config_override.into()));
94                            self
95                        }
96    
97                        pub(crate) fn set_config_override(
98                            &mut self,
99                            config_override: ::std::option::Option<crate::config::Builder>,
100                        ) -> &mut Self {
101                            self.config_override = config_override;
102                            self
103                        }
104    /// 
105    /// Appends an item to `Statements`.
106    /// 
107    /// To override the contents of this collection use [`set_statements`](Self::set_statements).
108    /// 
109    /// <p>The list of PartiQL statements representing the batch to run.</p>
110    pub fn statements(mut self, input: crate::types::BatchStatementRequest) -> Self {
111                        self.inner = self.inner.statements(input);
112                        self
113                    }
114    /// <p>The list of PartiQL statements representing the batch to run.</p>
115    pub fn set_statements(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::BatchStatementRequest>>) -> Self {
116                    self.inner = self.inner.set_statements(input);
117                    self
118                }
119    /// <p>The list of PartiQL statements representing the batch to run.</p>
120    pub fn get_statements(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::BatchStatementRequest>> {
121                    self.inner.get_statements()
122                }
123    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
124    /// <ul>
125    /// <li>
126    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
127    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
128    /// <li>
129    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
130    /// <li>
131    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
132    /// </ul>
133    pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
134                    self.inner = self.inner.return_consumed_capacity(input);
135                    self
136                }
137    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
138    /// <ul>
139    /// <li>
140    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
141    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
142    /// <li>
143    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
144    /// <li>
145    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
146    /// </ul>
147    pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
148                    self.inner = self.inner.set_return_consumed_capacity(input);
149                    self
150                }
151    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
152    /// <ul>
153    /// <li>
154    /// <p><code>INDEXES</code> - The response includes the aggregate <code>ConsumedCapacity</code> for the operation, together with <code>ConsumedCapacity</code> for each table and secondary index that was accessed.</p>
155    /// <p>Note that some operations, such as <code>GetItem</code> and <code>BatchGetItem</code>, do not access any indexes at all. In these cases, specifying <code>INDEXES</code> will only return <code>ConsumedCapacity</code> information for table(s).</p></li>
156    /// <li>
157    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
158    /// <li>
159    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
160    /// </ul>
161    pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
162                    self.inner.get_return_consumed_capacity()
163                }
164}
165