aws_sdk_ec2/protocol_serde/
shape_instance_status_event.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_instance_status_event(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::InstanceStatusEvent, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::InstanceStatusEvent::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("instanceEventId") /* InstanceEventId com.amazonaws.ec2#InstanceStatusEvent$InstanceEventId */ =>  {
11                let var_1 =
12                    Some(
13                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
15                            .into()
16                        )
17                        ?
18                    )
19                ;
20                builder = builder.set_instance_event_id(var_1);
21            }
22            ,
23            s if s.matches("code") /* Code com.amazonaws.ec2#InstanceStatusEvent$Code */ =>  {
24                let var_2 =
25                    Some(
26                        Result::<crate::types::EventCode, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27                            crate::types::EventCode::from(
28                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29                            )
30                        )
31                        ?
32                    )
33                ;
34                builder = builder.set_code(var_2);
35            }
36            ,
37            s if s.matches("description") /* Description com.amazonaws.ec2#InstanceStatusEvent$Description */ =>  {
38                let var_3 =
39                    Some(
40                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
41                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            .into()
43                        )
44                        ?
45                    )
46                ;
47                builder = builder.set_description(var_3);
48            }
49            ,
50            s if s.matches("notAfter") /* NotAfter com.amazonaws.ec2#InstanceStatusEvent$NotAfter */ =>  {
51                let var_4 =
52                    Some(
53                        ::aws_smithy_types::DateTime::from_str(
54                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
56                        )
57                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
58                        ?
59                    )
60                ;
61                builder = builder.set_not_after(var_4);
62            }
63            ,
64            s if s.matches("notBefore") /* NotBefore com.amazonaws.ec2#InstanceStatusEvent$NotBefore */ =>  {
65                let var_5 =
66                    Some(
67                        ::aws_smithy_types::DateTime::from_str(
68                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
70                        )
71                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
72                        ?
73                    )
74                ;
75                builder = builder.set_not_before(var_5);
76            }
77            ,
78            s if s.matches("notBeforeDeadline") /* NotBeforeDeadline com.amazonaws.ec2#InstanceStatusEvent$NotBeforeDeadline */ =>  {
79                let var_6 =
80                    Some(
81                        ::aws_smithy_types::DateTime::from_str(
82                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
83                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
84                        )
85                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
86                        ?
87                    )
88                ;
89                builder = builder.set_not_before_deadline(var_6);
90            }
91            ,
92            _ => {}
93        }
94    }
95    Ok(builder.build())
96}