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.
72 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>> {
73 let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
74 let runtime_plugins = crate::operation::batch_execute_statement::BatchExecuteStatement::operation_runtime_plugins(
75 self.handle.runtime_plugins.clone(),
76 &self.handle.conf,
77 self.config_override,
78 );
79 crate::operation::batch_execute_statement::BatchExecuteStatement::orchestrate(&runtime_plugins, input).await
80 }
81
82 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
83 pub fn customize(
84 self,
85 ) -> crate::client::customize::CustomizableOperation<crate::operation::batch_execute_statement::BatchExecuteStatementOutput, crate::operation::batch_execute_statement::BatchExecuteStatementError, Self> {
86 crate::client::customize::CustomizableOperation::new(self)
87 }
88 pub(crate) fn config_override(
89 mut self,
90 config_override: impl ::std::convert::Into<crate::config::Builder>,
91 ) -> Self {
92 self.set_config_override(::std::option::Option::Some(config_override.into()));
93 self
94 }
95
96 pub(crate) fn set_config_override(
97 &mut self,
98 config_override: ::std::option::Option<crate::config::Builder>,
99 ) -> &mut Self {
100 self.config_override = config_override;
101 self
102 }
103 ///
104 /// Appends an item to `Statements`.
105 ///
106 /// To override the contents of this collection use [`set_statements`](Self::set_statements).
107 ///
108 /// <p>The list of PartiQL statements representing the batch to run.</p>
109 pub fn statements(mut self, input: crate::types::BatchStatementRequest) -> Self {
110 self.inner = self.inner.statements(input);
111 self
112 }
113 /// <p>The list of PartiQL statements representing the batch to run.</p>
114 pub fn set_statements(mut self, input: ::std::option::Option<::std::vec::Vec::<crate::types::BatchStatementRequest>>) -> Self {
115 self.inner = self.inner.set_statements(input);
116 self
117 }
118 /// <p>The list of PartiQL statements representing the batch to run.</p>
119 pub fn get_statements(&self) -> &::std::option::Option<::std::vec::Vec::<crate::types::BatchStatementRequest>> {
120 self.inner.get_statements()
121 }
122 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
123 /// <ul>
124 /// <li>
125 /// <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>
126 /// <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>
127 /// <li>
128 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
129 /// <li>
130 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
131 /// </ul>
132 pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
133 self.inner = self.inner.return_consumed_capacity(input);
134 self
135 }
136 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
137 /// <ul>
138 /// <li>
139 /// <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>
140 /// <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>
141 /// <li>
142 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
143 /// <li>
144 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
145 /// </ul>
146 pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
147 self.inner = self.inner.set_return_consumed_capacity(input);
148 self
149 }
150 /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
151 /// <ul>
152 /// <li>
153 /// <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>
154 /// <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>
155 /// <li>
156 /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
157 /// <li>
158 /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
159 /// </ul>
160 pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
161 self.inner.get_return_consumed_capacity()
162 }
163}
164