aws_sdk_ec2/protocol_serde/
shape_volume.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(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::Volume, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::Volume::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("availabilityZoneId") /* AvailabilityZoneId com.amazonaws.ec2#Volume$AvailabilityZoneId */ =>  {
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_availability_zone_id(var_1);
21            }
22            ,
23            s if s.matches("outpostArn") /* OutpostArn com.amazonaws.ec2#Volume$OutpostArn */ =>  {
24                let var_2 =
25                    Some(
26                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
28                            .into()
29                        )
30                        ?
31                    )
32                ;
33                builder = builder.set_outpost_arn(var_2);
34            }
35            ,
36            s if s.matches("iops") /* Iops com.amazonaws.ec2#Volume$Iops */ =>  {
37                let var_3 =
38                    Some(
39                         {
40                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
41                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            )
43                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
44                        }
45                        ?
46                    )
47                ;
48                builder = builder.set_iops(var_3);
49            }
50            ,
51            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#Volume$Tags */ =>  {
52                let var_4 =
53                    Some(
54                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
55                        ?
56                    )
57                ;
58                builder = builder.set_tags(var_4);
59            }
60            ,
61            s if s.matches("volumeType") /* VolumeType com.amazonaws.ec2#Volume$VolumeType */ =>  {
62                let var_5 =
63                    Some(
64                        Result::<crate::types::VolumeType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
65                            crate::types::VolumeType::from(
66                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
67                            )
68                        )
69                        ?
70                    )
71                ;
72                builder = builder.set_volume_type(var_5);
73            }
74            ,
75            s if s.matches("fastRestored") /* FastRestored com.amazonaws.ec2#Volume$FastRestored */ =>  {
76                let var_6 =
77                    Some(
78                         {
79                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
80                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
81                            )
82                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
83                        }
84                        ?
85                    )
86                ;
87                builder = builder.set_fast_restored(var_6);
88            }
89            ,
90            s if s.matches("multiAttachEnabled") /* MultiAttachEnabled com.amazonaws.ec2#Volume$MultiAttachEnabled */ =>  {
91                let var_7 =
92                    Some(
93                         {
94                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
95                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
96                            )
97                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
98                        }
99                        ?
100                    )
101                ;
102                builder = builder.set_multi_attach_enabled(var_7);
103            }
104            ,
105            s if s.matches("throughput") /* Throughput com.amazonaws.ec2#Volume$Throughput */ =>  {
106                let var_8 =
107                    Some(
108                         {
109                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
110                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
111                            )
112                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
113                        }
114                        ?
115                    )
116                ;
117                builder = builder.set_throughput(var_8);
118            }
119            ,
120            s if s.matches("sseType") /* SseType com.amazonaws.ec2#Volume$SseType */ =>  {
121                let var_9 =
122                    Some(
123                        Result::<crate::types::SseType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
124                            crate::types::SseType::from(
125                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
126                            )
127                        )
128                        ?
129                    )
130                ;
131                builder = builder.set_sse_type(var_9);
132            }
133            ,
134            s if s.matches("operator") /* Operator com.amazonaws.ec2#Volume$Operator */ =>  {
135                let var_10 =
136                    Some(
137                        crate::protocol_serde::shape_operator_response::de_operator_response(&mut tag)
138                        ?
139                    )
140                ;
141                builder = builder.set_operator(var_10);
142            }
143            ,
144            s if s.matches("volumeInitializationRate") /* VolumeInitializationRate com.amazonaws.ec2#Volume$VolumeInitializationRate */ =>  {
145                let var_11 =
146                    Some(
147                         {
148                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
149                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
150                            )
151                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
152                        }
153                        ?
154                    )
155                ;
156                builder = builder.set_volume_initialization_rate(var_11);
157            }
158            ,
159            s if s.matches("volumeId") /* VolumeId com.amazonaws.ec2#Volume$VolumeId */ =>  {
160                let var_12 =
161                    Some(
162                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
163                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
164                            .into()
165                        )
166                        ?
167                    )
168                ;
169                builder = builder.set_volume_id(var_12);
170            }
171            ,
172            s if s.matches("size") /* Size com.amazonaws.ec2#Volume$Size */ =>  {
173                let var_13 =
174                    Some(
175                         {
176                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
177                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
178                            )
179                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
180                        }
181                        ?
182                    )
183                ;
184                builder = builder.set_size(var_13);
185            }
186            ,
187            s if s.matches("snapshotId") /* SnapshotId com.amazonaws.ec2#Volume$SnapshotId */ =>  {
188                let var_14 =
189                    Some(
190                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
191                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
192                            .into()
193                        )
194                        ?
195                    )
196                ;
197                builder = builder.set_snapshot_id(var_14);
198            }
199            ,
200            s if s.matches("availabilityZone") /* AvailabilityZone com.amazonaws.ec2#Volume$AvailabilityZone */ =>  {
201                let var_15 =
202                    Some(
203                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
204                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
205                            .into()
206                        )
207                        ?
208                    )
209                ;
210                builder = builder.set_availability_zone(var_15);
211            }
212            ,
213            s if s.matches("status") /* State com.amazonaws.ec2#Volume$State */ =>  {
214                let var_16 =
215                    Some(
216                        Result::<crate::types::VolumeState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
217                            crate::types::VolumeState::from(
218                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
219                            )
220                        )
221                        ?
222                    )
223                ;
224                builder = builder.set_state(var_16);
225            }
226            ,
227            s if s.matches("createTime") /* CreateTime com.amazonaws.ec2#Volume$CreateTime */ =>  {
228                let var_17 =
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_create_time(var_17);
239            }
240            ,
241            s if s.matches("attachmentSet") /* Attachments com.amazonaws.ec2#Volume$Attachments */ =>  {
242                let var_18 =
243                    Some(
244                        crate::protocol_serde::shape_volume_attachment_list::de_volume_attachment_list(&mut tag)
245                        ?
246                    )
247                ;
248                builder = builder.set_attachments(var_18);
249            }
250            ,
251            s if s.matches("encrypted") /* Encrypted com.amazonaws.ec2#Volume$Encrypted */ =>  {
252                let var_19 =
253                    Some(
254                         {
255                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
256                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
257                            )
258                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
259                        }
260                        ?
261                    )
262                ;
263                builder = builder.set_encrypted(var_19);
264            }
265            ,
266            s if s.matches("kmsKeyId") /* KmsKeyId com.amazonaws.ec2#Volume$KmsKeyId */ =>  {
267                let var_20 =
268                    Some(
269                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
270                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
271                            .into()
272                        )
273                        ?
274                    )
275                ;
276                builder = builder.set_kms_key_id(var_20);
277            }
278            ,
279            _ => {}
280        }
281    }
282    Ok(builder.build())
283}