pub(crate) fn de_rcs_agent_information<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::RcsAgentInformation>, ::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::RcsAgentInformationBuilder::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() {
"RcsAgentArn" => {
builder = builder.set_rcs_agent_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"RcsAgentId" => {
builder = builder.set_rcs_agent_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Status" => {
builder = builder.set_status(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::RcsAgentStatus::from(u.as_ref())))
.transpose()?,
);
}
"CreatedTimestamp" => {
builder = builder.set_created_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"DeletionProtectionEnabled" => {
builder =
builder.set_deletion_protection_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"OptOutListName" => {
builder = builder.set_opt_out_list_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"SelfManagedOptOutsEnabled" => {
builder =
builder.set_self_managed_opt_outs_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"TwoWayChannelArn" => {
builder = builder.set_two_way_channel_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"TwoWayChannelRole" => {
builder = builder.set_two_way_channel_role(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"TwoWayEnabled" => {
builder = builder.set_two_way_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"PoolId" => {
builder = builder.set_pool_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"TwoWayMediaS3BucketName" => {
builder = builder.set_two_way_media_s3_bucket_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"TwoWayMediaS3KeyPrefix" => {
builder = builder.set_two_way_media_s3_key_prefix(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"TwoWayMediaS3Role" => {
builder = builder.set_two_way_media_s3_role(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"TwoWayRcsEventsEnabled" => {
builder = builder.set_two_way_rcs_events_enabled(
crate::protocol_serde::shape_rcs_event_type_list::de_rcs_event_type_list(tokens, _value, depth + 1)?,
);
}
"TestingAgent" => {
builder = builder.set_testing_agent(
crate::protocol_serde::shape_testing_agent_information::de_testing_agent_information(tokens, _value, depth + 1)?,
);
}
"MessagingLimits" => {
builder = builder.set_messaging_limits(crate::protocol_serde::shape_messaging_limits::de_messaging_limits(
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(crate::serde_util::rcs_agent_information_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",
)),
}
}