aws-sdk-groundstation 1.65.0

AWS SDK for AWS Ground Station
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_endpoint_details(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::EndpointDetails,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.security_details {
        #[allow(unused_mut)]
        let mut object_2 = object.key("securityDetails").start_object();
        crate::protocol_serde::shape_security_details::ser_security_details(&mut object_2, var_1)?;
        object_2.finish();
    }
    if let Some(var_3) = &input.endpoint {
        #[allow(unused_mut)]
        let mut object_4 = object.key("endpoint").start_object();
        crate::protocol_serde::shape_dataflow_endpoint::ser_dataflow_endpoint(&mut object_4, var_3)?;
        object_4.finish();
    }
    if let Some(var_5) = &input.aws_ground_station_agent_endpoint {
        #[allow(unused_mut)]
        let mut object_6 = object.key("awsGroundStationAgentEndpoint").start_object();
        crate::protocol_serde::shape_aws_ground_station_agent_endpoint::ser_aws_ground_station_agent_endpoint(&mut object_6, var_5)?;
        object_6.finish();
    }
    if let Some(var_7) = &input.health_status {
        object.key("healthStatus").string(var_7.as_str());
    }
    if let Some(var_8) = &input.health_reasons {
        let mut array_9 = object.key("healthReasons").start_array();
        for item_10 in var_8 {
            {
                array_9.value().string(item_10.as_str());
            }
        }
        array_9.finish();
    }
    Ok(())
}

pub(crate) fn de_endpoint_details<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::EndpointDetails>, ::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::EndpointDetailsBuilder::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() {
                        "securityDetails" => {
                            builder = builder.set_security_details(crate::protocol_serde::shape_security_details::de_security_details(tokens)?);
                        }
                        "endpoint" => {
                            builder = builder.set_endpoint(crate::protocol_serde::shape_dataflow_endpoint::de_dataflow_endpoint(tokens)?);
                        }
                        "awsGroundStationAgentEndpoint" => {
                            builder = builder.set_aws_ground_station_agent_endpoint(
                                crate::protocol_serde::shape_aws_ground_station_agent_endpoint::de_aws_ground_station_agent_endpoint(tokens)?,
                            );
                        }
                        "healthStatus" => {
                            builder = builder.set_health_status(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| crate::types::CapabilityHealth::from(u.as_ref())))
                                    .transpose()?,
                            );
                        }
                        "healthReasons" => {
                            builder = builder.set_health_reasons(
                                crate::protocol_serde::shape_capability_health_reason_list::de_capability_health_reason_list(tokens)?,
                            );
                        }
                        _ => ::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(builder.build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}