pub(crate) fn de_connection_properties_output<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::ConnectionPropertiesOutput>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
let mut variant = None;
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
tokens.peek()
{
let _ = tokens.next().expect("peek returned a token")?;
continue;
}
let key = key.to_unescaped()?;
if key == "__type" {
::aws_smithy_json::deserialize::token::skip_value(tokens)?;
continue;
}
if variant.is_some() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"encountered mixed variants in union",
));
}
variant = match key.as_ref() {
"athenaProperties" => Some(crate::types::ConnectionPropertiesOutput::AthenaProperties(
crate::protocol_serde::shape_athena_properties_output::de_athena_properties_output(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'athenaProperties' cannot be null")
})?,
)),
"glueProperties" => Some(crate::types::ConnectionPropertiesOutput::GlueProperties(
crate::protocol_serde::shape_glue_properties_output::de_glue_properties_output(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'glueProperties' cannot be null")
})?,
)),
"hyperPodProperties" => Some(crate::types::ConnectionPropertiesOutput::HyperPodProperties(
crate::protocol_serde::shape_hyper_pod_properties_output::de_hyper_pod_properties_output(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'hyperPodProperties' cannot be null"),
)?,
)),
"iamProperties" => Some(crate::types::ConnectionPropertiesOutput::IamProperties(
crate::protocol_serde::shape_iam_properties_output::de_iam_properties_output(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'iamProperties' cannot be null")
})?,
)),
"redshiftProperties" => Some(crate::types::ConnectionPropertiesOutput::RedshiftProperties(
crate::protocol_serde::shape_redshift_properties_output::de_redshift_properties_output(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'redshiftProperties' cannot be null"),
)?,
)),
"sparkEmrProperties" => Some(crate::types::ConnectionPropertiesOutput::SparkEmrProperties(
crate::protocol_serde::shape_spark_emr_properties_output::de_spark_emr_properties_output(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'sparkEmrProperties' cannot be null"),
)?,
)),
"sparkGlueProperties" => Some(crate::types::ConnectionPropertiesOutput::SparkGlueProperties(
crate::protocol_serde::shape_spark_glue_properties_output::de_spark_glue_properties_output(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'sparkGlueProperties' cannot be null"),
)?,
)),
"s3Properties" => Some(crate::types::ConnectionPropertiesOutput::S3Properties(
crate::protocol_serde::shape_s3_properties_output::de_s3_properties_output(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 's3Properties' cannot be null")
})?,
)),
"amazonQProperties" => Some(crate::types::ConnectionPropertiesOutput::AmazonQProperties(
crate::protocol_serde::shape_amazon_q_properties_output::de_amazon_q_properties_output(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'amazonQProperties' cannot be null"),
)?,
)),
"mlflowProperties" => Some(crate::types::ConnectionPropertiesOutput::MlflowProperties(
crate::protocol_serde::shape_mlflow_properties_output::de_mlflow_properties_output(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'mlflowProperties' cannot be null")
})?,
)),
"workflowsMwaaProperties" => Some(crate::types::ConnectionPropertiesOutput::WorkflowsMwaaProperties(
crate::protocol_serde::shape_workflows_mwaa_properties_output::de_workflows_mwaa_properties_output(tokens, _value)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom(
"value for 'workflowsMwaaProperties' cannot be null",
)
})?,
)),
"workflowsServerlessProperties" => Some(crate::types::ConnectionPropertiesOutput::WorkflowsServerlessProperties(
crate::protocol_serde::shape_workflows_serverless_properties_output::de_workflows_serverless_properties_output(
tokens, _value,
)?
.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom(
"value for 'workflowsServerlessProperties' cannot be null",
)
})?,
)),
"lakehouseProperties" => Some(crate::types::ConnectionPropertiesOutput::LakehouseProperties(
crate::protocol_serde::shape_lakehouse_properties_output::de_lakehouse_properties_output(tokens, _value)?.ok_or_else(
|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'lakehouseProperties' cannot be null"),
)?,
)),
"vpcProperties" => Some(crate::types::ConnectionPropertiesOutput::VpcProperties(
crate::protocol_serde::shape_vpc_properties_output::de_vpc_properties_output(tokens, _value)?.ok_or_else(|| {
::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'vpcProperties' cannot be null")
})?,
)),
_ => {
::aws_smithy_json::deserialize::token::skip_value(tokens)?;
Some(crate::types::ConnectionPropertiesOutput::Unknown)
}
};
}
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {other:?}"
)))
}
}
},
_ => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
))
}
}
if variant.is_none() {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"Union did not contain a valid variant.",
));
}
Ok(variant)
}