Skip to main content

aws_sdk_glue/schema_serde/
shape_custom_authentication_properties.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static CUSTOMAUTHENTICATIONPROPERTIES_MEMBER_AUTHENTICATION_PARAMETERS_MEMBER: ::aws_smithy_schema::Schema<'static> =
3    ::aws_smithy_schema::Schema::new_member(
4        ::aws_smithy_schema::ShapeId::from_parts(
5            "com.amazonaws.glue#ConnectorPropertyList$member",
6            "com.amazonaws.glue",
7            "ConnectorPropertyList",
8        ),
9        ::aws_smithy_schema::ShapeType::Structure,
10        "member",
11        0,
12    );
13static CUSTOMAUTHENTICATIONPROPERTIES_MEMBER_AUTHENTICATION_PARAMETERS: ::aws_smithy_schema::Schema<'static> =
14    ::aws_smithy_schema::Schema::new_member(
15        ::aws_smithy_schema::ShapeId::from_parts(
16            "com.amazonaws.glue#CustomAuthenticationProperties$AuthenticationParameters",
17            "com.amazonaws.glue",
18            "CustomAuthenticationProperties",
19        ),
20        ::aws_smithy_schema::ShapeType::List,
21        "AuthenticationParameters",
22        0,
23    )
24    .with_list_member(&CUSTOMAUTHENTICATIONPROPERTIES_MEMBER_AUTHENTICATION_PARAMETERS_MEMBER);
25static CUSTOMAUTHENTICATIONPROPERTIES_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
26    ::aws_smithy_schema::ShapeId::from_parts(
27        "com.amazonaws.glue#CustomAuthenticationProperties",
28        "com.amazonaws.glue",
29        "CustomAuthenticationProperties",
30    ),
31    ::aws_smithy_schema::ShapeType::Structure,
32    &[&CUSTOMAUTHENTICATIONPROPERTIES_MEMBER_AUTHENTICATION_PARAMETERS],
33);
34impl crate::types::CustomAuthenticationProperties {
35    /// The schema for this shape.
36    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &CUSTOMAUTHENTICATIONPROPERTIES_SCHEMA;
37}
38impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::CustomAuthenticationProperties {
39    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
40        Self::SCHEMA
41    }
42
43    #[allow(unused_variables, clippy::diverging_sub_expression)]
44    fn serialize_members(
45        &self,
46        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
47    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
48        {
49            let val = &self.authentication_parameters;
50
51            ser.write_list(
52                &CUSTOMAUTHENTICATIONPROPERTIES_MEMBER_AUTHENTICATION_PARAMETERS,
53                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
54                    for item in val {
55                        ser.write_struct(crate::types::ConnectorProperty::SCHEMA, item)?;
56                    }
57                    Ok(())
58                },
59            )?;
60        }
61        Ok(())
62    }
63}
64impl crate::types::builders::CustomAuthenticationPropertiesBuilder {
65    #[allow(
66        unused_variables,
67        unreachable_code,
68        clippy::single_match,
69        clippy::match_single_binding,
70        clippy::diverging_sub_expression
71    )]
72    pub(crate) fn deserialize_members(
73        &mut self,
74        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
75    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
76        deserializer.read_struct(&CUSTOMAUTHENTICATIONPROPERTIES_SCHEMA, &mut |member, deser| {
77            match member.member_index() {
78                Some(0) => {
79                    self.authentication_parameters = Some({
80                        let mut container = Vec::new();
81                        deser.read_list(member, &mut |deser| {
82                            container.push(crate::types::ConnectorProperty::deserialize(deser)?);
83                            Ok(())
84                        })?;
85                        container
86                    });
87                }
88                _ => {}
89            }
90            Ok(())
91        })
92    }
93}
94
95impl crate::types::CustomAuthenticationProperties {
96    /// Deserializes this structure from a [`ShapeDeserializer`].
97    pub fn deserialize(
98        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
99    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
100        let mut builder = Self::builder();
101        builder.deserialize_members(deserializer)?;
102        builder.authentication_parameters = builder.authentication_parameters.or(Some(Vec::new()));
103        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
104    }
105}