Skip to main content

aws_sdk_glue/schema_serde/
shape_basic_authentication_properties.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static BASICAUTHENTICATIONPROPERTIES_MEMBER_USERNAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue#BasicAuthenticationProperties$Username",
5        "com.amazonaws.glue",
6        "BasicAuthenticationProperties",
7    ),
8    ::aws_smithy_schema::ShapeType::Structure,
9    "Username",
10    0,
11);
12static BASICAUTHENTICATIONPROPERTIES_MEMBER_PASSWORD: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#BasicAuthenticationProperties$Password",
15        "com.amazonaws.glue",
16        "BasicAuthenticationProperties",
17    ),
18    ::aws_smithy_schema::ShapeType::Structure,
19    "Password",
20    1,
21);
22static BASICAUTHENTICATIONPROPERTIES_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue#BasicAuthenticationProperties",
25        "com.amazonaws.glue",
26        "BasicAuthenticationProperties",
27    ),
28    ::aws_smithy_schema::ShapeType::Structure,
29    &[
30        &BASICAUTHENTICATIONPROPERTIES_MEMBER_USERNAME,
31        &BASICAUTHENTICATIONPROPERTIES_MEMBER_PASSWORD,
32    ],
33);
34impl crate::types::BasicAuthenticationProperties {
35    /// The schema for this shape.
36    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &BASICAUTHENTICATIONPROPERTIES_SCHEMA;
37}
38impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::BasicAuthenticationProperties {
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        if let Some(ref val) = self.username {
49            ser.write_struct(&BASICAUTHENTICATIONPROPERTIES_MEMBER_USERNAME, val)?;
50        }
51        if let Some(ref val) = self.password {
52            ser.write_struct(&BASICAUTHENTICATIONPROPERTIES_MEMBER_PASSWORD, val)?;
53        }
54        Ok(())
55    }
56}
57impl crate::types::builders::BasicAuthenticationPropertiesBuilder {
58    #[allow(
59        unused_variables,
60        unreachable_code,
61        clippy::single_match,
62        clippy::match_single_binding,
63        clippy::diverging_sub_expression
64    )]
65    pub(crate) fn deserialize_members(
66        &mut self,
67        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
68    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
69        deserializer.read_struct(&BASICAUTHENTICATIONPROPERTIES_SCHEMA, &mut |member, deser| {
70            match member.member_index() {
71                Some(0) => {
72                    if deser.is_null() {
73                        deser.read_null()?;
74                    } else {
75                        self.username = Some(crate::types::ConnectorProperty::deserialize(deser)?);
76                    }
77                }
78                Some(1) => {
79                    if deser.is_null() {
80                        deser.read_null()?;
81                    } else {
82                        self.password = Some(crate::types::ConnectorProperty::deserialize(deser)?);
83                    }
84                }
85                _ => {}
86            }
87            Ok(())
88        })
89    }
90}
91
92impl crate::types::BasicAuthenticationProperties {
93    /// Deserializes this structure from a [`ShapeDeserializer`].
94    pub fn deserialize(
95        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
96    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
97        let mut builder = Self::builder();
98        builder.deserialize_members(deserializer)?;
99        Ok(builder.build())
100    }
101}