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::unnecessary_wraps)]
pub fn de_create_capacity_reservation_fleet_http_error(
    _response_status: u16,
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    _response_body: &[u8],
) -> std::result::Result<
    crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetOutput,
    crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError,
> {
    #[allow(unused_mut)]
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
        .map_err(crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError::unhandled)?;
    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
    let generic = generic_builder.build();
    Err(crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError::generic(generic))
}

#[allow(clippy::unnecessary_wraps)]
pub fn de_create_capacity_reservation_fleet_http_response(
    _response_status: u16,
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    _response_body: &[u8],
) -> std::result::Result<
    crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetOutput,
    crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError,
> {
    Ok({
        #[allow(unused_mut)]
        let mut output = crate::operation::create_capacity_reservation_fleet::builders::CreateCapacityReservationFleetOutputBuilder::default();
        output = crate::protocol_serde::shape_create_capacity_reservation_fleet::de_create_capacity_reservation_fleet(_response_body, output)
            .map_err(crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetError::unhandled)?;
        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
        output.build()
    })
}

#[allow(unused_mut)]
pub fn de_create_capacity_reservation_fleet(
    inp: &[u8],
    mut builder: crate::operation::create_capacity_reservation_fleet::builders::CreateCapacityReservationFleetOutputBuilder,
) -> std::result::Result<
    crate::operation::create_capacity_reservation_fleet::builders::CreateCapacityReservationFleetOutputBuilder,
    ::aws_smithy_xml::decode::XmlDecodeError,
> {
    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;

    #[allow(unused_mut)]
    let mut decoder = doc.root_element()?;
    #[allow(unused_variables)]
    let start_el = decoder.start_el();
    if !(start_el.matches("CreateCapacityReservationFleetResponse")) {
        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
            "invalid root, expected CreateCapacityReservationFleetResponse got {start_el:?}"
        )));
    }
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("capacityReservationFleetId") /* CapacityReservationFleetId com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$CapacityReservationFleetId */ =>  {
                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_capacity_reservation_fleet_id(var_1);
            }
            ,
            s if s.matches("state") /* State com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$State */ =>  {
                let var_2 =
                    Some(
                        Result::<crate::types::CapacityReservationFleetState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::CapacityReservationFleetState::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_state(var_2);
            }
            ,
            s if s.matches("totalTargetCapacity") /* TotalTargetCapacity com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$TotalTargetCapacity */ =>  {
                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_total_target_capacity(var_3);
            }
            ,
            s if s.matches("totalFulfilledCapacity") /* TotalFulfilledCapacity com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$TotalFulfilledCapacity */ =>  {
                let var_4 =
                    Some(
                         {
                            <f64 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 (double: `com.amazonaws.ec2#Double`)"))
                        }
                        ?
                    )
                ;
                builder = builder.set_total_fulfilled_capacity(var_4);
            }
            ,
            s if s.matches("instanceMatchCriteria") /* InstanceMatchCriteria com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$InstanceMatchCriteria */ =>  {
                let var_5 =
                    Some(
                        Result::<crate::types::FleetInstanceMatchCriteria, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::FleetInstanceMatchCriteria::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_instance_match_criteria(var_5);
            }
            ,
            s if s.matches("allocationStrategy") /* AllocationStrategy com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$AllocationStrategy */ =>  {
                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_allocation_strategy(var_6);
            }
            ,
            s if s.matches("createTime") /* CreateTime com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$CreateTime */ =>  {
                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#MillisecondDateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_create_time(var_7);
            }
            ,
            s if s.matches("endDate") /* EndDate com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$EndDate */ =>  {
                let var_8 =
                    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#MillisecondDateTime`)"))
                        ?
                    )
                ;
                builder = builder.set_end_date(var_8);
            }
            ,
            s if s.matches("tenancy") /* Tenancy com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$Tenancy */ =>  {
                let var_9 =
                    Some(
                        Result::<crate::types::FleetCapacityReservationTenancy, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
                            crate::types::FleetCapacityReservationTenancy::from(
                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
                            )
                        )
                        ?
                    )
                ;
                builder = builder.set_tenancy(var_9);
            }
            ,
            s if s.matches("fleetCapacityReservationSet") /* FleetCapacityReservations com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$FleetCapacityReservations */ =>  {
                let var_10 =
                    Some(
                        crate::protocol_serde::shape_fleet_capacity_reservation_set::de_fleet_capacity_reservation_set(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_fleet_capacity_reservations(var_10);
            }
            ,
            s if s.matches("tagSet") /* Tags com.amazonaws.ec2.synthetic#CreateCapacityReservationFleetOutput$Tags */ =>  {
                let var_11 =
                    Some(
                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
                        ?
                    )
                ;
                builder = builder.set_tags(var_11);
            }
            ,
            _ => {}
        }
    }
    Ok(builder)
}