pub(crate) fn de_deployment_config<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::DeploymentConfig>, ::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::DeploymentConfigBuilder::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() {
"concurrentDeploymentPercentage" => {
builder = builder.set_concurrent_deployment_percentage(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"failureThresholdPercentage" => {
builder = builder.set_failure_threshold_percentage(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"robotDeploymentTimeoutInSeconds" => {
builder = builder.set_robot_deployment_timeout_in_seconds(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i64::try_from)
.transpose()?,
);
}
"downloadConditionFile" => {
builder = builder.set_download_condition_file(crate::protocol_serde::shape_s3_object::de_s3_object(tokens)?);
}
_ => ::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",
)),
}
}
pub fn ser_deployment_config(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::DeploymentConfig,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.concurrent_deployment_percentage {
object.key("concurrentDeploymentPercentage").number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((*var_1).into()),
);
}
if let Some(var_2) = &input.failure_threshold_percentage {
object.key("failureThresholdPercentage").number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((*var_2).into()),
);
}
if let Some(var_3) = &input.robot_deployment_timeout_in_seconds {
object.key("robotDeploymentTimeoutInSeconds").number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((*var_3).into()),
);
}
if let Some(var_4) = &input.download_condition_file {
#[allow(unused_mut)]
let mut object_5 = object.key("downloadConditionFile").start_object();
crate::protocol_serde::shape_s3_object::ser_s3_object(&mut object_5, var_4)?;
object_5.finish();
}
Ok(())
}