pub(crate) fn de_launch_configuration_template<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::LaunchConfigurationTemplate>, ::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::LaunchConfigurationTemplateBuilder::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() {
"launchConfigurationTemplateID" => {
builder = builder.set_launch_configuration_template_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"arn" => {
builder = builder.set_arn(
::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_tags_map::de_tags_map(tokens, _value, depth + 1)?);
}
"launchDisposition" => {
builder = builder.set_launch_disposition(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::LaunchDisposition::from(u.as_ref())))
.transpose()?,
);
}
"targetInstanceTypeRightSizingMethod" => {
builder = builder.set_target_instance_type_right_sizing_method(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| {
s.to_unescaped()
.map(|u| crate::types::TargetInstanceTypeRightSizingMethod::from(u.as_ref()))
})
.transpose()?,
);
}
"copyPrivateIp" => {
builder = builder.set_copy_private_ip(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"copyTags" => {
builder = builder.set_copy_tags(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"licensing" => {
builder = builder.set_licensing(crate::protocol_serde::shape_licensing::de_licensing(tokens, _value, depth + 1)?);
}
"exportBucketArn" => {
builder = builder.set_export_bucket_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"postLaunchEnabled" => {
builder = builder.set_post_launch_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"launchIntoSourceInstance" => {
builder =
builder.set_launch_into_source_instance(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
_ => ::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",
)),
}
}