pub(crate) fn de_app<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::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>>,
{
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::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, depth + 1)?);
}
"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, depth + 1)?,
);
}
"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, depth + 1)?);
}
"productionBranch" => {
builder = builder.set_production_branch(crate::protocol_serde::shape_production_branch::de_production_branch(
tokens,
_value,
depth + 1,
)?);
}
"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,
depth + 1,
)?,
);
}
"autoBranchCreationConfig" => {
builder = builder.set_auto_branch_creation_config(
crate::protocol_serde::shape_auto_branch_creation_config::de_auto_branch_creation_config(tokens, _value, depth + 1)?,
);
}
"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, depth + 1)?);
}
"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,
depth + 1,
)?);
}
"jobConfig" => {
builder = builder.set_job_config(crate::protocol_serde::shape_job_config::de_job_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::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",
)),
}
}