1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_event_source_mapping_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_event_source_mapping::GetEventSourceMappingOutput,
|
9 - | crate::operation::get_event_source_mapping::GetEventSourceMappingError,
|
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_event_source_mapping::GetEventSourceMappingError::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::get_event_source_mapping::GetEventSourceMappingError::unhandled(generic)),
|
19 - | };
|
20 - |
|
21 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
22 - | Err(match error_code {
|
23 - | "InvalidParameterValueException" => crate::operation::get_event_source_mapping::GetEventSourceMappingError::InvalidParameterValueException({
|
24 - | #[allow(unused_mut)]
|
25 - | let mut tmp = {
|
26 - | #[allow(unused_mut)]
|
27 - | let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
|
28 - | output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(
|
29 - | _response_body,
|
30 - | output,
|
31 - | )
|
32 - | .map_err(crate::operation::get_event_source_mapping::GetEventSourceMappingError::unhandled)?;
|
33 - | let output = output.meta(generic);
|
34 - | output.build()
|
35 - | };
|
36 - | if tmp.message.is_none() {
|
37 - | tmp.message = _error_message;
|
38 - | }
|
39 - | tmp
|
40 - | }),
|
41 - | "ResourceNotFoundException" => crate::operation::get_event_source_mapping::GetEventSourceMappingError::ResourceNotFoundException({
|
42 - | #[allow(unused_mut)]
|
43 - | let mut tmp = {
|
44 - | #[allow(unused_mut)]
|
45 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
46 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
47 - | .map_err(crate::operation::get_event_source_mapping::GetEventSourceMappingError::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 - | "ServiceException" => crate::operation::get_event_source_mapping::GetEventSourceMappingError::ServiceException({
|
57 - | #[allow(unused_mut)]
|
58 - | let mut tmp = {
|
59 - | #[allow(unused_mut)]
|
60 - | let mut output = crate::types::error::builders::ServiceExceptionBuilder::default();
|
61 - | output = crate::protocol_serde::shape_service_exception::de_service_exception_json_err(_response_body, output)
|
62 - | .map_err(crate::operation::get_event_source_mapping::GetEventSourceMappingError::unhandled)?;
|
63 - | let output = output.meta(generic);
|
64 - | output.build()
|
65 - | };
|
66 - | if tmp.message.is_none() {
|
67 - | tmp.message = _error_message;
|
68 - | }
|
69 - | tmp
|
70 - | }),
|
71 - | "TooManyRequestsException" => crate::operation::get_event_source_mapping::GetEventSourceMappingError::TooManyRequestsException({
|
72 - | #[allow(unused_mut)]
|
73 - | let mut tmp = {
|
74 - | #[allow(unused_mut)]
|
75 - | let mut output = crate::types::error::builders::TooManyRequestsExceptionBuilder::default();
|
76 - | output = crate::protocol_serde::shape_too_many_requests_exception::de_too_many_requests_exception_json_err(_response_body, output)
|
77 - | .map_err(crate::operation::get_event_source_mapping::GetEventSourceMappingError::unhandled)?;
|
78 - | output = output.set_retry_after_seconds(
|
79 - | crate::protocol_serde::shape_too_many_requests_exception::de_retry_after_seconds_header(_response_headers).map_err(|_| {
|
80 - | crate::operation::get_event_source_mapping::GetEventSourceMappingError::unhandled(
|
81 - | "Failed to parse retryAfterSeconds from header `Retry-After",
|
82 - | )
|
83 - | })?,
|
84 - | );
|
85 - | let output = output.meta(generic);
|
86 - | output.build()
|
87 - | };
|
88 - | if tmp.message.is_none() {
|
89 - | tmp.message = _error_message;
|
90 - | }
|
91 - | tmp
|
92 - | }),
|
93 - | _ => crate::operation::get_event_source_mapping::GetEventSourceMappingError::generic(generic),
|
94 - | })
|
95 - | }
|
96 - |
|
97 - | #[allow(clippy::unnecessary_wraps)]
|
98 - | pub fn de_get_event_source_mapping_http_response(
|
99 - | _response_status: u16,
|
100 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
101 - | _response_body: &[u8],
|
102 - | ) -> std::result::Result<
|
103 - | crate::operation::get_event_source_mapping::GetEventSourceMappingOutput,
|
104 - | crate::operation::get_event_source_mapping::GetEventSourceMappingError,
|
105 - | > {
|
106 - | Ok({
|
107 - | #[allow(unused_mut)]
|
108 - | let mut output = crate::operation::get_event_source_mapping::builders::GetEventSourceMappingOutputBuilder::default();
|
109 - | output = crate::protocol_serde::shape_get_event_source_mapping::de_get_event_source_mapping(_response_body, output)
|
110 - | .map_err(crate::operation::get_event_source_mapping::GetEventSourceMappingError::unhandled)?;
|
111 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
112 - | output.build()
|
113 - | })
|
114 - | }
|
115 - |
|
116 - | pub(crate) fn de_get_event_source_mapping(
|
117 - | _value: &[u8],
|
118 - | mut builder: crate::operation::get_event_source_mapping::builders::GetEventSourceMappingOutputBuilder,
|
119 - | ) -> ::std::result::Result<
|
120 - | crate::operation::get_event_source_mapping::builders::GetEventSourceMappingOutputBuilder,
|
121 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
122 - | > {
|
123 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
124 - | let tokens = &mut tokens_owned;
|
125 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
126 - | loop {
|
127 - | match tokens.next().transpose()? {
|
128 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
129 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
130 - | "AmazonManagedKafkaEventSourceConfig" => {
|
131 - | builder = builder.set_amazon_managed_kafka_event_source_config(
|
132 - | crate::protocol_serde::shape_amazon_managed_kafka_event_source_config::de_amazon_managed_kafka_event_source_config(
|
133 - | tokens, _value,
|
134 - | )?,
|
135 - | );
|
136 - | }
|
137 - | "BatchSize" => {
|
138 - | builder = builder.set_batch_size(
|
139 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
140 - | .map(i32::try_from)
|
141 - | .transpose()?,
|
142 - | );
|
143 - | }
|
144 - | "BisectBatchOnFunctionError" => {
|
145 - | builder = builder.set_bisect_batch_on_function_error(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
146 - | }
|
147 - | "DestinationConfig" => {
|
148 - | builder = builder.set_destination_config(crate::protocol_serde::shape_destination_config::de_destination_config(tokens, _value)?);
|
149 - | }
|
150 - | "DocumentDBEventSourceConfig" => {
|
151 - | builder = builder.set_document_db_event_source_config(
|
152 - | crate::protocol_serde::shape_document_db_event_source_config::de_document_db_event_source_config(tokens, _value)?,
|
153 - | );
|
154 - | }
|
155 - | "EventSourceArn" => {
|
156 - | builder = builder.set_event_source_arn(
|
157 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
158 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
159 - | .transpose()?,
|
160 - | );
|
161 - | }
|
162 - | "EventSourceMappingArn" => {
|
163 - | builder = builder.set_event_source_mapping_arn(
|
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 - | "FilterCriteria" => {
|
170 - | builder = builder.set_filter_criteria(crate::protocol_serde::shape_filter_criteria::de_filter_criteria(tokens, _value)?);
|
171 - | }
|
172 - | "FilterCriteriaError" => {
|
173 - | builder = builder.set_filter_criteria_error(crate::protocol_serde::shape_filter_criteria_error::de_filter_criteria_error(
|
174 - | tokens, _value,
|
175 - | )?);
|
176 - | }
|
177 - | "FunctionArn" => {
|
178 - | builder = builder.set_function_arn(
|
179 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
180 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
181 - | .transpose()?,
|
182 - | );
|
183 - | }
|
184 - | "FunctionResponseTypes" => {
|
185 - | builder = builder.set_function_response_types(
|
186 - | crate::protocol_serde::shape_function_response_type_list::de_function_response_type_list(tokens, _value)?,
|
187 - | );
|
188 - | }
|
189 - | "KMSKeyArn" => {
|
190 - | builder = builder.set_kms_key_arn(
|
191 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
192 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
193 - | .transpose()?,
|
194 - | );
|
195 - | }
|
196 - | "LastModified" => {
|
197 - | builder = builder.set_last_modified(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
198 - | tokens.next(),
|
199 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
200 - | )?);
|
201 - | }
|
202 - | "LastProcessingResult" => {
|
203 - | builder = builder.set_last_processing_result(
|
204 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
205 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
206 - | .transpose()?,
|
207 - | );
|
208 - | }
|
209 - | "MaximumBatchingWindowInSeconds" => {
|
210 - | builder = builder.set_maximum_batching_window_in_seconds(
|
211 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
212 - | .map(i32::try_from)
|
213 - | .transpose()?,
|
214 - | );
|
215 - | }
|
216 - | "MaximumRecordAgeInSeconds" => {
|
217 - | builder = builder.set_maximum_record_age_in_seconds(
|
218 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
219 - | .map(i32::try_from)
|
220 - | .transpose()?,
|
221 - | );
|
222 - | }
|
223 - | "MaximumRetryAttempts" => {
|
224 - | builder = builder.set_maximum_retry_attempts(
|
225 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
226 - | .map(i32::try_from)
|
227 - | .transpose()?,
|
228 - | );
|
229 - | }
|
230 - | "MetricsConfig" => {
|
231 - | builder = builder.set_metrics_config(
|
232 - | crate::protocol_serde::shape_event_source_mapping_metrics_config::de_event_source_mapping_metrics_config(tokens, _value)?,
|
233 - | );
|
234 - | }
|
235 - | "ParallelizationFactor" => {
|
236 - | builder = builder.set_parallelization_factor(
|
237 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
238 - | .map(i32::try_from)
|
239 - | .transpose()?,
|
240 - | );
|
241 - | }
|
242 - | "ProvisionedPollerConfig" => {
|
243 - | builder = builder.set_provisioned_poller_config(
|
244 - | crate::protocol_serde::shape_provisioned_poller_config::de_provisioned_poller_config(tokens, _value)?,
|
245 - | );
|
246 - | }
|
247 - | "Queues" => {
|
248 - | builder = builder.set_queues(crate::protocol_serde::shape_queues::de_queues(tokens, _value)?);
|
249 - | }
|
250 - | "ScalingConfig" => {
|
251 - | builder = builder.set_scaling_config(crate::protocol_serde::shape_scaling_config::de_scaling_config(tokens, _value)?);
|
252 - | }
|
253 - | "SelfManagedEventSource" => {
|
254 - | builder = builder.set_self_managed_event_source(
|
255 - | crate::protocol_serde::shape_self_managed_event_source::de_self_managed_event_source(tokens, _value)?,
|
256 - | );
|
257 - | }
|
258 - | "SelfManagedKafkaEventSourceConfig" => {
|
259 - | builder = builder.set_self_managed_kafka_event_source_config(
|
260 - | crate::protocol_serde::shape_self_managed_kafka_event_source_config::de_self_managed_kafka_event_source_config(
|
261 - | tokens, _value,
|
262 - | )?,
|
263 - | );
|
264 - | }
|
265 - | "SourceAccessConfigurations" => {
|
266 - | builder = builder.set_source_access_configurations(
|
267 - | crate::protocol_serde::shape_source_access_configurations::de_source_access_configurations(tokens, _value)?,
|
268 - | );
|
269 - | }
|
270 - | "StartingPosition" => {
|
271 - | builder = builder.set_starting_position(
|
272 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
273 - | .map(|s| s.to_unescaped().map(|u| crate::types::EventSourcePosition::from(u.as_ref())))
|
274 - | .transpose()?,
|
275 - | );
|
276 - | }
|
277 - | "StartingPositionTimestamp" => {
|
278 - | builder = builder.set_starting_position_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
279 - | tokens.next(),
|
280 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
281 - | )?);
|
282 - | }
|
283 - | "State" => {
|
284 - | builder = builder.set_state(
|
285 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
286 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
287 - | .transpose()?,
|
288 - | );
|
289 - | }
|
290 - | "StateTransitionReason" => {
|
291 - | builder = builder.set_state_transition_reason(
|
292 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
293 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
294 - | .transpose()?,
|
295 - | );
|
296 - | }
|
297 - | "Topics" => {
|
298 - | builder = builder.set_topics(crate::protocol_serde::shape_topics::de_topics(tokens, _value)?);
|
299 - | }
|
300 - | "TumblingWindowInSeconds" => {
|
301 - | builder = builder.set_tumbling_window_in_seconds(
|
302 - | ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
|
303 - | .map(i32::try_from)
|
304 - | .transpose()?,
|
305 - | );
|
306 - | }
|
307 - | "UUID" => {
|
308 - | builder = builder.set_uuid(
|
309 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
310 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
311 - | .transpose()?,
|
312 - | );
|
313 - | }
|
314 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
315 - | },
|
316 - | other => {
|
317 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
318 - | "expected object key or end object, found: {other:?}"
|
319 - | )))
|
320 - | }
|
321 - | }
|
322 - | }
|
323 - | if tokens.next().is_some() {
|
324 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
325 - | "found more JSON tokens after completing parsing",
|
326 - | ));
|
327 - | }
|
328 - | Ok(builder)
|
329 - | }
|