pub fn ser_input_attachment(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::InputAttachment,
) -> Result<(), aws_smithy_http::operation::error::SerializationError> {
if let Some(var_1) = &input.automatic_input_failover_settings {
#[allow(unused_mut)]
let mut object_2 = object.key("automaticInputFailoverSettings").start_object();
crate::protocol_serde::shape_automatic_input_failover_settings::ser_automatic_input_failover_settings(&mut object_2, var_1)?;
object_2.finish();
}
if let Some(var_3) = &input.input_attachment_name {
object.key("inputAttachmentName").string(var_3.as_str());
}
if let Some(var_4) = &input.input_id {
object.key("inputId").string(var_4.as_str());
}
if let Some(var_5) = &input.input_settings {
#[allow(unused_mut)]
let mut object_6 = object.key("inputSettings").start_object();
crate::protocol_serde::shape_input_settings::ser_input_settings(&mut object_6, var_5)?;
object_6.finish();
}
Ok(())
}
pub(crate) fn de_input_attachment<'a, I>(
tokens: &mut std::iter::Peekable<I>,
) -> Result<
Option<crate::types::InputAttachment>,
aws_smithy_json::deserialize::error::DeserializeError,
>
where
I: Iterator<
Item = Result<
aws_smithy_json::deserialize::Token<'a>,
aws_smithy_json::deserialize::error::DeserializeError,
>,
>,
{
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::InputAttachmentBuilder::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() {
"automaticInputFailoverSettings" => {
builder = builder.set_automatic_input_failover_settings(
crate::protocol_serde::shape_automatic_input_failover_settings::de_automatic_input_failover_settings(tokens)?
);
}
"inputAttachmentName" => {
builder = builder.set_input_attachment_name(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"inputId" => {
builder = builder.set_input_id(
aws_smithy_json::deserialize::token::expect_string_or_null(
tokens.next(),
)?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"inputSettings" => {
builder = builder.set_input_settings(
crate::protocol_serde::shape_input_settings::de_input_settings(
tokens,
)?,
);
}
_ => 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",
),
),
}
}