Skip to main content

aws_sdk_redshiftdata/operation/execute_statement/
_execute_statement_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct ExecuteStatementInput {
6    /// <p>The SQL statement text to run.</p>
7    pub sql: ::std::option::Option<::std::string::String>,
8    /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
9    pub cluster_identifier: ::std::option::Option<::std::string::String>,
10    /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
11    pub secret_arn: ::std::option::Option<::std::string::String>,
12    /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
13    pub db_user: ::std::option::Option<::std::string::String>,
14    /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
15    pub database: ::std::option::Option<::std::string::String>,
16    /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.</p>
17    pub with_event: ::std::option::Option<bool>,
18    /// <p>The name of the SQL statement. You can name the SQL statement when you create it to identify the query.</p>
19    pub statement_name: ::std::option::Option<::std::string::String>,
20    /// <p>The parameters for the SQL statement.</p>
21    pub parameters: ::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>>,
22    /// <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>
23    pub workgroup_name: ::std::option::Option<::std::string::String>,
24    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
25    pub client_token: ::std::option::Option<::std::string::String>,
26    /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
27    pub result_format: ::std::option::Option<crate::types::ResultFormatString>,
28    /// <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>
29    pub session_keep_alive_seconds: ::std::option::Option<i32>,
30    /// <p>The session identifier of the query.</p>
31    pub session_id: ::std::option::Option<::std::string::String>,
32    /// <p>The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.</p>
33    pub wait_time_seconds: ::std::option::Option<i32>,
34}
35impl ExecuteStatementInput {
36    /// <p>The SQL statement text to run.</p>
37    pub fn sql(&self) -> ::std::option::Option<&str> {
38        self.sql.as_deref()
39    }
40    /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
41    pub fn cluster_identifier(&self) -> ::std::option::Option<&str> {
42        self.cluster_identifier.as_deref()
43    }
44    /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
45    pub fn secret_arn(&self) -> ::std::option::Option<&str> {
46        self.secret_arn.as_deref()
47    }
48    /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
49    pub fn db_user(&self) -> ::std::option::Option<&str> {
50        self.db_user.as_deref()
51    }
52    /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
53    pub fn database(&self) -> ::std::option::Option<&str> {
54        self.database.as_deref()
55    }
56    /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.</p>
57    pub fn with_event(&self) -> ::std::option::Option<bool> {
58        self.with_event
59    }
60    /// <p>The name of the SQL statement. You can name the SQL statement when you create it to identify the query.</p>
61    pub fn statement_name(&self) -> ::std::option::Option<&str> {
62        self.statement_name.as_deref()
63    }
64    /// <p>The parameters for the SQL statement.</p>
65    ///
66    /// 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()`.
67    pub fn parameters(&self) -> &[crate::types::SqlParameter] {
68        self.parameters.as_deref().unwrap_or_default()
69    }
70    /// <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>
71    pub fn workgroup_name(&self) -> ::std::option::Option<&str> {
72        self.workgroup_name.as_deref()
73    }
74    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
75    pub fn client_token(&self) -> ::std::option::Option<&str> {
76        self.client_token.as_deref()
77    }
78    /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
79    pub fn result_format(&self) -> ::std::option::Option<&crate::types::ResultFormatString> {
80        self.result_format.as_ref()
81    }
82    /// <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>
83    pub fn session_keep_alive_seconds(&self) -> ::std::option::Option<i32> {
84        self.session_keep_alive_seconds
85    }
86    /// <p>The session identifier of the query.</p>
87    pub fn session_id(&self) -> ::std::option::Option<&str> {
88        self.session_id.as_deref()
89    }
90    /// <p>The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.</p>
91    pub fn wait_time_seconds(&self) -> ::std::option::Option<i32> {
92        self.wait_time_seconds
93    }
94}
95impl ExecuteStatementInput {
96    /// Creates a new builder-style object to manufacture [`ExecuteStatementInput`](crate::operation::execute_statement::ExecuteStatementInput).
97    pub fn builder() -> crate::operation::execute_statement::builders::ExecuteStatementInputBuilder {
98        crate::operation::execute_statement::builders::ExecuteStatementInputBuilder::default()
99    }
100}
101
102/// A builder for [`ExecuteStatementInput`](crate::operation::execute_statement::ExecuteStatementInput).
103#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
104#[non_exhaustive]
105pub struct ExecuteStatementInputBuilder {
106    pub(crate) sql: ::std::option::Option<::std::string::String>,
107    pub(crate) cluster_identifier: ::std::option::Option<::std::string::String>,
108    pub(crate) secret_arn: ::std::option::Option<::std::string::String>,
109    pub(crate) db_user: ::std::option::Option<::std::string::String>,
110    pub(crate) database: ::std::option::Option<::std::string::String>,
111    pub(crate) with_event: ::std::option::Option<bool>,
112    pub(crate) statement_name: ::std::option::Option<::std::string::String>,
113    pub(crate) parameters: ::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>>,
114    pub(crate) workgroup_name: ::std::option::Option<::std::string::String>,
115    pub(crate) client_token: ::std::option::Option<::std::string::String>,
116    pub(crate) result_format: ::std::option::Option<crate::types::ResultFormatString>,
117    pub(crate) session_keep_alive_seconds: ::std::option::Option<i32>,
118    pub(crate) session_id: ::std::option::Option<::std::string::String>,
119    pub(crate) wait_time_seconds: ::std::option::Option<i32>,
120}
121impl ExecuteStatementInputBuilder {
122    /// <p>The SQL statement text to run.</p>
123    /// This field is required.
124    pub fn sql(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.sql = ::std::option::Option::Some(input.into());
126        self
127    }
128    /// <p>The SQL statement text to run.</p>
129    pub fn set_sql(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.sql = input;
131        self
132    }
133    /// <p>The SQL statement text to run.</p>
134    pub fn get_sql(&self) -> &::std::option::Option<::std::string::String> {
135        &self.sql
136    }
137    /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
138    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.cluster_identifier = ::std::option::Option::Some(input.into());
140        self
141    }
142    /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
143    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.cluster_identifier = input;
145        self
146    }
147    /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
148    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
149        &self.cluster_identifier
150    }
151    /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
152    pub fn secret_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.secret_arn = ::std::option::Option::Some(input.into());
154        self
155    }
156    /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
157    pub fn set_secret_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.secret_arn = input;
159        self
160    }
161    /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
162    pub fn get_secret_arn(&self) -> &::std::option::Option<::std::string::String> {
163        &self.secret_arn
164    }
165    /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
166    pub fn db_user(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.db_user = ::std::option::Option::Some(input.into());
168        self
169    }
170    /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
171    pub fn set_db_user(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172        self.db_user = input;
173        self
174    }
175    /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
176    pub fn get_db_user(&self) -> &::std::option::Option<::std::string::String> {
177        &self.db_user
178    }
179    /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
180    pub fn database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.database = ::std::option::Option::Some(input.into());
182        self
183    }
184    /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
185    pub fn set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186        self.database = input;
187        self
188    }
189    /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
190    pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
191        &self.database
192    }
193    /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.</p>
194    pub fn with_event(mut self, input: bool) -> Self {
195        self.with_event = ::std::option::Option::Some(input);
196        self
197    }
198    /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.</p>
199    pub fn set_with_event(mut self, input: ::std::option::Option<bool>) -> Self {
200        self.with_event = input;
201        self
202    }
203    /// <p>A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.</p>
204    pub fn get_with_event(&self) -> &::std::option::Option<bool> {
205        &self.with_event
206    }
207    /// <p>The name of the SQL statement. You can name the SQL statement when you create it to identify the query.</p>
208    pub fn statement_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209        self.statement_name = ::std::option::Option::Some(input.into());
210        self
211    }
212    /// <p>The name of the SQL statement. You can name the SQL statement when you create it to identify the query.</p>
213    pub fn set_statement_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
214        self.statement_name = input;
215        self
216    }
217    /// <p>The name of the SQL statement. You can name the SQL statement when you create it to identify the query.</p>
218    pub fn get_statement_name(&self) -> &::std::option::Option<::std::string::String> {
219        &self.statement_name
220    }
221    /// Appends an item to `parameters`.
222    ///
223    /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
224    ///
225    /// <p>The parameters for the SQL statement.</p>
226    pub fn parameters(mut self, input: crate::types::SqlParameter) -> Self {
227        let mut v = self.parameters.unwrap_or_default();
228        v.push(input);
229        self.parameters = ::std::option::Option::Some(v);
230        self
231    }
232    /// <p>The parameters for the SQL statement.</p>
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>
238    pub fn get_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SqlParameter>> {
239        &self.parameters
240    }
241    /// <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>
242    pub fn workgroup_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
243        self.workgroup_name = ::std::option::Option::Some(input.into());
244        self
245    }
246    /// <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>
247    pub fn set_workgroup_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
248        self.workgroup_name = input;
249        self
250    }
251    /// <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>
252    pub fn get_workgroup_name(&self) -> &::std::option::Option<::std::string::String> {
253        &self.workgroup_name
254    }
255    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
256    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
257        self.client_token = ::std::option::Option::Some(input.into());
258        self
259    }
260    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
261    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
262        self.client_token = input;
263        self
264    }
265    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
266    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
267        &self.client_token
268    }
269    /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
270    pub fn result_format(mut self, input: crate::types::ResultFormatString) -> Self {
271        self.result_format = ::std::option::Option::Some(input);
272        self
273    }
274    /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
275    pub fn set_result_format(mut self, input: ::std::option::Option<crate::types::ResultFormatString>) -> Self {
276        self.result_format = input;
277        self
278    }
279    /// <p>The data format of the result of the SQL statement. If no format is specified, the default is JSON.</p>
280    pub fn get_result_format(&self) -> &::std::option::Option<crate::types::ResultFormatString> {
281        &self.result_format
282    }
283    /// <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>
284    pub fn session_keep_alive_seconds(mut self, input: i32) -> Self {
285        self.session_keep_alive_seconds = ::std::option::Option::Some(input);
286        self
287    }
288    /// <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>
289    pub fn set_session_keep_alive_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
290        self.session_keep_alive_seconds = input;
291        self
292    }
293    /// <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>
294    pub fn get_session_keep_alive_seconds(&self) -> &::std::option::Option<i32> {
295        &self.session_keep_alive_seconds
296    }
297    /// <p>The session identifier of the query.</p>
298    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
299        self.session_id = ::std::option::Option::Some(input.into());
300        self
301    }
302    /// <p>The session identifier of the query.</p>
303    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
304        self.session_id = input;
305        self
306    }
307    /// <p>The session identifier of the query.</p>
308    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
309        &self.session_id
310    }
311    /// <p>The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.</p>
312    pub fn wait_time_seconds(mut self, input: i32) -> Self {
313        self.wait_time_seconds = ::std::option::Option::Some(input);
314        self
315    }
316    /// <p>The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.</p>
317    pub fn set_wait_time_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
318        self.wait_time_seconds = input;
319        self
320    }
321    /// <p>The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.</p>
322    pub fn get_wait_time_seconds(&self) -> &::std::option::Option<i32> {
323        &self.wait_time_seconds
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            sql: self.sql,
331            cluster_identifier: self.cluster_identifier,
332            secret_arn: self.secret_arn,
333            db_user: self.db_user,
334            database: self.database,
335            with_event: self.with_event,
336            statement_name: self.statement_name,
337            parameters: self.parameters,
338            workgroup_name: self.workgroup_name,
339            client_token: self.client_token,
340            result_format: self.result_format,
341            session_keep_alive_seconds: self.session_keep_alive_seconds,
342            session_id: self.session_id,
343            wait_time_seconds: self.wait_time_seconds,
344        })
345    }
346}