aws_sdk_appsync/protocol_serde/
shape_log_config.rs1pub fn ser_log_config(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::LogConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 object.key("fieldLogLevel").string(input.field_log_level.as_str());
8 }
9 {
10 object.key("cloudWatchLogsRoleArn").string(input.cloud_watch_logs_role_arn.as_str());
11 }
12 if input.exclude_verbose_content {
13 object.key("excludeVerboseContent").boolean(input.exclude_verbose_content);
14 }
15 Ok(())
16}
17
18pub(crate) fn de_log_config<'a, I>(
19 tokens: &mut ::std::iter::Peekable<I>,
20) -> ::std::result::Result<Option<crate::types::LogConfig>, ::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::LogConfigBuilder::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, .. }) => match key.to_unescaped()?.as_ref() {
33 "fieldLogLevel" => {
34 builder = builder.set_field_log_level(
35 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
36 .map(|s| s.to_unescaped().map(|u| crate::types::FieldLogLevel::from(u.as_ref())))
37 .transpose()?,
38 );
39 }
40 "cloudWatchLogsRoleArn" => {
41 builder = builder.set_cloud_watch_logs_role_arn(
42 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
43 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
44 .transpose()?,
45 );
46 }
47 "excludeVerboseContent" => {
48 builder = builder.set_exclude_verbose_content(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
49 }
50 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
51 },
52 other => {
53 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
54 "expected object key or end object, found: {:?}",
55 other
56 )))
57 }
58 }
59 }
60 Ok(Some(crate::serde_util::log_config_correct_errors(builder).build().map_err(|err| {
61 ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
62 })?))
63 }
64 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
65 "expected start object or null",
66 )),
67 }
68}