aws_sdk_appflow/protocol_serde/
shape_glue_data_catalog_config.rs1pub fn ser_glue_data_catalog_config(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::GlueDataCatalogConfig,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 {
7 object.key("roleArn").string(input.role_arn.as_str());
8 }
9 {
10 object.key("databaseName").string(input.database_name.as_str());
11 }
12 {
13 object.key("tablePrefix").string(input.table_prefix.as_str());
14 }
15 Ok(())
16}
17
18pub(crate) fn de_glue_data_catalog_config<'a, I>(
19 tokens: &mut ::std::iter::Peekable<I>,
20 _value: &'a [u8],
21) -> ::std::result::Result<Option<crate::types::GlueDataCatalogConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
22where
23 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
24{
25 match tokens.next().transpose()? {
26 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
27 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
28 #[allow(unused_mut)]
29 let mut builder = crate::types::builders::GlueDataCatalogConfigBuilder::default();
30 loop {
31 match tokens.next().transpose()? {
32 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
33 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
34 "roleArn" => {
35 builder = builder.set_role_arn(
36 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
37 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
38 .transpose()?,
39 );
40 }
41 "databaseName" => {
42 builder = builder.set_database_name(
43 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
44 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
45 .transpose()?,
46 );
47 }
48 "tablePrefix" => {
49 builder = builder.set_table_prefix(
50 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
51 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
52 .transpose()?,
53 );
54 }
55 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
56 },
57 other => {
58 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
59 "expected object key or end object, found: {other:?}"
60 )))
61 }
62 }
63 }
64 Ok(Some(
65 crate::serde_util::glue_data_catalog_config_correct_errors(builder)
66 .build()
67 .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
68 ))
69 }
70 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
71 "expected start object or null",
72 )),
73 }
74}