aws_sdk_ec2/protocol_serde/
shape_request_launch_template_data.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(unused_mut)]
3pub fn ser_request_launch_template_data(
4    mut writer: ::aws_smithy_query::QueryValueWriter,
5    input: &crate::types::RequestLaunchTemplateData,
6) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
7    #[allow(unused_mut)]
8    let mut scope_1 = writer.prefix("KernelId");
9    if let Some(var_2) = &input.kernel_id {
10        scope_1.string(var_2);
11    }
12    #[allow(unused_mut)]
13    let mut scope_3 = writer.prefix("EbsOptimized");
14    if let Some(var_4) = &input.ebs_optimized {
15        scope_3.boolean(*var_4);
16    }
17    #[allow(unused_mut)]
18    let mut scope_5 = writer.prefix("IamInstanceProfile");
19    if let Some(var_6) = &input.iam_instance_profile {
20        crate::protocol_serde::shape_launch_template_iam_instance_profile_specification_request::ser_launch_template_iam_instance_profile_specification_request(scope_5, var_6)?;
21    }
22    #[allow(unused_mut)]
23    let mut scope_7 = writer.prefix("BlockDeviceMapping");
24    if let Some(var_8) = &input.block_device_mappings {
25        if !var_8.is_empty() {
26            let mut list_10 = scope_7.start_list(true, Some("BlockDeviceMapping"));
27            for item_9 in var_8 {
28                #[allow(unused_mut)]
29                let mut entry_11 = list_10.entry();
30                crate::protocol_serde::shape_launch_template_block_device_mapping_request::ser_launch_template_block_device_mapping_request(
31                    entry_11, item_9,
32                )?;
33            }
34            list_10.finish();
35        }
36    }
37    #[allow(unused_mut)]
38    let mut scope_12 = writer.prefix("NetworkInterface");
39    if let Some(var_13) = &input.network_interfaces {
40        if !var_13.is_empty() {
41            let mut list_15 = scope_12.start_list(true, Some("InstanceNetworkInterfaceSpecification"));
42            for item_14 in var_13 {
43                #[allow(unused_mut)]
44                let mut entry_16 = list_15.entry();
45                crate::protocol_serde::shape_launch_template_instance_network_interface_specification_request::ser_launch_template_instance_network_interface_specification_request(entry_16, item_14)?;
46            }
47            list_15.finish();
48        }
49    }
50    #[allow(unused_mut)]
51    let mut scope_17 = writer.prefix("ImageId");
52    if let Some(var_18) = &input.image_id {
53        scope_17.string(var_18);
54    }
55    #[allow(unused_mut)]
56    let mut scope_19 = writer.prefix("InstanceType");
57    if let Some(var_20) = &input.instance_type {
58        scope_19.string(var_20.as_str());
59    }
60    #[allow(unused_mut)]
61    let mut scope_21 = writer.prefix("KeyName");
62    if let Some(var_22) = &input.key_name {
63        scope_21.string(var_22);
64    }
65    #[allow(unused_mut)]
66    let mut scope_23 = writer.prefix("Monitoring");
67    if let Some(var_24) = &input.monitoring {
68        crate::protocol_serde::shape_launch_templates_monitoring_request::ser_launch_templates_monitoring_request(scope_23, var_24)?;
69    }
70    #[allow(unused_mut)]
71    let mut scope_25 = writer.prefix("Placement");
72    if let Some(var_26) = &input.placement {
73        crate::protocol_serde::shape_launch_template_placement_request::ser_launch_template_placement_request(scope_25, var_26)?;
74    }
75    #[allow(unused_mut)]
76    let mut scope_27 = writer.prefix("RamDiskId");
77    if let Some(var_28) = &input.ram_disk_id {
78        scope_27.string(var_28);
79    }
80    #[allow(unused_mut)]
81    let mut scope_29 = writer.prefix("DisableApiTermination");
82    if let Some(var_30) = &input.disable_api_termination {
83        scope_29.boolean(*var_30);
84    }
85    #[allow(unused_mut)]
86    let mut scope_31 = writer.prefix("InstanceInitiatedShutdownBehavior");
87    if let Some(var_32) = &input.instance_initiated_shutdown_behavior {
88        scope_31.string(var_32.as_str());
89    }
90    #[allow(unused_mut)]
91    let mut scope_33 = writer.prefix("UserData");
92    if let Some(var_34) = &input.user_data {
93        scope_33.string(var_34);
94    }
95    #[allow(unused_mut)]
96    let mut scope_35 = writer.prefix("TagSpecification");
97    if let Some(var_36) = &input.tag_specifications {
98        if !var_36.is_empty() {
99            let mut list_38 = scope_35.start_list(true, Some("LaunchTemplateTagSpecificationRequest"));
100            for item_37 in var_36 {
101                #[allow(unused_mut)]
102                let mut entry_39 = list_38.entry();
103                crate::protocol_serde::shape_launch_template_tag_specification_request::ser_launch_template_tag_specification_request(
104                    entry_39, item_37,
105                )?;
106            }
107            list_38.finish();
108        }
109    }
110    #[allow(unused_mut)]
111    let mut scope_40 = writer.prefix("ElasticGpuSpecification");
112    if let Some(var_41) = &input.elastic_gpu_specifications {
113        if !var_41.is_empty() {
114            let mut list_43 = scope_40.start_list(true, Some("ElasticGpuSpecification"));
115            for item_42 in var_41 {
116                #[allow(unused_mut)]
117                let mut entry_44 = list_43.entry();
118                crate::protocol_serde::shape_elastic_gpu_specification::ser_elastic_gpu_specification(entry_44, item_42)?;
119            }
120            list_43.finish();
121        }
122    }
123    #[allow(unused_mut)]
124    let mut scope_45 = writer.prefix("ElasticInferenceAccelerator");
125    if let Some(var_46) = &input.elastic_inference_accelerators {
126        if !var_46.is_empty() {
127            let mut list_48 = scope_45.start_list(true, Some("item"));
128            for item_47 in var_46 {
129                #[allow(unused_mut)]
130                let mut entry_49 = list_48.entry();
131                crate::protocol_serde::shape_launch_template_elastic_inference_accelerator::ser_launch_template_elastic_inference_accelerator(
132                    entry_49, item_47,
133                )?;
134            }
135            list_48.finish();
136        }
137    }
138    #[allow(unused_mut)]
139    let mut scope_50 = writer.prefix("SecurityGroupId");
140    if let Some(var_51) = &input.security_group_ids {
141        if !var_51.is_empty() {
142            let mut list_53 = scope_50.start_list(true, Some("SecurityGroupId"));
143            for item_52 in var_51 {
144                #[allow(unused_mut)]
145                let mut entry_54 = list_53.entry();
146                entry_54.string(item_52);
147            }
148            list_53.finish();
149        }
150    }
151    #[allow(unused_mut)]
152    let mut scope_55 = writer.prefix("SecurityGroup");
153    if let Some(var_56) = &input.security_groups {
154        if !var_56.is_empty() {
155            let mut list_58 = scope_55.start_list(true, Some("SecurityGroup"));
156            for item_57 in var_56 {
157                #[allow(unused_mut)]
158                let mut entry_59 = list_58.entry();
159                entry_59.string(item_57);
160            }
161            list_58.finish();
162        }
163    }
164    #[allow(unused_mut)]
165    let mut scope_60 = writer.prefix("InstanceMarketOptions");
166    if let Some(var_61) = &input.instance_market_options {
167        crate::protocol_serde::shape_launch_template_instance_market_options_request::ser_launch_template_instance_market_options_request(
168            scope_60, var_61,
169        )?;
170    }
171    #[allow(unused_mut)]
172    let mut scope_62 = writer.prefix("CreditSpecification");
173    if let Some(var_63) = &input.credit_specification {
174        crate::protocol_serde::shape_credit_specification_request::ser_credit_specification_request(scope_62, var_63)?;
175    }
176    #[allow(unused_mut)]
177    let mut scope_64 = writer.prefix("CpuOptions");
178    if let Some(var_65) = &input.cpu_options {
179        crate::protocol_serde::shape_launch_template_cpu_options_request::ser_launch_template_cpu_options_request(scope_64, var_65)?;
180    }
181    #[allow(unused_mut)]
182    let mut scope_66 = writer.prefix("CapacityReservationSpecification");
183    if let Some(var_67) = &input.capacity_reservation_specification {
184        crate::protocol_serde::shape_launch_template_capacity_reservation_specification_request::ser_launch_template_capacity_reservation_specification_request(scope_66, var_67)?;
185    }
186    #[allow(unused_mut)]
187    let mut scope_68 = writer.prefix("LicenseSpecification");
188    if let Some(var_69) = &input.license_specifications {
189        if !var_69.is_empty() {
190            let mut list_71 = scope_68.start_list(true, Some("item"));
191            for item_70 in var_69 {
192                #[allow(unused_mut)]
193                let mut entry_72 = list_71.entry();
194                crate::protocol_serde::shape_launch_template_license_configuration_request::ser_launch_template_license_configuration_request(
195                    entry_72, item_70,
196                )?;
197            }
198            list_71.finish();
199        }
200    }
201    #[allow(unused_mut)]
202    let mut scope_73 = writer.prefix("HibernationOptions");
203    if let Some(var_74) = &input.hibernation_options {
204        crate::protocol_serde::shape_launch_template_hibernation_options_request::ser_launch_template_hibernation_options_request(scope_73, var_74)?;
205    }
206    #[allow(unused_mut)]
207    let mut scope_75 = writer.prefix("MetadataOptions");
208    if let Some(var_76) = &input.metadata_options {
209        crate::protocol_serde::shape_launch_template_instance_metadata_options_request::ser_launch_template_instance_metadata_options_request(
210            scope_75, var_76,
211        )?;
212    }
213    #[allow(unused_mut)]
214    let mut scope_77 = writer.prefix("EnclaveOptions");
215    if let Some(var_78) = &input.enclave_options {
216        crate::protocol_serde::shape_launch_template_enclave_options_request::ser_launch_template_enclave_options_request(scope_77, var_78)?;
217    }
218    #[allow(unused_mut)]
219    let mut scope_79 = writer.prefix("InstanceRequirements");
220    if let Some(var_80) = &input.instance_requirements {
221        crate::protocol_serde::shape_instance_requirements_request::ser_instance_requirements_request(scope_79, var_80)?;
222    }
223    #[allow(unused_mut)]
224    let mut scope_81 = writer.prefix("PrivateDnsNameOptions");
225    if let Some(var_82) = &input.private_dns_name_options {
226        crate::protocol_serde::shape_launch_template_private_dns_name_options_request::ser_launch_template_private_dns_name_options_request(
227            scope_81, var_82,
228        )?;
229    }
230    #[allow(unused_mut)]
231    let mut scope_83 = writer.prefix("MaintenanceOptions");
232    if let Some(var_84) = &input.maintenance_options {
233        crate::protocol_serde::shape_launch_template_instance_maintenance_options_request::ser_launch_template_instance_maintenance_options_request(
234            scope_83, var_84,
235        )?;
236    }
237    #[allow(unused_mut)]
238    let mut scope_85 = writer.prefix("DisableApiStop");
239    if let Some(var_86) = &input.disable_api_stop {
240        scope_85.boolean(*var_86);
241    }
242    #[allow(unused_mut)]
243    let mut scope_87 = writer.prefix("Operator");
244    if let Some(var_88) = &input.operator {
245        crate::protocol_serde::shape_operator_request::ser_operator_request(scope_87, var_88)?;
246    }
247    #[allow(unused_mut)]
248    let mut scope_89 = writer.prefix("NetworkPerformanceOptions");
249    if let Some(var_90) = &input.network_performance_options {
250        crate::protocol_serde::shape_launch_template_network_performance_options_request::ser_launch_template_network_performance_options_request(
251            scope_89, var_90,
252        )?;
253    }
254    Ok(())
255}