pub fn ser_user_stack_association(
encoder: &mut ::aws_smithy_cbor::Encoder,
#[allow(unused)] input: &crate::types::UserStackAssociation,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
encoder.begin_map();
if let Some(var_1) = &input.stack_name {
encoder.str("StackName").str(var_1.as_str());
}
if let Some(var_2) = &input.user_name {
encoder.str("UserName").str(var_2.as_str());
}
if let Some(var_3) = &input.authentication_type {
encoder.str("AuthenticationType").str(var_3.as_str());
}
if let Some(var_4) = &input.send_email_notification {
encoder.str("SendEmailNotification").boolean(*var_4);
}
encoder.end();
Ok(())
}
pub(crate) fn de_user_stack_association(
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::UserStackAssociation, ::aws_smithy_cbor::decode::DeserializeError> {
if depth >= 128u32 {
return Err(::aws_smithy_cbor::decode::DeserializeError::custom(
"maximum nesting depth exceeded",
decoder.position(),
));
}
#[allow(clippy::match_single_binding, unused_variables)]
fn pair(
mut builder: crate::types::builders::UserStackAssociationBuilder,
decoder: &mut ::aws_smithy_cbor::Decoder,
depth: u32,
) -> ::std::result::Result<crate::types::builders::UserStackAssociationBuilder, ::aws_smithy_cbor::decode::DeserializeError> {
builder = match decoder.str()?.as_ref() {
"StackName" => builder.set_stack_name(Some(decoder.string()?)),
"UserName" => builder.set_user_name(Some(decoder.string()?)),
"AuthenticationType" => {
builder.set_authentication_type(Some(decoder.string().map(|s| crate::types::AuthenticationType::from(s.as_ref()))?))
}
"SendEmailNotification" => ::aws_smithy_cbor::decode::set_optional(builder, decoder, |builder, decoder| {
Ok(builder.set_send_email_notification(Some(decoder.boolean()?)))
})?,
_ => {
decoder.skip()?;
builder
}
};
Ok(builder)
}
let mut builder = crate::types::builders::UserStackAssociationBuilder::default();
match decoder.map()? {
None => loop {
match decoder.datatype()? {
::aws_smithy_cbor::data::Type::Break => {
decoder.skip()?;
break;
}
_ => {
builder = pair(builder, decoder, depth)?;
}
};
},
Some(n) => {
for _ in 0..n {
builder = pair(builder, decoder, depth)?;
}
}
};
#[allow(clippy::needless_question_mark)]
{
return Ok(crate::serde_util::user_stack_association_correct_errors(builder).build());
}
}