aws-sdk-ec2 1.224.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_create_nat_gateway_input_input_input(
    input: &crate::operation::create_nat_gateway::CreateNatGatewayInput,
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
    let mut out = String::new();
    #[allow(unused_mut)]
    let mut writer = ::aws_smithy_query::QueryWriter::new(&mut out, "CreateNatGateway", "2016-11-15");
    #[allow(unused_mut)]
    let mut scope_1 = writer.prefix("AvailabilityMode");
    if let Some(var_2) = &input.availability_mode {
        scope_1.string(var_2.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_3 = writer.prefix("AllocationId");
    if let Some(var_4) = &input.allocation_id {
        scope_3.string(var_4);
    }
    #[allow(unused_mut)]
    let mut scope_5 = writer.prefix("ClientToken");
    if let Some(var_6) = &input.client_token {
        scope_5.string(var_6);
    }
    #[allow(unused_mut)]
    let mut scope_7 = writer.prefix("DryRun");
    if let Some(var_8) = &input.dry_run {
        scope_7.boolean(*var_8);
    }
    #[allow(unused_mut)]
    let mut scope_9 = writer.prefix("SubnetId");
    if let Some(var_10) = &input.subnet_id {
        scope_9.string(var_10);
    }
    #[allow(unused_mut)]
    let mut scope_11 = writer.prefix("VpcId");
    if let Some(var_12) = &input.vpc_id {
        scope_11.string(var_12);
    }
    #[allow(unused_mut)]
    let mut scope_13 = writer.prefix("AvailabilityZoneAddress");
    if let Some(var_14) = &input.availability_zone_addresses {
        if !var_14.is_empty() {
            let mut list_16 = scope_13.start_list(true, Some("AvailabilityZoneAddress"));
            for item_15 in var_14 {
                #[allow(unused_mut)]
                let mut entry_17 = list_16.entry();
                crate::protocol_serde::shape_availability_zone_address::ser_availability_zone_address(entry_17, item_15)?;
            }
            list_16.finish();
        }
    }
    #[allow(unused_mut)]
    let mut scope_18 = writer.prefix("TagSpecification");
    if let Some(var_19) = &input.tag_specifications {
        if !var_19.is_empty() {
            let mut list_21 = scope_18.start_list(true, Some("item"));
            for item_20 in var_19 {
                #[allow(unused_mut)]
                let mut entry_22 = list_21.entry();
                crate::protocol_serde::shape_tag_specification::ser_tag_specification(entry_22, item_20)?;
            }
            list_21.finish();
        }
    }
    #[allow(unused_mut)]
    let mut scope_23 = writer.prefix("ConnectivityType");
    if let Some(var_24) = &input.connectivity_type {
        scope_23.string(var_24.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_25 = writer.prefix("PrivateIpAddress");
    if let Some(var_26) = &input.private_ip_address {
        scope_25.string(var_26);
    }
    #[allow(unused_mut)]
    let mut scope_27 = writer.prefix("SecondaryAllocationId");
    if let Some(var_28) = &input.secondary_allocation_ids {
        if !var_28.is_empty() {
            let mut list_30 = scope_27.start_list(true, Some("AllocationId"));
            for item_29 in var_28 {
                #[allow(unused_mut)]
                let mut entry_31 = list_30.entry();
                entry_31.string(item_29);
            }
            list_30.finish();
        }
    }
    #[allow(unused_mut)]
    let mut scope_32 = writer.prefix("SecondaryPrivateIpAddress");
    if let Some(var_33) = &input.secondary_private_ip_addresses {
        if !var_33.is_empty() {
            let mut list_35 = scope_32.start_list(true, Some("item"));
            for item_34 in var_33 {
                #[allow(unused_mut)]
                let mut entry_36 = list_35.entry();
                entry_36.string(item_34);
            }
            list_35.finish();
        }
    }
    #[allow(unused_mut)]
    let mut scope_37 = writer.prefix("SecondaryPrivateIpAddressCount");
    if let Some(var_38) = &input.secondary_private_ip_address_count {
        scope_37.number(
            #[allow(clippy::useless_conversion)]
            ::aws_smithy_types::Number::NegInt((*var_38).into()),
        );
    }
    writer.finish();
    Ok(::aws_smithy_types::body::SdkBody::from(out))
}