pub fn ser_kafka_cluster_client_authentication(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::KafkaClusterClientAuthentication,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
if let Some(var_1) = &input.sasl_scram {
#[allow(unused_mut)]
let mut object_2 = object.key("saslScram").start_object();
crate::protocol_serde::shape_kafka_cluster_sasl_scram_authentication::ser_kafka_cluster_sasl_scram_authentication(&mut object_2, var_1)?;
object_2.finish();
}
if let Some(var_3) = &input.mtls {
#[allow(unused_mut)]
let mut object_4 = object.key("mTLS").start_object();
crate::protocol_serde::shape_kafka_cluster_mtls_authentication::ser_kafka_cluster_mtls_authentication(&mut object_4, var_3)?;
object_4.finish();
}
if let Some(var_5) = &input.sasl_o_auth_bearer {
#[allow(unused_mut)]
let mut object_6 = object.key("saslOAuthBearer").start_object();
crate::protocol_serde::shape_kafka_cluster_sasl_o_auth_bearer_authentication::ser_kafka_cluster_sasl_o_auth_bearer_authentication(
&mut object_6,
var_5,
)?;
object_6.finish();
}
Ok(())
}
pub(crate) fn de_kafka_cluster_client_authentication<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::KafkaClusterClientAuthentication>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
if depth >= 128u32 {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"maximum nesting depth exceeded",
));
}
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::KafkaClusterClientAuthenticationBuilder::default();
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"saslScram" => {
builder = builder.set_sasl_scram(
crate::protocol_serde::shape_kafka_cluster_sasl_scram_authentication::de_kafka_cluster_sasl_scram_authentication(
tokens,
_value,
depth + 1,
)?,
);
}
"mTLS" => {
builder = builder.set_mtls(
crate::protocol_serde::shape_kafka_cluster_mtls_authentication::de_kafka_cluster_mtls_authentication(
tokens,
_value,
depth + 1,
)?,
);
}
"saslOAuthBearer" => {
builder = builder.set_sasl_o_auth_bearer(
crate::protocol_serde::shape_kafka_cluster_sasl_o_auth_bearer_authentication::de_kafka_cluster_sasl_o_auth_bearer_authentication(tokens, _value, depth + 1)?
);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {other:?}"
)))
}
}
}
Ok(Some(builder.build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}