pub fn ser_data_partition_storage_options(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::DataPartitionStorageOptions,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.maximum_size {
#[allow(unused_mut)]
let mut object_2 = object.key("maximumSize").start_object();
crate::protocol_serde::shape_storage_maximum_size::ser_storage_maximum_size(&mut object_2, var_1)?;
object_2.finish();
}
{
object.key("storageLocation").string(input.storage_location.as_str());
}
if let Some(var_3) = &input.minimum_time_to_live {
#[allow(unused_mut)]
let mut object_4 = object.key("minimumTimeToLive").start_object();
crate::protocol_serde::shape_storage_minimum_time_to_live::ser_storage_minimum_time_to_live(&mut object_4, var_3)?;
object_4.finish();
}
Ok(())
}
pub(crate) fn de_data_partition_storage_options<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::DataPartitionStorageOptions>, ::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::DataPartitionStorageOptionsBuilder::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() {
"maximumSize" => {
builder = builder.set_maximum_size(crate::protocol_serde::shape_storage_maximum_size::de_storage_maximum_size(
tokens,
_value,
depth + 1,
)?);
}
"storageLocation" => {
builder = builder.set_storage_location(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"minimumTimeToLive" => {
builder = builder.set_minimum_time_to_live(
crate::protocol_serde::shape_storage_minimum_time_to_live::de_storage_minimum_time_to_live(
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::data_partition_storage_options_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",
)),
}
}