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