1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_select_aggregate_resource_config_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::select_aggregate_resource_config::SelectAggregateResourceConfigOutput,
|
9 - | crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError,
|
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::select_aggregate_resource_config::SelectAggregateResourceConfigError::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::select_aggregate_resource_config::SelectAggregateResourceConfigError::unhandled(generic)),
|
19 - | };
|
20 - |
|
21 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
22 - | Err(match error_code {
|
23 - | "InvalidExpressionException" => {
|
24 - | crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::InvalidExpressionException({
|
25 - | #[allow(unused_mut)]
|
26 - | let mut tmp = {
|
27 - | #[allow(unused_mut)]
|
28 - | let mut output = crate::types::error::builders::InvalidExpressionExceptionBuilder::default();
|
29 - | output =
|
30 - | crate::protocol_serde::shape_invalid_expression_exception::de_invalid_expression_exception_json_err(_response_body, output)
|
31 - | .map_err(crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::unhandled)?;
|
32 - | let output = output.meta(generic);
|
33 - | output.build()
|
34 - | };
|
35 - | if tmp.message.is_none() {
|
36 - | tmp.message = _error_message;
|
37 - | }
|
38 - | tmp
|
39 - | })
|
40 - | }
|
41 - | "InvalidLimitException" => crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::InvalidLimitException({
|
42 - | #[allow(unused_mut)]
|
43 - | let mut tmp = {
|
44 - | #[allow(unused_mut)]
|
45 - | let mut output = crate::types::error::builders::InvalidLimitExceptionBuilder::default();
|
46 - | output = crate::protocol_serde::shape_invalid_limit_exception::de_invalid_limit_exception_json_err(_response_body, output)
|
47 - | .map_err(crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::unhandled)?;
|
48 - | let output = output.meta(generic);
|
49 - | output.build()
|
50 - | };
|
51 - | if tmp.message.is_none() {
|
52 - | tmp.message = _error_message;
|
53 - | }
|
54 - | tmp
|
55 - | }),
|
56 - | "InvalidNextTokenException" => {
|
57 - | crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::InvalidNextTokenException({
|
58 - | #[allow(unused_mut)]
|
59 - | let mut tmp = {
|
60 - | #[allow(unused_mut)]
|
61 - | let mut output = crate::types::error::builders::InvalidNextTokenExceptionBuilder::default();
|
62 - | output =
|
63 - | crate::protocol_serde::shape_invalid_next_token_exception::de_invalid_next_token_exception_json_err(_response_body, output)
|
64 - | .map_err(crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::unhandled)?;
|
65 - | let output = output.meta(generic);
|
66 - | output.build()
|
67 - | };
|
68 - | if tmp.message.is_none() {
|
69 - | tmp.message = _error_message;
|
70 - | }
|
71 - | tmp
|
72 - | })
|
73 - | }
|
74 - | "NoSuchConfigurationAggregatorException" => {
|
75 - | crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::NoSuchConfigurationAggregatorException({
|
76 - | #[allow(unused_mut)]
|
77 - | let mut tmp = {
|
78 - | #[allow(unused_mut)]
|
79 - | let mut output = crate::types::error::builders::NoSuchConfigurationAggregatorExceptionBuilder::default();
|
80 - | output = crate::protocol_serde::shape_no_such_configuration_aggregator_exception::de_no_such_configuration_aggregator_exception_json_err(_response_body, output).map_err(crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::unhandled)?;
|
81 - | let output = output.meta(generic);
|
82 - | output.build()
|
83 - | };
|
84 - | if tmp.message.is_none() {
|
85 - | tmp.message = _error_message;
|
86 - | }
|
87 - | tmp
|
88 - | })
|
89 - | }
|
90 - | _ => crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::generic(generic),
|
91 - | })
|
92 - | }
|
93 - |
|
94 - | #[allow(clippy::unnecessary_wraps)]
|
95 - | pub fn de_select_aggregate_resource_config_http_response(
|
96 - | _response_status: u16,
|
97 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
98 - | _response_body: &[u8],
|
99 - | ) -> std::result::Result<
|
100 - | crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigOutput,
|
101 - | crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError,
|
102 - | > {
|
103 - | Ok({
|
104 - | #[allow(unused_mut)]
|
105 - | let mut output = crate::operation::select_aggregate_resource_config::builders::SelectAggregateResourceConfigOutputBuilder::default();
|
106 - | output = crate::protocol_serde::shape_select_aggregate_resource_config::de_select_aggregate_resource_config(_response_body, output)
|
107 - | .map_err(crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigError::unhandled)?;
|
108 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
109 - | output.build()
|
110 - | })
|
111 - | }
|
112 - |
|
113 - | pub fn ser_select_aggregate_resource_config_input(
|
114 - | input: &crate::operation::select_aggregate_resource_config::SelectAggregateResourceConfigInput,
|
115 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
116 - | let mut out = String::new();
|
117 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
118 - | crate::protocol_serde::shape_select_aggregate_resource_config_input::ser_select_aggregate_resource_config_input_input(&mut object, input)?;
|
119 - | object.finish();
|
120 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
121 - | }
|
122 - |
|
123 - | pub(crate) fn de_select_aggregate_resource_config(
|
124 - | _value: &[u8],
|
125 - | mut builder: crate::operation::select_aggregate_resource_config::builders::SelectAggregateResourceConfigOutputBuilder,
|
126 - | ) -> ::std::result::Result<
|
127 - | crate::operation::select_aggregate_resource_config::builders::SelectAggregateResourceConfigOutputBuilder,
|
128 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
129 - | > {
|
130 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
131 - | let tokens = &mut tokens_owned;
|
132 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
133 - | loop {
|
134 - | match tokens.next().transpose()? {
|
135 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
136 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
137 - | "Results" => {
|
138 - | builder = builder.set_results(crate::protocol_serde::shape_results::de_results(tokens, _value)?);
|
139 - | }
|
140 - | "QueryInfo" => {
|
141 - | builder = builder.set_query_info(crate::protocol_serde::shape_query_info::de_query_info(tokens, _value)?);
|
142 - | }
|
143 - | "NextToken" => {
|
144 - | builder = builder.set_next_token(
|
145 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
146 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
147 - | .transpose()?,
|
148 - | );
|
149 - | }
|
150 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
151 - | },
|
152 - | other => {
|
153 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
154 - | "expected object key or end object, found: {other:?}"
|
155 - | )))
|
156 - | }
|
157 - | }
|
158 - | }
|
159 - | if tokens.next().is_some() {
|
160 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
161 - | "found more JSON tokens after completing parsing",
|
162 - | ));
|
163 - | }
|
164 - | Ok(builder)
|
165 - | }
|