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
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// This managed object creates and removes datastores from the host.
///
/// To a host, a datastore is a storage abstraction that is backed by one
/// of several types of storage volumes:
/// <dl>
/// <dt>**Local file system**</dt>
/// <dd>
/// A datastore that is backed by a local file system volume uses a host native
/// local file system such as NTFS or ext3. The datastore is created by
/// identifying a file path for a directory in which virtual machine data will
/// be stored. When the datastore is deleted, the mapping from the datastore to
/// the file is deleted. The contents of the directory are not deleted.
/// </dd>
///
/// <dt>**NAS Volume**</dt>
/// <dd>
/// A datastore that is backed by a network-attached storage device is created
/// by specifying the required data needed to attach the volume to the host.
/// Destroying the datastore detaches the volume from the host.
/// </dd>
///
/// <dt>**VMFS**</dt>
/// <dd>
/// A datastore that is backed by a VMware File System (VMFS) is created by
/// specifying a disk with unpartitioned space, the desired disk partition
/// format on the disk, and some VMFS attributes.
///
/// An ESX Server system automatically discovers the VMFS volume on attached Logical
/// Unit Numbers (LUNs) on startup and after re-scanning the host bus adapter.
/// Datastores are automatically created. The datastore label is based on the
/// VMFS volume label. If there is a conflict with an existing datastore,
/// it is made unique by appending a suffix. The VMFS volume label will
/// be unchanged.
///
/// Destroying the datastore removes the partitions that compose the VMFS volume.
/// </dd>
/// </dl>
/// Datastores are never automatically removed because transient storage
/// connection outages may occur. They must be removed from the host using
/// this interface.
///
/// See also *Datastore*.
#[derive(Clone)]
pub struct HostDatastoreSystem {
client: Arc<dyn VimClient>,
mo_id: String,
}
impl HostDatastoreSystem {
pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
Self {
client,
mo_id: mo_id.to_string(),
}
}
/// Configures datastore principal user for the host.
///
/// All virtual machine-related file I/O is performed under
/// this user. Configuring datastore principal user
/// will result in all virtual machine files (configuration, disk,
/// and so on) being checked for proper access. If necessary, ownership
/// and permissions are modified. Note that in some environments,
/// file ownership and permissions modification may not be possible.
/// For example, virtual machine files stored on NFS cannot be
/// modified for ownership and permissions if root squashing is
/// enabled. Ownership and permissions for these files must be
/// manually changed by a system administrator. In general, if
/// server process does not have rights to change ownership
/// and file permissions of virtual machine files, they must
/// be modified manually. If a virtual machine files are not
/// read/writeable by this user, virtual machine related operations such as
/// power on/off, configuration, and so on will fail. This operation
/// must be performed while in maintenance mode and requires host
/// reboot.
///
/// ***Required privileges:*** Host.Config.Maintenance
///
/// ## Parameters:
///
/// ### user_name
/// Datastore principal user name.
///
/// ### password
/// Optional password for systems that require password for
/// user impersonation.
///
/// ## Errors:
///
/// ***InvalidState***: if the host is not in maintenance mode.
///
/// ***InvalidArgument***: if userName or password is not valid.
///
/// ***NotSupported***: if this feature is not supported on the host.
///
/// ***HostConfigFault***: if unable to configure the datastore principal.
pub async fn configure_datastore_principal(&self, user_name: &str, password: Option<&str>) -> Result<()> {
let input = ConfigureDatastorePrincipalRequestType {user_name, password, };
self.client.invoke_void("", "HostDatastoreSystem", &self.mo_id, "ConfigureDatastorePrincipal", Some(&input)).await
}
/// Creates a new local datastore.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### name
/// The name of a datastore to create on the local host.
///
/// ### path
/// The file path for a directory in which the virtual machine data
/// will be stored.
///
/// ## Returns:
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***DuplicateName***: if a datastore with the same name already exists.
///
/// ***HostConfigFault***: if unable to create the datastore on host.
///
/// ***InvalidName***: if name is not valid datastore name
///
/// ***FileNotFound***: if path doesn't exist
pub async fn create_local_datastore(&self, name: &str, path: &str) -> Result<crate::types::structs::ManagedObjectReference> {
let input = CreateLocalDatastoreRequestType {name, path, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "CreateLocalDatastore", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Creates a new network-attached storage datastore.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### spec
/// The specification for creating a network-attached storage volume.
///
/// ## Returns:
///
/// The newly created datastore.
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***DuplicateName***: if a datastore with the same name already exists.
///
/// ***InvalidArgument***: if the datastore name is invalid, or the spec
/// is invalid.
///
/// ***NoVirtualNic***: if VMkernel TCPIP stack is not configured.
///
/// ***NoGateway***: if VMkernel gateway is not configured.
///
/// ***AlreadyExists***: if the local path already exists on the host, or
/// the remote path is already mounted on the host.
///
/// ***HostConfigFault***: if unable to mount the NAS volume.
pub async fn create_nas_datastore(&self, spec: &crate::types::structs::HostNasVolumeSpec) -> Result<crate::types::structs::ManagedObjectReference> {
let input = CreateNasDatastoreRequestType {spec, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "CreateNasDatastore", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Creates a new VMFS datastore.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### spec
/// The specification for creating a datastore backed by a VMFS.
///
/// ## Returns:
///
/// The newly created datastore.
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***DuplicateName***: if a datastore with the same name already exists.
///
/// ***InvalidArgument***: if the datastore name is invalid, or the spec
/// is invalid.
///
/// ***NotSupported***: if the host is not an ESX Server system.
///
/// ***HostConfigFault***: if unable to format the VMFS volume or
/// gather information about the created volume.
pub async fn create_vmfs_datastore(&self, spec: &crate::types::structs::VmfsDatastoreCreateSpec) -> Result<crate::types::structs::ManagedObjectReference> {
let input = CreateVmfsDatastoreRequestType {spec, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "CreateVmfsDatastore", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Create a Virtual-Volume based datastore
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### spec
/// Specification for creating a Virtual-Volume based datastore.
///
/// ## Returns:
///
/// The newly created datastore.
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***NotFound***: if the storage container could not be found.
///
/// ***DuplicateName***: if a datastore with the same name already exists.
///
/// ***HostConfigFault***: if unable to create the datastore on host.
///
/// ***InvalidName***: if name is not valid datastore name
pub async fn create_vvol_datastore(&self, spec: &crate::types::structs::HostDatastoreSystemVvolDatastoreSpec) -> Result<crate::types::structs::ManagedObjectReference> {
let input = CreateVvolDatastoreRequestType {spec, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "CreateVvolDatastore", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Disable the clustered vmdk support on specified datastore.
///
/// This API will fail if there are running VMs on the datastore
/// which are configured to use clustered VMDK feature.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// Datastore on which clustered vmdk should be
/// disabled.
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***NotFound***: if a datastore with the name could not be found.
///
/// ***HostConfigFault***: if unable to disable clustered vmdk support.
pub async fn disable_clustered_vmdk_support(&self, datastore: &crate::types::structs::ManagedObjectReference) -> Result<()> {
let input = DisableClusteredVmdkSupportRequestType {datastore, };
self.client.invoke_void("", "HostDatastoreSystem", &self.mo_id, "DisableClusteredVmdkSupport", Some(&input)).await
}
/// Enable the clustered vmdk support on specified datastore.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// Datastore on which clustered vmdk should be
/// enabled
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***NotFound***: if a datastore with the name could not be found.
///
/// ***HostConfigFault***: if unable to enable clustered vmdk support.
pub async fn enable_clustered_vmdk_support(&self, datastore: &crate::types::structs::ManagedObjectReference) -> Result<()> {
let input = EnableClusteredVmdkSupportRequestType {datastore, };
self.client.invoke_void("", "HostDatastoreSystem", &self.mo_id, "EnableClusteredVmdkSupport", Some(&input)).await
}
/// Increases the capacity of an existing VMFS datastore by expanding
/// (increasing the size of) an existing extent of the datastore.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The datastore whose capacity should be increased.
///
/// Refers instance of *Datastore*.
///
/// ### spec
/// The specification describing which extent of the VMFS
/// datastore to expand.
///
/// ## Returns:
///
/// The expanded datastore.
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***NotFound***: if a datastore with the name could not be found.
///
/// ***NotSupported***: if the host is not an ESX Server.
///
/// ***HostConfigFault***: if unable to expand the VMFS volume.
pub async fn expand_vmfs_datastore(&self, datastore: &crate::types::structs::ManagedObjectReference, spec: &crate::types::structs::VmfsDatastoreExpandSpec) -> Result<crate::types::structs::ManagedObjectReference> {
let input = ExpandVmfsDatastoreRequestType {datastore, spec, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "ExpandVmfsDatastore", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Increases the capacity of an existing VMFS datastore by adding new
/// extents to the datastore.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The datastore whose capacity should be increased.
///
/// Refers instance of *Datastore*.
///
/// ### spec
/// The specification describing what extents to add to a
/// VMFS datastore.
///
/// ## Returns:
///
/// The extended datastore.
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***NotFound***: if a datastore with the name could not be found.
///
/// ***NotSupported***: if the host is not an ESX Server.
///
/// ***HostConfigFault***: if unable to extend the VMFS volume.
pub async fn extend_vmfs_datastore(&self, datastore: &crate::types::structs::ManagedObjectReference, spec: &crate::types::structs::VmfsDatastoreExtendSpec) -> Result<crate::types::structs::ManagedObjectReference> {
let input = ExtendVmfsDatastoreRequestType {datastore, spec, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "ExtendVmfsDatastore", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Query to list disks that can be used to contain VMFS datastore extents.
///
/// If the optional parameter name is supplied, queries for disks that can be
/// used to contain extents for a VMFS datastore identified by the supplied
/// name. Otherwise, the method retrieves disks that can be used to contain
/// new VMFS datastores.
///
/// This operation will filter out disks that are currently in use by an
/// existing VMFS unless the VMFS using the disk is one being extended.
/// It will also filter out management LUNs and disks that are referenced by
/// RDMs. These disk LUNs are also unsuited for use by a VMFS.
///
/// Disk LUNs referenced by RDMs are found by examining all virtual machines
/// known to the system and visiting their virtual disk backends. If a
/// virtual disk backend uses an RDM that is referencing a disk LUN, the disk
/// LUN becomes ineligible for use by a VMFS datastore.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The managed object reference of the VMFS datastore
/// you want extents for.
///
/// Refers instance of *Datastore*.
///
/// ## Returns:
///
/// An array of data objects describing SCSI disks.
///
/// ## Errors:
///
/// ***NotSupported***: if the host is not an ESX Server.
///
/// ***NotFound***: if the named VMFS datastore is not found.
///
/// ***InvalidArgument***: if named VMFS datastore is not a VMFS datastore.
///
/// ***HostConfigFault***: if unable to query disk information.
pub async fn query_available_disks_for_vmfs(&self, datastore: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::HostScsiDisk>>> {
let input = QueryAvailableDisksForVmfsRequestType {datastore, };
let bytes_opt = self.client.invoke_optional("", "HostDatastoreSystem", &self.mo_id, "QueryAvailableDisksForVmfs", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Query max queue depth for a specified NFS datastore.
///
/// ***Since:*** vSphere API Release 8.0.0.1
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The NFS datastore which need to query max queue depth
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***NotFound***: if the datastore could not be found.
pub async fn query_max_queue_depth(&self, datastore: &crate::types::structs::ManagedObjectReference) -> Result<i64> {
let input = QueryMaxQueueDepthRequestType {datastore, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "QueryMaxQueueDepth", Some(&input)).await?;
let result: i64 = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Get the list of unbound VMFS volumes.
///
/// For sharing a volume across hosts, a VMFS volume is bound to its
/// underlying block device storage. When a low level block copy is
/// performed to copy or move the VMFS volume, the copied volume will
/// be unbound.
///
/// ***Required privileges:*** System.Read
///
/// ## Returns:
///
/// An array of unbound VMFS datastore
pub async fn query_unresolved_vmfs_volumes(&self) -> Result<Option<Vec<crate::types::structs::HostUnresolvedVmfsVolume>>> {
let bytes_opt = self.client.invoke_optional("", "HostDatastoreSystem", &self.mo_id, "QueryUnresolvedVmfsVolumes", None).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Queries options for creating a new VMFS datastore for a disk.
///
/// See also *HostScsiDisk.devicePath*.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### device_path
/// The devicePath of the disk on which datastore creation
/// options are generated.
///
/// ### vmfs_major_version
/// major version of VMFS to be used for
/// formatting the datastore. If this
/// parameter is not specified, then the highest
/// *supported VMFS major version* for the host
/// is used.
///
/// ## Returns:
///
/// An array of VMFS datastore provisioning options that can be
/// applied on a disk.
///
/// ## Errors:
///
/// ***NotSupported***: if the host is not an ESX Server.
///
/// ***NotFound***: if the device is not found.
///
/// ***HostConfigFault***: if unable to get the current partition information for
/// the device.
pub async fn query_vmfs_datastore_create_options(&self, device_path: &str, vmfs_major_version: Option<i32>) -> Result<Option<Vec<crate::types::structs::VmfsDatastoreOption>>> {
let input = QueryVmfsDatastoreCreateOptionsRequestType {device_path, vmfs_major_version, };
let bytes_opt = self.client.invoke_optional("", "HostDatastoreSystem", &self.mo_id, "QueryVmfsDatastoreCreateOptions", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Queries for options for increasing the capacity of an existing VMFS
/// datastore by expanding (increasing the size of) an existing extent of
/// the datastore.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The datastore to be expanded.
///
/// Refers instance of *Datastore*.
///
/// ## Returns:
///
/// An array of VMFS datastore expansion options that can be applied.
///
/// ## Errors:
///
/// ***NotFound***: if the specified datastore could not be found or is unmounted.
///
/// ***HostConfigFault***: if unable to get partition information for the
/// devices on which the extents reside
///
/// ***NotSupported***: if the host is not an ESX Server.
pub async fn query_vmfs_datastore_expand_options(&self, datastore: &crate::types::structs::ManagedObjectReference) -> Result<Option<Vec<crate::types::structs::VmfsDatastoreOption>>> {
let input = QueryVmfsDatastoreExpandOptionsRequestType {datastore, };
let bytes_opt = self.client.invoke_optional("", "HostDatastoreSystem", &self.mo_id, "QueryVmfsDatastoreExpandOptions", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Queries for options for increasing the capacity of an existing VMFS
/// datastore by adding new extents using space from the specified disk.
///
/// See also *HostScsiDisk.devicePath*.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The datastore to be extended.
///
/// Refers instance of *Datastore*.
///
/// ### device_path
/// The devicePath of the disk on which datastore extension
/// options are generated.
///
/// ### suppress_expand_candidates
/// Indicates whether to exclude options that can be
/// used for extent expansion also.
/// Free space can be used for adding an extent or expanding an existing
/// extent. If this parameter is set to true, the list of options
/// returned will not include free space that can be used for expansion.
///
/// ## Returns:
///
/// An array of VMFS datastore provisioning options that can be applied
/// on a disk.
///
/// ## Errors:
///
/// ***NotFound***: if a datastore or device with the given name could not be found
/// or if the datastore is unmounted.
///
/// ***HostConfigFault***: if unable to get the current partition information for
/// the device.
///
/// ***NotSupported***: if the host is not an ESX Server.
pub async fn query_vmfs_datastore_extend_options(&self, datastore: &crate::types::structs::ManagedObjectReference, device_path: &str, suppress_expand_candidates: Option<bool>) -> Result<Option<Vec<crate::types::structs::VmfsDatastoreOption>>> {
let input = QueryVmfsDatastoreExtendOptionsRequestType {datastore, device_path, suppress_expand_candidates, };
let bytes_opt = self.client.invoke_optional("", "HostDatastoreSystem", &self.mo_id, "QueryVmfsDatastoreExtendOptions", Some(&input)).await?;
match bytes_opt {
Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
None => Ok(None),
}
}
/// Removes a datastore from a host.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The datastore to be removed.
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***NotFound***: if the datastore could not be found.
///
/// ***HostConfigFault***: if unable to umount the NAS volume for NAS
/// datastore, or gather the existing volume information.
///
/// ***ResourceInUse***: for a VMFS volume if there is any VM registered
/// on any host attached to this datastore.
///
/// ***ResourceInUse***: for a NFS volume if there is any VM residing on
/// this datastore and registered on this host.
pub async fn remove_datastore(&self, datastore: &crate::types::structs::ManagedObjectReference) -> Result<()> {
let input = RemoveDatastoreRequestType {datastore, };
self.client.invoke_void("", "HostDatastoreSystem", &self.mo_id, "RemoveDatastore", Some(&input)).await
}
/// Remove one or more datastores.
///
/// This is an asynchronous, batch operation of
/// removeDatastore. Please see *HostDatastoreSystem.RemoveDatastore*
/// for operational details.
/// Note: This API currently supports removal of only NFS datastores.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// each element specifies one datastore to be removed.
///
/// Refers instances of *Datastore*.
///
/// ## Returns:
///
/// Refers instance of *Task*.
///
/// ## Errors:
///
/// ***HostConfigFault***: for host configuration failures.
pub async fn remove_datastore_ex_task(&self, datastore: &[crate::types::structs::ManagedObjectReference]) -> Result<crate::types::structs::ManagedObjectReference> {
let input = RemoveDatastoreExRequestType {datastore, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "RemoveDatastoreEx_Task", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Resignature an unbound VMFS volume.
///
/// To safely enable sharing of the volume across hosts, a VMFS volume
/// is bound to its underlying block device storage. When a low level
/// block copy is performed to copy or move the VMFS volume, the copied
/// volume will be unbound. In order for the VMFS volume to be usable,
/// a resolution operation is needed to determine whether the VMFS volume
/// should be treated as a new volume or not and what extents compose
/// that volume in the event there is more than one unbound volume.
///
/// With 'Resignature' operation, a new Vmfs Uuid is assigned to the
/// volume but its contents are kept intact. Resignature results in a
/// new Vmfs volume on the host. Users can specify a list of hosts on which
/// the volume will be auto-mounted.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### resolution_spec
/// A data object that describes what the disk
/// extents to be used for creating the new
/// VMFS volume.
///
/// ## Returns:
///
/// This method returns a *Task* object with which to monitor
/// the operation. The task result
/// (*Task.info*.*TaskInfo.result*) contains a
/// *HostResignatureRescanResult* object that identifies
/// the newly created VMFS datastore.
///
/// Refers instance of *Task*.
///
/// ## Errors:
///
/// ***VmfsAmbiguousMount***: when ESX is unable to resolve the extents
/// of a VMFS volume unambiguously. This is thrown only when
/// a VMFS volume has multiple extents and multiple copies of
/// non-head extents are detected, and the user has not
/// specified one copy of every extent. Please note that some
/// versions of ESX may not support resolving the situation
/// where multiple copies of non-head extents are detected,
/// even if one copy of every extent is specified in the
/// method parameter. To resolve such a situation, the user
/// is expected to change the configuration (for example,
/// using array management tools) so that only one copy of
/// each non-head extent is presented to ESX.
///
/// ***HostConfigFault***: for all other configuration failures.
pub async fn resignature_unresolved_vmfs_volume_task(&self, resolution_spec: &crate::types::structs::HostUnresolvedVmfsResignatureSpec) -> Result<crate::types::structs::ManagedObjectReference> {
let input = ResignatureUnresolvedVmfsVolumeRequestType {resolution_spec, };
let bytes = self.client.invoke("", "HostDatastoreSystem", &self.mo_id, "ResignatureUnresolvedVmfsVolume_Task", Some(&input)).await?;
let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
Ok(result)
}
/// Set max queue depth for a specified NFS datastore.
///
/// ***Since:*** vSphere API Release 8.0.0.1
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The NFS datastore which need to set max queue depth
///
/// Refers instance of *Datastore*.
///
/// ### max_qdepth
/// Max queue depth value for a datastore
///
/// ## Errors:
///
/// ***NotFound***: if the datastore could not be found.
///
/// ***InvalidArgument***: if max queue depth is not within range.
pub async fn set_max_queue_depth(&self, datastore: &crate::types::structs::ManagedObjectReference, max_qdepth: i64) -> Result<()> {
let input = SetMaxQueueDepthRequestType {datastore, max_qdepth, };
self.client.invoke_void("", "HostDatastoreSystem", &self.mo_id, "SetMaxQueueDepth", Some(&input)).await
}
/// Choose the
/// *localSwapDatastore*
/// for this host.
///
/// Any change to this setting will affect virtual machines
/// that subsequently power on or resume from a suspended state at this host,
/// or that migrate to this host while powered on; virtual machines that are
/// currently powered on at this host will not yet be affected.
///
/// ***Required privileges:*** Host.Config.Storage
///
/// ## Parameters:
///
/// ### datastore
/// The selected datastore. If this argument is unset, then
/// the *localSwapDatastore*
/// property becomes unset. Otherwise, the host must have read/write
/// access to the indicated datastore.
///
/// Refers instance of *Datastore*.
///
/// ## Errors:
///
/// ***NotSupported***: if the datastore argument is set and the
/// *localSwapDatastoreSupported*
/// capability is not true for the host.
///
/// ***InaccessibleDatastore***: if the datastore argument is set and
/// the host cannot access the indicated datastore.
///
/// ***DatastoreNotWritableOnHost***: if the datastore argument is set and
/// the host cannot write to the indicated datastore.
pub async fn update_local_swap_datastore(&self, datastore: Option<&crate::types::structs::ManagedObjectReference>) -> Result<()> {
let input = UpdateLocalSwapDatastoreRequestType {datastore, };
self.client.invoke_void("", "HostDatastoreSystem", &self.mo_id, "UpdateLocalSwapDatastore", Some(&input)).await
}
/// Capability vector indicating the available product features.
pub async fn capabilities(&self) -> Result<crate::types::structs::HostDatastoreSystemCapabilities> {
let pv_opt = self.client.fetch_property_raw("", "HostDatastoreSystem", &self.mo_id, "capabilities").await?;
let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property capabilities was empty".to_string()))?;
let result: crate::types::structs::HostDatastoreSystemCapabilities = crate::core::client::extract_property(pv)?;
Ok(result)
}
/// List of datastores on this host.
///
/// ***Required privileges:*** System.View
///
/// ## Returns:
///
/// Refers instances of *Datastore*.
pub async fn datastore(&self) -> Result<Option<Vec<crate::types::structs::ManagedObjectReference>>> {
let pv_opt = self.client.fetch_property_raw("", "HostDatastoreSystem", &self.mo_id, "datastore").await?;
match pv_opt {
Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
None => Ok(None),
}
}
}
struct ConfigureDatastorePrincipalRequestType<'a> {
user_name: &'a str,
password: Option<&'a str>,
}
impl<'a> miniserde::Serialize for ConfigureDatastorePrincipalRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(ConfigureDatastorePrincipalRequestTypeSer { data: self, seq: 0 }))
}
}
struct ConfigureDatastorePrincipalRequestTypeSer<'b, 'a> {
data: &'b ConfigureDatastorePrincipalRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for ConfigureDatastorePrincipalRequestTypeSer<'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"), &"ConfigureDatastorePrincipalRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("userName"), &self.data.user_name as &dyn miniserde::Serialize)),
2 => {
let Some(ref val) = self.data.password else { continue; };
return Some((std::borrow::Cow::Borrowed("password"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct CreateLocalDatastoreRequestType<'a> {
name: &'a str,
path: &'a str,
}
impl<'a> miniserde::Serialize for CreateLocalDatastoreRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(CreateLocalDatastoreRequestTypeSer { data: self, seq: 0 }))
}
}
struct CreateLocalDatastoreRequestTypeSer<'b, 'a> {
data: &'b CreateLocalDatastoreRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for CreateLocalDatastoreRequestTypeSer<'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"), &"CreateLocalDatastoreRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("name"), &self.data.name as &dyn miniserde::Serialize)),
2 => return Some((std::borrow::Cow::Borrowed("path"), &self.data.path as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct CreateNasDatastoreRequestType<'a> {
spec: &'a crate::types::structs::HostNasVolumeSpec,
}
impl<'a> miniserde::Serialize for CreateNasDatastoreRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(CreateNasDatastoreRequestTypeSer { data: self, seq: 0 }))
}
}
struct CreateNasDatastoreRequestTypeSer<'b, 'a> {
data: &'b CreateNasDatastoreRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for CreateNasDatastoreRequestTypeSer<'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"), &"CreateNasDatastoreRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct CreateVmfsDatastoreRequestType<'a> {
spec: &'a crate::types::structs::VmfsDatastoreCreateSpec,
}
impl<'a> miniserde::Serialize for CreateVmfsDatastoreRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(CreateVmfsDatastoreRequestTypeSer { data: self, seq: 0 }))
}
}
struct CreateVmfsDatastoreRequestTypeSer<'b, 'a> {
data: &'b CreateVmfsDatastoreRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for CreateVmfsDatastoreRequestTypeSer<'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"), &"CreateVmfsDatastoreRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct CreateVvolDatastoreRequestType<'a> {
spec: &'a crate::types::structs::HostDatastoreSystemVvolDatastoreSpec,
}
impl<'a> miniserde::Serialize for CreateVvolDatastoreRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(CreateVvolDatastoreRequestTypeSer { data: self, seq: 0 }))
}
}
struct CreateVvolDatastoreRequestTypeSer<'b, 'a> {
data: &'b CreateVvolDatastoreRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for CreateVvolDatastoreRequestTypeSer<'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"), &"CreateVvolDatastoreRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct DisableClusteredVmdkSupportRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for DisableClusteredVmdkSupportRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(DisableClusteredVmdkSupportRequestTypeSer { data: self, seq: 0 }))
}
}
struct DisableClusteredVmdkSupportRequestTypeSer<'b, 'a> {
data: &'b DisableClusteredVmdkSupportRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for DisableClusteredVmdkSupportRequestTypeSer<'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"), &"DisableClusteredVmdkSupportRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct EnableClusteredVmdkSupportRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for EnableClusteredVmdkSupportRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(EnableClusteredVmdkSupportRequestTypeSer { data: self, seq: 0 }))
}
}
struct EnableClusteredVmdkSupportRequestTypeSer<'b, 'a> {
data: &'b EnableClusteredVmdkSupportRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for EnableClusteredVmdkSupportRequestTypeSer<'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"), &"EnableClusteredVmdkSupportRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct ExpandVmfsDatastoreRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
spec: &'a crate::types::structs::VmfsDatastoreExpandSpec,
}
impl<'a> miniserde::Serialize for ExpandVmfsDatastoreRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(ExpandVmfsDatastoreRequestTypeSer { data: self, seq: 0 }))
}
}
struct ExpandVmfsDatastoreRequestTypeSer<'b, 'a> {
data: &'b ExpandVmfsDatastoreRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for ExpandVmfsDatastoreRequestTypeSer<'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"), &"ExpandVmfsDatastoreRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
2 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct ExtendVmfsDatastoreRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
spec: &'a crate::types::structs::VmfsDatastoreExtendSpec,
}
impl<'a> miniserde::Serialize for ExtendVmfsDatastoreRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(ExtendVmfsDatastoreRequestTypeSer { data: self, seq: 0 }))
}
}
struct ExtendVmfsDatastoreRequestTypeSer<'b, 'a> {
data: &'b ExtendVmfsDatastoreRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for ExtendVmfsDatastoreRequestTypeSer<'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"), &"ExtendVmfsDatastoreRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
2 => return Some((std::borrow::Cow::Borrowed("spec"), &self.data.spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct QueryAvailableDisksForVmfsRequestType<'a> {
datastore: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for QueryAvailableDisksForVmfsRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(QueryAvailableDisksForVmfsRequestTypeSer { data: self, seq: 0 }))
}
}
struct QueryAvailableDisksForVmfsRequestTypeSer<'b, 'a> {
data: &'b QueryAvailableDisksForVmfsRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for QueryAvailableDisksForVmfsRequestTypeSer<'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"), &"QueryAvailableDisksForVmfsRequestType")),
1 => {
let Some(ref val) = self.data.datastore else { continue; };
return Some((std::borrow::Cow::Borrowed("datastore"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct QueryMaxQueueDepthRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for QueryMaxQueueDepthRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(QueryMaxQueueDepthRequestTypeSer { data: self, seq: 0 }))
}
}
struct QueryMaxQueueDepthRequestTypeSer<'b, 'a> {
data: &'b QueryMaxQueueDepthRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for QueryMaxQueueDepthRequestTypeSer<'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"), &"QueryMaxQueueDepthRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct QueryVmfsDatastoreCreateOptionsRequestType<'a> {
device_path: &'a str,
vmfs_major_version: Option<i32>,
}
impl<'a> miniserde::Serialize for QueryVmfsDatastoreCreateOptionsRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(QueryVmfsDatastoreCreateOptionsRequestTypeSer { data: self, seq: 0 }))
}
}
struct QueryVmfsDatastoreCreateOptionsRequestTypeSer<'b, 'a> {
data: &'b QueryVmfsDatastoreCreateOptionsRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for QueryVmfsDatastoreCreateOptionsRequestTypeSer<'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"), &"QueryVmfsDatastoreCreateOptionsRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("devicePath"), &self.data.device_path as &dyn miniserde::Serialize)),
2 => {
let Some(ref val) = self.data.vmfs_major_version else { continue; };
return Some((std::borrow::Cow::Borrowed("vmfsMajorVersion"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct QueryVmfsDatastoreExpandOptionsRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for QueryVmfsDatastoreExpandOptionsRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(QueryVmfsDatastoreExpandOptionsRequestTypeSer { data: self, seq: 0 }))
}
}
struct QueryVmfsDatastoreExpandOptionsRequestTypeSer<'b, 'a> {
data: &'b QueryVmfsDatastoreExpandOptionsRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for QueryVmfsDatastoreExpandOptionsRequestTypeSer<'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"), &"QueryVmfsDatastoreExpandOptionsRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct QueryVmfsDatastoreExtendOptionsRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
device_path: &'a str,
suppress_expand_candidates: Option<bool>,
}
impl<'a> miniserde::Serialize for QueryVmfsDatastoreExtendOptionsRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(QueryVmfsDatastoreExtendOptionsRequestTypeSer { data: self, seq: 0 }))
}
}
struct QueryVmfsDatastoreExtendOptionsRequestTypeSer<'b, 'a> {
data: &'b QueryVmfsDatastoreExtendOptionsRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for QueryVmfsDatastoreExtendOptionsRequestTypeSer<'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"), &"QueryVmfsDatastoreExtendOptionsRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
2 => return Some((std::borrow::Cow::Borrowed("devicePath"), &self.data.device_path as &dyn miniserde::Serialize)),
3 => {
let Some(ref val) = self.data.suppress_expand_candidates else { continue; };
return Some((std::borrow::Cow::Borrowed("suppressExpandCandidates"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}
struct RemoveDatastoreRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
}
impl<'a> miniserde::Serialize for RemoveDatastoreRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(RemoveDatastoreRequestTypeSer { data: self, seq: 0 }))
}
}
struct RemoveDatastoreRequestTypeSer<'b, 'a> {
data: &'b RemoveDatastoreRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for RemoveDatastoreRequestTypeSer<'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"), &"RemoveDatastoreRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct RemoveDatastoreExRequestType<'a> {
datastore: &'a [crate::types::structs::ManagedObjectReference],
}
impl<'a> miniserde::Serialize for RemoveDatastoreExRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(RemoveDatastoreExRequestTypeSer { data: self, seq: 0 }))
}
}
struct RemoveDatastoreExRequestTypeSer<'b, 'a> {
data: &'b RemoveDatastoreExRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for RemoveDatastoreExRequestTypeSer<'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"), &"RemoveDatastoreExRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct ResignatureUnresolvedVmfsVolumeRequestType<'a> {
resolution_spec: &'a crate::types::structs::HostUnresolvedVmfsResignatureSpec,
}
impl<'a> miniserde::Serialize for ResignatureUnresolvedVmfsVolumeRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(ResignatureUnresolvedVmfsVolumeRequestTypeSer { data: self, seq: 0 }))
}
}
struct ResignatureUnresolvedVmfsVolumeRequestTypeSer<'b, 'a> {
data: &'b ResignatureUnresolvedVmfsVolumeRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for ResignatureUnresolvedVmfsVolumeRequestTypeSer<'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"), &"ResignatureUnresolvedVmfsVolumeRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("resolutionSpec"), &self.data.resolution_spec as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct SetMaxQueueDepthRequestType<'a> {
datastore: &'a crate::types::structs::ManagedObjectReference,
max_qdepth: i64,
}
impl<'a> miniserde::Serialize for SetMaxQueueDepthRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(SetMaxQueueDepthRequestTypeSer { data: self, seq: 0 }))
}
}
struct SetMaxQueueDepthRequestTypeSer<'b, 'a> {
data: &'b SetMaxQueueDepthRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for SetMaxQueueDepthRequestTypeSer<'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"), &"SetMaxQueueDepthRequestType")),
1 => return Some((std::borrow::Cow::Borrowed("datastore"), &self.data.datastore as &dyn miniserde::Serialize)),
2 => return Some((std::borrow::Cow::Borrowed("maxQdepth"), &self.data.max_qdepth as &dyn miniserde::Serialize)),
_ => return None,
}
}
}
struct UpdateLocalSwapDatastoreRequestType<'a> {
datastore: Option<&'a crate::types::structs::ManagedObjectReference>,
}
impl<'a> miniserde::Serialize for UpdateLocalSwapDatastoreRequestType<'a> {
fn begin(&self) -> miniserde::ser::Fragment<'_> {
miniserde::ser::Fragment::Map(Box::new(UpdateLocalSwapDatastoreRequestTypeSer { data: self, seq: 0 }))
}
}
struct UpdateLocalSwapDatastoreRequestTypeSer<'b, 'a> {
data: &'b UpdateLocalSwapDatastoreRequestType<'a>,
seq: usize,
}
impl<'b, 'a> miniserde::ser::Map for UpdateLocalSwapDatastoreRequestTypeSer<'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"), &"UpdateLocalSwapDatastoreRequestType")),
1 => {
let Some(ref val) = self.data.datastore else { continue; };
return Some((std::borrow::Cow::Borrowed("datastore"), val as &dyn miniserde::Serialize));
}
_ => return None,
}
}
}
}