aws_sdk_redshift/protocol_serde/
shape_endpoint_authorization.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::needless_question_mark)]
3pub fn de_endpoint_authorization(
4    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::EndpointAuthorization, ::aws_smithy_xml::decode::XmlDecodeError> {
6    #[allow(unused_mut)]
7    let mut builder = crate::types::EndpointAuthorization::builder();
8    while let Some(mut tag) = decoder.next_tag() {
9        match tag.start_el() {
10            s if s.matches("Grantor") /* Grantor com.amazonaws.redshift#EndpointAuthorization$Grantor */ =>  {
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_grantor(var_1);
21            }
22            ,
23            s if s.matches("Grantee") /* Grantee com.amazonaws.redshift#EndpointAuthorization$Grantee */ =>  {
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_grantee(var_2);
34            }
35            ,
36            s if s.matches("ClusterIdentifier") /* ClusterIdentifier com.amazonaws.redshift#EndpointAuthorization$ClusterIdentifier */ =>  {
37                let var_3 =
38                    Some(
39                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
40                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
41                            .into()
42                        )
43                        ?
44                    )
45                ;
46                builder = builder.set_cluster_identifier(var_3);
47            }
48            ,
49            s if s.matches("AuthorizeTime") /* AuthorizeTime com.amazonaws.redshift#EndpointAuthorization$AuthorizeTime */ =>  {
50                let var_4 =
51                    Some(
52                        ::aws_smithy_types::DateTime::from_str(
53                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
54                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
55                        )
56                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.redshift#TStamp`)"))
57                        ?
58                    )
59                ;
60                builder = builder.set_authorize_time(var_4);
61            }
62            ,
63            s if s.matches("ClusterStatus") /* ClusterStatus com.amazonaws.redshift#EndpointAuthorization$ClusterStatus */ =>  {
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_cluster_status(var_5);
74            }
75            ,
76            s if s.matches("Status") /* Status com.amazonaws.redshift#EndpointAuthorization$Status */ =>  {
77                let var_6 =
78                    Some(
79                        Result::<crate::types::AuthorizationStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
80                            crate::types::AuthorizationStatus::from(
81                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
82                            )
83                        )
84                        ?
85                    )
86                ;
87                builder = builder.set_status(var_6);
88            }
89            ,
90            s if s.matches("AllowedAllVPCs") /* AllowedAllVPCs com.amazonaws.redshift#EndpointAuthorization$AllowedAllVPCs */ =>  {
91                let var_7 =
92                    Some(
93                         {
94                            <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
95                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
96                            )
97                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.redshift#Boolean`)"))
98                        }
99                        ?
100                    )
101                ;
102                builder = builder.set_allowed_all_vpcs(var_7);
103            }
104            ,
105            s if s.matches("AllowedVPCs") /* AllowedVPCs com.amazonaws.redshift#EndpointAuthorization$AllowedVPCs */ =>  {
106                let var_8 =
107                    Some(
108                        crate::protocol_serde::shape_vpc_identifier_list::de_vpc_identifier_list(&mut tag)
109                        ?
110                    )
111                ;
112                builder = builder.set_allowed_vpcs(var_8);
113            }
114            ,
115            s if s.matches("EndpointCount") /* EndpointCount com.amazonaws.redshift#EndpointAuthorization$EndpointCount */ =>  {
116                let var_9 =
117                    Some(
118                         {
119                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
120                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
121                            )
122                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.redshift#Integer`)"))
123                        }
124                        ?
125                    )
126                ;
127                builder = builder.set_endpoint_count(var_9);
128            }
129            ,
130            _ => {}
131        }
132    }
133    Ok(builder.build())
134}