aws_sdk_ec2/protocol_serde/
shape_transit_gateway.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_transit_gateway(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::TransitGateway, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::TransitGateway::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("transitGatewayId") => {
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_transit_gateway_id(var_1);
21 }
22 ,
23 s if s.matches("transitGatewayArn") => {
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_transit_gateway_arn(var_2);
34 }
35 ,
36 s if s.matches("state") => {
37 let var_3 =
38 Some(
39 Result::<crate::types::TransitGatewayState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40 crate::types::TransitGatewayState::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("ownerId") => {
51 let var_4 =
52 Some(
53 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
54 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
55 .into()
56 )
57 ?
58 )
59 ;
60 builder = builder.set_owner_id(var_4);
61 }
62 ,
63 s if s.matches("description") => {
64 let var_5 =
65 Some(
66 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
67 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
68 .into()
69 )
70 ?
71 )
72 ;
73 builder = builder.set_description(var_5);
74 }
75 ,
76 s if s.matches("creationTime") => {
77 let var_6 =
78 Some(
79 ::aws_smithy_types::DateTime::from_str(
80 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
81 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
82 )
83 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
84 ?
85 )
86 ;
87 builder = builder.set_creation_time(var_6);
88 }
89 ,
90 s if s.matches("options") => {
91 let var_7 =
92 Some(
93 crate::protocol_serde::shape_transit_gateway_options::de_transit_gateway_options(&mut tag)
94 ?
95 )
96 ;
97 builder = builder.set_options(var_7);
98 }
99 ,
100 s if s.matches("tagSet") => {
101 let var_8 =
102 Some(
103 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
104 ?
105 )
106 ;
107 builder = builder.set_tags(var_8);
108 }
109 ,
110 _ => {}
111 }
112 }
113 Ok(builder.build())
114}