aws_sdk_rdsdata/operation/execute_statement/_execute_statement_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The request parameters represent the input of a request to run a SQL statement against a database.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ExecuteStatementInput {
7 /// <p>The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.</p>
8 pub resource_arn: ::std::option::Option<::std::string::String>,
9 /// <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>
10 /// <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>
11 /// <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>
12 /// <p>Alternatively, disable shell history expansion by running <code>set +H</code> before you execute the command.</p>
13 /// </note>
14 pub secret_arn: ::std::option::Option<::std::string::String>,
15 /// <p>The SQL statement to run.</p>
16 pub sql: ::std::option::Option<::std::string::String>,
17 /// <p>The name of the database.</p>
18 pub database: ::std::option::Option<::std::string::String>,
19 /// <p>The name of the database schema.</p><note>
20 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
21 /// </note>
22 pub schema: ::std::option::Option<::std::string::String>,
23 /// <p>The parameters for the SQL statement.</p><note>
24 /// <p>Array parameters are not supported.</p>
25 /// </note>
26 pub parameters: ::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>>,
27 /// <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>
28 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
29 pub transaction_id: ::std::option::Option<::std::string::String>,
30 /// <p>A value that indicates whether to include metadata in the results.</p>
31 pub include_result_metadata: ::std::option::Option<bool>,
32 /// <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>
33 /// <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>
34 /// </note>
35 pub continue_after_timeout: ::std::option::Option<bool>,
36 /// <p>Options that control how the result set is returned.</p>
37 pub result_set_options: ::std::option::Option<crate::types::ResultSetOptions>,
38 /// <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>
39 /// <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>
40 pub format_records_as: ::std::option::Option<crate::types::RecordsFormatType>,
41}
42impl ExecuteStatementInput {
43 /// <p>The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.</p>
44 pub fn resource_arn(&self) -> ::std::option::Option<&str> {
45 self.resource_arn.as_deref()
46 }
47 /// <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>
48 /// <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>
49 /// <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>
50 /// <p>Alternatively, disable shell history expansion by running <code>set +H</code> before you execute the command.</p>
51 /// </note>
52 pub fn secret_arn(&self) -> ::std::option::Option<&str> {
53 self.secret_arn.as_deref()
54 }
55 /// <p>The SQL statement to run.</p>
56 pub fn sql(&self) -> ::std::option::Option<&str> {
57 self.sql.as_deref()
58 }
59 /// <p>The name of the database.</p>
60 pub fn database(&self) -> ::std::option::Option<&str> {
61 self.database.as_deref()
62 }
63 /// <p>The name of the database schema.</p><note>
64 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
65 /// </note>
66 pub fn schema(&self) -> ::std::option::Option<&str> {
67 self.schema.as_deref()
68 }
69 /// <p>The parameters for the SQL statement.</p><note>
70 /// <p>Array parameters are not supported.</p>
71 /// </note>
72 ///
73 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.parameters.is_none()`.
74 pub fn parameters(&self) -> &[crate::types::SqlParameter] {
75 self.parameters.as_deref().unwrap_or_default()
76 }
77 /// <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>
78 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
79 pub fn transaction_id(&self) -> ::std::option::Option<&str> {
80 self.transaction_id.as_deref()
81 }
82 /// <p>A value that indicates whether to include metadata in the results.</p>
83 pub fn include_result_metadata(&self) -> ::std::option::Option<bool> {
84 self.include_result_metadata
85 }
86 /// <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>
87 /// <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>
88 /// </note>
89 pub fn continue_after_timeout(&self) -> ::std::option::Option<bool> {
90 self.continue_after_timeout
91 }
92 /// <p>Options that control how the result set is returned.</p>
93 pub fn result_set_options(&self) -> ::std::option::Option<&crate::types::ResultSetOptions> {
94 self.result_set_options.as_ref()
95 }
96 /// <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>
97 /// <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>
98 pub fn format_records_as(&self) -> ::std::option::Option<&crate::types::RecordsFormatType> {
99 self.format_records_as.as_ref()
100 }
101}
102impl ExecuteStatementInput {
103 /// Creates a new builder-style object to manufacture [`ExecuteStatementInput`](crate::operation::execute_statement::ExecuteStatementInput).
104 pub fn builder() -> crate::operation::execute_statement::builders::ExecuteStatementInputBuilder {
105 crate::operation::execute_statement::builders::ExecuteStatementInputBuilder::default()
106 }
107}
108
109/// A builder for [`ExecuteStatementInput`](crate::operation::execute_statement::ExecuteStatementInput).
110#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
111#[non_exhaustive]
112pub struct ExecuteStatementInputBuilder {
113 pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
114 pub(crate) secret_arn: ::std::option::Option<::std::string::String>,
115 pub(crate) sql: ::std::option::Option<::std::string::String>,
116 pub(crate) database: ::std::option::Option<::std::string::String>,
117 pub(crate) schema: ::std::option::Option<::std::string::String>,
118 pub(crate) parameters: ::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>>,
119 pub(crate) transaction_id: ::std::option::Option<::std::string::String>,
120 pub(crate) include_result_metadata: ::std::option::Option<bool>,
121 pub(crate) continue_after_timeout: ::std::option::Option<bool>,
122 pub(crate) result_set_options: ::std::option::Option<crate::types::ResultSetOptions>,
123 pub(crate) format_records_as: ::std::option::Option<crate::types::RecordsFormatType>,
124}
125impl ExecuteStatementInputBuilder {
126 /// <p>The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.</p>
127 /// This field is required.
128 pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129 self.resource_arn = ::std::option::Option::Some(input.into());
130 self
131 }
132 /// <p>The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.</p>
133 pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134 self.resource_arn = input;
135 self
136 }
137 /// <p>The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.</p>
138 pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
139 &self.resource_arn
140 }
141 /// <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>
142 /// <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>
143 /// <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>
144 /// <p>Alternatively, disable shell history expansion by running <code>set +H</code> before you execute the command.</p>
145 /// </note>
146 /// This field is required.
147 pub fn secret_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148 self.secret_arn = ::std::option::Option::Some(input.into());
149 self
150 }
151 /// <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>
152 /// <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>
153 /// <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>
154 /// <p>Alternatively, disable shell history expansion by running <code>set +H</code> before you execute the command.</p>
155 /// </note>
156 pub fn set_secret_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157 self.secret_arn = input;
158 self
159 }
160 /// <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>
161 /// <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>
162 /// <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>
163 /// <p>Alternatively, disable shell history expansion by running <code>set +H</code> before you execute the command.</p>
164 /// </note>
165 pub fn get_secret_arn(&self) -> &::std::option::Option<::std::string::String> {
166 &self.secret_arn
167 }
168 /// <p>The SQL statement to run.</p>
169 /// This field is required.
170 pub fn sql(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
171 self.sql = ::std::option::Option::Some(input.into());
172 self
173 }
174 /// <p>The SQL statement to run.</p>
175 pub fn set_sql(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
176 self.sql = input;
177 self
178 }
179 /// <p>The SQL statement to run.</p>
180 pub fn get_sql(&self) -> &::std::option::Option<::std::string::String> {
181 &self.sql
182 }
183 /// <p>The name of the database.</p>
184 pub fn database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
185 self.database = ::std::option::Option::Some(input.into());
186 self
187 }
188 /// <p>The name of the database.</p>
189 pub fn set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
190 self.database = input;
191 self
192 }
193 /// <p>The name of the database.</p>
194 pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
195 &self.database
196 }
197 /// <p>The name of the database schema.</p><note>
198 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
199 /// </note>
200 pub fn schema(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
201 self.schema = ::std::option::Option::Some(input.into());
202 self
203 }
204 /// <p>The name of the database schema.</p><note>
205 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
206 /// </note>
207 pub fn set_schema(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
208 self.schema = input;
209 self
210 }
211 /// <p>The name of the database schema.</p><note>
212 /// <p>Currently, the <code>schema</code> parameter isn't supported.</p>
213 /// </note>
214 pub fn get_schema(&self) -> &::std::option::Option<::std::string::String> {
215 &self.schema
216 }
217 /// Appends an item to `parameters`.
218 ///
219 /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
220 ///
221 /// <p>The parameters for the SQL statement.</p><note>
222 /// <p>Array parameters are not supported.</p>
223 /// </note>
224 pub fn parameters(mut self, input: crate::types::SqlParameter) -> Self {
225 let mut v = self.parameters.unwrap_or_default();
226 v.push(input);
227 self.parameters = ::std::option::Option::Some(v);
228 self
229 }
230 /// <p>The parameters for the SQL statement.</p><note>
231 /// <p>Array parameters are not supported.</p>
232 /// </note>
233 pub fn set_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>>) -> Self {
234 self.parameters = input;
235 self
236 }
237 /// <p>The parameters for the SQL statement.</p><note>
238 /// <p>Array parameters are not supported.</p>
239 /// </note>
240 pub fn get_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>> {
241 &self.parameters
242 }
243 /// <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>
244 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
245 pub fn transaction_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246 self.transaction_id = ::std::option::Option::Some(input.into());
247 self
248 }
249 /// <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>
250 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
251 pub fn set_transaction_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
252 self.transaction_id = input;
253 self
254 }
255 /// <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>
256 /// <p>If the SQL statement is not part of a transaction, don't set this parameter.</p>
257 pub fn get_transaction_id(&self) -> &::std::option::Option<::std::string::String> {
258 &self.transaction_id
259 }
260 /// <p>A value that indicates whether to include metadata in the results.</p>
261 pub fn include_result_metadata(mut self, input: bool) -> Self {
262 self.include_result_metadata = ::std::option::Option::Some(input);
263 self
264 }
265 /// <p>A value that indicates whether to include metadata in the results.</p>
266 pub fn set_include_result_metadata(mut self, input: ::std::option::Option<bool>) -> Self {
267 self.include_result_metadata = input;
268 self
269 }
270 /// <p>A value that indicates whether to include metadata in the results.</p>
271 pub fn get_include_result_metadata(&self) -> &::std::option::Option<bool> {
272 &self.include_result_metadata
273 }
274 /// <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>
275 /// <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>
276 /// </note>
277 pub fn continue_after_timeout(mut self, input: bool) -> Self {
278 self.continue_after_timeout = ::std::option::Option::Some(input);
279 self
280 }
281 /// <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>
282 /// <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>
283 /// </note>
284 pub fn set_continue_after_timeout(mut self, input: ::std::option::Option<bool>) -> Self {
285 self.continue_after_timeout = input;
286 self
287 }
288 /// <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>
289 /// <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>
290 /// </note>
291 pub fn get_continue_after_timeout(&self) -> &::std::option::Option<bool> {
292 &self.continue_after_timeout
293 }
294 /// <p>Options that control how the result set is returned.</p>
295 pub fn result_set_options(mut self, input: crate::types::ResultSetOptions) -> Self {
296 self.result_set_options = ::std::option::Option::Some(input);
297 self
298 }
299 /// <p>Options that control how the result set is returned.</p>
300 pub fn set_result_set_options(mut self, input: ::std::option::Option<crate::types::ResultSetOptions>) -> Self {
301 self.result_set_options = input;
302 self
303 }
304 /// <p>Options that control how the result set is returned.</p>
305 pub fn get_result_set_options(&self) -> &::std::option::Option<crate::types::ResultSetOptions> {
306 &self.result_set_options
307 }
308 /// <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>
309 /// <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>
310 pub fn format_records_as(mut self, input: crate::types::RecordsFormatType) -> Self {
311 self.format_records_as = ::std::option::Option::Some(input);
312 self
313 }
314 /// <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>
315 /// <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>
316 pub fn set_format_records_as(mut self, input: ::std::option::Option<crate::types::RecordsFormatType>) -> Self {
317 self.format_records_as = input;
318 self
319 }
320 /// <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>
321 /// <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>
322 pub fn get_format_records_as(&self) -> &::std::option::Option<crate::types::RecordsFormatType> {
323 &self.format_records_as
324 }
325 /// Consumes the builder and constructs a [`ExecuteStatementInput`](crate::operation::execute_statement::ExecuteStatementInput).
326 pub fn build(
327 self,
328 ) -> ::std::result::Result<crate::operation::execute_statement::ExecuteStatementInput, ::aws_smithy_types::error::operation::BuildError> {
329 ::std::result::Result::Ok(crate::operation::execute_statement::ExecuteStatementInput {
330 resource_arn: self.resource_arn,
331 secret_arn: self.secret_arn,
332 sql: self.sql,
333 database: self.database,
334 schema: self.schema,
335 parameters: self.parameters,
336 transaction_id: self.transaction_id,
337 include_result_metadata: self.include_result_metadata,
338 continue_after_timeout: self.continue_after_timeout,
339 result_set_options: self.result_set_options,
340 format_records_as: self.format_records_as,
341 })
342 }
343}