aws_sdk_securityhub/protocol_serde/
shape_aws_code_build_project_logs_config_s3_logs_details.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_aws_code_build_project_logs_config_s3_logs_details(
3    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4    input: &crate::types::AwsCodeBuildProjectLogsConfigS3LogsDetails,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    if let Some(var_1) = &input.encryption_disabled {
7        object.key("EncryptionDisabled").boolean(*var_1);
8    }
9    if let Some(var_2) = &input.location {
10        object.key("Location").string(var_2.as_str());
11    }
12    if let Some(var_3) = &input.status {
13        object.key("Status").string(var_3.as_str());
14    }
15    Ok(())
16}
17
18pub(crate) fn de_aws_code_build_project_logs_config_s3_logs_details<'a, I>(
19    tokens: &mut ::std::iter::Peekable<I>,
20) -> ::std::result::Result<Option<crate::types::AwsCodeBuildProjectLogsConfigS3LogsDetails>, ::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::AwsCodeBuildProjectLogsConfigS3LogsDetailsBuilder::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                        "EncryptionDisabled" => {
34                            builder = builder.set_encryption_disabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
35                        }
36                        "Location" => {
37                            builder = builder.set_location(
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                        "Status" => {
44                            builder = builder.set_status(
45                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
46                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
47                                    .transpose()?,
48                            );
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(builder.build()))
61        }
62        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
63            "expected start object or null",
64        )),
65    }
66}