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_host(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::Host, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::Host::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("autoPlacement") /* AutoPlacement com.amazonaws.ec2#Host$AutoPlacement */ =>  {
                let var_1 =
                    Some(
                        Result::<crate::types::AutoPlacement, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::AutoPlacement::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_auto_placement(var_1);
            }
            ,
            s if s.matches("availabilityZone") /* AvailabilityZone com.amazonaws.ec2#Host$AvailabilityZone */ =>  {
                let var_2 =
                    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_2);
            }
            ,
            s if s.matches("availableCapacity") /* AvailableCapacity com.amazonaws.ec2#Host$AvailableCapacity */ =>  {
                let var_3 =
                    Some(
                        crate::protocol_serde::shape_available_capacity::de_available_capacity(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_available_capacity(var_3);
            }
            ,
            s if s.matches("clientToken") /* ClientToken com.amazonaws.ec2#Host$ClientToken */ =>  {
                let var_4 =
                    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_client_token(var_4);
            }
            ,
            s if s.matches("hostId") /* HostId com.amazonaws.ec2#Host$HostId */ =>  {
                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_host_id(var_5);
            }
            ,
            s if s.matches("hostProperties") /* HostProperties com.amazonaws.ec2#Host$HostProperties */ =>  {
                let var_6 =
                    Some(
                        crate::protocol_serde::shape_host_properties::de_host_properties(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_host_properties(var_6);
            }
            ,
            s if s.matches("hostReservationId") /* HostReservationId com.amazonaws.ec2#Host$HostReservationId */ =>  {
                let var_7 =
                    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_host_reservation_id(var_7);
            }
            ,
            s if s.matches("instances") /* Instances com.amazonaws.ec2#Host$Instances */ =>  {
                let var_8 =
                    Some(
                        crate::protocol_serde::shape_host_instance_list::de_host_instance_list(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_instances(var_8);
            }
            ,
            s if s.matches("state") /* State com.amazonaws.ec2#Host$State */ =>  {
                let var_9 =
                    Some(
                        Result::<crate::types::AllocationState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::AllocationState::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_state(var_9);
            }
            ,
            s if s.matches("allocationTime") /* AllocationTime com.amazonaws.ec2#Host$AllocationTime */ =>  {
                let var_10 =
                    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_allocation_time(var_10);
            }
            ,
            s if s.matches("releaseTime") /* ReleaseTime com.amazonaws.ec2#Host$ReleaseTime */ =>  {
                let var_11 =
                    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_release_time(var_11);
            }
            ,
            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#Host$Tags */ =>  {
                let var_12 =
                    Some(
                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_tags(var_12);
            }
            ,
            s if s.matches("hostRecovery") /* HostRecovery com.amazonaws.ec2#Host$HostRecovery */ =>  {
                let var_13 =
                    Some(
                        Result::<crate::types::HostRecovery, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::HostRecovery::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_host_recovery(var_13);
            }
            ,
            s if s.matches("allowsMultipleInstanceTypes") /* AllowsMultipleInstanceTypes com.amazonaws.ec2#Host$AllowsMultipleInstanceTypes */ =>  {
                let var_14 =
                    Some(
                        Result::<crate::types::AllowsMultipleInstanceTypes, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::AllowsMultipleInstanceTypes::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_allows_multiple_instance_types(var_14);
            }
            ,
            s if s.matches("ownerId") /* OwnerId com.amazonaws.ec2#Host$OwnerId */ =>  {
                let var_15 =
                    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_owner_id(var_15);
            }
            ,
            s if s.matches("availabilityZoneId") /* AvailabilityZoneId com.amazonaws.ec2#Host$AvailabilityZoneId */ =>  {
                let var_16 =
                    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_id(var_16);
            }
            ,
            s if s.matches("memberOfServiceLinkedResourceGroup") /* MemberOfServiceLinkedResourceGroup com.amazonaws.ec2#Host$MemberOfServiceLinkedResourceGroup */ =>  {
                let var_17 =
                    Some(
                         {
                            <bool 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 (boolean: `com.amazonaws.ec2#Boolean`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_member_of_service_linked_resource_group(var_17);
            }
            ,
            s if s.matches("outpostArn") /* OutpostArn com.amazonaws.ec2#Host$OutpostArn */ =>  {
                let var_18 =
                    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_outpost_arn(var_18);
            }
            ,
            s if s.matches("hostMaintenance") /* HostMaintenance com.amazonaws.ec2#Host$HostMaintenance */ =>  {
                let var_19 =
                    Some(
                        Result::<crate::types::HostMaintenance, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::HostMaintenance::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_host_maintenance(var_19);
            }
            ,
            s if s.matches("assetId") /* AssetId com.amazonaws.ec2#Host$AssetId */ =>  {
                let var_20 =
                    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_asset_id(var_20);
            }
            ,
            _ => {}
        }
    }
    Ok(builder.build())
}