aws-sdk-ses 1.95.0

AWS SDK for Amazon Simple Email Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(unused_mut)]
pub fn ser_bounce_action(
    mut writer: ::aws_smithy_query::QueryValueWriter,
    input: &crate::types::BounceAction,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    #[allow(unused_mut)]
    let mut scope_1 = writer.prefix("TopicArn");
    if let Some(var_2) = &input.topic_arn {
        scope_1.string(var_2);
    }
    #[allow(unused_mut)]
    let mut scope_3 = writer.prefix("SmtpReplyCode");
    {
        scope_3.string(&input.smtp_reply_code);
    }
    #[allow(unused_mut)]
    let mut scope_4 = writer.prefix("StatusCode");
    if let Some(var_5) = &input.status_code {
        scope_4.string(var_5);
    }
    #[allow(unused_mut)]
    let mut scope_6 = writer.prefix("Message");
    {
        scope_6.string(&input.message);
    }
    #[allow(unused_mut)]
    let mut scope_7 = writer.prefix("Sender");
    {
        scope_7.string(&input.sender);
    }
    Ok(())
}

#[allow(clippy::needless_question_mark)]
pub fn de_bounce_action(
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
) -> ::std::result::Result<crate::types::BounceAction, ::aws_smithy_xml::decode::XmlDecodeError> {
    #[allow(unused_mut)]
    let mut builder = crate::types::BounceAction::builder();
    while let Some(mut tag) = decoder.next_tag() {
        match tag.start_el() {
            s if s.matches("TopicArn") /* TopicArn com.amazonaws.ses#BounceAction$TopicArn */ =>  {
                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_topic_arn(var_8);
            }
            ,
            s if s.matches("SmtpReplyCode") /* SmtpReplyCode com.amazonaws.ses#BounceAction$SmtpReplyCode */ =>  {
                let var_9 =
                    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_smtp_reply_code(var_9);
            }
            ,
            s if s.matches("StatusCode") /* StatusCode com.amazonaws.ses#BounceAction$StatusCode */ =>  {
                let var_10 =
                    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_status_code(var_10);
            }
            ,
            s if s.matches("Message") /* Message com.amazonaws.ses#BounceAction$Message */ =>  {
                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_message(var_11);
            }
            ,
            s if s.matches("Sender") /* Sender com.amazonaws.ses#BounceAction$Sender */ =>  {
                let var_12 =
                    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_sender(var_12);
            }
            ,
            _ => {}
        }
    }
    Ok(crate::serde_util::bounce_action_correct_errors(builder)
        .build()
        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
}