Skip to main content

aws_sdk_glue/schema_serde/
shape_o_auth2_properties_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2static OAUTH2PROPERTIESINPUT_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#OAuth2PropertiesInput$OAuth2GrantType",
5        "com.amazonaws.glue",
6        "OAuth2PropertiesInput",
7    ),
8    ::aws_smithy_schema::ShapeType::String,
9    "OAuth2GrantType",
10    0,
11);
12static OAUTH2PROPERTIESINPUT_MEMBER_O_AUTH2_CLIENT_APPLICATION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
13    ::aws_smithy_schema::ShapeId::from_parts(
14        "com.amazonaws.glue#OAuth2PropertiesInput$OAuth2ClientApplication",
15        "com.amazonaws.glue",
16        "OAuth2PropertiesInput",
17    ),
18    ::aws_smithy_schema::ShapeType::Structure,
19    "OAuth2ClientApplication",
20    1,
21);
22static OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.glue#OAuth2PropertiesInput$TokenUrl",
25        "com.amazonaws.glue",
26        "OAuth2PropertiesInput",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "TokenUrl",
30    2,
31);
32static OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL_PARAMETERS_MAP_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.glue#TokenUrlParametersMap$key",
35        "com.amazonaws.glue",
36        "TokenUrlParametersMap",
37    ),
38    ::aws_smithy_schema::ShapeType::String,
39    "key",
40    0,
41);
42static OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL_PARAMETERS_MAP_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
43    ::aws_smithy_schema::ShapeId::from_parts(
44        "com.amazonaws.glue#TokenUrlParametersMap$value",
45        "com.amazonaws.glue",
46        "TokenUrlParametersMap",
47    ),
48    ::aws_smithy_schema::ShapeType::String,
49    "value",
50    1,
51);
52static OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL_PARAMETERS_MAP: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
53    ::aws_smithy_schema::ShapeId::from_parts(
54        "com.amazonaws.glue#OAuth2PropertiesInput$TokenUrlParametersMap",
55        "com.amazonaws.glue",
56        "OAuth2PropertiesInput",
57    ),
58    ::aws_smithy_schema::ShapeType::Map,
59    "TokenUrlParametersMap",
60    3,
61)
62.with_map_members(
63    &OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL_PARAMETERS_MAP_KEY,
64    &OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL_PARAMETERS_MAP_VALUE,
65);
66static OAUTH2PROPERTIESINPUT_MEMBER_AUTHORIZATION_CODE_PROPERTIES: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
67    ::aws_smithy_schema::ShapeId::from_parts(
68        "com.amazonaws.glue#OAuth2PropertiesInput$AuthorizationCodeProperties",
69        "com.amazonaws.glue",
70        "OAuth2PropertiesInput",
71    ),
72    ::aws_smithy_schema::ShapeType::Structure,
73    "AuthorizationCodeProperties",
74    4,
75);
76static OAUTH2PROPERTIESINPUT_MEMBER_O_AUTH2_CREDENTIALS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
77    ::aws_smithy_schema::ShapeId::from_parts(
78        "com.amazonaws.glue#OAuth2PropertiesInput$OAuth2Credentials",
79        "com.amazonaws.glue",
80        "OAuth2PropertiesInput",
81    ),
82    ::aws_smithy_schema::ShapeType::Structure,
83    "OAuth2Credentials",
84    5,
85);
86static OAUTH2PROPERTIESINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
87    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.glue#OAuth2PropertiesInput", "com.amazonaws.glue", "OAuth2PropertiesInput"),
88    ::aws_smithy_schema::ShapeType::Structure,
89    &[
90        &OAUTH2PROPERTIESINPUT_MEMBER_O_AUTH2_GRANT_TYPE,
91        &OAUTH2PROPERTIESINPUT_MEMBER_O_AUTH2_CLIENT_APPLICATION,
92        &OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL,
93        &OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL_PARAMETERS_MAP,
94        &OAUTH2PROPERTIESINPUT_MEMBER_AUTHORIZATION_CODE_PROPERTIES,
95        &OAUTH2PROPERTIESINPUT_MEMBER_O_AUTH2_CREDENTIALS,
96    ],
97);
98impl crate::types::OAuth2PropertiesInput {
99    /// The schema for this shape.
100    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &OAUTH2PROPERTIESINPUT_SCHEMA;
101}
102impl ::aws_smithy_schema::serde::SerializableStruct for crate::types::OAuth2PropertiesInput {
103    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
104        Self::SCHEMA
105    }
106
107    #[allow(unused_variables, clippy::diverging_sub_expression)]
108    fn serialize_members(
109        &self,
110        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
111    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
112        if let Some(ref val) = self.o_auth2_grant_type {
113            ser.write_string(&OAUTH2PROPERTIESINPUT_MEMBER_O_AUTH2_GRANT_TYPE, val.as_str())?;
114        }
115        if let Some(ref val) = self.o_auth2_client_application {
116            ser.write_struct(&OAUTH2PROPERTIESINPUT_MEMBER_O_AUTH2_CLIENT_APPLICATION, val)?;
117        }
118        if let Some(ref val) = self.token_url {
119            ser.write_string(&OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL, val)?;
120        }
121        if let Some(ref val) = self.token_url_parameters_map {
122            ser.write_map(
123                &OAUTH2PROPERTIESINPUT_MEMBER_TOKEN_URL_PARAMETERS_MAP,
124                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
125                    for (key, value) in val {
126                        ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
127                        ser.write_string(&::aws_smithy_schema::prelude::STRING, value)?;
128                    }
129                    Ok(())
130                },
131            )?;
132        }
133        if let Some(ref val) = self.authorization_code_properties {
134            ser.write_struct(&OAUTH2PROPERTIESINPUT_MEMBER_AUTHORIZATION_CODE_PROPERTIES, val)?;
135        }
136        if let Some(ref val) = self.o_auth2_credentials {
137            ser.write_struct(&OAUTH2PROPERTIESINPUT_MEMBER_O_AUTH2_CREDENTIALS, val)?;
138        }
139        Ok(())
140    }
141}
142impl crate::types::builders::OAuth2PropertiesInputBuilder {
143    #[allow(
144        unused_variables,
145        unreachable_code,
146        clippy::single_match,
147        clippy::match_single_binding,
148        clippy::diverging_sub_expression
149    )]
150    pub(crate) fn deserialize_members(
151        &mut self,
152        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
153    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
154        deserializer.read_struct(&OAUTH2PROPERTIESINPUT_SCHEMA, &mut |member, deser| {
155            match member.member_index() {
156                Some(0) => {
157                    if deser.is_null() {
158                        deser.read_null()?;
159                    } else {
160                        self.o_auth2_grant_type = Some(crate::types::OAuth2GrantType::from(deser.read_string(member)?.as_str()));
161                    }
162                }
163                Some(1) => {
164                    if deser.is_null() {
165                        deser.read_null()?;
166                    } else {
167                        self.o_auth2_client_application = Some(crate::types::OAuth2ClientApplication::deserialize(deser)?);
168                    }
169                }
170                Some(2) => {
171                    if deser.is_null() {
172                        deser.read_null()?;
173                    } else {
174                        self.token_url = Some(deser.read_string(member)?);
175                    }
176                }
177                Some(3) => {
178                    if deser.is_null() {
179                        deser.read_null()?;
180                    } else {
181                        self.token_url_parameters_map = Some(deser.read_string_string_map(member)?);
182                    }
183                }
184                Some(4) => {
185                    if deser.is_null() {
186                        deser.read_null()?;
187                    } else {
188                        self.authorization_code_properties = Some(crate::types::AuthorizationCodeProperties::deserialize(deser)?);
189                    }
190                }
191                Some(5) => {
192                    if deser.is_null() {
193                        deser.read_null()?;
194                    } else {
195                        self.o_auth2_credentials = Some(crate::types::OAuth2Credentials::deserialize(deser)?);
196                    }
197                }
198                _ => {}
199            }
200            Ok(())
201        })
202    }
203}
204
205impl crate::types::OAuth2PropertiesInput {
206    /// Deserializes this structure from a [`ShapeDeserializer`].
207    pub fn deserialize(
208        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
209    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
210        let mut builder = Self::builder();
211        builder.deserialize_members(deserializer)?;
212        Ok(builder.build())
213    }
214}