aws_sdk_ecs/protocol_serde/
shape_service_volume_configuration.rs1pub fn ser_service_volume_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::ServiceVolumeConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 object.key("name").string(input.name.as_str());
8 }
9 if let Some(var_1) = &input.managed_ebs_volume {
10 #[allow(unused_mut)]
11 let mut object_2 = object.key("managedEBSVolume").start_object();
12 crate::protocol_serde::shape_service_managed_ebs_volume_configuration::ser_service_managed_ebs_volume_configuration(&mut object_2, var_1)?;
13 object_2.finish();
14 }
15 Ok(())
16}
17
18pub(crate) fn de_service_volume_configuration<'a, I>(
19 tokens: &mut ::std::iter::Peekable<I>,
20) -> ::std::result::Result<Option<crate::types::ServiceVolumeConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
21where
22 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
23{
24 match tokens.next().transpose()? {
25 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
26 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
27 #[allow(unused_mut)]
28 let mut builder = crate::types::builders::ServiceVolumeConfigurationBuilder::default();
29 loop {
30 match tokens.next().transpose()? {
31 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
32 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
33 match key.to_unescaped()?.as_ref() {
34 "name" => {
35 builder = builder.set_name(
36 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
37 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
38 .transpose()?,
39 );
40 }
41 "managedEBSVolume" => {
42 builder = builder.set_managed_ebs_volume(
43 crate::protocol_serde::shape_service_managed_ebs_volume_configuration::de_service_managed_ebs_volume_configuration(tokens)?
44 );
45 }
46 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
47 }
48 }
49 other => {
50 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
51 "expected object key or end object, found: {:?}",
52 other
53 )))
54 }
55 }
56 }
57 Ok(Some(
58 crate::serde_util::service_volume_configuration_correct_errors(builder)
59 .build()
60 .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
61 ))
62 }
63 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
64 "expected start object or null",
65 )),
66 }
67}