pub fn ser_custom_file_system_config(
object_18: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::CustomFileSystemConfig,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
match input {
crate::types::CustomFileSystemConfig::EfsFileSystemConfig(inner) => {
#[allow(unused_mut)]
let mut object_1 = object_18.key("EFSFileSystemConfig").start_object();
crate::protocol_serde::shape_efs_file_system_config::ser_efs_file_system_config(&mut object_1, inner)?;
object_1.finish();
}
crate::types::CustomFileSystemConfig::FSxLustreFileSystemConfig(inner) => {
#[allow(unused_mut)]
let mut object_2 = object_18.key("FSxLustreFileSystemConfig").start_object();
crate::protocol_serde::shape_f_sx_lustre_file_system_config::ser_f_sx_lustre_file_system_config(&mut object_2, inner)?;
object_2.finish();
}
crate::types::CustomFileSystemConfig::S3FileSystemConfig(inner) => {
#[allow(unused_mut)]
let mut object_3 = object_18.key("S3FileSystemConfig").start_object();
crate::protocol_serde::shape_s3_file_system_config::ser_s3_file_system_config(&mut object_3, inner)?;
object_3.finish();
}
crate::types::CustomFileSystemConfig::Unknown => {
return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
"CustomFileSystemConfig",
))
}
}
Ok(())
}
pub(crate) fn de_custom_file_system_config<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::CustomFileSystemConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
let mut variant = None;
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
tokens.peek()
{
let _ = tokens.next().expect("peek returned a token")?;
continue;
}
let key = key.to_unescaped()?;
if key == "__type" {
::aws_smithy_json::deserialize::token::skip_value(tokens)?;
continue;
}
if variant.is_some() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"encountered mixed variants in union",
));
}
variant = match key.as_ref() {
"EFSFileSystemConfig" => Some(crate::types::CustomFileSystemConfig::EfsFileSystemConfig(
crate::protocol_serde::shape_efs_file_system_config::de_efs_file_system_config(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'EFSFileSystemConfig' cannot be null")
})?,
)),
"FSxLustreFileSystemConfig" => Some(crate::types::CustomFileSystemConfig::FSxLustreFileSystemConfig(
crate::protocol_serde::shape_f_sx_lustre_file_system_config::de_f_sx_lustre_file_system_config(tokens, _value)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom(
"value for 'FSxLustreFileSystemConfig' cannot be null",
)
})?,
)),
"S3FileSystemConfig" => Some(crate::types::CustomFileSystemConfig::S3FileSystemConfig(
crate::protocol_serde::shape_s3_file_system_config::de_s3_file_system_config(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'S3FileSystemConfig' cannot be null")
})?,
)),
_ => {
::aws_smithy_json::deserialize::token::skip_value(tokens)?;
Some(crate::types::CustomFileSystemConfig::Unknown)
}
};
}
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {other:?}"
)))
}
}
},
_ => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
))
}
}
if variant.is_none() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"Union did not contain a valid variant.",
));
}
Ok(variant)
}