aws_sdk_dynamodb/operation/execute_statement/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::execute_statement::_execute_statement_output::ExecuteStatementOutputBuilder;
3
4pub use crate::operation::execute_statement::_execute_statement_input::ExecuteStatementInputBuilder;
5
6impl crate::operation::execute_statement::builders::ExecuteStatementInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::execute_statement::ExecuteStatementOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::execute_statement::ExecuteStatementError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.execute_statement();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ExecuteStatement`.
24///
25/// <p>This operation allows you to perform reads and singleton writes on data stored in DynamoDB, using PartiQL.</p>
26/// <p>For PartiQL reads (<code>SELECT</code> statement), if the total number of processed items exceeds the maximum dataset size limit of 1 MB, the read stops and results are returned to the user as a <code>LastEvaluatedKey</code> value to continue the read in a subsequent operation. If the filter criteria in <code>WHERE</code> clause does not match any data, the read will return an empty result set.</p>
27/// <p>A single <code>SELECT</code> statement response can return up to the maximum number of items (if using the Limit parameter) or a maximum of 1 MB of data (and then apply any filtering to the results using <code>WHERE</code> clause). If <code>LastEvaluatedKey</code> is present in the response, you need to paginate the result set. If <code>NextToken</code> is present, you need to paginate the result set and include <code>NextToken</code>.</p>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct ExecuteStatementFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::execute_statement::builders::ExecuteStatementInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::execute_statement::ExecuteStatementOutput,
37        crate::operation::execute_statement::ExecuteStatementError,
38    > for ExecuteStatementFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::execute_statement::ExecuteStatementOutput,
46            crate::operation::execute_statement::ExecuteStatementError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl ExecuteStatementFluentBuilder {
53    /// Creates a new `ExecuteStatementFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the ExecuteStatement as a reference.
62    pub fn as_input(&self) -> &crate::operation::execute_statement::builders::ExecuteStatementInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::execute_statement::ExecuteStatementOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::execute_statement::ExecuteStatementError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::execute_statement::ExecuteStatement::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::execute_statement::ExecuteStatement::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::execute_statement::ExecuteStatementOutput,
99        crate::operation::execute_statement::ExecuteStatementError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>The PartiQL statement representing the operation to run.</p>
114    pub fn statement(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.statement(input.into());
116        self
117    }
118    /// <p>The PartiQL statement representing the operation to run.</p>
119    pub fn set_statement(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_statement(input);
121        self
122    }
123    /// <p>The PartiQL statement representing the operation to run.</p>
124    pub fn get_statement(&self) -> &::std::option::Option<::std::string::String> {
125        self.inner.get_statement()
126    }
127    ///
128    /// Appends an item to `Parameters`.
129    ///
130    /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
131    ///
132    /// <p>The parameters for the PartiQL statement, if any.</p>
133    pub fn parameters(mut self, input: crate::types::AttributeValue) -> Self {
134        self.inner = self.inner.parameters(input);
135        self
136    }
137    /// <p>The parameters for the PartiQL statement, if any.</p>
138    pub fn set_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AttributeValue>>) -> Self {
139        self.inner = self.inner.set_parameters(input);
140        self
141    }
142    /// <p>The parameters for the PartiQL statement, if any.</p>
143    pub fn get_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AttributeValue>> {
144        self.inner.get_parameters()
145    }
146    /// <p>The consistency of a read operation. If set to <code>true</code>, then a strongly consistent read is used; otherwise, an eventually consistent read is used.</p>
147    pub fn consistent_read(mut self, input: bool) -> Self {
148        self.inner = self.inner.consistent_read(input);
149        self
150    }
151    /// <p>The consistency of a read operation. If set to <code>true</code>, then a strongly consistent read is used; otherwise, an eventually consistent read is used.</p>
152    pub fn set_consistent_read(mut self, input: ::std::option::Option<bool>) -> Self {
153        self.inner = self.inner.set_consistent_read(input);
154        self
155    }
156    /// <p>The consistency of a read operation. If set to <code>true</code>, then a strongly consistent read is used; otherwise, an eventually consistent read is used.</p>
157    pub fn get_consistent_read(&self) -> &::std::option::Option<bool> {
158        self.inner.get_consistent_read()
159    }
160    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
161    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162        self.inner = self.inner.next_token(input.into());
163        self
164    }
165    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
166    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167        self.inner = self.inner.set_next_token(input);
168        self
169    }
170    /// <p>Set this value to get remaining results, if <code>NextToken</code> was returned in the statement response.</p>
171    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
172        self.inner.get_next_token()
173    }
174    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
175    /// <ul>
176    /// <li>
177    /// <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>
178    /// <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>
179    /// <li>
180    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
181    /// <li>
182    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
183    /// </ul>
184    pub fn return_consumed_capacity(mut self, input: crate::types::ReturnConsumedCapacity) -> Self {
185        self.inner = self.inner.return_consumed_capacity(input);
186        self
187    }
188    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
189    /// <ul>
190    /// <li>
191    /// <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>
192    /// <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>
193    /// <li>
194    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
195    /// <li>
196    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
197    /// </ul>
198    pub fn set_return_consumed_capacity(mut self, input: ::std::option::Option<crate::types::ReturnConsumedCapacity>) -> Self {
199        self.inner = self.inner.set_return_consumed_capacity(input);
200        self
201    }
202    /// <p>Determines the level of detail about either provisioned or on-demand throughput consumption that is returned in the response:</p>
203    /// <ul>
204    /// <li>
205    /// <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>
206    /// <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>
207    /// <li>
208    /// <p><code>TOTAL</code> - The response includes only the aggregate <code>ConsumedCapacity</code> for the operation.</p></li>
209    /// <li>
210    /// <p><code>NONE</code> - No <code>ConsumedCapacity</code> details are included in the response.</p></li>
211    /// </ul>
212    pub fn get_return_consumed_capacity(&self) -> &::std::option::Option<crate::types::ReturnConsumedCapacity> {
213        self.inner.get_return_consumed_capacity()
214    }
215    /// <p>The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, along with a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation so you can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation to continue the operation.</p>
216    pub fn limit(mut self, input: i32) -> Self {
217        self.inner = self.inner.limit(input);
218        self
219    }
220    /// <p>The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, along with a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation so you can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation to continue the operation.</p>
221    pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
222        self.inner = self.inner.set_limit(input);
223        self
224    }
225    /// <p>The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, along with a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation so you can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in <code>LastEvaluatedKey</code> to apply in a subsequent operation to continue the operation.</p>
226    pub fn get_limit(&self) -> &::std::option::Option<i32> {
227        self.inner.get_limit()
228    }
229    /// <p>An optional parameter that returns the item attributes for an <code>ExecuteStatement</code> operation that failed a condition check.</p>
230    /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
231    pub fn return_values_on_condition_check_failure(mut self, input: crate::types::ReturnValuesOnConditionCheckFailure) -> Self {
232        self.inner = self.inner.return_values_on_condition_check_failure(input);
233        self
234    }
235    /// <p>An optional parameter that returns the item attributes for an <code>ExecuteStatement</code> operation that failed a condition check.</p>
236    /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
237    pub fn set_return_values_on_condition_check_failure(
238        mut self,
239        input: ::std::option::Option<crate::types::ReturnValuesOnConditionCheckFailure>,
240    ) -> Self {
241        self.inner = self.inner.set_return_values_on_condition_check_failure(input);
242        self
243    }
244    /// <p>An optional parameter that returns the item attributes for an <code>ExecuteStatement</code> operation that failed a condition check.</p>
245    /// <p>There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No read capacity units are consumed.</p>
246    pub fn get_return_values_on_condition_check_failure(&self) -> &::std::option::Option<crate::types::ReturnValuesOnConditionCheckFailure> {
247        self.inner.get_return_values_on_condition_check_failure()
248    }
249}