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