pub fn ser_deployment_launch_config(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::DeploymentLaunchConfig,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
object.key("packageName").string(input.package_name.as_str());
}
if let Some(var_1) = &input.pre_launch_file {
object.key("preLaunchFile").string(var_1.as_str());
}
{
object.key("launchFile").string(input.launch_file.as_str());
}
if let Some(var_2) = &input.post_launch_file {
object.key("postLaunchFile").string(var_2.as_str());
}
if let Some(var_3) = &input.environment_variables {
#[allow(unused_mut)]
let mut object_4 = object.key("environmentVariables").start_object();
for (key_5, value_6) in var_3 {
{
object_4.key(key_5.as_str()).string(value_6.as_str());
}
}
object_4.finish();
}
Ok(())
}
pub(crate) fn de_deployment_launch_config<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::DeploymentLaunchConfig>, ::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::DeploymentLaunchConfigBuilder::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() {
"packageName" => {
builder = builder.set_package_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"preLaunchFile" => {
builder = builder.set_pre_launch_file(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"launchFile" => {
builder = builder.set_launch_file(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"postLaunchFile" => {
builder = builder.set_post_launch_file(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"environmentVariables" => {
builder = builder.set_environment_variables(
crate::protocol_serde::shape_environment_variable_map::de_environment_variable_map(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(
crate::serde_util::deployment_launch_config_correct_errors(builder)
.build()
.map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}