aws_sdk_redshiftdata/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(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::batch_execute_statement::BatchExecuteStatementOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::batch_execute_statement::BatchExecuteStatementError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.batch_execute_statement();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `BatchExecuteStatement`.
24///
25/// <p>Runs one or more SQL statements, which can be data manipulation language (DML) or data definition language (DDL). 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 BatchExecuteStatementFluentBuilder {
43 handle: ::std::sync::Arc<crate::client::Handle>,
44 inner: crate::operation::batch_execute_statement::builders::BatchExecuteStatementInputBuilder,
45 config_override: ::std::option::Option<crate::config::Builder>,
46}
47impl
48 crate::client::customize::internal::CustomizableSend<
49 crate::operation::batch_execute_statement::BatchExecuteStatementOutput,
50 crate::operation::batch_execute_statement::BatchExecuteStatementError,
51 > for BatchExecuteStatementFluentBuilder
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::batch_execute_statement::BatchExecuteStatementOutput,
59 crate::operation::batch_execute_statement::BatchExecuteStatementError,
60 >,
61 > {
62 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
63 }
64}
65impl BatchExecuteStatementFluentBuilder {
66 /// Creates a new `BatchExecuteStatementFluentBuilder`.
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 BatchExecuteStatement as a reference.
75 pub fn as_input(&self) -> &crate::operation::batch_execute_statement::builders::BatchExecuteStatementInputBuilder {
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::batch_execute_statement::BatchExecuteStatementOutput,
90 ::aws_smithy_runtime_api::client::result::SdkError<
91 crate::operation::batch_execute_statement::BatchExecuteStatementError,
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::batch_execute_statement::BatchExecuteStatement::operation_runtime_plugins(
100 self.handle.runtime_plugins.clone(),
101 &self.handle.conf,
102 self.config_override,
103 );
104 crate::operation::batch_execute_statement::BatchExecuteStatement::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::batch_execute_statement::BatchExecuteStatementOutput,
112 crate::operation::batch_execute_statement::BatchExecuteStatementError,
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 ///
127 /// Appends an item to `Sqls`.
128 ///
129 /// To override the contents of this collection use [`set_sqls`](Self::set_sqls).
130 ///
131 /// <p>One or more SQL statements to run. The SQL statements are run as a single transaction. They run serially in the order of the array. Subsequent SQL statements don't start until the previous statement in the array completes. If any SQL statement fails, then because they are run as one transaction, all work is rolled back.</p>
132 pub fn sqls(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133 self.inner = self.inner.sqls(input.into());
134 self
135 }
136 /// <p>One or more SQL statements to run. The SQL statements are run as a single transaction. They run serially in the order of the array. Subsequent SQL statements don't start until the previous statement in the array completes. If any SQL statement fails, then because they are run as one transaction, all work is rolled back.</p>
137 pub fn set_sqls(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
138 self.inner = self.inner.set_sqls(input);
139 self
140 }
141 /// <p>One or more SQL statements to run. The SQL statements are run as a single transaction. They run serially in the order of the array. Subsequent SQL statements don't start until the previous statement in the array completes. If any SQL statement fails, then because they are run as one transaction, all work is rolled back.</p>
142 pub fn get_sqls(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
143 self.inner.get_sqls()
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 cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147 self.inner = self.inner.cluster_identifier(input.into());
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 set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152 self.inner = self.inner.set_cluster_identifier(input);
153 self
154 }
155 /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
156 pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
157 self.inner.get_cluster_identifier()
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 secret_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161 self.inner = self.inner.secret_arn(input.into());
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 set_secret_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166 self.inner = self.inner.set_secret_arn(input);
167 self
168 }
169 /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
170 pub fn get_secret_arn(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_secret_arn()
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 db_user(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175 self.inner = self.inner.db_user(input.into());
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 set_db_user(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180 self.inner = self.inner.set_db_user(input);
181 self
182 }
183 /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
184 pub fn get_db_user(&self) -> &::std::option::Option<::std::string::String> {
185 self.inner.get_db_user()
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 database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189 self.inner = self.inner.database(input.into());
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 set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194 self.inner = self.inner.set_database(input);
195 self
196 }
197 /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
198 pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
199 self.inner.get_database()
200 }
201 /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statements run.</p>
202 pub fn with_event(mut self, input: bool) -> Self {
203 self.inner = self.inner.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 statements run.</p>
207 pub fn set_with_event(mut self, input: ::std::option::Option<bool>) -> Self {
208 self.inner = self.inner.set_with_event(input);
209 self
210 }
211 /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statements run.</p>
212 pub fn get_with_event(&self) -> &::std::option::Option<bool> {
213 self.inner.get_with_event()
214 }
215 /// <p>The name of the SQL statements. You can name the SQL statements when you create them to identify the query.</p>
216 pub fn statement_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217 self.inner = self.inner.statement_name(input.into());
218 self
219 }
220 /// <p>The name of the SQL statements. You can name the SQL statements when you create them to identify the query.</p>
221 pub fn set_statement_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222 self.inner = self.inner.set_statement_name(input);
223 self
224 }
225 /// <p>The name of the SQL statements. You can name the SQL statements when you create them to identify the query.</p>
226 pub fn get_statement_name(&self) -> &::std::option::Option<::std::string::String> {
227 self.inner.get_statement_name()
228 }
229 /// <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>
230 pub fn workgroup_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
231 self.inner = self.inner.workgroup_name(input.into());
232 self
233 }
234 /// <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>
235 pub fn set_workgroup_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
236 self.inner = self.inner.set_workgroup_name(input);
237 self
238 }
239 /// <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>
240 pub fn get_workgroup_name(&self) -> &::std::option::Option<::std::string::String> {
241 self.inner.get_workgroup_name()
242 }
243 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
244 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
245 self.inner = self.inner.client_token(input.into());
246 self
247 }
248 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
249 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
250 self.inner = self.inner.set_client_token(input);
251 self
252 }
253 /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
254 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
255 self.inner.get_client_token()
256 }
257 /// <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>
258 pub fn session_keep_alive_seconds(mut self, input: i32) -> Self {
259 self.inner = self.inner.session_keep_alive_seconds(input);
260 self
261 }
262 /// <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>
263 pub fn set_session_keep_alive_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
264 self.inner = self.inner.set_session_keep_alive_seconds(input);
265 self
266 }
267 /// <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>
268 pub fn get_session_keep_alive_seconds(&self) -> &::std::option::Option<i32> {
269 self.inner.get_session_keep_alive_seconds()
270 }
271 /// <p>The session identifier of the query.</p>
272 pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
273 self.inner = self.inner.session_id(input.into());
274 self
275 }
276 /// <p>The session identifier of the query.</p>
277 pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
278 self.inner = self.inner.set_session_id(input);
279 self
280 }
281 /// <p>The session identifier of the query.</p>
282 pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
283 self.inner.get_session_id()
284 }
285 /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
286 pub fn result_format(mut self, input: crate::types::ResultFormatString) -> Self {
287 self.inner = self.inner.result_format(input);
288 self
289 }
290 /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
291 pub fn set_result_format(mut self, input: ::std::option::Option<crate::types::ResultFormatString>) -> Self {
292 self.inner = self.inner.set_result_format(input);
293 self
294 }
295 /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
296 pub fn get_result_format(&self) -> &::std::option::Option<crate::types::ResultFormatString> {
297 self.inner.get_result_format()
298 }
299}