aws-sdk-costexplorer 1.100.0

AWS SDK for AWS Cost Explorer Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_commitment_purchase_analysis_configuration<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::CommitmentPurchaseAnalysisConfiguration>, ::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::CommitmentPurchaseAnalysisConfigurationBuilder::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() {
                        "SavingsPlansPurchaseAnalysisConfiguration" => {
                            builder = builder.set_savings_plans_purchase_analysis_configuration(
                                    crate::protocol_serde::shape_savings_plans_purchase_analysis_configuration::de_savings_plans_purchase_analysis_configuration(tokens)?
                                );
                        }
                        _ => ::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",
        )),
    }
}

pub fn ser_commitment_purchase_analysis_configuration(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::CommitmentPurchaseAnalysisConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.savings_plans_purchase_analysis_configuration {
        #[allow(unused_mut)]
        let mut object_2 = object.key("SavingsPlansPurchaseAnalysisConfiguration").start_object();
        crate::protocol_serde::shape_savings_plans_purchase_analysis_configuration::ser_savings_plans_purchase_analysis_configuration(
            &mut object_2,
            var_1,
        )?;
        object_2.finish();
    }
    Ok(())
}