aws_sdk_ec2/protocol_serde/
shape_instance.rs1#[allow(clippy::needless_question_mark)]
3pub fn de_instance(
4 decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
5) -> ::std::result::Result<crate::types::Instance, ::aws_smithy_xml::decode::XmlDecodeError> {
6 #[allow(unused_mut)]
7 let mut builder = crate::types::Instance::builder();
8 while let Some(mut tag) = decoder.next_tag() {
9 match tag.start_el() {
10 s if s.matches("architecture") => {
11 let var_1 =
12 Some(
13 Result::<crate::types::ArchitectureValues, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
14 crate::types::ArchitectureValues::from(
15 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
16 )
17 )
18 ?
19 )
20 ;
21 builder = builder.set_architecture(var_1);
22 }
23 ,
24 s if s.matches("blockDeviceMapping") => {
25 let var_2 =
26 Some(
27 crate::protocol_serde::shape_instance_block_device_mapping_list::de_instance_block_device_mapping_list(&mut tag)
28 ?
29 )
30 ;
31 builder = builder.set_block_device_mappings(var_2);
32 }
33 ,
34 s if s.matches("clientToken") => {
35 let var_3 =
36 Some(
37 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
38 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
39 .into()
40 )
41 ?
42 )
43 ;
44 builder = builder.set_client_token(var_3);
45 }
46 ,
47 s if s.matches("ebsOptimized") => {
48 let var_4 =
49 Some(
50 {
51 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
52 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
53 )
54 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
55 }
56 ?
57 )
58 ;
59 builder = builder.set_ebs_optimized(var_4);
60 }
61 ,
62 s if s.matches("enaSupport") => {
63 let var_5 =
64 Some(
65 {
66 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
67 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
68 )
69 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
70 }
71 ?
72 )
73 ;
74 builder = builder.set_ena_support(var_5);
75 }
76 ,
77 s if s.matches("hypervisor") => {
78 let var_6 =
79 Some(
80 Result::<crate::types::HypervisorType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
81 crate::types::HypervisorType::from(
82 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
83 )
84 )
85 ?
86 )
87 ;
88 builder = builder.set_hypervisor(var_6);
89 }
90 ,
91 s if s.matches("iamInstanceProfile") => {
92 let var_7 =
93 Some(
94 crate::protocol_serde::shape_iam_instance_profile::de_iam_instance_profile(&mut tag)
95 ?
96 )
97 ;
98 builder = builder.set_iam_instance_profile(var_7);
99 }
100 ,
101 s if s.matches("instanceLifecycle") => {
102 let var_8 =
103 Some(
104 Result::<crate::types::InstanceLifecycleType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
105 crate::types::InstanceLifecycleType::from(
106 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
107 )
108 )
109 ?
110 )
111 ;
112 builder = builder.set_instance_lifecycle(var_8);
113 }
114 ,
115 s if s.matches("elasticGpuAssociationSet") => {
116 let var_9 =
117 Some(
118 crate::protocol_serde::shape_elastic_gpu_association_list::de_elastic_gpu_association_list(&mut tag)
119 ?
120 )
121 ;
122 builder = builder.set_elastic_gpu_associations(var_9);
123 }
124 ,
125 s if s.matches("elasticInferenceAcceleratorAssociationSet") => {
126 let var_10 =
127 Some(
128 crate::protocol_serde::shape_elastic_inference_accelerator_association_list::de_elastic_inference_accelerator_association_list(&mut tag)
129 ?
130 )
131 ;
132 builder = builder.set_elastic_inference_accelerator_associations(var_10);
133 }
134 ,
135 s if s.matches("networkInterfaceSet") => {
136 let var_11 =
137 Some(
138 crate::protocol_serde::shape_instance_network_interface_list::de_instance_network_interface_list(&mut tag)
139 ?
140 )
141 ;
142 builder = builder.set_network_interfaces(var_11);
143 }
144 ,
145 s if s.matches("outpostArn") => {
146 let var_12 =
147 Some(
148 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
149 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
150 .into()
151 )
152 ?
153 )
154 ;
155 builder = builder.set_outpost_arn(var_12);
156 }
157 ,
158 s if s.matches("rootDeviceName") => {
159 let var_13 =
160 Some(
161 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
162 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
163 .into()
164 )
165 ?
166 )
167 ;
168 builder = builder.set_root_device_name(var_13);
169 }
170 ,
171 s if s.matches("rootDeviceType") => {
172 let var_14 =
173 Some(
174 Result::<crate::types::DeviceType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
175 crate::types::DeviceType::from(
176 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
177 )
178 )
179 ?
180 )
181 ;
182 builder = builder.set_root_device_type(var_14);
183 }
184 ,
185 s if s.matches("groupSet") => {
186 let var_15 =
187 Some(
188 crate::protocol_serde::shape_group_identifier_list::de_group_identifier_list(&mut tag)
189 ?
190 )
191 ;
192 builder = builder.set_security_groups(var_15);
193 }
194 ,
195 s if s.matches("sourceDestCheck") => {
196 let var_16 =
197 Some(
198 {
199 <bool as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
200 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
201 )
202 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (boolean: `com.amazonaws.ec2#Boolean`)"))
203 }
204 ?
205 )
206 ;
207 builder = builder.set_source_dest_check(var_16);
208 }
209 ,
210 s if s.matches("spotInstanceRequestId") => {
211 let var_17 =
212 Some(
213 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
214 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
215 .into()
216 )
217 ?
218 )
219 ;
220 builder = builder.set_spot_instance_request_id(var_17);
221 }
222 ,
223 s if s.matches("sriovNetSupport") => {
224 let var_18 =
225 Some(
226 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
227 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
228 .into()
229 )
230 ?
231 )
232 ;
233 builder = builder.set_sriov_net_support(var_18);
234 }
235 ,
236 s if s.matches("stateReason") => {
237 let var_19 =
238 Some(
239 crate::protocol_serde::shape_state_reason::de_state_reason(&mut tag)
240 ?
241 )
242 ;
243 builder = builder.set_state_reason(var_19);
244 }
245 ,
246 s if s.matches("tagSet") => {
247 let var_20 =
248 Some(
249 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
250 ?
251 )
252 ;
253 builder = builder.set_tags(var_20);
254 }
255 ,
256 s if s.matches("virtualizationType") => {
257 let var_21 =
258 Some(
259 Result::<crate::types::VirtualizationType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
260 crate::types::VirtualizationType::from(
261 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
262 )
263 )
264 ?
265 )
266 ;
267 builder = builder.set_virtualization_type(var_21);
268 }
269 ,
270 s if s.matches("cpuOptions") => {
271 let var_22 =
272 Some(
273 crate::protocol_serde::shape_cpu_options::de_cpu_options(&mut tag)
274 ?
275 )
276 ;
277 builder = builder.set_cpu_options(var_22);
278 }
279 ,
280 s if s.matches("capacityBlockId") => {
281 let var_23 =
282 Some(
283 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
284 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
285 .into()
286 )
287 ?
288 )
289 ;
290 builder = builder.set_capacity_block_id(var_23);
291 }
292 ,
293 s if s.matches("capacityReservationId") => {
294 let var_24 =
295 Some(
296 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
297 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
298 .into()
299 )
300 ?
301 )
302 ;
303 builder = builder.set_capacity_reservation_id(var_24);
304 }
305 ,
306 s if s.matches("capacityReservationSpecification") => {
307 let var_25 =
308 Some(
309 crate::protocol_serde::shape_capacity_reservation_specification_response::de_capacity_reservation_specification_response(&mut tag)
310 ?
311 )
312 ;
313 builder = builder.set_capacity_reservation_specification(var_25);
314 }
315 ,
316 s if s.matches("hibernationOptions") => {
317 let var_26 =
318 Some(
319 crate::protocol_serde::shape_hibernation_options::de_hibernation_options(&mut tag)
320 ?
321 )
322 ;
323 builder = builder.set_hibernation_options(var_26);
324 }
325 ,
326 s if s.matches("licenseSet") => {
327 let var_27 =
328 Some(
329 crate::protocol_serde::shape_license_list::de_license_list(&mut tag)
330 ?
331 )
332 ;
333 builder = builder.set_licenses(var_27);
334 }
335 ,
336 s if s.matches("metadataOptions") => {
337 let var_28 =
338 Some(
339 crate::protocol_serde::shape_instance_metadata_options_response::de_instance_metadata_options_response(&mut tag)
340 ?
341 )
342 ;
343 builder = builder.set_metadata_options(var_28);
344 }
345 ,
346 s if s.matches("enclaveOptions") => {
347 let var_29 =
348 Some(
349 crate::protocol_serde::shape_enclave_options::de_enclave_options(&mut tag)
350 ?
351 )
352 ;
353 builder = builder.set_enclave_options(var_29);
354 }
355 ,
356 s if s.matches("bootMode") => {
357 let var_30 =
358 Some(
359 Result::<crate::types::BootModeValues, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
360 crate::types::BootModeValues::from(
361 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
362 )
363 )
364 ?
365 )
366 ;
367 builder = builder.set_boot_mode(var_30);
368 }
369 ,
370 s if s.matches("platformDetails") => {
371 let var_31 =
372 Some(
373 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
374 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
375 .into()
376 )
377 ?
378 )
379 ;
380 builder = builder.set_platform_details(var_31);
381 }
382 ,
383 s if s.matches("usageOperation") => {
384 let var_32 =
385 Some(
386 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
387 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
388 .into()
389 )
390 ?
391 )
392 ;
393 builder = builder.set_usage_operation(var_32);
394 }
395 ,
396 s if s.matches("usageOperationUpdateTime") => {
397 let var_33 =
398 Some(
399 ::aws_smithy_types::DateTime::from_str(
400 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
401 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
402 )
403 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
404 ?
405 )
406 ;
407 builder = builder.set_usage_operation_update_time(var_33);
408 }
409 ,
410 s if s.matches("privateDnsNameOptions") => {
411 let var_34 =
412 Some(
413 crate::protocol_serde::shape_private_dns_name_options_response::de_private_dns_name_options_response(&mut tag)
414 ?
415 )
416 ;
417 builder = builder.set_private_dns_name_options(var_34);
418 }
419 ,
420 s if s.matches("ipv6Address") => {
421 let var_35 =
422 Some(
423 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
424 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
425 .into()
426 )
427 ?
428 )
429 ;
430 builder = builder.set_ipv6_address(var_35);
431 }
432 ,
433 s if s.matches("tpmSupport") => {
434 let var_36 =
435 Some(
436 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
437 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
438 .into()
439 )
440 ?
441 )
442 ;
443 builder = builder.set_tpm_support(var_36);
444 }
445 ,
446 s if s.matches("maintenanceOptions") => {
447 let var_37 =
448 Some(
449 crate::protocol_serde::shape_instance_maintenance_options::de_instance_maintenance_options(&mut tag)
450 ?
451 )
452 ;
453 builder = builder.set_maintenance_options(var_37);
454 }
455 ,
456 s if s.matches("currentInstanceBootMode") => {
457 let var_38 =
458 Some(
459 Result::<crate::types::InstanceBootModeValues, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
460 crate::types::InstanceBootModeValues::from(
461 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
462 )
463 )
464 ?
465 )
466 ;
467 builder = builder.set_current_instance_boot_mode(var_38);
468 }
469 ,
470 s if s.matches("networkPerformanceOptions") => {
471 let var_39 =
472 Some(
473 crate::protocol_serde::shape_instance_network_performance_options::de_instance_network_performance_options(&mut tag)
474 ?
475 )
476 ;
477 builder = builder.set_network_performance_options(var_39);
478 }
479 ,
480 s if s.matches("operator") => {
481 let var_40 =
482 Some(
483 crate::protocol_serde::shape_operator_response::de_operator_response(&mut tag)
484 ?
485 )
486 ;
487 builder = builder.set_operator(var_40);
488 }
489 ,
490 s if s.matches("instanceId") => {
491 let var_41 =
492 Some(
493 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
494 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
495 .into()
496 )
497 ?
498 )
499 ;
500 builder = builder.set_instance_id(var_41);
501 }
502 ,
503 s if s.matches("imageId") => {
504 let var_42 =
505 Some(
506 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
507 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
508 .into()
509 )
510 ?
511 )
512 ;
513 builder = builder.set_image_id(var_42);
514 }
515 ,
516 s if s.matches("instanceState") => {
517 let var_43 =
518 Some(
519 crate::protocol_serde::shape_instance_state::de_instance_state(&mut tag)
520 ?
521 )
522 ;
523 builder = builder.set_state(var_43);
524 }
525 ,
526 s if s.matches("privateDnsName") => {
527 let var_44 =
528 Some(
529 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
530 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
531 .into()
532 )
533 ?
534 )
535 ;
536 builder = builder.set_private_dns_name(var_44);
537 }
538 ,
539 s if s.matches("dnsName") => {
540 let var_45 =
541 Some(
542 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
543 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
544 .into()
545 )
546 ?
547 )
548 ;
549 builder = builder.set_public_dns_name(var_45);
550 }
551 ,
552 s if s.matches("reason") => {
553 let var_46 =
554 Some(
555 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
556 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
557 .into()
558 )
559 ?
560 )
561 ;
562 builder = builder.set_state_transition_reason(var_46);
563 }
564 ,
565 s if s.matches("keyName") => {
566 let var_47 =
567 Some(
568 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
569 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
570 .into()
571 )
572 ?
573 )
574 ;
575 builder = builder.set_key_name(var_47);
576 }
577 ,
578 s if s.matches("amiLaunchIndex") => {
579 let var_48 =
580 Some(
581 {
582 <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
583 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
584 )
585 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
586 }
587 ?
588 )
589 ;
590 builder = builder.set_ami_launch_index(var_48);
591 }
592 ,
593 s if s.matches("productCodes") => {
594 let var_49 =
595 Some(
596 crate::protocol_serde::shape_product_code_list::de_product_code_list(&mut tag)
597 ?
598 )
599 ;
600 builder = builder.set_product_codes(var_49);
601 }
602 ,
603 s if s.matches("instanceType") => {
604 let var_50 =
605 Some(
606 Result::<crate::types::InstanceType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
607 crate::types::InstanceType::from(
608 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
609 )
610 )
611 ?
612 )
613 ;
614 builder = builder.set_instance_type(var_50);
615 }
616 ,
617 s if s.matches("launchTime") => {
618 let var_51 =
619 Some(
620 ::aws_smithy_types::DateTime::from_str(
621 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
622 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
623 )
624 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#DateTime`)"))
625 ?
626 )
627 ;
628 builder = builder.set_launch_time(var_51);
629 }
630 ,
631 s if s.matches("placement") => {
632 let var_52 =
633 Some(
634 crate::protocol_serde::shape_placement::de_placement(&mut tag)
635 ?
636 )
637 ;
638 builder = builder.set_placement(var_52);
639 }
640 ,
641 s if s.matches("kernelId") => {
642 let var_53 =
643 Some(
644 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
645 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
646 .into()
647 )
648 ?
649 )
650 ;
651 builder = builder.set_kernel_id(var_53);
652 }
653 ,
654 s if s.matches("ramdiskId") => {
655 let var_54 =
656 Some(
657 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
658 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
659 .into()
660 )
661 ?
662 )
663 ;
664 builder = builder.set_ramdisk_id(var_54);
665 }
666 ,
667 s if s.matches("platform") => {
668 let var_55 =
669 Some(
670 Result::<crate::types::PlatformValues, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
671 crate::types::PlatformValues::from(
672 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
673 )
674 )
675 ?
676 )
677 ;
678 builder = builder.set_platform(var_55);
679 }
680 ,
681 s if s.matches("monitoring") => {
682 let var_56 =
683 Some(
684 crate::protocol_serde::shape_monitoring::de_monitoring(&mut tag)
685 ?
686 )
687 ;
688 builder = builder.set_monitoring(var_56);
689 }
690 ,
691 s if s.matches("subnetId") => {
692 let var_57 =
693 Some(
694 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
695 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
696 .into()
697 )
698 ?
699 )
700 ;
701 builder = builder.set_subnet_id(var_57);
702 }
703 ,
704 s if s.matches("vpcId") => {
705 let var_58 =
706 Some(
707 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
708 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
709 .into()
710 )
711 ?
712 )
713 ;
714 builder = builder.set_vpc_id(var_58);
715 }
716 ,
717 s if s.matches("privateIpAddress") => {
718 let var_59 =
719 Some(
720 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
721 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
722 .into()
723 )
724 ?
725 )
726 ;
727 builder = builder.set_private_ip_address(var_59);
728 }
729 ,
730 s if s.matches("ipAddress") => {
731 let var_60 =
732 Some(
733 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
734 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
735 .into()
736 )
737 ?
738 )
739 ;
740 builder = builder.set_public_ip_address(var_60);
741 }
742 ,
743 _ => {}
744 }
745 }
746 Ok(builder.build())
747}