aws-sdk-ec2 1.222.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::needless_question_mark)]
pub fn de_target_capacity_specification(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::TargetCapacitySpecification, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::TargetCapacitySpecification::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("totalTargetCapacity") /* TotalTargetCapacity com.amazonaws.ec2#TargetCapacitySpecification$TotalTargetCapacity */ =>  {
                let var_1 =
                    Some(
                         {
                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_total_target_capacity(var_1);
            }
            ,
            s if s.matches("onDemandTargetCapacity") /* OnDemandTargetCapacity com.amazonaws.ec2#TargetCapacitySpecification$OnDemandTargetCapacity */ =>  {
                let var_2 =
                    Some(
                         {
                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_on_demand_target_capacity(var_2);
            }
            ,
            s if s.matches("spotTargetCapacity") /* SpotTargetCapacity com.amazonaws.ec2#TargetCapacitySpecification$SpotTargetCapacity */ =>  {
                let var_3 =
                    Some(
                         {
                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_spot_target_capacity(var_3);
            }
            ,
            s if s.matches("defaultTargetCapacityType") /* DefaultTargetCapacityType com.amazonaws.ec2#TargetCapacitySpecification$DefaultTargetCapacityType */ =>  {
                let var_4 =
                    Some(
                        Result::<crate::types::DefaultTargetCapacityType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::DefaultTargetCapacityType::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_default_target_capacity_type(var_4);
            }
            ,
            s if s.matches("targetCapacityUnitType") /* TargetCapacityUnitType com.amazonaws.ec2#TargetCapacitySpecification$TargetCapacityUnitType */ =>  {
                let var_5 =
                    Some(
                        Result::<crate::types::TargetCapacityUnitType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::TargetCapacityUnitType::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_target_capacity_unit_type(var_5);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}