aws_sdk_ecs/protocol_serde/
shape_execute_command_configuration.rs1pub fn ser_execute_command_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::ExecuteCommandConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.kms_key_id {
7 object.key("kmsKeyId").string(var_1.as_str());
8 }
9 if let Some(var_2) = &input.logging {
10 object.key("logging").string(var_2.as_str());
11 }
12 if let Some(var_3) = &input.log_configuration {
13 #[allow(unused_mut)]
14 let mut object_4 = object.key("logConfiguration").start_object();
15 crate::protocol_serde::shape_execute_command_log_configuration::ser_execute_command_log_configuration(&mut object_4, var_3)?;
16 object_4.finish();
17 }
18 Ok(())
19}
20
21pub(crate) fn de_execute_command_configuration<'a, I>(
22 tokens: &mut ::std::iter::Peekable<I>,
23) -> ::std::result::Result<Option<crate::types::ExecuteCommandConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
24where
25 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
26{
27 match tokens.next().transpose()? {
28 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
29 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
30 #[allow(unused_mut)]
31 let mut builder = crate::types::builders::ExecuteCommandConfigurationBuilder::default();
32 loop {
33 match tokens.next().transpose()? {
34 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
35 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
36 "kmsKeyId" => {
37 builder = builder.set_kms_key_id(
38 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
39 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
40 .transpose()?,
41 );
42 }
43 "logging" => {
44 builder = builder.set_logging(
45 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
46 .map(|s| s.to_unescaped().map(|u| crate::types::ExecuteCommandLogging::from(u.as_ref())))
47 .transpose()?,
48 );
49 }
50 "logConfiguration" => {
51 builder = builder.set_log_configuration(
52 crate::protocol_serde::shape_execute_command_log_configuration::de_execute_command_log_configuration(tokens)?,
53 );
54 }
55 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
56 },
57 other => {
58 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
59 "expected object key or end object, found: {:?}",
60 other
61 )))
62 }
63 }
64 }
65 Ok(Some(builder.build()))
66 }
67 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
68 "expected start object or null",
69 )),
70 }
71}