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