pub fn ser_srt_caller_router_output_configuration(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::SrtCallerRouterOutputConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
object.key("destinationAddress").string(input.destination_address.as_str());
}
{
object.key("destinationPort").number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((input.destination_port).into()),
);
}
{
object.key("minimumLatencyMilliseconds").number(
#[allow(clippy::useless_conversion)]
::aws_smithy_types::Number::NegInt((input.minimum_latency_milliseconds).into()),
);
}
if let Some(var_1) = &input.stream_id {
object.key("streamId").string(var_1.as_str());
}
if let Some(var_2) = &input.encryption_configuration {
#[allow(unused_mut)]
let mut object_3 = object.key("encryptionConfiguration").start_object();
crate::protocol_serde::shape_srt_encryption_configuration::ser_srt_encryption_configuration(&mut object_3, var_2)?;
object_3.finish();
}
Ok(())
}
pub(crate) fn de_srt_caller_router_output_configuration<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::SrtCallerRouterOutputConfiguration>, ::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::SrtCallerRouterOutputConfigurationBuilder::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() {
"destinationAddress" => {
builder = builder.set_destination_address(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"destinationPort" => {
builder = builder.set_destination_port(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"minimumLatencyMilliseconds" => {
builder = builder.set_minimum_latency_milliseconds(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i64::try_from)
.transpose()?,
);
}
"streamId" => {
builder = builder.set_stream_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"encryptionConfiguration" => {
builder = builder.set_encryption_configuration(
crate::protocol_serde::shape_srt_encryption_configuration::de_srt_encryption_configuration(tokens, _value)?,
);
}
_ => ::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(
crate::serde_util::srt_caller_router_output_configuration_correct_errors(builder)
.build()
.map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}