aws_sdk_swf/protocol_serde/
shape_history_event.rs1pub(crate) fn de_history_event<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::HistoryEvent>, ::aws_smithy_json::deserialize::error::DeserializeError>
5where
6 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
7{
8 match tokens.next().transpose()? {
9 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
10 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
11 #[allow(unused_mut)]
12 let mut builder = crate::types::builders::HistoryEventBuilder::default();
13 loop {
14 match tokens.next().transpose()? {
15 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
16 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
17 match key.to_unescaped()?.as_ref() {
18 "eventTimestamp" => {
19 builder = builder.set_event_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
20 tokens.next(),
21 ::aws_smithy_types::date_time::Format::EpochSeconds,
22 )?);
23 }
24 "eventType" => {
25 builder = builder.set_event_type(
26 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27 .map(|s| s.to_unescaped().map(|u| crate::types::EventType::from(u.as_ref())))
28 .transpose()?,
29 );
30 }
31 "eventId" => {
32 builder = builder.set_event_id(
33 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
34 .map(i64::try_from)
35 .transpose()?,
36 );
37 }
38 "workflowExecutionStartedEventAttributes" => {
39 builder = builder.set_workflow_execution_started_event_attributes(
40 crate::protocol_serde::shape_workflow_execution_started_event_attributes::de_workflow_execution_started_event_attributes(tokens)?
41 );
42 }
43 "workflowExecutionCompletedEventAttributes" => {
44 builder = builder.set_workflow_execution_completed_event_attributes(
45 crate::protocol_serde::shape_workflow_execution_completed_event_attributes::de_workflow_execution_completed_event_attributes(tokens)?
46 );
47 }
48 "completeWorkflowExecutionFailedEventAttributes" => {
49 builder = builder.set_complete_workflow_execution_failed_event_attributes(
50 crate::protocol_serde::shape_complete_workflow_execution_failed_event_attributes::de_complete_workflow_execution_failed_event_attributes(tokens)?
51 );
52 }
53 "workflowExecutionFailedEventAttributes" => {
54 builder = builder.set_workflow_execution_failed_event_attributes(
55 crate::protocol_serde::shape_workflow_execution_failed_event_attributes::de_workflow_execution_failed_event_attributes(tokens)?
56 );
57 }
58 "failWorkflowExecutionFailedEventAttributes" => {
59 builder = builder.set_fail_workflow_execution_failed_event_attributes(
60 crate::protocol_serde::shape_fail_workflow_execution_failed_event_attributes::de_fail_workflow_execution_failed_event_attributes(tokens)?
61 );
62 }
63 "workflowExecutionTimedOutEventAttributes" => {
64 builder = builder.set_workflow_execution_timed_out_event_attributes(
65 crate::protocol_serde::shape_workflow_execution_timed_out_event_attributes::de_workflow_execution_timed_out_event_attributes(tokens)?
66 );
67 }
68 "workflowExecutionCanceledEventAttributes" => {
69 builder = builder.set_workflow_execution_canceled_event_attributes(
70 crate::protocol_serde::shape_workflow_execution_canceled_event_attributes::de_workflow_execution_canceled_event_attributes(tokens)?
71 );
72 }
73 "cancelWorkflowExecutionFailedEventAttributes" => {
74 builder = builder.set_cancel_workflow_execution_failed_event_attributes(
75 crate::protocol_serde::shape_cancel_workflow_execution_failed_event_attributes::de_cancel_workflow_execution_failed_event_attributes(tokens)?
76 );
77 }
78 "workflowExecutionContinuedAsNewEventAttributes" => {
79 builder = builder.set_workflow_execution_continued_as_new_event_attributes(
80 crate::protocol_serde::shape_workflow_execution_continued_as_new_event_attributes::de_workflow_execution_continued_as_new_event_attributes(tokens)?
81 );
82 }
83 "continueAsNewWorkflowExecutionFailedEventAttributes" => {
84 builder = builder.set_continue_as_new_workflow_execution_failed_event_attributes(
85 crate::protocol_serde::shape_continue_as_new_workflow_execution_failed_event_attributes::de_continue_as_new_workflow_execution_failed_event_attributes(tokens)?
86 );
87 }
88 "workflowExecutionTerminatedEventAttributes" => {
89 builder = builder.set_workflow_execution_terminated_event_attributes(
90 crate::protocol_serde::shape_workflow_execution_terminated_event_attributes::de_workflow_execution_terminated_event_attributes(tokens)?
91 );
92 }
93 "workflowExecutionCancelRequestedEventAttributes" => {
94 builder = builder.set_workflow_execution_cancel_requested_event_attributes(
95 crate::protocol_serde::shape_workflow_execution_cancel_requested_event_attributes::de_workflow_execution_cancel_requested_event_attributes(tokens)?
96 );
97 }
98 "decisionTaskScheduledEventAttributes" => {
99 builder = builder.set_decision_task_scheduled_event_attributes(
100 crate::protocol_serde::shape_decision_task_scheduled_event_attributes::de_decision_task_scheduled_event_attributes(tokens)?
101 );
102 }
103 "decisionTaskStartedEventAttributes" => {
104 builder = builder.set_decision_task_started_event_attributes(
105 crate::protocol_serde::shape_decision_task_started_event_attributes::de_decision_task_started_event_attributes(
106 tokens,
107 )?,
108 );
109 }
110 "decisionTaskCompletedEventAttributes" => {
111 builder = builder.set_decision_task_completed_event_attributes(
112 crate::protocol_serde::shape_decision_task_completed_event_attributes::de_decision_task_completed_event_attributes(tokens)?
113 );
114 }
115 "decisionTaskTimedOutEventAttributes" => {
116 builder = builder.set_decision_task_timed_out_event_attributes(
117 crate::protocol_serde::shape_decision_task_timed_out_event_attributes::de_decision_task_timed_out_event_attributes(tokens)?
118 );
119 }
120 "activityTaskScheduledEventAttributes" => {
121 builder = builder.set_activity_task_scheduled_event_attributes(
122 crate::protocol_serde::shape_activity_task_scheduled_event_attributes::de_activity_task_scheduled_event_attributes(tokens)?
123 );
124 }
125 "activityTaskStartedEventAttributes" => {
126 builder = builder.set_activity_task_started_event_attributes(
127 crate::protocol_serde::shape_activity_task_started_event_attributes::de_activity_task_started_event_attributes(
128 tokens,
129 )?,
130 );
131 }
132 "activityTaskCompletedEventAttributes" => {
133 builder = builder.set_activity_task_completed_event_attributes(
134 crate::protocol_serde::shape_activity_task_completed_event_attributes::de_activity_task_completed_event_attributes(tokens)?
135 );
136 }
137 "activityTaskFailedEventAttributes" => {
138 builder = builder.set_activity_task_failed_event_attributes(
139 crate::protocol_serde::shape_activity_task_failed_event_attributes::de_activity_task_failed_event_attributes(
140 tokens,
141 )?,
142 );
143 }
144 "activityTaskTimedOutEventAttributes" => {
145 builder = builder.set_activity_task_timed_out_event_attributes(
146 crate::protocol_serde::shape_activity_task_timed_out_event_attributes::de_activity_task_timed_out_event_attributes(tokens)?
147 );
148 }
149 "activityTaskCanceledEventAttributes" => {
150 builder = builder.set_activity_task_canceled_event_attributes(
151 crate::protocol_serde::shape_activity_task_canceled_event_attributes::de_activity_task_canceled_event_attributes(
152 tokens,
153 )?,
154 );
155 }
156 "activityTaskCancelRequestedEventAttributes" => {
157 builder = builder.set_activity_task_cancel_requested_event_attributes(
158 crate::protocol_serde::shape_activity_task_cancel_requested_event_attributes::de_activity_task_cancel_requested_event_attributes(tokens)?
159 );
160 }
161 "workflowExecutionSignaledEventAttributes" => {
162 builder = builder.set_workflow_execution_signaled_event_attributes(
163 crate::protocol_serde::shape_workflow_execution_signaled_event_attributes::de_workflow_execution_signaled_event_attributes(tokens)?
164 );
165 }
166 "markerRecordedEventAttributes" => {
167 builder = builder.set_marker_recorded_event_attributes(
168 crate::protocol_serde::shape_marker_recorded_event_attributes::de_marker_recorded_event_attributes(tokens)?,
169 );
170 }
171 "recordMarkerFailedEventAttributes" => {
172 builder = builder.set_record_marker_failed_event_attributes(
173 crate::protocol_serde::shape_record_marker_failed_event_attributes::de_record_marker_failed_event_attributes(
174 tokens,
175 )?,
176 );
177 }
178 "timerStartedEventAttributes" => {
179 builder = builder.set_timer_started_event_attributes(
180 crate::protocol_serde::shape_timer_started_event_attributes::de_timer_started_event_attributes(tokens)?,
181 );
182 }
183 "timerFiredEventAttributes" => {
184 builder = builder.set_timer_fired_event_attributes(
185 crate::protocol_serde::shape_timer_fired_event_attributes::de_timer_fired_event_attributes(tokens)?,
186 );
187 }
188 "timerCanceledEventAttributes" => {
189 builder = builder.set_timer_canceled_event_attributes(
190 crate::protocol_serde::shape_timer_canceled_event_attributes::de_timer_canceled_event_attributes(tokens)?,
191 );
192 }
193 "startChildWorkflowExecutionInitiatedEventAttributes" => {
194 builder = builder.set_start_child_workflow_execution_initiated_event_attributes(
195 crate::protocol_serde::shape_start_child_workflow_execution_initiated_event_attributes::de_start_child_workflow_execution_initiated_event_attributes(tokens)?
196 );
197 }
198 "childWorkflowExecutionStartedEventAttributes" => {
199 builder = builder.set_child_workflow_execution_started_event_attributes(
200 crate::protocol_serde::shape_child_workflow_execution_started_event_attributes::de_child_workflow_execution_started_event_attributes(tokens)?
201 );
202 }
203 "childWorkflowExecutionCompletedEventAttributes" => {
204 builder = builder.set_child_workflow_execution_completed_event_attributes(
205 crate::protocol_serde::shape_child_workflow_execution_completed_event_attributes::de_child_workflow_execution_completed_event_attributes(tokens)?
206 );
207 }
208 "childWorkflowExecutionFailedEventAttributes" => {
209 builder = builder.set_child_workflow_execution_failed_event_attributes(
210 crate::protocol_serde::shape_child_workflow_execution_failed_event_attributes::de_child_workflow_execution_failed_event_attributes(tokens)?
211 );
212 }
213 "childWorkflowExecutionTimedOutEventAttributes" => {
214 builder = builder.set_child_workflow_execution_timed_out_event_attributes(
215 crate::protocol_serde::shape_child_workflow_execution_timed_out_event_attributes::de_child_workflow_execution_timed_out_event_attributes(tokens)?
216 );
217 }
218 "childWorkflowExecutionCanceledEventAttributes" => {
219 builder = builder.set_child_workflow_execution_canceled_event_attributes(
220 crate::protocol_serde::shape_child_workflow_execution_canceled_event_attributes::de_child_workflow_execution_canceled_event_attributes(tokens)?
221 );
222 }
223 "childWorkflowExecutionTerminatedEventAttributes" => {
224 builder = builder.set_child_workflow_execution_terminated_event_attributes(
225 crate::protocol_serde::shape_child_workflow_execution_terminated_event_attributes::de_child_workflow_execution_terminated_event_attributes(tokens)?
226 );
227 }
228 "signalExternalWorkflowExecutionInitiatedEventAttributes" => {
229 builder = builder.set_signal_external_workflow_execution_initiated_event_attributes(
230 crate::protocol_serde::shape_signal_external_workflow_execution_initiated_event_attributes::de_signal_external_workflow_execution_initiated_event_attributes(tokens)?
231 );
232 }
233 "externalWorkflowExecutionSignaledEventAttributes" => {
234 builder = builder.set_external_workflow_execution_signaled_event_attributes(
235 crate::protocol_serde::shape_external_workflow_execution_signaled_event_attributes::de_external_workflow_execution_signaled_event_attributes(tokens)?
236 );
237 }
238 "signalExternalWorkflowExecutionFailedEventAttributes" => {
239 builder = builder.set_signal_external_workflow_execution_failed_event_attributes(
240 crate::protocol_serde::shape_signal_external_workflow_execution_failed_event_attributes::de_signal_external_workflow_execution_failed_event_attributes(tokens)?
241 );
242 }
243 "externalWorkflowExecutionCancelRequestedEventAttributes" => {
244 builder = builder.set_external_workflow_execution_cancel_requested_event_attributes(
245 crate::protocol_serde::shape_external_workflow_execution_cancel_requested_event_attributes::de_external_workflow_execution_cancel_requested_event_attributes(tokens)?
246 );
247 }
248 "requestCancelExternalWorkflowExecutionInitiatedEventAttributes" => {
249 builder = builder.set_request_cancel_external_workflow_execution_initiated_event_attributes(
250 crate::protocol_serde::shape_request_cancel_external_workflow_execution_initiated_event_attributes::de_request_cancel_external_workflow_execution_initiated_event_attributes(tokens)?
251 );
252 }
253 "requestCancelExternalWorkflowExecutionFailedEventAttributes" => {
254 builder = builder.set_request_cancel_external_workflow_execution_failed_event_attributes(
255 crate::protocol_serde::shape_request_cancel_external_workflow_execution_failed_event_attributes::de_request_cancel_external_workflow_execution_failed_event_attributes(tokens)?
256 );
257 }
258 "scheduleActivityTaskFailedEventAttributes" => {
259 builder = builder.set_schedule_activity_task_failed_event_attributes(
260 crate::protocol_serde::shape_schedule_activity_task_failed_event_attributes::de_schedule_activity_task_failed_event_attributes(tokens)?
261 );
262 }
263 "requestCancelActivityTaskFailedEventAttributes" => {
264 builder = builder.set_request_cancel_activity_task_failed_event_attributes(
265 crate::protocol_serde::shape_request_cancel_activity_task_failed_event_attributes::de_request_cancel_activity_task_failed_event_attributes(tokens)?
266 );
267 }
268 "startTimerFailedEventAttributes" => {
269 builder = builder.set_start_timer_failed_event_attributes(
270 crate::protocol_serde::shape_start_timer_failed_event_attributes::de_start_timer_failed_event_attributes(tokens)?,
271 );
272 }
273 "cancelTimerFailedEventAttributes" => {
274 builder = builder.set_cancel_timer_failed_event_attributes(
275 crate::protocol_serde::shape_cancel_timer_failed_event_attributes::de_cancel_timer_failed_event_attributes(
276 tokens,
277 )?,
278 );
279 }
280 "startChildWorkflowExecutionFailedEventAttributes" => {
281 builder = builder.set_start_child_workflow_execution_failed_event_attributes(
282 crate::protocol_serde::shape_start_child_workflow_execution_failed_event_attributes::de_start_child_workflow_execution_failed_event_attributes(tokens)?
283 );
284 }
285 "lambdaFunctionScheduledEventAttributes" => {
286 builder = builder.set_lambda_function_scheduled_event_attributes(
287 crate::protocol_serde::shape_lambda_function_scheduled_event_attributes::de_lambda_function_scheduled_event_attributes(tokens)?
288 );
289 }
290 "lambdaFunctionStartedEventAttributes" => {
291 builder = builder.set_lambda_function_started_event_attributes(
292 crate::protocol_serde::shape_lambda_function_started_event_attributes::de_lambda_function_started_event_attributes(tokens)?
293 );
294 }
295 "lambdaFunctionCompletedEventAttributes" => {
296 builder = builder.set_lambda_function_completed_event_attributes(
297 crate::protocol_serde::shape_lambda_function_completed_event_attributes::de_lambda_function_completed_event_attributes(tokens)?
298 );
299 }
300 "lambdaFunctionFailedEventAttributes" => {
301 builder = builder.set_lambda_function_failed_event_attributes(
302 crate::protocol_serde::shape_lambda_function_failed_event_attributes::de_lambda_function_failed_event_attributes(
303 tokens,
304 )?,
305 );
306 }
307 "lambdaFunctionTimedOutEventAttributes" => {
308 builder = builder.set_lambda_function_timed_out_event_attributes(
309 crate::protocol_serde::shape_lambda_function_timed_out_event_attributes::de_lambda_function_timed_out_event_attributes(tokens)?
310 );
311 }
312 "scheduleLambdaFunctionFailedEventAttributes" => {
313 builder = builder.set_schedule_lambda_function_failed_event_attributes(
314 crate::protocol_serde::shape_schedule_lambda_function_failed_event_attributes::de_schedule_lambda_function_failed_event_attributes(tokens)?
315 );
316 }
317 "startLambdaFunctionFailedEventAttributes" => {
318 builder = builder.set_start_lambda_function_failed_event_attributes(
319 crate::protocol_serde::shape_start_lambda_function_failed_event_attributes::de_start_lambda_function_failed_event_attributes(tokens)?
320 );
321 }
322 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
323 }
324 }
325 other => {
326 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
327 "expected object key or end object, found: {:?}",
328 other
329 )))
330 }
331 }
332 }
333 Ok(Some(crate::serde_util::history_event_correct_errors(builder).build().map_err(|err| {
334 ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
335 })?))
336 }
337 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
338 "expected start object or null",
339 )),
340 }
341}