aws-sdk-swf 1.103.0

AWS SDK for Amazon Simple Workflow Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_workflow_execution_started_event_attributes<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
    depth: u32,
) -> ::std::result::Result<Option<crate::types::WorkflowExecutionStartedEventAttributes>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
    if depth >= 128u32 {
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "maximum nesting depth exceeded",
        ));
    }
    match tokens.next().transpose()? {
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
            #[allow(unused_mut)]
            let mut builder = crate::types::builders::WorkflowExecutionStartedEventAttributesBuilder::default();
            loop {
                match tokens.next().transpose()? {
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
                        "input" => {
                            builder = builder.set_input(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "executionStartToCloseTimeout" => {
                            builder = builder.set_execution_start_to_close_timeout(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "taskStartToCloseTimeout" => {
                            builder = builder.set_task_start_to_close_timeout(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "childPolicy" => {
                            builder = builder.set_child_policy(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| crate::types::ChildPolicy::from(u.as_ref())))
                                    .transpose()?,
                            );
                        }
                        "taskList" => {
                            builder = builder.set_task_list(crate::protocol_serde::shape_task_list::de_task_list(tokens, _value, depth + 1)?);
                        }
                        "taskPriority" => {
                            builder = builder.set_task_priority(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "workflowType" => {
                            builder =
                                builder.set_workflow_type(crate::protocol_serde::shape_workflow_type::de_workflow_type(tokens, _value, depth + 1)?);
                        }
                        "tagList" => {
                            builder = builder.set_tag_list(crate::protocol_serde::shape_tag_list::de_tag_list(tokens, _value, depth + 1)?);
                        }
                        "continuedExecutionRunId" => {
                            builder = builder.set_continued_execution_run_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "parentWorkflowExecution" => {
                            builder = builder.set_parent_workflow_execution(crate::protocol_serde::shape_workflow_execution::de_workflow_execution(
                                tokens,
                                _value,
                                depth + 1,
                            )?);
                        }
                        "parentInitiatedEventId" => {
                            builder = builder.set_parent_initiated_event_id(
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
                                    .map(i64::try_from)
                                    .transpose()?,
                            );
                        }
                        "lambdaRole" => {
                            builder = builder.set_lambda_role(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
                    },
                    other => {
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
                            "expected object key or end object, found: {other:?}"
                        )))
                    }
                }
            }
            Ok(Some(
                crate::serde_util::workflow_execution_started_event_attributes_correct_errors(builder)
                    .build()
                    .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
            ))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}