aws_sdk_ec2/protocol_serde/
shape_create_nat_gateway_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_create_nat_gateway_input_input_input(
3    input: &crate::operation::create_nat_gateway::CreateNatGatewayInput,
4) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
5    let mut out = String::new();
6    #[allow(unused_mut)]
7    let mut writer = ::aws_smithy_query::QueryWriter::new(&mut out, "CreateNatGateway", "2016-11-15");
8    #[allow(unused_mut)]
9    let mut scope_1 = writer.prefix("AllocationId");
10    if let Some(var_2) = &input.allocation_id {
11        scope_1.string(var_2);
12    }
13    #[allow(unused_mut)]
14    let mut scope_3 = writer.prefix("ClientToken");
15    if let Some(var_4) = &input.client_token {
16        scope_3.string(var_4);
17    }
18    #[allow(unused_mut)]
19    let mut scope_5 = writer.prefix("DryRun");
20    if let Some(var_6) = &input.dry_run {
21        scope_5.boolean(*var_6);
22    }
23    #[allow(unused_mut)]
24    let mut scope_7 = writer.prefix("SubnetId");
25    if let Some(var_8) = &input.subnet_id {
26        scope_7.string(var_8);
27    }
28    #[allow(unused_mut)]
29    let mut scope_9 = writer.prefix("TagSpecification");
30    if let Some(var_10) = &input.tag_specifications {
31        if !var_10.is_empty() {
32            let mut list_12 = scope_9.start_list(true, Some("item"));
33            for item_11 in var_10 {
34                #[allow(unused_mut)]
35                let mut entry_13 = list_12.entry();
36                crate::protocol_serde::shape_tag_specification::ser_tag_specification(entry_13, item_11)?;
37            }
38            list_12.finish();
39        }
40    }
41    #[allow(unused_mut)]
42    let mut scope_14 = writer.prefix("ConnectivityType");
43    if let Some(var_15) = &input.connectivity_type {
44        scope_14.string(var_15.as_str());
45    }
46    #[allow(unused_mut)]
47    let mut scope_16 = writer.prefix("PrivateIpAddress");
48    if let Some(var_17) = &input.private_ip_address {
49        scope_16.string(var_17);
50    }
51    #[allow(unused_mut)]
52    let mut scope_18 = writer.prefix("SecondaryAllocationId");
53    if let Some(var_19) = &input.secondary_allocation_ids {
54        if !var_19.is_empty() {
55            let mut list_21 = scope_18.start_list(true, Some("AllocationId"));
56            for item_20 in var_19 {
57                #[allow(unused_mut)]
58                let mut entry_22 = list_21.entry();
59                entry_22.string(item_20);
60            }
61            list_21.finish();
62        }
63    }
64    #[allow(unused_mut)]
65    let mut scope_23 = writer.prefix("SecondaryPrivateIpAddress");
66    if let Some(var_24) = &input.secondary_private_ip_addresses {
67        if !var_24.is_empty() {
68            let mut list_26 = scope_23.start_list(true, Some("item"));
69            for item_25 in var_24 {
70                #[allow(unused_mut)]
71                let mut entry_27 = list_26.entry();
72                entry_27.string(item_25);
73            }
74            list_26.finish();
75        }
76    }
77    #[allow(unused_mut)]
78    let mut scope_28 = writer.prefix("SecondaryPrivateIpAddressCount");
79    if let Some(var_29) = &input.secondary_private_ip_address_count {
80        scope_28.number(
81            #[allow(clippy::useless_conversion)]
82            ::aws_smithy_types::Number::NegInt((*var_29).into()),
83        );
84    }
85    writer.finish();
86    Ok(::aws_smithy_types::body::SdkBody::from(out))
87}