Skip to main content

aws_sdk_redshiftdata/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_input::ExecuteStatementInputBuilder;
3
4pub use crate::operation::execute_statement::_execute_statement_output::ExecuteStatementOutputBuilder;
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>Runs an SQL statement, which can be data manipulation language (DML) or data definition language (DDL). This statement must be a single SQL statement. Depending on the authorization method, use one of the following combinations of request parameters:</p>
26/// <ul>
27/// <li>
28/// <p>Secrets Manager - when connecting to a cluster, provide the <code>secret-arn</code> of a secret stored in Secrets Manager which has <code>username</code> and <code>password</code>. The specified secret contains credentials to connect to the <code>database</code> you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (<code>dbClusterIdentifier</code>), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.</p></li>
29/// <li>
30/// <p>Temporary credentials - when connecting to your data warehouse, choose one of the following options:</p>
31/// <ul>
32/// <li>
33/// <p>When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, <code>arn:iam::123456789012:user:foo</code> has the database user name <code>IAM:foo</code>. Also, permission to call the <code>redshift-serverless:GetCredentials</code> operation is required.</p></li>
34/// <li>
35/// <p>When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, <code>arn:iam::123456789012:user:foo</code> has the database user name <code>IAM:foo</code>. Also, permission to call the <code>redshift:GetClusterCredentialsWithIAM</code> operation is required.</p></li>
36/// <li>
37/// <p>When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the <code>redshift:GetClusterCredentials</code> operation is required.</p></li>
38/// </ul></li>
39/// </ul>
40/// <p>For more information about the Amazon Redshift Data API and CLI usage examples, see <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/data-api.html">Using the Amazon Redshift Data API</a> in the <i>Amazon Redshift Management Guide</i>.</p>
41#[derive(::std::clone::Clone, ::std::fmt::Debug)]
42pub struct ExecuteStatementFluentBuilder {
43    handle: ::std::sync::Arc<crate::client::Handle>,
44    inner: crate::operation::execute_statement::builders::ExecuteStatementInputBuilder,
45    config_override: ::std::option::Option<crate::config::Builder>,
46}
47impl
48    crate::client::customize::internal::CustomizableSend<
49        crate::operation::execute_statement::ExecuteStatementOutput,
50        crate::operation::execute_statement::ExecuteStatementError,
51    > for ExecuteStatementFluentBuilder
52{
53    fn send(
54        self,
55        config_override: crate::config::Builder,
56    ) -> crate::client::customize::internal::BoxFuture<
57        crate::client::customize::internal::SendResult<
58            crate::operation::execute_statement::ExecuteStatementOutput,
59            crate::operation::execute_statement::ExecuteStatementError,
60        >,
61    > {
62        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
63    }
64}
65impl ExecuteStatementFluentBuilder {
66    /// Creates a new `ExecuteStatementFluentBuilder`.
67    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
68        Self {
69            handle,
70            inner: ::std::default::Default::default(),
71            config_override: ::std::option::Option::None,
72        }
73    }
74    /// Access the ExecuteStatement as a reference.
75    pub fn as_input(&self) -> &crate::operation::execute_statement::builders::ExecuteStatementInputBuilder {
76        &self.inner
77    }
78    /// Sends the request and returns the response.
79    ///
80    /// If an error occurs, an `SdkError` will be returned with additional details that
81    /// can be matched against.
82    ///
83    /// By default, any retryable failures will be retried twice. Retry behavior
84    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
85    /// set when configuring the client.
86    pub async fn send(
87        self,
88    ) -> ::std::result::Result<
89        crate::operation::execute_statement::ExecuteStatementOutput,
90        ::aws_smithy_runtime_api::client::result::SdkError<
91            crate::operation::execute_statement::ExecuteStatementError,
92            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
93        >,
94    > {
95        let input = self
96            .inner
97            .build()
98            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
99        let runtime_plugins = crate::operation::execute_statement::ExecuteStatement::operation_runtime_plugins(
100            self.handle.runtime_plugins.clone(),
101            &self.handle.conf,
102            self.config_override,
103        );
104        crate::operation::execute_statement::ExecuteStatement::orchestrate(&runtime_plugins, input).await
105    }
106
107    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
108    pub fn customize(
109        self,
110    ) -> crate::client::customize::CustomizableOperation<
111        crate::operation::execute_statement::ExecuteStatementOutput,
112        crate::operation::execute_statement::ExecuteStatementError,
113        Self,
114    > {
115        crate::client::customize::CustomizableOperation::new(self)
116    }
117    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
118        self.set_config_override(::std::option::Option::Some(config_override.into()));
119        self
120    }
121
122    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
123        self.config_override = config_override;
124        self
125    }
126    /// <p>The SQL statement text to run.</p>
127    pub fn sql(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.sql(input.into());
129        self
130    }
131    /// <p>The SQL statement text to run.</p>
132    pub fn set_sql(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_sql(input);
134        self
135    }
136    /// <p>The SQL statement text to run.</p>
137    pub fn get_sql(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_sql()
139    }
140    /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
141    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.inner = self.inner.cluster_identifier(input.into());
143        self
144    }
145    /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
146    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_cluster_identifier(input);
148        self
149    }
150    /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
151    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
152        self.inner.get_cluster_identifier()
153    }
154    /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
155    pub fn secret_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.inner = self.inner.secret_arn(input.into());
157        self
158    }
159    /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
160    pub fn set_secret_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.inner = self.inner.set_secret_arn(input);
162        self
163    }
164    /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
165    pub fn get_secret_arn(&self) -> &::std::option::Option<::std::string::String> {
166        self.inner.get_secret_arn()
167    }
168    /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
169    pub fn db_user(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170        self.inner = self.inner.db_user(input.into());
171        self
172    }
173    /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
174    pub fn set_db_user(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175        self.inner = self.inner.set_db_user(input);
176        self
177    }
178    /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
179    pub fn get_db_user(&self) -> &::std::option::Option<::std::string::String> {
180        self.inner.get_db_user()
181    }
182    /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
183    pub fn database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184        self.inner = self.inner.database(input.into());
185        self
186    }
187    /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
188    pub fn set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189        self.inner = self.inner.set_database(input);
190        self
191    }
192    /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
193    pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
194        self.inner.get_database()
195    }
196    /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.</p>
197    pub fn with_event(mut self, input: bool) -> Self {
198        self.inner = self.inner.with_event(input);
199        self
200    }
201    /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.</p>
202    pub fn set_with_event(mut self, input: ::std::option::Option<bool>) -> Self {
203        self.inner = self.inner.set_with_event(input);
204        self
205    }
206    /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.</p>
207    pub fn get_with_event(&self) -> &::std::option::Option<bool> {
208        self.inner.get_with_event()
209    }
210    /// <p>The name of the SQL statement. You can name the SQL statement when you create it to identify the query.</p>
211    pub fn statement_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
212        self.inner = self.inner.statement_name(input.into());
213        self
214    }
215    /// <p>The name of the SQL statement. You can name the SQL statement when you create it to identify the query.</p>
216    pub fn set_statement_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
217        self.inner = self.inner.set_statement_name(input);
218        self
219    }
220    /// <p>The name of the SQL statement. You can name the SQL statement when you create it to identify the query.</p>
221    pub fn get_statement_name(&self) -> &::std::option::Option<::std::string::String> {
222        self.inner.get_statement_name()
223    }
224    ///
225    /// Appends an item to `Parameters`.
226    ///
227    /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
228    ///
229    /// <p>The parameters for the SQL statement.</p>
230    pub fn parameters(mut self, input: crate::types::SqlParameter) -> Self {
231        self.inner = self.inner.parameters(input);
232        self
233    }
234    /// <p>The parameters for the SQL statement.</p>
235    pub fn set_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>>) -> Self {
236        self.inner = self.inner.set_parameters(input);
237        self
238    }
239    /// <p>The parameters for the SQL statement.</p>
240    pub fn get_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>> {
241        self.inner.get_parameters()
242    }
243    /// <p>The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.</p>
244    pub fn workgroup_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
245        self.inner = self.inner.workgroup_name(input.into());
246        self
247    }
248    /// <p>The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.</p>
249    pub fn set_workgroup_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
250        self.inner = self.inner.set_workgroup_name(input);
251        self
252    }
253    /// <p>The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.</p>
254    pub fn get_workgroup_name(&self) -> &::std::option::Option<::std::string::String> {
255        self.inner.get_workgroup_name()
256    }
257    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
258    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
259        self.inner = self.inner.client_token(input.into());
260        self
261    }
262    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
263    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
264        self.inner = self.inner.set_client_token(input);
265        self
266    }
267    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
268    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
269        self.inner.get_client_token()
270    }
271    /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
272    pub fn result_format(mut self, input: crate::types::ResultFormatString) -> Self {
273        self.inner = self.inner.result_format(input);
274        self
275    }
276    /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
277    pub fn set_result_format(mut self, input: ::std::option::Option<crate::types::ResultFormatString>) -> Self {
278        self.inner = self.inner.set_result_format(input);
279        self
280    }
281    /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
282    pub fn get_result_format(&self) -> &::std::option::Option<crate::types::ResultFormatString> {
283        self.inner.get_result_format()
284    }
285    /// <p>The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.</p>
286    pub fn session_keep_alive_seconds(mut self, input: i32) -> Self {
287        self.inner = self.inner.session_keep_alive_seconds(input);
288        self
289    }
290    /// <p>The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.</p>
291    pub fn set_session_keep_alive_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
292        self.inner = self.inner.set_session_keep_alive_seconds(input);
293        self
294    }
295    /// <p>The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.</p>
296    pub fn get_session_keep_alive_seconds(&self) -> &::std::option::Option<i32> {
297        self.inner.get_session_keep_alive_seconds()
298    }
299    /// <p>The session identifier of the query.</p>
300    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
301        self.inner = self.inner.session_id(input.into());
302        self
303    }
304    /// <p>The session identifier of the query.</p>
305    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
306        self.inner = self.inner.set_session_id(input);
307        self
308    }
309    /// <p>The session identifier of the query.</p>
310    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
311        self.inner.get_session_id()
312    }
313    /// <p>The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.</p>
314    pub fn wait_time_seconds(mut self, input: i32) -> Self {
315        self.inner = self.inner.wait_time_seconds(input);
316        self
317    }
318    /// <p>The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.</p>
319    pub fn set_wait_time_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
320        self.inner = self.inner.set_wait_time_seconds(input);
321        self
322    }
323    /// <p>The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.</p>
324    pub fn get_wait_time_seconds(&self) -> &::std::option::Option<i32> {
325        self.inner.get_wait_time_seconds()
326    }
327}