1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_resource_config_history_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_resource_config_history::GetResourceConfigHistoryOutput,
|
9 - | crate::operation::get_resource_config_history::GetResourceConfigHistoryError,
|
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_resource_config_history::GetResourceConfigHistoryError::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_resource_config_history::GetResourceConfigHistoryError::unhandled(
|
20 - | generic,
|
21 - | ))
|
22 - | }
|
23 - | };
|
24 - |
|
25 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
26 - | Err(match error_code {
|
27 - | "InvalidLimitException" => crate::operation::get_resource_config_history::GetResourceConfigHistoryError::InvalidLimitException({
|
28 - | #[allow(unused_mut)]
|
29 - | let mut tmp = {
|
30 - | #[allow(unused_mut)]
|
31 - | let mut output = crate::types::error::builders::InvalidLimitExceptionBuilder::default();
|
32 - | output = crate::protocol_serde::shape_invalid_limit_exception::de_invalid_limit_exception_json_err(_response_body, output)
|
33 - | .map_err(crate::operation::get_resource_config_history::GetResourceConfigHistoryError::unhandled)?;
|
34 - | let output = output.meta(generic);
|
35 - | output.build()
|
36 - | };
|
37 - | if tmp.message.is_none() {
|
38 - | tmp.message = _error_message;
|
39 - | }
|
40 - | tmp
|
41 - | }),
|
42 - | "InvalidNextTokenException" => crate::operation::get_resource_config_history::GetResourceConfigHistoryError::InvalidNextTokenException({
|
43 - | #[allow(unused_mut)]
|
44 - | let mut tmp = {
|
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)
|
48 - | .map_err(crate::operation::get_resource_config_history::GetResourceConfigHistoryError::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 - | "InvalidTimeRangeException" => crate::operation::get_resource_config_history::GetResourceConfigHistoryError::InvalidTimeRangeException({
|
58 - | #[allow(unused_mut)]
|
59 - | let mut tmp = {
|
60 - | #[allow(unused_mut)]
|
61 - | let mut output = crate::types::error::builders::InvalidTimeRangeExceptionBuilder::default();
|
62 - | output = crate::protocol_serde::shape_invalid_time_range_exception::de_invalid_time_range_exception_json_err(_response_body, output)
|
63 - | .map_err(crate::operation::get_resource_config_history::GetResourceConfigHistoryError::unhandled)?;
|
64 - | let output = output.meta(generic);
|
65 - | output.build()
|
66 - | };
|
67 - | if tmp.message.is_none() {
|
68 - | tmp.message = _error_message;
|
69 - | }
|
70 - | tmp
|
71 - | }),
|
72 - | "NoAvailableConfigurationRecorderException" => {
|
73 - | crate::operation::get_resource_config_history::GetResourceConfigHistoryError::NoAvailableConfigurationRecorderException({
|
74 - | #[allow(unused_mut)]
|
75 - | let mut tmp = {
|
76 - | #[allow(unused_mut)]
|
77 - | let mut output = crate::types::error::builders::NoAvailableConfigurationRecorderExceptionBuilder::default();
|
78 - | output = crate::protocol_serde::shape_no_available_configuration_recorder_exception::de_no_available_configuration_recorder_exception_json_err(_response_body, output).map_err(crate::operation::get_resource_config_history::GetResourceConfigHistoryError::unhandled)?;
|
79 - | let output = output.meta(generic);
|
80 - | output.build()
|
81 - | };
|
82 - | if tmp.message.is_none() {
|
83 - | tmp.message = _error_message;
|
84 - | }
|
85 - | tmp
|
86 - | })
|
87 - | }
|
88 - | "ResourceNotDiscoveredException" => {
|
89 - | crate::operation::get_resource_config_history::GetResourceConfigHistoryError::ResourceNotDiscoveredException({
|
90 - | #[allow(unused_mut)]
|
91 - | let mut tmp = {
|
92 - | #[allow(unused_mut)]
|
93 - | let mut output = crate::types::error::builders::ResourceNotDiscoveredExceptionBuilder::default();
|
94 - | output = crate::protocol_serde::shape_resource_not_discovered_exception::de_resource_not_discovered_exception_json_err(
|
95 - | _response_body,
|
96 - | output,
|
97 - | )
|
98 - | .map_err(crate::operation::get_resource_config_history::GetResourceConfigHistoryError::unhandled)?;
|
99 - | let output = output.meta(generic);
|
100 - | output.build()
|
101 - | };
|
102 - | if tmp.message.is_none() {
|
103 - | tmp.message = _error_message;
|
104 - | }
|
105 - | tmp
|
106 - | })
|
107 - | }
|
108 - | "ValidationException" => crate::operation::get_resource_config_history::GetResourceConfigHistoryError::ValidationException({
|
109 - | #[allow(unused_mut)]
|
110 - | let mut tmp = {
|
111 - | #[allow(unused_mut)]
|
112 - | let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
|
113 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
114 - | .map_err(crate::operation::get_resource_config_history::GetResourceConfigHistoryError::unhandled)?;
|
115 - | let output = output.meta(generic);
|
116 - | output.build()
|
117 - | };
|
118 - | if tmp.message.is_none() {
|
119 - | tmp.message = _error_message;
|
120 - | }
|
121 - | tmp
|
122 - | }),
|
123 - | _ => crate::operation::get_resource_config_history::GetResourceConfigHistoryError::generic(generic),
|
124 - | })
|
125 - | }
|
126 - |
|
127 - | #[allow(clippy::unnecessary_wraps)]
|
128 - | pub fn de_get_resource_config_history_http_response(
|
129 - | _response_status: u16,
|
130 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
131 - | _response_body: &[u8],
|
132 - | ) -> std::result::Result<
|
133 - | crate::operation::get_resource_config_history::GetResourceConfigHistoryOutput,
|
134 - | crate::operation::get_resource_config_history::GetResourceConfigHistoryError,
|
135 - | > {
|
136 - | Ok({
|
137 - | #[allow(unused_mut)]
|
138 - | let mut output = crate::operation::get_resource_config_history::builders::GetResourceConfigHistoryOutputBuilder::default();
|
139 - | output = crate::protocol_serde::shape_get_resource_config_history::de_get_resource_config_history(_response_body, output)
|
140 - | .map_err(crate::operation::get_resource_config_history::GetResourceConfigHistoryError::unhandled)?;
|
141 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
142 - | output.build()
|
143 - | })
|
144 - | }
|
145 - |
|
146 - | pub fn ser_get_resource_config_history_input(
|
147 - | input: &crate::operation::get_resource_config_history::GetResourceConfigHistoryInput,
|
148 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
149 - | let mut out = String::new();
|
150 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
151 - | crate::protocol_serde::shape_get_resource_config_history_input::ser_get_resource_config_history_input_input(&mut object, input)?;
|
152 - | object.finish();
|
153 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
154 - | }
|
155 - |
|
156 - | pub(crate) fn de_get_resource_config_history(
|
157 - | _value: &[u8],
|
158 - | mut builder: crate::operation::get_resource_config_history::builders::GetResourceConfigHistoryOutputBuilder,
|
159 - | ) -> ::std::result::Result<
|
160 - | crate::operation::get_resource_config_history::builders::GetResourceConfigHistoryOutputBuilder,
|
161 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
162 - | > {
|
163 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
164 - | let tokens = &mut tokens_owned;
|
165 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
166 - | loop {
|
167 - | match tokens.next().transpose()? {
|
168 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
169 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
170 - | "configurationItems" => {
|
171 - | builder = builder.set_configuration_items(crate::protocol_serde::shape_configuration_item_list::de_configuration_item_list(
|
172 - | tokens, _value,
|
173 - | )?);
|
174 - | }
|
175 - | "nextToken" => {
|
176 - | builder = builder.set_next_token(
|
177 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
178 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
179 - | .transpose()?,
|
180 - | );
|
181 - | }
|
182 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
183 - | },
|
184 - | other => {
|
185 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
186 - | "expected object key or end object, found: {other:?}"
|
187 - | )))
|
188 - | }
|
189 - | }
|
190 - | }
|
191 - | if tokens.next().is_some() {
|
192 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
193 - | "found more JSON tokens after completing parsing",
|
194 - | ));
|
195 - | }
|
196 - | Ok(builder)
|
197 - | }
|