aws_sdk_ec2/protocol_serde/
shape_run_instances_input.rs1pub fn ser_run_instances_input_input_input(
3 input: &crate::operation::run_instances::RunInstancesInput,
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, "RunInstances", "2016-11-15");
8 #[allow(unused_mut)]
9 let mut scope_1 = writer.prefix("BlockDeviceMapping");
10 if let Some(var_2) = &input.block_device_mappings {
11 if !var_2.is_empty() {
12 let mut list_4 = scope_1.start_list(true, Some("BlockDeviceMapping"));
13 for item_3 in var_2 {
14 #[allow(unused_mut)]
15 let mut entry_5 = list_4.entry();
16 crate::protocol_serde::shape_block_device_mapping::ser_block_device_mapping(entry_5, item_3)?;
17 }
18 list_4.finish();
19 }
20 }
21 #[allow(unused_mut)]
22 let mut scope_6 = writer.prefix("ImageId");
23 if let Some(var_7) = &input.image_id {
24 scope_6.string(var_7);
25 }
26 #[allow(unused_mut)]
27 let mut scope_8 = writer.prefix("InstanceType");
28 if let Some(var_9) = &input.instance_type {
29 scope_8.string(var_9.as_str());
30 }
31 #[allow(unused_mut)]
32 let mut scope_10 = writer.prefix("Ipv6AddressCount");
33 if let Some(var_11) = &input.ipv6_address_count {
34 scope_10.number(
35 #[allow(clippy::useless_conversion)]
36 ::aws_smithy_types::Number::NegInt((*var_11).into()),
37 );
38 }
39 #[allow(unused_mut)]
40 let mut scope_12 = writer.prefix("Ipv6Address");
41 if let Some(var_13) = &input.ipv6_addresses {
42 if !var_13.is_empty() {
43 let mut list_15 = scope_12.start_list(true, Some("item"));
44 for item_14 in var_13 {
45 #[allow(unused_mut)]
46 let mut entry_16 = list_15.entry();
47 crate::protocol_serde::shape_instance_ipv6_address::ser_instance_ipv6_address(entry_16, item_14)?;
48 }
49 list_15.finish();
50 }
51 }
52 #[allow(unused_mut)]
53 let mut scope_17 = writer.prefix("KernelId");
54 if let Some(var_18) = &input.kernel_id {
55 scope_17.string(var_18);
56 }
57 #[allow(unused_mut)]
58 let mut scope_19 = writer.prefix("KeyName");
59 if let Some(var_20) = &input.key_name {
60 scope_19.string(var_20);
61 }
62 #[allow(unused_mut)]
63 let mut scope_21 = writer.prefix("MaxCount");
64 if let Some(var_22) = &input.max_count {
65 scope_21.number(
66 #[allow(clippy::useless_conversion)]
67 ::aws_smithy_types::Number::NegInt((*var_22).into()),
68 );
69 }
70 #[allow(unused_mut)]
71 let mut scope_23 = writer.prefix("MinCount");
72 if let Some(var_24) = &input.min_count {
73 scope_23.number(
74 #[allow(clippy::useless_conversion)]
75 ::aws_smithy_types::Number::NegInt((*var_24).into()),
76 );
77 }
78 #[allow(unused_mut)]
79 let mut scope_25 = writer.prefix("Monitoring");
80 if let Some(var_26) = &input.monitoring {
81 crate::protocol_serde::shape_run_instances_monitoring_enabled::ser_run_instances_monitoring_enabled(scope_25, var_26)?;
82 }
83 #[allow(unused_mut)]
84 let mut scope_27 = writer.prefix("Placement");
85 if let Some(var_28) = &input.placement {
86 crate::protocol_serde::shape_placement::ser_placement(scope_27, var_28)?;
87 }
88 #[allow(unused_mut)]
89 let mut scope_29 = writer.prefix("RamdiskId");
90 if let Some(var_30) = &input.ramdisk_id {
91 scope_29.string(var_30);
92 }
93 #[allow(unused_mut)]
94 let mut scope_31 = writer.prefix("SecurityGroupId");
95 if let Some(var_32) = &input.security_group_ids {
96 if !var_32.is_empty() {
97 let mut list_34 = scope_31.start_list(true, Some("SecurityGroupId"));
98 for item_33 in var_32 {
99 #[allow(unused_mut)]
100 let mut entry_35 = list_34.entry();
101 entry_35.string(item_33);
102 }
103 list_34.finish();
104 }
105 }
106 #[allow(unused_mut)]
107 let mut scope_36 = writer.prefix("SecurityGroup");
108 if let Some(var_37) = &input.security_groups {
109 if !var_37.is_empty() {
110 let mut list_39 = scope_36.start_list(true, Some("SecurityGroup"));
111 for item_38 in var_37 {
112 #[allow(unused_mut)]
113 let mut entry_40 = list_39.entry();
114 entry_40.string(item_38);
115 }
116 list_39.finish();
117 }
118 }
119 #[allow(unused_mut)]
120 let mut scope_41 = writer.prefix("SubnetId");
121 if let Some(var_42) = &input.subnet_id {
122 scope_41.string(var_42);
123 }
124 #[allow(unused_mut)]
125 let mut scope_43 = writer.prefix("UserData");
126 if let Some(var_44) = &input.user_data {
127 scope_43.string(var_44);
128 }
129 #[allow(unused_mut)]
130 let mut scope_45 = writer.prefix("ElasticGpuSpecification");
131 if let Some(var_46) = &input.elastic_gpu_specification {
132 if !var_46.is_empty() {
133 let mut list_48 = scope_45.start_list(true, Some("item"));
134 for item_47 in var_46 {
135 #[allow(unused_mut)]
136 let mut entry_49 = list_48.entry();
137 crate::protocol_serde::shape_elastic_gpu_specification::ser_elastic_gpu_specification(entry_49, item_47)?;
138 }
139 list_48.finish();
140 }
141 }
142 #[allow(unused_mut)]
143 let mut scope_50 = writer.prefix("ElasticInferenceAccelerator");
144 if let Some(var_51) = &input.elastic_inference_accelerators {
145 if !var_51.is_empty() {
146 let mut list_53 = scope_50.start_list(true, Some("item"));
147 for item_52 in var_51 {
148 #[allow(unused_mut)]
149 let mut entry_54 = list_53.entry();
150 crate::protocol_serde::shape_elastic_inference_accelerator::ser_elastic_inference_accelerator(entry_54, item_52)?;
151 }
152 list_53.finish();
153 }
154 }
155 #[allow(unused_mut)]
156 let mut scope_55 = writer.prefix("TagSpecification");
157 if let Some(var_56) = &input.tag_specifications {
158 if !var_56.is_empty() {
159 let mut list_58 = scope_55.start_list(true, Some("item"));
160 for item_57 in var_56 {
161 #[allow(unused_mut)]
162 let mut entry_59 = list_58.entry();
163 crate::protocol_serde::shape_tag_specification::ser_tag_specification(entry_59, item_57)?;
164 }
165 list_58.finish();
166 }
167 }
168 #[allow(unused_mut)]
169 let mut scope_60 = writer.prefix("LaunchTemplate");
170 if let Some(var_61) = &input.launch_template {
171 crate::protocol_serde::shape_launch_template_specification::ser_launch_template_specification(scope_60, var_61)?;
172 }
173 #[allow(unused_mut)]
174 let mut scope_62 = writer.prefix("InstanceMarketOptions");
175 if let Some(var_63) = &input.instance_market_options {
176 crate::protocol_serde::shape_instance_market_options_request::ser_instance_market_options_request(scope_62, var_63)?;
177 }
178 #[allow(unused_mut)]
179 let mut scope_64 = writer.prefix("CreditSpecification");
180 if let Some(var_65) = &input.credit_specification {
181 crate::protocol_serde::shape_credit_specification_request::ser_credit_specification_request(scope_64, var_65)?;
182 }
183 #[allow(unused_mut)]
184 let mut scope_66 = writer.prefix("CpuOptions");
185 if let Some(var_67) = &input.cpu_options {
186 crate::protocol_serde::shape_cpu_options_request::ser_cpu_options_request(scope_66, var_67)?;
187 }
188 #[allow(unused_mut)]
189 let mut scope_68 = writer.prefix("CapacityReservationSpecification");
190 if let Some(var_69) = &input.capacity_reservation_specification {
191 crate::protocol_serde::shape_capacity_reservation_specification::ser_capacity_reservation_specification(scope_68, var_69)?;
192 }
193 #[allow(unused_mut)]
194 let mut scope_70 = writer.prefix("HibernationOptions");
195 if let Some(var_71) = &input.hibernation_options {
196 crate::protocol_serde::shape_hibernation_options_request::ser_hibernation_options_request(scope_70, var_71)?;
197 }
198 #[allow(unused_mut)]
199 let mut scope_72 = writer.prefix("LicenseSpecification");
200 if let Some(var_73) = &input.license_specifications {
201 if !var_73.is_empty() {
202 let mut list_75 = scope_72.start_list(true, Some("item"));
203 for item_74 in var_73 {
204 #[allow(unused_mut)]
205 let mut entry_76 = list_75.entry();
206 crate::protocol_serde::shape_license_configuration_request::ser_license_configuration_request(entry_76, item_74)?;
207 }
208 list_75.finish();
209 }
210 }
211 #[allow(unused_mut)]
212 let mut scope_77 = writer.prefix("MetadataOptions");
213 if let Some(var_78) = &input.metadata_options {
214 crate::protocol_serde::shape_instance_metadata_options_request::ser_instance_metadata_options_request(scope_77, var_78)?;
215 }
216 #[allow(unused_mut)]
217 let mut scope_79 = writer.prefix("EnclaveOptions");
218 if let Some(var_80) = &input.enclave_options {
219 crate::protocol_serde::shape_enclave_options_request::ser_enclave_options_request(scope_79, var_80)?;
220 }
221 #[allow(unused_mut)]
222 let mut scope_81 = writer.prefix("PrivateDnsNameOptions");
223 if let Some(var_82) = &input.private_dns_name_options {
224 crate::protocol_serde::shape_private_dns_name_options_request::ser_private_dns_name_options_request(scope_81, var_82)?;
225 }
226 #[allow(unused_mut)]
227 let mut scope_83 = writer.prefix("MaintenanceOptions");
228 if let Some(var_84) = &input.maintenance_options {
229 crate::protocol_serde::shape_instance_maintenance_options_request::ser_instance_maintenance_options_request(scope_83, var_84)?;
230 }
231 #[allow(unused_mut)]
232 let mut scope_85 = writer.prefix("DisableApiStop");
233 if let Some(var_86) = &input.disable_api_stop {
234 scope_85.boolean(*var_86);
235 }
236 #[allow(unused_mut)]
237 let mut scope_87 = writer.prefix("EnablePrimaryIpv6");
238 if let Some(var_88) = &input.enable_primary_ipv6 {
239 scope_87.boolean(*var_88);
240 }
241 #[allow(unused_mut)]
242 let mut scope_89 = writer.prefix("NetworkPerformanceOptions");
243 if let Some(var_90) = &input.network_performance_options {
244 crate::protocol_serde::shape_instance_network_performance_options_request::ser_instance_network_performance_options_request(
245 scope_89, var_90,
246 )?;
247 }
248 #[allow(unused_mut)]
249 let mut scope_91 = writer.prefix("Operator");
250 if let Some(var_92) = &input.operator {
251 crate::protocol_serde::shape_operator_request::ser_operator_request(scope_91, var_92)?;
252 }
253 #[allow(unused_mut)]
254 let mut scope_93 = writer.prefix("DryRun");
255 if let Some(var_94) = &input.dry_run {
256 scope_93.boolean(*var_94);
257 }
258 #[allow(unused_mut)]
259 let mut scope_95 = writer.prefix("DisableApiTermination");
260 if let Some(var_96) = &input.disable_api_termination {
261 scope_95.boolean(*var_96);
262 }
263 #[allow(unused_mut)]
264 let mut scope_97 = writer.prefix("InstanceInitiatedShutdownBehavior");
265 if let Some(var_98) = &input.instance_initiated_shutdown_behavior {
266 scope_97.string(var_98.as_str());
267 }
268 #[allow(unused_mut)]
269 let mut scope_99 = writer.prefix("PrivateIpAddress");
270 if let Some(var_100) = &input.private_ip_address {
271 scope_99.string(var_100);
272 }
273 #[allow(unused_mut)]
274 let mut scope_101 = writer.prefix("ClientToken");
275 if let Some(var_102) = &input.client_token {
276 scope_101.string(var_102);
277 }
278 #[allow(unused_mut)]
279 let mut scope_103 = writer.prefix("AdditionalInfo");
280 if let Some(var_104) = &input.additional_info {
281 scope_103.string(var_104);
282 }
283 #[allow(unused_mut)]
284 let mut scope_105 = writer.prefix("NetworkInterface");
285 if let Some(var_106) = &input.network_interfaces {
286 if !var_106.is_empty() {
287 let mut list_108 = scope_105.start_list(true, Some("item"));
288 for item_107 in var_106 {
289 #[allow(unused_mut)]
290 let mut entry_109 = list_108.entry();
291 crate::protocol_serde::shape_instance_network_interface_specification::ser_instance_network_interface_specification(
292 entry_109, item_107,
293 )?;
294 }
295 list_108.finish();
296 }
297 }
298 #[allow(unused_mut)]
299 let mut scope_110 = writer.prefix("IamInstanceProfile");
300 if let Some(var_111) = &input.iam_instance_profile {
301 crate::protocol_serde::shape_iam_instance_profile_specification::ser_iam_instance_profile_specification(scope_110, var_111)?;
302 }
303 #[allow(unused_mut)]
304 let mut scope_112 = writer.prefix("EbsOptimized");
305 if let Some(var_113) = &input.ebs_optimized {
306 scope_112.boolean(*var_113);
307 }
308 writer.finish();
309 Ok(::aws_smithy_types::body::SdkBody::from(out))
310}