aws_sdk_ec2/protocol_serde/
shape_volume_modification.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_modification(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::VolumeModification, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::VolumeModification::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("volumeId") /* VolumeId com.amazonaws.ec2#VolumeModification$VolumeId */ =>  {
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_volume_id(var_1);
21            }
22            ,
23            s if s.matches("modificationState") /* ModificationState com.amazonaws.ec2#VolumeModification$ModificationState */ =>  {
24                let var_2 =
25                    Some(
26                        Result::<crate::types::VolumeModificationState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27                            crate::types::VolumeModificationState::from(
28                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29                            )
30                        )
31                        ?
32                    )
33                ;
34                builder = builder.set_modification_state(var_2);
35            }
36            ,
37            s if s.matches("statusMessage") /* StatusMessage com.amazonaws.ec2#VolumeModification$StatusMessage */ =>  {
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_status_message(var_3);
48            }
49            ,
50            s if s.matches("targetSize") /* TargetSize com.amazonaws.ec2#VolumeModification$TargetSize */ =>  {
51                let var_4 =
52                    Some(
53                         {
54                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
55                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56                            )
57                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
58                        }
59                        ?
60                    )
61                ;
62                builder = builder.set_target_size(var_4);
63            }
64            ,
65            s if s.matches("targetIops") /* TargetIops com.amazonaws.ec2#VolumeModification$TargetIops */ =>  {
66                let var_5 =
67                    Some(
68                         {
69                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
70                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
71                            )
72                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
73                        }
74                        ?
75                    )
76                ;
77                builder = builder.set_target_iops(var_5);
78            }
79            ,
80            s if s.matches("targetVolumeType") /* TargetVolumeType com.amazonaws.ec2#VolumeModification$TargetVolumeType */ =>  {
81                let var_6 =
82                    Some(
83                        Result::<crate::types::VolumeType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
84                            crate::types::VolumeType::from(
85                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
86                            )
87                        )
88                        ?
89                    )
90                ;
91                builder = builder.set_target_volume_type(var_6);
92            }
93            ,
94            s if s.matches("targetThroughput") /* TargetThroughput com.amazonaws.ec2#VolumeModification$TargetThroughput */ =>  {
95                let var_7 =
96                    Some(
97                         {
98                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
99                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
100                            )
101                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
102                        }
103                        ?
104                    )
105                ;
106                builder = builder.set_target_throughput(var_7);
107            }
108            ,
109            s if s.matches("targetMultiAttachEnabled") /* TargetMultiAttachEnabled com.amazonaws.ec2#VolumeModification$TargetMultiAttachEnabled */ =>  {
110                let var_8 =
111                    Some(
112                         {
113                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
114                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
115                            )
116                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
117                        }
118                        ?
119                    )
120                ;
121                builder = builder.set_target_multi_attach_enabled(var_8);
122            }
123            ,
124            s if s.matches("originalSize") /* OriginalSize com.amazonaws.ec2#VolumeModification$OriginalSize */ =>  {
125                let var_9 =
126                    Some(
127                         {
128                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
129                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
130                            )
131                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
132                        }
133                        ?
134                    )
135                ;
136                builder = builder.set_original_size(var_9);
137            }
138            ,
139            s if s.matches("originalIops") /* OriginalIops com.amazonaws.ec2#VolumeModification$OriginalIops */ =>  {
140                let var_10 =
141                    Some(
142                         {
143                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
144                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
145                            )
146                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
147                        }
148                        ?
149                    )
150                ;
151                builder = builder.set_original_iops(var_10);
152            }
153            ,
154            s if s.matches("originalVolumeType") /* OriginalVolumeType com.amazonaws.ec2#VolumeModification$OriginalVolumeType */ =>  {
155                let var_11 =
156                    Some(
157                        Result::<crate::types::VolumeType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
158                            crate::types::VolumeType::from(
159                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
160                            )
161                        )
162                        ?
163                    )
164                ;
165                builder = builder.set_original_volume_type(var_11);
166            }
167            ,
168            s if s.matches("originalThroughput") /* OriginalThroughput com.amazonaws.ec2#VolumeModification$OriginalThroughput */ =>  {
169                let var_12 =
170                    Some(
171                         {
172                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
173                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
174                            )
175                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
176                        }
177                        ?
178                    )
179                ;
180                builder = builder.set_original_throughput(var_12);
181            }
182            ,
183            s if s.matches("originalMultiAttachEnabled") /* OriginalMultiAttachEnabled com.amazonaws.ec2#VolumeModification$OriginalMultiAttachEnabled */ =>  {
184                let var_13 =
185                    Some(
186                         {
187                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
188                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
189                            )
190                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
191                        }
192                        ?
193                    )
194                ;
195                builder = builder.set_original_multi_attach_enabled(var_13);
196            }
197            ,
198            s if s.matches("progress") /* Progress com.amazonaws.ec2#VolumeModification$Progress */ =>  {
199                let var_14 =
200                    Some(
201                         {
202                            <i64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
203                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
204                            )
205                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.ec2#Long`)"))
206                        }
207                        ?
208                    )
209                ;
210                builder = builder.set_progress(var_14);
211            }
212            ,
213            s if s.matches("startTime") /* StartTime com.amazonaws.ec2#VolumeModification$StartTime */ =>  {
214                let var_15 =
215                    Some(
216                        ::aws_smithy_types::DateTime::from_str(
217                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
218                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
219                        )
220                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
221                        ?
222                    )
223                ;
224                builder = builder.set_start_time(var_15);
225            }
226            ,
227            s if s.matches("endTime") /* EndTime com.amazonaws.ec2#VolumeModification$EndTime */ =>  {
228                let var_16 =
229                    Some(
230                        ::aws_smithy_types::DateTime::from_str(
231                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
232                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
233                        )
234                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
235                        ?
236                    )
237                ;
238                builder = builder.set_end_time(var_16);
239            }
240            ,
241            _ => {}
242        }
243    }
244    Ok(builder.build())
245}