133 137 | crate::operation::query::QueryError,
|
134 138 | >::new());
|
135 139 |
|
136 140 | ::std::borrow::Cow::Owned(rcb)
|
137 141 | }
|
138 142 | }
|
139 143 |
|
140 144 | #[derive(Debug)]
|
141 145 | struct QueryResponseDeserializer;
|
142 146 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for QueryResponseDeserializer {
|
143 - | fn deserialize_nonstreaming(
|
147 + | fn deserialize_nonstreaming_with_config(
|
144 148 | &self,
|
145 149 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
150 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
146 151 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
147 152 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
148 - | let headers = response.headers();
|
149 - | let body = response.body().bytes().expect("body loaded");
|
150 153 | #[allow(unused_mut)]
|
151 154 | let mut force_error = false;
|
152 155 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
153 - | let parse_result = if !success && status != 200 || force_error {
|
154 - | crate::protocol_serde::shape_query::de_query_http_error(status, headers, body)
|
156 + | if !success && status != 200 || force_error {
|
157 + | let headers = response.headers();
|
158 + | let body = response.body().bytes().expect("body loaded");
|
159 + | #[allow(unused_mut)]
|
160 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
161 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
162 + | })?;
|
163 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
164 + | let generic = generic_builder.build();
|
165 + | let error_code = match generic.code() {
|
166 + | ::std::option::Option::Some(code) => code,
|
167 + | ::std::option::Option::None => {
|
168 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
169 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::query::QueryError::unhandled(generic)),
|
170 + | ))
|
171 + | }
|
172 + | };
|
173 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
174 + | let protocol = _cfg
|
175 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
176 + | .expect("a SharedClientProtocol is required");
|
177 + | let err = match error_code {
|
178 + | "AccessDeniedException" => crate::operation::query::QueryError::AccessDeniedException({
|
179 + | let mut tmp = match protocol
|
180 + | .deserialize_response(response, crate::types::error::AccessDeniedException::SCHEMA, _cfg)
|
181 + | .and_then(|mut deser| {
|
182 + | crate::types::error::AccessDeniedException::deserialize_with_response(
|
183 + | &mut *deser,
|
184 + | response.headers(),
|
185 + | response.status().into(),
|
186 + | body,
|
187 + | )
|
188 + | }) {
|
189 + | ::std::result::Result::Ok(val) => val,
|
190 + | ::std::result::Result::Err(e) => {
|
191 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
192 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
193 + | ))
|
194 + | }
|
195 + | };
|
196 + | tmp.meta = generic;
|
197 + | if tmp.message.is_none() {
|
198 + | tmp.message = _error_message;
|
199 + | }
|
200 + | tmp
|
201 + | }),
|
202 + | "ConflictException" => crate::operation::query::QueryError::ConflictException({
|
203 + | let mut tmp = match protocol
|
204 + | .deserialize_response(response, crate::types::error::ConflictException::SCHEMA, _cfg)
|
205 + | .and_then(|mut deser| {
|
206 + | crate::types::error::ConflictException::deserialize_with_response(
|
207 + | &mut *deser,
|
208 + | response.headers(),
|
209 + | response.status().into(),
|
210 + | body,
|
211 + | )
|
212 + | }) {
|
213 + | ::std::result::Result::Ok(val) => val,
|
214 + | ::std::result::Result::Err(e) => {
|
215 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
216 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
217 + | ))
|
218 + | }
|
219 + | };
|
220 + | tmp.meta = generic;
|
221 + | if tmp.message.is_none() {
|
222 + | tmp.message = _error_message;
|
223 + | }
|
224 + | tmp
|
225 + | }),
|
226 + | "InternalServerException" => crate::operation::query::QueryError::InternalServerException({
|
227 + | let mut tmp = match protocol
|
228 + | .deserialize_response(response, crate::types::error::InternalServerException::SCHEMA, _cfg)
|
229 + | .and_then(|mut deser| {
|
230 + | crate::types::error::InternalServerException::deserialize_with_response(
|
231 + | &mut *deser,
|
232 + | response.headers(),
|
233 + | response.status().into(),
|
234 + | body,
|
235 + | )
|
236 + | }) {
|
237 + | ::std::result::Result::Ok(val) => val,
|
238 + | ::std::result::Result::Err(e) => {
|
239 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
240 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
241 + | ))
|
242 + | }
|
243 + | };
|
244 + | tmp.meta = generic;
|
245 + | if tmp.message.is_none() {
|
246 + | tmp.message = _error_message;
|
247 + | }
|
248 + | tmp
|
249 + | }),
|
250 + | "InvalidEndpointException" => crate::operation::query::QueryError::InvalidEndpointException({
|
251 + | let mut tmp = match protocol
|
252 + | .deserialize_response(response, crate::types::error::InvalidEndpointException::SCHEMA, _cfg)
|
253 + | .and_then(|mut deser| {
|
254 + | crate::types::error::InvalidEndpointException::deserialize_with_response(
|
255 + | &mut *deser,
|
256 + | response.headers(),
|
257 + | response.status().into(),
|
258 + | body,
|
259 + | )
|
260 + | }) {
|
261 + | ::std::result::Result::Ok(val) => val,
|
262 + | ::std::result::Result::Err(e) => {
|
263 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
264 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
265 + | ))
|
266 + | }
|
267 + | };
|
268 + | tmp.meta = generic;
|
269 + | if tmp.message.is_none() {
|
270 + | tmp.message = _error_message;
|
271 + | }
|
272 + | tmp
|
273 + | }),
|
274 + | "QueryExecutionException" => crate::operation::query::QueryError::QueryExecutionException({
|
275 + | let mut tmp = match protocol
|
276 + | .deserialize_response(response, crate::types::error::QueryExecutionException::SCHEMA, _cfg)
|
277 + | .and_then(|mut deser| {
|
278 + | crate::types::error::QueryExecutionException::deserialize_with_response(
|
279 + | &mut *deser,
|
280 + | response.headers(),
|
281 + | response.status().into(),
|
282 + | body,
|
283 + | )
|
284 + | }) {
|
285 + | ::std::result::Result::Ok(val) => val,
|
286 + | ::std::result::Result::Err(e) => {
|
287 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
288 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
289 + | ))
|
290 + | }
|
291 + | };
|
292 + | tmp.meta = generic;
|
293 + | if tmp.message.is_none() {
|
294 + | tmp.message = _error_message;
|
295 + | }
|
296 + | tmp
|
297 + | }),
|
298 + | "ThrottlingException" => crate::operation::query::QueryError::ThrottlingException({
|
299 + | let mut tmp = match protocol
|
300 + | .deserialize_response(response, crate::types::error::ThrottlingException::SCHEMA, _cfg)
|
301 + | .and_then(|mut deser| {
|
302 + | crate::types::error::ThrottlingException::deserialize_with_response(
|
303 + | &mut *deser,
|
304 + | response.headers(),
|
305 + | response.status().into(),
|
306 + | body,
|
307 + | )
|
308 + | }) {
|
309 + | ::std::result::Result::Ok(val) => val,
|
310 + | ::std::result::Result::Err(e) => {
|
311 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
312 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
313 + | ))
|
314 + | }
|
315 + | };
|
316 + | tmp.meta = generic;
|
317 + | if tmp.message.is_none() {
|
318 + | tmp.message = _error_message;
|
319 + | }
|
320 + | tmp
|
321 + | }),
|
322 + | "ValidationException" => crate::operation::query::QueryError::ValidationException({
|
323 + | let mut tmp = match protocol
|
324 + | .deserialize_response(response, crate::types::error::ValidationException::SCHEMA, _cfg)
|
325 + | .and_then(|mut deser| {
|
326 + | crate::types::error::ValidationException::deserialize_with_response(
|
327 + | &mut *deser,
|
328 + | response.headers(),
|
329 + | response.status().into(),
|
330 + | body,
|
331 + | )
|
332 + | }) {
|
333 + | ::std::result::Result::Ok(val) => val,
|
334 + | ::std::result::Result::Err(e) => {
|
335 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
336 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
337 + | ))
|
338 + | }
|
339 + | };
|
340 + | tmp.meta = generic;
|
341 + | if tmp.message.is_none() {
|
342 + | tmp.message = _error_message;
|
343 + | }
|
344 + | tmp
|
345 + | }),
|
346 + | _ => crate::operation::query::QueryError::generic(generic),
|
347 + | };
|
348 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
349 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
350 + | ))
|
155 351 | } else {
|
156 - | crate::protocol_serde::shape_query::de_query_http_response(status, headers, body)
|
157 - | };
|
158 - | crate::protocol_serde::type_erase_result(parse_result)
|
352 + | let protocol = _cfg
|
353 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
354 + | .expect("a SharedClientProtocol is required");
|
355 + | let mut deser = protocol.deserialize_response(response, Query::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
356 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
357 + | })?;
|
358 + | let body = response.body().bytes().expect("body loaded");
|
359 + | let output =
|
360 + | crate::operation::query::QueryOutput::deserialize_with_response(&mut *deser, response.headers(), response.status().into(), body)
|
361 + | .map_err(|e| {
|
362 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
|
363 + | e,
|
364 + | ))
|
365 + | })?;
|
366 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
367 + | }
|
159 368 | }
|
160 369 | }
|
161 370 | #[derive(Debug)]
|
162 371 | struct QueryRequestSerializer;
|
163 372 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for QueryRequestSerializer {
|
164 373 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
165 374 | fn serialize_input(
|
166 375 | &self,
|
167 376 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
168 377 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
169 378 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
170 379 | let input = input.downcast::<crate::operation::query::QueryInput>().expect("correct type");
|
171 - | let _header_serialization_settings = _cfg
|
172 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
173 - | .cloned()
|
174 - | .unwrap_or_default();
|
175 - | let mut request_builder = {
|
176 - | #[allow(clippy::uninlined_format_args)]
|
177 - | fn uri_base(
|
178 - | _input: &crate::operation::query::QueryInput,
|
179 - | output: &mut ::std::string::String,
|
180 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
181 - | use ::std::fmt::Write as _;
|
182 - | ::std::write!(output, "/").expect("formatting should succeed");
|
183 - | ::std::result::Result::Ok(())
|
184 - | }
|
185 - | #[allow(clippy::unnecessary_wraps)]
|
186 - | fn update_http_builder(
|
187 - | input: &crate::operation::query::QueryInput,
|
188 - | builder: ::http_1x::request::Builder,
|
189 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
190 - | let mut uri = ::std::string::String::new();
|
191 - | uri_base(input, &mut uri)?;
|
192 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
193 - | }
|
194 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
195 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.0");
|
196 - | builder = _header_serialization_settings.set_default_header(
|
197 - | builder,
|
198 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
199 - | "Timestream_20181101.Query",
|
200 - | );
|
201 - | builder
|
202 - | };
|
203 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_query::ser_query_input(&input)?);
|
204 - | if let Some(content_length) = body.content_length() {
|
205 - | let content_length = content_length.to_string();
|
206 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
207 - | }
|
208 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
380 + | let protocol = _cfg
|
381 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
382 + | .expect("a SharedClientProtocol is required");
|
383 + | let mut request = protocol
|
384 + | .serialize_request(&input, Query::INPUT_SCHEMA, "", _cfg)
|
385 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
386 + |
|
387 + | return ::std::result::Result::Ok(request);
|
209 388 | }
|
210 389 | }
|
211 390 | #[derive(Debug)]
|
212 391 | struct QueryEndpointParamsInterceptor;
|
213 392 |
|
214 393 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for QueryEndpointParamsInterceptor {
|
215 394 | fn name(&self) -> &'static str {
|
216 395 | "QueryEndpointParamsInterceptor"
|
217 396 | }
|
218 397 |
|