aws-sdk-firehose 1.110.0

AWS SDK for Amazon Kinesis Firehose
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_destination_table_configuration(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::DestinationTableConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    {
        object.key("DestinationTableName").string(input.destination_table_name.as_str());
    }
    {
        object.key("DestinationDatabaseName").string(input.destination_database_name.as_str());
    }
    if let Some(var_1) = &input.unique_keys {
        let mut array_2 = object.key("UniqueKeys").start_array();
        for item_3 in var_1 {
            {
                array_2.value().string(item_3.as_str());
            }
        }
        array_2.finish();
    }
    if let Some(var_4) = &input.partition_spec {
        #[allow(unused_mut)]
        let mut object_5 = object.key("PartitionSpec").start_object();
        crate::protocol_serde::shape_partition_spec::ser_partition_spec(&mut object_5, var_4)?;
        object_5.finish();
    }
    if let Some(var_6) = &input.s3_error_output_prefix {
        object.key("S3ErrorOutputPrefix").string(var_6.as_str());
    }
    Ok(())
}

pub(crate) fn de_destination_table_configuration<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
    depth: u32,
) -> ::std::result::Result<Option<crate::types::DestinationTableConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
    if depth >= 128u32 {
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "maximum nesting depth exceeded",
        ));
    }
    match tokens.next().transpose()? {
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
            #[allow(unused_mut)]
            let mut builder = crate::types::builders::DestinationTableConfigurationBuilder::default();
            loop {
                match tokens.next().transpose()? {
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
                        "DestinationTableName" => {
                            builder = builder.set_destination_table_name(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "DestinationDatabaseName" => {
                            builder = builder.set_destination_database_name(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "UniqueKeys" => {
                            builder = builder.set_unique_keys(
                                    crate::protocol_serde::shape_list_of_non_empty_strings_without_whitespace::de_list_of_non_empty_strings_without_whitespace(tokens, _value, depth + 1)?
                                );
                        }
                        "PartitionSpec" => {
                            builder = builder.set_partition_spec(crate::protocol_serde::shape_partition_spec::de_partition_spec(
                                tokens,
                                _value,
                                depth + 1,
                            )?);
                        }
                        "S3ErrorOutputPrefix" => {
                            builder = builder.set_s3_error_output_prefix(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
                    },
                    other => {
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
                            "expected object key or end object, found: {other:?}"
                        )))
                    }
                }
            }
            Ok(Some(
                crate::serde_util::destination_table_configuration_correct_errors(builder)
                    .build()
                    .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
            ))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}