aws_sdk_ec2/protocol_serde/
shape_ebs_instance_block_device.rs

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