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