pub(crate) fn de_environment<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::Environment>, ::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::EnvironmentBuilder::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() {
"environmentId" => {
builder = builder.set_environment_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"environmentState" => {
builder = builder.set_environment_state(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::EnvironmentState::from(u.as_ref())))
.transpose()?,
);
}
"stateDetails" => {
builder = builder.set_state_details(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"createdAt" => {
builder = builder.set_created_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"modifiedAt" => {
builder = builder.set_modified_at(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"environmentArn" => {
builder = builder.set_environment_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"environmentName" => {
builder = builder.set_environment_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"vpcId" => {
builder = builder.set_vpc_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"serviceAccessSubnetId" => {
builder = builder.set_service_access_subnet_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"vcfVersion" => {
builder = builder.set_vcf_version(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::VcfVersion::from(u.as_ref())))
.transpose()?,
);
}
"termsAccepted" => {
builder = builder.set_terms_accepted(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"licenseInfo" => {
builder = builder.set_license_info(crate::protocol_serde::shape_license_info_list::de_license_info_list(tokens, _value)?);
}
"siteId" => {
builder = builder.set_site_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"environmentStatus" => {
builder = builder.set_environment_status(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::CheckResult::from(u.as_ref())))
.transpose()?,
);
}
"checks" => {
builder = builder.set_checks(crate::protocol_serde::shape_checks_list::de_checks_list(tokens, _value)?);
}
"connectivityInfo" => {
builder =
builder.set_connectivity_info(crate::protocol_serde::shape_connectivity_info::de_connectivity_info(tokens, _value)?);
}
"vcfHostnames" => {
builder = builder.set_vcf_hostnames(crate::protocol_serde::shape_vcf_hostnames::de_vcf_hostnames(tokens, _value)?);
}
"kmsKeyId" => {
builder = builder.set_kms_key_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"serviceAccessSecurityGroups" => {
builder = builder.set_service_access_security_groups(
crate::protocol_serde::shape_service_access_security_groups::de_service_access_security_groups(tokens, _value)?,
);
}
"credentials" => {
builder = builder.set_credentials(crate::protocol_serde::shape_secret_list::de_secret_list(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(builder.build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}