Skip to main content

aws_sdk_ec2/protocol_serde/
shape_launch_template_ebs_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_launch_template_ebs_block_device(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::LaunchTemplateEbsBlockDevice, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::LaunchTemplateEbsBlockDevice::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("encrypted") /* Encrypted com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$Encrypted */ =>  {
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_encrypted(var_1);
23            }
24            ,
25            s if s.matches("deleteOnTermination") /* DeleteOnTermination com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$DeleteOnTermination */ =>  {
26                let var_2 =
27                    Some(
28                         {
29                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
30                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
31                            )
32                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
33                        }
34                        ?
35                    )
36                ;
37                builder = builder.set_delete_on_termination(var_2);
38            }
39            ,
40            s if s.matches("iops") /* Iops com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$Iops */ =>  {
41                let var_3 =
42                    Some(
43                         {
44                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
45                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
46                            )
47                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
48                        }
49                        ?
50                    )
51                ;
52                builder = builder.set_iops(var_3);
53            }
54            ,
55            s if s.matches("kmsKeyId") /* KmsKeyId com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$KmsKeyId */ =>  {
56                let var_4 =
57                    Some(
58                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
59                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
60                            .into()
61                        )
62                        ?
63                    )
64                ;
65                builder = builder.set_kms_key_id(var_4);
66            }
67            ,
68            s if s.matches("snapshotId") /* SnapshotId com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$SnapshotId */ =>  {
69                let var_5 =
70                    Some(
71                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
72                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
73                            .into()
74                        )
75                        ?
76                    )
77                ;
78                builder = builder.set_snapshot_id(var_5);
79            }
80            ,
81            s if s.matches("volumeSize") /* VolumeSize com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$VolumeSize */ =>  {
82                let var_6 =
83                    Some(
84                         {
85                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
86                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
87                            )
88                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
89                        }
90                        ?
91                    )
92                ;
93                builder = builder.set_volume_size(var_6);
94            }
95            ,
96            s if s.matches("volumeType") /* VolumeType com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$VolumeType */ =>  {
97                let var_7 =
98                    Some(
99                        Result::<crate::types::VolumeType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
100                            crate::types::VolumeType::from(
101                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
102                            )
103                        )
104                        ?
105                    )
106                ;
107                builder = builder.set_volume_type(var_7);
108            }
109            ,
110            s if s.matches("throughput") /* Throughput com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$Throughput */ =>  {
111                let var_8 =
112                    Some(
113                         {
114                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
115                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
116                            )
117                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
118                        }
119                        ?
120                    )
121                ;
122                builder = builder.set_throughput(var_8);
123            }
124            ,
125            s if s.matches("volumeInitializationRate") /* VolumeInitializationRate com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$VolumeInitializationRate */ =>  {
126                let var_9 =
127                    Some(
128                         {
129                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
130                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
131                            )
132                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
133                        }
134                        ?
135                    )
136                ;
137                builder = builder.set_volume_initialization_rate(var_9);
138            }
139            ,
140            s if s.matches("ebsCardIndex") /* EbsCardIndex com.amazonaws.ec2#LaunchTemplateEbsBlockDevice$EbsCardIndex */ =>  {
141                let var_10 =
142                    Some(
143                         {
144                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
145                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
146                            )
147                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
148                        }
149                        ?
150                    )
151                ;
152                builder = builder.set_ebs_card_index(var_10);
153            }
154            ,
155            _ => {}
156        }
157    }
158    Ok(builder.build())
159}