aws-sdk-observabilityadmin 1.52.0

AWS SDK for CloudWatch Observability Admin Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_destination_logs_configuration(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::DestinationLogsConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.logs_encryption_configuration {
        #[allow(unused_mut)]
        let mut object_2 = object.key("LogsEncryptionConfiguration").start_object();
        crate::protocol_serde::shape_logs_encryption_configuration::ser_logs_encryption_configuration(&mut object_2, var_1)?;
        object_2.finish();
    }
    if let Some(var_3) = &input.backup_configuration {
        #[allow(unused_mut)]
        let mut object_4 = object.key("BackupConfiguration").start_object();
        crate::protocol_serde::shape_logs_backup_configuration::ser_logs_backup_configuration(&mut object_4, var_3)?;
        object_4.finish();
    }
    if let Some(var_5) = &input.log_group_name_configuration {
        #[allow(unused_mut)]
        let mut object_6 = object.key("LogGroupNameConfiguration").start_object();
        crate::protocol_serde::shape_log_group_name_configuration::ser_log_group_name_configuration(&mut object_6, var_5)?;
        object_6.finish();
    }
    Ok(())
}

pub(crate) fn de_destination_logs_configuration<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::DestinationLogsConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
    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::DestinationLogsConfigurationBuilder::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() {
                        "LogsEncryptionConfiguration" => {
                            builder = builder.set_logs_encryption_configuration(
                                crate::protocol_serde::shape_logs_encryption_configuration::de_logs_encryption_configuration(tokens, _value)?,
                            );
                        }
                        "BackupConfiguration" => {
                            builder = builder.set_backup_configuration(
                                crate::protocol_serde::shape_logs_backup_configuration::de_logs_backup_configuration(tokens, _value)?,
                            );
                        }
                        "LogGroupNameConfiguration" => {
                            builder = builder.set_log_group_name_configuration(
                                crate::protocol_serde::shape_log_group_name_configuration::de_log_group_name_configuration(tokens, _value)?,
                            );
                        }
                        _ => ::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(builder.build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}