aws_sdk_costoptimizationhub/protocol_serde/
shape_ebs_volume_configuration.rs1pub(crate) fn de_ebs_volume_configuration<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4 _value: &'a [u8],
5) -> ::std::result::Result<Option<crate::types::EbsVolumeConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
6where
7 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
8{
9 match tokens.next().transpose()? {
10 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
11 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
12 #[allow(unused_mut)]
13 let mut builder = crate::types::builders::EbsVolumeConfigurationBuilder::default();
14 loop {
15 match tokens.next().transpose()? {
16 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
17 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
18 "storage" => {
19 builder = builder.set_storage(crate::protocol_serde::shape_storage_configuration::de_storage_configuration(
20 tokens, _value,
21 )?);
22 }
23 "performance" => {
24 builder = builder.set_performance(
25 crate::protocol_serde::shape_block_storage_performance_configuration::de_block_storage_performance_configuration(
26 tokens, _value,
27 )?,
28 );
29 }
30 "attachmentState" => {
31 builder = builder.set_attachment_state(
32 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
33 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
34 .transpose()?,
35 );
36 }
37 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
38 },
39 other => {
40 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
41 "expected object key or end object, found: {other:?}"
42 )))
43 }
44 }
45 }
46 Ok(Some(builder.build()))
47 }
48 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
49 "expected start object or null",
50 )),
51 }
52}