aws-sdk-groundstation 0.27.0

AWS SDK for AWS Ground Station
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_config_details<'a, I>(
    tokens: &mut std::iter::Peekable<I>,
) -> Result<
    Option<crate::types::ConfigDetails>,
    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 variant.is_some() {
                        return Err(
                            aws_smithy_json::deserialize::error::DeserializeError::custom(
                                "encountered mixed variants in union",
                            ),
                        );
                    }
                    variant = match key.to_unescaped()?.as_ref() {
                            "endpointDetails" => {
                                Some(crate::types::ConfigDetails::EndpointDetails(
                                    crate::protocol_serde::shape_endpoint_details::de_endpoint_details(tokens)?
                                    .ok_or_else(|| aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'endpointDetails' cannot be null"))?
                                ))
                            }
                            "antennaDemodDecodeDetails" => {
                                Some(crate::types::ConfigDetails::AntennaDemodDecodeDetails(
                                    crate::protocol_serde::shape_antenna_demod_decode_details::de_antenna_demod_decode_details(tokens)?
                                    .ok_or_else(|| aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'antennaDemodDecodeDetails' cannot be null"))?
                                ))
                            }
                            "s3RecordingDetails" => {
                                Some(crate::types::ConfigDetails::S3RecordingDetails(
                                    crate::protocol_serde::shape_s3_recording_details::de_s3_recording_details(tokens)?
                                    .ok_or_else(|| aws_smithy_json::deserialize::error::DeserializeError::custom("value for 's3RecordingDetails' cannot be null"))?
                                ))
                            }
                            _ => {
                                                                      aws_smithy_json::deserialize::token::skip_value(tokens)?;
                                                                      Some(crate::types::ConfigDetails::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",
                ),
            )
        }
    }
    Ok(variant)
}