aws-sdk-securityhub 1.109.0

AWS SDK for AWS SecurityHub
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_aws_ec2_client_vpn_endpoint_details(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::AwsEc2ClientVpnEndpointDetails,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.client_vpn_endpoint_id {
        object.key("ClientVpnEndpointId").string(var_1.as_str());
    }
    if let Some(var_2) = &input.description {
        object.key("Description").string(var_2.as_str());
    }
    if let Some(var_3) = &input.client_cidr_block {
        object.key("ClientCidrBlock").string(var_3.as_str());
    }
    if let Some(var_4) = &input.dns_server {
        let mut array_5 = object.key("DnsServer").start_array();
        for item_6 in var_4 {
            {
                array_5.value().string(item_6.as_str());
            }
        }
        array_5.finish();
    }
    if let Some(var_7) = &input.split_tunnel {
        object.key("SplitTunnel").boolean(*var_7);
    }
    if let Some(var_8) = &input.transport_protocol {
        object.key("TransportProtocol").string(var_8.as_str());
    }
    if let Some(var_9) = &input.vpn_port {
        object.key("VpnPort").number(
            #[allow(clippy::useless_conversion)]
            ::aws_smithy_types::Number::NegInt((*var_9).into()),
        );
    }
    if let Some(var_10) = &input.server_certificate_arn {
        object.key("ServerCertificateArn").string(var_10.as_str());
    }
    if let Some(var_11) = &input.authentication_options {
        let mut array_12 = object.key("AuthenticationOptions").start_array();
        for item_13 in var_11 {
            {
                #[allow(unused_mut)]
                let mut object_14 = array_12.value().start_object();
                crate::protocol_serde::shape_aws_ec2_client_vpn_endpoint_authentication_options_details::ser_aws_ec2_client_vpn_endpoint_authentication_options_details(&mut object_14, item_13)?;
                object_14.finish();
            }
        }
        array_12.finish();
    }
    if let Some(var_15) = &input.connection_log_options {
        #[allow(unused_mut)]
        let mut object_16 = object.key("ConnectionLogOptions").start_object();
        crate::protocol_serde::shape_aws_ec2_client_vpn_endpoint_connection_log_options_details::ser_aws_ec2_client_vpn_endpoint_connection_log_options_details(&mut object_16, var_15)?;
        object_16.finish();
    }
    if let Some(var_17) = &input.security_group_id_set {
        let mut array_18 = object.key("SecurityGroupIdSet").start_array();
        for item_19 in var_17 {
            {
                array_18.value().string(item_19.as_str());
            }
        }
        array_18.finish();
    }
    if let Some(var_20) = &input.vpc_id {
        object.key("VpcId").string(var_20.as_str());
    }
    if let Some(var_21) = &input.self_service_portal_url {
        object.key("SelfServicePortalUrl").string(var_21.as_str());
    }
    if let Some(var_22) = &input.client_connect_options {
        #[allow(unused_mut)]
        let mut object_23 = object.key("ClientConnectOptions").start_object();
        crate::protocol_serde::shape_aws_ec2_client_vpn_endpoint_client_connect_options_details::ser_aws_ec2_client_vpn_endpoint_client_connect_options_details(&mut object_23, var_22)?;
        object_23.finish();
    }
    if let Some(var_24) = &input.session_timeout_hours {
        object.key("SessionTimeoutHours").number(
            #[allow(clippy::useless_conversion)]
            ::aws_smithy_types::Number::NegInt((*var_24).into()),
        );
    }
    if let Some(var_25) = &input.client_login_banner_options {
        #[allow(unused_mut)]
        let mut object_26 = object.key("ClientLoginBannerOptions").start_object();
        crate::protocol_serde::shape_aws_ec2_client_vpn_endpoint_client_login_banner_options_details::ser_aws_ec2_client_vpn_endpoint_client_login_banner_options_details(&mut object_26, var_25)?;
        object_26.finish();
    }
    Ok(())
}

pub(crate) fn de_aws_ec2_client_vpn_endpoint_details<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::AwsEc2ClientVpnEndpointDetails>, ::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::AwsEc2ClientVpnEndpointDetailsBuilder::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() {
                        "ClientVpnEndpointId" => {
                            builder = builder.set_client_vpn_endpoint_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "Description" => {
                            builder = builder.set_description(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "ClientCidrBlock" => {
                            builder = builder.set_client_cidr_block(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "DnsServer" => {
                            builder = builder.set_dns_server(crate::protocol_serde::shape_string_list::de_string_list(tokens, _value)?);
                        }
                        "SplitTunnel" => {
                            builder = builder.set_split_tunnel(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "TransportProtocol" => {
                            builder = builder.set_transport_protocol(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "VpnPort" => {
                            builder = builder.set_vpn_port(
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
                                    .map(i32::try_from)
                                    .transpose()?,
                            );
                        }
                        "ServerCertificateArn" => {
                            builder = builder.set_server_certificate_arn(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "AuthenticationOptions" => {
                            builder = builder.set_authentication_options(
                                    crate::protocol_serde::shape_aws_ec2_client_vpn_endpoint_authentication_options_list::de_aws_ec2_client_vpn_endpoint_authentication_options_list(tokens, _value)?
                                );
                        }
                        "ConnectionLogOptions" => {
                            builder = builder.set_connection_log_options(
                                    crate::protocol_serde::shape_aws_ec2_client_vpn_endpoint_connection_log_options_details::de_aws_ec2_client_vpn_endpoint_connection_log_options_details(tokens, _value)?
                                );
                        }
                        "SecurityGroupIdSet" => {
                            builder = builder.set_security_group_id_set(crate::protocol_serde::shape_string_list::de_string_list(tokens, _value)?);
                        }
                        "VpcId" => {
                            builder = builder.set_vpc_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "SelfServicePortalUrl" => {
                            builder = builder.set_self_service_portal_url(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "ClientConnectOptions" => {
                            builder = builder.set_client_connect_options(
                                    crate::protocol_serde::shape_aws_ec2_client_vpn_endpoint_client_connect_options_details::de_aws_ec2_client_vpn_endpoint_client_connect_options_details(tokens, _value)?
                                );
                        }
                        "SessionTimeoutHours" => {
                            builder = builder.set_session_timeout_hours(
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
                                    .map(i32::try_from)
                                    .transpose()?,
                            );
                        }
                        "ClientLoginBannerOptions" => {
                            builder = builder.set_client_login_banner_options(
                                    crate::protocol_serde::shape_aws_ec2_client_vpn_endpoint_client_login_banner_options_details::de_aws_ec2_client_vpn_endpoint_client_login_banner_options_details(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(builder.build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}