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
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// A *DistributedVirtualSwitch* managed object is a virtual network
/// switch that is located on a vCenter Server.
/// 
/// A distributed virtual switch
/// manages configuration for proxy switches (*HostProxySwitch*).
/// A proxy switch is located on an ESXi host that is managed by the vCenter
/// Server and is a member of the switch.
/// A distributed switch also provides virtual port state management
/// so that port state is maintained when vCenter Server operations
/// move a virtual machine from one host to another.
/// 
/// A proxy switch performs network I/O to support the following network traffic
/// and operations:
/// - Network traffic between virtual machines on any hosts that are members
///   of the distributed virtual switch.
/// - Network traffic between virtual machines that uses a distributed switch
///   and a virtual machine that uses a VMware standard switch.
/// - Network traffic between a virtual machine and a remote system
///   on a physical network connected to the ESXi host.
/// - vSphere system operations to support capabilities
///   such as VMotion or High Availability.
///   
/// A *DistributedVirtualSwitch* is the base distributed
/// switch implementation. It supports a VMware distributed virtual
/// switch implementation and it supports third party distributed
/// switch implementations. The base implementation provides
/// the following capabilities
/// (*DVSFeatureCapability*):
/// - NIC teaming
/// - Network I/O control
/// - Network resource allocation
/// - Quality of service tag support
/// - User-defined resource pools
/// - I/O passthrough (VMDirectPath Gen2)
///   
/// A *VmwareDistributedVirtualSwitch*
/// supports the following additional capabilities
/// (*DVSFeatureCapability* and
/// *VMwareDVSFeatureCapability*):
/// - Backup, restore, and rollback for a VMware distributed virtual switch
///   and its associated portgroups.
/// - Maximum Transmission Unit (MTU) configuration.
/// - Health check operations for NIC teaming and VLAN/MTU support.
/// - Monitoring switch traffic using Internet Protocol Flow Information Export (IPFIX).
/// - Link Layer Discovery Protocol (LLDP).
/// - Virtual network segmentation using a Private VLAN (PVLAN).
/// - VLAN-based SPAN (VSPAN) for virtual distributed port mirroring.
/// - Link Aggregation Control Protocol (LACP) defined for uplink portgroups.
///   
/// **Distributed Virtual Switch Configuration**
/// 
/// To use a distributed virtual switch, you create a switch and portgroups
/// on a vCenter Server, and add hosts as members of the switch.
/// 1. Create a distributed virtual switch
///    (*Folder*.*Folder.CreateDVS_Task*).
///    Use a *DVSConfigSpec* to create a switch
///    for a third-party implementation. Use a
///    *VMwareDVSConfigSpec* to create
///    a VMware distributed virtual switch.
/// 2. Create portgroups (*DistributedVirtualSwitch.CreateDVPortgroup_Task*)
///    for host and virtual machine network connections and for the connection between
///    proxy switches and physical NICs.
///    A *DistributedVirtualPortgroup* specifies how
///    virtual ports (*DistributedVirtualPort*) will be used.
///    When you create a distributed virtual switch, the vCenter Server
///    automatically creates one uplink portgroup
///    (*DistributedVirtualSwitch.config*.*DVSConfigInfo.uplinkPortgroup*).
///    Uplink portgroups are distributed virtual portgroups that support
///    the connection between proxy switches and physical NICs.
///    
///    Port creation on a distributed switch is determined by the
///    portgroup type
///    (*DVPortgroupConfigSpec*.*DVPortgroupConfigSpec.type*):
///    - If a portgroup is early binding (static), then
///      *DVPortgroupConfigSpec*.*DVPortgroupConfigSpec.numPorts*
///      determines the number of ports that get created when the portgroup is created.
///      This number can be increased if
///      *DVPortgroupConfigSpec*.*DVPortgroupConfigSpec.autoExpand*
///      is <code>true</code>.
///    - If a portgroup is ephemeral (dynamic), then
///      *DVPortgroupConfigSpec.numPorts*
///      is ignored and ports are created as needed.
///      
///    You can also specify standalone ports that are not associated with
///    a port group and uplink ports that are created on ESXi hosts
///    (*DVSConfigSpec*.*DVSConfigSpec.numStandalonePorts*).
///    
///    The *DVPortgroupConfigInfo*.*DVPortgroupConfigInfo.numPorts*
///    property is the total number of ports for a distributed virtual switch.
///    This total includes the ports generated by the static and dynamic portgroups
///    and the standalone ports.
/// 3. If you have created additional uplink portgroups, use the
///    *DistributedVirtualSwitch.ReconfigureDvs_Task* method
///    to add the portgroup(s) to the
///    *DVSConfigSpec*.*DVSConfigSpec.uplinkPortgroup*
///    array.
/// 4. Retrieve physical NIC device names from the host
///    (*HostSystem*.*HostSystem.config*.*HostConfigInfo.network*.*HostNetworkInfo.pnic*\[\].*PhysicalNic.device*).
/// 5. Add host member(s) to the distributed virtual switch. To configure host members:
///    - Specify hosts
///      (*DVSConfigSpec*.*DVSConfigSpec.host*\[\]).
///    - For each host, specify one or more physical NIC device names
///      to identify the pNIC(s) for the host proxy connection to the network
///      (*DistributedVirtualSwitchHostMemberConfigSpec*.*DistributedVirtualSwitchHostMemberConfigSpec.backing*.*DistributedVirtualSwitchHostMemberPnicBacking.pnicSpec*\[\].*DistributedVirtualSwitchHostMemberPnicSpec.pnicDevice*)
///    - Use the
///      *DistributedVirtualSwitch*.*DistributedVirtualSwitch.ReconfigureDvs_Task*
///      method to update the switch configuration.
///      
///    When you add a host to a distributed virtual switch
///    (*DistributedVirtualSwitch*.*DistributedVirtualSwitch.config*.*DVSConfigInfo.host*),
///    the host automatically creates a proxy switch. The proxy switch is removed automatically
///    when the host is removed from the distributed virtual switch.
/// 6. Connect hosts and virtual machines to the distributed virtual switch.
///    
///    <table style="border:0">
///    <tr>
///    <td style="border:0">Host connection</td>
///    <td style="border:0">Specify port or portgroup connections in the host virtual NIC spec
///    (*HostVirtualNicSpec*.*HostVirtualNicSpec.distributedVirtualPort*
///    or *HostVirtualNicSpec*.*HostVirtualNicSpec.portgroup*).</td>
///    </tr>
///    <tr>
///    <td style="border:0">Virtual machine connection</td>
///    <td style="border:0">Specify port or portgroup connections in the distributed virtual port backing
///    (*VirtualEthernetCardDistributedVirtualPortBackingInfo*)
///    for the virtual Ethernet cards on the virtual machine
///    (*VirtualEthernetCard*.*VirtualDevice.backing*).</td>
///    </tr>
///    </table>
///    
/// **Backup, Rollback, and Query Operations**
/// 
/// If you are using a *VmwareDistributedVirtualSwitch*,
/// you can perform backup and rollback operations on the switch
/// and its associated distributed virtual portgroups.
/// When you reconfigure a VMware distributed virtual switch
/// (*DistributedVirtualSwitch.ReconfigureDvs_Task*), the Server
/// saves the current switch configuration before applying the
/// configuration updates. The saved switch configuration includes
/// portgroup configuration data. The Server uses the saved switch
/// configuration as a checkpoint for rollback operations.
/// You can rollback the switch or portgroup configuration
/// to the saved configuration, or you can rollback to a backup
/// configuration (*EntityBackupConfig*).
/// - To backup the switch and portgroup configuration, use the
///   *DistributedVirtualSwitchManager*.*DistributedVirtualSwitchManager.DVSManagerExportEntity_Task*
///   method. The export method produces a
///   *EntityBackupConfig* object. The backup configuration
///   contains the switch and/or portgroups specified in the
///   <code>SelectionSet</code> parameter.
///   To backup the complete configuration you must select the
///   distributed virtual switch and all of its portgroups.
/// - To rollback the switch configuration, use the
///   *DistributedVirtualSwitch.DVSRollback_Task* method
///   to determine if the switch configuration has changed.
///   If it has changed, use the
///   *DistributedVirtualSwitch.ReconfigureDvs_Task*
///   method to complete the rollback operation.
/// - To rollback the portgroup configuration, use the
///   *DistributedVirtualPortgroup*.*DistributedVirtualPortgroup.DVPortgroupRollback_Task*
///   method to determine if the portgroup configuration
///   has changed. If it has changed, use the
///   *DistributedVirtualPortgroup.ReconfigureDVPortgroup_Task*
///   method to complete the rollback operation.  
///   
/// To perform query operations on a distributed virtual switch,
/// use the *DistributedVirtualSwitchManager* methods.
#[derive(Clone)]
pub struct DistributedVirtualSwitch {
    client: Arc<dyn VimClient>,
    mo_id: String,
}
impl DistributedVirtualSwitch {
    pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
        Self {
            client,
            mo_id: mo_id.to_string(),
        }
    }
    /// Deprecated as of vSphere API 6.0
    /// Use *DistributedVirtualSwitch.DvsReconfigureVmVnicNetworkResourcePool_Task* instead
    /// to add a Virtual NIC network resource pool.
    /// 
    /// Add a network resource pool.
    /// 
    /// ***Required privileges:*** DVSwitch.ResourceManagement
    ///
    /// ## Parameters:
    ///
    /// ### config_spec
    /// the network resource pool configuration specification.
    ///
    /// ## Errors:
    ///
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***NotSupported***: if network I/O control is not supported on
    /// the vSphere Distributed Switch.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn add_network_resource_pool(&self, config_spec: &[crate::types::structs::DvsNetworkResourcePoolConfigSpec]) -> Result<()> {
        let input = AddNetworkResourcePoolRequestType {config_spec, };
        self.client.invoke_void("", "DistributedVirtualSwitch", &self.mo_id, "AddNetworkResourcePool", Some(&input)).await
    }
    /// Creates a single *DistributedVirtualPortgroup* and adds it
    /// to the distributed virtual switch.
    /// 
    /// ***Required privileges:*** DVPortgroup.Create
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// The specification for the portgroup.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object. The
    /// *Task*.*Task.info*.*TaskInfo.result* property
    /// contains a managed object reference to the new portgroup.
    /// The *DistributedVirtualSwitch.portgroup* property also contains
    /// the reference.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***DuplicateName***: if a portgroup with the same name already exists
    /// 
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***InvalidName***: if name of the portgroup is invalid
    pub async fn create_dv_portgroup_task(&self, spec: &crate::types::structs::DvPortgroupConfigSpec) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = CreateDvPortgroupRequestType {spec, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "CreateDVPortgroup_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Creates one or more *DistributedVirtualPortgroup*s and adds them to
    /// the distributed virtual switch.
    /// 
    /// ***Required privileges:*** DVPortgroup.Create
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// The specification for the portgroup.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// The method does not return a value in the
    /// *Task*.*Task.info*.*TaskInfo.result* property.
    /// Use the *DistributedVirtualSwitch.portgroup* property to obtain
    /// managed object references to the new portgroups.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: If called directly on a host.
    /// 
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn add_dv_portgroup_task(&self, spec: &[crate::types::structs::DvPortgroupConfigSpec]) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = AddDvPortgroupRequestType {spec, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "AddDVPortgroup_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// 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:*** DVSwitch.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("", "DistributedVirtualSwitch", &self.mo_id, "Destroy_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Enable/Disable network I/O control on the vSphere Distributed Switch.
    /// 
    /// ***Required privileges:*** DVSwitch.ResourceManagement
    ///
    /// ## Parameters:
    ///
    /// ### enable
    /// If true, enables I/O control. If false,
    /// disables network I/O control.
    ///
    /// ## Errors:
    ///
    /// ***DvsFault***: if the enabling/disabling fails.
    /// 
    /// ***NotSupported***: if network I/O control is not supported on
    /// the vSphere Distributed Switch.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn enable_network_resource_management(&self, enable: bool) -> Result<()> {
        let input = EnableNetworkResourceManagementRequestType {enable, };
        self.client.invoke_void("", "DistributedVirtualSwitch", &self.mo_id, "EnableNetworkResourceManagement", Some(&input)).await
    }
    /// Return the keys of ports that meet the criteria.
    /// 
    /// On an ESXi host,
    /// the property shows only the connected ports currently on the host.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### criteria
    /// The port selection criteria. If unset, the operation
    /// returns the keys of all the ports in the switch.
    pub async fn fetch_dv_port_keys(&self, criteria: Option<&crate::types::structs::DistributedVirtualSwitchPortCriteria>) -> Result<Option<Vec<String>>> {
        let input = FetchDvPortKeysRequestType {criteria, };
        let bytes_opt = self.client.invoke_optional("", "DistributedVirtualSwitch", &self.mo_id, "FetchDVPortKeys", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Return the ports that meet the criteria.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### criteria
    /// The port selection criteria. If unset, the operation
    /// returns the keys of all the ports in the portgroup.
    pub async fn fetch_dv_ports(&self, criteria: Option<&crate::types::structs::DistributedVirtualSwitchPortCriteria>) -> Result<Option<Vec<crate::types::structs::DistributedVirtualPort>>> {
        let input = FetchDvPortsRequestType {criteria, };
        let bytes_opt = self.client.invoke_optional("", "DistributedVirtualSwitch", &self.mo_id, "FetchDVPorts", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Returns the portgroup identified by the key within this VDS.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### portgroup_key
    /// The key that identifies a portgroup of this VDS.
    ///
    /// ## Returns:
    ///
    /// Refers instance of *DistributedVirtualPortgroup*.
    ///
    /// ## Errors:
    ///
    /// ***NotFound***: If the portgroup for the specified key is not found.
    /// 
    /// ***NotSupported***: If the operation is not supported.
    pub async fn lookup_dv_port_group(&self, portgroup_key: &str) -> Result<Option<crate::types::structs::ManagedObjectReference>> {
        let input = LookupDvPortGroupRequestType {portgroup_key, };
        let bytes_opt = self.client.invoke_optional("", "DistributedVirtualSwitch", &self.mo_id, "LookupDvPortGroup", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Deprecated as of vSphere API 5.5.
    /// 
    /// Merge an existing DistributedVirtualSwitch (source) to this switch
    /// (destination).
    /// 
    /// The host members and the connected entity of the source
    /// switch will be transferred to the destination switch. This operation
    /// disconnects the entities from the source switch, tears down its host
    /// proxy switches, creates new proxies for the destination switch,
    /// and reconnects the entities to the destination switch.
    /// 
    /// In summary, this operation does the following:
    /// - Adds the
    ///   <code>config</code>.*DVSConfigInfo.maxPorts*
    ///   of the source switch to the <code>maxPorts</code> of the
    ///   destination switch.
    /// - The host members of the source switch leave the source switch
    ///   and join the destination switch with the same Physical NIC and
    ///   VirtualSwitch (if applicable). A set of new uplink ports,
    ///   compliant with the
    ///   *DVSConfigSpec.uplinkPortPolicy*,
    ///   is created as the hosts join the destination switch.
    /// - The portgroups on the source switch are copied over to destination
    ///   switch, by calculating the effective default port config and
    ///   creating a portgroup of the same name in the destination switch. If
    ///   the name already exists, the copied portgroup uses names following a
    ///   "Copy of switch-portgroup-name" scheme to avoid conflict. The same
    ///   number of ports are created inside each copied portgroup.
    /// - The standalone distributed virtual ports are not copied,
    ///   unless there is a virtual
    ///   machine or host virtual NIC connecting to it. In that case, the
    ///   operation calculates the effective port config and creates a port
    ///   in the destination switch with the same name. Name conflict is
    ///   resolved using numbers like "original-port-name(1)". The uplink ports
    ///   are not copied over.
    /// - The virtual machine and host virtual NICs are disconnected from the source
    ///   switch and reconnected with the destination switch, to the
    ///   copied standalone port or portgroup.
    /// - If you are using a *VmwareDistributedVirtualSwitch* -
    ///   Unless the PVLAN map contains exactly the same entries between
    ///   the source and destination VMware distributed virtual switches,
    ///   the method raises a fault if
    ///   *VmwareDistributedVirtualSwitchPvlanSpec.pvlanId*
    ///   is set in any port, portgroup, or switch that will be copied.
    ///   
    /// ***Required privileges:*** DVSwitch.Modify
    ///
    /// ## Parameters:
    ///
    /// ### dvs
    /// The switch (source) to be merged
    /// 
    /// ***Required privileges:*** DVSwitch.Delete
    /// 
    /// Refers instance of *DistributedVirtualSwitch*.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: If called directly on a host.
    /// 
    /// ***ResourceInUse***: If failed to delete the source switch
    /// 
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn merge_dvs_task(&self, dvs: &crate::types::structs::ManagedObjectReference) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = MergeDvsRequestType {dvs, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "MergeDvs_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 6.0.
    /// 
    /// Move the ports out of their current portgroup into the specified portgroup.
    /// 
    /// If the moving of any of the ports results in a violation of the portgroup
    /// policy, or type of the source or destination portgroup, the operation
    /// raises a fault. A conflict port cannot be moved.
    /// 
    /// ***Required privileges:*** DVSwitch.Modify
    ///
    /// ## Parameters:
    ///
    /// ### port_key
    /// The keys of the ports to be moved into the portgroup.
    ///
    /// ### destination_portgroup_key
    /// The key of the portgroup to be moved into.
    /// If unset, the port will be moved under the switch.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: If called directly on a host.
    /// 
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn move_dv_port_task(&self, port_key: &[String], destination_portgroup_key: Option<&str>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = MoveDvPortRequestType {port_key, destination_portgroup_key, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "MoveDVPort_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// This method updates the *DistributedVirtualSwitch* product specifications.
    /// 
    /// ***Required privileges:*** DVSwitch.Modify
    ///
    /// ## Parameters:
    ///
    /// ### operation
    /// The operation. See *DistributedVirtualSwitchProductSpecOperationType_enum* for
    /// valid values. For
    /// *VmwareDistributedVirtualSwitch*,
    /// only *upgrade*
    /// is valid.
    ///
    /// ### product_spec
    /// The product info of the implementation.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: If called directly on a host.
    /// 
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn perform_dvs_product_spec_operation_task(&self, operation: &str, product_spec: Option<&crate::types::structs::DistributedVirtualSwitchProductSpec>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = PerformDvsProductSpecOperationRequestType {operation, product_spec, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "PerformDvsProductSpecOperation_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Return the used VLAN ID (PVLAN excluded) in the switch.
    /// 
    /// ***Required privileges:*** System.Read
    pub async fn query_used_vlan_id_in_dvs(&self) -> Result<Option<Vec<i32>>> {
        let bytes_opt = self.client.invoke_optional("", "DistributedVirtualSwitch", &self.mo_id, "QueryUsedVlanIdInDvs", None).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Reconfigures a distributed virtual switch.
    /// 
    /// You can use this method
    /// to set switch properties or to reset the switch to a previous state.
    /// 
    /// **Reconfiguring a Standard Distributed Virtual Switch**
    /// 
    /// To reconfigure a *DistributedVirtualSwitch*,
    /// use a *DVSConfigSpec*
    /// to set the switch properties.
    /// 
    /// **Reconfiguring a VMware Distributed Virtual Switch**
    /// 
    /// If you use a *VmwareDistributedVirtualSwitch*,
    /// you can perform the following switch reconfiguration:
    /// - Use a *VMwareDVSConfigSpec*
    ///   to set the switch properties.
    /// - Use the *VMwareDVSConfigSpec*
    ///   returned by *DistributedVirtualSwitch.DVSRollback_Task*
    ///   to reset the switch to a previous state.
    ///   
    /// Reconfiguring the switch may require any of the following privileges,
    /// depending on what is being changed:
    /// - DVSwitch.PolicyOp if *DVSConfigSpec.policy*
    ///   is set.
    /// - DVSwitch.PortSetting if *DVSConfigSpec.defaultPortConfig*
    ///   is set.
    /// - DVSwitch.HostOp if *DVSConfigSpec.policy*
    ///   is set. The
    ///   user will also need the Host.Config.Network
    ///   privilege on the host.
    /// - DVSwitch.Vspan if *VMwareDVSConfigSpec.vspanConfigSpec*
    ///   is set.
    /// - DVSwitch.Modify for anything else.
    ///
    /// ## Parameters:
    ///
    /// ### spec
    /// The configuration of the switch
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: if called directly on a host or if the spec
    /// includes settings for any vNetwork Distributed
    /// Switch feature that is not supported on this
    /// switch.
    /// 
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *DVSConfigInfo.extensionKey*.
    /// 
    /// ***ResourceNotAvailable***: If there is no port available in the portgroup
    /// 
    /// ***VspanPortConflict***: if dvPort is used as both the transmitted source and destination ports in Distributed Port Mirroring sessions.
    /// 
    /// ***VspanPromiscuousPortNotSupported***: if a promiscuous port is used as transmitted source or destination in the Distributed Port Mirroring sessions.
    /// 
    /// ***VspanSameSessionPortConflict***: if a dvPort is used as both the source and destination in the same Distributed Port Mirroring session.
    /// 
    /// ***VspanDestPortConflict***: if a dvPort is used as desination ports in multiple Distributed Port Mirroring sessions.
    pub async fn reconfigure_dvs_task(&self, spec: &dyn crate::types::traits::DvsConfigSpecTrait) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = ReconfigureDvsRequestType {spec, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "ReconfigureDvs_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Reconfigure individual ports.
    /// 
    /// ***Required privileges:*** DVSwitch.PortConfig
    ///
    /// ## Parameters:
    ///
    /// ### port
    /// The specification of the ports.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: If called directly on a host or if the switch
    /// implementation doesn't support this API or if the spec
    /// includes settings for any vSphere Distributed Switch
    /// feature that is not supported on this switch.
    /// 
    /// ***InvalidArgument***: If the array have different elements for the
    /// same port.
    /// 
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn reconfigure_dv_port_task(&self, port: &[crate::types::structs::DvPortConfigSpec]) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = ReconfigureDvPortRequestType {port, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "ReconfigureDVPort_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// reconfigure the Virtual NIC network resource pool configuration.
    /// 
    /// ***Required privileges:*** DVSwitch.ResourceManagement
    ///
    /// ## Parameters:
    ///
    /// ### config_spec
    /// The Virtual NIC network resource pool configuration specification and operation type.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***DvsFault***: if operation fails on any host or if there are other reconfigure failures.
    /// 
    /// ***NotFound***: if the resource pool does not exist on the dvs.
    /// 
    /// ***DuplicateName***: if a virtual NIC network resource pool with the same name already exists.
    /// 
    /// ***ConcurrentAccess***: if a Virtual NIC network resource pool is modified by
    /// two or more clients at the same time.
    /// 
    /// ***ResourceInUse***: If Virtual NIC network resource pool being removed
    /// is associated with a network entity
    /// 
    /// ***NotSupported***: if network I/O control is not supported on
    /// the vSphere Distributed Switch.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    /// 
    /// ***ConflictingConfiguration***: if the any property being set is in conflict.
    pub async fn dvs_reconfigure_vm_vnic_network_resource_pool_task(&self, config_spec: &[crate::types::structs::DvsVmVnicResourcePoolConfigSpec]) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = DvsReconfigureVmVnicNetworkResourcePoolRequestType {config_spec, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "DvsReconfigureVmVnicNetworkResourcePool_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.0.
    /// Use
    /// *DistributedVirtualSwitchManager*.*DistributedVirtualSwitchManager.RectifyDvsOnHost_Task* instead.
    /// 
    /// Update the switch configuration on the host to bring them in sync with the
    /// current configuration in vCenter Server.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### hosts
    /// The hosts to be rectified.
    /// 
    /// Refers instances of *HostSystem*.
    ///
    /// ## Returns:
    ///
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    pub async fn rectify_dvs_host_task(&self, hosts: Option<&[crate::types::structs::ManagedObjectReference]>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = RectifyDvsHostRequestType {hosts, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "RectifyDvsHost_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Refresh port states.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### port_keys
    /// The keys of the ports to be refreshed. If not specified, all port
    /// states are refreshed.
    ///
    /// ## Errors:
    ///
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    pub async fn refresh_dv_port_state(&self, port_keys: Option<&[String]>) -> Result<()> {
        let input = RefreshDvPortStateRequestType {port_keys, };
        self.client.invoke_void("", "DistributedVirtualSwitch", &self.mo_id, "RefreshDVPortState", Some(&input)).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("", "DistributedVirtualSwitch", &self.mo_id, "Reload", None).await
    }
    /// Deprecated as of vSphere API 6.0
    /// Use *DistributedVirtualSwitch.DvsReconfigureVmVnicNetworkResourcePool_Task* instead
    /// to remove a Virtual NIC network resource pool.
    /// 
    /// Remove a network resource pool.
    /// 
    /// ***Required privileges:*** DVSwitch.ResourceManagement
    ///
    /// ## Parameters:
    ///
    /// ### key
    /// The network resource pool key.
    ///
    /// ## Errors:
    ///
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***NotFound***: if the resource pool does not exist on the dvs.
    /// 
    /// ***InvalidName***: if the name of the resource pool is invalid.
    /// 
    /// ***ResourceInUse***: If network resource pool is associated with a network entity
    /// 
    /// ***NotSupported***: if network I/O control is not supported on
    /// the vSphere Distributed Switch.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn remove_network_resource_pool(&self, key: &[String]) -> Result<()> {
        let input = RemoveNetworkResourcePoolRequestType {key, };
        self.client.invoke_void("", "DistributedVirtualSwitch", &self.mo_id, "RemoveNetworkResourcePool", Some(&input)).await
    }
    /// 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:*** DVSwitch.Modify
    ///
    /// ## 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("", "DistributedVirtualSwitch", &self.mo_id, "Rename_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// This method determines if the distributed virtual switch configuration
    /// has changed.
    /// 
    /// If it has changed, the method returns a
    /// *VMwareDVSConfigSpec*.
    /// Use the *DistributedVirtualSwitch.ReconfigureDvs_Task* method to apply
    /// the rollback configuration to the switch.
    /// You can use the rollback method only on a *VmwareDistributedVirtualSwitch*.
    /// - If you specify the <code>entityBackup</code> parameter, the returned
    ///   configuration specification represents the exported switch configuration.
    ///   If the <code>entityBackup</code> matches the current switch
    ///   configuration, the method does not return a configuration specification.
    /// - If <code>entityBackup</code> is not specified, the returned configuration
    ///   specification represents a previous state of the switch, if available.
    ///   When you use a VMware distributed virtual switch, each time you reconfigure
    ///   the switch, the Server saves the switch configuration before applying the updates.
    ///   If the vCenter Server is restarted, the saved configuration is not preserved
    ///   and the method does not return a configuration specification.
    ///   
    /// To use the rollback method, you must have the DVSwitch.Read privilege.
    ///
    /// ## Parameters:
    ///
    /// ### entity_backup
    /// Backup of a distributed virtual switch, returned by
    /// the *DistributedVirtualSwitchManager.DVSManagerExportEntity_Task*
    /// method.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// If the distributed virtual switch configuration has changed, the
    /// *Task*.*Task.info*.*TaskInfo.result*
    /// property contains the *DVSConfigSpec* object.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***RollbackFailure***: if there is no configuration specified in entityBackup and
    /// the previous configuration does not exist either.
    /// 
    /// ***DvsFault***: if operation fails.
    pub async fn dvs_rollback_task(&self, entity_backup: Option<&crate::types::structs::EntityBackupConfig>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = DvsRollbackRequestType {entity_backup, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "DVSRollback_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// 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("", "DistributedVirtualSwitch", &self.mo_id, "setCustomValue", Some(&input)).await
    }
    /// Set the capability of the switch.
    /// 
    /// ***Required privileges:*** DVSwitch.Modify
    ///
    /// ## Parameters:
    ///
    /// ### capability
    /// The capability of the switch.
    ///
    /// ## Errors:
    ///
    /// ***NotSupported***: If called directly on a host or if the switch
    /// implementation doesn't support this API.
    /// 
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn update_dvs_capability(&self, capability: &crate::types::structs::DvsCapability) -> Result<()> {
        let input = UpdateDvsCapabilityRequestType {capability, };
        self.client.invoke_void("", "DistributedVirtualSwitch", &self.mo_id, "UpdateDvsCapability", Some(&input)).await
    }
    /// Update health check configuration.
    /// 
    /// ***Required privileges:*** DVSwitch.Modify
    ///
    /// ## Parameters:
    ///
    /// ### health_check_config
    /// The health check configuration.
    ///
    /// ## Returns:
    ///
    /// Returns a *Task* object with which to monitor the operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***NotSupported***: if health check is not supported on the switch.
    pub async fn update_dvs_health_check_config_task(&self, health_check_config: &[Box<dyn crate::types::traits::DvsHealthCheckConfigTrait>]) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = UpdateDvsHealthCheckConfigRequestType {health_check_config, };
        let bytes = self.client.invoke("", "DistributedVirtualSwitch", &self.mo_id, "UpdateDVSHealthCheckConfig_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 6.0
    /// Use *DistributedVirtualSwitch.DvsReconfigureVmVnicNetworkResourcePool_Task* instead
    /// to update the Virtual NIC network resource pool.
    /// 
    /// Update the network resource pool configuration.
    /// 
    /// ***Required privileges:*** DVSwitch.ResourceManagement
    ///
    /// ## Parameters:
    ///
    /// ### config_spec
    /// The network resource pool configuration specification.
    ///
    /// ## Errors:
    ///
    /// ***DvsFault***: if operation fails on any host or if there are other update failures.
    /// 
    /// ***NotFound***: if the resource pool does not exist on the dvs.
    /// 
    /// ***InvalidName***: if the name of the resource pool is invalid.
    /// 
    /// ***ConcurrentAccess***: if a network resource pool is modified by
    /// two or more clients at the same time.
    /// 
    /// ***NotSupported***: if network I/O control is not supported on
    /// the vSphere Distributed Switch.
    /// 
    /// ***DvsNotAuthorized***: if login-session's extension key does not match
    /// the switch's configured
    /// *extensionKey*.
    pub async fn update_network_resource_pool(&self, config_spec: &[crate::types::structs::DvsNetworkResourcePoolConfigSpec]) -> Result<()> {
        let input = UpdateNetworkResourcePoolRequestType {config_spec, };
        self.client.invoke_void("", "DistributedVirtualSwitch", &self.mo_id, "UpdateNetworkResourcePool", Some(&input)).await
    }
    /// 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("", "DistributedVirtualSwitch", &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("", "DistributedVirtualSwitch", &self.mo_id, "availableField").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Capability of the switch.
    /// 
    /// Capabilities are indicated at the port,
    /// portgroup and switch levels, and for version-specific features.
    /// When you retrieve this property from an ESXi host,
    /// *DistributedVirtualSwitch.capability*.*DVSCapability.dvsOperationSupported*
    /// should always be set to false.
    pub async fn capability(&self) -> Result<crate::types::structs::DvsCapability> {
        let pv_opt = self.client.fetch_property_raw("", "DistributedVirtualSwitch", &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::DvsCapability = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Switch configuration data.
    pub async fn config(&self) -> Result<Box<dyn crate::types::traits::DvsConfigInfoTrait>> {
        let pv_opt = self.client.fetch_property_raw("", "DistributedVirtualSwitch", &self.mo_id, "config").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property config was empty".to_string()))?;
        let result: Box<dyn crate::types::traits::DvsConfigInfoTrait> = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// 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("", "DistributedVirtualSwitch", &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("", "DistributedVirtualSwitch", &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("", "DistributedVirtualSwitch", &self.mo_id, "customValue").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("", "DistributedVirtualSwitch", &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("", "DistributedVirtualSwitch", &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("", "DistributedVirtualSwitch", &self.mo_id, "effectiveRole").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("", "DistributedVirtualSwitch", &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)
    }
    /// Deprecated as of vSphere API 6.0
    /// Use *DVSConfigInfo.vmVnicNetworkResourcePool*
    /// to get the Virtual NIC resource pool information.
    /// Use *DVSConfigInfo.infrastructureTrafficResourceConfig*
    /// to get the host infrastructure resource information.
    /// 
    /// Network resource pool information for the switch.
    pub async fn network_resource_pool(&self) -> Result<Option<Vec<crate::types::structs::DvsNetworkResourcePool>>> {
        let pv_opt = self.client.fetch_property_raw("", "DistributedVirtualSwitch", &self.mo_id, "networkResourcePool").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("", "DistributedVirtualSwitch", &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("", "DistributedVirtualSwitch", &self.mo_id, "parent").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("", "DistributedVirtualSwitch", &self.mo_id, "permission").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Portgroups that are defined on the switch.
    ///
    /// ## Returns:
    ///
    /// Refers instances of *DistributedVirtualPortgroup*.
    pub async fn portgroup(&self) -> Result<Option<Vec<crate::types::structs::ManagedObjectReference>>> {
        let pv_opt = self.client.fetch_property_raw("", "DistributedVirtualSwitch", &self.mo_id, "portgroup").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("", "DistributedVirtualSwitch", &self.mo_id, "recentTask").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Runtime information of the distributed virtual switch.
    pub async fn runtime(&self) -> Result<Option<crate::types::structs::DvsRuntimeInfo>> {
        let pv_opt = self.client.fetch_property_raw("", "DistributedVirtualSwitch", &self.mo_id, "runtime").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Summary of the switch.
    pub async fn summary(&self) -> Result<crate::types::structs::DvsSummary> {
        let pv_opt = self.client.fetch_property_raw("", "DistributedVirtualSwitch", &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::DvsSummary = 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("", "DistributedVirtualSwitch", &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("", "DistributedVirtualSwitch", &self.mo_id, "triggeredAlarmState").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Generated UUID of the switch.
    /// 
    /// Unique across vCenter Server
    /// inventory and instances.
    pub async fn uuid(&self) -> Result<String> {
        let pv_opt = self.client.fetch_property_raw("", "DistributedVirtualSwitch", &self.mo_id, "uuid").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property uuid was empty".to_string()))?;
        let result: String = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// 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("", "DistributedVirtualSwitch", &self.mo_id, "value").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
}
struct AddNetworkResourcePoolRequestType<'a> {
    config_spec: &'a [crate::types::structs::DvsNetworkResourcePoolConfigSpec],
}

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

struct AddNetworkResourcePoolRequestTypeSer<'b, 'a> {
    data: &'b AddNetworkResourcePoolRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for AddNetworkResourcePoolRequestTypeSer<'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"), &"AddNetworkResourcePoolRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("configSpec"), &self.data.config_spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct CreateDvPortgroupRequestType<'a> {
    spec: &'a crate::types::structs::DvPortgroupConfigSpec,
}

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

struct CreateDvPortgroupRequestTypeSer<'b, 'a> {
    data: &'b CreateDvPortgroupRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CreateDvPortgroupRequestTypeSer<'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"), &"CreateDVPortgroupRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct AddDvPortgroupRequestType<'a> {
    spec: &'a [crate::types::structs::DvPortgroupConfigSpec],
}

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

struct AddDvPortgroupRequestTypeSer<'b, 'a> {
    data: &'b AddDvPortgroupRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for AddDvPortgroupRequestTypeSer<'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"), &"AddDVPortgroupRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct EnableNetworkResourceManagementRequestType {
    enable: bool,
}

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

struct EnableNetworkResourceManagementRequestTypeSer<'b> {
    data: &'b EnableNetworkResourceManagementRequestType,
    seq: usize,
}

impl<'b> miniserde::ser::Map for EnableNetworkResourceManagementRequestTypeSer<'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"), &"EnableNetworkResourceManagementRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("enable"), &self.data.enable as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct FetchDvPortKeysRequestType<'a> {
    criteria: Option<&'a crate::types::structs::DistributedVirtualSwitchPortCriteria>,
}

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

struct FetchDvPortKeysRequestTypeSer<'b, 'a> {
    data: &'b FetchDvPortKeysRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for FetchDvPortKeysRequestTypeSer<'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"), &"FetchDVPortKeysRequestType")),
                1 => {
                    let Some(ref val) = self.data.criteria else { continue; };
                    return Some((std::borrow::Cow::Borrowed("criteria"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct FetchDvPortsRequestType<'a> {
    criteria: Option<&'a crate::types::structs::DistributedVirtualSwitchPortCriteria>,
}

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

struct FetchDvPortsRequestTypeSer<'b, 'a> {
    data: &'b FetchDvPortsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for FetchDvPortsRequestTypeSer<'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"), &"FetchDVPortsRequestType")),
                1 => {
                    let Some(ref val) = self.data.criteria else { continue; };
                    return Some((std::borrow::Cow::Borrowed("criteria"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct LookupDvPortGroupRequestType<'a> {
    portgroup_key: &'a str,
}

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

struct LookupDvPortGroupRequestTypeSer<'b, 'a> {
    data: &'b LookupDvPortGroupRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for LookupDvPortGroupRequestTypeSer<'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"), &"LookupDvPortGroupRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("portgroupKey"), &self.data.portgroup_key as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct MergeDvsRequestType<'a> {
    dvs: &'a crate::types::structs::ManagedObjectReference,
}

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

struct MergeDvsRequestTypeSer<'b, 'a> {
    data: &'b MergeDvsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for MergeDvsRequestTypeSer<'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"), &"MergeDvsRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("dvs"), &self.data.dvs as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct MoveDvPortRequestType<'a> {
    port_key: &'a [String],
    destination_portgroup_key: Option<&'a str>,
}

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

struct MoveDvPortRequestTypeSer<'b, 'a> {
    data: &'b MoveDvPortRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for MoveDvPortRequestTypeSer<'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"), &"MoveDVPortRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("portKey"), &self.data.port_key as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.destination_portgroup_key else { continue; };
                    return Some((std::borrow::Cow::Borrowed("destinationPortgroupKey"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct PerformDvsProductSpecOperationRequestType<'a> {
    operation: &'a str,
    product_spec: Option<&'a crate::types::structs::DistributedVirtualSwitchProductSpec>,
}

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

struct PerformDvsProductSpecOperationRequestTypeSer<'b, 'a> {
    data: &'b PerformDvsProductSpecOperationRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for PerformDvsProductSpecOperationRequestTypeSer<'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"), &"PerformDvsProductSpecOperationRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("operation"), &self.data.operation as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.product_spec else { continue; };
                    return Some((std::borrow::Cow::Borrowed("productSpec"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct ReconfigureDvsRequestType<'a> {
    spec: &'a dyn crate::types::traits::DvsConfigSpecTrait,
}

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

struct ReconfigureDvsRequestTypeSer<'b, 'a> {
    data: &'b ReconfigureDvsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for ReconfigureDvsRequestTypeSer<'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"), &"ReconfigureDvsRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct ReconfigureDvPortRequestType<'a> {
    port: &'a [crate::types::structs::DvPortConfigSpec],
}

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

struct ReconfigureDvPortRequestTypeSer<'b, 'a> {
    data: &'b ReconfigureDvPortRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for ReconfigureDvPortRequestTypeSer<'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"), &"ReconfigureDVPortRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("port"), &self.data.port as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct DvsReconfigureVmVnicNetworkResourcePoolRequestType<'a> {
    config_spec: &'a [crate::types::structs::DvsVmVnicResourcePoolConfigSpec],
}

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

struct DvsReconfigureVmVnicNetworkResourcePoolRequestTypeSer<'b, 'a> {
    data: &'b DvsReconfigureVmVnicNetworkResourcePoolRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for DvsReconfigureVmVnicNetworkResourcePoolRequestTypeSer<'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"), &"DvsReconfigureVmVnicNetworkResourcePoolRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("configSpec"), &self.data.config_spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct RectifyDvsHostRequestType<'a> {
    hosts: Option<&'a [crate::types::structs::ManagedObjectReference]>,
}

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

struct RectifyDvsHostRequestTypeSer<'b, 'a> {
    data: &'b RectifyDvsHostRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RectifyDvsHostRequestTypeSer<'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"), &"RectifyDvsHostRequestType")),
                1 => {
                    let Some(ref val) = self.data.hosts else { continue; };
                    return Some((std::borrow::Cow::Borrowed("hosts"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct RefreshDvPortStateRequestType<'a> {
    port_keys: Option<&'a [String]>,
}

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

struct RefreshDvPortStateRequestTypeSer<'b, 'a> {
    data: &'b RefreshDvPortStateRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RefreshDvPortStateRequestTypeSer<'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"), &"RefreshDVPortStateRequestType")),
                1 => {
                    let Some(ref val) = self.data.port_keys else { continue; };
                    return Some((std::borrow::Cow::Borrowed("portKeys"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct RemoveNetworkResourcePoolRequestType<'a> {
    key: &'a [String],
}

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

struct RemoveNetworkResourcePoolRequestTypeSer<'b, 'a> {
    data: &'b RemoveNetworkResourcePoolRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RemoveNetworkResourcePoolRequestTypeSer<'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"), &"RemoveNetworkResourcePoolRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("key"), &self.data.key 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 DvsRollbackRequestType<'a> {
    entity_backup: Option<&'a crate::types::structs::EntityBackupConfig>,
}

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

struct DvsRollbackRequestTypeSer<'b, 'a> {
    data: &'b DvsRollbackRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for DvsRollbackRequestTypeSer<'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"), &"DVSRollbackRequestType")),
                1 => {
                    let Some(ref val) = self.data.entity_backup else { continue; };
                    return Some((std::borrow::Cow::Borrowed("entityBackup"), 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 UpdateDvsCapabilityRequestType<'a> {
    capability: &'a crate::types::structs::DvsCapability,
}

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

struct UpdateDvsCapabilityRequestTypeSer<'b, 'a> {
    data: &'b UpdateDvsCapabilityRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for UpdateDvsCapabilityRequestTypeSer<'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"), &"UpdateDvsCapabilityRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("capability"), &self.data.capability as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct UpdateDvsHealthCheckConfigRequestType<'a> {
    health_check_config: &'a [Box<dyn crate::types::traits::DvsHealthCheckConfigTrait>],
}

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

struct UpdateDvsHealthCheckConfigRequestTypeSer<'b, 'a> {
    data: &'b UpdateDvsHealthCheckConfigRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for UpdateDvsHealthCheckConfigRequestTypeSer<'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"), &"UpdateDVSHealthCheckConfigRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("healthCheckConfig"), &self.data.health_check_config as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct UpdateNetworkResourcePoolRequestType<'a> {
    config_spec: &'a [crate::types::structs::DvsNetworkResourcePoolConfigSpec],
}

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

struct UpdateNetworkResourcePoolRequestTypeSer<'b, 'a> {
    data: &'b UpdateNetworkResourcePoolRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for UpdateNetworkResourcePoolRequestTypeSer<'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"), &"UpdateNetworkResourcePoolRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("configSpec"), &self.data.config_spec as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}