aws-sdk-computeoptimizerautomation 1.9.0

AWS SDK for Compute Optimizer Automation
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_organization_configuration(
    decoder: &mut ::aws_smithy_cbor::Decoder,
) -> ::std::result::Result<crate::types::OrganizationConfiguration, ::aws_smithy_cbor::decode::DeserializeError> {
    #[allow(clippy::match_single_binding)]
    fn pair(
        mut builder: crate::types::builders::OrganizationConfigurationBuilder,
        decoder: &mut ::aws_smithy_cbor::Decoder,
    ) -> ::std::result::Result<crate::types::builders::OrganizationConfigurationBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
        builder = match decoder.str()?.as_ref() {
            "ruleApplyOrder" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
                Ok(builder.set_rule_apply_order(Some(decoder.string().map(|s| crate::types::RuleApplyOrder::from(s.as_ref()))?)))
            })?,
            "accountIds" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
                Ok(builder.set_account_ids(Some(
                    crate::protocol_serde::shape_organization_configuration_account_ids::de_organization_configuration_account_ids(decoder)?,
                )))
            })?,
            _ => {
                decoder.skip()?;
                builder
            }
        };
        Ok(builder)
    }

    let mut builder = crate::types::builders::OrganizationConfigurationBuilder::default();

    match decoder.map()? {
        None => loop {
            match decoder.datatype()? {
                ::aws_smithy_cbor::data::Type::Break => {
                    decoder.skip()?;
                    break;
                }
                _ => {
                    builder = pair(builder, decoder)?;
                }
            };
        },
        Some(n) => {
            for _ in 0..n {
                builder = pair(builder, decoder)?;
            }
        }
    };
    #[allow(clippy::needless_question_mark)]
    {
        return Ok(builder.build());
    }
}

pub fn ser_organization_configuration(
    encoder: &mut ::aws_smithy_cbor::Encoder,
    #[allow(unused)] input: &crate::types::OrganizationConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    encoder.begin_map();
    if let Some(var_1) = &input.rule_apply_order {
        encoder.str("ruleApplyOrder").str(var_1.as_str());
    }
    if let Some(var_2) = &input.account_ids {
        encoder.str("accountIds");
        encoder.array((*var_2).len());
        for item_3 in var_2 {
            {
                encoder.str(item_3.as_str());
            }
        }
    }
    encoder.end();
    Ok(())
}