aws_sdk_ec2/protocol_serde/
shape_volume_attachment.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_volume_attachment(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::VolumeAttachment, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::VolumeAttachment::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("deleteOnTermination") /* DeleteOnTermination com.amazonaws.ec2#VolumeAttachment$DeleteOnTermination */ =>  {
11                let var_1 =
12                    Some(
13                         {
14                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
15                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16                            )
17                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
18                        }
19                        ?
20                    )
21                ;
22                builder = builder.set_delete_on_termination(var_1);
23            }
24            ,
25            s if s.matches("associatedResource") /* AssociatedResource com.amazonaws.ec2#VolumeAttachment$AssociatedResource */ =>  {
26                let var_2 =
27                    Some(
28                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
29                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
30                            .into()
31                        )
32                        ?
33                    )
34                ;
35                builder = builder.set_associated_resource(var_2);
36            }
37            ,
38            s if s.matches("instanceOwningService") /* InstanceOwningService com.amazonaws.ec2#VolumeAttachment$InstanceOwningService */ =>  {
39                let var_3 =
40                    Some(
41                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
42                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
43                            .into()
44                        )
45                        ?
46                    )
47                ;
48                builder = builder.set_instance_owning_service(var_3);
49            }
50            ,
51            s if s.matches("volumeId") /* VolumeId com.amazonaws.ec2#VolumeAttachment$VolumeId */ =>  {
52                let var_4 =
53                    Some(
54                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
55                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56                            .into()
57                        )
58                        ?
59                    )
60                ;
61                builder = builder.set_volume_id(var_4);
62            }
63            ,
64            s if s.matches("instanceId") /* InstanceId com.amazonaws.ec2#VolumeAttachment$InstanceId */ =>  {
65                let var_5 =
66                    Some(
67                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
68                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69                            .into()
70                        )
71                        ?
72                    )
73                ;
74                builder = builder.set_instance_id(var_5);
75            }
76            ,
77            s if s.matches("device") /* Device com.amazonaws.ec2#VolumeAttachment$Device */ =>  {
78                let var_6 =
79                    Some(
80                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
81                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
82                            .into()
83                        )
84                        ?
85                    )
86                ;
87                builder = builder.set_device(var_6);
88            }
89            ,
90            s if s.matches("status") /* State com.amazonaws.ec2#VolumeAttachment$State */ =>  {
91                let var_7 =
92                    Some(
93                        Result::<crate::types::VolumeAttachmentState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
94                            crate::types::VolumeAttachmentState::from(
95                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
96                            )
97                        )
98                        ?
99                    )
100                ;
101                builder = builder.set_state(var_7);
102            }
103            ,
104            s if s.matches("attachTime") /* AttachTime com.amazonaws.ec2#VolumeAttachment$AttachTime */ =>  {
105                let var_8 =
106                    Some(
107                        ::aws_smithy_types::DateTime::from_str(
108                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
109                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
110                        )
111                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
112                        ?
113                    )
114                ;
115                builder = builder.set_attach_time(var_8);
116            }
117            ,
118            _ => {}
119        }
120    }
121    Ok(builder.build())
122}