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_account_info(
    decoder: &mut ::aws_smithy_cbor::Decoder,
) -> ::std::result::Result<crate::types::AccountInfo, ::aws_smithy_cbor::decode::DeserializeError> {
    #[allow(clippy::match_single_binding)]
    fn pair(
        mut builder: crate::types::builders::AccountInfoBuilder,
        decoder: &mut ::aws_smithy_cbor::Decoder,
    ) -> ::std::result::Result<crate::types::builders::AccountInfoBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
        builder =
            match decoder.str()?.as_ref() {
                "accountId" => builder.set_account_id(Some(decoder.string()?)),
                "status" => builder.set_status(Some(decoder.string().map(|s| crate::types::EnrollmentStatus::from(s.as_ref()))?)),
                "organizationRuleMode" => {
                    builder.set_organization_rule_mode(Some(decoder.string().map(|s| crate::types::OrganizationRuleMode::from(s.as_ref()))?))
                }
                "statusReason" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
                    Ok(builder.set_status_reason(Some(decoder.string()?)))
                })?,
                "lastUpdatedTimestamp" => builder.set_last_updated_timestamp(Some(decoder.timestamp()?)),
                _ => {
                    decoder.skip()?;
                    builder
                }
            };
        Ok(builder)
    }

    let mut builder = crate::types::builders::AccountInfoBuilder::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(crate::serde_util::account_info_correct_errors(builder)
            .build()
            .map_err(|err| ::aws_smithy_cbor::decode::DeserializeError::custom(err.to_string(), decoder.position()))?);
    }
}