aws_sdk_rdsdata/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 a SQL statement against a database.</p><note>
26/// <p>If a call isn't part of a transaction because it doesn't include the <code>transactionID</code> parameter, changes that result from the call are committed automatically.</p>
27/// <p>If the binary response data from the database is more than 1 MB, the call is terminated.</p>
28/// </note>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct ExecuteStatementFluentBuilder {
31 handle: ::std::sync::Arc<crate::client::Handle>,
32 inner: crate::operation::execute_statement::builders::ExecuteStatementInputBuilder,
33 config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36 crate::client::customize::internal::CustomizableSend<
37 crate::operation::execute_statement::ExecuteStatementOutput,
38 crate::operation::execute_statement::ExecuteStatementError,
39 > for ExecuteStatementFluentBuilder
40{
41 fn send(
42 self,
43 config_override: crate::config::Builder,
44 ) -> crate::client::customize::internal::BoxFuture<
45 crate::client::customize::internal::SendResult<
46 crate::operation::execute_statement::ExecuteStatementOutput,
47 crate::operation::execute_statement::ExecuteStatementError,
48 >,
49 > {
50 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51 }
52}
53impl ExecuteStatementFluentBuilder {
54 /// Creates a new `ExecuteStatementFluentBuilder`.
55 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56 Self {
57 handle,
58 inner: ::std::default::Default::default(),
59 config_override: ::std::option::Option::None,
60 }
61 }
62 /// Access the ExecuteStatement as a reference.
63 pub fn as_input(&self) -> &crate::operation::execute_statement::builders::ExecuteStatementInputBuilder {
64 &self.inner
65 }
66 /// Sends the request and returns the response.
67 ///
68 /// If an error occurs, an `SdkError` will be returned with additional details that
69 /// can be matched against.
70 ///
71 /// By default, any retryable failures will be retried twice. Retry behavior
72 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73 /// set when configuring the client.
74 pub async fn send(
75 self,
76 ) -> ::std::result::Result<
77 crate::operation::execute_statement::ExecuteStatementOutput,
78 ::aws_smithy_runtime_api::client::result::SdkError<
79 crate::operation::execute_statement::ExecuteStatementError,
80 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81 >,
82 > {
83 let input = self
84 .inner
85 .build()
86 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87 let runtime_plugins = crate::operation::execute_statement::ExecuteStatement::operation_runtime_plugins(
88 self.handle.runtime_plugins.clone(),
89 &self.handle.conf,
90 self.config_override,
91 );
92 crate::operation::execute_statement::ExecuteStatement::orchestrate(&runtime_plugins, input).await
93 }
94
95 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96 pub fn customize(
97 self,
98 ) -> crate::client::customize::CustomizableOperation<
99 crate::operation::execute_statement::ExecuteStatementOutput,
100 crate::operation::execute_statement::ExecuteStatementError,
101 Self,
102 > {
103 crate::client::customize::CustomizableOperation::new(self)
104 }
105 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106 self.set_config_override(::std::option::Option::Some(config_override.into()));
107 self
108 }
109
110 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111 self.config_override = config_override;
112 self
113 }
114 /// <p>The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.</p>
115 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116 self.inner = self.inner.resource_arn(input.into());
117 self
118 }
119 /// <p>The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.</p>
120 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121 self.inner = self.inner.set_resource_arn(input);
122 self
123 }
124 /// <p>The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.</p>
125 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
126 self.inner.get_resource_arn()
127 }
128 /// <p>The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the credentials in the secret.</p>
129 /// <p>For information about creating the secret, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_database_secret.html">Create a database secret</a>.</p><note>
130 /// <p>When you use the CLI on Linux to reference a secret created in the RDS console, the ARN might include special characters like <code>rds!cluster</code>. If you enclose the ARN in double quotes, the <code>!</code> character might trigger a shell expansion error, such as <code>-bash: !cluster: event not found</code>. To avoid this, escape the exclamation mark (\!) in the ARN or enclose the entire ARN in single quotes (') instead of double quotes.</p>
131 /// <p>Alternatively, disable shell history expansion by running <code>set +H</code> before you execute the command.</p>
132 /// </note>
133 pub fn secret_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.inner = self.inner.secret_arn(input.into());
135 self
136 }
137 /// <p>The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the credentials in the secret.</p>
138 /// <p>For information about creating the secret, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_database_secret.html">Create a database secret</a>.</p><note>
139 /// <p>When you use the CLI on Linux to reference a secret created in the RDS console, the ARN might include special characters like <code>rds!cluster</code>. If you enclose the ARN in double quotes, the <code>!</code> character might trigger a shell expansion error, such as <code>-bash: !cluster: event not found</code>. To avoid this, escape the exclamation mark (\!) in the ARN or enclose the entire ARN in single quotes (') instead of double quotes.</p>
140 /// <p>Alternatively, disable shell history expansion by running <code>set +H</code> before you execute the command.</p>
141 /// </note>
142 pub fn set_secret_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143 self.inner = self.inner.set_secret_arn(input);
144 self
145 }
146 /// <p>The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the credentials in the secret.</p>
147 /// <p>For information about creating the secret, see <a href="https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_database_secret.html">Create a database secret</a>.</p><note>
148 /// <p>When you use the CLI on Linux to reference a secret created in the RDS console, the ARN might include special characters like <code>rds!cluster</code>. If you enclose the ARN in double quotes, the <code>!</code> character might trigger a shell expansion error, such as <code>-bash: !cluster: event not found</code>. To avoid this, escape the exclamation mark (\!) in the ARN or enclose the entire ARN in single quotes (') instead of double quotes.</p>
149 /// <p>Alternatively, disable shell history expansion by running <code>set +H</code> before you execute the command.</p>
150 /// </note>
151 pub fn get_secret_arn(&self) -> &::std::option::Option<::std::string::String> {
152 self.inner.get_secret_arn()
153 }
154 /// <p>The SQL statement to run.</p>
155 pub fn sql(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156 self.inner = self.inner.sql(input.into());
157 self
158 }
159 /// <p>The SQL statement to run.</p>
160 pub fn set_sql(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161 self.inner = self.inner.set_sql(input);
162 self
163 }
164 /// <p>The SQL statement to run.</p>
165 pub fn get_sql(&self) -> &::std::option::Option<::std::string::String> {
166 self.inner.get_sql()
167 }
168 /// <p>The name of the database.</p>
169 pub fn database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170 self.inner = self.inner.database(input.into());
171 self
172 }
173 /// <p>The name of the database.</p>
174 pub fn set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175 self.inner = self.inner.set_database(input);
176 self
177 }
178 /// <p>The name of the database.</p>
179 pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
180 self.inner.get_database()
181 }
182 /// <p>The name of the database schema.</p><note>
183 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
184 /// </note>
185 pub fn schema(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186 self.inner = self.inner.schema(input.into());
187 self
188 }
189 /// <p>The name of the database schema.</p><note>
190 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
191 /// </note>
192 pub fn set_schema(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
193 self.inner = self.inner.set_schema(input);
194 self
195 }
196 /// <p>The name of the database schema.</p><note>
197 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
198 /// </note>
199 pub fn get_schema(&self) -> &::std::option::Option<::std::string::String> {
200 self.inner.get_schema()
201 }
202 ///
203 /// Appends an item to `parameters`.
204 ///
205 /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
206 ///
207 /// <p>The parameters for the SQL statement.</p><note>
208 /// <p>Array parameters are not supported.</p>
209 /// </note>
210 pub fn parameters(mut self, input: crate::types::SqlParameter) -> Self {
211 self.inner = self.inner.parameters(input);
212 self
213 }
214 /// <p>The parameters for the SQL statement.</p><note>
215 /// <p>Array parameters are not supported.</p>
216 /// </note>
217 pub fn set_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>>) -> Self {
218 self.inner = self.inner.set_parameters(input);
219 self
220 }
221 /// <p>The parameters for the SQL statement.</p><note>
222 /// <p>Array parameters are not supported.</p>
223 /// </note>
224 pub fn get_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>> {
225 self.inner.get_parameters()
226 }
227 /// <p>The identifier of a transaction that was started by using the <code>BeginTransaction</code> operation. Specify the transaction ID of the transaction that you want to include the SQL statement in.</p>
228 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
229 pub fn transaction_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
230 self.inner = self.inner.transaction_id(input.into());
231 self
232 }
233 /// <p>The identifier of a transaction that was started by using the <code>BeginTransaction</code> operation. Specify the transaction ID of the transaction that you want to include the SQL statement in.</p>
234 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
235 pub fn set_transaction_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
236 self.inner = self.inner.set_transaction_id(input);
237 self
238 }
239 /// <p>The identifier of a transaction that was started by using the <code>BeginTransaction</code> operation. Specify the transaction ID of the transaction that you want to include the SQL statement in.</p>
240 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
241 pub fn get_transaction_id(&self) -> &::std::option::Option<::std::string::String> {
242 self.inner.get_transaction_id()
243 }
244 /// <p>A value that indicates whether to include metadata in the results.</p>
245 pub fn include_result_metadata(mut self, input: bool) -> Self {
246 self.inner = self.inner.include_result_metadata(input);
247 self
248 }
249 /// <p>A value that indicates whether to include metadata in the results.</p>
250 pub fn set_include_result_metadata(mut self, input: ::std::option::Option<bool>) -> Self {
251 self.inner = self.inner.set_include_result_metadata(input);
252 self
253 }
254 /// <p>A value that indicates whether to include metadata in the results.</p>
255 pub fn get_include_result_metadata(&self) -> &::std::option::Option<bool> {
256 self.inner.get_include_result_metadata()
257 }
258 /// <p>A value that indicates whether to continue running the statement after the call times out. By default, the statement stops running when the call times out.</p><note>
259 /// <p>For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.</p>
260 /// </note>
261 pub fn continue_after_timeout(mut self, input: bool) -> Self {
262 self.inner = self.inner.continue_after_timeout(input);
263 self
264 }
265 /// <p>A value that indicates whether to continue running the statement after the call times out. By default, the statement stops running when the call times out.</p><note>
266 /// <p>For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.</p>
267 /// </note>
268 pub fn set_continue_after_timeout(mut self, input: ::std::option::Option<bool>) -> Self {
269 self.inner = self.inner.set_continue_after_timeout(input);
270 self
271 }
272 /// <p>A value that indicates whether to continue running the statement after the call times out. By default, the statement stops running when the call times out.</p><note>
273 /// <p>For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.</p>
274 /// </note>
275 pub fn get_continue_after_timeout(&self) -> &::std::option::Option<bool> {
276 self.inner.get_continue_after_timeout()
277 }
278 /// <p>Options that control how the result set is returned.</p>
279 pub fn result_set_options(mut self, input: crate::types::ResultSetOptions) -> Self {
280 self.inner = self.inner.result_set_options(input);
281 self
282 }
283 /// <p>Options that control how the result set is returned.</p>
284 pub fn set_result_set_options(mut self, input: ::std::option::Option<crate::types::ResultSetOptions>) -> Self {
285 self.inner = self.inner.set_result_set_options(input);
286 self
287 }
288 /// <p>Options that control how the result set is returned.</p>
289 pub fn get_result_set_options(&self) -> &::std::option::Option<crate::types::ResultSetOptions> {
290 self.inner.get_result_set_options()
291 }
292 /// <p>A value that indicates whether to format the result set as a single JSON string. This parameter only applies to <code>SELECT</code> statements and is ignored for other types of statements. Allowed values are <code>NONE</code> and <code>JSON</code>. The default value is <code>NONE</code>. The result is returned in the <code>formattedRecords</code> field.</p>
293 /// <p>For usage information about the JSON format for result sets, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html">Using the Data API</a> in the <i>Amazon Aurora User Guide</i>.</p>
294 pub fn format_records_as(mut self, input: crate::types::RecordsFormatType) -> Self {
295 self.inner = self.inner.format_records_as(input);
296 self
297 }
298 /// <p>A value that indicates whether to format the result set as a single JSON string. This parameter only applies to <code>SELECT</code> statements and is ignored for other types of statements. Allowed values are <code>NONE</code> and <code>JSON</code>. The default value is <code>NONE</code>. The result is returned in the <code>formattedRecords</code> field.</p>
299 /// <p>For usage information about the JSON format for result sets, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html">Using the Data API</a> in the <i>Amazon Aurora User Guide</i>.</p>
300 pub fn set_format_records_as(mut self, input: ::std::option::Option<crate::types::RecordsFormatType>) -> Self {
301 self.inner = self.inner.set_format_records_as(input);
302 self
303 }
304 /// <p>A value that indicates whether to format the result set as a single JSON string. This parameter only applies to <code>SELECT</code> statements and is ignored for other types of statements. Allowed values are <code>NONE</code> and <code>JSON</code>. The default value is <code>NONE</code>. The result is returned in the <code>formattedRecords</code> field.</p>
305 /// <p>For usage information about the JSON format for result sets, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html">Using the Data API</a> in the <i>Amazon Aurora User Guide</i>.</p>
306 pub fn get_format_records_as(&self) -> &::std::option::Option<crate::types::RecordsFormatType> {
307 self.inner.get_format_records_as()
308 }
309}