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_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>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>
130 pub fn secret_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.inner = self.inner.secret_arn(input.into());
132 self
133 }
134 /// <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>
135 /// <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>
136 pub fn set_secret_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137 self.inner = self.inner.set_secret_arn(input);
138 self
139 }
140 /// <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>
141 /// <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>
142 pub fn get_secret_arn(&self) -> &::std::option::Option<::std::string::String> {
143 self.inner.get_secret_arn()
144 }
145 /// <p>The SQL statement to run.</p>
146 pub fn sql(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147 self.inner = self.inner.sql(input.into());
148 self
149 }
150 /// <p>The SQL statement to run.</p>
151 pub fn set_sql(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152 self.inner = self.inner.set_sql(input);
153 self
154 }
155 /// <p>The SQL statement to run.</p>
156 pub fn get_sql(&self) -> &::std::option::Option<::std::string::String> {
157 self.inner.get_sql()
158 }
159 /// <p>The name of the database.</p>
160 pub fn database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161 self.inner = self.inner.database(input.into());
162 self
163 }
164 /// <p>The name of the database.</p>
165 pub fn set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166 self.inner = self.inner.set_database(input);
167 self
168 }
169 /// <p>The name of the database.</p>
170 pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_database()
172 }
173 /// <p>The name of the database schema.</p><note>
174 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
175 /// </note>
176 pub fn schema(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177 self.inner = self.inner.schema(input.into());
178 self
179 }
180 /// <p>The name of the database schema.</p><note>
181 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
182 /// </note>
183 pub fn set_schema(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
184 self.inner = self.inner.set_schema(input);
185 self
186 }
187 /// <p>The name of the database schema.</p><note>
188 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
189 /// </note>
190 pub fn get_schema(&self) -> &::std::option::Option<::std::string::String> {
191 self.inner.get_schema()
192 }
193 ///
194 /// Appends an item to `parameters`.
195 ///
196 /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
197 ///
198 /// <p>The parameters for the SQL statement.</p><note>
199 /// <p>Array parameters are not supported.</p>
200 /// </note>
201 pub fn parameters(mut self, input: crate::types::SqlParameter) -> Self {
202 self.inner = self.inner.parameters(input);
203 self
204 }
205 /// <p>The parameters for the SQL statement.</p><note>
206 /// <p>Array parameters are not supported.</p>
207 /// </note>
208 pub fn set_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>>) -> Self {
209 self.inner = self.inner.set_parameters(input);
210 self
211 }
212 /// <p>The parameters for the SQL statement.</p><note>
213 /// <p>Array parameters are not supported.</p>
214 /// </note>
215 pub fn get_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>> {
216 self.inner.get_parameters()
217 }
218 /// <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>
219 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
220 pub fn transaction_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
221 self.inner = self.inner.transaction_id(input.into());
222 self
223 }
224 /// <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>
225 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
226 pub fn set_transaction_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
227 self.inner = self.inner.set_transaction_id(input);
228 self
229 }
230 /// <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>
231 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
232 pub fn get_transaction_id(&self) -> &::std::option::Option<::std::string::String> {
233 self.inner.get_transaction_id()
234 }
235 /// <p>A value that indicates whether to include metadata in the results.</p>
236 pub fn include_result_metadata(mut self, input: bool) -> Self {
237 self.inner = self.inner.include_result_metadata(input);
238 self
239 }
240 /// <p>A value that indicates whether to include metadata in the results.</p>
241 pub fn set_include_result_metadata(mut self, input: ::std::option::Option<bool>) -> Self {
242 self.inner = self.inner.set_include_result_metadata(input);
243 self
244 }
245 /// <p>A value that indicates whether to include metadata in the results.</p>
246 pub fn get_include_result_metadata(&self) -> &::std::option::Option<bool> {
247 self.inner.get_include_result_metadata()
248 }
249 /// <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>
250 /// <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>
251 /// </note>
252 pub fn continue_after_timeout(mut self, input: bool) -> Self {
253 self.inner = self.inner.continue_after_timeout(input);
254 self
255 }
256 /// <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>
257 /// <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>
258 /// </note>
259 pub fn set_continue_after_timeout(mut self, input: ::std::option::Option<bool>) -> Self {
260 self.inner = self.inner.set_continue_after_timeout(input);
261 self
262 }
263 /// <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>
264 /// <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>
265 /// </note>
266 pub fn get_continue_after_timeout(&self) -> &::std::option::Option<bool> {
267 self.inner.get_continue_after_timeout()
268 }
269 /// <p>Options that control how the result set is returned.</p>
270 pub fn result_set_options(mut self, input: crate::types::ResultSetOptions) -> Self {
271 self.inner = self.inner.result_set_options(input);
272 self
273 }
274 /// <p>Options that control how the result set is returned.</p>
275 pub fn set_result_set_options(mut self, input: ::std::option::Option<crate::types::ResultSetOptions>) -> Self {
276 self.inner = self.inner.set_result_set_options(input);
277 self
278 }
279 /// <p>Options that control how the result set is returned.</p>
280 pub fn get_result_set_options(&self) -> &::std::option::Option<crate::types::ResultSetOptions> {
281 self.inner.get_result_set_options()
282 }
283 /// <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>
284 /// <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>
285 pub fn format_records_as(mut self, input: crate::types::RecordsFormatType) -> Self {
286 self.inner = self.inner.format_records_as(input);
287 self
288 }
289 /// <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>
290 /// <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>
291 pub fn set_format_records_as(mut self, input: ::std::option::Option<crate::types::RecordsFormatType>) -> Self {
292 self.inner = self.inner.set_format_records_as(input);
293 self
294 }
295 /// <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>
296 /// <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>
297 pub fn get_format_records_as(&self) -> &::std::option::Option<crate::types::RecordsFormatType> {
298 self.inner.get_format_records_as()
299 }
300}