aws_sdk_ec2/protocol_serde/
shape_bundle_task.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_bundle_task(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::BundleTask, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::BundleTask::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("instanceId") /* InstanceId com.amazonaws.ec2#BundleTask$InstanceId */ =>  {
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_instance_id(var_1);
21            }
22            ,
23            s if s.matches("bundleId") /* BundleId com.amazonaws.ec2#BundleTask$BundleId */ =>  {
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_bundle_id(var_2);
34            }
35            ,
36            s if s.matches("state") /* State com.amazonaws.ec2#BundleTask$State */ =>  {
37                let var_3 =
38                    Some(
39                        Result::<crate::types::BundleTaskState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40                            crate::types::BundleTaskState::from(
41                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            )
43                        )
44                        ?
45                    )
46                ;
47                builder = builder.set_state(var_3);
48            }
49            ,
50            s if s.matches("startTime") /* StartTime com.amazonaws.ec2#BundleTask$StartTime */ =>  {
51                let var_4 =
52                    Some(
53                        ::aws_smithy_types::DateTime::from_str(
54                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
56                        )
57                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
58                        ?
59                    )
60                ;
61                builder = builder.set_start_time(var_4);
62            }
63            ,
64            s if s.matches("updateTime") /* UpdateTime com.amazonaws.ec2#BundleTask$UpdateTime */ =>  {
65                let var_5 =
66                    Some(
67                        ::aws_smithy_types::DateTime::from_str(
68                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
69                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
70                        )
71                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
72                        ?
73                    )
74                ;
75                builder = builder.set_update_time(var_5);
76            }
77            ,
78            s if s.matches("storage") /* Storage com.amazonaws.ec2#BundleTask$Storage */ =>  {
79                let var_6 =
80                    Some(
81                        crate::protocol_serde::shape_storage::de_storage(&mut tag)
82                        ?
83                    )
84                ;
85                builder = builder.set_storage(var_6);
86            }
87            ,
88            s if s.matches("progress") /* Progress com.amazonaws.ec2#BundleTask$Progress */ =>  {
89                let var_7 =
90                    Some(
91                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
92                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
93                            .into()
94                        )
95                        ?
96                    )
97                ;
98                builder = builder.set_progress(var_7);
99            }
100            ,
101            s if s.matches("error") /* BundleTaskError com.amazonaws.ec2#BundleTask$BundleTaskError */ =>  {
102                let var_8 =
103                    Some(
104                        crate::protocol_serde::shape_bundle_task_error::de_bundle_task_error(&mut tag)
105                        ?
106                    )
107                ;
108                builder = builder.set_bundle_task_error(var_8);
109            }
110            ,
111            _ => {}
112        }
113    }
114    Ok(builder.build())
115}