aws_sdk_athena/types/
_query_execution.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Information about a single instance of a query execution.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct QueryExecution {
7    /// <p>The unique identifier for each query execution.</p>
8    pub query_execution_id: ::std::option::Option<::std::string::String>,
9    /// <p>The SQL query statements which the query execution ran.</p>
10    pub query: ::std::option::Option<::std::string::String>,
11    /// <p>The type of query statement that was run. <code>DDL</code> indicates DDL query statements. <code>DML</code> indicates DML (Data Manipulation Language) query statements, such as <code>CREATE TABLE AS SELECT</code>. <code>UTILITY</code> indicates query statements other than DDL and DML, such as <code>SHOW CREATE TABLE</code>, or <code>DESCRIBE TABLE</code>.</p>
12    pub statement_type: ::std::option::Option<crate::types::StatementType>,
13    /// <p>The configuration for storing results in Athena owned storage, which includes whether this feature is enabled; whether encryption configuration, if any, is used for encrypting query results.</p>
14    pub managed_query_results_configuration: ::std::option::Option<crate::types::ManagedQueryResultsConfiguration>,
15    /// <p>The location in Amazon S3 where query and calculation results are stored and the encryption option, if any, used for query results. These are known as "client-side settings". If workgroup settings override client-side settings, then the query uses the location for the query results and the encryption configuration that are specified for the workgroup.</p>
16    pub result_configuration: ::std::option::Option<crate::types::ResultConfiguration>,
17    /// <p>Specifies the query result reuse behavior that was used for the query.</p>
18    pub result_reuse_configuration: ::std::option::Option<crate::types::ResultReuseConfiguration>,
19    /// <p>The database in which the query execution occurred.</p>
20    pub query_execution_context: ::std::option::Option<crate::types::QueryExecutionContext>,
21    /// <p>The completion date, current state, submission time, and state change reason (if applicable) for the query execution.</p>
22    pub status: ::std::option::Option<crate::types::QueryExecutionStatus>,
23    /// <p>Query execution statistics, such as the amount of data scanned, the amount of time that the query took to process, and the type of statement that was run.</p>
24    pub statistics: ::std::option::Option<crate::types::QueryExecutionStatistics>,
25    /// <p>The name of the workgroup in which the query ran.</p>
26    pub work_group: ::std::option::Option<::std::string::String>,
27    /// <p>The engine version that executed the query.</p>
28    pub engine_version: ::std::option::Option<crate::types::EngineVersion>,
29    /// <p>A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur. The list of parameters is not returned in the response.</p>
30    pub execution_parameters: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
31    /// <p>The kind of query statement that was run.</p>
32    pub substatement_type: ::std::option::Option<::std::string::String>,
33    /// <p>Specifies whether Amazon S3 access grants are enabled for query results.</p>
34    pub query_results_s3_access_grants_configuration: ::std::option::Option<crate::types::QueryResultsS3AccessGrantsConfiguration>,
35}
36impl QueryExecution {
37    /// <p>The unique identifier for each query execution.</p>
38    pub fn query_execution_id(&self) -> ::std::option::Option<&str> {
39        self.query_execution_id.as_deref()
40    }
41    /// <p>The SQL query statements which the query execution ran.</p>
42    pub fn query(&self) -> ::std::option::Option<&str> {
43        self.query.as_deref()
44    }
45    /// <p>The type of query statement that was run. <code>DDL</code> indicates DDL query statements. <code>DML</code> indicates DML (Data Manipulation Language) query statements, such as <code>CREATE TABLE AS SELECT</code>. <code>UTILITY</code> indicates query statements other than DDL and DML, such as <code>SHOW CREATE TABLE</code>, or <code>DESCRIBE TABLE</code>.</p>
46    pub fn statement_type(&self) -> ::std::option::Option<&crate::types::StatementType> {
47        self.statement_type.as_ref()
48    }
49    /// <p>The configuration for storing results in Athena owned storage, which includes whether this feature is enabled; whether encryption configuration, if any, is used for encrypting query results.</p>
50    pub fn managed_query_results_configuration(&self) -> ::std::option::Option<&crate::types::ManagedQueryResultsConfiguration> {
51        self.managed_query_results_configuration.as_ref()
52    }
53    /// <p>The location in Amazon S3 where query and calculation results are stored and the encryption option, if any, used for query results. These are known as "client-side settings". If workgroup settings override client-side settings, then the query uses the location for the query results and the encryption configuration that are specified for the workgroup.</p>
54    pub fn result_configuration(&self) -> ::std::option::Option<&crate::types::ResultConfiguration> {
55        self.result_configuration.as_ref()
56    }
57    /// <p>Specifies the query result reuse behavior that was used for the query.</p>
58    pub fn result_reuse_configuration(&self) -> ::std::option::Option<&crate::types::ResultReuseConfiguration> {
59        self.result_reuse_configuration.as_ref()
60    }
61    /// <p>The database in which the query execution occurred.</p>
62    pub fn query_execution_context(&self) -> ::std::option::Option<&crate::types::QueryExecutionContext> {
63        self.query_execution_context.as_ref()
64    }
65    /// <p>The completion date, current state, submission time, and state change reason (if applicable) for the query execution.</p>
66    pub fn status(&self) -> ::std::option::Option<&crate::types::QueryExecutionStatus> {
67        self.status.as_ref()
68    }
69    /// <p>Query execution statistics, such as the amount of data scanned, the amount of time that the query took to process, and the type of statement that was run.</p>
70    pub fn statistics(&self) -> ::std::option::Option<&crate::types::QueryExecutionStatistics> {
71        self.statistics.as_ref()
72    }
73    /// <p>The name of the workgroup in which the query ran.</p>
74    pub fn work_group(&self) -> ::std::option::Option<&str> {
75        self.work_group.as_deref()
76    }
77    /// <p>The engine version that executed the query.</p>
78    pub fn engine_version(&self) -> ::std::option::Option<&crate::types::EngineVersion> {
79        self.engine_version.as_ref()
80    }
81    /// <p>A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur. The list of parameters is not returned in the response.</p>
82    ///
83    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.execution_parameters.is_none()`.
84    pub fn execution_parameters(&self) -> &[::std::string::String] {
85        self.execution_parameters.as_deref().unwrap_or_default()
86    }
87    /// <p>The kind of query statement that was run.</p>
88    pub fn substatement_type(&self) -> ::std::option::Option<&str> {
89        self.substatement_type.as_deref()
90    }
91    /// <p>Specifies whether Amazon S3 access grants are enabled for query results.</p>
92    pub fn query_results_s3_access_grants_configuration(&self) -> ::std::option::Option<&crate::types::QueryResultsS3AccessGrantsConfiguration> {
93        self.query_results_s3_access_grants_configuration.as_ref()
94    }
95}
96impl QueryExecution {
97    /// Creates a new builder-style object to manufacture [`QueryExecution`](crate::types::QueryExecution).
98    pub fn builder() -> crate::types::builders::QueryExecutionBuilder {
99        crate::types::builders::QueryExecutionBuilder::default()
100    }
101}
102
103/// A builder for [`QueryExecution`](crate::types::QueryExecution).
104#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
105#[non_exhaustive]
106pub struct QueryExecutionBuilder {
107    pub(crate) query_execution_id: ::std::option::Option<::std::string::String>,
108    pub(crate) query: ::std::option::Option<::std::string::String>,
109    pub(crate) statement_type: ::std::option::Option<crate::types::StatementType>,
110    pub(crate) managed_query_results_configuration: ::std::option::Option<crate::types::ManagedQueryResultsConfiguration>,
111    pub(crate) result_configuration: ::std::option::Option<crate::types::ResultConfiguration>,
112    pub(crate) result_reuse_configuration: ::std::option::Option<crate::types::ResultReuseConfiguration>,
113    pub(crate) query_execution_context: ::std::option::Option<crate::types::QueryExecutionContext>,
114    pub(crate) status: ::std::option::Option<crate::types::QueryExecutionStatus>,
115    pub(crate) statistics: ::std::option::Option<crate::types::QueryExecutionStatistics>,
116    pub(crate) work_group: ::std::option::Option<::std::string::String>,
117    pub(crate) engine_version: ::std::option::Option<crate::types::EngineVersion>,
118    pub(crate) execution_parameters: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
119    pub(crate) substatement_type: ::std::option::Option<::std::string::String>,
120    pub(crate) query_results_s3_access_grants_configuration: ::std::option::Option<crate::types::QueryResultsS3AccessGrantsConfiguration>,
121}
122impl QueryExecutionBuilder {
123    /// <p>The unique identifier for each query execution.</p>
124    pub fn query_execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.query_execution_id = ::std::option::Option::Some(input.into());
126        self
127    }
128    /// <p>The unique identifier for each query execution.</p>
129    pub fn set_query_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.query_execution_id = input;
131        self
132    }
133    /// <p>The unique identifier for each query execution.</p>
134    pub fn get_query_execution_id(&self) -> &::std::option::Option<::std::string::String> {
135        &self.query_execution_id
136    }
137    /// <p>The SQL query statements which the query execution ran.</p>
138    pub fn query(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.query = ::std::option::Option::Some(input.into());
140        self
141    }
142    /// <p>The SQL query statements which the query execution ran.</p>
143    pub fn set_query(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.query = input;
145        self
146    }
147    /// <p>The SQL query statements which the query execution ran.</p>
148    pub fn get_query(&self) -> &::std::option::Option<::std::string::String> {
149        &self.query
150    }
151    /// <p>The type of query statement that was run. <code>DDL</code> indicates DDL query statements. <code>DML</code> indicates DML (Data Manipulation Language) query statements, such as <code>CREATE TABLE AS SELECT</code>. <code>UTILITY</code> indicates query statements other than DDL and DML, such as <code>SHOW CREATE TABLE</code>, or <code>DESCRIBE TABLE</code>.</p>
152    pub fn statement_type(mut self, input: crate::types::StatementType) -> Self {
153        self.statement_type = ::std::option::Option::Some(input);
154        self
155    }
156    /// <p>The type of query statement that was run. <code>DDL</code> indicates DDL query statements. <code>DML</code> indicates DML (Data Manipulation Language) query statements, such as <code>CREATE TABLE AS SELECT</code>. <code>UTILITY</code> indicates query statements other than DDL and DML, such as <code>SHOW CREATE TABLE</code>, or <code>DESCRIBE TABLE</code>.</p>
157    pub fn set_statement_type(mut self, input: ::std::option::Option<crate::types::StatementType>) -> Self {
158        self.statement_type = input;
159        self
160    }
161    /// <p>The type of query statement that was run. <code>DDL</code> indicates DDL query statements. <code>DML</code> indicates DML (Data Manipulation Language) query statements, such as <code>CREATE TABLE AS SELECT</code>. <code>UTILITY</code> indicates query statements other than DDL and DML, such as <code>SHOW CREATE TABLE</code>, or <code>DESCRIBE TABLE</code>.</p>
162    pub fn get_statement_type(&self) -> &::std::option::Option<crate::types::StatementType> {
163        &self.statement_type
164    }
165    /// <p>The configuration for storing results in Athena owned storage, which includes whether this feature is enabled; whether encryption configuration, if any, is used for encrypting query results.</p>
166    pub fn managed_query_results_configuration(mut self, input: crate::types::ManagedQueryResultsConfiguration) -> Self {
167        self.managed_query_results_configuration = ::std::option::Option::Some(input);
168        self
169    }
170    /// <p>The configuration for storing results in Athena owned storage, which includes whether this feature is enabled; whether encryption configuration, if any, is used for encrypting query results.</p>
171    pub fn set_managed_query_results_configuration(mut self, input: ::std::option::Option<crate::types::ManagedQueryResultsConfiguration>) -> Self {
172        self.managed_query_results_configuration = input;
173        self
174    }
175    /// <p>The configuration for storing results in Athena owned storage, which includes whether this feature is enabled; whether encryption configuration, if any, is used for encrypting query results.</p>
176    pub fn get_managed_query_results_configuration(&self) -> &::std::option::Option<crate::types::ManagedQueryResultsConfiguration> {
177        &self.managed_query_results_configuration
178    }
179    /// <p>The location in Amazon S3 where query and calculation results are stored and the encryption option, if any, used for query results. These are known as "client-side settings". If workgroup settings override client-side settings, then the query uses the location for the query results and the encryption configuration that are specified for the workgroup.</p>
180    pub fn result_configuration(mut self, input: crate::types::ResultConfiguration) -> Self {
181        self.result_configuration = ::std::option::Option::Some(input);
182        self
183    }
184    /// <p>The location in Amazon S3 where query and calculation results are stored and the encryption option, if any, used for query results. These are known as "client-side settings". If workgroup settings override client-side settings, then the query uses the location for the query results and the encryption configuration that are specified for the workgroup.</p>
185    pub fn set_result_configuration(mut self, input: ::std::option::Option<crate::types::ResultConfiguration>) -> Self {
186        self.result_configuration = input;
187        self
188    }
189    /// <p>The location in Amazon S3 where query and calculation results are stored and the encryption option, if any, used for query results. These are known as "client-side settings". If workgroup settings override client-side settings, then the query uses the location for the query results and the encryption configuration that are specified for the workgroup.</p>
190    pub fn get_result_configuration(&self) -> &::std::option::Option<crate::types::ResultConfiguration> {
191        &self.result_configuration
192    }
193    /// <p>Specifies the query result reuse behavior that was used for the query.</p>
194    pub fn result_reuse_configuration(mut self, input: crate::types::ResultReuseConfiguration) -> Self {
195        self.result_reuse_configuration = ::std::option::Option::Some(input);
196        self
197    }
198    /// <p>Specifies the query result reuse behavior that was used for the query.</p>
199    pub fn set_result_reuse_configuration(mut self, input: ::std::option::Option<crate::types::ResultReuseConfiguration>) -> Self {
200        self.result_reuse_configuration = input;
201        self
202    }
203    /// <p>Specifies the query result reuse behavior that was used for the query.</p>
204    pub fn get_result_reuse_configuration(&self) -> &::std::option::Option<crate::types::ResultReuseConfiguration> {
205        &self.result_reuse_configuration
206    }
207    /// <p>The database in which the query execution occurred.</p>
208    pub fn query_execution_context(mut self, input: crate::types::QueryExecutionContext) -> Self {
209        self.query_execution_context = ::std::option::Option::Some(input);
210        self
211    }
212    /// <p>The database in which the query execution occurred.</p>
213    pub fn set_query_execution_context(mut self, input: ::std::option::Option<crate::types::QueryExecutionContext>) -> Self {
214        self.query_execution_context = input;
215        self
216    }
217    /// <p>The database in which the query execution occurred.</p>
218    pub fn get_query_execution_context(&self) -> &::std::option::Option<crate::types::QueryExecutionContext> {
219        &self.query_execution_context
220    }
221    /// <p>The completion date, current state, submission time, and state change reason (if applicable) for the query execution.</p>
222    pub fn status(mut self, input: crate::types::QueryExecutionStatus) -> Self {
223        self.status = ::std::option::Option::Some(input);
224        self
225    }
226    /// <p>The completion date, current state, submission time, and state change reason (if applicable) for the query execution.</p>
227    pub fn set_status(mut self, input: ::std::option::Option<crate::types::QueryExecutionStatus>) -> Self {
228        self.status = input;
229        self
230    }
231    /// <p>The completion date, current state, submission time, and state change reason (if applicable) for the query execution.</p>
232    pub fn get_status(&self) -> &::std::option::Option<crate::types::QueryExecutionStatus> {
233        &self.status
234    }
235    /// <p>Query execution statistics, such as the amount of data scanned, the amount of time that the query took to process, and the type of statement that was run.</p>
236    pub fn statistics(mut self, input: crate::types::QueryExecutionStatistics) -> Self {
237        self.statistics = ::std::option::Option::Some(input);
238        self
239    }
240    /// <p>Query execution statistics, such as the amount of data scanned, the amount of time that the query took to process, and the type of statement that was run.</p>
241    pub fn set_statistics(mut self, input: ::std::option::Option<crate::types::QueryExecutionStatistics>) -> Self {
242        self.statistics = input;
243        self
244    }
245    /// <p>Query execution statistics, such as the amount of data scanned, the amount of time that the query took to process, and the type of statement that was run.</p>
246    pub fn get_statistics(&self) -> &::std::option::Option<crate::types::QueryExecutionStatistics> {
247        &self.statistics
248    }
249    /// <p>The name of the workgroup in which the query ran.</p>
250    pub fn work_group(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
251        self.work_group = ::std::option::Option::Some(input.into());
252        self
253    }
254    /// <p>The name of the workgroup in which the query ran.</p>
255    pub fn set_work_group(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
256        self.work_group = input;
257        self
258    }
259    /// <p>The name of the workgroup in which the query ran.</p>
260    pub fn get_work_group(&self) -> &::std::option::Option<::std::string::String> {
261        &self.work_group
262    }
263    /// <p>The engine version that executed the query.</p>
264    pub fn engine_version(mut self, input: crate::types::EngineVersion) -> Self {
265        self.engine_version = ::std::option::Option::Some(input);
266        self
267    }
268    /// <p>The engine version that executed the query.</p>
269    pub fn set_engine_version(mut self, input: ::std::option::Option<crate::types::EngineVersion>) -> Self {
270        self.engine_version = input;
271        self
272    }
273    /// <p>The engine version that executed the query.</p>
274    pub fn get_engine_version(&self) -> &::std::option::Option<crate::types::EngineVersion> {
275        &self.engine_version
276    }
277    /// Appends an item to `execution_parameters`.
278    ///
279    /// To override the contents of this collection use [`set_execution_parameters`](Self::set_execution_parameters).
280    ///
281    /// <p>A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur. The list of parameters is not returned in the response.</p>
282    pub fn execution_parameters(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
283        let mut v = self.execution_parameters.unwrap_or_default();
284        v.push(input.into());
285        self.execution_parameters = ::std::option::Option::Some(v);
286        self
287    }
288    /// <p>A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur. The list of parameters is not returned in the response.</p>
289    pub fn set_execution_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
290        self.execution_parameters = input;
291        self
292    }
293    /// <p>A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur. The list of parameters is not returned in the response.</p>
294    pub fn get_execution_parameters(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
295        &self.execution_parameters
296    }
297    /// <p>The kind of query statement that was run.</p>
298    pub fn substatement_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
299        self.substatement_type = ::std::option::Option::Some(input.into());
300        self
301    }
302    /// <p>The kind of query statement that was run.</p>
303    pub fn set_substatement_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
304        self.substatement_type = input;
305        self
306    }
307    /// <p>The kind of query statement that was run.</p>
308    pub fn get_substatement_type(&self) -> &::std::option::Option<::std::string::String> {
309        &self.substatement_type
310    }
311    /// <p>Specifies whether Amazon S3 access grants are enabled for query results.</p>
312    pub fn query_results_s3_access_grants_configuration(mut self, input: crate::types::QueryResultsS3AccessGrantsConfiguration) -> Self {
313        self.query_results_s3_access_grants_configuration = ::std::option::Option::Some(input);
314        self
315    }
316    /// <p>Specifies whether Amazon S3 access grants are enabled for query results.</p>
317    pub fn set_query_results_s3_access_grants_configuration(
318        mut self,
319        input: ::std::option::Option<crate::types::QueryResultsS3AccessGrantsConfiguration>,
320    ) -> Self {
321        self.query_results_s3_access_grants_configuration = input;
322        self
323    }
324    /// <p>Specifies whether Amazon S3 access grants are enabled for query results.</p>
325    pub fn get_query_results_s3_access_grants_configuration(&self) -> &::std::option::Option<crate::types::QueryResultsS3AccessGrantsConfiguration> {
326        &self.query_results_s3_access_grants_configuration
327    }
328    /// Consumes the builder and constructs a [`QueryExecution`](crate::types::QueryExecution).
329    pub fn build(self) -> crate::types::QueryExecution {
330        crate::types::QueryExecution {
331            query_execution_id: self.query_execution_id,
332            query: self.query,
333            statement_type: self.statement_type,
334            managed_query_results_configuration: self.managed_query_results_configuration,
335            result_configuration: self.result_configuration,
336            result_reuse_configuration: self.result_reuse_configuration,
337            query_execution_context: self.query_execution_context,
338            status: self.status,
339            statistics: self.statistics,
340            work_group: self.work_group,
341            engine_version: self.engine_version,
342            execution_parameters: self.execution_parameters,
343            substatement_type: self.substatement_type,
344            query_results_s3_access_grants_configuration: self.query_results_s3_access_grants_configuration,
345        }
346    }
347}