1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// This managed object type provides the service interface for obtaining
/// statistical data about various aspects of vSAN performance, as generated
/// and maintained by the vSAN performance service of the cluster.
///
/// It also offers
/// methods to enable/disable, configure and perform other maintenance tasks
/// about the vSAN performance service. It is available on both vCenter as well
/// as ESXi under the vSAN extension endpoint. On both systems a singleton object
/// is registered under the Managed Object ID 'vsan-performance-manager'.
///
/// All the vSAN hosts belongs to one of the following two type in performance service
/// perspective.
///
/// Stats Master node: see *VsanPerfNodeInformation*
///
/// Agent node: all other nodes except the master node, which collect its performance
/// statistics when receive the request from master then send it back.
#[derive(Clone)]
pub struct VsanPerformanceManager {
client: Arc<dyn VimClient>,
mo_id: String,
}
impl VsanPerformanceManager {
pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
Self {
client,
mo_id: mo_id.to_string(),
}
}
/// Create the vSAN object/directory containing the vSAN Perf Stats DB.
///
/// Creation of the object also starts the collection of statistics as a side effect,
/// i.e., it effectively enables the vSAN performance service.
/// Profile can be 3 formats:
/// - VirtualMachineEmptyProfileSpec means to use the empty vSAN policy. This is not the
/// default policy, but a policy where all fields have default values.
/// - VirtualMachineDefinedProfileSpec where profileId is set, in which case this profileId
/// will be looked up in SPBM for the detailed policy information.
/// - VirtualMachineDefinedProfileSpec where profileId is an empty string and instead
/// the profileData is set for extensionKey 'com.vmware.vim.sps'. In this case the
/// objectData field can be either the vSAN expression format, or a SPBM XML string.
///
///
/// If no profile is supplied, and the call is executed against vCenter, then SPBM will
/// be consulted for the vSAN datastore's default profile.
///
/// Profile is ignored if executed against ESXi host.
/// - If the vSAN object is already exist, return directly.
/// - If vSAN is disabled, DestinationVsanDisabled exception will be raised.
/// - If SPBM needs to be contacted, but SPBM is not available, RuntimeFault exception will be raised.
/// - If the profileId can not be resolved with SPBM, InvalidArgument exception will be raised.
/// - If objectData was provided but is neither of the two supported formats, InvalidArgument exception
/// will be raised.
/// - If the statsDB object can not be found, FileNotFound exception will be raised.
/// - If the statsDB object failed to set the policy, e.g. because it is not accessible,
/// FileNotWritable exception will be raised.
/// - If called against VC, but no ESX host could be contacted to perform the operation
/// NotFound exception will be raised.
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** Host.Inventory.EditCluster
///
/// Refers instance of *ComputeResource*.
///
/// ### profile
/// Profile to be used for the stats object, see above.
///
/// ## Returns:
///
/// mounted path of the vSAN stats object (using "/" as path separator)
/// i.e. /vmfs/volumes/vsan:525218c52dce3d62-e51a774ec7aef712/
///
/// ## Errors:
///
/// ***VsanFault***: if the pre-check tests failed.
///
/// ***FileAlreadyExists***: if the stats object already exists.
///
/// ***CannotCreateFile***: if it cannot complete file creation operation.
///
/// ***NotFound***: if no ESXi host could be contacted to perform the operation
/// when called against vCenter.
pub async fn vsan_perf_create_stats_object(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, profile: Option<&dyn crate::types::traits::VirtualMachineProfileSpecTrait>) -> Result<String> {
let input = VsanPerfCreateStatsObjectRequestType {cluster, profile, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfCreateStatsObject", Some(&input)).await?;
let result: String = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// The asynchronous API of CreateStatsObject.
///
/// The stats obj is created in
/// in background, with a task returned. This method is only supported on
/// vCenter.
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** Host.Inventory.EditCluster
///
/// Refers instance of *ComputeResource*.
///
/// ### profile
/// Profile to be used for the stats object, see above
///
/// ## Returns:
///
/// vim task
///
/// Refers instance of *Task*.
///
/// ## Errors:
///
/// ***VsanFault***: if the caller doesn't have the required privilege, or the
/// cluster has no hosts.
pub async fn vsan_perf_create_stats_object_task(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, profile: Option<&dyn crate::types::traits::VirtualMachineProfileSpecTrait>) -> Result<crate::types::structs::ManagedObjectReference> {
let input = VsanPerfCreateStatsObjectTaskRequestType {cluster, profile, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfCreateStatsObjectTask", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Delete vSAN object/directory containing the vSAN Perf Stats DB.
///
/// This method is only supported on ESXi host.
/// Note: this will destroy all history and shut down the vSAN performance
/// service.
/// If the vSAN object doesn't exist, FileNotWritable exception will be raised.
/// If vSAN is disabled, DestinationVsanDisabled exception will be raised.
/// The operation can only be performed by masters, so VsanNodeNotMaster is raised
/// when the node is not Stats master.
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** Host.Inventory.EditCluster
///
/// Refers instance of *ComputeResource*.
///
/// ## Returns:
///
/// True on success
///
/// ## Errors:
///
/// ***VsanFault***: if the pre-check tests failed, or the host in the states
/// that do not allow objects deletion (i.e. maintenance mode
/// with data migration mode: ensure accessibility).
///
/// ***CannotCreateFile***: if it cannot complete file creation operation.
///
/// ***NotFound***: if no ESXi host could be contacted to perform the operation
/// when called against vCenter.
pub async fn vsan_perf_delete_stats_object(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<bool> {
let input = VsanPerfDeleteStatsObjectRequestType {cluster, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfDeleteStatsObject", Some(&input)).await?;
let result: bool = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// The asynchronous API of DeleteStatsObject.
///
/// The statistics object is created
/// in background, with a task returned.
/// This method is only supported on vCenter.
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** Host.Inventory.EditCluster
///
/// Refers instance of *ComputeResource*.
///
/// ## Returns:
///
/// vim task
///
/// Refers instance of *Task*.
///
/// ## Errors:
///
/// ***VsanFault***: if the caller doesn't have the required privilege, or the
/// cluster has no hosts.
pub async fn vsan_perf_delete_stats_object_task(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<crate::types::structs::ManagedObjectReference> {
let input = VsanPerfDeleteStatsObjectTaskRequestType {cluster, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfDeleteStatsObjectTask", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Delete saved time range in performance service.
///
/// ***Required privileges:*** Global.Diagnostics
///
/// ## Parameters:
///
/// ### cluster
/// Refers instance of *ClusterComputeResource*.
///
/// ### name
/// Delete by the name of *VsanPerfTimeRange*
///
/// ## Errors:
///
/// Failure
pub async fn vsan_perf_delete_time_range(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, name: &str) -> Result<()> {
let input = VsanPerfDeleteTimeRangeRequestType {cluster, name, };
self.client.invoke_void("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfDeleteTimeRange", Some(&input)).await
}
/// Get supported aggregated entity types for front end data-driven
/// reporting of diagnostic exceptions which return aggregated data.
///
/// This API can be used to build performance graphs of aggregated data in a
/// dynamic way.
///
/// ***Required privileges:*** System.Read
///
/// ## Errors:
///
/// Failure
pub async fn vsan_perf_get_aggregated_entity_types(&self) -> Result<Option<Vec<crate::types::structs::VsanPerfEntityType>>> {
let bytes_opt = self.client.invoke_optional("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfGetAggregatedEntityTypes", None).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Get supported performance exceptions for front end data-driven
/// performance exception reporting
///
/// ***Required privileges:*** System.Read
pub async fn vsan_perf_get_supported_diagnostic_exceptions(&self) -> Result<Option<Vec<crate::types::structs::VsanPerfDiagnosticException>>> {
let bytes_opt = self.client.invoke_optional("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfGetSupportedDiagnosticExceptions", None).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// This API is used to build performance graphs in a data-driven and dynamic way.
///
/// Before querying stats, you need to know the entity type for specifying entity ID of the
/// query spec. If you want to query specific metrics, you need to know what metrics are
/// supported by that type of entities. And you may want to know how to organize the metrics
/// into different graphs. The returned list of
/// *VsanPerfEntityType* data model
/// tells you all the information you needed for above questions.
///
/// Each *VsanPerfEntityType* object describes supported
/// metrics grouped by graphs
/// for a type of entities like VMs. The name attribute of
/// *VsanPerfEntityType*
/// is the entity type ID used as part of the entity ID in the query spec.
/// See *VsanPerfQuerySpec.entityRefId*.
///
/// The model of vim.cluster.VsanPerfEntityType defines a list of performance graphs
/// (*VsanPerfGraph*). And
/// *VsanPerfGraph* defines a list of metrics
/// (*VsanPerfMetricId*). This tells you how to organized
/// different metrics to a graph and supported metrics of a type of entities.
/// Then front-end/client can compose
/// query specs using the information from the VsanPerfEntityType list and entity instance
/// UUIDs to retrieved wanted performance statistics.
///
/// ***Required privileges:*** System.Read
pub async fn vsan_perf_get_supported_entity_types(&self) -> Result<Option<Vec<crate::types::structs::VsanPerfEntityType>>> {
let bytes_opt = self.client.invoke_optional("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfGetSupportedEntityTypes", None).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Returns the diagnosis result from the in memory cache for the supplied
/// task.
///
/// The task should have been returned by VsanPerfDiagnoseTask. This API
/// is available only in the vCenter, it is not available at the end-host.
///
/// ## Parameters:
///
/// ### task
/// Task returned by VsanPerfDiagnoseTask
///
/// Refers instance of *Task*.
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** Global.Diagnostics
///
/// Refers instance of *ComputeResource*.
///
/// ## Returns:
///
/// A list of performance issues.
///
/// ## Errors:
///
/// ***VsanFault***: if the caller doesn't have the required privilege, or the
/// cluster has no hosts.
///
/// ***NotFound***: If no result is found in the cache for the specified task
pub async fn get_vsan_perf_diagnosis_result(&self, task: &crate::types::structs::ManagedObjectReference, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::VsanPerfDiagnosticResult>>> {
let input = GetVsanPerfDiagnosisResultRequestType {task, cluster, };
let bytes_opt = self.client.invoke_optional("vsan", "VsanPerformanceManager", &self.mo_id, "GetVsanPerfDiagnosisResult", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// This API shall not be used to query the health status for vSAN performance service.
///
/// Consider this API as deprecated. Use *VsanVcClusterHealthSystem.VsanQueryVcClusterHealthSummary*
/// instead.
///
/// ## Parameters:
///
/// ### cluster
/// The cluster for which to compute health for.
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ## Returns:
///
/// vim.cluster.VsanClusterHealthGroup\[\] A list of health groups.
///
/// ## Errors:
///
/// ***NotFound***: if no ESXi host could be contacted to perform the operation
/// when called against vCenter.
pub async fn vsan_perf_query_cluster_health(&self, cluster: &crate::types::structs::ManagedObjectReference) -> Result<Vec<crate::types::structs::VsanClusterHealthGroup>> {
let input = VsanPerfQueryClusterHealthRequestType {cluster, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfQueryClusterHealth", Some(&input)).await?;
let result: Vec<crate::types::structs::VsanClusterHealthGroup> = crate::core::client::unmarshal_array(self.client.transport(), &bytes)?;
Ok(result)
}
/// Query performance service related information about the node(s).
///
/// Always returns a list, but when run against the host the list is guaranteed
/// to have length=1. If run against vCenter, information about all hosts in the
/// cluster is retrieved. If information of one host can not be retrieved, there
/// are 2 situations:
/// 1. If the host is connected: it will throw
/// "invalid Request", "method fault",
/// "vsan fault" or other run time exception message.
/// 2. If the host is not connected, it will throw
/// "host is not in connected status"
/// message.
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ComputeResource*.
///
/// ## Errors:
///
/// Failure
pub async fn vsan_perf_query_node_information(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::VsanPerfNodeInformation>>> {
let input = VsanPerfQueryNodeInformationRequestType {cluster, };
let bytes_opt = self.client.invoke_optional("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfQueryNodeInformation", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Query all remote server clusters ever mounted from perf database by the
/// specified query specification and return their UUIDs.
///
/// This API is available
/// on VC and stats master node.
///
/// ## Parameters:
///
/// ### cluster
/// Local vSAN cluster. This parameter will be ignored if the API
/// is called against host.
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ### query_spec
/// Specification for the query operation. If the parameter
/// is not specified all available remote clusters will be
/// returned.
///
/// ## Errors:
///
/// ***InvalidArgument***: If any argument passed to the function is not
/// specified correctly.
///
/// ***VsanFault***: If any other unexpected fault is encountered.
pub async fn query_remote_server_clusters(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, query_spec: Option<&crate::types::structs::VsanRemoteClusterQuerySpec>) -> Result<Vec<String>> {
let input = QueryRemoteServerClustersRequestType {cluster, query_spec, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "QueryRemoteServerClusters", Some(&input)).await?;
let result: Vec<String> = crate::core::client::unmarshal_array(self.client.transport(), &bytes)?;
Ok(result)
}
/// Get information about the vSAN object/directory containing the vSAN Perf Stats DB.
///
/// If the statsDB object can not be found, FileNotFound exception will be raised.
/// If the statsDB object failed to read the policy, e.g. because it is not accessible,
/// FileNotWritable exception will be raised.
/// If called against vCenter, but no ESXi host could be contacted to perform the
/// operation NotFound exception will be raised.
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ComputeResource*.
///
/// ## Returns:
///
/// Object information structure
///
/// ## Errors:
///
/// ***NotFound***: if no ESXi host could be contacted to perform the operation
/// when called against vCenter.
pub async fn vsan_perf_query_stats_object_information(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<crate::types::structs::VsanObjectInformation> {
let input = VsanPerfQueryStatsObjectInformationRequestType {cluster, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfQueryStatsObjectInformation", Some(&input)).await?;
let result: crate::types::structs::VsanObjectInformation = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Query saved time ranges in performance service.
///
/// ## Parameters:
///
/// ### cluster
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ### query_spec
/// Specify the name and time boundaries. See details
/// in *VsanPerfTimeRangeQuerySpec*
///
/// ## Errors:
///
/// Failure
pub async fn vsan_perf_query_time_ranges(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, query_spec: &crate::types::structs::VsanPerfTimeRangeQuerySpec) -> Result<Option<Vec<crate::types::structs::VsanPerfTimeRange>>> {
let input = VsanPerfQueryTimeRangesRequestType {cluster, query_spec, };
let bytes_opt = self.client.invoke_optional("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfQueryTimeRanges", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Retrieves the performance metrics for the specified
/// vSAN entity (or entities) based on the properties specified in
/// the VsanPerfQuerySpec data object
/// The supported entity types are listed as bellow.
/// - 'cluster-domclient'
/// - 'cluster-domcompmgr'
/// - 'host-domclient'
/// - 'host-domcompmgr'
/// - 'cache-disk'
/// - 'capacity-disk'
/// - 'disk-group'
/// - 'vscsi'
/// - 'virtual-machine'
/// - 'virtual-disk'
/// - 'vsan-host-net'
/// - 'vsan-vnic-net'
/// - 'vsan-pnic-net'
/// - 'lsom-world-cpu'
/// - 'dom-world-cpu'
/// - 'host-cpu'
/// - 'nic-world-cpu'
/// - 'vsan-cpu'
/// - 'vsan-memory'
/// - 'rdt-net'
///
/// The below entity types are used for vSAN ESA related metrics.
/// - 'vsan-esa-disk-layer'
/// - 'vsan-esa-disk-scsifw'
/// - 'zdom-vtx'
///
/// The below entity types are used for HCI mesh related metrics.
/// - 'cluster-remotedomclient'
/// - 'computeCluster-remotedomclient'
///
/// The below entity types are used for vSAN direct related metrics.
/// - 'vsan-direct-cluster'
/// - 'vsan-direct-host'
///
/// The below entity types are used for PMem related metrics.
/// - 'host-pmem'
/// - 'cluster-pmem'
///
/// The below entity types are used for vSAN iSCSI service related metrics.
/// The metrics are only collected when vSAN iSCSI service is enabled.
/// - 'vsan-iscsi-host'
/// - 'vsan-iscsi-lun'
/// - 'vsan-iscsi-target'
///
/// The below entity type is used for vSAN datastore capacity historical data.
/// - 'vsan-cluster-capacity'
///
/// The below entity type is used for vSAN file service related metrics.
/// The metrics are only collected when vSAN file service is enabled.
/// - 'vsan-file-service'
///
/// The below entity type is used for IOInsight related metrics.
/// The metrics are only collected when the IOInsight instance is running.
/// - 'ioinsight'
/// - 'ioinsight-histogram'
///
/// To identify an entity in vSAN performance query spec, a vSAN performance
/// entity reference is used.
/// An vSAN performance entity is in this format
/// <entity-type>:<entity-uuid>.
/// Below are the examples:
/// <table cellspacing="0">
/// <tr>
/// <th>Entity Type</th>
/// <th>Entity ID format</th>
/// <th>Example</th>
/// <th>Notes</th>
/// <tr>
/// <td>cluster-domclient</td>
/// <td><cluster-UUID></td>
/// <td>'cluster-domclient:52c89b61-f818-e495-af20-816d24c850b8'</td>
/// <td>The UUID is represented by the associated cluster UUID.</td>
/// </tr>
/// <tr>
/// <td>cluster-domcompmgr</td>
/// <td><cluster-UUID></td>
/// <td>'cluster-domcompmgr:52c89b61-f818-e495-af20-816d24c850b8'</td>
/// <td>The UUID is represented by the associated cluster UUID.</td>
/// </tr>
/// <tr>
/// <td>host-domclient</td>
/// <td><host-UUID></td>
/// <td>'host-domclient:588b2225-c58c-8365-c47b-02001065be12'</td>
/// <td>The UUID is represented by the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>host-domcompmgr</td>
/// <td><host-UUID></td>
/// <td>'host-domcompmgr:588b2225-c58c-8365-c47b-02001065be12'</td>
/// <td>The UUID is represented by the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>cache-disk</td>
/// <td> <CacheDisk-UUID></td>
/// <td>'cache-disk:55c98c4d-41f0-6ff7-2784-0200103eb5e1'</td>
/// <td>The UUID is represented by the associated cache disk UUID.</td>
/// </tr>
/// <tr>
/// <td>capacity-disk</td>
/// <td> <CapacityDisk-UUID></td>
/// <td>'capacity-disk:55c98c4d-41f0-6ff7-2784-0200103eb5e1'</td>
/// <td>The UUID is represented by the associated capacity disk UUID.</td>
/// </tr>
/// <tr>
/// <td>disk-group</td>
/// <td> <CacheDisk-UUID></td>
/// <td>'disk-group:55c98c4d-41f0-6ff7-2784-0200103eb5e1'</td>
/// <td>The UUID is represented by the associated disk group UUID, which is the same as cache disk UUID.</td>
/// </tr>
/// <tr>
/// <td>vscsi</td>
/// <td> <VM-instance-UUID>|<VSCSI-name></td>
/// <td>'vscsi:55c98c4d-41f0-6ff7-2784-0200103eb5e1|vscsi0:1'</td>
/// <td>The UUID is represented by the associated VM instance UUID with its VSCSI name. Virtual disk IOPS limit statistics are associated with 'virtual-disk'.</td>
/// </tr>
/// <tr>
/// <td>virtual-machine</td>
/// <td> <VM-instance-UUID></td>
/// <td>'virtual-machine:55c98c4d-41f0-6ff7-2784-0200103eb5e1'</td>
/// <td>The UUID is represented by the associated VM instance UUID.</td>
/// </tr>
/// <tr>
/// <td>virtual-disk</td>
/// <td><VM-dir-uuid>/<VMDK-file-name></td>
/// <td>'virtual-disk:a2a04b57-e0e6-502b-e4a0-0200073bd703/iops-160-10.160.109.28-1\_1.vmdk'</td>
/// <td>The UUID is represented by the VMDK file path, which can be retrieved using the vSphere API.</td>
/// </tr>
/// <tr>
/// <td>vsan-vnic-net</td>
/// <td> <host-UUID>|<stack-name>|<vnic-name></td>
/// <td>'vsan-vnic-net:588b2225-c58c-8365-c47b-02001065be12|defaultTcpipStack|vmknic0'</td>
/// <td>The UUID is represented by the associated ESXi host UUID with its stack name and vNIC name.</td>
/// </tr>
/// <tr>
/// <td>vsan-pnic-net</td>
/// <td><host-UUID>|<pnic-name></td>
/// <td>'vsan-pnic-net:588b2225-c58c-8365-c47b-02001065be12|vmnic0'</td>
/// <td>This UUID is represented by the associated ESXi host UUID with the pNIC name.</td>
/// </tr>
/// <tr>
/// <td>lsom-world-cpu</td>
/// <td><host-UUID>|<world-name>|<world-id></td>
/// <td>'lsom-world-cpu:5ad47458-3bca-870a-602c-02002c89fe44|VSAN\_0x43050bf3f7f8\_LSOMLLOG|1001393599'</td>
/// <td>The UUID is represented by the associated ESXi host UUID with the LSOM world name and its world ID.</td>
/// </tr>
/// <tr>
/// <td>dom-world-cpu</td>
/// <td><host-UUID>|<world-name>|<world-id></td>
/// <td>'dom-world-cpu:5ad47458-3bca-870a-602c-02002c89fe44|VSAN\_0x430bfa348888\_CompServer|1001393015'</td>
/// <td>The UUID is represented by the associated ESXi host UUID with its DOM world name and world ID.</td>
/// </tr>
/// <tr>
/// <td>host-cpu</td>
/// <td><host-UUID></td>
/// <td>'host-cpu:5ad47458-3bca-870a-602c-02002c89fe44'</td>
/// <td>The UUID is represented by the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>iscsi-target-alias</td>
/// <td><iscsi-target-alias>|<lunid></td>
/// <td>'iscsi-target-alias:iscsitargetaliasexample|1'</td>
/// <td>The UUID is represented by iSCSI target alias with the LUN ID.</td>
/// </tr>
/// <tr>
/// <td>vsan-cluster-capacity</td>
/// <td><cluster-UUID></td>
/// <td>'vsan-cluster-capacity:52c89b61-f818-e495-af20-816d24c850b8'</td>
/// <td>The UUID is represented by the associated cluster UUID.</td>
/// </tr>
/// <tr>
/// <td>vsan-file-service</td>
/// <td><domain-name>|<share-name></td>
/// <td>'vsan-file-service:VSANFS-LOCAL.PRV|genericShare'</td>
/// <td>The UUID is represented by the domain name and the share name.</td>
/// </tr>
/// <tr>
/// <td>nic-world-cpu</td>
/// <td><host-UUID>|<world-name></td>
/// <td>'nic-world-cpu:5b9f8fd9-3687-7003-2f0b-02002fc9daae|vmnic0-pollWorld-0'</td>
/// <td>The UUID is represented by the associated ESXi host UUID with its vNIC/pNIC world name.</td>
/// </tr>
/// <tr>
/// <td>vsan-cpu</td>
/// <td><host-UUID></td>
/// <td>'vsan-cpu:5afa638a-f98a-c9f5-9f8a-0050569ee233'</td>
/// <td>The UUID represents the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>vsan-memory</td>
/// <td><host-UUID></td>
/// <td>'vsan-memory:5afa638a-f98a-c9f5-9f8a-0050569ee233'</td>
/// <td>The UUID represents the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>rdt-net</td>
/// <td><host-UUID></td>
/// <td>'rdt-net:5afa638a-f98a-c9f5-9f8a-0050569ee233'</td>
/// <td>The UUID represents the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>vsan-esa-disk-layer</td>
/// <td><host-UUID></td>
/// <td>'vsan-esa-disk-layer:5afa638a-f98a-c9f5-9f8a-0050569ee233'</td>
/// <td>The UUID represents the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>vsan-esa-disk-scsifw</td>
/// <td><host-UUID></td>
/// <td>'vsan-esa-disk-scsifw:5afa638a-f98a-c9f5-9f8a-0050569ee233'</td>
/// <td>The UUID represents the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>zdom-vtx</td>
/// <td><host-UUID></td>
/// <td>'zdom-vtx:5afa638a-f98a-c9f5-9f8a-0050569ee233'</td>
/// <td>The UUID represents the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>cluster-remotedomclient</td>
/// <td><cluster-UUID></td>
/// <td>'cluster-remotedomclient:52c89b61-f818-e495-af20-816d24c850b8'</td>
/// <td>The UUID is represented by the associated cluster UUID.</td>
/// </tr>
/// <tr>
/// <td>computeCluster-remotedomclient</td>
/// <td><cluster-UUID></td>
/// <td>'computeCluster-remotedomclient:52c89b61-f818-e495-af20-816d24c850b8'</td>
/// <td>The UUID is represented by the associated cluster UUID.</td>
/// </tr>
/// <tr>
/// <td>vsan-direct-cluster</td>
/// <td><cluster-UUID></td>
/// <td>'vsan-direct-cluster:52c89b61-f818-e495-af20-816d24c850b8'</td>
/// <td>The UUID is represented by the associated cluster UUID.</td>
/// </tr>
/// <tr>
/// <td>vsan-direct-host</td>
/// <td><host-UUID></td>
/// <td>'vsan-direct-host:5afa638a-f98a-c9f5-9f8a-0050569ee233'</td>
/// <td>The UUID represents the associated ESXi host UUID.</td>
/// </tr>
/// <tr>
/// <td>host-pmem</td>
/// <td><host-UUID></td>
/// <td>'host-pmem:5afa638a-f98a-c9f5-9f8a-0050569ee233'</td>
/// <td>The UUID represents the associated ESXi host hardware UUID.</td>
/// </tr>
/// <tr>
/// <td>cluster-pmem</td>
/// <td><cluster-MOID></td>
/// <td>'cluster-pmem:domain-c21'</td>
/// <td>The MOID represents the associated managed object ID.</td>
/// </tr>
/// <tr>
/// <td>ioinsight</td>
/// <td> <VM-instance-UUID>|<VSCSI-name></td>
/// <td>'ioinsight:55c98c4d-41f0-6ff7-2784-0200103eb5e1|vscsi0:1'</td>
/// <td>The UUID is represented by the associated VM instance UUID with its VSCSI name.</td>
/// </tr>
/// <tr>
/// <td>ioinsight-histogram</td>
/// <td> <VM-instance-UUID>|<VSCSI-name></td>
/// <td>'ioinsight-histogram:55c98c4d-41f0-6ff7-2784-0200103eb5e1|vscsi0:1'</td>
/// <td>The UUID is represented by the associated VM instance UUID with its VSCSI name.</td>
/// </tr>
/// </table>
///
/// **Supported metrics for each entity type:**
/// <table cellspacing="0">
/// <tr><th>Entity Type</th><th>Metrics (Labels)</th></tr>
/// <tr>
/// <td nowrap="1">'cluster-domclient'</td>
/// <td>
/// 'iopsRead', 'throughputRead', 'latencyAvgRead',
/// 'iopsWrite', 'throughputWrite', 'latencyAvgWrite',
/// 'congestion', 'oio'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'cluster-domcompmgr'</td>
/// <td>
/// 'iopsRead', 'throughputRead', 'latencyAvgRead',
/// 'iopsWrite', 'throughputWrite', 'latencyAvgWrite',
/// 'iopsRecWrite', 'throughputRecWrite', 'latencyAvgRecWrite',
/// 'congestion', 'oio', 'iopsResyncRead', 'tputResyncRead',
/// 'latAvgResyncRead'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'host-domclient'</td>
/// <td>
/// 'iopsRead', 'throughputRead', 'latencyAvgRead', 'readCount',
/// 'iopsWrite', 'throughputWrite', 'latencyAvgWrite', 'writeCount',
/// 'congestion', 'oio', 'clientCacheHits', 'clientCacheHitRate',
/// 'iopsUnmap', 'throughputUnmap', 'latencyAvgUnmap'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'host-domcompmgr'</td>
/// <td>
/// 'iopsRead', 'throughputRead', 'latencyAvgRead', 'readCount',
/// 'iopsWrite', 'throughputWrite', 'latencyAvgWrite', 'writeCount',
/// 'iopsRecWrite', 'throughputRecWrite', 'latencyAvgRecWrite',
/// 'recWriteCount', 'congestion', 'oio', 'iopsResyncRead',
/// 'tputResyncRead', 'latAvgResyncRead', 'iopsUnmap', 'iopsRecUnmap',
/// 'throughputUnmap', 'throughputRecUnmap', 'latencyAvgUnmap',
/// 'latencyAvgRecUnmap'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'cache-disk'</td>
/// <td>
/// 'iopsDevRead', 'throughputDevRead', 'latencyDevRead',
/// 'ioCountDevRead', 'iopsDevWrite', 'throughputDevWrite', 'latencyDevWrite',
/// 'ioCountDevWrite', 'latencyDevDAvg', 'latencyDevGAvg'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'capacity-disk'</td>
/// <td>
/// 'iopsDevRead', 'throughputDevRead', 'latencyDevRead',
/// 'ioCountDevRead', 'iopsDevWrite', 'throughputDevWrite', 'latencyDevWrite',
/// 'ioCountDevWrite', 'latencyDevDAvg', 'latencyDevGAvg', 'iopsRead',
/// 'latencyRead', 'ioCountRead', 'iopsWrite', 'latencyWrite', 'ioCountWrite',
/// 'deleteCongestion'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'disk-group'</td>
/// <td>
/// 'iopsSched', 'latencySched', 'outstandingBytesSched',
/// 'iopsSchedQueueRec', 'throughputSchedQueueRec','latencySchedQueueRec',
/// 'iopsSchedQueueVM', 'throughputSchedQueueVM','latencySchedQueueVM',
/// 'iopsSchedQueueMeta', 'throughputSchedQueueMeta','latencySchedQueueMeta',
/// 'iopsDelayPctSched', 'latencyDelaySched',
/// 'rcHitRate', 'wbFreePct', 'warEvictions', 'quotaEvictions',
/// 'iopsRcRead', 'latencyRcRead', 'ioCountRcRead',
/// 'iopsWbRead', 'latencyWbRead', 'ioCountWbRead',
/// 'iopsRcWrite', 'latencyRcWrite', 'ioCountRcWrite',
/// 'iopsWbWrite', 'latencyWbWrite', 'ioCountWbWrite',
/// 'ssdBytesDrained', 'zeroBytesDrained',
/// 'memCongestion', 'slabCongestion', 'ssdCongestion',
/// 'iopsCongestion', 'logCongestion', 'compCongestion', 'iopsDirectSched',
/// 'iopsRead', 'throughputRead', 'latencyAvgRead', 'readCount',
/// 'iopsWrite', 'throughputWrite', 'latencyAvgWrite', 'writeCount',
/// 'oioWrite', 'oioRecWrite', 'oioWriteSize', 'oioRecWriteSize',
/// 'rcSize', 'wbSize', 'capacity', 'capacityUsed', 'capacityReserved',
/// 'throughputSched', 'iopsResyncReadPolicy', 'iopsResyncReadDecom',
/// 'iopsResyncReadRebalance', 'iopsResyncReadFixComp', 'iopsResyncWritePolicy',
/// 'iopsResyncWriteDecom', 'iopsResyncWriteRebalance', 'iopsResyncWriteFixComp',
/// 'tputResyncReadPolicy', 'tputResyncReadDecom', 'tputResyncReadRebalance',
/// 'tputResyncReadFixComp', 'tputResyncWritePolicy', 'tputResyncWriteDecom',
/// 'tputResyncWriteRebalance', 'tputResyncWriteFixComp', 'latResyncReadPolicy',
/// 'latResyncReadDecom', 'latResyncReadRebalance', 'latResyncReadFixComp',
/// 'latResyncWritePolicy', 'latResyncWriteDecom', 'latResyncWriteRebalance',
/// 'latResyncWriteFixComp', 'bytesPerSecondBandwidth'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'virtual-machine'</td>
/// <td>
/// 'iopsRead', 'throughputRead', 'latencyRead', 'readCount',
/// 'iopsWrite', 'throughputWrite', 'latencyWrite', 'writeCount'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vscsi'</td>
/// <td>
/// 'iopsRead', 'throughputRead', 'latencyRead', 'readCount',
/// 'iopsWrite', 'throughputWrite', 'latencyWrite', 'writeCount'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'virtual-disk'</td>
/// <td>
/// 'iopsLimit', 'NIOPS', 'NIOPSDelayed'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-host-net'</td>
/// <td>
/// 'rxThroughput', 'rxPackets', 'rxPacketsLossRate',
/// 'txThroughput', 'txPackets', 'txPacketsLossRate',
/// 'portRxDrops', 'portTxDrops',
/// 'tcpTxRexmitRate', 'tcpRxErrRate'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-vnic-net'</td>
/// <td>
/// 'rxThroughput', 'rxPackets', 'rxPacketsLossRate',
/// 'txThroughput', 'txPackets', 'txPacketsLossRate',
/// 'portRxDrops', 'portTxDrops'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-pnic-net'</td>
/// <td>
/// 'rxThroughput', 'rxPackets', 'rxPacketsLossRate',
/// 'txThroughput', 'txPackets', 'txPacketsLossRate',
/// 'portRxDrops', 'portTxDrops', 'pauseCount'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'lsom-world-cpu'</td>
/// <td>
/// 'usedPct', 'readyPct'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'dom-world-cpu'</td>
/// <td>
/// 'usedPct', 'readyPct'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'host-cpu'</td>
/// <td>
/// 'coreUtilPct', 'pcpuUtilPct', 'pcpuUsedPct'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-iscsi-host'</td>
/// <td>
/// 'iopsRead', 'iopsWrite', 'iopsTotal',
/// 'bandwidthRead', 'bandwidthWrite', 'bandwidthTotal',
/// 'latencyRead', 'latencyWrite', 'latencyTotal', 'queueDepth'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-iscsi-target'</td>
/// <td>
/// 'iopsRead', 'iopsWrite', 'iopsTotal',
/// 'bandwidthRead', 'bandwidthWrite', 'bandwidthTotal',
/// 'latencyRead', 'latencyWrite', 'latencyTotal', 'queueDepth'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-iscsi-lun'</td>
/// <td>
/// 'iopsRead', 'iopsWrite', 'iopsTotal',
/// 'bandwidthRead', 'bandwidthWrite', 'bandwidthTotal',
/// 'latencyRead', 'latencyWrite', 'latencyTotal', 'queueDepth'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-cluster-capacity'</td>
/// <td>
/// 'total', 'used', 'free', 'savedByDedup', 'dedupRatio'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-file-service'</td>
/// <td>
/// 'readRequested', 'readTransferred', 'readOpTotal', 'readLatency',
/// 'writeRequested', 'writeTransferred', 'writeOpTotal', 'writeLatency'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'nic-world-cpu'</td>
/// <td>
/// 'usedPct', 'readyPct'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-cpu'</td>
/// <td>
/// 'usedPct', 'readyPct'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-memory'</td>
/// <td>
/// 'kernelReservedSize', 'uwReservedSize'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'rdt-net'</td>
/// <td>
/// 'checksumMismatchCount'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-esa-disk-layer'</td>
/// <td>
/// 'iopsReadCapacity', 'iopsWriteCapacity', 'tputReadCapacity', 'tputReadCapacity',
/// 'avgLatReadCapacity', 'avgLatReadCapacity'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-esa-disk-scsifw'</td>
/// <td>
/// 'iopsDevRead', 'iopsDevWrite', 'latencyDevRead', 'latencyDevWrite',
/// 'latencyDevGAvg', 'latencyDevDAvg', 'throughputDevRead', 'throughputDevWrite'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'zdom-vtx'</td>
/// <td>
/// 'rateTotalCacheMiss', 'rateTotalCacheRef', 'rateTotalLogicalTreeCacheMiss',
/// 'rateTotalMiddleTreeCacheMiss', 'rateTotalSnapTreeCacheMiss', 'rateTotalBitmapCacheMiss',
/// 'rateTotalSutCacheMiss', 'rateTxnPrefetchTotalCacheMiss', 'rateTxnPrefetchLogicalTreeCacheMiss',
/// 'rateTxnPrefetchMiddleTreeCacheMiss', 'rateTxnPrefetchSutCacheMiss', 'rateTxnBankTotalCacheMiss',
/// 'rateTxnBankLogicalTreeCacheMiss', 'rateTxnBankMiddleTreeCacheMiss', 'rateTxnBankSutCacheMiss',
/// 'rateTxnUnmapTotalCacheMiss, 'rateTxnUnmapLogicalTreeCacheMiss', 'rateTxnUnmapMiddleTreeCacheMiss',
/// 'rateTxnUnmapSutCacheMiss', 'rateTxnSegCleaningCtxDataTotalCacheMiss', 'rateTxnSegCleaningCtxDataLogicalTreeCacheMiss',
/// 'rateTxnSegCleaningCtxDataMiddleTreeCacheMiss', 'rateTxnSegCleaningCtxDataSutCacheMiss',
/// 'rateTxnlookUpCacheMiss', 'rateTxnlookUpLogicalTreeCacheMiss', 'rateTxnlookUpMiddleTreeCacheMiss',
/// 'latAvgCacheGet', 'latAvgTotalOpIO', 'latAvgTxnBank', 'latAvgTxnBankTotalIO', 'latAvgTxnUnmap',
/// 'latAvgTxnUnmapTotalIO', 'cacheMissPerPrefetchTxn', 'cacheMissPerBankFlushTxn', 'cacheMissPerLookupTxn'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'cluster-remotedomclient'</td>
/// <td>
/// 'iopsRead', 'iopsWrite', 'throughputRead',
/// 'throughputWrite', 'latencyAvgRead', 'latencyAvgWrite',
/// 'congestion', 'oio'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'computeCluster-remotedomclient'</td>
/// <td>
/// 'iopsRead', 'iopsWrite', 'throughputRead',
/// 'throughputWrite', 'latencyAvgRead', 'latencyAvgWrite',
/// 'congestion', 'oio'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-direct-cluster'</td>
/// <td>
/// 'iopsDevRead', 'iopsDevWrite', 'throughputDevRead',
/// 'throughputDevWrite', 'latencyDevRead', 'latencyDevWrite',
/// 'oioDevRead', 'oioDevWrite'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'vsan-direct-host'</td>
/// <td>
/// 'iopsDevRead', 'iopsDevWrite', 'throughputDevRead',
/// 'throughputDevWrite', 'latencyDevRead', 'latencyDevWrite',
/// 'oioDevRead', 'oioDevWrite'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'host-pmem'</td>
/// <td>
/// 'bandwidthRead', 'bandwidthWrite', 'bandwidthTotal',
/// 'latencyRead', 'latencyWrite', 'iopsRead', 'iopsWrite',
/// 'iopsTotal'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'cluster-pmem'</td>
/// <td>
/// 'bandwidthRead', 'bandwidthWrite', 'bandwidthTotal',
/// 'latencyRead', 'latencyWrite', 'iopsRead', 'iopsWrite',
/// 'iopsTotal'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'ioinsight'</td>
/// <td>
/// 'iopsRead', 'iopsWrite', 'iopsTotal', 'throughputRead', 'throughputWrite',
/// 'throughputSequential', 'throughputRandom', 'throughputTotal',
/// 'sequentialReadRatio', 'sequentialWriteRatio', 'sequentialRatio',
/// 'randomReadRatio', 'randomWriteRatio', 'randomRatio',
/// 'aligned4kReadRatio', 'aligned4kWriteRatio', 'aligned4kRatio',
/// 'unaligned4kReadRatio', 'unaligned4kWriteRatio', 'unaligned4kRatio',
/// 'readRatio', 'writeRatio'
/// </td>
/// </tr>
/// <tr>
/// <td nowrap="1">'ioinsight-histogram'</td>
/// <td>
/// 'iosz0\_4k', 'riosz0\_4k', 'wiosz0\_4k',
/// 'iosz4k', 'riosz4k', 'wiosz4k',
/// 'iosz4k\_8k', 'riosz4k\_8k', 'wiosz4k\_8k',
/// 'iosz8k', 'riosz8k', 'wiosz8k',
/// 'iosz8k\_16k', 'riosz8k\_16k', 'wiosz8k\_16k',
/// 'iosz16k', 'riosz16k', 'wiosz16k',
/// 'iosz16k\_32k', 'riosz16k\_32k', 'wiosz16k\_32k',
/// 'iosz32k', 'riosz32k', 'wiosz32k',
/// 'iosz32k\_64k', 'riosz32k\_64k', 'wiosz32k\_64k',
/// 'iosz64k', 'riosz64k', 'wiosz64k',
/// 'iosz64k\_128k', 'riosz64k\_128k', 'wiosz64k\_128k',
/// 'iosz128k', 'riosz128k', 'wiosz128k',
/// 'iosz128k\_256k', 'riosz128k\_256k', 'wiosz128k\_256k',
/// 'iosz256k', 'riosz256k', 'wiosz256k',
/// 'iosz256k\_512k', 'riosz256k\_512k', 'wiosz256k\_512k',
/// 'iosz512k', 'riosz512k', 'wiosz512k',
/// 'iosz512k\_1m', 'riosz512k\_1m', 'wiosz512k\_1m',
/// 'iosz1m', 'riosz1m', 'wiosz1m', 'iosz1\_m', 'riosz1\_m', 'wiosz1\_m',
/// 'lat0\_1us', 'rlat0\_1us', 'wlat0\_1us',
/// 'lat1\_10us', 'rlat1\_10us', 'wlat1\_10us',
/// 'lat10\_100us', 'rlat10\_100us', 'wlat10\_100us',
/// 'lat100\_500us', 'rlat100\_500us', 'wlat100\_500us',
/// 'lat500us\_1ms', 'rlat500us\_1ms', 'wlat500us\_1ms',
/// 'lat1\_5ms', 'rlat1\_5ms', 'wlat1\_5ms',
/// 'lat5\_10ms', 'rlat5\_10ms', 'wlat5\_10ms',
/// 'lat10\_25ms', 'rlat10\_25ms', 'wlat10\_25ms',
/// 'lat25\_50ms', 'rlat25\_50ms', 'wlat25\_50ms',
/// 'lat50\_100ms', 'rlat50\_100ms', 'wlat50\_100ms',
/// 'lat100\_ms', 'rlat100\_ms', 'wlat100\_ms'
/// </td>
/// </tr>
/// </table>
///
/// ## Parameters:
///
/// ### query_specs
/// A array of VsanPerfQuerySpec objects. The VsanPerfQuerySpec object
/// specifies a reference for an entity, plus optional criteria for filtering
/// results. Only metrics for the entities that can be resolved are returned in
/// any result.
/// The VsanPerfQuerySpec object in this operation can
/// query for different metrics. Or, select all types of statistics for a
/// single entity. See above for supported entity types, metric groups and metrics
/// The VsanPerfQuerySpec object supports wildcard query by setting UUID to '\*', it retrieves
/// all entities based on the specified entity type, startTime, and endTime.
/// From version 8.0U2, the VsanPerfQuerySpec object supports multi-entity query for a single
/// entity type and unified duration by setting queried node id to '<UUID1>,<UUID2>,..',
/// it will return all relevant entities according to the entity type, startTime and endTime.
/// The maximum limit of the number of UUIDs is 400.
/// **Note**: To avoid bad performance and resource usage issues caused by massive stats data
/// from a stats query. There are some validation checks:
/// - In each query, the startTime and endTime must be specified in
/// the query spec. And the suggested time span is less than 24 hours. To query stats
/// for larger time range, please use paging mechanism. For example, split the time range
/// in to smaller ones, and use multiple status queries with smaller time ranges.
/// - In each query, when there is no wildcard or multi-entity query specified in the parameter
/// querySpecs, the number of items within querySpecs should not exceed 100. When the parameter
/// querySpecs includes more than 100 items, please use the paging mechanism.
/// - In each query, if there is wildcard query or multi-entity query, the parameter querySpecs
/// can only contain either one wildcard query or one multi-entity query.
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ComputeResource*.
///
/// ## Returns:
///
/// The metric values for the specified entity or entities.
///
/// ## Errors:
///
/// ***InvalidArgument***: if the set of arguments passed to the function is
/// not specified correctly.
///
/// ***NotSupported***: if the host queried is not a Stats Daemon master
///
/// ***NotFound***: if no ESXi host could be contacted to perform the operation
/// when called against vCenter.
pub async fn vsan_perf_query_perf(&self, query_specs: &[crate::types::structs::VsanPerfQuerySpec], cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Vec<crate::types::structs::VsanPerfEntityMetricCsv>> {
let input = VsanPerfQueryPerfRequestType {query_specs, cluster, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfQueryPerf", Some(&input)).await?;
let result: Vec<crate::types::structs::VsanPerfEntityMetricCsv> = crate::core::client::unmarshal_array(self.client.transport(), &bytes)?;
Ok(result)
}
/// The API is designed to return a list of hotspot entities that are consuming the
/// most IOPS, throughput or latency according to given start time and end time in
/// the vSAN cluster.
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster, which is ignored if the API is called against
/// host.
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ### query_spec
/// Represent query specification to retrieve the desired top
/// entities.
///
/// ## Returns:
///
/// A list of hotspot entities with the expected metric values at the given
/// start time and end time.
///
/// ## Errors:
///
/// ***InvalidArgument***: if the set of arguments passed to the function is
/// not specified correctly, e.g., numEntities is more than 64.
///
/// ***Timedout***: if this API is timeout.
///
/// ***VsanNodeNotMaster***: if this API is invokded against stats agent node.
///
/// ***NotFound***: if the stats primary node is not found in target cluster.
///
/// ***NotSupported***: if vSAN is not enabled in target cluster.
pub async fn query_vsan_perf_hotspot_entities(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, query_spec: &crate::types::structs::VsanPerfHotspotQuerySpec) -> Result<Vec<crate::types::structs::VsanPerfHotspotEntitiesMetrics>> {
let input = QueryVsanPerfHotspotEntitiesRequestType {cluster, query_spec, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "QueryVsanPerfHotspotEntities", Some(&input)).await?;
let result: Vec<crate::types::structs::VsanPerfHotspotEntitiesMetrics> = crate::core::client::unmarshal_array(self.client.transport(), &bytes)?;
Ok(result)
}
/// The API is designed to return a list of top contributors with either type of
/// VM or disk group that are consuming the most IOPS, throughput or latency in
/// the vSAN cluster.
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster, which is ignored if the API is called against
/// host.
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ClusterComputeResource*.
///
/// ### query_spec
/// Represent query specification to retrieve the desired top
/// entities.
///
/// ## Returns:
///
/// A list of top entities with the expected metric values at the given
/// time stamp.
///
/// ## Errors:
///
/// ***InvalidArgument***: if the set of arguments passed to the function is
/// not specified correctly, e.g., numEntities is above 50.
///
/// ***VsanNodeNotMaster***: if this API is invokded against stats agent node.
pub async fn query_vsan_perf_top_entities(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, query_spec: &crate::types::structs::VsanPerfTopQuerySpec) -> Result<Vec<crate::types::structs::VsanPerfEntityMetricCsv>> {
let input = QueryVsanPerfTopEntitiesRequestType {cluster, query_spec, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "QueryVsanPerfTopEntities", Some(&input)).await?;
let result: Vec<crate::types::structs::VsanPerfEntityMetricCsv> = crate::core::client::unmarshal_array(self.client.transport(), &bytes)?;
Ok(result)
}
/// Save time ranges in performance service.
///
/// ***Required privileges:*** Global.Diagnostics
///
/// ## Parameters:
///
/// ### cluster
/// Refers instance of *ClusterComputeResource*.
///
/// ### time_ranges
/// *VsanPerfTimeRange* list to be saved.
///
/// ## Errors:
///
/// Failure
pub async fn vsan_perf_save_time_ranges(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, time_ranges: &[crate::types::structs::VsanPerfTimeRange]) -> Result<()> {
let input = VsanPerfSaveTimeRangesRequestType {cluster, time_ranges, };
self.client.invoke_void("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfSaveTimeRanges", Some(&input)).await
}
/// Set the policy of the vSAN object/directory containing the vSAN Perf Stats DB.
///
/// The cluster parameter is ignored if called on ESXi.
/// Profile can be 3 formats:
/// - 1\. VirtualMachineEmptyProfileSpec means to use the empty vSAN policy. This is not the
/// default policy, but a policy where all fields have default values.
/// - 2\. VirtualMachineDefinedProfileSpec where profileId is set, in which case this
/// profileId will be looked up in SPBM for the detailed policy information.
/// - 3\. VirtualMachineDefinedProfileSpec where profileId is an empty string and instead
/// the profileData is set for extensionKey 'com.vmware.vim.sps'. In this case the
/// objectData field can be either the vSAN expression format, or a SPBM XML string.
///
///
/// If no profile is supplied, and the call is executed against vCenter, then SPBM will
/// be consulted for the vSAN datastore's default profile.
///
/// When this method returns successfully, the profile has been applied, but vSAN may
/// still be remediating in order to implement the new policy. The health state of the
/// object and resync information should be monitored to check on the progress.
///
/// Only the third option is available when called on ESXi, other formats will raise
/// InvalidArgument exception.
///
/// Exception:
/// - If SPBM needs to be contacted, but SPBM is not available, RuntimeFault exception will
/// be raised.
/// - If the profileId can not be resolved with SPBM, InvalidArgument exception will be raised.
/// - If objectData was provided but is neither of the two supported formats, InvalidArgument
/// exception will be raised.
/// - If the statsDB object can not be found, FileNotFound exception will be raised.
/// - If the statsDB object failed to set the policy, e.g. because it is not accessible,
/// FileNotWritable exception will be raised.
/// - If called against vCenter, but no ESXi host could be contacted to perform
/// the operation NotFound exception will be raised.
///
///
/// Python code example:
///
/// spec = vim.vm.DefinedProfileSpec()
///
/// VsanPerfSetStatsObjectPolicy(self.clusterRef, spec)
///
/// ## Parameters:
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** Host.Inventory.EditCluster
///
/// Refers instance of *ComputeResource*.
///
/// ### profile
/// See above description for all possible options.
///
/// ## Errors:
///
/// ***NotFound***: if no ESXi host could be contacted to perform the operation
/// when called against vCenter.
///
/// ***VsanFault***: if the caller doesn't have the required privilege
pub async fn vsan_perf_set_stats_object_policy(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, profile: Option<&dyn crate::types::traits::VirtualMachineProfileSpecTrait>) -> Result<bool> {
let input = VsanPerfSetStatsObjectPolicyRequestType {cluster, profile, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfSetStatsObjectPolicy", Some(&input)).await?;
let result: bool = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Toggle vSAN performance service verbose mode.
///
/// ***Required privileges:*** Global.Settings
///
/// ## Parameters:
///
/// ### cluster
/// Refers instance of *ClusterComputeResource*.
///
/// ### verbose_mode
/// Switch of verbose mode, the type is boolean.
///
/// ## Errors:
///
/// Failure
pub async fn vsan_perf_toggle_verbose_mode(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, verbose_mode: bool) -> Result<()> {
let input = VsanPerfToggleVerboseModeRequestType {cluster, verbose_mode, };
self.client.invoke_void("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfToggleVerboseMode", Some(&input)).await
}
/// Deprecated as of vSphere API 6.7, please use VsanPerfDiagnoseTask instead.
///
/// API to do performance diagnosis.
///
/// ## Parameters:
///
/// ### perf_diagnose_query
/// The query describing details of diagnosis
/// required, such as the period of diagnosis and the query type.
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** System.Read
///
/// Refers instance of *ComputeResource*.
///
/// ## Returns:
///
/// The list of performance issues found. Each performance issue is
/// returned as a VsanPerfDiagnosticResult. The VsanPerfDiagnosticResult
/// object will contain the entity and the metrics that caused the performance
/// exception.
///
/// ## Errors:
///
/// Failure
pub async fn vsan_perf_diagnose(&self, perf_diagnose_query: &crate::types::structs::VsanPerfDiagnoseQuerySpec, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::VsanPerfDiagnosticResult>>> {
let input = VsanPerfDiagnoseRequestType {perf_diagnose_query, cluster, };
let bytes_opt = self.client.invoke_optional("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfDiagnose", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Runs a diagnostic query to determine performance issues in a vSAN
/// cluster.
///
/// This API call investigates the state of the vSAN cluster during
/// the chosen period of time, and returns any issues (list of
/// VsanPerfDiagnosticResult) that may be limiting the
/// performance of the vSAN cluster. This API is available from only the vCenter,
/// it is not available at the end-host. Processing is performed in the
/// background, and a task is returned. Please wait for the task to finish, and
/// then call GetVsanPerfDiagnosisResult to retrieve results.
///
/// ## Parameters:
///
/// ### perf_diagnose_query
/// The query describing details of diagnosis
/// required, such as the period of diagnosis and the query type.
///
/// ### cluster
/// vSAN cluster. Ignored if called against host.
///
/// ***Required privileges:*** Global.Diagnostics
///
/// Refers instance of *ComputeResource*.
///
/// ## Returns:
///
/// A task doing the asynchronous work.
///
/// Refers instance of *Task*.
///
/// ## Errors:
///
/// ***InvalidArgument***: if the set of arguments passed to the function is
/// not specified correctly.
///
/// ***NotFound***: if no ESXi host could be contacted to perform the
/// operation when called against vCenter or if the API was not invoked on
/// vCenter or if CEIP is not enabled
///
/// ***VsanFault***: if the caller doesn't have the required privilege, or the
/// cluster has no hosts.
pub async fn vsan_perf_diagnose_task(&self, perf_diagnose_query: &crate::types::structs::VsanPerfDiagnoseQuerySpec, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<crate::types::structs::ManagedObjectReference> {
let input = VsanPerfDiagnoseTaskRequestType {perf_diagnose_query, cluster, };
let bytes = self.client.invoke("vsan", "VsanPerformanceManager", &self.mo_id, "VsanPerfDiagnoseTask", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
}
struct VsanPerfCreateStatsObjectRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
profile: Option<&'a dyn crate::types::traits::VirtualMachineProfileSpecTrait>,
}
impl<'a> miniserde::Serialize for VsanPerfCreateStatsObjectRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfCreateStatsObjectRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfCreateStatsObjectRequestTypeSer<'b, 'a> {
data: &'b VsanPerfCreateStatsObjectRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfCreateStatsObjectRequestTypeSer<'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"), &"VsanPerfCreateStatsObjectRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => {
let Some(ref val) = self.data.profile else { continue; };
return Some((std::borrow::Cow::Borrowed("profile"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfCreateStatsObjectTaskRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
profile: Option<&'a dyn crate::types::traits::VirtualMachineProfileSpecTrait>,
}
impl<'a> miniserde::Serialize for VsanPerfCreateStatsObjectTaskRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfCreateStatsObjectTaskRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfCreateStatsObjectTaskRequestTypeSer<'b, 'a> {
data: &'b VsanPerfCreateStatsObjectTaskRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfCreateStatsObjectTaskRequestTypeSer<'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"), &"VsanPerfCreateStatsObjectTaskRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => {
let Some(ref val) = self.data.profile else { continue; };
return Some((std::borrow::Cow::Borrowed("profile"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfDeleteStatsObjectRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for VsanPerfDeleteStatsObjectRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfDeleteStatsObjectRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfDeleteStatsObjectRequestTypeSer<'b, 'a> {
data: &'b VsanPerfDeleteStatsObjectRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfDeleteStatsObjectRequestTypeSer<'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"), &"VsanPerfDeleteStatsObjectRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfDeleteStatsObjectTaskRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for VsanPerfDeleteStatsObjectTaskRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfDeleteStatsObjectTaskRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfDeleteStatsObjectTaskRequestTypeSer<'b, 'a> {
data: &'b VsanPerfDeleteStatsObjectTaskRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfDeleteStatsObjectTaskRequestTypeSer<'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"), &"VsanPerfDeleteStatsObjectTaskRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfDeleteTimeRangeRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
name: &'a str,
}
impl<'a> miniserde::Serialize for VsanPerfDeleteTimeRangeRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfDeleteTimeRangeRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfDeleteTimeRangeRequestTypeSer<'b, 'a> {
data: &'b VsanPerfDeleteTimeRangeRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfDeleteTimeRangeRequestTypeSer<'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"), &"VsanPerfDeleteTimeRangeRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => return Some((std::borrow::Cow::Borrowed("name"), &self.data.name as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
}
struct GetVsanPerfDiagnosisResultRequestType<'a> {
task: &'a crate::types::structs::ManagedObjectReference,
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for GetVsanPerfDiagnosisResultRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(GetVsanPerfDiagnosisResultRequestTypeSer { data: self, seq: 0 }))
}
}
struct GetVsanPerfDiagnosisResultRequestTypeSer<'b, 'a> {
data: &'b GetVsanPerfDiagnosisResultRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for GetVsanPerfDiagnosisResultRequestTypeSer<'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"), &"GetVsanPerfDiagnosisResultRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("task"), &self.data.task as &dyn miniserde::Serialize)),
2 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfQueryClusterHealthRequestType<'a> {
cluster: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for VsanPerfQueryClusterHealthRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfQueryClusterHealthRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfQueryClusterHealthRequestTypeSer<'b, 'a> {
data: &'b VsanPerfQueryClusterHealthRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfQueryClusterHealthRequestTypeSer<'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"), &"VsanPerfQueryClusterHealthRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct VsanPerfQueryNodeInformationRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for VsanPerfQueryNodeInformationRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfQueryNodeInformationRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfQueryNodeInformationRequestTypeSer<'b, 'a> {
data: &'b VsanPerfQueryNodeInformationRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfQueryNodeInformationRequestTypeSer<'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"), &"VsanPerfQueryNodeInformationRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct QueryRemoteServerClustersRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
query_spec: Option<&'a crate::types::structs::VsanRemoteClusterQuerySpec>,
}
impl<'a> miniserde::Serialize for QueryRemoteServerClustersRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(QueryRemoteServerClustersRequestTypeSer { data: self, seq: 0 }))
}
}
struct QueryRemoteServerClustersRequestTypeSer<'b, 'a> {
data: &'b QueryRemoteServerClustersRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for QueryRemoteServerClustersRequestTypeSer<'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"), &"QueryRemoteServerClustersRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => {
let Some(ref val) = self.data.query_spec else { continue; };
return Some((std::borrow::Cow::Borrowed("querySpec"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfQueryStatsObjectInformationRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for VsanPerfQueryStatsObjectInformationRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfQueryStatsObjectInformationRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfQueryStatsObjectInformationRequestTypeSer<'b, 'a> {
data: &'b VsanPerfQueryStatsObjectInformationRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfQueryStatsObjectInformationRequestTypeSer<'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"), &"VsanPerfQueryStatsObjectInformationRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfQueryTimeRangesRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
query_spec: &'a crate::types::structs::VsanPerfTimeRangeQuerySpec,
}
impl<'a> miniserde::Serialize for VsanPerfQueryTimeRangesRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfQueryTimeRangesRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfQueryTimeRangesRequestTypeSer<'b, 'a> {
data: &'b VsanPerfQueryTimeRangesRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfQueryTimeRangesRequestTypeSer<'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"), &"VsanPerfQueryTimeRangesRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => return Some((std::borrow::Cow::Borrowed("querySpec"), &self.data.query_spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
}
struct VsanPerfQueryPerfRequestType<'a> {
query_specs: &'a [crate::types::structs::VsanPerfQuerySpec],
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for VsanPerfQueryPerfRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfQueryPerfRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfQueryPerfRequestTypeSer<'b, 'a> {
data: &'b VsanPerfQueryPerfRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfQueryPerfRequestTypeSer<'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"), &"VsanPerfQueryPerfRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("querySpecs"), &self.data.query_specs as &dyn miniserde::Serialize)),
2 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct QueryVsanPerfHotspotEntitiesRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
query_spec: &'a crate::types::structs::VsanPerfHotspotQuerySpec,
}
impl<'a> miniserde::Serialize for QueryVsanPerfHotspotEntitiesRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(QueryVsanPerfHotspotEntitiesRequestTypeSer { data: self, seq: 0 }))
}
}
struct QueryVsanPerfHotspotEntitiesRequestTypeSer<'b, 'a> {
data: &'b QueryVsanPerfHotspotEntitiesRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for QueryVsanPerfHotspotEntitiesRequestTypeSer<'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"), &"QueryVsanPerfHotspotEntitiesRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => return Some((std::borrow::Cow::Borrowed("querySpec"), &self.data.query_spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
}
struct QueryVsanPerfTopEntitiesRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
query_spec: &'a crate::types::structs::VsanPerfTopQuerySpec,
}
impl<'a> miniserde::Serialize for QueryVsanPerfTopEntitiesRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(QueryVsanPerfTopEntitiesRequestTypeSer { data: self, seq: 0 }))
}
}
struct QueryVsanPerfTopEntitiesRequestTypeSer<'b, 'a> {
data: &'b QueryVsanPerfTopEntitiesRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for QueryVsanPerfTopEntitiesRequestTypeSer<'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"), &"QueryVsanPerfTopEntitiesRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => return Some((std::borrow::Cow::Borrowed("querySpec"), &self.data.query_spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
}
struct VsanPerfSaveTimeRangesRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
time_ranges: &'a [crate::types::structs::VsanPerfTimeRange],
}
impl<'a> miniserde::Serialize for VsanPerfSaveTimeRangesRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfSaveTimeRangesRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfSaveTimeRangesRequestTypeSer<'b, 'a> {
data: &'b VsanPerfSaveTimeRangesRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfSaveTimeRangesRequestTypeSer<'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"), &"VsanPerfSaveTimeRangesRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => return Some((std::borrow::Cow::Borrowed("timeRanges"), &self.data.time_ranges as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
}
struct VsanPerfSetStatsObjectPolicyRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
profile: Option<&'a dyn crate::types::traits::VirtualMachineProfileSpecTrait>,
}
impl<'a> miniserde::Serialize for VsanPerfSetStatsObjectPolicyRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfSetStatsObjectPolicyRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfSetStatsObjectPolicyRequestTypeSer<'b, 'a> {
data: &'b VsanPerfSetStatsObjectPolicyRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfSetStatsObjectPolicyRequestTypeSer<'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"), &"VsanPerfSetStatsObjectPolicyRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => {
let Some(ref val) = self.data.profile else { continue; };
return Some((std::borrow::Cow::Borrowed("profile"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfToggleVerboseModeRequestType<'a> {
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
verbose_mode: bool,
}
impl<'a> miniserde::Serialize for VsanPerfToggleVerboseModeRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfToggleVerboseModeRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfToggleVerboseModeRequestTypeSer<'b, 'a> {
data: &'b VsanPerfToggleVerboseModeRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfToggleVerboseModeRequestTypeSer<'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"), &"VsanPerfToggleVerboseModeRequestType")),
1 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
2 => return Some((std::borrow::Cow::Borrowed("verboseMode"), &self.data.verbose_mode as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
}
struct VsanPerfDiagnoseRequestType<'a> {
perf_diagnose_query: &'a crate::types::structs::VsanPerfDiagnoseQuerySpec,
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for VsanPerfDiagnoseRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfDiagnoseRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfDiagnoseRequestTypeSer<'b, 'a> {
data: &'b VsanPerfDiagnoseRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfDiagnoseRequestTypeSer<'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"), &"VsanPerfDiagnoseRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("perfDiagnoseQuery"), &self.data.perf_diagnose_query as &dyn miniserde::Serialize)),
2 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct VsanPerfDiagnoseTaskRequestType<'a> {
perf_diagnose_query: &'a crate::types::structs::VsanPerfDiagnoseQuerySpec,
cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for VsanPerfDiagnoseTaskRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(VsanPerfDiagnoseTaskRequestTypeSer { data: self, seq: 0 }))
}
}
struct VsanPerfDiagnoseTaskRequestTypeSer<'b, 'a> {
data: &'b VsanPerfDiagnoseTaskRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for VsanPerfDiagnoseTaskRequestTypeSer<'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"), &"VsanPerfDiagnoseTaskRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("perfDiagnoseQuery"), &self.data.perf_diagnose_query as &dyn miniserde::Serialize)),
2 => {
let Some(ref val) = self.data.cluster else { continue; };
return Some((std::borrow::Cow::Borrowed("cluster"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}