aws_sdk_timestreamquery/operation/prepare_query/
_prepare_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)]
5pub struct PrepareQueryOutput {
6    /// <p>The query string that you want prepare.</p>
7    pub query_string: ::std::string::String,
8    /// <p>A list of SELECT clause columns of the submitted query string.</p>
9    pub columns: ::std::vec::Vec<crate::types::SelectColumn>,
10    /// <p>A list of parameters used in the submitted query string.</p>
11    pub parameters: ::std::vec::Vec<crate::types::ParameterMapping>,
12    _request_id: Option<String>,
13}
14impl PrepareQueryOutput {
15    /// <p>The query string that you want prepare.</p>
16    pub fn query_string(&self) -> &str {
17        use std::ops::Deref;
18        self.query_string.deref()
19    }
20    /// <p>A list of SELECT clause columns of the submitted query string.</p>
21    pub fn columns(&self) -> &[crate::types::SelectColumn] {
22        use std::ops::Deref;
23        self.columns.deref()
24    }
25    /// <p>A list of parameters used in the submitted query string.</p>
26    pub fn parameters(&self) -> &[crate::types::ParameterMapping] {
27        use std::ops::Deref;
28        self.parameters.deref()
29    }
30}
31impl ::std::fmt::Debug for PrepareQueryOutput {
32    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
33        let mut formatter = f.debug_struct("PrepareQueryOutput");
34        formatter.field("query_string", &"*** Sensitive Data Redacted ***");
35        formatter.field("columns", &self.columns);
36        formatter.field("parameters", &self.parameters);
37        formatter.field("_request_id", &self._request_id);
38        formatter.finish()
39    }
40}
41impl ::aws_types::request_id::RequestId for PrepareQueryOutput {
42    fn request_id(&self) -> Option<&str> {
43        self._request_id.as_deref()
44    }
45}
46impl PrepareQueryOutput {
47    /// Creates a new builder-style object to manufacture [`PrepareQueryOutput`](crate::operation::prepare_query::PrepareQueryOutput).
48    pub fn builder() -> crate::operation::prepare_query::builders::PrepareQueryOutputBuilder {
49        crate::operation::prepare_query::builders::PrepareQueryOutputBuilder::default()
50    }
51}
52
53/// A builder for [`PrepareQueryOutput`](crate::operation::prepare_query::PrepareQueryOutput).
54#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
55#[non_exhaustive]
56pub struct PrepareQueryOutputBuilder {
57    pub(crate) query_string: ::std::option::Option<::std::string::String>,
58    pub(crate) columns: ::std::option::Option<::std::vec::Vec<crate::types::SelectColumn>>,
59    pub(crate) parameters: ::std::option::Option<::std::vec::Vec<crate::types::ParameterMapping>>,
60    _request_id: Option<String>,
61}
62impl PrepareQueryOutputBuilder {
63    /// <p>The query string that you want prepare.</p>
64    /// This field is required.
65    pub fn query_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
66        self.query_string = ::std::option::Option::Some(input.into());
67        self
68    }
69    /// <p>The query string that you want prepare.</p>
70    pub fn set_query_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
71        self.query_string = input;
72        self
73    }
74    /// <p>The query string that you want prepare.</p>
75    pub fn get_query_string(&self) -> &::std::option::Option<::std::string::String> {
76        &self.query_string
77    }
78    /// Appends an item to `columns`.
79    ///
80    /// To override the contents of this collection use [`set_columns`](Self::set_columns).
81    ///
82    /// <p>A list of SELECT clause columns of the submitted query string.</p>
83    pub fn columns(mut self, input: crate::types::SelectColumn) -> Self {
84        let mut v = self.columns.unwrap_or_default();
85        v.push(input);
86        self.columns = ::std::option::Option::Some(v);
87        self
88    }
89    /// <p>A list of SELECT clause columns of the submitted query string.</p>
90    pub fn set_columns(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SelectColumn>>) -> Self {
91        self.columns = input;
92        self
93    }
94    /// <p>A list of SELECT clause columns of the submitted query string.</p>
95    pub fn get_columns(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SelectColumn>> {
96        &self.columns
97    }
98    /// Appends an item to `parameters`.
99    ///
100    /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
101    ///
102    /// <p>A list of parameters used in the submitted query string.</p>
103    pub fn parameters(mut self, input: crate::types::ParameterMapping) -> Self {
104        let mut v = self.parameters.unwrap_or_default();
105        v.push(input);
106        self.parameters = ::std::option::Option::Some(v);
107        self
108    }
109    /// <p>A list of parameters used in the submitted query string.</p>
110    pub fn set_parameters(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ParameterMapping>>) -> Self {
111        self.parameters = input;
112        self
113    }
114    /// <p>A list of parameters used in the submitted query string.</p>
115    pub fn get_parameters(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ParameterMapping>> {
116        &self.parameters
117    }
118    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
119        self._request_id = Some(request_id.into());
120        self
121    }
122
123    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
124        self._request_id = request_id;
125        self
126    }
127    /// Consumes the builder and constructs a [`PrepareQueryOutput`](crate::operation::prepare_query::PrepareQueryOutput).
128    /// This method will fail if any of the following fields are not set:
129    /// - [`query_string`](crate::operation::prepare_query::builders::PrepareQueryOutputBuilder::query_string)
130    /// - [`columns`](crate::operation::prepare_query::builders::PrepareQueryOutputBuilder::columns)
131    /// - [`parameters`](crate::operation::prepare_query::builders::PrepareQueryOutputBuilder::parameters)
132    pub fn build(
133        self,
134    ) -> ::std::result::Result<crate::operation::prepare_query::PrepareQueryOutput, ::aws_smithy_types::error::operation::BuildError> {
135        ::std::result::Result::Ok(crate::operation::prepare_query::PrepareQueryOutput {
136            query_string: self.query_string.ok_or_else(|| {
137                ::aws_smithy_types::error::operation::BuildError::missing_field(
138                    "query_string",
139                    "query_string was not specified but it is required when building PrepareQueryOutput",
140                )
141            })?,
142            columns: self.columns.ok_or_else(|| {
143                ::aws_smithy_types::error::operation::BuildError::missing_field(
144                    "columns",
145                    "columns was not specified but it is required when building PrepareQueryOutput",
146                )
147            })?,
148            parameters: self.parameters.ok_or_else(|| {
149                ::aws_smithy_types::error::operation::BuildError::missing_field(
150                    "parameters",
151                    "parameters was not specified but it is required when building PrepareQueryOutput",
152                )
153            })?,
154            _request_id: self._request_id,
155        })
156    }
157}
158impl ::std::fmt::Debug for PrepareQueryOutputBuilder {
159    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
160        let mut formatter = f.debug_struct("PrepareQueryOutputBuilder");
161        formatter.field("query_string", &"*** Sensitive Data Redacted ***");
162        formatter.field("columns", &self.columns);
163        formatter.field("parameters", &self.parameters);
164        formatter.field("_request_id", &self._request_id);
165        formatter.finish()
166    }
167}