aws-sdk-ec2 1.224.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_scheduled_instance(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::ScheduledInstance, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::ScheduledInstance::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("availabilityZone") /* AvailabilityZone com.amazonaws.ec2#ScheduledInstance$AvailabilityZone */ =>  {
                let var_1 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_availability_zone(var_1);
            }
            ,
            s if s.matches("createDate") /* CreateDate com.amazonaws.ec2#ScheduledInstance$CreateDate */ =>  {
                let var_2 =
                    Some(
                        ::aws_smithy_types::DateTime::from_str(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
                        )
                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_create_date(var_2);
            }
            ,
            s if s.matches("hourlyPrice") /* HourlyPrice com.amazonaws.ec2#ScheduledInstance$HourlyPrice */ =>  {
                let var_3 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_hourly_price(var_3);
            }
            ,
            s if s.matches("instanceCount") /* InstanceCount com.amazonaws.ec2#ScheduledInstance$InstanceCount */ =>  {
                let var_4 =
                    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_instance_count(var_4);
            }
            ,
            s if s.matches("instanceType") /* InstanceType com.amazonaws.ec2#ScheduledInstance$InstanceType */ =>  {
                let var_5 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_instance_type(var_5);
            }
            ,
            s if s.matches("networkPlatform") /* NetworkPlatform com.amazonaws.ec2#ScheduledInstance$NetworkPlatform */ =>  {
                let var_6 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_network_platform(var_6);
            }
            ,
            s if s.matches("nextSlotStartTime") /* NextSlotStartTime com.amazonaws.ec2#ScheduledInstance$NextSlotStartTime */ =>  {
                let var_7 =
                    Some(
                        ::aws_smithy_types::DateTime::from_str(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
                        )
                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_next_slot_start_time(var_7);
            }
            ,
            s if s.matches("platform") /* Platform com.amazonaws.ec2#ScheduledInstance$Platform */ =>  {
                let var_8 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_platform(var_8);
            }
            ,
            s if s.matches("previousSlotEndTime") /* PreviousSlotEndTime com.amazonaws.ec2#ScheduledInstance$PreviousSlotEndTime */ =>  {
                let var_9 =
                    Some(
                        ::aws_smithy_types::DateTime::from_str(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
                        )
                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_previous_slot_end_time(var_9);
            }
            ,
            s if s.matches("recurrence") /* Recurrence com.amazonaws.ec2#ScheduledInstance$Recurrence */ =>  {
                let var_10 =
                    Some(
                        crate::protocol_serde::shape_scheduled_instance_recurrence::de_scheduled_instance_recurrence(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_recurrence(var_10);
            }
            ,
            s if s.matches("scheduledInstanceId") /* ScheduledInstanceId com.amazonaws.ec2#ScheduledInstance$ScheduledInstanceId */ =>  {
                let var_11 =
                    Some(
                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            .into()
                        )
                        ?
                    )
                ;
                builder = builder.set_scheduled_instance_id(var_11);
            }
            ,
            s if s.matches("slotDurationInHours") /* SlotDurationInHours com.amazonaws.ec2#ScheduledInstance$SlotDurationInHours */ =>  {
                let var_12 =
                    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_slot_duration_in_hours(var_12);
            }
            ,
            s if s.matches("termEndDate") /* TermEndDate com.amazonaws.ec2#ScheduledInstance$TermEndDate */ =>  {
                let var_13 =
                    Some(
                        ::aws_smithy_types::DateTime::from_str(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
                        )
                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_term_end_date(var_13);
            }
            ,
            s if s.matches("termStartDate") /* TermStartDate com.amazonaws.ec2#ScheduledInstance$TermStartDate */ =>  {
                let var_14 =
                    Some(
                        ::aws_smithy_types::DateTime::from_str(
                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
                        )
                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_term_start_date(var_14);
            }
            ,
            s if s.matches("totalScheduledInstanceHours") /* TotalScheduledInstanceHours com.amazonaws.ec2#ScheduledInstance$TotalScheduledInstanceHours */ =>  {
                let var_15 =
                    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_scheduled_instance_hours(var_15);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}