pub(crate) fn de_job_flow_instances_detail<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::JobFlowInstancesDetail>, ::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::JobFlowInstancesDetailBuilder::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() {
"MasterInstanceType" => {
builder = builder.set_master_instance_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"MasterPublicDnsName" => {
builder = builder.set_master_public_dns_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"MasterInstanceId" => {
builder = builder.set_master_instance_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"SlaveInstanceType" => {
builder = builder.set_slave_instance_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"InstanceCount" => {
builder = builder.set_instance_count(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"InstanceGroups" => {
builder = builder.set_instance_groups(
crate::protocol_serde::shape_instance_group_detail_list::de_instance_group_detail_list(tokens, _value, depth + 1)?,
);
}
"NormalizedInstanceHours" => {
builder = builder.set_normalized_instance_hours(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"Ec2KeyName" => {
builder = builder.set_ec2_key_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Ec2SubnetId" => {
builder = builder.set_ec2_subnet_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Placement" => {
builder =
builder.set_placement(crate::protocol_serde::shape_placement_type::de_placement_type(tokens, _value, depth + 1)?);
}
"KeepJobFlowAliveWhenNoSteps" => {
builder = builder
.set_keep_job_flow_alive_when_no_steps(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"TerminationProtected" => {
builder = builder.set_termination_protected(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"UnhealthyNodeReplacement" => {
builder =
builder.set_unhealthy_node_replacement(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"HadoopVersion" => {
builder = builder.set_hadoop_version(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
_ => ::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::job_flow_instances_detail_correct_errors(builder).build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}