aws_sdk_ec2/protocol_serde/
shape_vpc.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_vpc(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::Vpc, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::Vpc::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#Vpc$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("instanceTenancy") /* InstanceTenancy com.amazonaws.ec2#Vpc$InstanceTenancy */ =>  {
24                let var_2 =
25                    Some(
26                        Result::<crate::types::Tenancy, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
27                            crate::types::Tenancy::from(
28                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
29                            )
30                        )
31                        ?
32                    )
33                ;
34                builder = builder.set_instance_tenancy(var_2);
35            }
36            ,
37            s if s.matches("ipv6CidrBlockAssociationSet") /* Ipv6CidrBlockAssociationSet com.amazonaws.ec2#Vpc$Ipv6CidrBlockAssociationSet */ =>  {
38                let var_3 =
39                    Some(
40                        crate::protocol_serde::shape_vpc_ipv6_cidr_block_association_set::de_vpc_ipv6_cidr_block_association_set(&mut tag)
41                        ?
42                    )
43                ;
44                builder = builder.set_ipv6_cidr_block_association_set(var_3);
45            }
46            ,
47            s if s.matches("cidrBlockAssociationSet") /* CidrBlockAssociationSet com.amazonaws.ec2#Vpc$CidrBlockAssociationSet */ =>  {
48                let var_4 =
49                    Some(
50                        crate::protocol_serde::shape_vpc_cidr_block_association_set::de_vpc_cidr_block_association_set(&mut tag)
51                        ?
52                    )
53                ;
54                builder = builder.set_cidr_block_association_set(var_4);
55            }
56            ,
57            s if s.matches("isDefault") /* IsDefault com.amazonaws.ec2#Vpc$IsDefault */ =>  {
58                let var_5 =
59                    Some(
60                         {
61                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
62                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
63                            )
64                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
65                        }
66                        ?
67                    )
68                ;
69                builder = builder.set_is_default(var_5);
70            }
71            ,
72            s if s.matches("encryptionControl") /* EncryptionControl com.amazonaws.ec2#Vpc$EncryptionControl */ =>  {
73                let var_6 =
74                    Some(
75                        crate::protocol_serde::shape_vpc_encryption_control::de_vpc_encryption_control(&mut tag)
76                        ?
77                    )
78                ;
79                builder = builder.set_encryption_control(var_6);
80            }
81            ,
82            s if s.matches("tagSet") /* Tags com.amazonaws.ec2#Vpc$Tags */ =>  {
83                let var_7 =
84                    Some(
85                        crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
86                        ?
87                    )
88                ;
89                builder = builder.set_tags(var_7);
90            }
91            ,
92            s if s.matches("blockPublicAccessStates") /* BlockPublicAccessStates com.amazonaws.ec2#Vpc$BlockPublicAccessStates */ =>  {
93                let var_8 =
94                    Some(
95                        crate::protocol_serde::shape_block_public_access_states::de_block_public_access_states(&mut tag)
96                        ?
97                    )
98                ;
99                builder = builder.set_block_public_access_states(var_8);
100            }
101            ,
102            s if s.matches("vpcId") /* VpcId com.amazonaws.ec2#Vpc$VpcId */ =>  {
103                let var_9 =
104                    Some(
105                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
106                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
107                            .into()
108                        )
109                        ?
110                    )
111                ;
112                builder = builder.set_vpc_id(var_9);
113            }
114            ,
115            s if s.matches("state") /* State com.amazonaws.ec2#Vpc$State */ =>  {
116                let var_10 =
117                    Some(
118                        Result::<crate::types::VpcState, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
119                            crate::types::VpcState::from(
120                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
121                            )
122                        )
123                        ?
124                    )
125                ;
126                builder = builder.set_state(var_10);
127            }
128            ,
129            s if s.matches("cidrBlock") /* CidrBlock com.amazonaws.ec2#Vpc$CidrBlock */ =>  {
130                let var_11 =
131                    Some(
132                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
133                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
134                            .into()
135                        )
136                        ?
137                    )
138                ;
139                builder = builder.set_cidr_block(var_11);
140            }
141            ,
142            s if s.matches("dhcpOptionsId") /* DhcpOptionsId com.amazonaws.ec2#Vpc$DhcpOptionsId */ =>  {
143                let var_12 =
144                    Some(
145                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
146                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
147                            .into()
148                        )
149                        ?
150                    )
151                ;
152                builder = builder.set_dhcp_options_id(var_12);
153            }
154            ,
155            _ => {}
156        }
157    }
158    Ok(builder.build())
159}