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_eip_details(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::AwsEc2EipDetails,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.instance_id {
        object.key("InstanceId").string(var_1.as_str());
    }
    if let Some(var_2) = &input.public_ip {
        object.key("PublicIp").string(var_2.as_str());
    }
    if let Some(var_3) = &input.allocation_id {
        object.key("AllocationId").string(var_3.as_str());
    }
    if let Some(var_4) = &input.association_id {
        object.key("AssociationId").string(var_4.as_str());
    }
    if let Some(var_5) = &input.domain {
        object.key("Domain").string(var_5.as_str());
    }
    if let Some(var_6) = &input.public_ipv4_pool {
        object.key("PublicIpv4Pool").string(var_6.as_str());
    }
    if let Some(var_7) = &input.network_border_group {
        object.key("NetworkBorderGroup").string(var_7.as_str());
    }
    if let Some(var_8) = &input.network_interface_id {
        object.key("NetworkInterfaceId").string(var_8.as_str());
    }
    if let Some(var_9) = &input.network_interface_owner_id {
        object.key("NetworkInterfaceOwnerId").string(var_9.as_str());
    }
    if let Some(var_10) = &input.private_ip_address {
        object.key("PrivateIpAddress").string(var_10.as_str());
    }
    Ok(())
}

pub(crate) fn de_aws_ec2_eip_details<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::AwsEc2EipDetails>, ::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::AwsEc2EipDetailsBuilder::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() {
                        "InstanceId" => {
                            builder = builder.set_instance_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "PublicIp" => {
                            builder = builder.set_public_ip(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "AllocationId" => {
                            builder = builder.set_allocation_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "AssociationId" => {
                            builder = builder.set_association_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "Domain" => {
                            builder = builder.set_domain(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "PublicIpv4Pool" => {
                            builder = builder.set_public_ipv4_pool(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "NetworkBorderGroup" => {
                            builder = builder.set_network_border_group(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "NetworkInterfaceId" => {
                            builder = builder.set_network_interface_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "NetworkInterfaceOwnerId" => {
                            builder = builder.set_network_interface_owner_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "PrivateIpAddress" => {
                            builder = builder.set_private_ip_address(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        _ => ::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",
        )),
    }
}