aws_sdk_ec2/protocol_serde/
shape_create_network_interface_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_create_network_interface_input_input_input(
3    input: &crate::operation::create_network_interface::CreateNetworkInterfaceInput,
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, "CreateNetworkInterface", "2016-11-15");
8    #[allow(unused_mut)]
9    let mut scope_1 = writer.prefix("Ipv4Prefix");
10    if let Some(var_2) = &input.ipv4_prefixes {
11        if !var_2.is_empty() {
12            let mut list_4 = scope_1.start_list(true, Some("item"));
13            for item_3 in var_2 {
14                #[allow(unused_mut)]
15                let mut entry_5 = list_4.entry();
16                crate::protocol_serde::shape_ipv4_prefix_specification_request::ser_ipv4_prefix_specification_request(entry_5, item_3)?;
17            }
18            list_4.finish();
19        }
20    }
21    #[allow(unused_mut)]
22    let mut scope_6 = writer.prefix("Ipv4PrefixCount");
23    if let Some(var_7) = &input.ipv4_prefix_count {
24        scope_6.number(
25            #[allow(clippy::useless_conversion)]
26            ::aws_smithy_types::Number::NegInt((*var_7).into()),
27        );
28    }
29    #[allow(unused_mut)]
30    let mut scope_8 = writer.prefix("Ipv6Prefix");
31    if let Some(var_9) = &input.ipv6_prefixes {
32        if !var_9.is_empty() {
33            let mut list_11 = scope_8.start_list(true, Some("item"));
34            for item_10 in var_9 {
35                #[allow(unused_mut)]
36                let mut entry_12 = list_11.entry();
37                crate::protocol_serde::shape_ipv6_prefix_specification_request::ser_ipv6_prefix_specification_request(entry_12, item_10)?;
38            }
39            list_11.finish();
40        }
41    }
42    #[allow(unused_mut)]
43    let mut scope_13 = writer.prefix("Ipv6PrefixCount");
44    if let Some(var_14) = &input.ipv6_prefix_count {
45        scope_13.number(
46            #[allow(clippy::useless_conversion)]
47            ::aws_smithy_types::Number::NegInt((*var_14).into()),
48        );
49    }
50    #[allow(unused_mut)]
51    let mut scope_15 = writer.prefix("InterfaceType");
52    if let Some(var_16) = &input.interface_type {
53        scope_15.string(var_16.as_str());
54    }
55    #[allow(unused_mut)]
56    let mut scope_17 = writer.prefix("TagSpecification");
57    if let Some(var_18) = &input.tag_specifications {
58        if !var_18.is_empty() {
59            let mut list_20 = scope_17.start_list(true, Some("item"));
60            for item_19 in var_18 {
61                #[allow(unused_mut)]
62                let mut entry_21 = list_20.entry();
63                crate::protocol_serde::shape_tag_specification::ser_tag_specification(entry_21, item_19)?;
64            }
65            list_20.finish();
66        }
67    }
68    #[allow(unused_mut)]
69    let mut scope_22 = writer.prefix("ClientToken");
70    if let Some(var_23) = &input.client_token {
71        scope_22.string(var_23);
72    }
73    #[allow(unused_mut)]
74    let mut scope_24 = writer.prefix("EnablePrimaryIpv6");
75    if let Some(var_25) = &input.enable_primary_ipv6 {
76        scope_24.boolean(*var_25);
77    }
78    #[allow(unused_mut)]
79    let mut scope_26 = writer.prefix("ConnectionTrackingSpecification");
80    if let Some(var_27) = &input.connection_tracking_specification {
81        crate::protocol_serde::shape_connection_tracking_specification_request::ser_connection_tracking_specification_request(scope_26, var_27)?;
82    }
83    #[allow(unused_mut)]
84    let mut scope_28 = writer.prefix("Operator");
85    if let Some(var_29) = &input.operator {
86        crate::protocol_serde::shape_operator_request::ser_operator_request(scope_28, var_29)?;
87    }
88    #[allow(unused_mut)]
89    let mut scope_30 = writer.prefix("SubnetId");
90    if let Some(var_31) = &input.subnet_id {
91        scope_30.string(var_31);
92    }
93    #[allow(unused_mut)]
94    let mut scope_32 = writer.prefix("Description");
95    if let Some(var_33) = &input.description {
96        scope_32.string(var_33);
97    }
98    #[allow(unused_mut)]
99    let mut scope_34 = writer.prefix("PrivateIpAddress");
100    if let Some(var_35) = &input.private_ip_address {
101        scope_34.string(var_35);
102    }
103    #[allow(unused_mut)]
104    let mut scope_36 = writer.prefix("SecurityGroupId");
105    if let Some(var_37) = &input.groups {
106        if !var_37.is_empty() {
107            let mut list_39 = scope_36.start_list(true, Some("SecurityGroupId"));
108            for item_38 in var_37 {
109                #[allow(unused_mut)]
110                let mut entry_40 = list_39.entry();
111                entry_40.string(item_38);
112            }
113            list_39.finish();
114        }
115    }
116    #[allow(unused_mut)]
117    let mut scope_41 = writer.prefix("PrivateIpAddresses");
118    if let Some(var_42) = &input.private_ip_addresses {
119        if !var_42.is_empty() {
120            let mut list_44 = scope_41.start_list(true, Some("item"));
121            for item_43 in var_42 {
122                #[allow(unused_mut)]
123                let mut entry_45 = list_44.entry();
124                crate::protocol_serde::shape_private_ip_address_specification::ser_private_ip_address_specification(entry_45, item_43)?;
125            }
126            list_44.finish();
127        }
128    }
129    #[allow(unused_mut)]
130    let mut scope_46 = writer.prefix("SecondaryPrivateIpAddressCount");
131    if let Some(var_47) = &input.secondary_private_ip_address_count {
132        scope_46.number(
133            #[allow(clippy::useless_conversion)]
134            ::aws_smithy_types::Number::NegInt((*var_47).into()),
135        );
136    }
137    #[allow(unused_mut)]
138    let mut scope_48 = writer.prefix("Ipv6Addresses");
139    if let Some(var_49) = &input.ipv6_addresses {
140        if !var_49.is_empty() {
141            let mut list_51 = scope_48.start_list(true, Some("item"));
142            for item_50 in var_49 {
143                #[allow(unused_mut)]
144                let mut entry_52 = list_51.entry();
145                crate::protocol_serde::shape_instance_ipv6_address::ser_instance_ipv6_address(entry_52, item_50)?;
146            }
147            list_51.finish();
148        }
149    }
150    #[allow(unused_mut)]
151    let mut scope_53 = writer.prefix("Ipv6AddressCount");
152    if let Some(var_54) = &input.ipv6_address_count {
153        scope_53.number(
154            #[allow(clippy::useless_conversion)]
155            ::aws_smithy_types::Number::NegInt((*var_54).into()),
156        );
157    }
158    #[allow(unused_mut)]
159    let mut scope_55 = writer.prefix("DryRun");
160    if let Some(var_56) = &input.dry_run {
161        scope_55.boolean(*var_56);
162    }
163    writer.finish();
164    Ok(::aws_smithy_types::body::SdkBody::from(out))
165}