Skip to main content

aws_sdk_glue/schema_serde/
shape_auth_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static AUTHCONFIGURATION_MEMBER_AUTHENTICATION_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue#AuthConfiguration$AuthenticationType",
5        "com.amazonaws.glue",
6        "AuthConfiguration",
7    ),
8    ::aws_smithy_schema::ShapeType::Structure,
9    "AuthenticationType",
10    0,
11);
12static AUTHCONFIGURATION_MEMBER_SECRET_ARN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#AuthConfiguration$SecretArn",
15        "com.amazonaws.glue",
16        "AuthConfiguration",
17    ),
18    ::aws_smithy_schema::ShapeType::Structure,
19    "SecretArn",
20    1,
21);
22static AUTHCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#PropertiesMap$key", "com.amazonaws.glue", "PropertiesMap"),
24    ::aws_smithy_schema::ShapeType::String,
25    "key",
26    0,
27);
28static AUTHCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
29    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#PropertiesMap$value", "com.amazonaws.glue", "PropertiesMap"),
30    ::aws_smithy_schema::ShapeType::Structure,
31    "value",
32    1,
33);
34static AUTHCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
35    ::aws_smithy_schema::ShapeId::from_parts(
36        "com.amazonaws.glue#AuthConfiguration$OAuth2Properties",
37        "com.amazonaws.glue",
38        "AuthConfiguration",
39    ),
40    ::aws_smithy_schema::ShapeType::Map,
41    "OAuth2Properties",
42    2,
43)
44.with_map_members(
45    &AUTHCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES_KEY,
46    &AUTHCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES_VALUE,
47);
48static AUTHCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
49    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#PropertiesMap$key", "com.amazonaws.glue", "PropertiesMap"),
50    ::aws_smithy_schema::ShapeType::String,
51    "key",
52    0,
53);
54static AUTHCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
55    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#PropertiesMap$value", "com.amazonaws.glue", "PropertiesMap"),
56    ::aws_smithy_schema::ShapeType::Structure,
57    "value",
58    1,
59);
60static AUTHCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
61    ::aws_smithy_schema::ShapeId::from_parts(
62        "com.amazonaws.glue#AuthConfiguration$BasicAuthenticationProperties",
63        "com.amazonaws.glue",
64        "AuthConfiguration",
65    ),
66    ::aws_smithy_schema::ShapeType::Map,
67    "BasicAuthenticationProperties",
68    3,
69)
70.with_map_members(
71    &AUTHCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES_KEY,
72    &AUTHCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES_VALUE,
73);
74static AUTHCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
75    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#PropertiesMap$key", "com.amazonaws.glue", "PropertiesMap"),
76    ::aws_smithy_schema::ShapeType::String,
77    "key",
78    0,
79);
80static AUTHCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES_VALUE: ::aws_smithy_schema::Schema<'static> =
81    ::aws_smithy_schema::Schema::new_member(
82        ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#PropertiesMap$value", "com.amazonaws.glue", "PropertiesMap"),
83        ::aws_smithy_schema::ShapeType::Structure,
84        "value",
85        1,
86    );
87static AUTHCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
88    ::aws_smithy_schema::ShapeId::from_parts(
89        "com.amazonaws.glue#AuthConfiguration$CustomAuthenticationProperties",
90        "com.amazonaws.glue",
91        "AuthConfiguration",
92    ),
93    ::aws_smithy_schema::ShapeType::Map,
94    "CustomAuthenticationProperties",
95    4,
96)
97.with_map_members(
98    &AUTHCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES_KEY,
99    &AUTHCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES_VALUE,
100);
101static AUTHCONFIGURATION_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
102    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#AuthConfiguration", "com.amazonaws.glue", "AuthConfiguration"),
103    ::aws_smithy_schema::ShapeType::Structure,
104    &[
105        &AUTHCONFIGURATION_MEMBER_AUTHENTICATION_TYPE,
106        &AUTHCONFIGURATION_MEMBER_SECRET_ARN,
107        &AUTHCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES,
108        &AUTHCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES,
109        &AUTHCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES,
110    ],
111);
112impl crate::types::AuthConfiguration {
113    /// The schema for this shape.
114    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &AUTHCONFIGURATION_SCHEMA;
115}
116impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::AuthConfiguration {
117    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
118        Self::SCHEMA
119    }
120
121    #[allow(unused_variables, clippy::diverging_sub_expression)]
122    fn serialize_members(
123        &self,
124        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
125    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
126        if let Some(ref val) = self.authentication_type {
127            ser.write_struct(&AUTHCONFIGURATION_MEMBER_AUTHENTICATION_TYPE, val)?;
128        }
129        if let Some(ref val) = self.secret_arn {
130            ser.write_struct(&AUTHCONFIGURATION_MEMBER_SECRET_ARN, val)?;
131        }
132        if let Some(ref val) = self.o_auth2_properties {
133            ser.write_map(
134                &AUTHCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES,
135                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
136                    for (key, value) in val {
137                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
138                        ser.write_struct(crate::types::Property::SCHEMA, value)?;
139                    }
140                    Ok(())
141                },
142            )?;
143        }
144        if let Some(ref val) = self.basic_authentication_properties {
145            ser.write_map(
146                &AUTHCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES,
147                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
148                    for (key, value) in val {
149                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
150                        ser.write_struct(crate::types::Property::SCHEMA, value)?;
151                    }
152                    Ok(())
153                },
154            )?;
155        }
156        if let Some(ref val) = self.custom_authentication_properties {
157            ser.write_map(
158                &AUTHCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES,
159                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
160                    for (key, value) in val {
161                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
162                        ser.write_struct(crate::types::Property::SCHEMA, value)?;
163                    }
164                    Ok(())
165                },
166            )?;
167        }
168        Ok(())
169    }
170}
171impl crate::types::builders::AuthConfigurationBuilder {
172    #[allow(
173        unused_variables,
174        unreachable_code,
175        clippy::single_match,
176        clippy::match_single_binding,
177        clippy::diverging_sub_expression
178    )]
179    pub(crate) fn deserialize_members(
180        &mut self,
181        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
182    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
183        deserializer.read_struct(&AUTHCONFIGURATION_SCHEMA, &mut |member, deser| {
184            match member.member_index() {
185                Some(0) => {
186                    if deser.is_null() {
187                        deser.read_null()?;
188                    } else {
189                        self.authentication_type = Some(crate::types::Property::deserialize(deser)?);
190                    }
191                }
192                Some(1) => {
193                    if deser.is_null() {
194                        deser.read_null()?;
195                    } else {
196                        self.secret_arn = Some(crate::types::Property::deserialize(deser)?);
197                    }
198                }
199                Some(2) => {
200                    if deser.is_null() {
201                        deser.read_null()?;
202                    } else {
203                        self.o_auth2_properties = Some({
204                            let mut container = std::collections::HashMap::new();
205                            deser.read_map(member, &mut |key, deser| {
206                                container.insert(key, crate::types::Property::deserialize(deser)?);
207                                Ok(())
208                            })?;
209                            container
210                        });
211                    }
212                }
213                Some(3) => {
214                    if deser.is_null() {
215                        deser.read_null()?;
216                    } else {
217                        self.basic_authentication_properties = Some({
218                            let mut container = std::collections::HashMap::new();
219                            deser.read_map(member, &mut |key, deser| {
220                                container.insert(key, crate::types::Property::deserialize(deser)?);
221                                Ok(())
222                            })?;
223                            container
224                        });
225                    }
226                }
227                Some(4) => {
228                    if deser.is_null() {
229                        deser.read_null()?;
230                    } else {
231                        self.custom_authentication_properties = Some({
232                            let mut container = std::collections::HashMap::new();
233                            deser.read_map(member, &mut |key, deser| {
234                                container.insert(key, crate::types::Property::deserialize(deser)?);
235                                Ok(())
236                            })?;
237                            container
238                        });
239                    }
240                }
241                _ => {}
242            }
243            Ok(())
244        })
245    }
246}
247
248impl crate::types::AuthConfiguration {
249    /// Deserializes this structure from a [`ShapeDeserializer`].
250    pub fn deserialize(
251        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
252    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
253        let mut builder = Self::builder();
254        builder.deserialize_members(deserializer)?;
255        Ok(builder.build())
256    }
257}