aws-sdk-ses 1.105.0

AWS SDK for Amazon Simple Email Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(clippy::unnecessary_wraps)]
pub fn de_describe_configuration_set_http_error(
    _response_status: u16,
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    _response_body: &[u8],
) -> std::result::Result<
    crate::operation::describe_configuration_set::DescribeConfigurationSetOutput,
    crate::operation::describe_configuration_set::DescribeConfigurationSetError,
> {
    #[allow(unused_mut)]
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
        .map_err(crate::operation::describe_configuration_set::DescribeConfigurationSetError::unhandled)?;
    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
    let generic = generic_builder.build();
    let error_code = match generic.code() {
        Some(code) => code,
        None => {
            return Err(crate::operation::describe_configuration_set::DescribeConfigurationSetError::unhandled(
                generic,
            ))
        }
    };

    let _error_message = generic.message().map(|msg| msg.to_owned());
    Err(match error_code {
        "ConfigurationSetDoesNotExist" => {
            crate::operation::describe_configuration_set::DescribeConfigurationSetError::ConfigurationSetDoesNotExistException({
                #[allow(unused_mut)]
                let mut tmp = {
                    #[allow(unused_mut)]
                    let mut output = crate::types::error::builders::ConfigurationSetDoesNotExistExceptionBuilder::default();
                    output = crate::protocol_serde::shape_configuration_set_does_not_exist_exception::de_configuration_set_does_not_exist_exception_xml_err(_response_body, output).map_err(crate::operation::describe_configuration_set::DescribeConfigurationSetError::unhandled)?;
                    let output = output.meta(generic);
                    output.build()
                };
                if tmp.message.is_none() {
                    tmp.message = _error_message;
                }
                tmp
            })
        }
        _ => crate::operation::describe_configuration_set::DescribeConfigurationSetError::generic(generic),
    })
}

#[allow(clippy::unnecessary_wraps)]
pub fn de_describe_configuration_set_http_response(
    _response_status: u16,
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    _response_body: &[u8],
) -> std::result::Result<
    crate::operation::describe_configuration_set::DescribeConfigurationSetOutput,
    crate::operation::describe_configuration_set::DescribeConfigurationSetError,
> {
    Ok({
        #[allow(unused_mut)]
        let mut output = crate::operation::describe_configuration_set::builders::DescribeConfigurationSetOutputBuilder::default();
        output = crate::protocol_serde::shape_describe_configuration_set::de_describe_configuration_set(_response_body, output)
            .map_err(crate::operation::describe_configuration_set::DescribeConfigurationSetError::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_describe_configuration_set(
    inp: &[u8],
    mut builder: crate::operation::describe_configuration_set::builders::DescribeConfigurationSetOutputBuilder,
) -> std::result::Result<
    crate::operation::describe_configuration_set::builders::DescribeConfigurationSetOutputBuilder,
    ::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();
    #[allow(unused_variables)]
    let depth = 0u32;
    if !(start_el.matches("DescribeConfigurationSetResponse")) {
        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
            "invalid root, expected DescribeConfigurationSetResponse got {start_el:?}"
        )));
    }
    if let Some(mut result_tag) = decoder.next_tag() {
        let start_el = result_tag.start_el();
        if !(start_el.matches("DescribeConfigurationSetResult")) {
            return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
                "invalid result, expected DescribeConfigurationSetResult got {start_el:?}"
            )));
        }
        while let Some(mut tag) = result_tag.next_tag() {
            match tag.start_el() {
            s if s.matches("ConfigurationSet") /* ConfigurationSet com.amazonaws.ses.synthetic#DescribeConfigurationSetOutput$ConfigurationSet */ =>  {
                let var_1 =
                    Some(
                        crate::protocol_serde::shape_configuration_set::de_configuration_set(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_configuration_set(var_1);
            }
            ,
            s if s.matches("EventDestinations") /* EventDestinations com.amazonaws.ses.synthetic#DescribeConfigurationSetOutput$EventDestinations */ =>  {
                let var_2 =
                    Some(
                        crate::protocol_serde::shape_event_destinations::de_event_destinations(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_event_destinations(var_2);
            }
            ,
            s if s.matches("TrackingOptions") /* TrackingOptions com.amazonaws.ses.synthetic#DescribeConfigurationSetOutput$TrackingOptions */ =>  {
                let var_3 =
                    Some(
                        crate::protocol_serde::shape_tracking_options::de_tracking_options(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_tracking_options(var_3);
            }
            ,
            s if s.matches("DeliveryOptions") /* DeliveryOptions com.amazonaws.ses.synthetic#DescribeConfigurationSetOutput$DeliveryOptions */ =>  {
                let var_4 =
                    Some(
                        crate::protocol_serde::shape_delivery_options::de_delivery_options(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_delivery_options(var_4);
            }
            ,
            s if s.matches("ReputationOptions") /* ReputationOptions com.amazonaws.ses.synthetic#DescribeConfigurationSetOutput$ReputationOptions */ =>  {
                let var_5 =
                    Some(
                        crate::protocol_serde::shape_reputation_options::de_reputation_options(&mut tag, depth + 1)
                        ?
                    )
                ;
                builder = builder.set_reputation_options(var_5);
            }
            ,
            _ => {}
        }
        }
    } else {
        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(
            "expected DescribeConfigurationSetResult tag",
        ));
    };
    Ok(builder)
}