1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_list_aggregate_discovered_resources_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::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesOutput,
|
9 - | crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError,
|
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::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::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::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::unhandled(generic)),
|
19 - | };
|
20 - |
|
21 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
22 - | Err(match error_code {
|
23 - | "InvalidLimitException" => {
|
24 - | crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::InvalidLimitException({
|
25 - | #[allow(unused_mut)]
|
26 - | let mut tmp = {
|
27 - | #[allow(unused_mut)]
|
28 - | let mut output = crate::types::error::builders::InvalidLimitExceptionBuilder::default();
|
29 - | output = crate::protocol_serde::shape_invalid_limit_exception::de_invalid_limit_exception_json_err(_response_body, output)
|
30 - | .map_err(crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::unhandled)?;
|
31 - | let output = output.meta(generic);
|
32 - | output.build()
|
33 - | };
|
34 - | if tmp.message.is_none() {
|
35 - | tmp.message = _error_message;
|
36 - | }
|
37 - | tmp
|
38 - | })
|
39 - | }
|
40 - | "InvalidNextTokenException" => {
|
41 - | crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::InvalidNextTokenException({
|
42 - | #[allow(unused_mut)]
|
43 - | let mut tmp = {
|
44 - | #[allow(unused_mut)]
|
45 - | let mut output = crate::types::error::builders::InvalidNextTokenExceptionBuilder::default();
|
46 - | output =
|
47 - | crate::protocol_serde::shape_invalid_next_token_exception::de_invalid_next_token_exception_json_err(_response_body, output)
|
48 - | .map_err(crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::unhandled)?;
|
49 - | let output = output.meta(generic);
|
50 - | output.build()
|
51 - | };
|
52 - | if tmp.message.is_none() {
|
53 - | tmp.message = _error_message;
|
54 - | }
|
55 - | tmp
|
56 - | })
|
57 - | }
|
58 - | "NoSuchConfigurationAggregatorException" => {
|
59 - | crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::NoSuchConfigurationAggregatorException({
|
60 - | #[allow(unused_mut)]
|
61 - | let mut tmp = {
|
62 - | #[allow(unused_mut)]
|
63 - | let mut output = crate::types::error::builders::NoSuchConfigurationAggregatorExceptionBuilder::default();
|
64 - | 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::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::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 - | "ValidationException" => crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::ValidationException({
|
75 - | #[allow(unused_mut)]
|
76 - | let mut tmp = {
|
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)
|
80 - | .map_err(crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::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 - | _ => crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::generic(generic),
|
90 - | })
|
91 - | }
|
92 - |
|
93 - | #[allow(clippy::unnecessary_wraps)]
|
94 - | pub fn de_list_aggregate_discovered_resources_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::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesOutput,
|
100 - | crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError,
|
101 - | > {
|
102 - | Ok({
|
103 - | #[allow(unused_mut)]
|
104 - | let mut output = crate::operation::list_aggregate_discovered_resources::builders::ListAggregateDiscoveredResourcesOutputBuilder::default();
|
105 - | output = crate::protocol_serde::shape_list_aggregate_discovered_resources::de_list_aggregate_discovered_resources(_response_body, output)
|
106 - | .map_err(crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesError::unhandled)?;
|
107 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
108 - | output.build()
|
109 - | })
|
110 - | }
|
111 - |
|
112 - | pub fn ser_list_aggregate_discovered_resources_input(
|
113 - | input: &crate::operation::list_aggregate_discovered_resources::ListAggregateDiscoveredResourcesInput,
|
114 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
115 - | let mut out = String::new();
|
116 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
117 - | crate::protocol_serde::shape_list_aggregate_discovered_resources_input::ser_list_aggregate_discovered_resources_input_input(&mut object, input)?;
|
118 - | object.finish();
|
119 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
120 - | }
|
121 - |
|
122 - | pub(crate) fn de_list_aggregate_discovered_resources(
|
123 - | _value: &[u8],
|
124 - | mut builder: crate::operation::list_aggregate_discovered_resources::builders::ListAggregateDiscoveredResourcesOutputBuilder,
|
125 - | ) -> ::std::result::Result<
|
126 - | crate::operation::list_aggregate_discovered_resources::builders::ListAggregateDiscoveredResourcesOutputBuilder,
|
127 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
128 - | > {
|
129 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
130 - | let tokens = &mut tokens_owned;
|
131 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
132 - | loop {
|
133 - | match tokens.next().transpose()? {
|
134 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
135 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
136 - | "ResourceIdentifiers" => {
|
137 - | builder = builder.set_resource_identifiers(
|
138 - | crate::protocol_serde::shape_discovered_resource_identifier_list::de_discovered_resource_identifier_list(tokens, _value)?,
|
139 - | );
|
140 - | }
|
141 - | "NextToken" => {
|
142 - | builder = builder.set_next_token(
|
143 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
144 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
145 - | .transpose()?,
|
146 - | );
|
147 - | }
|
148 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
149 - | },
|
150 - | other => {
|
151 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
152 - | "expected object key or end object, found: {other:?}"
|
153 - | )))
|
154 - | }
|
155 - | }
|
156 - | }
|
157 - | if tokens.next().is_some() {
|
158 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
159 - | "found more JSON tokens after completing parsing",
|
160 - | ));
|
161 - | }
|
162 - | Ok(builder)
|
163 - | }
|