aws_sdk_ec2/protocol_serde/
shape_locked_snapshots_info.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_locked_snapshots_info(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::LockedSnapshotsInfo, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::LockedSnapshotsInfo::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("ownerId") /* OwnerId com.amazonaws.ec2#LockedSnapshotsInfo$OwnerId */ =>  {
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_owner_id(var_1);
21            }
22            ,
23            s if s.matches("snapshotId") /* SnapshotId com.amazonaws.ec2#LockedSnapshotsInfo$SnapshotId */ =>  {
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_snapshot_id(var_2);
34            }
35            ,
36            s if s.matches("lockState") /* LockState com.amazonaws.ec2#LockedSnapshotsInfo$LockState */ =>  {
37                let var_3 =
38                    Some(
39                        Result::<crate::types::LockState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40                            crate::types::LockState::from(
41                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
42                            )
43                        )
44                        ?
45                    )
46                ;
47                builder = builder.set_lock_state(var_3);
48            }
49            ,
50            s if s.matches("lockDuration") /* LockDuration com.amazonaws.ec2#LockedSnapshotsInfo$LockDuration */ =>  {
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#RetentionPeriodResponseDays`)"))
58                        }
59                        ?
60                    )
61                ;
62                builder = builder.set_lock_duration(var_4);
63            }
64            ,
65            s if s.matches("coolOffPeriod") /* CoolOffPeriod com.amazonaws.ec2#LockedSnapshotsInfo$CoolOffPeriod */ =>  {
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#CoolOffPeriodResponseHours`)"))
73                        }
74                        ?
75                    )
76                ;
77                builder = builder.set_cool_off_period(var_5);
78            }
79            ,
80            s if s.matches("coolOffPeriodExpiresOn") /* CoolOffPeriodExpiresOn com.amazonaws.ec2#LockedSnapshotsInfo$CoolOffPeriodExpiresOn */ =>  {
81                let var_6 =
82                    Some(
83                        ::aws_smithy_types::DateTime::from_str(
84                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
85                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
86                        )
87                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
88                        ?
89                    )
90                ;
91                builder = builder.set_cool_off_period_expires_on(var_6);
92            }
93            ,
94            s if s.matches("lockCreatedOn") /* LockCreatedOn com.amazonaws.ec2#LockedSnapshotsInfo$LockCreatedOn */ =>  {
95                let var_7 =
96                    Some(
97                        ::aws_smithy_types::DateTime::from_str(
98                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
99                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
100                        )
101                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
102                        ?
103                    )
104                ;
105                builder = builder.set_lock_created_on(var_7);
106            }
107            ,
108            s if s.matches("lockDurationStartTime") /* LockDurationStartTime com.amazonaws.ec2#LockedSnapshotsInfo$LockDurationStartTime */ =>  {
109                let var_8 =
110                    Some(
111                        ::aws_smithy_types::DateTime::from_str(
112                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
113                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
114                        )
115                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
116                        ?
117                    )
118                ;
119                builder = builder.set_lock_duration_start_time(var_8);
120            }
121            ,
122            s if s.matches("lockExpiresOn") /* LockExpiresOn com.amazonaws.ec2#LockedSnapshotsInfo$LockExpiresOn */ =>  {
123                let var_9 =
124                    Some(
125                        ::aws_smithy_types::DateTime::from_str(
126                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
127                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
128                        )
129                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
130                        ?
131                    )
132                ;
133                builder = builder.set_lock_expires_on(var_9);
134            }
135            ,
136            _ => {}
137        }
138    }
139    Ok(builder.build())
140}