aws_sdk_ses/protocol_serde/
shape_bounce_action.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(unused_mut)]
3pub fn ser_bounce_action(
4    mut writer: ::aws_smithy_query::QueryValueWriter,
5    input: &crate::types::BounceAction,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7    #[allow(unused_mut)]
8    let mut scope_1 = writer.prefix("TopicArn");
9    if let Some(var_2) = &input.topic_arn {
10        scope_1.string(var_2);
11    }
12    #[allow(unused_mut)]
13    let mut scope_3 = writer.prefix("SmtpReplyCode");
14    {
15        scope_3.string(&input.smtp_reply_code);
16    }
17    #[allow(unused_mut)]
18    let mut scope_4 = writer.prefix("StatusCode");
19    if let Some(var_5) = &input.status_code {
20        scope_4.string(var_5);
21    }
22    #[allow(unused_mut)]
23    let mut scope_6 = writer.prefix("Message");
24    {
25        scope_6.string(&input.message);
26    }
27    #[allow(unused_mut)]
28    let mut scope_7 = writer.prefix("Sender");
29    {
30        scope_7.string(&input.sender);
31    }
32    Ok(())
33}
34
35#[allow(clippy::needless_question_mark)]
36pub fn de_bounce_action(
37    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
38) -> ::std::result::Result<crate::types::BounceAction, ::aws_smithy_xml::decode::XmlDecodeError> {
39    #[allow(unused_mut)]
40    let mut builder = crate::types::BounceAction::builder();
41    while let Some(mut tag) = decoder.next_tag() {
42        match tag.start_el() {
43            s if s.matches("TopicArn") /* TopicArn com.amazonaws.ses#BounceAction$TopicArn */ =>  {
44                let var_8 =
45                    Some(
46                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
47                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
48                            .into()
49                        )
50                        ?
51                    )
52                ;
53                builder = builder.set_topic_arn(var_8);
54            }
55            ,
56            s if s.matches("SmtpReplyCode") /* SmtpReplyCode com.amazonaws.ses#BounceAction$SmtpReplyCode */ =>  {
57                let var_9 =
58                    Some(
59                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
60                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
61                            .into()
62                        )
63                        ?
64                    )
65                ;
66                builder = builder.set_smtp_reply_code(var_9);
67            }
68            ,
69            s if s.matches("StatusCode") /* StatusCode com.amazonaws.ses#BounceAction$StatusCode */ =>  {
70                let var_10 =
71                    Some(
72                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
73                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
74                            .into()
75                        )
76                        ?
77                    )
78                ;
79                builder = builder.set_status_code(var_10);
80            }
81            ,
82            s if s.matches("Message") /* Message com.amazonaws.ses#BounceAction$Message */ =>  {
83                let var_11 =
84                    Some(
85                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
86                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
87                            .into()
88                        )
89                        ?
90                    )
91                ;
92                builder = builder.set_message(var_11);
93            }
94            ,
95            s if s.matches("Sender") /* Sender com.amazonaws.ses#BounceAction$Sender */ =>  {
96                let var_12 =
97                    Some(
98                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
99                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
100                            .into()
101                        )
102                        ?
103                    )
104                ;
105                builder = builder.set_sender(var_12);
106            }
107            ,
108            _ => {}
109        }
110    }
111    Ok(crate::serde_util::bounce_action_correct_errors(builder)
112        .build()
113        .map_err(|_| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing field"))?)
114}