aws_sdk_ecs/protocol_serde/
shape_execute_command_log_configuration.rs1pub fn ser_execute_command_log_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::ExecuteCommandLogConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if let Some(var_1) = &input.cloud_watch_log_group_name {
7 object.key("cloudWatchLogGroupName").string(var_1.as_str());
8 }
9 if input.cloud_watch_encryption_enabled {
10 object.key("cloudWatchEncryptionEnabled").boolean(input.cloud_watch_encryption_enabled);
11 }
12 if let Some(var_2) = &input.s3_bucket_name {
13 object.key("s3BucketName").string(var_2.as_str());
14 }
15 if input.s3_encryption_enabled {
16 object.key("s3EncryptionEnabled").boolean(input.s3_encryption_enabled);
17 }
18 if let Some(var_3) = &input.s3_key_prefix {
19 object.key("s3KeyPrefix").string(var_3.as_str());
20 }
21 Ok(())
22}
23
24pub(crate) fn de_execute_command_log_configuration<'a, I>(
25 tokens: &mut ::std::iter::Peekable<I>,
26) -> ::std::result::Result<Option<crate::types::ExecuteCommandLogConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
27where
28 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
29{
30 match tokens.next().transpose()? {
31 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
32 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
33 #[allow(unused_mut)]
34 let mut builder = crate::types::builders::ExecuteCommandLogConfigurationBuilder::default();
35 loop {
36 match tokens.next().transpose()? {
37 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
38 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
39 "cloudWatchLogGroupName" => {
40 builder = builder.set_cloud_watch_log_group_name(
41 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
42 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
43 .transpose()?,
44 );
45 }
46 "cloudWatchEncryptionEnabled" => {
47 builder = builder
48 .set_cloud_watch_encryption_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
49 }
50 "s3BucketName" => {
51 builder = builder.set_s3_bucket_name(
52 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
53 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
54 .transpose()?,
55 );
56 }
57 "s3EncryptionEnabled" => {
58 builder = builder.set_s3_encryption_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
59 }
60 "s3KeyPrefix" => {
61 builder = builder.set_s3_key_prefix(
62 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
63 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
64 .transpose()?,
65 );
66 }
67 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
68 },
69 other => {
70 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
71 "expected object key or end object, found: {:?}",
72 other
73 )))
74 }
75 }
76 }
77 Ok(Some(builder.build()))
78 }
79 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
80 "expected start object or null",
81 )),
82 }
83}