vim_rs 0.4.4

Rust Bindings for the VMware by Broadcom vCenter VI JSON API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// VirtualMachine is the managed object type for manipulating virtual machines,
/// including templates that can be deployed (repeatedly) as new virtual machines.
/// 
/// This type provides methods for configuring and controlling a virtual machine.
/// 
/// VirtualMachine extends the ManagedEntity type because virtual machines are
/// part of a virtual infrastructure inventory. The parent of a virtual machine
/// must be a folder, and a virtual machine has no children.
/// 
/// Destroying a virtual machine disposes of all associated storage, including
/// the virtual disks. To remove a virtual machine while retaining its
/// virtual disk storage, a client must remove the virtual disks
/// from the virtual machine before destroying it.
#[derive(Clone)]
pub struct VirtualMachine {
    client: Arc<dyn VimClient>,
    mo_id: String,
}
impl VirtualMachine {
    pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
        Self {
            client,
            mo_id: mo_id.to_string(),
        }
    }
    /// Deprecated as of vSphere API 4.1, use *VirtualMachine.AcquireTicket* instead.
    /// 
    /// Creates and returns a one-time credential used in establishing a
    /// remote mouse-keyboard-screen connection to this virtual
    /// machine.
    /// 
    /// The correct function of this method depends on being able to
    /// retrieve TCP binding information about the server end of the
    /// client connection that is requesting the ticket. If such
    /// information is not available, the NotSupported fault is thrown.
    /// This method is appropriate for SOAP and authenticated connections,
    /// which are both TCP-based connections.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.ConsoleInteract
    ///
    /// ## Returns:
    ///
    /// A one-time credential used in establishing a remote
    /// mouse-keyboard-screen connection.
    pub async fn acquire_mks_ticket(&self) -> Result<crate::types::structs::VirtualMachineMksTicket> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "AcquireMksTicket", None).await?;
        let result: crate::types::structs::VirtualMachineMksTicket = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Creates and returns a one-time credential used in establishing a
    /// specific connection to this virtual machine, for example, a ticket
    /// type of mks can be used to establish a remote mouse-keyboard-screen
    /// connection.
    /// 
    /// A client using this ticketing mechanism must have network
    /// connectivity to the ESX server where the virtual machine is running,
    /// and the ESX server must be reachable to the management client from
    /// the address made available to the client via the ticket.
    /// 
    /// Acquiring a virtual machine ticket requires different privileges
    /// depending on the types of ticket:
    /// - VirtualMachine.Interact.DeviceConnection if requesting a device
    ///   ticket.
    /// - VirtualMachine.Interact.GuestControl if requesting a guestControl
    ///   or guestIntegrity ticket.
    /// - VirtualMachine.Interact.ConsoleInteract if requesting an mks
    ///   or webmks ticket.
    /// - VirtualMachine.Interact.DnD if requesting a drag and drop
    ///   ticket.
    ///
    /// ## Parameters:
    ///
    /// ### ticket_type
    /// The type of service to acquire, the set of possible
    /// values is described in *VirtualMachineTicketType_enum*.
    ///
    /// ## Returns:
    ///
    /// A one-time credential used in establishing a remote
    /// connection to this virtual machine.
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the virtual machine is not connected.
    pub async fn acquire_ticket(&self, ticket_type: &str) -> Result<crate::types::structs::VirtualMachineTicket> {
        let input = AcquireTicketRequestType {ticket_type, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "AcquireTicket", Some(&input)).await?;
        let result: crate::types::structs::VirtualMachineTicket = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Responds to a question that is blocking this virtual machine.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.AnswerQuestion
    ///
    /// ## Parameters:
    ///
    /// ### question_id
    /// The value from QuestionInfo.id that identifies the question
    /// to answer.
    ///
    /// ### answer_choice
    /// The contents of the QuestionInfo.choice.value array element
    /// that identifies the desired answer.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: if the questionId does not apply to this virtual machine.
    /// For example, this can happen if another client already answered the message.
    /// 
    /// ***ConcurrentAccess***: if the question has been or is being answered by
    /// another thread or user.
    pub async fn answer_vm(&self, question_id: &str, answer_choice: &str) -> Result<()> {
        let input = AnswerVmRequestType {question_id, answer_choice, };
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "AnswerVM", Some(&input)).await
    }
    /// Applies the EVC mode masks to the virtual machine.
    /// 
    /// Existing masks will be replaced by the input masks.
    /// If the mask parameter is not set, then the masks on the virtual machine
    /// are removed.
    /// See *EVCMode.featureMask* for the list of masks to provide.
    /// These can be retrieved from *Capability.supportedEVCMode*,
    /// which is accessible in *ServiceInstance.capability*.
    /// 
    /// This operation is only supported if
    /// *VirtualMachineCapability.perVmEvcSupported* is true.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.Settings
    ///
    /// ## Parameters:
    ///
    /// ### mask
    /// The feature masks to apply to the virtual machine.
    /// An empty set of masks will clear EVC settings.
    ///
    /// ### complete_masks
    /// Defaults to true if not set. A true value implies
    /// that any unspecified feature will not be exposed to the guest.
    /// A false value will expose any unspecified feature to the guest
    /// with the value of the host.
    ///
    /// ## Returns:
    ///
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is not poweredOff.
    pub async fn apply_evc_mode_vm_task(&self, mask: Option<&[crate::types::structs::HostFeatureMask]>, complete_masks: Option<bool>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = ApplyEvcModeVmRequestType {mask, complete_masks, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "ApplyEvcModeVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Attach an existing disk to this virtual machine.
    /// 
    /// A minimum virtual machine version of 'vmx-13' is required for this
    /// operation to succeed. If a compatible VM version is not satisfied,
    /// a *DeviceUnsupportedForVmVersion* fault will be thrown.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.AddExistingDisk
    ///
    /// ## Parameters:
    ///
    /// ### disk_id
    /// The ID of the virtual disk to be operated. See
    /// *ID*
    ///
    /// ### datastore
    /// The datastore where the virtual disk is located.
    /// 
    /// Refers instance of *Datastore*.
    ///
    /// ### controller_key
    /// Key of the controller the disk will connect to.
    /// It can be unset if there is only one controller
    /// (SCSI or SATA) with the available slot in the
    /// virtual machine. If there are multiple SCSI or
    /// SATA controllers available, user must specify
    /// the controller; if there is no available
    /// controllers, a *MissingController*
    /// fault will be thrown.
    ///
    /// ### unit_number
    /// The unit number of the attached disk on its controller.
    /// If unset, the next available slot on the specified
    /// controller or the only available controller will be
    /// assigned to the attached disk.
    ///
    /// ## Returns:
    ///
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotFound***: if the disk object cannot be found.
    /// 
    /// ***VmConfigFault***: if the virtual machine's configuration is invalid.
    /// 
    /// ***FileFault***: if there is a problem creating or accessing the virtual
    /// machine's files for this operation.
    /// 
    /// ***InvalidState***: if the operation cannot be performed in the current
    /// state of the virtual machine. For example, because the virtual
    /// machine's configuration is not available.
    /// 
    /// ***InvalidDatastore***: If the datastore cannot be found or inaccessible.
    /// 
    /// ***InvalidController***: If the specified controller cannot be found or
    /// the specified unitNumber is already taken, or
    /// the controller has no free slots.
    /// 
    /// ***MissingController***: If the virtual machine has no or more than one
    /// available controllers when controllerKey is
    /// unset.
    /// 
    /// ***DeviceUnsupportedForVmVersion***: If the virtual machine's version is
    /// incompatible for the given device.
    pub async fn attach_disk_task(&self, disk_id: &crate::types::structs::Id, datastore: &crate::types::structs::ManagedObjectReference, controller_key: Option<i32>, unit_number: Option<i32>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = AttachDiskRequestType {disk_id, datastore, controller_key, unit_number, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "AttachDisk_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Checks the customization specification against the virtual machine configuration.
    /// 
    /// For example, this is used on a source virtual machine before a clone operation to
    /// catch customization failure before the disk copy. This checks the specification's
    /// internal consistency as well as for compatibility with this virtual machine's
    /// configuration.
    /// 
    /// ***Required privileges:*** VirtualMachine.Provisioning.Customize
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// The customization specification to check.
    ///
    /// ## Errors:
    ///
    /// ***CustomizationFault***: A subclass of CustomizationFault is thrown.
    pub async fn check_customization_spec(&self, spec: &crate::types::structs::CustomizationSpec) -> Result<()> {
        let input = CheckCustomizationSpecRequestType {spec, };
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "CheckCustomizationSpec", Some(&input)).await
    }
    /// Creates a clone of this virtual machine.
    /// 
    /// If the virtual machine
    /// is used as a template, this method corresponds to the deploy command.
    /// 
    /// Any % (percent) character used in this name parameter must be escaped, unless it
    /// is used to start an escape sequence. Clients may also escape any other characters
    /// in this name parameter.
    /// 
    /// The privilege required on the source virtual machine depends on the source
    /// and destination types:
    /// - source is virtual machine, destination is virtual machine -
    ///   VirtualMachine.Provisioning.Clone
    /// - source is virtual machine, destination is template -
    ///   VirtualMachine.Provisioning.CreateTemplateFromVM
    /// - source is template, destination is virtual machine -
    ///   VirtualMachine.Provisioning.DeployTemplate
    /// - source is template, destination is template -
    ///   VirtualMachine.Provisioning.CloneTemplate
    /// - source is encrypted virtual machine - Cryptographer.Clone
    ///   
    /// If customization is requested in the CloneSpec, then the
    /// VirtualMachine.Provisioning.Customize privilege must also be
    /// held on the source virtual machine.
    /// 
    /// The Resource.AssignVMToPool privilege is also required for the
    /// resource pool specified in the CloneSpec, if the destination is not a
    /// template.
    /// The Datastore.AllocateSpace privilege is required on all datastores
    /// where the clone is created.
    ///
    /// ## Parameters:
    ///
    /// ### folder
    /// The location of the new virtual machine.
    /// 
    /// ***Required privileges:*** VirtualMachine.Inventory.CreateFromExisting
    /// 
    /// Refers instance of *Folder*.
    ///
    /// ### name
    /// The name of the new virtual machine.
    ///
    /// ### spec
    /// Specifies how to clone the virtual machine. The folder
    /// specified in the spec takes precedence over the folder parameter.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation. The *info.result* property in the
    /// *Task* contains the newly added *VirtualMachine* upon
    /// success.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: if the host cannot run this virtual machine.
    /// 
    /// ***CustomizationFault***: if a customization error happens.
    /// Typically, a specific subclass of this exception is thrown.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the operation is not supported by the current agent.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    /// 
    /// ***InvalidDatastore***: if the operation cannot be performed on the
    /// target datastores.
    /// 
    /// ***FileFault***: if there is an error accessing the virtual machine files.
    /// 
    /// ***VmConfigFault***: if the virtual machine is not compatible with the
    /// destination host. Typically, a specific subclass of this exception is
    /// thrown, such as IDEDiskNotSupported.
    /// 
    /// ***MigrationFault***: if it is not possible to migrate the virtual machine to
    /// the destination host. This is typically due to hosts being incompatible,
    /// such as mismatch in network polices or access to networks and datastores.
    /// Typically, a more specific subclass is thrown.
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a resource
    /// usage policy.
    /// 
    /// ***NoPermission***: if the virtual machine is encrypted, but encryption
    /// is not enabled on the destination and the user does not have
    /// Cryptographer.RegisterHost permission on the host.
    /// 
    /// ***NoPermission***: if source virtual machine is encrypted, but the
    /// the user does not have Cryptographer.Clone permission on it.
    pub async fn clone_vm_task(&self, folder: &crate::types::structs::ManagedObjectReference, name: &str, spec: &crate::types::structs::VirtualMachineCloneSpec) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = CloneVmRequestType {folder, name, spec, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "CloneVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Consolidate the virtual disk files of the virtual machine by finding hierarchies
    /// of redo logs that can be combined without violating data dependency.
    /// 
    /// The
    /// redundant redo logs after merging are then deleted.
    /// Consolidation improves I/O performance since less number of virtual disk
    /// files need to be traversed; it also reduces the storage usage. However
    /// additional space is temporarily required to perform the operation. Use *VirtualMachine.EstimateStorageForConsolidateSnapshots_Task* to estimate the
    /// temporary space required.
    /// Consolidation can be I/O intensive, it is advisable to invoke this operation
    /// when guest is not under heavy I/O usage.
    /// 
    /// ***Required privileges:*** VirtualMachine.State.RemoveSnapshot
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***FileFault***: if if there is a problem creating or accessing the
    /// virtual machine's files for this operation. Typically a more
    /// specific fault for example *NoDiskSpace* is
    /// thrown.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual
    /// machine configuration information is not available.
    /// 
    /// ***VmConfigFault***: if a virtual machine configuration issue prevents
    /// consolidation. Typically, a more specific fault is thrown
    /// such as *InvalidDiskFormat* if a disk cannot
    /// be read, or *InvalidSnapshotFormat* if the
    /// snapshot configuration is invalid.
    pub async fn consolidate_vm_disks_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "ConsolidateVMDisks_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Create a screen shot of a virtual machine.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.CreateScreenshot
    ///
    /// ## Returns:
    ///
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***FileFault***: if there is a problem with creating or accessing one
    /// or more files needed for this operation.
    /// 
    /// ***InvalidPowerState***: if the virtual machine is not powered on.
    /// 
    /// ***InvalidState***: if the virtual machine is not ready to respond to
    /// such requests.
    pub async fn create_screenshot_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "CreateScreenshot_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 6.0, use *VirtualMachine.CreateSecondaryVMEx_Task* instead.
    /// 
    /// Creates a secondary virtual machine to be part of this fault tolerant group.
    /// 
    /// If a host is specified, the secondary virtual machine will be created on it.
    /// Otherwise, a host will be selected by the system.
    /// 
    /// If the primary virtual machine (i.e., this virtual machine) is powered on when
    /// the secondary is created, an attempt will be made to power on the secondary on
    /// a system selected host. If the cluster is a DRS cluster, DRS will be
    /// invoked to obtain a placement for the new secondary virtual machine. If the DRS
    /// recommendation (see *ClusterRecommendation*)
    /// is automatic, it will be automatically executed. Otherwise, the recommendation will
    /// be returned to the caller of this method and the secondary will remain powered off
    /// until the recommendation is approved using *ClusterComputeResource.ApplyRecommendation*.
    /// Failure to power on the secondary virtual machine will not fail the creation of the secondary.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.CreateSecondary
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// The host where the secondary virtual machine is to be
    /// created and powered on. If no host is specified, a compatible host will be
    /// selected by the system. If a host cannot be found for the secondary or the specified
    /// host is not suitable, the secondary will not be created and a fault will be returned.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation. The *info.result* property in the
    /// *Task* returns an instance of the
    /// *FaultToleranceSecondaryOpResult* data object, which
    /// contains a reference to the created *VirtualMachine*
    /// and the status of powering it on, if attempted.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the virtual machine is marked as a template, or
    /// it is not in a vSphere HA enabled cluster.
    /// 
    /// ***InvalidState***: if the virtual machine's configuration information
    /// is not available.
    /// 
    /// ***ManagedObjectNotFound***: if a host is specified and it does not exist.
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a resource
    /// usage policy.
    /// 
    /// ***VmFaultToleranceIssue***: if any error is encountered with the
    /// fault tolerance configuration of the virtual machine. Typically,
    /// a more specific fault like FaultToleranceNotLicensed is thrown.
    /// 
    /// ***FileFault***: if there is a problem accessing the virtual machine on the
    /// filesystem.
    /// 
    /// ***VmConfigFault***: if a configuration issue prevents creating the secondary.
    /// Typically, a more specific fault such as
    /// VmConfigIncompatibleForFaultTolerance is thrown.
    pub async fn create_secondary_vm_task(&self, host: Option<&crate::types::structs::ManagedObjectReference>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = CreateSecondaryVmRequestType {host, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "CreateSecondaryVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Creates a secondary virtual machine to be part of this fault tolerant group.
    /// 
    /// If a host is specified, the secondary virtual machine will be created on it.
    /// Otherwise, a host will be selected by the system.
    /// 
    /// If a FaultToleranceConfigSpec is specified, the virtual machine's
    /// configuration files and disks will be created in the specified datastores.
    /// 
    /// If the primary virtual machine (i.e., this virtual machine) is powered on when
    /// the secondary is created, an attempt will be made to power on the secondary on
    /// a system selected host. If the cluster is a DRS cluster, DRS will be
    /// invoked to obtain a placement for the new secondary virtual machine. If the DRS
    /// recommendation (see *ClusterRecommendation*)
    /// is automatic, it will be automatically executed. Otherwise, the recommendation will
    /// be returned to the caller of this method and the secondary will remain powered off
    /// until the recommendation is approved using *ClusterComputeResource.ApplyRecommendation*.
    /// Failure to power on the secondary virtual machine will not fail the creation of the secondary.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.CreateSecondary
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// The host where the secondary virtual machine is to be
    /// created and powered on. If no host is specified, a compatible host will be
    /// selected by the system. If a host cannot be found for the secondary or the specified
    /// host is not suitable, the secondary will not be created and a fault will be returned.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ### spec
    /// This parameter *FaultToleranceVMConfigSpec* can
    /// be used to specify the storage location of the fault tolerance
    /// tie-breaker file, secondary configuration file and secondary
    /// disks.
    /// 
    /// If the virtual machine is on a vSAN datastore, then the
    /// Fault Tolerance secondary virtual machine and the tie-breaker
    /// file also have to be placed on that same vSAN datastore.
    /// Conversely, if a primary VM is not using vSAN datastore,
    /// then its Fault Tolerance secondary virtual machine can
    /// not be placed on a vSAN datastore. Fault Tolerance is not
    /// supported for VMs that are using both vSAN and non-vSAN
    /// datastores for its configuration and disks.
    /// 
    /// If the virtual machine is using persistent memory for any of
    /// its disks, then its corresponding secondary disk placement
    /// entry should not be specified in the
    /// *FaultToleranceVMConfigSpec*. The system will
    /// automatically place the corresponding secondary disk on
    /// persistent memory.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation. The *info.result* property in the
    /// *Task* returns an instance of the
    /// *FaultToleranceSecondaryOpResult* data object, which
    /// contains a reference to the created *VirtualMachine*
    /// and the status of powering it on, if attempted.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the virtual machine is marked as a template, or
    /// it is not in a vSphere HA enabled cluster.
    /// 
    /// ***InvalidState***: if the virtual machine's configuration information
    /// is not available.
    /// 
    /// ***ManagedObjectNotFound***: if a host is specified and it does not exist.
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a resource
    /// usage policy.
    /// 
    /// ***VmFaultToleranceIssue***: if any error is encountered with the
    /// fault tolerance configuration of the virtual machine. Typically,
    /// a more specific fault like FaultToleranceNotLicensed is thrown.
    /// 
    /// ***FileFault***: if there is a problem accessing the virtual machine on the
    /// filesystem.
    /// 
    /// ***VmConfigFault***: if a configuration issue prevents creating the secondary.
    /// Typically, a more specific fault such as
    /// VmConfigIncompatibleForFaultTolerance is thrown.
    pub async fn create_secondary_vm_ex_task(&self, host: Option<&crate::types::structs::ManagedObjectReference>, spec: Option<&crate::types::structs::FaultToleranceConfigSpec>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = CreateSecondaryVmExRequestType {host, spec, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "CreateSecondaryVMEx_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vSphere 8.0GA, this method is deprecated. Please
    /// use *VirtualMachine.CreateSnapshotEx_Task* instead.
    /// 
    /// Creates a new snapshot of this virtual machine.
    /// 
    /// As a side effect,
    /// this updates the current snapshot.
    /// 
    /// Snapshots are not supported for Fault Tolerance primary and secondary
    /// virtual machines.
    /// 
    /// Any % (percent) character used in this name parameter must be escaped, unless it
    /// is used to start an escape sequence. Clients may also escape any other characters
    /// in this name parameter.
    /// 
    /// ***Required privileges:*** VirtualMachine.State.CreateSnapshot
    ///
    /// ## Parameters:
    ///
    /// ### name
    /// The name for this snapshot. The name need not be unique for
    /// this virtual machine.
    ///
    /// ### description
    /// A description for this snapshot. If omitted, a default
    /// description may be provided.
    ///
    /// ### memory
    /// If TRUE, a dump of the internal state of the virtual machine
    /// (basically a memory dump) is included in the snapshot. Memory snapshots
    /// consume time and resources, and thus take longer to create. When set to FALSE,
    /// the power state of the snapshot is set to powered off.
    /// 
    /// *capabilities*
    /// indicates whether or not this virtual machine supports this operation.
    /// For a virtual machine in suspended state we always include memory
    /// unless *VirtualMachineCapability.diskOnlySnapshotOnSuspendedVMSupported* is
    /// true.
    ///
    /// ### quiesce
    /// If TRUE and the virtual machine is powered on when the
    /// snapshot is taken, VMware Tools is used to quiesce the file
    /// system in the virtual machine. This assures that a disk snapshot
    /// represents a consistent state of the guest file systems. If the virtual machine
    /// is powered off or VMware Tools are not available, the quiesce flag is ignored.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation. The *info.result* property in the
    /// *Task* contains the newly created *VirtualMachineSnapshot* upon
    /// success.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host product does not support snapshots or if the host
    /// does not support quiesced snapshots and the quiesce parameter is set to true; or
    /// if the virtual machine is a Fault Tolerance primary or secondary
    /// 
    /// ***SnapshotFault***: if an error occurs during the snapshot operation.
    /// Typically a more specific fault like MultipleSnapshotsNotSupported
    /// is thrown.
    /// 
    /// ***FileFault***: if there is a problem with creating or accessing one
    /// or more files needed for this operation.
    /// 
    /// ***VmConfigFault***: if the virtual machine's configuration is invalid.
    /// Typically, a more specific fault like InvalidSnapshotState is thrown.
    /// 
    /// ***InvalidName***: if the specified snapshot name is invalid.
    /// 
    /// ***InvalidPowerState***: if the operation cannot be performed in the current
    /// power state of the virtual machine.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, the virtual machine
    /// configuration information is not available.
    pub async fn create_snapshot_task(&self, name: &str, description: Option<&str>, memory: bool, quiesce: bool) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = CreateSnapshotRequestType {name, description, memory, quiesce, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "CreateSnapshot_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Creates a new snapshot of this virtual machine.
    /// 
    /// As a side effect,
    /// this updates the current snapshot.
    /// 
    /// Snapshots are not supported for Fault Tolerance primary and secondary
    /// virtual machines.
    /// 
    /// Any % (percent) character used in this name parameter must be escaped,
    /// unless it is used to start an escape sequence. Clients may also escape
    /// any other characters in this name parameter.
    /// 
    /// ***Required privileges:*** VirtualMachine.State.CreateSnapshot
    ///
    /// ## Parameters:
    ///
    /// ### name
    /// The name for this snapshot. The name need not be unique for
    /// this virtual machine.
    ///
    /// ### description
    /// A description for this snapshot. If omitted, a default
    /// description may be provided.
    ///
    /// ### memory
    /// If TRUE, a dump of the internal state of the virtual machine
    /// (basically a memory dump) is included in the snapshot. Memory snapshots
    /// consume time and resources, and thus take longer to create.
    /// When set to FALSE, the power state of the snapshot is set to powered off.
    /// 
    /// *capabilities*
    /// indicates whether or not this virtual machine supports this operation.
    /// For a virtual machine in suspended state we always include memory
    /// unless *VirtualMachineCapability.diskOnlySnapshotOnSuspendedVMSupported* is
    /// true.
    ///
    /// ### quiesce_spec
    /// Spec for granular control over quiesce details.
    /// If quiesceSpec is set and the virtual machine is powered on when the
    /// snapshot is taken, VMware Tools is used to quiesce the file
    /// system in the virtual machine. This assures that a disk snapshot
    /// represents a consistent state of the guest file systems. If the virtual
    /// machine is powered off or VMware Tools are not available, the quiesce
    /// spec is ignored. If the spec type is *VirtualMachineGuestQuiesceSpec*, the
    /// default quiescing process will be applied. If the spec type is
    /// *VirtualMachineWindowsQuiesceSpec* and Guest OS is Windows, the parameters
    /// will control the VSS process.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor
    /// the operation. The *info.result* property
    /// in the *Task* contains the newly created
    /// *VirtualMachineSnapshot* upon success.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: if quiesceSpec is invalid.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host product does not support snapshots or
    /// if the host does not support quiesced snapshots and the quiesce
    /// spec is set; or if the virtual machine is a Fault
    /// Tolerance primary or secondary; or if an unsupported quiesce
    /// spec is set.
    /// 
    /// ***SnapshotFault***: if an error occurs during the snapshot operation.
    /// Typically a more specific fault like MultipleSnapshotsNotSupported
    /// is thrown.
    /// 
    /// ***FileFault***: if there is a problem with creating or accessing one
    /// or more files needed for this operation.
    /// 
    /// ***VmConfigFault***: if the virtual machine's configuration is invalid.
    /// Typically, a more specific fault like InvalidSnapshotState is
    /// thrown.
    /// 
    /// ***InvalidName***: if the specified snapshot name is invalid.
    /// 
    /// ***InvalidPowerState***: if the operation cannot be performed in the
    /// current power state of the virtual machine.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, the virtual machine
    /// configuration information is not available.
    pub async fn create_snapshot_ex_task(&self, name: &str, description: Option<&str>, memory: bool, quiesce_spec: Option<&dyn crate::types::traits::VirtualMachineGuestQuiesceSpecTrait>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = CreateSnapshotExRequestType {name, description, memory, quiesce_spec, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "CreateSnapshotEx_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Unlocks an encrypted virtual machine by sending the encryption keys for
    /// the Virtual Machine Home and all the Virtual Disks to the ESX Server.
    /// 
    /// ***Required privileges:*** Cryptographer.RegisterVM
    ///
    /// ## Returns:
    ///
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: when the required Key Management Server is not
    /// configured.
    /// 
    /// ***InvalidVmState***: when the virtual machine failed to unlock.
    /// 
    /// ***NotSupported***: if the ESX server doesn't support encryption.
    pub async fn crypto_unlock_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "CryptoUnlock_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Customizes a virtual machine's guest operating system.
    /// 
    /// ***Required privileges:*** VirtualMachine.Provisioning.Customize
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// The customization specification object.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***CustomizationFault***: A subclass of CustomizationFault is thrown.
    pub async fn customize_vm_task(&self, spec: &crate::types::structs::CustomizationSpec) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = CustomizeVmRequestType {spec, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "CustomizeVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Defragment all virtual disks attached to this virtual machine.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.DefragmentAllDisks
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the virtual machine is not connected.
    /// 
    /// ***InvalidPowerState***: if the virtual machine is poweredOn.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***FileFault***: if there is an error accessing the disk files.
    pub async fn defragment_all_disks(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "DefragmentAllDisks", None).await
    }
    /// Destroys this object, deleting its contents and removing it from its parent
    /// folder (if any).
    /// 
    /// NOTE: The appropriate privilege must be held on the parent of the destroyed
    /// entity as well as the entity itself.
    /// This method can throw one of several exceptions. The exact set of exceptions
    /// depends on the kind of entity that is being removed. See comments for
    /// each entity for more information on destroy behavior.
    /// 
    /// ***Required privileges:*** VirtualMachine.Inventory.Delete
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// Failure
    pub async fn destroy_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "Destroy_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Detach a disk from this virtual machine.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.RemoveDisk
    ///
    /// ## Parameters:
    ///
    /// ### disk_id
    /// The ID of the virtual disk to be operated. See
    /// *ID*
    ///
    /// ## Returns:
    ///
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotFound***: if the disk object cannot be found.
    /// 
    /// ***VmConfigFault***: if the virtual machine's configuration is invalid.
    /// 
    /// ***FileFault***: if there is a problem creating or accessing the virtual
    /// machine's files for this operation.
    /// 
    /// ***InvalidState***: if the operation cannot be performed in the current
    /// state of the virtual machine. For example, because the virtual
    /// machine's configuration is not available.
    pub async fn detach_disk_task(&self, disk_id: &crate::types::structs::Id) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = DetachDiskRequestType {disk_id, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "DetachDisk_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Disables the specified secondary virtual machine in this fault tolerant group.
    /// 
    /// The specified secondary will not be automatically started on a subsequent
    /// power-on of the primary virtual machine.
    /// This operation could leave the primary virtual machine in a non-fault
    /// tolerant state.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.DisableSecondary
    ///
    /// ## Parameters:
    ///
    /// ### vm
    /// The secondary virtual machine specified will be disabed.
    /// This field must specify a secondary virtual machine that is part of the fault
    /// tolerant group that this virtual machine is currently associated with. It can
    /// only be invoked from the primary virtual machine in the group.
    /// 
    /// Refers instance of *VirtualMachine*.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***VmFaultToleranceIssue***: if any error is encountered with the
    /// fault tolerance configuration of the virtual machine. Typically,
    /// a more specific fault like InvalidOperationOnSecondaryVm is thrown.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the host is in maintenance mode or if
    /// the virtual machine's configuration information is not available.
    pub async fn disable_secondary_vm_task(&self, vm: &crate::types::structs::ManagedObjectReference) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = DisableSecondaryVmRequestType {vm, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "DisableSecondaryVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Force the virtual machine to drop the specified connections.
    /// 
    /// Attempt to drop the specified virtual machine connections. An attempt
    /// will be made to drop all of the specified connections before returning.
    /// 
    /// ***Since:*** vSphere API Release 7.0.1.0
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.ConsoleInteract
    ///
    /// ## Parameters:
    ///
    /// ### list_of_connections
    /// -
    ///
    /// ## Returns:
    ///
    /// true All of the specified connections have been dropped.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: If the virtual machine is not powered on.
    /// No connection drop actions will have been
    /// attempted if this is thrown.
    pub async fn drop_connections(&self, list_of_connections: Option<&[Box<dyn crate::types::traits::VirtualMachineConnectionTrait>]>) -> Result<bool> {
        let input = DropConnectionsRequestType {list_of_connections, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "DropConnections", Some(&input)).await?;
        let result: bool = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Enables the specified secondary virtual machine in this fault tolerant group.
    /// 
    /// This operation is used to enable a secondary virtual machine that was
    /// previously disabled by the *VirtualMachine.DisableSecondaryVM_Task*
    /// call. The specified secondary will be automatically started whenever the
    /// primary is powered on.
    /// 
    /// If the primary virtual machine (i.e., this virtual machine) is powered on when
    /// the secondary is enabled, an attempt will be made to power on the secondary. If
    /// a host was specified in the method call, this host will be used. If a host is
    /// not specified, one will be selected by the system. In the latter case, if the cluster
    /// is a DRS cluster, DRS will be invoked to obtain a placement for the new secondary
    /// virtual machine. If the DRS recommendation (see *ClusterRecommendation*)
    /// is automatic, it will be executed. Otherwise, the recommendation will be
    /// returned to the caller of this method and the secondary will remain powered off
    /// until the recommendation is approved using *ClusterComputeResource.ApplyRecommendation*.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.EnableSecondary
    ///
    /// ## Parameters:
    ///
    /// ### vm
    /// The secondary virtual machine specified will be enabled.
    /// This field must specify a secondary virtual machine that is part of the fault
    /// tolerant group that this virtual machine is currently associated with. It can
    /// only be invoked from the primary virtual machine in the group.
    /// 
    /// Refers instance of *VirtualMachine*.
    ///
    /// ### host
    /// The host on which the secondary virtual machine is to be
    /// enabled and possibly powered on. If no host is specified, a compatible host
    /// will be selected by the system. If the secondary virtual machine is not
    /// compatible with the specified host, the secondary will not be re-enabled
    /// and a fault will be returned.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation. The *info.result* property in the
    /// *Task* returns an instance of the
    /// *FaultToleranceSecondaryOpResult* data object, which
    /// contains a reference to the *VirtualMachine*
    /// and the status of powering it on, if attempted.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***VmConfigFault***: if a configuration issue prevents enabling the secondary.
    /// Typically, a more specific fault such as
    /// VmConfigIncompatibleForFaultTolerance is thrown.
    /// 
    /// ***VmFaultToleranceIssue***: if any error is encountered with the
    /// fault tolerance configuration of the virtual machine. Typically,
    /// a more specific fault like InvalidOperationOnSecondaryVm is thrown.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***ManagedObjectNotFound***: if a host is specified and it does not exist.
    /// 
    /// ***InvalidState***: if the virtual machine's configuration information is not
    /// available, if the secondary virtual machine is not disabled, or if a
    /// power-on is attempted and one is already in progress.
    pub async fn enable_secondary_vm_task(&self, vm: &crate::types::structs::ManagedObjectReference, host: Option<&crate::types::structs::ManagedObjectReference>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = EnableSecondaryVmRequestType {vm, host, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "EnableSecondaryVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Estimate the temporary space required to consolidation disk
    /// files.
    /// 
    /// The estimation is a lower bound if the childmost writable disk
    /// file will be consolidated for an online virtual machine, it is
    /// accurate for all other situations. This is because the space
    /// requirement depending on the size of the childmost disk file and how
    /// write intensive the guest is.
    /// 
    /// This method can be used prior to invoke consolidation via
    /// *VirtualMachine.ConsolidateVMDisks_Task*.
    /// 
    /// ***Required privileges:*** VirtualMachine.State.RemoveSnapshot
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    /// 
    /// ***FileFault***: if if there is a problem accessing the
    /// virtual machine's files for this operation. Typically a more
    /// specific fault *FileLocked* is thrown.
    /// 
    /// ***VmConfigFault***: if a virtual machine configuration issue prevents
    /// the estimation. Typically, a more specific fault is thrown.
    pub async fn estimate_storage_for_consolidate_snapshots_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "EstimateStorageForConsolidateSnapshots_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Obtains an export lease on this virtual machine.
    /// 
    /// The export lease contains
    /// a list of URLs for the virtual disks for this virtual machine, as well as
    /// a ticket giving access to the URLs.
    /// 
    /// See *HttpNfcLease* for information on how to use the lease.
    /// 
    /// ***Required privileges:*** VApp.Export
    ///
    /// ## Returns:
    ///
    /// The export lease on this *VirtualMachine*. The
    /// export task continues running until the lease is completed by the
    /// caller.
    /// 
    /// Refers instance of *HttpNfcLease*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the virtual machine is powered on.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    /// 
    /// ***FileFault***: if there is an error accessing the virtual machine files.
    pub async fn export_vm(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "ExportVm", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Returns the OVF environment for a virtual machine.
    /// 
    /// If the virtual machine has no
    /// vApp configuration, an empty string is returned. Also, sensitive information
    /// is omitted, so this method is not guaranteed to return the complete OVF
    /// environment.
    /// 
    /// ***Required privileges:*** VApp.ExtractOvfEnvironment
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the virtual machine is not running
    pub async fn extract_ovf_environment(&self) -> Result<String> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "ExtractOvfEnvironment", None).await?;
        let result: String = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Creates a powered-on Instant Clone of a virtual machine.
    /// 
    /// The new
    /// virtual machine will be created on the same host and start with the
    /// identical running point as the original virtual machine, sharing memory
    /// state when possible and sharing disk state.
    /// The original virtual machine must be in a powered-on state.
    /// The privilege required for Instant Clone operation are:
    /// - VirtualMachine.Provisioning.Clone
    /// - VirtualMachine.Interact.PowerOn
    /// - VirtualMachine.Inventory.CreateFromExisting
    /// - Datastore.AllocateSpace
    /// - Resource.AssignVMToPool
    ///   
    /// ***Required privileges:*** VirtualMachine.Provisioning.Clone
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// Is a *VirtualMachineInstantCloneSpec*. It specifies the
    /// cloned virtual machine's configuration.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor
    /// the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: in the following cases:
    /// - Source virtual machine is not powered on
    /// - Source virtual machine configuration is not supported for
    ///   Instant Clone operation
    /// - Relocation specification has unsupported settings 
    ///   
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// host or virtual machine's current state. For example, if the host
    /// is in maintenance mode or if the source virtual machine is not
    /// powered on.
    /// 
    /// ***InvalidDatastore***: if the operation cannot be performed on the
    /// target datastores.
    /// 
    /// ***FileFault***: if there is an error accessing the virtual machine
    /// files.
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a
    /// resource usage policy.
    /// 
    /// ***DisallowedMigrationDeviceAttached***: if any of the devices attached
    /// to the source virtual machine are not supported for the Instant
    /// Clone operation or if device change specification contains
    /// changes that are not supported.
    pub async fn instant_clone_task(&self, spec: &crate::types::structs::VirtualMachineInstantCloneSpec) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = InstantCloneRequestType {spec, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "InstantClone_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Makes the specified secondary virtual machine from this fault tolerant group as
    /// the primary virtual machine.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.MakePrimary
    ///
    /// ## Parameters:
    ///
    /// ### vm
    /// The secondary virtual machine specified will be made the primary
    /// virtual machine.
    /// This field must specify a secondary virtual machine that is part of the fault
    /// tolerant group that this virtual machine is currently associated with. It can
    /// only be invoked from the primary virtual machine in the group.
    /// 
    /// Refers instance of *VirtualMachine*.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***VmFaultToleranceIssue***: if any error is encountered with the
    /// fault tolerance configuration of the virtual machine. Typically,
    /// a more specific fault like InvalidOperationOnSecondaryVm is thrown.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the host is in maintenance mode or if
    /// the virtual machine's configuration information is not available.
    pub async fn make_primary_vm_task(&self, vm: &crate::types::structs::ManagedObjectReference) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = MakePrimaryVmRequestType {vm, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "MakePrimaryVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Marks a VirtualMachine object as being used as a template.
    /// 
    /// Note: A VirtualMachine marked as a template cannot be powered on.
    /// 
    /// ***Required privileges:*** VirtualMachine.Provisioning.MarkAsTemplate
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: if marking a virtual machine as a template is not supported.
    /// 
    /// ***InvalidPowerState***: if the virtual machine is not powered off.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    /// 
    /// ***VmConfigFault***: if the template is incompatible with the host, such
    /// as the files are not accessible.
    /// 
    /// ***FileFault***: if there is an error accessing the virtual machine files.
    pub async fn mark_as_template(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "MarkAsTemplate", None).await
    }
    /// Clears the 'isTemplate' flag and reassociates the virtual machine with
    /// a resource pool and host.
    /// 
    /// ***Required privileges:*** VirtualMachine.Provisioning.MarkAsVM
    ///
    /// ## Parameters:
    ///
    /// ### pool
    /// Resource pool to associate with the virtual machine.
    /// 
    /// ***Required privileges:*** Resource.AssignVMToPool
    /// 
    /// Refers instance of *ResourcePool*.
    ///
    /// ### host
    /// The target host on which the virtual machine is intended to run. The
    /// host
    /// parameter must specify a host that is a member of the ComputeResource
    /// indirectly specified by the pool. For a stand-alone host or a cluster with
    /// DRS, it can be omitted and the system selects a default.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: if marking a template as a virtual machine is not
    /// supported.
    /// 
    /// ***InvalidState***: if the virtual machine is not marked as a template.
    /// 
    /// ***InvalidDatastore***: if the operation cannot be performed on the
    /// target datastores.
    /// 
    /// ***VmConfigFault***: if the virtual machine is not compatible with the
    /// host. For example, a DisksNotSupported fault if the destination host
    /// does not support the disk backings of the template.
    /// 
    /// ***FileFault***: if there is an error accessing the virtual machine files.
    pub async fn mark_as_virtual_machine(&self, pool: &crate::types::structs::ManagedObjectReference, host: Option<&crate::types::structs::ManagedObjectReference>) -> Result<()> {
        let input = MarkAsVirtualMachineRequestType {pool, host, };
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "MarkAsVirtualMachine", Some(&input)).await
    }
    /// Deprecated as of vSphere 6.5, use *VirtualMachine.RelocateVM_Task*
    /// instead.
    /// 
    /// Migrates a virtual machine's execution to a specific resource pool or host.
    /// 
    /// Requires Resource.HotMigrate privilege if the virtual machine is powered on or
    /// Resource.ColdMigrate privilege if the virtual machine is powered off or
    /// suspended.
    ///
    /// ## Parameters:
    ///
    /// ### pool
    /// The target resource pool for the virtual machine. If the pool
    /// parameter is left unset, the virtual machine's current pool is used
    /// as the target pool.
    /// 
    /// ***Required privileges:*** Resource.AssignVMToPool
    /// 
    /// Refers instance of *ResourcePool*.
    ///
    /// ### host
    /// The target host to which the virtual machine is intended to migrate.
    /// The host parameter
    /// may be left unset if the compute resource associated with the
    /// target pool represents a stand-alone host or a DRS-enabled cluster.
    /// In the former case the stand-alone host is used as the target host.
    /// In the latter case, the DRS system selects an appropriate
    /// target host from the cluster.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ### priority
    /// The task priority (@see vim.VirtualMachine.MovePriority).
    ///
    /// ### state
    /// If specified, the virtual machine migrates only if
    /// its state matches the specified state.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: if the virtual machine is marked as a template.
    /// 
    /// ***InvalidArgument***: in the following cases:
    /// - the target host and target pool are not associated with the
    ///   same compute resource
    /// - the host parameter is left unset when the target pool is
    ///   associated with a non-DRS cluster
    ///   
    /// ***InvalidPowerState***: if the state argument is set and the virtual
    /// machine does not have that power state.
    /// 
    /// ***FileFault***: if, in a case where the virtual machine
    /// configuration file must be copied, the destination location for
    /// that file does not have the necessary file access permissions.
    /// 
    /// ***VmConfigFault***: if the virtual machine is not compatible with the
    /// destination host. Typically, a specific subclass of this exception is
    /// thrown, such as IDEDiskNotSupported.
    /// 
    /// ***MigrationFault***: if it is not possible to migrate the virtual machine to
    /// the destination host. This is typically due to hosts being incompatible,
    /// such as mismatch in network polices or access to networks and datastores.
    /// Typically, a more specific subclass is thrown.
    /// 
    /// ***Timedout***: if one of the phases of the migration process times out.
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a resource
    /// usage policy.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state or the target host's current state.
    /// For example, if the virtual machine configuration information is not
    /// available or if the target host is disconnected or in maintenance mode.
    /// 
    /// ***NoActiveHostInCluster***: if a target host is not specified and the
    /// cluster associated with the target pool does not contain at least one
    /// potential target host. A host must be connected and not in maintenance
    /// mode in order to be considered as a potential target host.
    /// 
    /// ***NoPermission***: if the virtual machine is encrypted, but encryption is
    /// not enabled on the destination host and the user does not have
    /// Cryptographer.RegisterHost permission on it.
    /// 
    /// ***NoPermission***: if the virtual machine is encrypted, but the
    /// the user does not have Cryptographer.Migrate permission on the VM.
    pub async fn migrate_vm_task(&self, pool: Option<&crate::types::structs::ManagedObjectReference>, host: Option<&crate::types::structs::ManagedObjectReference>, priority: crate::types::enums::VirtualMachineMovePriorityEnum, state: Option<crate::types::enums::VirtualMachinePowerStateEnum>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = MigrateVmRequestType {pool, host, priority, state, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "MigrateVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Mounts the VMware Tools CD installer as a CD-ROM for the guest operating system.
    /// 
    /// To monitor the status of the tools install, clients should check the tools status,
    /// *GuestInfo.toolsVersionStatus* and
    /// *GuestInfo.toolsRunningStatus*
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.ToolsInstall
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the virtual machine is not running,
    /// or the VMware Tools CD is already mounted.
    /// 
    /// ***VmToolsUpgradeFault***: if the VMware Tools CD failed to mount.
    pub async fn mount_tools_installer(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "MountToolsInstaller", None).await
    }
    /// Powers off this virtual machine.
    /// 
    /// If this virtual machine is a fault tolerant primary virtual machine, this
    /// will result in the secondary virtual machine(s) getting powered off as well.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.PowerOff
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is not poweredOn.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the virtual machine is marked as a template.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    pub async fn power_off_vm_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "PowerOffVM_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Powers on this virtual machine.
    /// 
    /// If the virtual machine is suspended,
    /// this method resumes execution from the suspend point.
    /// 
    /// When powering on a virtual machine in a cluster, the system might implicitly
    /// or due to the host argument, do an implicit relocation of the virtual machine
    /// to another host. Hence, errors related to this relocation can be thrown. If the
    /// cluster is a DRS cluster, DRS will be invoked if the virtual machine can be
    /// automatically placed by DRS (see *DrsBehavior_enum*).
    /// Because this method does not return a DRS *ClusterRecommendation*, no
    /// vmotion nor host power operations will be done as part of a DRS-facilitated power
    /// on. To have DRS consider such operations use *Datacenter.PowerOnMultiVM_Task*.
    /// As of vSphere API 5.1, use of this method with vCenter Server is deprecated;
    /// use *Datacenter.PowerOnMultiVM_Task* instead.
    /// 
    /// If this virtual machine is a fault tolerant primary virtual machine, its
    /// secondary virtual machines will be started on system-selected
    /// hosts. If the virtual machines are in a VMware DRS enabled cluster,
    /// then DRS will be invoked to obtain placements for the secondaries but
    /// no vmotion nor host power operations will be considered for these power ons.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.PowerOn
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// (optional) The host where the virtual machine is to be powered on.
    /// If no host is specified, the current associated host is used. This field must
    /// specify a host that is part of the same compute resource that the virtual machine
    /// is currently associated with. If this host is not compatible, the current host
    /// association is used.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is poweredOn.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotEnoughLicenses***: if there are not enough licenses to power on this
    /// virtual machine.
    /// 
    /// ***NotSupported***: if the virtual machine is marked as a template.
    /// 
    /// ***InvalidState***: if the host is in maintenance mode or if
    /// the virtual machine's configuration information is not available
    /// or if the virtual machine is already powering on
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a resource
    /// usage policy.
    /// 
    /// ***VmConfigFault***: if a configuration issue prevents the power-on.
    /// Typically, a more specific fault, such as UnsupportedVmxLocation, is
    /// thrown.
    /// 
    /// ***FileFault***: if there is a problem accessing the virtual machine on the
    /// filesystem.
    /// 
    /// ***DisallowedOperationOnFailoverHost***: if the host specified is a failover
    /// host. See *ClusterFailoverHostAdmissionControlPolicy*.
    pub async fn power_on_vm_task(&self, host: Option<&crate::types::structs::ManagedObjectReference>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = PowerOnVmRequestType {host, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "PowerOnVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Promotes disks on this virtual machine that have delta disk backings.
    /// 
    /// A delta disk backing is a way to preserve a virtual disk backing
    /// at some point in time. A delta disk backing is a file backing which in
    /// turn points to the original virtual disk backing (the parent). After a delta
    /// disk backing is added, all writes go to the delta disk backing. All reads
    /// first try the delta disk backing and then try the parent backing if needed.
    /// 
    /// Promoting does two things
    /// 1. If the unlink parameter is true, any disk backing which is shared
    ///    shared by multiple virtual machines is copied so that this virtual machine
    ///    has its own unshared version. Copied files always end up in the virtual
    ///    machine's home directory. To promote the disks of a powered on VM,
    ///    the VM cannot have snapshots.
    /// 2. Any disk backing which is not shared between multiple virtual
    ///    machines and is not associated with a snapshot is consolidated
    ///    with its child backing.
    ///    
    /// If the unlink parameter is true, the net effect of this operation is improved
    /// read performance, at the cost of disk space. If the unlink parameter is
    /// false the net effect is improved read performance at the cost of inhibiting
    /// future sharing.
    /// 
    /// This operation is only supported if
    /// *HostCapability.deltaDiskBackingsSupported* is true.
    /// 
    /// This operation is only supported on VirtualCenter. If no work is required,
    /// an invocation completes successfully.
    /// 
    /// ***Required privileges:*** VirtualMachine.Provisioning.PromoteDisks
    ///
    /// ## Parameters:
    ///
    /// ### unlink
    /// If true, then these disks will be unlinked before consolidation.
    ///
    /// ### disks
    /// The set of disks that are to be promoted.
    /// If this value is unset or the array is empty,
    /// all disks which have delta disk backings are promoted.
    ///
    /// ## Returns:
    ///
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host doesn't support disk promotion APIs.
    /// 
    /// ***InvalidState***: if the virtual machine's power state changes
    /// during the execution of this method.
    /// 
    /// ***InvalidState***: if the virtual machine is not ready to respond to
    /// such requests.
    pub async fn promote_disks_task(&self, unlink: bool, disks: Option<&[crate::types::structs::VirtualDisk]>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = PromoteDisksRequestType {unlink, disks, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "PromoteDisks_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Inject a sequence of USB HID scan codes into the keyboard.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.PutUsbScanCodes
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// -
    ///
    /// ## Returns:
    ///
    /// Number of keys injected.
    pub async fn put_usb_scan_codes(&self, spec: &crate::types::structs::UsbScanCodeSpec) -> Result<i32> {
        let input = PutUsbScanCodesRequestType {spec, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "PutUsbScanCodes", Some(&input)).await?;
        let result: i32 = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Get a list of areas of a virtual disk belonging to this VM that have
    /// been modified since a well-defined point in the past.
    /// 
    /// The beginning of
    /// the change interval is identified by "changeId", while the end of the
    /// change interval is implied by the snapshot ID passed in.
    /// 
    /// Note that the result of this function may contain "false positives"
    /// (i.e: flag areas of the disk as modified that are not). However, it is
    /// guaranteed that no changes will be missed.
    /// 
    /// ***Required privileges:*** VirtualMachine.Provisioning.DiskRandomRead
    ///
    /// ## Parameters:
    ///
    /// ### snapshot
    /// Snapshot for which changes that have been made sine
    /// "changeId" should be computed. If not set, changes are computed
    /// against the "current" snapshot of the virtual machine. However,
    /// using the "current" snapshot will only work for virtual machines
    /// that are powered off.
    /// 
    /// Refers instance of *VirtualMachineSnapshot*.
    ///
    /// ### device_key
    /// Identifies the virtual disk for which to compute changes.
    ///
    /// ### start_offset
    /// Start Offset in bytes at which to start computing changes.
    /// Typically, callers will make multiple calls to this function, starting
    /// with startOffset 0 and then examine the "length" property in the
    /// returned DiskChangeInfo structure, repeatedly calling queryChangedDiskAreas
    /// until a map forthe entire virtual disk has been obtained.
    ///
    /// ### change_id
    /// Identifyer referring to a point in the past that should be used
    /// as the point in time at which to begin including changes to the disk in
    /// the result. A typical use case would be a backup application obtaining a
    /// changeId from a virtual disk's backing info when performing a
    /// backup. When a subsequent incremental backup is to be performed, this
    /// change Id can be used to obtain a list of changed areas on disk.
    ///
    /// ## Returns:
    ///
    /// Returns a data structure specifying extents of the virtual disk that
    /// have changed since the thime the changeId string was obtained.
    ///
    /// ## Errors:
    ///
    /// ***NotFound***: if the snapshot specified does not exist.
    /// 
    /// ***InvalidArgument***: if deviceKey does not specify a virtual disk, startOffset
    /// is beyond the end of the virtual disk or changeId is invalid or change
    /// tracking is not supported for this particular disk.
    /// 
    /// ***FileFault***: if the virtual disk files cannot be accessed/queried.
    pub async fn query_changed_disk_areas(&self, snapshot: Option<&crate::types::structs::ManagedObjectReference>, device_key: i32, start_offset: i64, change_id: &str) -> Result<crate::types::structs::DiskChangeInfo> {
        let input = QueryChangedDiskAreasRequestType {snapshot, device_key, start_offset, change_id, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "QueryChangedDiskAreas", Some(&input)).await?;
        let result: crate::types::structs::DiskChangeInfo = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Ask the virtual machine for a list of connections.
    /// 
    /// The virtual machine returns a list of connections.
    /// It is possible for the array returned to be empty - a virtual machine
    /// may have no connections.
    /// 
    /// ***Since:*** vSphere API Release 7.0.1.0
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.ConsoleInteract
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: If the virtual machine is not powered on.
    /// 
    /// ***Timedout***: If the the virtual machine did not respond
    /// to the request in a timely manner.
    /// 
    /// ***VmConfigFault***: If an error occurred.
    pub async fn query_connections(&self) -> Result<Option<Vec<Box<dyn crate::types::traits::VirtualMachineConnectionTrait>>>> {
        let bytes_opt = self.client.invoke_optional("", "VirtualMachine", &self.mo_id, "QueryConnections", None).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Deprecated as of vSphere API 6.0.
    /// 
    /// This API can be invoked to determine whether a virtual machine is
    /// compatible for legacy Fault Tolerance.
    /// 
    /// The API only checks for
    /// VM-specific factors that impact compatibility for RecordReplay based
    /// Fault Tolerance. Other requirements for Fault Tolerance such as host
    /// processor compatibility, logging nic configuration and licensing are
    /// not covered by this API.
    /// The query returns a list of faults, each fault corresponding to a
    /// specific incompatibility. If a given virtual machine is
    /// compatible for Fault Tolerance, then the fault list returned will be
    /// empty.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.QueryFTCompatibility
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the operation cannot be performed because of
    /// the virtual machine's current state.
    /// 
    /// ***VmConfigFault***: if the virtual machine's configuration is invalid.
    /// 
    /// ***NotSupported***: if the virtual machine is a template or this operation
    /// is not supported.
    pub async fn query_fault_tolerance_compatibility(&self) -> Result<Option<Vec<crate::types::structs::MethodFault>>> {
        let bytes_opt = self.client.invoke_optional("", "VirtualMachine", &self.mo_id, "QueryFaultToleranceCompatibility", None).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// This API can be invoked to determine whether a virtual machine is
    /// compatible for Fault Tolerance.
    /// 
    /// The API only checks for VM-specific
    /// factors that impact compatibility for Fault Tolerance. Other
    /// requirements for Fault Tolerance such as host processor compatibility,
    /// logging nic configuration and licensing are not covered by this API.
    /// The query returns a list of faults, each fault corresponding to a
    /// specific incompatibility. If a given virtual machine is
    /// compatible for Fault Tolerance, then the fault list returned will be
    /// empty.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.QueryFTCompatibility
    ///
    /// ## Parameters:
    ///
    /// ### for_legacy_ft
    /// checks for legacy record-replay FT compatibility only
    /// if this is set to true.
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the operation cannot be performed because of
    /// the virtual machine's current state.
    /// 
    /// ***VmConfigFault***: if the virtual machine's configuration is invalid.
    /// 
    /// ***NotSupported***: if the virtual machine is a template or this operation
    /// is not supported.
    pub async fn query_fault_tolerance_compatibility_ex(&self, for_legacy_ft: Option<bool>) -> Result<Option<Vec<crate::types::structs::MethodFault>>> {
        let input = QueryFaultToleranceCompatibilityExRequestType {for_legacy_ft, };
        let bytes_opt = self.client.invoke_optional("", "VirtualMachine", &self.mo_id, "QueryFaultToleranceCompatibilityEx", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// For all files that belong to the vm, check that the file owner
    /// is set to the current datastore principal user, as set by
    /// *HostDatastoreSystem.ConfigureDatastorePrincipal*
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.QueryUnownedFiles
    ///
    /// ## Returns:
    ///
    /// The list of file paths for vm files whose ownership is
    /// not correct.
    /// Use *FileManager.ChangeOwner* to set the file ownership.
    pub async fn query_unowned_files(&self) -> Result<Option<Vec<String>>> {
        let bytes_opt = self.client.invoke_optional("", "VirtualMachine", &self.mo_id, "QueryUnownedFiles", None).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Issues a command to the guest operating system asking it to perform
    /// a reboot.
    /// 
    /// Returns immediately and does not wait for the guest operating system
    /// to complete the operation.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.Reset
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is not powered on.
    /// 
    /// ***ToolsUnavailable***: if VMware Tools is not running.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    pub async fn reboot_guest(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "RebootGuest", None).await
    }
    /// Reconfigures this virtual machine.
    /// 
    /// All the changes in the given configuration
    /// are applied to the virtual machine as an atomic operation.
    /// 
    /// Reconfiguring the virtual machine may require any of the following privileges
    /// depending on what is being changed:
    /// - VirtualMachine.Interact.DeviceConnection if changing the runtime connection
    ///   state of a device as embodied by the Connectable property.
    /// - VirtualMachine.Interact.SetCDMedia if changing the backing of a CD-ROM
    ///   device
    /// - VirtualMachine.Interact.SetFloppyMedia if changing the backing of a
    ///   floppy device
    /// - VirtualMachine.Config.Rename if renaming the virtual machine
    /// - VirtualMachine.Config.Annotation if setting annotation a value
    /// - VirtualMachine.Config.AddExistingDisk if adding a virtual disk device
    ///   that is backed by an existing virtual disk file
    /// - VirtualMachine.Config.AddNewDisk if adding a virtual disk device for which
    ///   the backing virtual disk file is to be created
    /// - VirtualMachine.Config.RemoveDisk if removing a virtual disk device that
    ///   refers to a virtual disk file
    /// - VirtualMachine.Config.CPUCount if changing the number of CPUs
    /// - VirtualMachine.Config.Memory if changing the amount of memory
    /// - VirtualMachine.Config.RawDevice if adding, removing or editing a raw
    ///   device mapping (RDM) or SCSI passthrough device
    /// - VirtualMachine.Config.AddRemoveDevice if adding or removing any
    ///   device other than disk, raw, or USB device
    /// - VirtualMachine.Config.EditDevice if changing the settings of any
    ///   device
    /// - VirtualMachine.Config.Settings if changing any basic settings such as
    ///   those in ToolsConfigInfo, FlagInfo, or DefaultPowerOpInfo
    /// - VirtualMachine.Config.Resource if changing resource allocations,
    ///   affinities, or setting network traffic shaping or virtual disk shares
    /// - VirtualMachine.Config.AdvancedConfig if changing values in
    ///   extraConfig
    /// - VirtualMachine.Config.SwapPlacement if changing swapPlacement
    /// - VirtualMachine.Config.HostUSBDevice if adding, removing or editing a
    ///   VirtualUSB device backed by the host USB device.
    /// - VirtualMachine.Config.DiskExtend if extending an existing VirtualDisk
    ///   device.
    /// - VirtualMachine.Config.ChangeTracking if enabling/disabling changed
    ///   block tracking for the virtual machine's disks.
    /// - VirtualMachine.Config.MksControl if toggling display connection
    ///   limits or the guest auto-lock feature.
    /// - DVSwitch.CanUse if connecting a VirtualEthernetAdapter to a port
    ///   in a DistributedVirtualSwitch.
    /// - DVPortgroup.CanUse if connecting a VirtualEthernetAdapter to a
    ///   DistributedVirtualPortgroup.
    /// - Cryptographer.Encrypt if vm home folder is encrypted or existing
    ///   disk is encryted.
    /// - Cryptographer.Decrypt if vm home folder is decrypted or existing
    ///   disk is decryted.
    /// - Cryptographer.Recrypt if vm home folder is recrypted or existing
    ///   disk is recryted.
    /// - Cryptographer.AddDisk if encrypted disk is attached to the vm.
    /// - Cryptographer.RegisterHost on the host if the virtual machine is
    ///   encrypted, but encryption is not enabled on the host.
    ///   
    /// Creating a virtual machine may require the following privileges:
    /// - VirtualMachine.Config.RawDevice if adding a raw device
    /// - VirtualMachine.Config.AddExistingDisk if adding a VirtualDisk and
    ///   the fileOperation is unset
    /// - VirtualMachine.Config.AddNewDisk if adding a VirtualDisk and
    ///   the fileOperation is set
    /// - VirtualMachine.Config.HostUSBDevice if adding a VirtualUSB device
    ///   backed by the host USB device.
    ///   
    /// In addition, this operation may require the following privileges:
    /// - Datastore.AllocateSpace on any datastore where virtual disks will
    ///   be created or extended.
    /// - Network.Assign on any network the virtual machine will be
    ///   connected to.
    ///   
    /// To create a VirtualDisk on a persistent memory storage, the storage
    /// must be specified via
    /// *profile* while the datastore
    /// property of corresponding VirtualDisk backing must be unset.
    /// 
    /// To create a VirtualNVDIMM device, the storage
    /// *profile* must be set to the
    /// default persistent memory storage profile while the datastore property of
    /// *the device backing* must be
    /// unset.
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// The new configuration values.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is poweredOn and the virtual hardware
    /// cannot support the configuration changes.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***TooManyDevices***: if the device specifications exceed the allowed limits.
    /// 
    /// ***ConcurrentAccess***: if the changeVersion does not match the server's
    /// changeVersion for the configuration.
    /// 
    /// ***FileFault***: if there is a problem creating or accessing the virtual machine's
    /// files for this operation. Typically a more specific fault like NoDiskSpace
    /// or FileAlreadyExists is thrown.
    /// 
    /// ***InvalidName***: if the specified name is invalid.
    /// 
    /// ***DuplicateName***: if the specified name already exists in the parent folder.
    /// 
    /// ***InvalidState***: if the operation cannot be performed in the current state
    /// of the virtual machine. For example, because the virtual machine's
    /// configuration is not available.
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a resource
    /// usage policy.
    /// 
    /// ***VmConfigFault***: if the spec is invalid. Typically, a more specific subclass
    /// is thrown.
    /// 
    /// ***CpuHotPlugNotSupported***: if the current configuration of the VM does not
    /// support hot-plugging of CPUs.
    /// 
    /// ***MemoryHotPlugNotSupported***: if the current configuration of the VM does not
    /// support hot-plugging of memory.
    /// 
    /// ***VmWwnConflict***: if the WWN of the virtual machine has been used by
    /// other virtual machines.
    /// 
    /// ***NoPermission***: if crypto operation is requested on the vm home
    /// folder, but the user does not have the corresponding crypto
    /// privilege on the virtual machine:
    /// Encrypt - Cryptographer.Encrypt
    /// Decrypt - Cryptographer.Decrypt
    /// Recrypt - Cryptographer.Recrypt
    /// 
    /// ***NoPermission***: if crypto operation is requested on the vms disks,
    /// but the user does not have the corresponding crypto privilege
    /// on the virtual machine:
    /// Encrypt - Cryptographer.Encrypt
    /// Decrypt - Cryptographer.Decrypt
    /// Recrypt - Cryptographer.Recrypt
    /// AddDisk - Cryptographer.AddDisk
    /// 
    /// ***NoPermission***: if the virtual machine is encrypted and the
    /// encryption is not enabled on the host, but the user does not have
    /// Cryptographer.RegisterHost privilege on the host.
    pub async fn reconfig_vm_task(&self, spec: &crate::types::structs::VirtualMachineConfigSpec) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = ReconfigVmRequestType {spec, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "ReconfigVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Explicitly refreshes the storage information of this virtual machine,
    /// updating properties *VirtualMachine.storage*, *VirtualMachine.layoutEx*
    /// and *VirtualMachineSummary.storage*.
    /// 
    /// This is an asynchronous operation which will return immediately; changes
    /// may not be reflected in vCenter for some time.
    /// 
    /// ***Required privileges:*** System.Read
    pub async fn refresh_storage_info(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "RefreshStorageInfo", None).await
    }
    /// Reload the entity state.
    /// 
    /// Clients only need to call this method
    /// if they changed some external state that affects the service
    /// without using the Web service interface to perform the change.
    /// For example, hand-editing a virtual machine configuration file
    /// affects the configuration of the associated virtual machine but
    /// the service managing the virtual machine might not monitor the
    /// file for changes. In this case, after such an edit, a client
    /// would call "reload" on the associated virtual machine to ensure
    /// the service and its clients have current data for the
    /// virtual machine.
    /// 
    /// ***Required privileges:*** System.Read
    pub async fn reload(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "Reload", None).await
    }
    /// Reloads the configuration for this virtual machine from a given
    /// datastore path.
    /// 
    /// This is equivalent to unregistering and registering the
    /// virtual machine from a different path. The virtual machine's hardware
    /// configuration, snapshots, guestinfo variables etc. will be
    /// replaced based on the new configuration file. Other information
    /// associated with the virtual machine object, such as events and
    /// permissions, will be preserved.
    /// 
    /// This method is only supported on vCenter Server. It can be invoked on
    /// inaccessible or orphaned virtual machines, but it cannot be invoked on
    /// powered on, connected virtual machines. Both the source virtual machine
    /// object and the destination path should be of the same type i.e. virtual
    /// machine or template. Reloading a virtual machine with a template or
    /// vice-versa is not supported.
    /// 
    /// _Note:_ Since the API replaces the source configuration with that
    /// of the destination, if the destination configuration does not refer to a
    /// valid virtual machine, it will create an invalid virtual machine object.
    /// This API should not be invoked on fault tolerant virtual machines since
    /// doing so will leave the original virtual machine's configuration in an
    /// invalid state. It is recommended that you turn off fault tolerance before
    /// invoking this API.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.ReloadFromPath
    ///
    /// ## Parameters:
    ///
    /// ### configuration_path
    /// -
    ///
    /// ## Returns:
    ///
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: if invoked on ESX server or if invoked on a virtual
    /// machine with the destination path for a template and vice-versa.
    /// 
    /// ***InvalidPowerState***: if the virtual machine is powered on.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***FileFault***: if there is a problem creating or accessing the files
    /// needed for this operation.
    /// 
    /// ***InvalidState***: if the virtual machine is busy or not ready to
    /// respond to such requests.
    /// 
    /// ***VmConfigFault***: if the format / configuration of the virtual machine
    /// is invalid. Typically, a more specific fault is thrown such as
    /// InvalidFormat if the configuration file cannot be read, or
    /// InvalidDiskFormat if the disks cannot be read.
    /// 
    /// ***AlreadyExists***: if the virtual machine is already registered.
    pub async fn reload_virtual_machine_from_path_task(&self, configuration_path: &str) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = ReloadVirtualMachineFromPathRequestType {configuration_path, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "reloadVirtualMachineFromPath_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Relocates a virtual machine to the location specified by
    /// *VirtualMachineRelocateSpec*.
    /// 
    /// Starting from VCenter 5.1, this API also supports relocating a template
    /// to a new host should the current host become inactive.
    /// Starting from vCenter 6.0 this API also supports relocating a VM to a new
    /// vCenter service.
    /// 
    /// Requires the following additional permissions:
    /// - Resource.HotMigrate if the virtual machine is powered on.
    /// - Datastore.AllocateSpec if the virtual machine or its disks are
    ///   being relocated to a new datastore.
    /// - Resource.AssignVMToPool if the resource pool is changing.
    /// - VirtualMachine.Inventory.Register against the destination folder if
    ///   the virtual machine is moving to a new vCenter service.
    /// - VirtualMachine.Inventory.Move against the virtual machine, source
    ///   folder, and destination folder if the virtual machine is changing
    ///   folders within the same vCenter service.
    /// - Network.Assign against the new network if the virtual machine is
    ///   changing networks.
    ///   
    /// If this virtual machine is configured with a VirtualNVDIMM device, and if
    /// the virtual machine will be moved to a different host, the VirtualNVDIMM
    /// will be automatically relocated to the destination host's Non-Volatile
    /// Memory storage.
    /// If this Virtual machine is configured with virtual disks via
    /// persistent memory storage profile:
    /// - If spec specifies only compute location change, these virtual disks
    ///   will be automatically moved to a persistent memory storage in
    ///   destination host that supports the profile.
    /// - If spec specifies primary datastore change via
    ///   *datastore*, unlike regular
    ///   virtual disks, these disks will not be automatically moved to the
    ///   specified datastore, instead they will stay on a persistent
    ///   memory storage in destination host that supports the profile.
    /// - To explicityly move these disks to a location other than
    ///   persistent memory storage, use disk locator to specify the
    ///   new destination datastore along with a storage profile that removes
    ///   the persistent memory storage requirement. Note that this
    ///   downgrades the disk I/O performance.
    /// - On the other hand, to move a virtual disk from a regular storage to
    ///   persistent memory, use
    ///   *deviceChange*
    ///   to specify a storage profile of persistent memory storage. Note
    ///   that this upgrades the disk I/O performance.
    ///   
    /// ***Required privileges:*** Resource.ColdMigrate
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// The specification of where to relocate the virtual machine
    /// (see *VirtualMachineRelocateSpec*).
    ///
    /// ### priority
    /// The task priority
    /// (see *VirtualMachineMovePriority_enum*).
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: in the following cases:
    /// - the target host and target pool are not associated with the
    ///   same compute resource
    /// - the target pool represents a cluster without DRS enabled,
    ///   and the host is not specified
    /// - the virtual machine is powered on, its home or any of its disks
    ///   will change storage location, and the host is not specified
    /// - Datastore is not accessible in a cross-datacenter move
    /// - Datastore in a diskLocator entry is not specified
    /// - the specified device ID cannot be found in the virtual machine's current
    ///   configuration
    ///   
    /// ***NotSupported***: if the virtual machine is marked as template and
    /// the datastore is changing or if it is a cross vCenter vMotion operation.
    /// 
    /// ***Timedout***: if one of the phases of the relocate process times out.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// host or virtual machine's current state. For example, if the host is in
    /// maintenance mode, or if the virtual machine's configuration information
    /// is not available.
    /// 
    /// ***InvalidDatastore***: if the operation cannot be performed on the
    /// target datastores.
    /// 
    /// ***FileFault***: if there is an error accessing the virtual machine files.
    /// 
    /// ***VmConfigFault***: if the virtual machine is not compatible with the
    /// destination host. Typically, a specific subclass of this exception is
    /// thrown, such as IDEDiskNotSupported.
    /// 
    /// ***MigrationFault***: if it is not possible to migrate the virtual machine to
    /// the destination host. This is typically due to hosts being incompatible,
    /// such as mismatch in network polices or access to networks and datastores.
    /// Typically, a more specific subclass is thrown.
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a resource
    /// usage policy.
    /// 
    /// ***DisallowedOperationOnFailoverHost***: if the virtual machine is powered on
    /// and is being migrated to a failover host. See
    /// *ClusterFailoverHostAdmissionControlPolicy*.
    pub async fn relocate_vm_task(&self, spec: &crate::types::structs::VirtualMachineRelocateSpec, priority: Option<crate::types::enums::VirtualMachineMovePriorityEnum>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = RelocateVmRequestType {spec, priority, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "RelocateVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Remove all the snapshots associated with this virtual machine.
    /// 
    /// If the virtual
    /// machine
    /// does not have any snapshots, then this operation simply returns successfully.
    /// 
    /// ***Required privileges:*** VirtualMachine.State.RemoveSnapshot
    ///
    /// ## Parameters:
    ///
    /// ### consolidate
    /// (optional) If set to true, the virtual disks of the deleted
    /// snapshot will be merged with other disk if possible. Default to true.
    ///
    /// ### spec
    /// (optional) When provided, only snapshots satisfying the
    /// criteria described by the spec will be removed. If unset, all snapshots
    /// will be removed.
    /// 
    /// ***Since:*** vSphere API Release 8.0.3.0
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host product does not support snapshots.
    /// 
    /// ***InvalidPowerState***: if the operation cannot be performed in the current
    /// power state of the virtual machine.
    /// 
    /// ***SnapshotFault***: if an error occurs during the snapshot operation.
    /// Typically, a more specific fault like InvalidSnapshotFormat
    /// is thrown.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    pub async fn remove_all_snapshots_task(&self, consolidate: Option<bool>, spec: Option<&crate::types::structs::SnapshotSelectionSpec>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = RemoveAllSnapshotsRequestType {consolidate, spec, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "RemoveAllSnapshots_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Renames this managed entity.
    /// 
    /// Any % (percent) character used in this name parameter
    /// must be escaped, unless it is used to start an escape
    /// sequence. Clients may also escape any other characters in
    /// this name parameter.
    /// 
    /// See also *ManagedEntity.name*.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.Rename
    ///
    /// ## Parameters:
    ///
    /// ### new_name
    /// -
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***DuplicateName***: If another object in the same folder has the target name.
    /// 
    /// ***InvalidName***: If the new name is not a valid entity name.
    pub async fn rename_task(&self, new_name: &str) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = RenameRequestType {new_name, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "Rename_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Resets power on this virtual machine.
    /// 
    /// If the current state is poweredOn,
    /// then this method first performs powerOff(hard). Once the power state
    /// is poweredOff, then this method performs powerOn(option).
    /// 
    /// Although this method functions as a powerOff followed by a powerOn, the
    /// two operations are atomic with respect to other clients, meaning that
    /// other power operations cannot be performed until the reset method completes.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.Reset
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is suspended or poweredOff.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotEnoughLicenses***: if there are not enough licenses to reset
    /// this virtual machine.
    /// 
    /// ***NotSupported***: if the virtual machine is marked as a template.
    /// 
    /// ***InvalidState***: if the host is in maintenance mode.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    pub async fn reset_vm_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "ResetVM_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Clears cached guest information.
    /// 
    /// Guest information can be cleared
    /// only if the virtual machine is powered off.
    /// 
    /// This method can be useful if stale information is cached,
    /// preventing an IP address or MAC address from being reused.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.ResetGuestInfo
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the virtual machine is not powered off.
    /// 
    /// ***NotSupported***: if the virtual machine is marked as a template.
    pub async fn reset_guest_information(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "ResetGuestInformation", None).await
    }
    /// Reverts the virtual machine to the current snapshot.
    /// 
    /// This is equivalent to
    /// doing snapshot.currentSnapshot.revert.
    /// 
    /// If no snapshot exists, then the operation does nothing,
    /// and the virtual machine state remains unchanged.
    /// 
    /// ***Required privileges:*** VirtualMachine.State.RevertToSnapshot
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// (optional) Choice of host for the virtual machine,
    /// in case this operation causes the virtual machine to power on.
    /// 
    /// If a snapshot was taken while a virtual machine was powered on,
    /// and this operation is invoked after the virtual machine was
    /// powered off, the operation causes the virtual machine to power
    /// on to reach the snapshot state. This parameter can be used to
    /// specify a choice of host where the virtual machine should power
    /// on.
    /// 
    /// If this parameter is not set, and the vBalance feature is
    /// configured for automatic load balancing, a host is
    /// automatically selected. Otherwise, the virtual machine keeps
    /// its existing host affiliation.
    /// 
    /// This is not supported for virtual machines associated with hosts on ESX 2.x
    /// servers.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ### suppress_power_on
    /// (optional) If set to true, the virtual
    /// machine will not be powered on regardless of the power state when
    /// the current snapshot was created. Default to false.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host product does not support snapshots.
    /// 
    /// ***InsufficientResourcesFault***: if this operation would violate a resource
    /// usage policy.
    /// 
    /// ***SnapshotFault***: if an error occurs during the snapshot operation.
    /// Typically, a more specific fault like InvalidSnapshotFormat
    /// is thrown.
    /// 
    /// ***InvalidPowerState***: if the operation cannot be performed in the current
    /// power state of the virtual machine.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available or if an OVF consumer is
    /// blocking the operation.
    /// 
    /// ***VmConfigFault***: if a configuration issue prevents the power-on. Typically, a
    /// more specific fault, such as UnsupportedVmxLocation, is thrown.
    /// 
    /// ***FileFault***: if there is a problem accessing the virtual machine on the
    /// filesystem.
    /// 
    /// ***NotFound***: if the virtual machine does not have a current snapshot.
    /// 
    /// ***DisallowedOperationOnFailoverHost***: if the virtual machine is being
    /// reverted to a powered on state and the host specified is a failover host.
    /// See *ClusterFailoverHostAdmissionControlPolicy*.
    pub async fn revert_to_current_snapshot_task(&self, host: Option<&crate::types::structs::ManagedObjectReference>, suppress_power_on: Option<bool>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = RevertToCurrentSnapshotRequestType {host, suppress_power_on, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "RevertToCurrentSnapshot_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Send a non-maskable interrupt (NMI).
    /// 
    /// Currently, there is no way to verify if the NMI was actually
    /// received by the guest OS.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.GuestControl
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the virtual machine is not powered on.
    pub async fn send_nmi(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "SendNMI", None).await
    }
    /// Assigns a value to a custom field.
    /// 
    /// The setCustomValue method requires
    /// whichever updatePrivilege is defined as one of the
    /// *CustomFieldDef.fieldInstancePrivileges*
    /// for the CustomFieldDef whose value is being changed.
    ///
    /// ## Parameters:
    ///
    /// ### key
    /// The name of the field whose value is to be updated.
    ///
    /// ### value
    /// Value to be assigned to the custom field.
    pub async fn set_custom_value(&self, key: &str, value: &str) -> Result<()> {
        let input = SetCustomValueRequestType {key, value, };
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "setCustomValue", Some(&input)).await
    }
    /// Sets the console window's display topology as specified.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.ConsoleInteract
    ///
    /// ## Parameters:
    ///
    /// ### displays
    /// The topology for each monitor that the
    /// virtual machine's display must span.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: if the Guest Operating system does
    /// not support setting the display topology
    /// 
    /// ***InvalidPowerState***: if the power state is not poweredOn.
    /// 
    /// ***InvalidState***: if the virtual machine is not connected.
    /// 
    /// ***ToolsUnavailable***: if VMware Tools is not running.
    pub async fn set_display_topology(&self, displays: &[crate::types::structs::VirtualMachineDisplayTopology]) -> Result<()> {
        let input = SetDisplayTopologyRequestType {displays, };
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "SetDisplayTopology", Some(&input)).await
    }
    /// Sets the console window's resolution as specified.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.ConsoleInteract
    ///
    /// ## Parameters:
    ///
    /// ### width
    /// The screen width that should be set.
    ///
    /// ### height
    /// The screen height that should be set.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: if the Guest Operating system does
    /// not support setting the screen resolution.
    /// 
    /// ***InvalidPowerState***: if the power state is not poweredOn.
    /// 
    /// ***InvalidState***: if the virtual machine is not connected.
    /// 
    /// ***ToolsUnavailable***: if VMware Tools is not running.
    pub async fn set_screen_resolution(&self, width: i32, height: i32) -> Result<()> {
        let input = SetScreenResolutionRequestType {width, height, };
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "SetScreenResolution", Some(&input)).await
    }
    /// Issues a command to the guest operating system asking it to perform
    /// a clean shutdown of all services.
    /// 
    /// Returns immediately and does not wait for the guest operating system
    /// to complete the operation.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.PowerOff
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is not powered on.
    /// 
    /// ***ToolsUnavailable***: if VMware Tools is not running.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    pub async fn shutdown_guest(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "ShutdownGuest", None).await
    }
    /// Issues a command to the guest operating system asking it to prepare for
    /// a suspend operation.
    /// 
    /// Returns immediately and does not wait for the guest operating system
    /// to complete the operation.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.Suspend
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is not powered on.
    /// 
    /// ***ToolsUnavailable***: if VMware Tools is not running.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    pub async fn standby_guest(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "StandbyGuest", None).await
    }
    /// Deprecated as of vsphere API 5.1.
    /// 
    /// Initiates a recording session on this virtual machine.
    /// 
    /// As a side effect,
    /// this operation creates a snapshot on the virtual machine, which in turn
    /// becomes the current snapshot.
    /// 
    /// This is an experimental interface that is not intended for use in production code.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.Record
    ///
    /// ## Parameters:
    ///
    /// ### name
    /// The name for the snapshot associated with this recording.
    /// The name need not be unique for this virtual machine.
    ///
    /// ### description
    /// A description for the snapshot associated with this
    /// recording. If omitted, a default description may be provided.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor
    /// the operation. The *info.result* property
    /// in the *Task* contains the newly created *VirtualMachineSnapshot*
    /// associated with the recording on success.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host product does not support record
    /// functionality or if the virtual machine does not support this
    /// 
    /// ***VmConfigIncompatibleForRecordReplay***: if the virtual machine
    /// configuration is incompatible for recording.
    /// 
    /// ***SnapshotFault***: if an error occurs during the snapshot operation.
    /// Typically, a more specific fault like MultipleSnapshotsNotSupported
    /// is thrown.
    /// 
    /// ***InvalidName***: if the specified snapshot name is invalid.
    /// 
    /// ***FileFault***: if there is a problem with creating or accessing one
    /// or more files needed for this operation.
    /// 
    /// ***InvalidPowerState***: if the operation cannot be performed in the
    /// current power state of the virtual machine.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, the virtual machine
    /// configuration information is not available.
    /// 
    /// ***RecordReplayDisabled***: if the record/replay config flag has not been
    /// enabled for this virtual machine.
    /// 
    /// ***HostIncompatibleForRecordReplay***: if the virtual machine is located
    /// on a host that does not support record/replay.
    pub async fn start_recording_task(&self, name: &str, description: Option<&str>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = StartRecordingRequestType {name, description, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "StartRecording_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vsphere API 5.1.
    /// 
    /// Starts a replay session on this virtual machine.
    /// 
    /// As a side effect,
    /// this operation updates the current snapshot of the virtual machine.
    /// 
    /// This is an experimental interface that is not intended for use in production code.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.Replay
    ///
    /// ## Parameters:
    ///
    /// ### replay_snapshot
    /// The snapshot from which to start the replay. This
    /// snapshot must have been created by a record operation on the
    /// virtual machine.
    /// 
    /// Refers instance of *VirtualMachineSnapshot*.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor
    /// the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host product does not support record/replay
    /// functionality or if the virtual machine does not support this
    /// capability.
    /// 
    /// ***InvalidArgument***: if replaySnapshot is not a valid snapshot
    /// associated with a recorded session on this virtual machine.
    /// 
    /// ***SnapshotFault***: if an error occurs during the snapshot operation.
    /// Typically, a more specific fault like InvalidSnapshotFormat
    /// is thrown.
    /// 
    /// ***FileFault***: if there is a problem with creating or accessing one
    /// or more files needed for this operation.
    /// 
    /// ***VmConfigIncompatibleForRecordReplay***: if the virtual machine
    /// configuration is incompatible for replaying.
    /// 
    /// ***InvalidPowerState***: if the operation cannot be performed in the
    /// current power state of the virtual machine.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, the virtual machine
    /// configuration information is not available.
    /// 
    /// ***NotFound***: if replaySnapshot is no longer present.
    /// 
    /// ***RecordReplayDisabled***: if the record/replay config flag has not been
    /// enabled for this virtual machine.
    /// 
    /// ***HostIncompatibleForRecordReplay***: if the virtual machine is located
    /// on a host that does not support record/replay.
    pub async fn start_replaying_task(&self, replay_snapshot: &crate::types::structs::ManagedObjectReference) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = StartReplayingRequestType {replay_snapshot, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "StartReplaying_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vsphere API 5.1.
    /// 
    /// Stops a currently active recording session on this virtual machine.
    /// 
    /// This is an experimental interface that is not intended for use in production code.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.Record
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor
    /// the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host product does not support record/replay
    /// functionality or if the virtual machine does not support this
    /// capability.
    /// 
    /// ***SnapshotFault***: if an error occurs during the snapshot operation.
    /// Typically, a more specific fault like InvalidSnapshotFormat
    /// is thrown.
    /// 
    /// ***FileFault***: if there is a problem with creating or accessing one
    /// or more files needed for this operation.
    /// 
    /// ***InvalidPowerState***: if the operation cannot be performed in the current
    /// power state of the virtual machine.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, the virtual machine
    /// does not have an active recording session.
    pub async fn stop_recording_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "StopRecording_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vsphere API 5.1.
    /// 
    /// Stops a replay session on this virtual machine.
    /// 
    /// This is an experimental interface that is not intended for use in production code.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.Replay
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor
    /// the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the host product does not support record/replay
    /// functionality or if the virtual machine does not support this
    /// capability.
    /// 
    /// ***SnapshotFault***: if an error occurs during the snapshot operation.
    /// Typically, a more specific fault like InvalidSnapshotFormat
    /// is thrown.
    /// 
    /// ***FileFault***: if there is a problem with creating or accessing one
    /// or more files needed for this operation.
    /// 
    /// ***InvalidPowerState***: if the operation cannot be performed in the
    /// current power state of the virtual machine.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, the virtual machine
    /// does not have an active recording session.
    pub async fn stop_replaying_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "StopReplaying_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Suspends execution in this virtual machine.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.Suspend
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is not poweredOn.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***NotSupported***: if the virtual machine is marked as a template.
    /// 
    /// ***InvalidState***: if the operation cannot be performed because of the
    /// virtual machine's current state. For example, if the virtual machine
    /// configuration information is not available.
    pub async fn suspend_vm_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "SuspendVM_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Do an immediate power off of a VM.
    /// 
    /// This API issues a SIGKILL to the vmx process of the VM.
    /// Pending synchronous I/Os may not be written out before the vmx
    /// process dies depending on accessibility of the datastore.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.PowerOff
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: if this operation is not supported.
    /// 
    /// ***InvalidState***: if the VM is not powered on or another issue prevents the
    /// operation from being performed.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    pub async fn terminate_vm(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "TerminateVM", None).await
    }
    /// Terminates the specified secondary virtual machine in a fault tolerant group.
    /// 
    /// This
    /// can be used to test fault tolerance on a given virtual machine, and should
    /// be used with care.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.TerminateFaultTolerantVM
    ///
    /// ## Parameters:
    ///
    /// ### vm
    /// The secondary virtual machine specified will be terminated, allowing
    /// fault tolerance to activate. If no virtual machine is specified,
    /// all secondary virtual machines will be terminated. If vm is a
    /// primary, InvalidArgument exception is thrown.
    /// This field must specify a virtual machine that is part of the fault
    /// tolerant group that this virtual machine is currently associated with. It can
    /// only be invoked from the primary virtual machine in the group. If the primary
    /// virtual machine is terminated, an available secondary virtual machine will be
    /// promoted to primary. If no secondary exists, an exception will be thrown and
    /// the primary virtual machine will not be terminated. If a secondary virtual
    /// machine is terminated, it may be respawned on a potentially different host.
    /// 
    /// Refers instance of *VirtualMachine*.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***VmFaultToleranceIssue***: if any error is encountered with the
    /// fault tolerance configuration of the virtual machine. Typically,
    /// a more specific fault like InvalidOperationOnSecondaryVm is thrown.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the host is in maintenance mode or if
    /// the virtual machine's configuration information is not available.
    pub async fn terminate_fault_tolerant_vm_task(&self, vm: Option<&crate::types::structs::ManagedObjectReference>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = TerminateFaultTolerantVmRequestType {vm, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "TerminateFaultTolerantVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Removes all secondary virtual machines associated with the fault tolerant
    /// group and turns off protection for this virtual machine.
    /// 
    /// This operation can only be invoked from the primary virtual machine in
    /// the group.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.TurnOffFaultTolerance
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***VmFaultToleranceIssue***: if any error is encountered with the
    /// fault tolerance configuration of the virtual machine. Typically,
    /// a more specific fault like InvalidOperationOnSecondaryVm is thrown.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidState***: if the host is in maintenance mode or if
    /// the virtual machine's configuration information is not available.
    pub async fn turn_off_fault_tolerance_for_vm_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "TurnOffFaultToleranceForVM_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Unmounts VMware Tools installer CD.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.ToolsInstall
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the virtual machine is not running,
    /// VMware Tools is not running or the VMware Tools CD is already mounted.
    pub async fn unmount_tools_installer(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "UnmountToolsInstaller", None).await
    }
    /// Removes this virtual machine from the inventory without removing
    /// any of the virtual machine's files on disk.
    /// 
    /// All high-level information
    /// stored with the management server (ESX Server or VirtualCenter) is
    /// removed, including information such as statistics, resource pool association,
    /// permissions, and alarms.
    /// 
    /// Use the Folder.RegisterVM method to recreate a
    /// VirtualMachine object from the set of virtual machine files by passing in
    /// the path to the configuration file. However, the VirtualMachine managed object
    /// that results typically has different objects ID and may inherit a different
    /// set of permissions.
    /// 
    /// ***Required privileges:*** VirtualMachine.Inventory.Unregister
    ///
    /// ## Errors:
    ///
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***InvalidPowerState***: if the virtual machine is powered on.
    pub async fn unregister_vm(&self) -> Result<()> {
        self.client.invoke_void("", "VirtualMachine", &self.mo_id, "UnregisterVM", None).await
    }
    /// Begins the tools upgrade process.
    /// 
    /// To monitor the status of the tools install, clients should check the tools status,
    /// *GuestInfo.toolsVersionStatus* and
    /// *GuestInfo.toolsRunningStatus*.
    /// 
    /// ***Required privileges:*** VirtualMachine.Interact.ToolsInstall
    ///
    /// ## Parameters:
    ///
    /// ### installer_options
    /// Command line options passed to the installer to modify
    /// the installation procedure for tools.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the virtual machine is not running
    /// or is suspended.
    /// 
    /// ***NotSupported***: if upgrading tools is not supported.
    /// 
    /// ***TaskInProgress***: if an upgrade is already taking place.
    /// 
    /// ***VmToolsUpgradeFault***: if the upgrade failed.
    /// 
    /// ***ToolsUnavailable***: if VMware Tools is not running.
    pub async fn upgrade_tools_task(&self, installer_options: Option<&str>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = UpgradeToolsRequestType {installer_options, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "UpgradeTools_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Upgrades this virtual machine's virtual hardware to the latest revision
    /// that is supported by the virtual machine's current host.
    /// 
    /// ***Required privileges:*** VirtualMachine.Config.UpgradeVirtualHardware
    ///
    /// ## Parameters:
    ///
    /// ### version
    /// If specified, upgrade to that specified version. If not specified,
    /// upgrade to the most current virtual hardware supported on the host.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidPowerState***: if the power state is not poweredOff.
    /// 
    /// ***TaskInProgress***: if the virtual machine is busy.
    /// 
    /// ***AlreadyUpgraded***: if the virtual machine's hardware is already up-to-date.
    /// 
    /// ***NoDiskFound***: if no virtual disks are attached to this virtual machine.
    /// 
    /// ***InvalidState***: if the host is in maintenance mode,
    /// if an invalid version string is specified, or
    /// if the virtual machine is in a state in which the operation
    /// cannot be performed. For example, if the configuration
    /// information is not available.
    pub async fn upgrade_vm_task(&self, version: Option<&str>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = UpgradeVmRequestType {version, };
        let bytes = self.client.invoke("", "VirtualMachine", &self.mo_id, "UpgradeVM_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Whether alarm actions are enabled for this entity.
    /// 
    /// True if enabled; false otherwise.
    /// 
    /// ***Required privileges:*** System.Read
    pub async fn alarm_actions_enabled(&self) -> Result<Option<bool>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "alarmActionsEnabled").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// List of custom field definitions that are valid for the object's type.
    /// 
    /// The fields are sorted by *CustomFieldDef.name*.
    /// 
    /// ***Required privileges:*** System.View
    pub async fn available_field(&self) -> Result<Option<Vec<crate::types::structs::CustomFieldDef>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "availableField").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Information about the runtime capabilities of this virtual machine.
    pub async fn capability(&self) -> Result<crate::types::structs::VirtualMachineCapability> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "capability").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property capability was empty".to_string()))?;
        let result: crate::types::structs::VirtualMachineCapability = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Configuration of this virtual machine, including the name and UUID.
    /// 
    /// This property is set when a virtual machine is created or when
    /// the *reconfigVM* method is called.
    /// 
    /// The virtual machine configuration is not guaranteed to be available.
    /// For example, the configuration information would be unavailable
    /// if the server is unable to access the virtual machine files on disk,
    /// and is often also unavailable during the initial phases of
    /// virtual machine creation.
    pub async fn config(&self) -> Result<Option<crate::types::structs::VirtualMachineConfigInfo>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "config").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Current configuration issues that have been detected for this entity.
    /// 
    /// Typically,
    /// these issues have already been logged as events. The entity stores these
    /// events as long as they are still current. The
    /// *configStatus* property provides an overall status
    /// based on these events.
    pub async fn config_issue(&self) -> Result<Option<Vec<crate::types::structs::Event>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "configIssue").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// The configStatus indicates whether or not the system has detected a configuration
    /// issue involving this entity.
    /// 
    /// For example, it might have detected a
    /// duplicate IP address or MAC address, or a host in a cluster
    /// might be out of compliance. The meanings of the configStatus values are:
    /// - red: A problem has been detected involving the entity.
    /// - yellow: A problem is about to occur or a transient condition
    ///   has occurred (For example, reconfigure fail-over policy).
    /// - green: No configuration issues have been detected.
    /// - gray: The configuration status of the entity is not being monitored.
    ///   
    /// A green status indicates only that a problem has not been detected;
    /// it is not a guarantee that the entity is problem-free.
    /// 
    /// The *configIssue* property contains a list of the
    /// problems that have been detected.
    /// In releases after vSphere API 5.0, vSphere Servers might not
    /// generate property collector update notifications for this property.
    /// To obtain the latest value of the property, you can use
    /// PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.
    /// If you use the PropertyCollector.WaitForUpdatesEx method, specify
    /// an empty string for the version parameter. Any other version value will not
    /// produce any property values as no updates are generated.
    pub async fn config_status(&self) -> Result<crate::types::enums::ManagedEntityStatusEnum> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "configStatus").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property configStatus was empty".to_string()))?;
        let result: crate::types::enums::ManagedEntityStatusEnum = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Custom field values.
    /// 
    /// ***Required privileges:*** System.View
    pub async fn custom_value(&self) -> Result<Option<Vec<Box<dyn crate::types::traits::CustomFieldValueTrait>>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "customValue").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// A collection of references to the subset of datastore objects in the datacenter
    /// that is used by this virtual machine.
    /// 
    /// ***Required privileges:*** System.View
    ///
    /// ## Returns:
    ///
    /// Refers instances of *Datastore*.
    pub async fn datastore(&self) -> Result<Option<Vec<crate::types::structs::ManagedObjectReference>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "datastore").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// A set of alarm states for alarms that apply to this managed entity.
    /// 
    /// The set includes alarms defined on this entity
    /// and alarms inherited from the parent entity,
    /// or from any ancestors in the inventory hierarchy.
    /// 
    /// Alarms are inherited if they can be triggered by this entity or its descendants.
    /// This set does not include alarms that are defined on descendants of this entity.
    /// 
    /// ***Required privileges:*** System.View
    pub async fn declared_alarm_state(&self) -> Result<Option<Vec<crate::types::structs::AlarmState>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "declaredAlarmState").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// List of operations that are disabled, given the current runtime
    /// state of the entity.
    /// 
    /// For example, a power-on operation always fails if a
    /// virtual machine is already powered on. This list can be used by clients to
    /// enable or disable operations in a graphical user interface.
    /// 
    /// Note: This list is determined by the current runtime state of an entity,
    /// not by its permissions.
    /// 
    /// This list may include the following operations for a HostSystem:
    /// - *HostSystem.EnterMaintenanceMode_Task*
    /// - *HostSystem.ExitMaintenanceMode_Task*
    /// - *HostSystem.RebootHost_Task*
    /// - *HostSystem.ShutdownHost_Task*
    /// - *HostSystem.ReconnectHost_Task*
    /// - *HostSystem.DisconnectHost_Task*
    ///   
    /// This list may include the following operations for a VirtualMachine:
    /// - *VirtualMachine.AnswerVM*
    /// - *ManagedEntity.Rename_Task*
    /// - *VirtualMachine.CloneVM_Task*
    /// - *VirtualMachine.PowerOffVM_Task*
    /// - *VirtualMachine.PowerOnVM_Task*
    /// - *VirtualMachine.SuspendVM_Task*
    /// - *VirtualMachine.ResetVM_Task*
    /// - *VirtualMachine.ReconfigVM_Task*
    /// - *VirtualMachine.RelocateVM_Task*
    /// - *VirtualMachine.MigrateVM_Task*
    /// - *VirtualMachine.CustomizeVM_Task*
    /// - *VirtualMachine.ShutdownGuest*
    /// - *VirtualMachine.StandbyGuest*
    /// - *VirtualMachine.RebootGuest*
    /// - *VirtualMachine.CreateSnapshot_Task*
    /// - *VirtualMachine.RemoveAllSnapshots_Task*
    /// - *VirtualMachine.RevertToCurrentSnapshot_Task*
    /// - *VirtualMachine.MarkAsTemplate*
    /// - *VirtualMachine.MarkAsVirtualMachine*
    /// - *VirtualMachine.ResetGuestInformation*
    /// - *VirtualMachine.MountToolsInstaller*
    /// - *VirtualMachine.UnmountToolsInstaller*
    /// - *ManagedEntity.Destroy_Task*
    /// - *VirtualMachine.UpgradeVM_Task*
    /// - *VirtualMachine.ExportVm*
    ///   
    /// This list may include the following operations for a ResourcePool:
    /// - *ResourcePool.ImportVApp*
    /// - *ResourcePool.CreateChildVM_Task*
    /// - *ResourcePool.UpdateConfig*
    /// - *Folder.CreateVM_Task*
    /// - *ManagedEntity.Destroy_Task*
    /// - *ManagedEntity.Rename_Task*
    ///   
    /// This list may include the following operations for a VirtualApp:
    /// - *ManagedEntity.Destroy_Task*
    /// - *VirtualApp.CloneVApp_Task*
    /// - *VirtualApp.unregisterVApp_Task*
    /// - *VirtualApp.ExportVApp*
    /// - *VirtualApp.PowerOnVApp_Task*
    /// - *VirtualApp.PowerOffVApp_Task*
    /// - *VirtualApp.UpdateVAppConfig*
    ///   
    /// In releases after vSphere API 5.0, vSphere Servers might not
    /// generate property collector update notifications for this property.
    /// To obtain the latest value of the property, you can use
    /// PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.
    /// If you use the PropertyCollector.WaitForUpdatesEx method, specify
    /// an empty string for the version parameter. Any other version value will not
    /// produce any property values as no updates are generated.
    pub async fn disabled_method(&self) -> Result<Option<Vec<String>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "disabledMethod").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Access rights the current session has to this entity.
    /// 
    /// ***Required privileges:*** System.View
    pub async fn effective_role(&self) -> Result<Option<Vec<i32>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "effectiveRole").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// The current virtual machine's environment browser object.
    /// 
    /// This contains
    /// information on all the configurations that can be used on the
    /// virtual machine. This is identical to the environment browser on
    /// the *ComputeResource* to which this virtual machine belongs.
    ///
    /// ## Returns:
    ///
    /// Refers instance of *EnvironmentBrowser*.
    pub async fn environment_browser(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "environmentBrowser").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property environmentBrowser was empty".to_string()))?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Information about VMware Tools and about the virtual machine
    /// from the perspective of VMware Tools.
    /// 
    /// Information about the guest operating system is available in VirtualCenter. Guest
    /// operating system information reflects the last known state of the virtual machine.
    /// For powered on machines, this is current information. For powered off machines,
    /// this is the last recorded state before the virtual machine was powered off.
    pub async fn guest(&self) -> Result<Option<crate::types::structs::GuestInfo>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "guest").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// The guest heartbeat.
    /// 
    /// The heartbeat status is classified as:
    /// - gray - VMware Tools are not installed or not running.
    /// - red - No heartbeat. Guest operating system may have stopped responding.
    /// - yellow - Intermittent heartbeat. May be due to guest load.
    /// - green - Guest operating system is responding normally.
    ///   
    /// The guest heartbeat is a statistics metric. Alarms can be configured on
    /// this metric to trigger emails or other actions.
    pub async fn guest_heartbeat_status(&self) -> Result<crate::types::enums::ManagedEntityStatusEnum> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "guestHeartbeatStatus").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property guestHeartbeatStatus was empty".to_string()))?;
        let result: crate::types::enums::ManagedEntityStatusEnum = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, use *VirtualMachine.layoutEx* instead.
    /// In releases after vSphere API 5.0, vSphere Servers might not
    /// generate property collector update notifications for this property.
    /// To obtain the latest value of the property, you can use
    /// PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.
    /// If you use the PropertyCollector.WaitForUpdatesEx method, specify
    /// an empty string for the version parameter. Any other version value will not
    /// produce any property values as no updates are generated.
    /// 
    /// Detailed information about the files that comprise this virtual machine.
    pub async fn layout(&self) -> Result<Option<crate::types::structs::VirtualMachineFileLayout>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "layout").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Detailed information about the files that comprise this virtual machine.
    /// 
    /// Can be explicitly refreshed by the *VirtualMachine.RefreshStorageInfo* operation.
    /// In releases after vSphere API 5.0, vSphere Servers might not
    /// generate property collector update notifications for this property.
    /// To obtain the latest value of the property, you can use
    /// PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.
    /// If you use the PropertyCollector.WaitForUpdatesEx method, specify
    /// an empty string for the version parameter. Any other version value will not
    /// produce any property values as no updates are generated.
    pub async fn layout_ex(&self) -> Result<Option<crate::types::structs::VirtualMachineFileLayoutEx>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "layoutEx").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Name of this entity, unique relative to its parent.
    /// 
    /// Any / (slash), \\ (backslash), character used in this
    /// name element will be escaped. Similarly, any % (percent) character used in
    /// this name element will be escaped, unless it is used to start an escape
    /// sequence. A slash is escaped as %2F or %2f. A backslash is escaped as %5C or
    /// %5c, and a percent is escaped as %25.
    /// 
    /// ***Required privileges:*** System.View
    pub async fn name(&self) -> Result<String> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "name").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property name was empty".to_string()))?;
        let result: String = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// A collection of references to the subset of network objects in the datacenter that
    /// is used by this virtual machine.
    /// 
    /// ***Required privileges:*** System.View
    ///
    /// ## Returns:
    ///
    /// Refers instances of *Network*.
    pub async fn network(&self) -> Result<Option<Vec<crate::types::structs::ManagedObjectReference>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "network").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// General health of this managed entity.
    /// 
    /// The overall status of the managed entity is computed as the worst status
    /// among its alarms and the configuration issues detected on the entity.
    /// The status is reported as one of the following values:
    /// - red: The entity has alarms or configuration issues with a red status.
    /// - yellow: The entity does not have alarms or configuration issues with a
    ///   red status, and has at least one with a yellow status.
    /// - green: The entity does not have alarms or configuration issues with a
    ///   red or yellow status, and has at least one with a green status.
    /// - gray: All of the entity's alarms have a gray status and the
    ///   configuration status of the entity is not being monitored.
    ///   
    /// In releases after vSphere API 5.0, vSphere Servers might not
    /// generate property collector update notifications for this property.
    /// To obtain the latest value of the property, you can use
    /// PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.
    /// If you use the PropertyCollector.WaitForUpdatesEx method, specify
    /// an empty string for the version parameter. Any other version value will not
    /// produce any property values as no updates are generated.
    pub async fn overall_status(&self) -> Result<crate::types::enums::ManagedEntityStatusEnum> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "overallStatus").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property overallStatus was empty".to_string()))?;
        let result: crate::types::enums::ManagedEntityStatusEnum = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Parent of this entity.
    /// 
    /// This value is null for the root object and for
    /// *VirtualMachine* objects that are part of
    /// a *VirtualApp*.
    /// 
    /// ***Required privileges:*** System.View
    ///
    /// ## Returns:
    ///
    /// Refers instance of *ManagedEntity*.
    pub async fn parent(&self) -> Result<Option<crate::types::structs::ManagedObjectReference>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "parent").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Reference to the parent vApp.
    ///
    /// ## Returns:
    ///
    /// Refers instance of *ManagedEntity*.
    pub async fn parent_v_app(&self) -> Result<Option<crate::types::structs::ManagedObjectReference>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "parentVApp").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// List of permissions defined for this entity.
    pub async fn permission(&self) -> Result<Option<Vec<crate::types::structs::Permission>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "permission").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// The set of recent tasks operating on this managed entity.
    /// 
    /// This is a subset
    /// of *TaskManager.recentTask* belong to this entity. A task in this
    /// list could be in one of the four states: pending, running, success or error.
    /// 
    /// This property can be used to deduce intermediate power states for
    /// a virtual machine entity. For example, if the current powerState is "poweredOn"
    /// and there is a running task performing the "suspend" operation, then the virtual
    /// machine's intermediate state might be described as "suspending."
    /// 
    /// Most tasks (such as power operations) obtain exclusive access to the virtual
    /// machine, so it is unusual for this list to contain more than one running task.
    /// One exception, however, is the task of cloning a virtual machine.
    /// In releases after vSphere API 5.0, vSphere Servers might not
    /// generate property collector update notifications for this property.
    /// To obtain the latest value of the property, you can use
    /// PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.
    /// If you use the PropertyCollector.WaitForUpdatesEx method, specify
    /// an empty string for the version parameter. Any other version value will not
    /// produce any property values as no updates are generated.
    ///
    /// ## Returns:
    ///
    /// Refers instances of *Task*.
    pub async fn recent_task(&self) -> Result<Option<Vec<crate::types::structs::ManagedObjectReference>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "recentTask").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// The resource configuration for a virtual machine.
    /// 
    /// The shares
    /// in this specification are evaluated relative to the resource pool
    /// to which it is assigned. This will return null if the product
    /// the virtual machine is registered on does not support resource
    /// configuration.
    /// 
    /// To retrieve the configuration, you typically use
    /// *childConfiguration*.
    /// 
    /// To change the configuration, use
    /// *ResourcePool.UpdateChildResourceConfiguration*.
    pub async fn resource_config(&self) -> Result<Option<crate::types::structs::ResourceConfigSpec>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "resourceConfig").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// The current resource pool that specifies resource allocation
    /// for this virtual machine.
    /// 
    /// This property is set when a virtual machine is created or associated with
    /// a different resource pool.
    /// 
    /// Returns null if the virtual machine is a template or the session has no access
    /// to the resource pool.
    ///
    /// ## Returns:
    ///
    /// Refers instance of *ResourcePool*.
    pub async fn resource_pool(&self) -> Result<Option<crate::types::structs::ManagedObjectReference>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "resourcePool").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// The roots of all snapshot trees for the virtual machine.
    ///
    /// ## Returns:
    ///
    /// Refers instances of *VirtualMachineSnapshot*.
    pub async fn root_snapshot(&self) -> Result<Option<Vec<crate::types::structs::ManagedObjectReference>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "rootSnapshot").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Execution state and history for this virtual machine.
    /// 
    /// The contents of this property change when:
    /// - the virtual machine's power state changes.
    /// - an execution message is pending.
    /// - an event occurs.
    pub async fn runtime(&self) -> Result<crate::types::structs::VirtualMachineRuntimeInfo> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "runtime").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property runtime was empty".to_string()))?;
        let result: crate::types::structs::VirtualMachineRuntimeInfo = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Current snapshot and tree.
    /// 
    /// The property is valid if snapshots have been created
    /// for this virtual machine.
    /// 
    /// The contents of this property change in response to the methods:
    /// - *createSnapshot*
    /// - *revertToCurrentSnapshot*
    /// - *remove*
    /// - *revert*
    /// - *removeAllSnapshots*
    pub async fn snapshot(&self) -> Result<Option<crate::types::structs::VirtualMachineSnapshotInfo>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "snapshot").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Storage space used by the virtual machine, split by datastore.
    /// 
    /// Can be explicitly refreshed by the *VirtualMachine.RefreshStorageInfo* operation.
    /// In releases after vSphere API 5.0, vSphere Servers might not
    /// generate property collector update notifications for this property.
    /// To obtain the latest value of the property, you can use
    /// PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.
    /// If you use the PropertyCollector.WaitForUpdatesEx method, specify
    /// an empty string for the version parameter. Any other version value will not
    /// produce any property values as no updates are generated.
    pub async fn storage(&self) -> Result<Option<crate::types::structs::VirtualMachineStorageInfo>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "storage").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Basic information about this virtual machine.
    /// 
    /// This includes:
    /// - runtimeInfo
    /// - guest
    /// - basic configuration
    /// - alarms
    /// - performance information
    pub async fn summary(&self) -> Result<crate::types::structs::VirtualMachineSummary> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "summary").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property summary was empty".to_string()))?;
        let result: crate::types::structs::VirtualMachineSummary = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// The set of tags associated with this managed entity.
    /// 
    /// Experimental. Subject to change.
    /// 
    /// ***Required privileges:*** System.View
    pub async fn tag(&self) -> Result<Option<Vec<crate::types::structs::Tag>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "tag").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// A set of alarm states for alarms triggered by this entity
    /// or by its descendants.
    /// 
    /// Triggered alarms are propagated up the inventory hierarchy
    /// so that a user can readily tell when a descendant has triggered an alarm.
    /// In releases after vSphere API 5.0, vSphere Servers might not
    /// generate property collector update notifications for this property.
    /// To obtain the latest value of the property, you can use
    /// PropertyCollector methods RetrievePropertiesEx or WaitForUpdatesEx.
    /// If you use the PropertyCollector.WaitForUpdatesEx method, specify
    /// an empty string for the version parameter. Any other version value will not
    /// produce any property values as no updates are generated.
    /// 
    /// ***Required privileges:*** System.View
    pub async fn triggered_alarm_state(&self) -> Result<Option<Vec<crate::types::structs::AlarmState>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "triggeredAlarmState").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// List of custom field values.
    /// 
    /// Each value uses a key to associate
    /// an instance of a *CustomFieldStringValue* with
    /// a custom field definition.
    /// 
    /// ***Required privileges:*** System.View
    pub async fn value(&self) -> Result<Option<Vec<Box<dyn crate::types::traits::CustomFieldValueTrait>>>> {
        let pv_opt = self.client.fetch_property_raw("", "VirtualMachine", &self.mo_id, "value").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
}
struct AcquireTicketRequestType<'a> {
    ticket_type: &'a str,
}

impl<'a> miniserde::Serialize for AcquireTicketRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(AcquireTicketRequestTypeSer { data: self, seq: 0 }))
    }
}

struct AcquireTicketRequestTypeSer<'b, 'a> {
    data: &'b AcquireTicketRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for AcquireTicketRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"AcquireTicketRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("ticketType"), &self.data.ticket_type as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct AnswerVmRequestType<'a> {
    question_id: &'a str,
    answer_choice: &'a str,
}

impl<'a> miniserde::Serialize for AnswerVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(AnswerVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct AnswerVmRequestTypeSer<'b, 'a> {
    data: &'b AnswerVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for AnswerVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"AnswerVMRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("questionId"), &self.data.question_id as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("answerChoice"), &self.data.answer_choice as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct ApplyEvcModeVmRequestType<'a> {
    mask: Option<&'a [crate::types::structs::HostFeatureMask]>,
    complete_masks: Option<bool>,
}

impl<'a> miniserde::Serialize for ApplyEvcModeVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(ApplyEvcModeVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct ApplyEvcModeVmRequestTypeSer<'b, 'a> {
    data: &'b ApplyEvcModeVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for ApplyEvcModeVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"ApplyEvcModeVMRequestType")),
                1 => {
                    let Some(ref val) = self.data.mask else { continue; };
                    return Some((std::borrow::Cow::Borrowed("mask"), val as &dyn miniserde::Serialize));
                }
                2 => {
                    let Some(ref val) = self.data.complete_masks else { continue; };
                    return Some((std::borrow::Cow::Borrowed("completeMasks"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct AttachDiskRequestType<'a> {
    disk_id: &'a crate::types::structs::Id,
    datastore: &'a crate::types::structs::ManagedObjectReference,
    controller_key: Option<i32>,
    unit_number: Option<i32>,
}

impl<'a> miniserde::Serialize for AttachDiskRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(AttachDiskRequestTypeSer { data: self, seq: 0 }))
    }
}

struct AttachDiskRequestTypeSer<'b, 'a> {
    data: &'b AttachDiskRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for AttachDiskRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"AttachDiskRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("diskId"), &self.data.disk_id as &dyn miniserde::Serialize)),
                2 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
                3 => {
                    let Some(ref val) = self.data.controller_key else { continue; };
                    return Some((std::borrow::Cow::Borrowed("controllerKey"), val as &dyn miniserde::Serialize));
                }
                4 => {
                    let Some(ref val) = self.data.unit_number else { continue; };
                    return Some((std::borrow::Cow::Borrowed("unitNumber"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct CheckCustomizationSpecRequestType<'a> {
    spec: &'a crate::types::structs::CustomizationSpec,
}

impl<'a> miniserde::Serialize for CheckCustomizationSpecRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(CheckCustomizationSpecRequestTypeSer { data: self, seq: 0 }))
    }
}

struct CheckCustomizationSpecRequestTypeSer<'b, 'a> {
    data: &'b CheckCustomizationSpecRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CheckCustomizationSpecRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"CheckCustomizationSpecRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct CloneVmRequestType<'a> {
    folder: &'a crate::types::structs::ManagedObjectReference,
    name: &'a str,
    spec: &'a crate::types::structs::VirtualMachineCloneSpec,
}

impl<'a> miniserde::Serialize for CloneVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(CloneVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct CloneVmRequestTypeSer<'b, 'a> {
    data: &'b CloneVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CloneVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"CloneVMRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("folder"), &self.data.folder as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("name"), &self.data.name as &dyn miniserde::Serialize)),
            3 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct CreateSecondaryVmRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
}

impl<'a> miniserde::Serialize for CreateSecondaryVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(CreateSecondaryVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct CreateSecondaryVmRequestTypeSer<'b, 'a> {
    data: &'b CreateSecondaryVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CreateSecondaryVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"CreateSecondaryVMRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct CreateSecondaryVmExRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
    spec: Option<&'a crate::types::structs::FaultToleranceConfigSpec>,
}

impl<'a> miniserde::Serialize for CreateSecondaryVmExRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(CreateSecondaryVmExRequestTypeSer { data: self, seq: 0 }))
    }
}

struct CreateSecondaryVmExRequestTypeSer<'b, 'a> {
    data: &'b CreateSecondaryVmExRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CreateSecondaryVmExRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"CreateSecondaryVMExRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                2 => {
                    let Some(ref val) = self.data.spec else { continue; };
                    return Some((std::borrow::Cow::Borrowed("spec"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct CreateSnapshotRequestType<'a> {
    name: &'a str,
    description: Option<&'a str>,
    memory: bool,
    quiesce: bool,
}

impl<'a> miniserde::Serialize for CreateSnapshotRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(CreateSnapshotRequestTypeSer { data: self, seq: 0 }))
    }
}

struct CreateSnapshotRequestTypeSer<'b, 'a> {
    data: &'b CreateSnapshotRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CreateSnapshotRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"CreateSnapshotRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("name"), &self.data.name as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.description else { continue; };
                    return Some((std::borrow::Cow::Borrowed("description"), val as &dyn miniserde::Serialize));
                }
                3 => return Some((std::borrow::Cow::Borrowed("memory"), &self.data.memory as &dyn miniserde::Serialize)),
                4 => return Some((std::borrow::Cow::Borrowed("quiesce"), &self.data.quiesce as &dyn miniserde::Serialize)),
                _ => return None,
            }
        }
    }
}
struct CreateSnapshotExRequestType<'a> {
    name: &'a str,
    description: Option<&'a str>,
    memory: bool,
    quiesce_spec: Option<&'a dyn crate::types::traits::VirtualMachineGuestQuiesceSpecTrait>,
}

impl<'a> miniserde::Serialize for CreateSnapshotExRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(CreateSnapshotExRequestTypeSer { data: self, seq: 0 }))
    }
}

struct CreateSnapshotExRequestTypeSer<'b, 'a> {
    data: &'b CreateSnapshotExRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CreateSnapshotExRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"CreateSnapshotExRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("name"), &self.data.name as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.description else { continue; };
                    return Some((std::borrow::Cow::Borrowed("description"), val as &dyn miniserde::Serialize));
                }
                3 => return Some((std::borrow::Cow::Borrowed("memory"), &self.data.memory as &dyn miniserde::Serialize)),
                4 => {
                    let Some(ref val) = self.data.quiesce_spec else { continue; };
                    return Some((std::borrow::Cow::Borrowed("quiesceSpec"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct CustomizeVmRequestType<'a> {
    spec: &'a crate::types::structs::CustomizationSpec,
}

impl<'a> miniserde::Serialize for CustomizeVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(CustomizeVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct CustomizeVmRequestTypeSer<'b, 'a> {
    data: &'b CustomizeVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CustomizeVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"CustomizeVMRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct DetachDiskRequestType<'a> {
    disk_id: &'a crate::types::structs::Id,
}

impl<'a> miniserde::Serialize for DetachDiskRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(DetachDiskRequestTypeSer { data: self, seq: 0 }))
    }
}

struct DetachDiskRequestTypeSer<'b, 'a> {
    data: &'b DetachDiskRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for DetachDiskRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"DetachDiskRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("diskId"), &self.data.disk_id as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct DisableSecondaryVmRequestType<'a> {
    vm: &'a crate::types::structs::ManagedObjectReference,
}

impl<'a> miniserde::Serialize for DisableSecondaryVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(DisableSecondaryVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct DisableSecondaryVmRequestTypeSer<'b, 'a> {
    data: &'b DisableSecondaryVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for DisableSecondaryVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"DisableSecondaryVMRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("vm"), &self.data.vm as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct DropConnectionsRequestType<'a> {
    list_of_connections: Option<&'a [Box<dyn crate::types::traits::VirtualMachineConnectionTrait>]>,
}

impl<'a> miniserde::Serialize for DropConnectionsRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(DropConnectionsRequestTypeSer { data: self, seq: 0 }))
    }
}

struct DropConnectionsRequestTypeSer<'b, 'a> {
    data: &'b DropConnectionsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for DropConnectionsRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"DropConnectionsRequestType")),
                1 => {
                    let Some(ref val) = self.data.list_of_connections else { continue; };
                    return Some((std::borrow::Cow::Borrowed("listOfConnections"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct EnableSecondaryVmRequestType<'a> {
    vm: &'a crate::types::structs::ManagedObjectReference,
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
}

impl<'a> miniserde::Serialize for EnableSecondaryVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(EnableSecondaryVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct EnableSecondaryVmRequestTypeSer<'b, 'a> {
    data: &'b EnableSecondaryVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for EnableSecondaryVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"EnableSecondaryVMRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("vm"), &self.data.vm as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct InstantCloneRequestType<'a> {
    spec: &'a crate::types::structs::VirtualMachineInstantCloneSpec,
}

impl<'a> miniserde::Serialize for InstantCloneRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(InstantCloneRequestTypeSer { data: self, seq: 0 }))
    }
}

struct InstantCloneRequestTypeSer<'b, 'a> {
    data: &'b InstantCloneRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for InstantCloneRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"InstantCloneRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct MakePrimaryVmRequestType<'a> {
    vm: &'a crate::types::structs::ManagedObjectReference,
}

impl<'a> miniserde::Serialize for MakePrimaryVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(MakePrimaryVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct MakePrimaryVmRequestTypeSer<'b, 'a> {
    data: &'b MakePrimaryVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for MakePrimaryVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"MakePrimaryVMRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("vm"), &self.data.vm as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct MarkAsVirtualMachineRequestType<'a> {
    pool: &'a crate::types::structs::ManagedObjectReference,
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
}

impl<'a> miniserde::Serialize for MarkAsVirtualMachineRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(MarkAsVirtualMachineRequestTypeSer { data: self, seq: 0 }))
    }
}

struct MarkAsVirtualMachineRequestTypeSer<'b, 'a> {
    data: &'b MarkAsVirtualMachineRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for MarkAsVirtualMachineRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"MarkAsVirtualMachineRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("pool"), &self.data.pool as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct MigrateVmRequestType<'a> {
    pool: Option<&'a crate::types::structs::ManagedObjectReference>,
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
    priority: crate::types::enums::VirtualMachineMovePriorityEnum,
    state: Option<crate::types::enums::VirtualMachinePowerStateEnum>,
}

impl<'a> miniserde::Serialize for MigrateVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(MigrateVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct MigrateVmRequestTypeSer<'b, 'a> {
    data: &'b MigrateVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for MigrateVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"MigrateVMRequestType")),
                1 => {
                    let Some(ref val) = self.data.pool else { continue; };
                    return Some((std::borrow::Cow::Borrowed("pool"), val as &dyn miniserde::Serialize));
                }
                2 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                3 => return Some((std::borrow::Cow::Borrowed("priority"), &self.data.priority as &dyn miniserde::Serialize)),
                4 => {
                    let Some(ref val) = self.data.state else { continue; };
                    return Some((std::borrow::Cow::Borrowed("state"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct PowerOnVmRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
}

impl<'a> miniserde::Serialize for PowerOnVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(PowerOnVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct PowerOnVmRequestTypeSer<'b, 'a> {
    data: &'b PowerOnVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for PowerOnVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"PowerOnVMRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct PromoteDisksRequestType<'a> {
    unlink: bool,
    disks: Option<&'a [crate::types::structs::VirtualDisk]>,
}

impl<'a> miniserde::Serialize for PromoteDisksRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(PromoteDisksRequestTypeSer { data: self, seq: 0 }))
    }
}

struct PromoteDisksRequestTypeSer<'b, 'a> {
    data: &'b PromoteDisksRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for PromoteDisksRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"PromoteDisksRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("unlink"), &self.data.unlink as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.disks else { continue; };
                    return Some((std::borrow::Cow::Borrowed("disks"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct PutUsbScanCodesRequestType<'a> {
    spec: &'a crate::types::structs::UsbScanCodeSpec,
}

impl<'a> miniserde::Serialize for PutUsbScanCodesRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(PutUsbScanCodesRequestTypeSer { data: self, seq: 0 }))
    }
}

struct PutUsbScanCodesRequestTypeSer<'b, 'a> {
    data: &'b PutUsbScanCodesRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for PutUsbScanCodesRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"PutUsbScanCodesRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct QueryChangedDiskAreasRequestType<'a> {
    snapshot: Option<&'a crate::types::structs::ManagedObjectReference>,
    device_key: i32,
    start_offset: i64,
    change_id: &'a str,
}

impl<'a> miniserde::Serialize for QueryChangedDiskAreasRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(QueryChangedDiskAreasRequestTypeSer { data: self, seq: 0 }))
    }
}

struct QueryChangedDiskAreasRequestTypeSer<'b, 'a> {
    data: &'b QueryChangedDiskAreasRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for QueryChangedDiskAreasRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"QueryChangedDiskAreasRequestType")),
                1 => {
                    let Some(ref val) = self.data.snapshot else { continue; };
                    return Some((std::borrow::Cow::Borrowed("snapshot"), val as &dyn miniserde::Serialize));
                }
                2 => return Some((std::borrow::Cow::Borrowed("deviceKey"), &self.data.device_key as &dyn miniserde::Serialize)),
                3 => return Some((std::borrow::Cow::Borrowed("startOffset"), &self.data.start_offset as &dyn miniserde::Serialize)),
                4 => return Some((std::borrow::Cow::Borrowed("changeId"), &self.data.change_id as &dyn miniserde::Serialize)),
                _ => return None,
            }
        }
    }
}
struct QueryFaultToleranceCompatibilityExRequestType {
    for_legacy_ft: Option<bool>,
}

impl miniserde::Serialize for QueryFaultToleranceCompatibilityExRequestType {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(QueryFaultToleranceCompatibilityExRequestTypeSer { data: self, seq: 0 }))
    }
}

struct QueryFaultToleranceCompatibilityExRequestTypeSer<'b> {
    data: &'b QueryFaultToleranceCompatibilityExRequestType,
    seq: usize,
}

impl<'b> miniserde::ser::Map for QueryFaultToleranceCompatibilityExRequestTypeSer<'b> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"QueryFaultToleranceCompatibilityExRequestType")),
                1 => {
                    let Some(ref val) = self.data.for_legacy_ft else { continue; };
                    return Some((std::borrow::Cow::Borrowed("forLegacyFt"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct ReconfigVmRequestType<'a> {
    spec: &'a crate::types::structs::VirtualMachineConfigSpec,
}

impl<'a> miniserde::Serialize for ReconfigVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(ReconfigVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct ReconfigVmRequestTypeSer<'b, 'a> {
    data: &'b ReconfigVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for ReconfigVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"ReconfigVMRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct ReloadVirtualMachineFromPathRequestType<'a> {
    configuration_path: &'a str,
}

impl<'a> miniserde::Serialize for ReloadVirtualMachineFromPathRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(ReloadVirtualMachineFromPathRequestTypeSer { data: self, seq: 0 }))
    }
}

struct ReloadVirtualMachineFromPathRequestTypeSer<'b, 'a> {
    data: &'b ReloadVirtualMachineFromPathRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for ReloadVirtualMachineFromPathRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"reloadVirtualMachineFromPathRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("configurationPath"), &self.data.configuration_path as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct RelocateVmRequestType<'a> {
    spec: &'a crate::types::structs::VirtualMachineRelocateSpec,
    priority: Option<crate::types::enums::VirtualMachineMovePriorityEnum>,
}

impl<'a> miniserde::Serialize for RelocateVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(RelocateVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct RelocateVmRequestTypeSer<'b, 'a> {
    data: &'b RelocateVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RelocateVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"RelocateVMRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.priority else { continue; };
                    return Some((std::borrow::Cow::Borrowed("priority"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct RemoveAllSnapshotsRequestType<'a> {
    consolidate: Option<bool>,
    spec: Option<&'a crate::types::structs::SnapshotSelectionSpec>,
}

impl<'a> miniserde::Serialize for RemoveAllSnapshotsRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(RemoveAllSnapshotsRequestTypeSer { data: self, seq: 0 }))
    }
}

struct RemoveAllSnapshotsRequestTypeSer<'b, 'a> {
    data: &'b RemoveAllSnapshotsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RemoveAllSnapshotsRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"RemoveAllSnapshotsRequestType")),
                1 => {
                    let Some(ref val) = self.data.consolidate else { continue; };
                    return Some((std::borrow::Cow::Borrowed("consolidate"), val as &dyn miniserde::Serialize));
                }
                2 => {
                    let Some(ref val) = self.data.spec else { continue; };
                    return Some((std::borrow::Cow::Borrowed("spec"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct RenameRequestType<'a> {
    new_name: &'a str,
}

impl<'a> miniserde::Serialize for RenameRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(RenameRequestTypeSer { data: self, seq: 0 }))
    }
}

struct RenameRequestTypeSer<'b, 'a> {
    data: &'b RenameRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RenameRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"RenameRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("newName"), &self.data.new_name as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct RevertToCurrentSnapshotRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
    suppress_power_on: Option<bool>,
}

impl<'a> miniserde::Serialize for RevertToCurrentSnapshotRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(RevertToCurrentSnapshotRequestTypeSer { data: self, seq: 0 }))
    }
}

struct RevertToCurrentSnapshotRequestTypeSer<'b, 'a> {
    data: &'b RevertToCurrentSnapshotRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RevertToCurrentSnapshotRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"RevertToCurrentSnapshotRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                2 => {
                    let Some(ref val) = self.data.suppress_power_on else { continue; };
                    return Some((std::borrow::Cow::Borrowed("suppressPowerOn"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct SetCustomValueRequestType<'a> {
    key: &'a str,
    value: &'a str,
}

impl<'a> miniserde::Serialize for SetCustomValueRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(SetCustomValueRequestTypeSer { data: self, seq: 0 }))
    }
}

struct SetCustomValueRequestTypeSer<'b, 'a> {
    data: &'b SetCustomValueRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for SetCustomValueRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"setCustomValueRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("key"), &self.data.key as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("value"), &self.data.value as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct SetDisplayTopologyRequestType<'a> {
    displays: &'a [crate::types::structs::VirtualMachineDisplayTopology],
}

impl<'a> miniserde::Serialize for SetDisplayTopologyRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(SetDisplayTopologyRequestTypeSer { data: self, seq: 0 }))
    }
}

struct SetDisplayTopologyRequestTypeSer<'b, 'a> {
    data: &'b SetDisplayTopologyRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for SetDisplayTopologyRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"SetDisplayTopologyRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("displays"), &self.data.displays as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct SetScreenResolutionRequestType {
    width: i32,
    height: i32,
}

impl miniserde::Serialize for SetScreenResolutionRequestType {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(SetScreenResolutionRequestTypeSer { data: self, seq: 0 }))
    }
}

struct SetScreenResolutionRequestTypeSer<'b> {
    data: &'b SetScreenResolutionRequestType,
    seq: usize,
}

impl<'b> miniserde::ser::Map for SetScreenResolutionRequestTypeSer<'b> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"SetScreenResolutionRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("width"), &self.data.width as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("height"), &self.data.height as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct StartRecordingRequestType<'a> {
    name: &'a str,
    description: Option<&'a str>,
}

impl<'a> miniserde::Serialize for StartRecordingRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(StartRecordingRequestTypeSer { data: self, seq: 0 }))
    }
}

struct StartRecordingRequestTypeSer<'b, 'a> {
    data: &'b StartRecordingRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for StartRecordingRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"StartRecordingRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("name"), &self.data.name as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.description else { continue; };
                    return Some((std::borrow::Cow::Borrowed("description"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct StartReplayingRequestType<'a> {
    replay_snapshot: &'a crate::types::structs::ManagedObjectReference,
}

impl<'a> miniserde::Serialize for StartReplayingRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(StartReplayingRequestTypeSer { data: self, seq: 0 }))
    }
}

struct StartReplayingRequestTypeSer<'b, 'a> {
    data: &'b StartReplayingRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for StartReplayingRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        let seq = self.seq;
        self.seq += 1;
        match seq {
            0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"StartReplayingRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("replaySnapshot"), &self.data.replay_snapshot as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct TerminateFaultTolerantVmRequestType<'a> {
    vm: Option<&'a crate::types::structs::ManagedObjectReference>,
}

impl<'a> miniserde::Serialize for TerminateFaultTolerantVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(TerminateFaultTolerantVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct TerminateFaultTolerantVmRequestTypeSer<'b, 'a> {
    data: &'b TerminateFaultTolerantVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for TerminateFaultTolerantVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"TerminateFaultTolerantVMRequestType")),
                1 => {
                    let Some(ref val) = self.data.vm else { continue; };
                    return Some((std::borrow::Cow::Borrowed("vm"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct UpgradeToolsRequestType<'a> {
    installer_options: Option<&'a str>,
}

impl<'a> miniserde::Serialize for UpgradeToolsRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(UpgradeToolsRequestTypeSer { data: self, seq: 0 }))
    }
}

struct UpgradeToolsRequestTypeSer<'b, 'a> {
    data: &'b UpgradeToolsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for UpgradeToolsRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"UpgradeToolsRequestType")),
                1 => {
                    let Some(ref val) = self.data.installer_options else { continue; };
                    return Some((std::borrow::Cow::Borrowed("installerOptions"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct UpgradeVmRequestType<'a> {
    version: Option<&'a str>,
}

impl<'a> miniserde::Serialize for UpgradeVmRequestType<'a> {
    fn begin(&self) -> miniserde::ser::Fragment<'_> {
        miniserde::ser::Fragment::Map(Box::new(UpgradeVmRequestTypeSer { data: self, seq: 0 }))
    }
}

struct UpgradeVmRequestTypeSer<'b, 'a> {
    data: &'b UpgradeVmRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for UpgradeVmRequestTypeSer<'b, 'a> {
    fn next(&mut self) -> Option<(std::borrow::Cow<'_, str>, &dyn miniserde::Serialize)> {
        loop {
            let seq = self.seq;
            self.seq += 1;
            match seq {
                0 => return Some((std::borrow::Cow::Borrowed("_typeName"), &"UpgradeVMRequestType")),
                1 => {
                    let Some(ref val) = self.data.version else { continue; };
                    return Some((std::borrow::Cow::Borrowed("version"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}