1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The response elements represent the output of a request to run a SQL statement against a database.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct ExecuteStatementOutput {
    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    pub records: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::Field>>>,
    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    pub column_metadata: ::std::option::Option<::std::vec::Vec<crate::types::ColumnMetadata>>,
    /// <p>The number of records updated by the request.</p>
    pub number_of_records_updated: i64,
    /// <p>Values for fields generated during a DML request.</p><note>
    /// <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p>
    /// </note>
    pub generated_fields: ::std::option::Option<::std::vec::Vec<crate::types::Field>>,
    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    /// <p>The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.</p>
    pub formatted_records: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ExecuteStatementOutput {
    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.records.is_none()`.
    pub fn records(&self) -> &[::std::vec::Vec<crate::types::Field>] {
        self.records.as_deref().unwrap_or_default()
    }
    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.column_metadata.is_none()`.
    pub fn column_metadata(&self) -> &[crate::types::ColumnMetadata] {
        self.column_metadata.as_deref().unwrap_or_default()
    }
    /// <p>The number of records updated by the request.</p>
    pub fn number_of_records_updated(&self) -> i64 {
        self.number_of_records_updated
    }
    /// <p>Values for fields generated during a DML request.</p><note>
    /// <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p>
    /// </note>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.generated_fields.is_none()`.
    pub fn generated_fields(&self) -> &[crate::types::Field] {
        self.generated_fields.as_deref().unwrap_or_default()
    }
    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    /// <p>The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.</p>
    pub fn formatted_records(&self) -> ::std::option::Option<&str> {
        self.formatted_records.as_deref()
    }
}
impl ::aws_types::request_id::RequestId for ExecuteStatementOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl ExecuteStatementOutput {
    /// Creates a new builder-style object to manufacture [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
    pub fn builder() -> crate::operation::execute_statement::builders::ExecuteStatementOutputBuilder {
        crate::operation::execute_statement::builders::ExecuteStatementOutputBuilder::default()
    }
}

/// A builder for [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct ExecuteStatementOutputBuilder {
    pub(crate) records: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::Field>>>,
    pub(crate) column_metadata: ::std::option::Option<::std::vec::Vec<crate::types::ColumnMetadata>>,
    pub(crate) number_of_records_updated: ::std::option::Option<i64>,
    pub(crate) generated_fields: ::std::option::Option<::std::vec::Vec<crate::types::Field>>,
    pub(crate) formatted_records: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl ExecuteStatementOutputBuilder {
    /// Appends an item to `records`.
    ///
    /// To override the contents of this collection use [`set_records`](Self::set_records).
    ///
    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    pub fn records(mut self, input: ::std::vec::Vec<crate::types::Field>) -> Self {
        let mut v = self.records.unwrap_or_default();
        v.push(input);
        self.records = ::std::option::Option::Some(v);
        self
    }
    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    pub fn set_records(mut self, input: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::Field>>>) -> Self {
        self.records = input;
        self
    }
    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    pub fn get_records(&self) -> &::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::Field>>> {
        &self.records
    }
    /// Appends an item to `column_metadata`.
    ///
    /// To override the contents of this collection use [`set_column_metadata`](Self::set_column_metadata).
    ///
    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    pub fn column_metadata(mut self, input: crate::types::ColumnMetadata) -> Self {
        let mut v = self.column_metadata.unwrap_or_default();
        v.push(input);
        self.column_metadata = ::std::option::Option::Some(v);
        self
    }
    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    pub fn set_column_metadata(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ColumnMetadata>>) -> Self {
        self.column_metadata = input;
        self
    }
    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    pub fn get_column_metadata(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ColumnMetadata>> {
        &self.column_metadata
    }
    /// <p>The number of records updated by the request.</p>
    pub fn number_of_records_updated(mut self, input: i64) -> Self {
        self.number_of_records_updated = ::std::option::Option::Some(input);
        self
    }
    /// <p>The number of records updated by the request.</p>
    pub fn set_number_of_records_updated(mut self, input: ::std::option::Option<i64>) -> Self {
        self.number_of_records_updated = input;
        self
    }
    /// <p>The number of records updated by the request.</p>
    pub fn get_number_of_records_updated(&self) -> &::std::option::Option<i64> {
        &self.number_of_records_updated
    }
    /// Appends an item to `generated_fields`.
    ///
    /// To override the contents of this collection use [`set_generated_fields`](Self::set_generated_fields).
    ///
    /// <p>Values for fields generated during a DML request.</p><note>
    /// <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p>
    /// </note>
    pub fn generated_fields(mut self, input: crate::types::Field) -> Self {
        let mut v = self.generated_fields.unwrap_or_default();
        v.push(input);
        self.generated_fields = ::std::option::Option::Some(v);
        self
    }
    /// <p>Values for fields generated during a DML request.</p><note>
    /// <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p>
    /// </note>
    pub fn set_generated_fields(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Field>>) -> Self {
        self.generated_fields = input;
        self
    }
    /// <p>Values for fields generated during a DML request.</p><note>
    /// <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p>
    /// </note>
    pub fn get_generated_fields(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Field>> {
        &self.generated_fields
    }
    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    /// <p>The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.</p>
    pub fn formatted_records(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.formatted_records = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    /// <p>The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.</p>
    pub fn set_formatted_records(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.formatted_records = input;
        self
    }
    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
    /// <p>The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.</p>
    pub fn get_formatted_records(&self) -> &::std::option::Option<::std::string::String> {
        &self.formatted_records
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
    pub fn build(self) -> crate::operation::execute_statement::ExecuteStatementOutput {
        crate::operation::execute_statement::ExecuteStatementOutput {
            records: self.records,
            column_metadata: self.column_metadata,
            number_of_records_updated: self.number_of_records_updated.unwrap_or_default(),
            generated_fields: self.generated_fields,
            formatted_records: self.formatted_records,
            _request_id: self._request_id,
        }
    }
}