aws_sdk_ec2/protocol_serde/
shape_nat_gateway.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_nat_gateway(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::NatGateway, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::NatGateway::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("createTime") => {
11 let var_1 =
12 Some(
13 ::aws_smithy_types::DateTime::from_str(
14 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
15 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
16 )
17 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
18 ?
19 )
20 ;
21 builder = builder.set_create_time(var_1);
22 }
23 ,
24 s if s.matches("deleteTime") => {
25 let var_2 =
26 Some(
27 ::aws_smithy_types::DateTime::from_str(
28 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
30 )
31 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
32 ?
33 )
34 ;
35 builder = builder.set_delete_time(var_2);
36 }
37 ,
38 s if s.matches("failureCode") => {
39 let var_3 =
40 Some(
41 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
42 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
43 .into()
44 )
45 ?
46 )
47 ;
48 builder = builder.set_failure_code(var_3);
49 }
50 ,
51 s if s.matches("failureMessage") => {
52 let var_4 =
53 Some(
54 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
55 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
56 .into()
57 )
58 ?
59 )
60 ;
61 builder = builder.set_failure_message(var_4);
62 }
63 ,
64 s if s.matches("natGatewayAddressSet") => {
65 let var_5 =
66 Some(
67 crate::protocol_serde::shape_nat_gateway_address_list::de_nat_gateway_address_list(&mut tag)
68 ?
69 )
70 ;
71 builder = builder.set_nat_gateway_addresses(var_5);
72 }
73 ,
74 s if s.matches("natGatewayId") => {
75 let var_6 =
76 Some(
77 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
78 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
79 .into()
80 )
81 ?
82 )
83 ;
84 builder = builder.set_nat_gateway_id(var_6);
85 }
86 ,
87 s if s.matches("provisionedBandwidth") => {
88 let var_7 =
89 Some(
90 crate::protocol_serde::shape_provisioned_bandwidth::de_provisioned_bandwidth(&mut tag)
91 ?
92 )
93 ;
94 builder = builder.set_provisioned_bandwidth(var_7);
95 }
96 ,
97 s if s.matches("state") => {
98 let var_8 =
99 Some(
100 Result::<crate::types::NatGatewayState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
101 crate::types::NatGatewayState::from(
102 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
103 )
104 )
105 ?
106 )
107 ;
108 builder = builder.set_state(var_8);
109 }
110 ,
111 s if s.matches("subnetId") => {
112 let var_9 =
113 Some(
114 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
115 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
116 .into()
117 )
118 ?
119 )
120 ;
121 builder = builder.set_subnet_id(var_9);
122 }
123 ,
124 s if s.matches("vpcId") => {
125 let var_10 =
126 Some(
127 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
128 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
129 .into()
130 )
131 ?
132 )
133 ;
134 builder = builder.set_vpc_id(var_10);
135 }
136 ,
137 s if s.matches("tagSet") => {
138 let var_11 =
139 Some(
140 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
141 ?
142 )
143 ;
144 builder = builder.set_tags(var_11);
145 }
146 ,
147 s if s.matches("connectivityType") => {
148 let var_12 =
149 Some(
150 Result::<crate::types::ConnectivityType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
151 crate::types::ConnectivityType::from(
152 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
153 )
154 )
155 ?
156 )
157 ;
158 builder = builder.set_connectivity_type(var_12);
159 }
160 ,
161 _ => {}
162 }
163 }
164 Ok(builder.build())
165}