1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_delete_query_definition_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<
|
8 - | crate::operation::delete_query_definition::DeleteQueryDefinitionOutput,
|
9 - | crate::operation::delete_query_definition::DeleteQueryDefinitionError,
|
10 - | > {
|
11 - | #[allow(unused_mut)]
|
12 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
13 - | .map_err(crate::operation::delete_query_definition::DeleteQueryDefinitionError::unhandled)?;
|
14 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
15 - | let generic = generic_builder.build();
|
16 - | let error_code = match generic.code() {
|
17 - | Some(code) => code,
|
18 - | None => return Err(crate::operation::delete_query_definition::DeleteQueryDefinitionError::unhandled(generic)),
|
19 - | };
|
20 - |
|
21 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
22 - | Err(match error_code {
|
23 - | "InvalidParameterException" => crate::operation::delete_query_definition::DeleteQueryDefinitionError::InvalidParameterException({
|
24 - | #[allow(unused_mut)]
|
25 - | let mut tmp = {
|
26 - | #[allow(unused_mut)]
|
27 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
28 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
29 - | .map_err(crate::operation::delete_query_definition::DeleteQueryDefinitionError::unhandled)?;
|
30 - | let output = output.meta(generic);
|
31 - | output.build()
|
32 - | };
|
33 - | if tmp.message.is_none() {
|
34 - | tmp.message = _error_message;
|
35 - | }
|
36 - | tmp
|
37 - | }),
|
38 - | "ResourceNotFoundException" => crate::operation::delete_query_definition::DeleteQueryDefinitionError::ResourceNotFoundException({
|
39 - | #[allow(unused_mut)]
|
40 - | let mut tmp = {
|
41 - | #[allow(unused_mut)]
|
42 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
43 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
44 - | .map_err(crate::operation::delete_query_definition::DeleteQueryDefinitionError::unhandled)?;
|
45 - | let output = output.meta(generic);
|
46 - | output.build()
|
47 - | };
|
48 - | if tmp.message.is_none() {
|
49 - | tmp.message = _error_message;
|
50 - | }
|
51 - | tmp
|
52 - | }),
|
53 - | "ServiceUnavailableException" => crate::operation::delete_query_definition::DeleteQueryDefinitionError::ServiceUnavailableException({
|
54 - | #[allow(unused_mut)]
|
55 - | let mut tmp = {
|
56 - | #[allow(unused_mut)]
|
57 - | let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
|
58 - | output =
|
59 - | crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
|
60 - | .map_err(crate::operation::delete_query_definition::DeleteQueryDefinitionError::unhandled)?;
|
61 - | let output = output.meta(generic);
|
62 - | output.build()
|
63 - | };
|
64 - | if tmp.message.is_none() {
|
65 - | tmp.message = _error_message;
|
66 - | }
|
67 - | tmp
|
68 - | }),
|
69 - | _ => crate::operation::delete_query_definition::DeleteQueryDefinitionError::generic(generic),
|
70 - | })
|
71 - | }
|
72 - |
|
73 - | #[allow(clippy::unnecessary_wraps)]
|
74 - | pub fn de_delete_query_definition_http_response(
|
75 - | _response_status: u16,
|
76 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
77 - | _response_body: &[u8],
|
78 - | ) -> std::result::Result<
|
79 - | crate::operation::delete_query_definition::DeleteQueryDefinitionOutput,
|
80 - | crate::operation::delete_query_definition::DeleteQueryDefinitionError,
|
81 - | > {
|
82 - | Ok({
|
83 - | #[allow(unused_mut)]
|
84 - | let mut output = crate::operation::delete_query_definition::builders::DeleteQueryDefinitionOutputBuilder::default();
|
85 - | output = crate::protocol_serde::shape_delete_query_definition::de_delete_query_definition(_response_body, output)
|
86 - | .map_err(crate::operation::delete_query_definition::DeleteQueryDefinitionError::unhandled)?;
|
87 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
88 - | output.build()
|
89 - | })
|
90 - | }
|
91 - |
|
92 - | pub fn ser_delete_query_definition_input(
|
93 - | input: &crate::operation::delete_query_definition::DeleteQueryDefinitionInput,
|
94 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
95 - | let mut out = String::new();
|
96 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
97 - | crate::protocol_serde::shape_delete_query_definition_input::ser_delete_query_definition_input_input(&mut object, input)?;
|
98 - | object.finish();
|
99 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
100 - | }
|
101 - |
|
102 - | pub(crate) fn de_delete_query_definition(
|
103 - | _value: &[u8],
|
104 - | mut builder: crate::operation::delete_query_definition::builders::DeleteQueryDefinitionOutputBuilder,
|
105 - | ) -> ::std::result::Result<
|
106 - | crate::operation::delete_query_definition::builders::DeleteQueryDefinitionOutputBuilder,
|
107 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
108 - | > {
|
109 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
110 - | let tokens = &mut tokens_owned;
|
111 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
112 - | loop {
|
113 - | match tokens.next().transpose()? {
|
114 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
115 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
116 - | "success" => {
|
117 - | builder = builder.set_success(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
118 - | }
|
119 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
120 - | },
|
121 - | other => {
|
122 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
123 - | "expected object key or end object, found: {other:?}"
|
124 - | )))
|
125 - | }
|
126 - | }
|
127 - | }
|
128 - | if tokens.next().is_some() {
|
129 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
130 - | "found more JSON tokens after completing parsing",
|
131 - | ));
|
132 - | }
|
133 - | Ok(builder)
|
134 - | }
|