Skip to main content

aws_sdk_glue/schema_serde/
shape_connector_o_auth2_properties.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static CONNECTOROAUTH2PROPERTIES_MEMBER_O_AUTH2_GRANT_TYPE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
3    ::aws_smithy_schema::ShapeId::from_parts(
4        "com.amazonaws.glue#ConnectorOAuth2Properties$OAuth2GrantType",
5        "com.amazonaws.glue",
6        "ConnectorOAuth2Properties",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "OAuth2GrantType",
10    0,
11);
12static CONNECTOROAUTH2PROPERTIES_MEMBER_CLIENT_CREDENTIALS_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#ConnectorOAuth2Properties$ClientCredentialsProperties",
15        "com.amazonaws.glue",
16        "ConnectorOAuth2Properties",
17    ),
18    ::aws_smithy_schema::ShapeType::Structure,
19    "ClientCredentialsProperties",
20    1,
21);
22static CONNECTOROAUTH2PROPERTIES_MEMBER_JWT_BEARER_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue#ConnectorOAuth2Properties$JWTBearerProperties",
25        "com.amazonaws.glue",
26        "ConnectorOAuth2Properties",
27    ),
28    ::aws_smithy_schema::ShapeType::Structure,
29    "JWTBearerProperties",
30    2,
31);
32static CONNECTOROAUTH2PROPERTIES_MEMBER_AUTHORIZATION_CODE_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue#ConnectorOAuth2Properties$AuthorizationCodeProperties",
35        "com.amazonaws.glue",
36        "ConnectorOAuth2Properties",
37    ),
38    ::aws_smithy_schema::ShapeType::Structure,
39    "AuthorizationCodeProperties",
40    3,
41);
42static CONNECTOROAUTH2PROPERTIES_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
43    ::aws_smithy_schema::ShapeId::from_parts(
44        "com.amazonaws.glue#ConnectorOAuth2Properties",
45        "com.amazonaws.glue",
46        "ConnectorOAuth2Properties",
47    ),
48    ::aws_smithy_schema::ShapeType::Structure,
49    &[
50        &CONNECTOROAUTH2PROPERTIES_MEMBER_O_AUTH2_GRANT_TYPE,
51        &CONNECTOROAUTH2PROPERTIES_MEMBER_CLIENT_CREDENTIALS_PROPERTIES,
52        &CONNECTOROAUTH2PROPERTIES_MEMBER_JWT_BEARER_PROPERTIES,
53        &CONNECTOROAUTH2PROPERTIES_MEMBER_AUTHORIZATION_CODE_PROPERTIES,
54    ],
55);
56impl crate::types::ConnectorOAuth2Properties {
57    /// The schema for this shape.
58    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &CONNECTOROAUTH2PROPERTIES_SCHEMA;
59}
60impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::ConnectorOAuth2Properties {
61    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
62        Self::SCHEMA
63    }
64
65    #[allow(unused_variables, clippy::diverging_sub_expression)]
66    fn serialize_members(
67        &self,
68        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
69    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
70        {
71            let val = &self.o_auth2_grant_type;
72            ser.write_string(&CONNECTOROAUTH2PROPERTIES_MEMBER_O_AUTH2_GRANT_TYPE, val.as_str())?;
73        }
74        if let Some(ref val) = self.client_credentials_properties {
75            ser.write_struct(&CONNECTOROAUTH2PROPERTIES_MEMBER_CLIENT_CREDENTIALS_PROPERTIES, val)?;
76        }
77        if let Some(ref val) = self.jwt_bearer_properties {
78            ser.write_struct(&CONNECTOROAUTH2PROPERTIES_MEMBER_JWT_BEARER_PROPERTIES, val)?;
79        }
80        if let Some(ref val) = self.authorization_code_properties {
81            ser.write_struct(&CONNECTOROAUTH2PROPERTIES_MEMBER_AUTHORIZATION_CODE_PROPERTIES, val)?;
82        }
83        Ok(())
84    }
85}
86impl crate::types::builders::ConnectorOAuth2PropertiesBuilder {
87    #[allow(
88        unused_variables,
89        unreachable_code,
90        clippy::single_match,
91        clippy::match_single_binding,
92        clippy::diverging_sub_expression
93    )]
94    pub(crate) fn deserialize_members(
95        &mut self,
96        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
97    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
98        deserializer.read_struct(&CONNECTOROAUTH2PROPERTIES_SCHEMA, &mut |member, deser| {
99            match member.member_index() {
100                Some(0) => {
101                    self.o_auth2_grant_type = Some(crate::types::ConnectorOAuth2GrantType::from(deser.read_string(member)?.as_str()));
102                }
103                Some(1) => {
104                    if deser.is_null() {
105                        deser.read_null()?;
106                    } else {
107                        self.client_credentials_properties = Some(crate::types::ClientCredentialsProperties::deserialize(deser)?);
108                    }
109                }
110                Some(2) => {
111                    if deser.is_null() {
112                        deser.read_null()?;
113                    } else {
114                        self.jwt_bearer_properties = Some(crate::types::JwtBearerProperties::deserialize(deser)?);
115                    }
116                }
117                Some(3) => {
118                    if deser.is_null() {
119                        deser.read_null()?;
120                    } else {
121                        self.authorization_code_properties = Some(crate::types::ConnectorAuthorizationCodeProperties::deserialize(deser)?);
122                    }
123                }
124                _ => {}
125            }
126            Ok(())
127        })
128    }
129}
130
131impl crate::types::ConnectorOAuth2Properties {
132    /// Deserializes this structure from a [`ShapeDeserializer`].
133    pub fn deserialize(
134        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
135    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
136        let mut builder = Self::builder();
137        builder.deserialize_members(deserializer)?;
138        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
139    }
140}