aws_sdk_swf/protocol_serde/
shape_workflow_execution_info.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_workflow_execution_info<'a, I>(
3    tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::WorkflowExecutionInfo>, ::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::WorkflowExecutionInfoBuilder::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, .. }) => match key.to_unescaped()?.as_ref() {
17                        "execution" => {
18                            builder = builder.set_execution(crate::protocol_serde::shape_workflow_execution::de_workflow_execution(tokens)?);
19                        }
20                        "workflowType" => {
21                            builder = builder.set_workflow_type(crate::protocol_serde::shape_workflow_type::de_workflow_type(tokens)?);
22                        }
23                        "startTimestamp" => {
24                            builder = builder.set_start_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
25                                tokens.next(),
26                                ::aws_smithy_types::date_time::Format::EpochSeconds,
27                            )?);
28                        }
29                        "closeTimestamp" => {
30                            builder = builder.set_close_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
31                                tokens.next(),
32                                ::aws_smithy_types::date_time::Format::EpochSeconds,
33                            )?);
34                        }
35                        "executionStatus" => {
36                            builder = builder.set_execution_status(
37                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
38                                    .map(|s| s.to_unescaped().map(|u| crate::types::ExecutionStatus::from(u.as_ref())))
39                                    .transpose()?,
40                            );
41                        }
42                        "closeStatus" => {
43                            builder = builder.set_close_status(
44                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
45                                    .map(|s| s.to_unescaped().map(|u| crate::types::CloseStatus::from(u.as_ref())))
46                                    .transpose()?,
47                            );
48                        }
49                        "parent" => {
50                            builder = builder.set_parent(crate::protocol_serde::shape_workflow_execution::de_workflow_execution(tokens)?);
51                        }
52                        "tagList" => {
53                            builder = builder.set_tag_list(crate::protocol_serde::shape_tag_list::de_tag_list(tokens)?);
54                        }
55                        "cancelRequested" => {
56                            builder = builder.set_cancel_requested(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
57                        }
58                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
59                    },
60                    other => {
61                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
62                            "expected object key or end object, found: {:?}",
63                            other
64                        )))
65                    }
66                }
67            }
68            Ok(Some(crate::serde_util::workflow_execution_info_correct_errors(builder).build().map_err(
69                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
70            )?))
71        }
72        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
73            "expected start object or null",
74        )),
75    }
76}