aws_sdk_securityhub/protocol_serde/
shape_aws_s3_bucket_notification_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_aws_s3_bucket_notification_configuration(
3    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4    input: &crate::types::AwsS3BucketNotificationConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    if let Some(var_1) = &input.configurations {
7        let mut array_2 = object.key("Configurations").start_array();
8        for item_3 in var_1 {
9            {
10                #[allow(unused_mut)]
11                let mut object_4 = array_2.value().start_object();
12                crate::protocol_serde::shape_aws_s3_bucket_notification_configuration_detail::ser_aws_s3_bucket_notification_configuration_detail(
13                    &mut object_4,
14                    item_3,
15                )?;
16                object_4.finish();
17            }
18        }
19        array_2.finish();
20    }
21    Ok(())
22}
23
24pub(crate) fn de_aws_s3_bucket_notification_configuration<'a, I>(
25    tokens: &mut ::std::iter::Peekable<I>,
26) -> ::std::result::Result<Option<crate::types::AwsS3BucketNotificationConfiguration>, ::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::AwsS3BucketNotificationConfigurationBuilder::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                        "Configurations" => {
40                            builder = builder.set_configurations(
41                                    crate::protocol_serde::shape_aws_s3_bucket_notification_configuration_details::de_aws_s3_bucket_notification_configuration_details(tokens)?
42                                );
43                        }
44                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
45                    },
46                    other => {
47                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
48                            "expected object key or end object, found: {:?}",
49                            other
50                        )))
51                    }
52                }
53            }
54            Ok(Some(builder.build()))
55        }
56        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
57            "expected start object or null",
58        )),
59    }
60}