aws_sdk_timestreamquery/operation/query/
_query_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 QueryOutput {
6    /// <p>A unique ID for the given query.</p>
7    pub query_id: ::std::string::String,
8    /// <p>A pagination token that can be used again on a <code>Query</code> call to get the next set of results.</p>
9    pub next_token: ::std::option::Option<::std::string::String>,
10    /// <p>The result set rows returned by the query.</p>
11    pub rows: ::std::vec::Vec<crate::types::Row>,
12    /// <p>The column data types of the returned result set.</p>
13    pub column_info: ::std::vec::Vec<crate::types::ColumnInfo>,
14    /// <p>Information about the status of the query, including progress and bytes scanned.</p>
15    pub query_status: ::std::option::Option<crate::types::QueryStatus>,
16    /// <p>Encapsulates <code>QueryInsights</code> containing insights and metrics related to the query that you executed.</p>
17    pub query_insights_response: ::std::option::Option<crate::types::QueryInsightsResponse>,
18    _request_id: Option<String>,
19}
20impl QueryOutput {
21    /// <p>A unique ID for the given query.</p>
22    pub fn query_id(&self) -> &str {
23        use std::ops::Deref;
24        self.query_id.deref()
25    }
26    /// <p>A pagination token that can be used again on a <code>Query</code> call to get the next set of results.</p>
27    pub fn next_token(&self) -> ::std::option::Option<&str> {
28        self.next_token.as_deref()
29    }
30    /// <p>The result set rows returned by the query.</p>
31    pub fn rows(&self) -> &[crate::types::Row] {
32        use std::ops::Deref;
33        self.rows.deref()
34    }
35    /// <p>The column data types of the returned result set.</p>
36    pub fn column_info(&self) -> &[crate::types::ColumnInfo] {
37        use std::ops::Deref;
38        self.column_info.deref()
39    }
40    /// <p>Information about the status of the query, including progress and bytes scanned.</p>
41    pub fn query_status(&self) -> ::std::option::Option<&crate::types::QueryStatus> {
42        self.query_status.as_ref()
43    }
44    /// <p>Encapsulates <code>QueryInsights</code> containing insights and metrics related to the query that you executed.</p>
45    pub fn query_insights_response(&self) -> ::std::option::Option<&crate::types::QueryInsightsResponse> {
46        self.query_insights_response.as_ref()
47    }
48}
49impl ::aws_types::request_id::RequestId for QueryOutput {
50    fn request_id(&self) -> Option<&str> {
51        self._request_id.as_deref()
52    }
53}
54impl QueryOutput {
55    /// Creates a new builder-style object to manufacture [`QueryOutput`](crate::operation::query::QueryOutput).
56    pub fn builder() -> crate::operation::query::builders::QueryOutputBuilder {
57        crate::operation::query::builders::QueryOutputBuilder::default()
58    }
59}
60
61/// A builder for [`QueryOutput`](crate::operation::query::QueryOutput).
62#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
63#[non_exhaustive]
64pub struct QueryOutputBuilder {
65    pub(crate) query_id: ::std::option::Option<::std::string::String>,
66    pub(crate) next_token: ::std::option::Option<::std::string::String>,
67    pub(crate) rows: ::std::option::Option<::std::vec::Vec<crate::types::Row>>,
68    pub(crate) column_info: ::std::option::Option<::std::vec::Vec<crate::types::ColumnInfo>>,
69    pub(crate) query_status: ::std::option::Option<crate::types::QueryStatus>,
70    pub(crate) query_insights_response: ::std::option::Option<crate::types::QueryInsightsResponse>,
71    _request_id: Option<String>,
72}
73impl QueryOutputBuilder {
74    /// <p>A unique ID for the given query.</p>
75    /// This field is required.
76    pub fn query_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        self.query_id = ::std::option::Option::Some(input.into());
78        self
79    }
80    /// <p>A unique ID for the given query.</p>
81    pub fn set_query_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82        self.query_id = input;
83        self
84    }
85    /// <p>A unique ID for the given query.</p>
86    pub fn get_query_id(&self) -> &::std::option::Option<::std::string::String> {
87        &self.query_id
88    }
89    /// <p>A pagination token that can be used again on a <code>Query</code> call to get the next set of results.</p>
90    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.next_token = ::std::option::Option::Some(input.into());
92        self
93    }
94    /// <p>A pagination token that can be used again on a <code>Query</code> call to get the next set of results.</p>
95    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.next_token = input;
97        self
98    }
99    /// <p>A pagination token that can be used again on a <code>Query</code> call to get the next set of results.</p>
100    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
101        &self.next_token
102    }
103    /// Appends an item to `rows`.
104    ///
105    /// To override the contents of this collection use [`set_rows`](Self::set_rows).
106    ///
107    /// <p>The result set rows returned by the query.</p>
108    pub fn rows(mut self, input: crate::types::Row) -> Self {
109        let mut v = self.rows.unwrap_or_default();
110        v.push(input);
111        self.rows = ::std::option::Option::Some(v);
112        self
113    }
114    /// <p>The result set rows returned by the query.</p>
115    pub fn set_rows(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Row>>) -> Self {
116        self.rows = input;
117        self
118    }
119    /// <p>The result set rows returned by the query.</p>
120    pub fn get_rows(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Row>> {
121        &self.rows
122    }
123    /// Appends an item to `column_info`.
124    ///
125    /// To override the contents of this collection use [`set_column_info`](Self::set_column_info).
126    ///
127    /// <p>The column data types of the returned result set.</p>
128    pub fn column_info(mut self, input: crate::types::ColumnInfo) -> Self {
129        let mut v = self.column_info.unwrap_or_default();
130        v.push(input);
131        self.column_info = ::std::option::Option::Some(v);
132        self
133    }
134    /// <p>The column data types of the returned result set.</p>
135    pub fn set_column_info(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ColumnInfo>>) -> Self {
136        self.column_info = input;
137        self
138    }
139    /// <p>The column data types of the returned result set.</p>
140    pub fn get_column_info(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ColumnInfo>> {
141        &self.column_info
142    }
143    /// <p>Information about the status of the query, including progress and bytes scanned.</p>
144    pub fn query_status(mut self, input: crate::types::QueryStatus) -> Self {
145        self.query_status = ::std::option::Option::Some(input);
146        self
147    }
148    /// <p>Information about the status of the query, including progress and bytes scanned.</p>
149    pub fn set_query_status(mut self, input: ::std::option::Option<crate::types::QueryStatus>) -> Self {
150        self.query_status = input;
151        self
152    }
153    /// <p>Information about the status of the query, including progress and bytes scanned.</p>
154    pub fn get_query_status(&self) -> &::std::option::Option<crate::types::QueryStatus> {
155        &self.query_status
156    }
157    /// <p>Encapsulates <code>QueryInsights</code> containing insights and metrics related to the query that you executed.</p>
158    pub fn query_insights_response(mut self, input: crate::types::QueryInsightsResponse) -> Self {
159        self.query_insights_response = ::std::option::Option::Some(input);
160        self
161    }
162    /// <p>Encapsulates <code>QueryInsights</code> containing insights and metrics related to the query that you executed.</p>
163    pub fn set_query_insights_response(mut self, input: ::std::option::Option<crate::types::QueryInsightsResponse>) -> Self {
164        self.query_insights_response = input;
165        self
166    }
167    /// <p>Encapsulates <code>QueryInsights</code> containing insights and metrics related to the query that you executed.</p>
168    pub fn get_query_insights_response(&self) -> &::std::option::Option<crate::types::QueryInsightsResponse> {
169        &self.query_insights_response
170    }
171    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
172        self._request_id = Some(request_id.into());
173        self
174    }
175
176    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
177        self._request_id = request_id;
178        self
179    }
180    /// Consumes the builder and constructs a [`QueryOutput`](crate::operation::query::QueryOutput).
181    /// This method will fail if any of the following fields are not set:
182    /// - [`query_id`](crate::operation::query::builders::QueryOutputBuilder::query_id)
183    /// - [`rows`](crate::operation::query::builders::QueryOutputBuilder::rows)
184    /// - [`column_info`](crate::operation::query::builders::QueryOutputBuilder::column_info)
185    pub fn build(self) -> ::std::result::Result<crate::operation::query::QueryOutput, ::aws_smithy_types::error::operation::BuildError> {
186        ::std::result::Result::Ok(crate::operation::query::QueryOutput {
187            query_id: self.query_id.ok_or_else(|| {
188                ::aws_smithy_types::error::operation::BuildError::missing_field(
189                    "query_id",
190                    "query_id was not specified but it is required when building QueryOutput",
191                )
192            })?,
193            next_token: self.next_token,
194            rows: self.rows.ok_or_else(|| {
195                ::aws_smithy_types::error::operation::BuildError::missing_field(
196                    "rows",
197                    "rows was not specified but it is required when building QueryOutput",
198                )
199            })?,
200            column_info: self.column_info.ok_or_else(|| {
201                ::aws_smithy_types::error::operation::BuildError::missing_field(
202                    "column_info",
203                    "column_info was not specified but it is required when building QueryOutput",
204                )
205            })?,
206            query_status: self.query_status,
207            query_insights_response: self.query_insights_response,
208            _request_id: self._request_id,
209        })
210    }
211}