aws-sdk-amplify 1.107.0

AWS SDK for AWS Amplify
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_app<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::App>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
    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::AppBuilder::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() {
                        "appId" => {
                            builder = builder.set_app_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "appArn" => {
                            builder = builder.set_app_arn(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "name" => {
                            builder = builder.set_name(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "tags" => {
                            builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens, _value)?);
                        }
                        "description" => {
                            builder = builder.set_description(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "repository" => {
                            builder = builder.set_repository(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "platform" => {
                            builder = builder.set_platform(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| crate::types::Platform::from(u.as_ref())))
                                    .transpose()?,
                            );
                        }
                        "createTime" => {
                            builder = builder.set_create_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
                                tokens.next(),
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
                            )?);
                        }
                        "updateTime" => {
                            builder = builder.set_update_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
                                tokens.next(),
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
                            )?);
                        }
                        "computeRoleArn" => {
                            builder = builder.set_compute_role_arn(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "iamServiceRoleArn" => {
                            builder = builder.set_iam_service_role_arn(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "environmentVariables" => {
                            builder = builder.set_environment_variables(
                                crate::protocol_serde::shape_environment_variables::de_environment_variables(tokens, _value)?,
                            );
                        }
                        "defaultDomain" => {
                            builder = builder.set_default_domain(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "enableBranchAutoBuild" => {
                            builder =
                                builder.set_enable_branch_auto_build(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "enableBranchAutoDeletion" => {
                            builder =
                                builder.set_enable_branch_auto_deletion(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "enableBasicAuth" => {
                            builder = builder.set_enable_basic_auth(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "basicAuthCredentials" => {
                            builder = builder.set_basic_auth_credentials(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "customRules" => {
                            builder = builder.set_custom_rules(crate::protocol_serde::shape_custom_rules::de_custom_rules(tokens, _value)?);
                        }
                        "productionBranch" => {
                            builder =
                                builder.set_production_branch(crate::protocol_serde::shape_production_branch::de_production_branch(tokens, _value)?);
                        }
                        "buildSpec" => {
                            builder = builder.set_build_spec(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "customHeaders" => {
                            builder = builder.set_custom_headers(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "enableAutoBranchCreation" => {
                            builder =
                                builder.set_enable_auto_branch_creation(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "autoBranchCreationPatterns" => {
                            builder = builder.set_auto_branch_creation_patterns(
                                crate::protocol_serde::shape_auto_branch_creation_patterns::de_auto_branch_creation_patterns(tokens, _value)?,
                            );
                        }
                        "autoBranchCreationConfig" => {
                            builder = builder.set_auto_branch_creation_config(
                                crate::protocol_serde::shape_auto_branch_creation_config::de_auto_branch_creation_config(tokens, _value)?,
                            );
                        }
                        "repositoryCloneMethod" => {
                            builder = builder.set_repository_clone_method(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| crate::types::RepositoryCloneMethod::from(u.as_ref())))
                                    .transpose()?,
                            );
                        }
                        "cacheConfig" => {
                            builder = builder.set_cache_config(crate::protocol_serde::shape_cache_config::de_cache_config(tokens, _value)?);
                        }
                        "webhookCreateTime" => {
                            builder = builder.set_webhook_create_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
                                tokens.next(),
                                ::aws_smithy_types::date_time::Format::EpochSeconds,
                            )?);
                        }
                        "wafConfiguration" => {
                            builder =
                                builder.set_waf_configuration(crate::protocol_serde::shape_waf_configuration::de_waf_configuration(tokens, _value)?);
                        }
                        "jobConfig" => {
                            builder = builder.set_job_config(crate::protocol_serde::shape_job_config::de_job_config(tokens, _value)?);
                        }
                        _ => ::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::app_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",
        )),
    }
}