Skip to main content

aws_sdk_glue/schema_serde/
shape_connector_authentication_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_AUTHENTICATION_TYPES_MEMBER: ::aws_smithy_schema::Schema<'static> =
3    ::aws_smithy_schema::Schema::new_member(
4        ::aws_smithy_schema::ShapeId::from_parts(
5            "com.amazonaws.glue#AuthenticationTypes$member",
6            "com.amazonaws.glue",
7            "AuthenticationTypes",
8        ),
9        ::aws_smithy_schema::ShapeType::String,
10        "member",
11        0,
12    );
13static CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_AUTHENTICATION_TYPES: ::aws_smithy_schema::Schema<'static> =
14    ::aws_smithy_schema::Schema::new_member(
15        ::aws_smithy_schema::ShapeId::from_parts(
16            "com.amazonaws.glue#ConnectorAuthenticationConfiguration$AuthenticationTypes",
17            "com.amazonaws.glue",
18            "ConnectorAuthenticationConfiguration",
19        ),
20        ::aws_smithy_schema::ShapeType::List,
21        "AuthenticationTypes",
22        0,
23    )
24    .with_list_member(&CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_AUTHENTICATION_TYPES_MEMBER);
25static CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
26    ::aws_smithy_schema::ShapeId::from_parts(
27        "com.amazonaws.glue#ConnectorAuthenticationConfiguration$OAuth2Properties",
28        "com.amazonaws.glue",
29        "ConnectorAuthenticationConfiguration",
30    ),
31    ::aws_smithy_schema::ShapeType::Structure,
32    "OAuth2Properties",
33    1,
34);
35static CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES: ::aws_smithy_schema::Schema<'static> =
36    ::aws_smithy_schema::Schema::new_member(
37        ::aws_smithy_schema::ShapeId::from_parts(
38            "com.amazonaws.glue#ConnectorAuthenticationConfiguration$BasicAuthenticationProperties",
39            "com.amazonaws.glue",
40            "ConnectorAuthenticationConfiguration",
41        ),
42        ::aws_smithy_schema::ShapeType::Structure,
43        "BasicAuthenticationProperties",
44        2,
45    );
46static CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES: ::aws_smithy_schema::Schema<'static> =
47    ::aws_smithy_schema::Schema::new_member(
48        ::aws_smithy_schema::ShapeId::from_parts(
49            "com.amazonaws.glue#ConnectorAuthenticationConfiguration$CustomAuthenticationProperties",
50            "com.amazonaws.glue",
51            "ConnectorAuthenticationConfiguration",
52        ),
53        ::aws_smithy_schema::ShapeType::Structure,
54        "CustomAuthenticationProperties",
55        3,
56    );
57static CONNECTORAUTHENTICATIONCONFIGURATION_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
58    ::aws_smithy_schema::ShapeId::from_parts(
59        "com.amazonaws.glue#ConnectorAuthenticationConfiguration",
60        "com.amazonaws.glue",
61        "ConnectorAuthenticationConfiguration",
62    ),
63    ::aws_smithy_schema::ShapeType::Structure,
64    &[
65        &CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_AUTHENTICATION_TYPES,
66        &CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES,
67        &CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES,
68        &CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES,
69    ],
70);
71impl crate::types::ConnectorAuthenticationConfiguration {
72    /// The schema for this shape.
73    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &CONNECTORAUTHENTICATIONCONFIGURATION_SCHEMA;
74}
75impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::ConnectorAuthenticationConfiguration {
76    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
77        Self::SCHEMA
78    }
79
80    #[allow(unused_variables, clippy::diverging_sub_expression)]
81    fn serialize_members(
82        &self,
83        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
84    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
85        {
86            let val = &self.authentication_types;
87
88            ser.write_list(
89                &CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_AUTHENTICATION_TYPES,
90                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
91                    for item in val {
92                        ser.write_string(&aws_smithy_schema::prelude::STRING, item.as_str())?;
93                    }
94                    Ok(())
95                },
96            )?;
97        }
98        if let Some(ref val) = self.o_auth2_properties {
99            ser.write_struct(&CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_O_AUTH2_PROPERTIES, val)?;
100        }
101        if let Some(ref val) = self.basic_authentication_properties {
102            ser.write_struct(&CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_BASIC_AUTHENTICATION_PROPERTIES, val)?;
103        }
104        if let Some(ref val) = self.custom_authentication_properties {
105            ser.write_struct(&CONNECTORAUTHENTICATIONCONFIGURATION_MEMBER_CUSTOM_AUTHENTICATION_PROPERTIES, val)?;
106        }
107        Ok(())
108    }
109}
110impl crate::types::builders::ConnectorAuthenticationConfigurationBuilder {
111    #[allow(
112        unused_variables,
113        unreachable_code,
114        clippy::single_match,
115        clippy::match_single_binding,
116        clippy::diverging_sub_expression
117    )]
118    pub(crate) fn deserialize_members(
119        &mut self,
120        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
121    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
122        deserializer.read_struct(&CONNECTORAUTHENTICATIONCONFIGURATION_SCHEMA, &mut |member, deser| {
123            match member.member_index() {
124                Some(0) => {
125                    self.authentication_types = Some({
126                        let mut container = Vec::new();
127                        deser.read_list(member, &mut |deser| {
128                            container.push(crate::types::AuthenticationType::from(
129                                deser.read_string(&::aws_smithy_schema::prelude::STRING)?.as_str(),
130                            ));
131                            Ok(())
132                        })?;
133                        container
134                    });
135                }
136                Some(1) => {
137                    if deser.is_null() {
138                        deser.read_null()?;
139                    } else {
140                        self.o_auth2_properties = Some(crate::types::ConnectorOAuth2Properties::deserialize(deser)?);
141                    }
142                }
143                Some(2) => {
144                    if deser.is_null() {
145                        deser.read_null()?;
146                    } else {
147                        self.basic_authentication_properties = Some(crate::types::BasicAuthenticationProperties::deserialize(deser)?);
148                    }
149                }
150                Some(3) => {
151                    if deser.is_null() {
152                        deser.read_null()?;
153                    } else {
154                        self.custom_authentication_properties = Some(crate::types::CustomAuthenticationProperties::deserialize(deser)?);
155                    }
156                }
157                _ => {}
158            }
159            Ok(())
160        })
161    }
162}
163
164impl crate::types::ConnectorAuthenticationConfiguration {
165    /// Deserializes this structure from a [`ShapeDeserializer`].
166    pub fn deserialize(
167        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
168    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
169        let mut builder = Self::builder();
170        builder.deserialize_members(deserializer)?;
171        builder.authentication_types = builder.authentication_types.or(Some(Vec::new()));
172        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
173    }
174}