vim_rs 0.4.4

Rust Bindings for the VMware by Broadcom vCenter VI JSON API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// The VsanSystem managed object type exposes VSAN configuration
/// primitives and serves as a host-level access point for relevant
/// VSAN data objects.
#[derive(Clone)]
pub struct HostVsanSystem {
    client: Arc<dyn VimClient>,
    mo_id: String,
}
impl HostVsanSystem {
    pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
        Self {
            client,
            mo_id: mo_id.to_string(),
        }
    }
    /// Add the set of given disks for use by the VSAN service on this host.
    /// 
    /// Users may use this API to manually add disks for use by VSAN, without
    /// specifying an explicit *VsanHostDiskMapping*, when the VSAN service
    /// not configured to automatically claim storage. Any ineligible disk in
    /// the set of given disks and disks which would have exceeded
    /// the capacity will be ignored and will not be published in
    /// returned *TaskInfo.result*.
    /// 
    /// Mount a *VsanHostDiskMapping* if the specified disk belongs to the
    /// unmounted mapping and is of type *VsanHostDiskMapping.ssd*.
    /// 
    /// Upon successful completion of the returned *Task*, its
    /// *TaskInfo.result* field will be populated with a
    /// *VsanHostDiskMapResult*\[\] and caller must inspect
    /// *VsanHostDiskMapResult*\[\] to check result for individual
    /// *VsanHostDiskMapping*.
    /// 
    /// See also *HostVsanSystem.QueryDisksForVsan*, *VsanHostConfigInfoStorageInfo.autoClaimStorage*, *VsanHostDiskMapInfo.mounted*.
    /// 
    /// ***Required privileges:*** Host.Config.Storage
    ///
    /// ## Parameters:
    ///
    /// ### disk
    /// list of disks to add for use by the VSAN service
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to
    /// monitor the operation.
    /// 
    /// Refers instance of *Task*.
    pub async fn add_disks_task(&self, disk: &[crate::types::structs::HostScsiDisk]) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = AddDisksRequestType {disk, };
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "AddDisks_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Evacuate this host from VSAN cluster.
    /// 
    /// The task is cancellable.
    /// 
    /// ***Required privileges:*** Host.Config.Storage
    ///
    /// ## Parameters:
    ///
    /// ### maintenance_spec
    /// Specifies the data evacuation mode. See *HostMaintenanceSpec*.
    /// If unspecified, the default mode chosen will be
    /// *ensureObjectAccessibility*.
    ///
    /// ### timeout
    /// Time to wait for the task to complete in seconds.
    /// If the value is less than or equal to zero, there
    /// is no timeout. The operation fails with a Timedout
    /// exception if it timed out.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: If the host is entering maintenance mode or evacuating data.
    /// 
    /// ***RequestCanceled***: if the operation is canceled.
    /// 
    /// ***Timedout***: if the operation timed out.
    /// 
    /// ***VsanFault***: if operation fails with VSAN-specific error.
    pub async fn evacuate_vsan_node_task(&self, maintenance_spec: &crate::types::structs::HostMaintenanceSpec, timeout: i32) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = EvacuateVsanNodeRequestType {maintenance_spec, timeout, };
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "EvacuateVsanNode_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Initialize and use the sets of disks in the given *VsanHostDiskMapping*
    /// list for the VSAN service on this host.
    /// 
    /// Users may use this API to specify or
    /// change disk mappings when the VSAN service is not configured to
    /// automatically claim storage. For appending new non-SSDs to an existing
    /// *VsanHostDiskMapping*, users need to specify only the new non-SSDs
    /// with its *VsanHostDiskMapping.ssd*.
    /// 
    /// Mount a *VsanHostDiskMapping* if the specified
    /// *VsanHostDiskMapping* is not mounted in this host.
    /// 
    /// Upon successful completion of the returned *Task*, its
    /// *TaskInfo.result* field will be populated with a
    /// *VsanHostDiskMapResult*\[\] and caller must inspect
    /// *VsanHostDiskMapResult*\[\] to check result for individual
    /// *VsanHostDiskMapping*.
    /// 
    /// See also *HostVsanSystem.QueryDisksForVsan*, *VsanHostConfigInfoStorageInfo.autoClaimStorage*.
    /// 
    /// ***Required privileges:*** Host.Config.Storage
    ///
    /// ## Parameters:
    ///
    /// ### mapping
    /// list of disk mappings to initialize
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to
    /// monitor the operation.
    /// 
    /// Refers instance of *Task*.
    pub async fn initialize_disks_task(&self, mapping: &[crate::types::structs::VsanHostDiskMapping]) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = InitializeDisksRequestType {mapping, };
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "InitializeDisks_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Queries disks on this host for suitability to use with the VSAN service,
    /// and returns the result.
    /// 
    /// See also *ScsiLun.canonicalName*.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### canonical_name
    /// may be set to restrict the query to the list of
    /// *HostScsiDisk* objects named by the
    /// given paths
    ///
    /// ## Returns:
    ///
    /// a list of populated *VsanHostDiskResult* entries
    pub async fn query_disks_for_vsan(&self, canonical_name: Option<&[String]>) -> Result<Option<Vec<Box<dyn crate::types::traits::VsanHostDiskResultTrait>>>> {
        let input = QueryDisksForVsanRequestType {canonical_name, };
        let bytes_opt = self.client.invoke_optional("vsan", "HostVsanSystem", &self.mo_id, "QueryDisksForVsan", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Queries this host's current runtime status for the VSAN service.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Returns:
    ///
    /// a populated *VsanHostClusterStatus* entry
    pub async fn query_host_status(&self) -> Result<crate::types::structs::VsanHostClusterStatus> {
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "QueryHostStatus", None).await?;
        let result: crate::types::structs::VsanHostClusterStatus = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Recommission this host to VSAN cluster.
    /// 
    /// Users may use this API to recommission a node that has been
    /// evacuated in *VsanHostDecommissionMode*.
    /// 
    /// See also *HostVsanSystem.EvacuateVsanNode_Task*, *VsanHostDecommissionMode*.
    /// 
    /// ***Required privileges:*** Host.Config.Storage
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: if the host is not evacuated.
    /// 
    /// ***VsanFault***: if operation fails with VSAN-specific error.
    pub async fn recommission_vsan_node_task(&self) -> Result<crate::types::structs::ManagedObjectReference> {
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "RecommissionVsanNode_Task", None).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Remove the set of given disks from use by the VSAN service on this host.
    /// 
    /// Users
    /// may use this API to manually remove a *VsanHostDiskMapping.nonSsd*
    /// from a *VsanHostDiskMapping*. This operation is only permitted if the
    /// VSAN service on this host is not configured to automatically claim storage.
    /// 
    /// The task is cancellable.
    /// 
    /// This method may not be used to remove the last
    /// *VsanHostDiskMapping.nonSsd* from any given
    /// *VsanHostDiskMapping*. Removal of the last
    /// *VsanHostDiskMapping.nonSsd* can be accomplished by using
    /// *HostVsanSystem.RemoveDiskMapping_Task*.
    /// 
    /// Upon successful completion of the returned *Task*, its
    /// *TaskInfo.result* field will be populated with a
    /// *VsanHostDiskResult*\[\]. Sets DiskIsLastRemainingNonSSD fault
    /// in returned task if specified disk is the last
    /// *VsanHostDiskMapping.nonSsd* member of
    /// *VsanHostDiskMapping*.
    /// 
    /// See also *HostVsanSystem.RemoveDiskMapping_Task*, *HostVsanSystem.UpdateVsan_Task*, *VsanHostConfigInfoStorageInfo.autoClaimStorage*.
    /// 
    /// ***Required privileges:*** Host.Config.Storage
    ///
    /// ## Parameters:
    ///
    /// ### disk
    /// list of disks to be removed from use by the VSAN service.
    ///
    /// ### maintenance_spec
    /// Any additional actions to move data out of the disk
    /// before removing it. See *HostMaintenanceSpec*.
    /// If unspecified, there is no action taken to move
    /// data from the disk.
    ///
    /// ### timeout
    /// Time to wait for the task to complete in seconds.
    /// If the value is less than or equal to zero, there
    /// is no timeout. The operation fails with a Timedout
    /// exception if it timed out.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to
    /// monitor the operation.
    /// 
    /// Refers instance of *Task*.
    pub async fn remove_disk_task(&self, disk: &[crate::types::structs::HostScsiDisk], maintenance_spec: Option<&crate::types::structs::HostMaintenanceSpec>, timeout: Option<i32>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = RemoveDiskRequestType {disk, maintenance_spec, timeout, };
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "RemoveDisk_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Delete given set of disk mappings from use by the VSAN service on this host.
    /// 
    /// This API may be used to remove all disks in a given mapping, including its
    /// *VsanHostDiskMapping.ssd*. This operation is only permitted
    /// if the VSAN service on this host is not configured to automatically
    /// claim storage.
    /// 
    /// The task is cancellable.
    /// 
    /// Upon successful completion of the returned *Task*, its
    /// *TaskInfo.result* field will be populated with an empty
    /// *VsanHostDiskMapResult*\[\]. If any errors are encountered,
    /// the returned field will instead contain populated error information.
    /// 
    /// See also *HostVsanSystem.RemoveDisk_Task*, *HostVsanSystem.UpdateVsan_Task*, *VsanHostConfigInfoStorageInfo.autoClaimStorage*.
    /// 
    /// ***Required privileges:*** Host.Config.Storage
    ///
    /// ## Parameters:
    ///
    /// ### mapping
    /// list of disk mappings to be removed from VSAN usage.
    ///
    /// ### maintenance_spec
    /// Any additional actions to move data out of the disk
    /// before removing it. See *HostMaintenanceSpec*.
    /// If unspecified, there is no action taken to move
    /// data from the disk.
    ///
    /// ### timeout
    /// Time to wait for the task to complete in seconds.
    /// If the value is less than or equal to zero, there
    /// is no timeout. The operation fails with a Timedout
    /// exception if it timed out.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to
    /// monitor the operation.
    /// 
    /// Refers instance of *Task*.
    pub async fn remove_disk_mapping_task(&self, mapping: &[crate::types::structs::VsanHostDiskMapping], maintenance_spec: Option<&crate::types::structs::HostMaintenanceSpec>, timeout: Option<i32>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = RemoveDiskMappingRequestType {mapping, maintenance_spec, timeout, };
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "RemoveDiskMapping_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Unmount the mounted *VsanHostDiskMapping*.
    /// 
    /// An unmounted volume cannot
    /// be used for any VSAN operations. In contrast to *HostVsanSystem.RemoveDiskMapping_Task*,
    /// this operation does not destroy or alter VSAN data on the disks.
    /// *HostVsanSystem.AddDisks_Task* and *HostVsanSystem.InitializeDisks_Task* can be used to
    /// re-mount the diskMapping.
    /// 
    /// In case of shared-SAS, where diskMappings are visible to more than one VSAN hosts,
    /// Users may use this API to manually unmount and re-mount diskMappings.
    /// 
    /// Upon successful completion of the returned *Task*, its
    /// *TaskInfo.result* field will be populated with
    /// *VsanHostDiskMapResult*\[\]. If any errors are encountered,
    /// the returned field will instead contain populated error information.
    /// 
    /// See also *HostVsanSystem.RemoveDiskMapping_Task*, *HostVsanSystem.AddDisks_Task*, *HostVsanSystem.InitializeDisks_Task*.
    /// 
    /// ***Required privileges:*** Host.Config.Storage
    ///
    /// ## Parameters:
    ///
    /// ### mapping
    /// -
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to monitor the
    /// operation.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidState***: If the *VsanHostDiskMapping* is already unmounted.
    /// 
    /// ***VsanFault***: if operation fails with VSAN-specific error.
    pub async fn unmount_disk_mapping_task(&self, mapping: &[crate::types::structs::VsanHostDiskMapping]) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = UnmountDiskMappingRequestType {mapping, };
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "UnmountDiskMapping_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Update the VSAN service on this host according to the given host
    /// configuration specification.
    /// 
    /// Enabling and disabling the VSAN service can be achieved by using
    /// the *VsanHostConfigInfo.enabled* flag.
    /// Host storage settings can be specified through use of
    /// *VsanHostConfigInfo.storageInfo*. If this value is omitted,
    /// changes will not be made to the existing storage configuration.
    /// Host cluster settings can be specified through use of
    /// *VsanHostConfigInfo.clusterInfo*. If this value is omitted,
    /// changes will not be made to the existing cluster configuration.
    /// Host network settings can be specified through use of
    /// *VsanHostConfigInfo.networkInfo*. If this value is omitted,
    /// changes will not be made to the existing network configuration.
    /// 
    /// See also *VsanHostConfigInfo*, *VsanHostConfigInfo.storageInfo*, *VsanHostConfigInfo.clusterInfo*, *VsanHostConfigInfo.networkInfo*, *HostVsanSystem.QueryDisksForVsan*.
    /// 
    /// ***Required privileges:*** Host.Config.Storage
    ///
    /// ## Parameters:
    ///
    /// ### config
    /// host configuration settings to use for the VSAN service.
    ///
    /// ## Returns:
    ///
    /// This method returns a *Task* object with which to
    /// monitor the operation.
    /// 
    /// Refers instance of *Task*.
    pub async fn update_vsan_task(&self, config: &dyn crate::types::traits::VsanHostConfigInfoTrait) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = UpdateVsanRequestType {config, };
        let bytes = self.client.invoke("vsan", "HostVsanSystem", &self.mo_id, "UpdateVsan_Task", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// The current VSAN service configuration information for this host.
    /// 
    /// ***Required privileges:*** System.Read
    pub async fn config(&self) -> Result<Box<dyn crate::types::traits::VsanHostConfigInfoTrait>> {
        let pv_opt = self.client.fetch_property_raw("vsan", "HostVsanSystem", &self.mo_id, "config").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property config was empty".to_string()))?;
        let result: Box<dyn crate::types::traits::VsanHostConfigInfoTrait> = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
}
struct AddDisksRequestType<'a> {
    disk: &'a [crate::types::structs::HostScsiDisk],
}

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

struct AddDisksRequestTypeSer<'b, 'a> {
    data: &'b AddDisksRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for AddDisksRequestTypeSer<'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"), &"AddDisksRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("disk"), &self.data.disk as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct EvacuateVsanNodeRequestType<'a> {
    maintenance_spec: &'a crate::types::structs::HostMaintenanceSpec,
    timeout: i32,
}

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

struct EvacuateVsanNodeRequestTypeSer<'b, 'a> {
    data: &'b EvacuateVsanNodeRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for EvacuateVsanNodeRequestTypeSer<'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"), &"EvacuateVsanNodeRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("maintenanceSpec"), &self.data.maintenance_spec as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("timeout"), &self.data.timeout as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct InitializeDisksRequestType<'a> {
    mapping: &'a [crate::types::structs::VsanHostDiskMapping],
}

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

struct InitializeDisksRequestTypeSer<'b, 'a> {
    data: &'b InitializeDisksRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for InitializeDisksRequestTypeSer<'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"), &"InitializeDisksRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("mapping"), &self.data.mapping as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct QueryDisksForVsanRequestType<'a> {
    canonical_name: Option<&'a [String]>,
}

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

struct QueryDisksForVsanRequestTypeSer<'b, 'a> {
    data: &'b QueryDisksForVsanRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for QueryDisksForVsanRequestTypeSer<'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"), &"QueryDisksForVsanRequestType")),
                1 => {
                    let Some(ref val) = self.data.canonical_name else { continue; };
                    return Some((std::borrow::Cow::Borrowed("canonicalName"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct RemoveDiskRequestType<'a> {
    disk: &'a [crate::types::structs::HostScsiDisk],
    maintenance_spec: Option<&'a crate::types::structs::HostMaintenanceSpec>,
    timeout: Option<i32>,
}

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

struct RemoveDiskRequestTypeSer<'b, 'a> {
    data: &'b RemoveDiskRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RemoveDiskRequestTypeSer<'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"), &"RemoveDiskRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("disk"), &self.data.disk as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.maintenance_spec else { continue; };
                    return Some((std::borrow::Cow::Borrowed("maintenanceSpec"), val as &dyn miniserde::Serialize));
                }
                3 => {
                    let Some(ref val) = self.data.timeout else { continue; };
                    return Some((std::borrow::Cow::Borrowed("timeout"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct RemoveDiskMappingRequestType<'a> {
    mapping: &'a [crate::types::structs::VsanHostDiskMapping],
    maintenance_spec: Option<&'a crate::types::structs::HostMaintenanceSpec>,
    timeout: Option<i32>,
}

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

struct RemoveDiskMappingRequestTypeSer<'b, 'a> {
    data: &'b RemoveDiskMappingRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RemoveDiskMappingRequestTypeSer<'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"), &"RemoveDiskMappingRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("mapping"), &self.data.mapping as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.maintenance_spec else { continue; };
                    return Some((std::borrow::Cow::Borrowed("maintenanceSpec"), val as &dyn miniserde::Serialize));
                }
                3 => {
                    let Some(ref val) = self.data.timeout else { continue; };
                    return Some((std::borrow::Cow::Borrowed("timeout"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct UnmountDiskMappingRequestType<'a> {
    mapping: &'a [crate::types::structs::VsanHostDiskMapping],
}

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

struct UnmountDiskMappingRequestTypeSer<'b, 'a> {
    data: &'b UnmountDiskMappingRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for UnmountDiskMappingRequestTypeSer<'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"), &"UnmountDiskMappingRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("mapping"), &self.data.mapping as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct UpdateVsanRequestType<'a> {
    config: &'a dyn crate::types::traits::VsanHostConfigInfoTrait,
}

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

struct UpdateVsanRequestTypeSer<'b, 'a> {
    data: &'b UpdateVsanRequestType<'a>,
    seq: usize,
}

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