Skip to main content

aws_sdk_cloudtrail/operation/get_query_results/
_get_query_results_output.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 GetQueryResultsOutput {
6    /// <p>The status of the query. Values include <code>QUEUED</code>, <code>RUNNING</code>, <code>FINISHED</code>, <code>FAILED</code>, <code>TIMED_OUT</code>, or <code>CANCELLED</code>.</p>
7    pub query_status: ::std::option::Option<crate::types::QueryStatus>,
8    /// <p>Shows the count of query results.</p>
9    pub query_statistics: ::std::option::Option<crate::types::QueryStatistics>,
10    /// <p>Contains the individual event results of the query.</p>
11    pub query_result_rows:
12        ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>>>,
13    /// <p>A token you can use to get the next page of query results.</p>
14    pub next_token: ::std::option::Option<::std::string::String>,
15    /// <p>The error message returned if a query failed.</p>
16    pub error_message: ::std::option::Option<::std::string::String>,
17    _request_id: Option<String>,
18}
19impl GetQueryResultsOutput {
20    /// <p>The status of the query. Values include <code>QUEUED</code>, <code>RUNNING</code>, <code>FINISHED</code>, <code>FAILED</code>, <code>TIMED_OUT</code>, or <code>CANCELLED</code>.</p>
21    pub fn query_status(&self) -> ::std::option::Option<&crate::types::QueryStatus> {
22        self.query_status.as_ref()
23    }
24    /// <p>Shows the count of query results.</p>
25    pub fn query_statistics(&self) -> ::std::option::Option<&crate::types::QueryStatistics> {
26        self.query_statistics.as_ref()
27    }
28    /// <p>Contains the individual event results of the query.</p>
29    ///
30    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.query_result_rows.is_none()`.
31    pub fn query_result_rows(&self) -> &[::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>] {
32        self.query_result_rows.as_deref().unwrap_or_default()
33    }
34    /// <p>A token you can use to get the next page of query results.</p>
35    pub fn next_token(&self) -> ::std::option::Option<&str> {
36        self.next_token.as_deref()
37    }
38    /// <p>The error message returned if a query failed.</p>
39    pub fn error_message(&self) -> ::std::option::Option<&str> {
40        self.error_message.as_deref()
41    }
42}
43impl ::aws_types::request_id::RequestId for GetQueryResultsOutput {
44    fn request_id(&self) -> Option<&str> {
45        self._request_id.as_deref()
46    }
47}
48impl GetQueryResultsOutput {
49    /// Creates a new builder-style object to manufacture [`GetQueryResultsOutput`](crate::operation::get_query_results::GetQueryResultsOutput).
50    pub fn builder() -> crate::operation::get_query_results::builders::GetQueryResultsOutputBuilder {
51        crate::operation::get_query_results::builders::GetQueryResultsOutputBuilder::default()
52    }
53}
54
55/// A builder for [`GetQueryResultsOutput`](crate::operation::get_query_results::GetQueryResultsOutput).
56#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
57#[non_exhaustive]
58pub struct GetQueryResultsOutputBuilder {
59    pub(crate) query_status: ::std::option::Option<crate::types::QueryStatus>,
60    pub(crate) query_statistics: ::std::option::Option<crate::types::QueryStatistics>,
61    pub(crate) query_result_rows:
62        ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>>>,
63    pub(crate) next_token: ::std::option::Option<::std::string::String>,
64    pub(crate) error_message: ::std::option::Option<::std::string::String>,
65    _request_id: Option<String>,
66}
67impl GetQueryResultsOutputBuilder {
68    /// <p>The status of the query. Values include <code>QUEUED</code>, <code>RUNNING</code>, <code>FINISHED</code>, <code>FAILED</code>, <code>TIMED_OUT</code>, or <code>CANCELLED</code>.</p>
69    pub fn query_status(mut self, input: crate::types::QueryStatus) -> Self {
70        self.query_status = ::std::option::Option::Some(input);
71        self
72    }
73    /// <p>The status of the query. Values include <code>QUEUED</code>, <code>RUNNING</code>, <code>FINISHED</code>, <code>FAILED</code>, <code>TIMED_OUT</code>, or <code>CANCELLED</code>.</p>
74    pub fn set_query_status(mut self, input: ::std::option::Option<crate::types::QueryStatus>) -> Self {
75        self.query_status = input;
76        self
77    }
78    /// <p>The status of the query. Values include <code>QUEUED</code>, <code>RUNNING</code>, <code>FINISHED</code>, <code>FAILED</code>, <code>TIMED_OUT</code>, or <code>CANCELLED</code>.</p>
79    pub fn get_query_status(&self) -> &::std::option::Option<crate::types::QueryStatus> {
80        &self.query_status
81    }
82    /// <p>Shows the count of query results.</p>
83    pub fn query_statistics(mut self, input: crate::types::QueryStatistics) -> Self {
84        self.query_statistics = ::std::option::Option::Some(input);
85        self
86    }
87    /// <p>Shows the count of query results.</p>
88    pub fn set_query_statistics(mut self, input: ::std::option::Option<crate::types::QueryStatistics>) -> Self {
89        self.query_statistics = input;
90        self
91    }
92    /// <p>Shows the count of query results.</p>
93    pub fn get_query_statistics(&self) -> &::std::option::Option<crate::types::QueryStatistics> {
94        &self.query_statistics
95    }
96    /// Appends an item to `query_result_rows`.
97    ///
98    /// To override the contents of this collection use [`set_query_result_rows`](Self::set_query_result_rows).
99    ///
100    /// <p>Contains the individual event results of the query.</p>
101    pub fn query_result_rows(mut self, input: ::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
102        let mut v = self.query_result_rows.unwrap_or_default();
103        v.push(input);
104        self.query_result_rows = ::std::option::Option::Some(v);
105        self
106    }
107    /// <p>Contains the individual event results of the query.</p>
108    pub fn set_query_result_rows(
109        mut self,
110        input: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>>>,
111    ) -> Self {
112        self.query_result_rows = input;
113        self
114    }
115    /// <p>Contains the individual event results of the query.</p>
116    pub fn get_query_result_rows(
117        &self,
118    ) -> &::std::option::Option<::std::vec::Vec<::std::vec::Vec<::std::collections::HashMap<::std::string::String, ::std::string::String>>>> {
119        &self.query_result_rows
120    }
121    /// <p>A token you can use to get the next page of query results.</p>
122    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.next_token = ::std::option::Option::Some(input.into());
124        self
125    }
126    /// <p>A token you can use to get the next page of query results.</p>
127    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128        self.next_token = input;
129        self
130    }
131    /// <p>A token you can use to get the next page of query results.</p>
132    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
133        &self.next_token
134    }
135    /// <p>The error message returned if a query failed.</p>
136    pub fn error_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.error_message = ::std::option::Option::Some(input.into());
138        self
139    }
140    /// <p>The error message returned if a query failed.</p>
141    pub fn set_error_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.error_message = input;
143        self
144    }
145    /// <p>The error message returned if a query failed.</p>
146    pub fn get_error_message(&self) -> &::std::option::Option<::std::string::String> {
147        &self.error_message
148    }
149    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
150        self._request_id = Some(request_id.into());
151        self
152    }
153
154    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
155        self._request_id = request_id;
156        self
157    }
158    /// Consumes the builder and constructs a [`GetQueryResultsOutput`](crate::operation::get_query_results::GetQueryResultsOutput).
159    pub fn build(self) -> crate::operation::get_query_results::GetQueryResultsOutput {
160        crate::operation::get_query_results::GetQueryResultsOutput {
161            query_status: self.query_status,
162            query_statistics: self.query_statistics,
163            query_result_rows: self.query_result_rows,
164            next_token: self.next_token,
165            error_message: self.error_message,
166            _request_id: self._request_id,
167        }
168    }
169}