pub(crate) fn de_destination_description<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::DestinationDescription>, ::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::DestinationDescriptionBuilder::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() {
"DestinationId" => {
builder = builder.set_destination_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"S3DestinationDescription" => {
builder = builder.set_s3_destination_description(
crate::protocol_serde::shape_s3_destination_description::de_s3_destination_description(tokens, _value)?,
);
}
"ExtendedS3DestinationDescription" => {
builder = builder.set_extended_s3_destination_description(
crate::protocol_serde::shape_extended_s3_destination_description::de_extended_s3_destination_description(
tokens, _value,
)?,
);
}
"RedshiftDestinationDescription" => {
builder = builder.set_redshift_destination_description(
crate::protocol_serde::shape_redshift_destination_description::de_redshift_destination_description(tokens, _value)?,
);
}
"ElasticsearchDestinationDescription" => {
builder = builder.set_elasticsearch_destination_description(
crate::protocol_serde::shape_elasticsearch_destination_description::de_elasticsearch_destination_description(
tokens, _value,
)?,
);
}
"AmazonopensearchserviceDestinationDescription" => {
builder = builder.set_amazonopensearchservice_destination_description(
crate::protocol_serde::shape_amazonopensearchservice_destination_description::de_amazonopensearchservice_destination_description(tokens, _value)?
);
}
"SplunkDestinationDescription" => {
builder = builder.set_splunk_destination_description(
crate::protocol_serde::shape_splunk_destination_description::de_splunk_destination_description(tokens, _value)?,
);
}
"HttpEndpointDestinationDescription" => {
builder = builder.set_http_endpoint_destination_description(
crate::protocol_serde::shape_http_endpoint_destination_description::de_http_endpoint_destination_description(
tokens, _value,
)?,
);
}
"SnowflakeDestinationDescription" => {
builder = builder.set_snowflake_destination_description(
crate::protocol_serde::shape_snowflake_destination_description::de_snowflake_destination_description(tokens, _value)?,
);
}
"AmazonOpenSearchServerlessDestinationDescription" => {
builder = builder.set_amazon_open_search_serverless_destination_description(
crate::protocol_serde::shape_amazon_open_search_serverless_destination_description::de_amazon_open_search_serverless_destination_description(tokens, _value)?
);
}
"IcebergDestinationDescription" => {
builder = builder.set_iceberg_destination_description(
crate::protocol_serde::shape_iceberg_destination_description::de_iceberg_destination_description(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::destination_description_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",
)),
}
}