aws_sdk_athena/operation/start_query_execution/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_query_execution::_start_query_execution_output::StartQueryExecutionOutputBuilder;
3
4pub use crate::operation::start_query_execution::_start_query_execution_input::StartQueryExecutionInputBuilder;
5
6impl crate::operation::start_query_execution::builders::StartQueryExecutionInputBuilder {
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::start_query_execution::StartQueryExecutionOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::start_query_execution::StartQueryExecutionError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.start_query_execution();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `StartQueryExecution`.
24///
25/// <p>Runs the SQL query statements contained in the <code>Query</code>. Requires you to have access to the workgroup in which the query ran. Running queries against an external catalog requires <code>GetDataCatalog</code> permission to the catalog. For code samples using the Amazon Web Services SDK for Java, see <a href="http://docs.aws.amazon.com/athena/latest/ug/code-samples.html">Examples and Code Samples</a> in the <i>Amazon Athena User Guide</i>.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct StartQueryExecutionFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::start_query_execution::builders::StartQueryExecutionInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33 crate::client::customize::internal::CustomizableSend<
34 crate::operation::start_query_execution::StartQueryExecutionOutput,
35 crate::operation::start_query_execution::StartQueryExecutionError,
36 > for StartQueryExecutionFluentBuilder
37{
38 fn send(
39 self,
40 config_override: crate::config::Builder,
41 ) -> crate::client::customize::internal::BoxFuture<
42 crate::client::customize::internal::SendResult<
43 crate::operation::start_query_execution::StartQueryExecutionOutput,
44 crate::operation::start_query_execution::StartQueryExecutionError,
45 >,
46 > {
47 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48 }
49}
50impl StartQueryExecutionFluentBuilder {
51 /// Creates a new `StartQueryExecutionFluentBuilder`.
52 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53 Self {
54 handle,
55 inner: ::std::default::Default::default(),
56 config_override: ::std::option::Option::None,
57 }
58 }
59 /// Access the StartQueryExecution as a reference.
60 pub fn as_input(&self) -> &crate::operation::start_query_execution::builders::StartQueryExecutionInputBuilder {
61 &self.inner
62 }
63 /// Sends the request and returns the response.
64 ///
65 /// If an error occurs, an `SdkError` will be returned with additional details that
66 /// can be matched against.
67 ///
68 /// By default, any retryable failures will be retried twice. Retry behavior
69 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70 /// set when configuring the client.
71 pub async fn send(
72 self,
73 ) -> ::std::result::Result<
74 crate::operation::start_query_execution::StartQueryExecutionOutput,
75 ::aws_smithy_runtime_api::client::result::SdkError<
76 crate::operation::start_query_execution::StartQueryExecutionError,
77 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78 >,
79 > {
80 let input = self
81 .inner
82 .build()
83 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84 let runtime_plugins = crate::operation::start_query_execution::StartQueryExecution::operation_runtime_plugins(
85 self.handle.runtime_plugins.clone(),
86 &self.handle.conf,
87 self.config_override,
88 );
89 crate::operation::start_query_execution::StartQueryExecution::orchestrate(&runtime_plugins, input).await
90 }
91
92 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93 pub fn customize(
94 self,
95 ) -> crate::client::customize::CustomizableOperation<
96 crate::operation::start_query_execution::StartQueryExecutionOutput,
97 crate::operation::start_query_execution::StartQueryExecutionError,
98 Self,
99 > {
100 crate::client::customize::CustomizableOperation::new(self)
101 }
102 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103 self.set_config_override(::std::option::Option::Some(config_override.into()));
104 self
105 }
106
107 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108 self.config_override = config_override;
109 self
110 }
111 /// <p>The SQL query statements to be executed.</p>
112 pub fn query_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113 self.inner = self.inner.query_string(input.into());
114 self
115 }
116 /// <p>The SQL query statements to be executed.</p>
117 pub fn set_query_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118 self.inner = self.inner.set_query_string(input);
119 self
120 }
121 /// <p>The SQL query statements to be executed.</p>
122 pub fn get_query_string(&self) -> &::std::option::Option<::std::string::String> {
123 self.inner.get_query_string()
124 }
125 /// <p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>StartQueryExecution</code> request is received, the same response is returned and another query is not created. An error is returned if a parameter, such as <code>QueryString</code>, has changed. A call to <code>StartQueryExecution</code> that uses a previous client request token returns the same <code>QueryExecutionId</code> even if the requester doesn't have permission on the tables specified in <code>QueryString</code>.</p><important>
126 /// <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p>
127 /// </important>
128 pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129 self.inner = self.inner.client_request_token(input.into());
130 self
131 }
132 /// <p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>StartQueryExecution</code> request is received, the same response is returned and another query is not created. An error is returned if a parameter, such as <code>QueryString</code>, has changed. A call to <code>StartQueryExecution</code> that uses a previous client request token returns the same <code>QueryExecutionId</code> even if the requester doesn't have permission on the tables specified in <code>QueryString</code>.</p><important>
133 /// <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p>
134 /// </important>
135 pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136 self.inner = self.inner.set_client_request_token(input);
137 self
138 }
139 /// <p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>StartQueryExecution</code> request is received, the same response is returned and another query is not created. An error is returned if a parameter, such as <code>QueryString</code>, has changed. A call to <code>StartQueryExecution</code> that uses a previous client request token returns the same <code>QueryExecutionId</code> even if the requester doesn't have permission on the tables specified in <code>QueryString</code>.</p><important>
140 /// <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p>
141 /// </important>
142 pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
143 self.inner.get_client_request_token()
144 }
145 /// <p>The database within which the query executes.</p>
146 pub fn query_execution_context(mut self, input: crate::types::QueryExecutionContext) -> Self {
147 self.inner = self.inner.query_execution_context(input);
148 self
149 }
150 /// <p>The database within which the query executes.</p>
151 pub fn set_query_execution_context(mut self, input: ::std::option::Option<crate::types::QueryExecutionContext>) -> Self {
152 self.inner = self.inner.set_query_execution_context(input);
153 self
154 }
155 /// <p>The database within which the query executes.</p>
156 pub fn get_query_execution_context(&self) -> &::std::option::Option<crate::types::QueryExecutionContext> {
157 self.inner.get_query_execution_context()
158 }
159 /// <p>Specifies information about where and how to save the results of the query execution. If the query runs in a workgroup, then workgroup's settings may override query settings. This affects the query results location. The workgroup settings override is specified in EnforceWorkGroupConfiguration (true/false) in the WorkGroupConfiguration. See <code>WorkGroupConfiguration$EnforceWorkGroupConfiguration</code>.</p>
160 pub fn result_configuration(mut self, input: crate::types::ResultConfiguration) -> Self {
161 self.inner = self.inner.result_configuration(input);
162 self
163 }
164 /// <p>Specifies information about where and how to save the results of the query execution. If the query runs in a workgroup, then workgroup's settings may override query settings. This affects the query results location. The workgroup settings override is specified in EnforceWorkGroupConfiguration (true/false) in the WorkGroupConfiguration. See <code>WorkGroupConfiguration$EnforceWorkGroupConfiguration</code>.</p>
165 pub fn set_result_configuration(mut self, input: ::std::option::Option<crate::types::ResultConfiguration>) -> Self {
166 self.inner = self.inner.set_result_configuration(input);
167 self
168 }
169 /// <p>Specifies information about where and how to save the results of the query execution. If the query runs in a workgroup, then workgroup's settings may override query settings. This affects the query results location. The workgroup settings override is specified in EnforceWorkGroupConfiguration (true/false) in the WorkGroupConfiguration. See <code>WorkGroupConfiguration$EnforceWorkGroupConfiguration</code>.</p>
170 pub fn get_result_configuration(&self) -> &::std::option::Option<crate::types::ResultConfiguration> {
171 self.inner.get_result_configuration()
172 }
173 /// <p>The name of the workgroup in which the query is being started.</p>
174 pub fn work_group(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175 self.inner = self.inner.work_group(input.into());
176 self
177 }
178 /// <p>The name of the workgroup in which the query is being started.</p>
179 pub fn set_work_group(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180 self.inner = self.inner.set_work_group(input);
181 self
182 }
183 /// <p>The name of the workgroup in which the query is being started.</p>
184 pub fn get_work_group(&self) -> &::std::option::Option<::std::string::String> {
185 self.inner.get_work_group()
186 }
187 ///
188 /// Appends an item to `ExecutionParameters`.
189 ///
190 /// To override the contents of this collection use [`set_execution_parameters`](Self::set_execution_parameters).
191 ///
192 /// <p>A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur.</p>
193 pub fn execution_parameters(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194 self.inner = self.inner.execution_parameters(input.into());
195 self
196 }
197 /// <p>A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur.</p>
198 pub fn set_execution_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
199 self.inner = self.inner.set_execution_parameters(input);
200 self
201 }
202 /// <p>A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur.</p>
203 pub fn get_execution_parameters(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
204 self.inner.get_execution_parameters()
205 }
206 /// <p>Specifies the query result reuse behavior for the query.</p>
207 pub fn result_reuse_configuration(mut self, input: crate::types::ResultReuseConfiguration) -> Self {
208 self.inner = self.inner.result_reuse_configuration(input);
209 self
210 }
211 /// <p>Specifies the query result reuse behavior for the query.</p>
212 pub fn set_result_reuse_configuration(mut self, input: ::std::option::Option<crate::types::ResultReuseConfiguration>) -> Self {
213 self.inner = self.inner.set_result_reuse_configuration(input);
214 self
215 }
216 /// <p>Specifies the query result reuse behavior for the query.</p>
217 pub fn get_result_reuse_configuration(&self) -> &::std::option::Option<crate::types::ResultReuseConfiguration> {
218 self.inner.get_result_reuse_configuration()
219 }
220}