aws-sdk-sagemaker 1.208.0

AWS SDK for Amazon SageMaker Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_labeling_job_summary<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
    depth: u32,
) -> ::std::result::Result<Option<crate::types::LabelingJobSummary>, ::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::LabelingJobSummaryBuilder::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() {
                            "LabelingJobName" => {
                                builder = builder.set_labeling_job_name(
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                        .transpose()?,
                                );
                            }
                            "LabelingJobArn" => {
                                builder = builder.set_labeling_job_arn(
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                        .transpose()?,
                                );
                            }
                            "CreationTime" => {
                                builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
                                    tokens.next(),
                                    ::aws_smithy_types::date_time::Format::EpochSeconds,
                                )?);
                            }
                            "LastModifiedTime" => {
                                builder = builder.set_last_modified_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
                                    tokens.next(),
                                    ::aws_smithy_types::date_time::Format::EpochSeconds,
                                )?);
                            }
                            "LabelingJobStatus" => {
                                builder = builder.set_labeling_job_status(
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                        .map(|s| s.to_unescaped().map(|u| crate::types::LabelingJobStatus::from(u.as_ref())))
                                        .transpose()?,
                                );
                            }
                            "LabelCounters" => {
                                builder = builder.set_label_counters(crate::protocol_serde::shape_label_counters::de_label_counters(
                                    tokens,
                                    _value,
                                    depth + 1,
                                )?);
                            }
                            "WorkteamArn" => {
                                builder = builder.set_workteam_arn(
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                        .transpose()?,
                                );
                            }
                            "PreHumanTaskLambdaArn" => {
                                builder = builder.set_pre_human_task_lambda_arn(
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                        .transpose()?,
                                );
                            }
                            "AnnotationConsolidationLambdaArn" => {
                                builder = builder.set_annotation_consolidation_lambda_arn(
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                        .transpose()?,
                                );
                            }
                            "FailureReason" => {
                                builder = builder.set_failure_reason(
                                    ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                        .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                        .transpose()?,
                                );
                            }
                            "LabelingJobOutput" => {
                                builder = builder.set_labeling_job_output(crate::protocol_serde::shape_labeling_job_output::de_labeling_job_output(
                                    tokens,
                                    _value,
                                    depth + 1,
                                )?);
                            }
                            "InputConfig" => {
                                builder = builder.set_input_config(
                                    crate::protocol_serde::shape_labeling_job_input_config::de_labeling_job_input_config(tokens, _value, depth + 1)?,
                                );
                            }
                            _ => ::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::labeling_job_summary_correct_errors(builder).build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}