pub(crate) fn de_open_zfs_volume_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::OpenZfsVolumeConfiguration>, ::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::OpenZfsVolumeConfigurationBuilder::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() {
"ParentVolumeId" => {
builder = builder.set_parent_volume_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"VolumePath" => {
builder = builder.set_volume_path(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"StorageCapacityReservationGiB" => {
builder = builder.set_storage_capacity_reservation_gib(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"StorageCapacityQuotaGiB" => {
builder = builder.set_storage_capacity_quota_gib(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"RecordSizeKiB" => {
builder = builder.set_record_size_kib(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"DataCompressionType" => {
builder = builder.set_data_compression_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::OpenZfsDataCompressionType::from(u.as_ref())))
.transpose()?,
);
}
"CopyTagsToSnapshots" => {
builder = builder.set_copy_tags_to_snapshots(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"OriginSnapshot" => {
builder = builder.set_origin_snapshot(
crate::protocol_serde::shape_open_zfs_origin_snapshot_configuration::de_open_zfs_origin_snapshot_configuration(
tokens, _value,
)?,
);
}
"ReadOnly" => {
builder = builder.set_read_only(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"NfsExports" => {
builder = builder.set_nfs_exports(crate::protocol_serde::shape_open_zfs_nfs_exports::de_open_zfs_nfs_exports(
tokens, _value,
)?);
}
"UserAndGroupQuotas" => {
builder = builder.set_user_and_group_quotas(
crate::protocol_serde::shape_open_zfs_user_and_group_quotas::de_open_zfs_user_and_group_quotas(tokens, _value)?,
);
}
"RestoreToSnapshot" => {
builder = builder.set_restore_to_snapshot(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"DeleteIntermediateSnaphots" => {
builder =
builder.set_delete_intermediate_snaphots(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"DeleteClonedVolumes" => {
builder = builder.set_delete_cloned_volumes(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"DeleteIntermediateData" => {
builder =
builder.set_delete_intermediate_data(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"SourceSnapshotARN" => {
builder = builder.set_source_snapshot_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"DestinationSnapshot" => {
builder = builder.set_destination_snapshot(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"CopyStrategy" => {
builder = builder.set_copy_strategy(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::OpenZfsCopyStrategy::from(u.as_ref())))
.transpose()?,
);
}
_ => ::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",
)),
}
}