Skip to main content

aws_sdk_firehose/protocol_serde/
shape_processing_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_processing_configuration(
3    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4    input: &crate::types::ProcessingConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6    if let Some(var_1) = &input.enabled {
7        object.key("Enabled").boolean(*var_1);
8    }
9    if let Some(var_2) = &input.processors {
10        let mut array_3 = object.key("Processors").start_array();
11        for item_4 in var_2 {
12            {
13                #[allow(unused_mut)]
14                let mut object_5 = array_3.value().start_object();
15                crate::protocol_serde::shape_processor::ser_processor(&mut object_5, item_4)?;
16                object_5.finish();
17            }
18        }
19        array_3.finish();
20    }
21    Ok(())
22}
23
24pub(crate) fn de_processing_configuration<'a, I>(
25    tokens: &mut ::std::iter::Peekable<I>,
26    _value: &'a [u8],
27) -> ::std::result::Result<Option<crate::types::ProcessingConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
28where
29    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
30{
31    match tokens.next().transpose()? {
32        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
33        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
34            #[allow(unused_mut)]
35            let mut builder = crate::types::builders::ProcessingConfigurationBuilder::default();
36            loop {
37                match tokens.next().transpose()? {
38                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
39                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
40                        "Enabled" => {
41                            builder = builder.set_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
42                        }
43                        "Processors" => {
44                            builder = builder.set_processors(crate::protocol_serde::shape_processor_list::de_processor_list(tokens, _value)?);
45                        }
46                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
47                    },
48                    other => {
49                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
50                            "expected object key or end object, found: {other:?}"
51                        )))
52                    }
53                }
54            }
55            Ok(Some(builder.build()))
56        }
57        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
58            "expected start object or null",
59        )),
60    }
61}