pub fn ser_container_health_check(
encoder: &mut ::aws_smithy_cbor::Encoder,
#[allow(unused)] input: &crate::types::ContainerHealthCheck,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
encoder.begin_map();
if let Some(var_1) = &input.command {
encoder.str("Command");
encoder.array((*var_1).len());
for item_2 in var_1 {
{
encoder.str(item_2.as_str());
}
}
}
if let Some(var_3) = &input.interval {
encoder.str("Interval").integer(*var_3);
}
if let Some(var_4) = &input.retries {
encoder.str("Retries").integer(*var_4);
}
if let Some(var_5) = &input.start_period {
encoder.str("StartPeriod").integer(*var_5);
}
if let Some(var_6) = &input.timeout {
encoder.str("Timeout").integer(*var_6);
}
encoder.end();
Ok(())
}
pub(crate) fn de_container_health_check(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::ContainerHealthCheck, ::aws_smithy_cbor::decode::DeserializeError> {
if depth >= 128u32 {
return Err(::aws_smithy_cbor::decode::DeserializeError::custom(
"maximum nesting depth exceeded",
decoder.position(),
));
}
#[allow(clippy::match_single_binding, unused_variables)]
fn pair(
mut builder: crate::types::builders::ContainerHealthCheckBuilder,
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::builders::ContainerHealthCheckBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
builder =
match decoder.str()?.as_ref() {
"Command" => builder.set_command(Some(
crate::protocol_serde::shape_container_command_string_list::de_container_command_string_list(decoder, depth + 1)?,
)),
"Interval" => {
::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_interval(Some(decoder.integer()?))))?
}
"Retries" => {
::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_retries(Some(decoder.integer()?))))?
}
"StartPeriod" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_start_period(Some(decoder.integer()?)))
})?,
"Timeout" => {
::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| Ok(builder.set_timeout(Some(decoder.integer()?))))?
}
_ => {
decoder.skip()?;
builder
}
};
Ok(builder)
}
let mut builder = crate::types::builders::ContainerHealthCheckBuilder::default();
match decoder.map()? {
None => loop {
match decoder.datatype()? {
::aws_smithy_cbor::data::Type::Break => {
decoder.skip()?;
break;
}
_ => {
builder = pair(builder, decoder, depth)?;
}
};
},
Some(n) => {
for _ in 0..n {
builder = pair(builder, decoder, depth)?;
}
}
};
#[allow(clippy::needless_question_mark)]
{
return Ok(crate::serde_util::container_health_check_correct_errors(builder).build());
}
}