pub fn ser_efs_volume_configuration(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::EfsVolumeConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
object.key("fileSystemId").string(input.file_system_id.as_str());
}
if let Some(var_1) = &input.root_directory {
object.key("rootDirectory").string(var_1.as_str());
}
if let Some(var_2) = &input.transit_encryption {
object.key("transitEncryption").string(var_2.as_str());
}
if let Some(var_3) = &input.transit_encryption_port {
object.key("transitEncryptionPort").number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((*var_3).into()),
);
}
if let Some(var_4) = &input.authorization_config {
#[allow(unused_mut)]
let mut object_5 = object.key("authorizationConfig").start_object();
crate::protocol_serde::shape_efs_authorization_config::ser_efs_authorization_config(&mut object_5, var_4)?;
object_5.finish();
}
Ok(())
}
pub(crate) fn de_efs_volume_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::EfsVolumeConfiguration>, ::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::EfsVolumeConfigurationBuilder::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() {
"fileSystemId" => {
builder = builder.set_file_system_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"rootDirectory" => {
builder = builder.set_root_directory(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"transitEncryption" => {
builder = builder.set_transit_encryption(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::EfsTransitEncryption::from(u.as_ref())))
.transpose()?,
);
}
"transitEncryptionPort" => {
builder = builder.set_transit_encryption_port(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"authorizationConfig" => {
builder = builder.set_authorization_config(
crate::protocol_serde::shape_efs_authorization_config::de_efs_authorization_config(tokens, _value, depth + 1)?,
);
}
_ => ::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::efs_volume_configuration_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",
)),
}
}