vim_rs 0.4.4

Rust Bindings for the VMware by Broadcom vCenter VI JSON API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// This managed object provides the diagnostics service that operates at cluster
/// level.
/// 
/// It runs the periodical diagnostics on the vSAN related statistics, as
/// well as the on-demand diagnostics operation, e.g., the diagnostics of the
/// IOs for a certain virtual machine.
/// The ManagedEntity can be accessed with MOID of
/// 'vsan-cluster-diagnostics-system' through vSAN service at at vCenter side.
#[derive(Clone)]
pub struct VsanDiagnosticsSystem {
    client: Arc<dyn VimClient>,
    mo_id: String,
}
impl VsanDiagnosticsSystem {
    pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
        Self {
            client,
            mo_id: mo_id.to_string(),
        }
    }
    /// Schedule a set of IO trip analyzer recurrences.
    /// 
    /// Currently only 1 recurrence supported for each vSAN cluster.
    /// 
    /// ***Required privileges:*** Global.Diagnostics
    ///
    /// ## Parameters:
    ///
    /// ### cluster
    /// The cluster on which the IO trip analyzer scheduler is
    /// configured.
    /// 
    /// Refers instance of *ComputeResource*.
    ///
    /// ### recurrences
    /// The scheduler recurrences configurations.
    ///
    /// ## Returns:
    ///
    /// The list of recurrences that are configured successfully. If the
    /// name of the recurrence is not given, it will fill the name with
    /// automatically generated name and return it in the list.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: if the recurrence(s) setting(s) are not valid.
    /// 
    /// ***AlreadyExists***: if the recurrence(s) name(s) already exists.
    /// 
    /// ***VsanFault***: if internal vSAN error hit.
    pub async fn create_io_trip_analyzer_recurrences(&self, cluster: &crate::types::structs::ManagedObjectReference, recurrences: &[crate::types::structs::VsanIoTripAnalyzerRecurrence]) -> Result<Vec<crate::types::structs::VsanIoTripAnalyzerRecurrence>> {
        let input = CreateIoTripAnalyzerRecurrencesRequestType {cluster, recurrences, };
        let bytes = self.client.invoke("vsan", "VsanDiagnosticsSystem", &self.mo_id, "CreateIOTripAnalyzerRecurrences", Some(&input)).await?;
        let result: Vec<crate::types::structs::VsanIoTripAnalyzerRecurrence> = crate::core::client::unmarshal_array(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Edit the IO trip analyzer recurrences with the given configuration.
    /// 
    /// The name of the recurrence is used to find the recurrence to be updated. It
    /// must be provided when editing.
    /// 
    /// ***Required privileges:*** Global.Diagnostics
    ///
    /// ## Parameters:
    ///
    /// ### cluster
    /// The cluster on which the IO trip analyzer scheduler is
    /// configured.
    /// 
    /// Refers instance of *ComputeResource*.
    ///
    /// ### recurrences
    /// The updated recurrence(s) configuration.
    ///
    /// ## Returns:
    ///
    /// The list of recurrence(s) that are edited successfully.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: if the recurrence(s) setting(s) are not valid.
    /// 
    /// ***NotFound***: if the recurrence(s) name(s) not found.
    /// 
    /// ***VsanFault***: if internal vSAN error hit.
    pub async fn edit_io_trip_analyzer_recurrences(&self, cluster: &crate::types::structs::ManagedObjectReference, recurrences: &[crate::types::structs::VsanIoTripAnalyzerRecurrence]) -> Result<Vec<crate::types::structs::VsanIoTripAnalyzerRecurrence>> {
        let input = EditIoTripAnalyzerRecurrencesRequestType {cluster, recurrences, };
        let bytes = self.client.invoke("vsan", "VsanDiagnosticsSystem", &self.mo_id, "EditIOTripAnalyzerRecurrences", Some(&input)).await?;
        let result: Vec<crate::types::structs::VsanIoTripAnalyzerRecurrence> = crate::core::client::unmarshal_array(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Get the IO trip analyzer scheduler configurations for the given cluster.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### cluster
    /// The cluster on which the IO trip analyzer scheduler is
    /// configured.
    /// 
    /// Refers instance of *ComputeResource*.
    ///
    /// ## Returns:
    ///
    /// The IO trip analyzer scheduler configuration.
    ///
    /// ## Errors:
    ///
    /// ***VsanFault***: if internal vSAN error hit.
    pub async fn get_io_trip_analyzer_scheduler_config(&self, cluster: &crate::types::structs::ManagedObjectReference) -> Result<Option<crate::types::structs::VsanIoTripAnalyzerConfig>> {
        let input = GetIoTripAnalyzerSchedulerConfigRequestType {cluster, };
        let bytes_opt = self.client.invoke_optional("vsan", "VsanDiagnosticsSystem", &self.mo_id, "GetIOTripAnalyzerSchedulerConfig", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Get the threshold.
    /// 
    /// If "entityType" is not set, all threshold settings will be returned;
    /// If "entityType" is set but "metric" is not set, threshold settings for the
    /// specified "entityType" will be returned; If threshold settings doesn't exist
    /// for "entityType", empty result (\[\]) will be returned;
    /// If both "entityType" and "metric" are set, threshold settings for the
    /// specified "entityType" and "metric" will be returned; If threshold settings
    /// doesn't exist for either "entityType" or "metric", empty result (\[\]) will be
    /// returned.
    /// If "metric" is set but "entityType" is not set, "metric" will be ignored and
    /// all threshold settings will be returned.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### cluster
    /// The cluster where the threshold is to get from
    /// 
    /// Refers instance of *ComputeResource*.
    ///
    /// ### entity_type
    /// Get threshold only for the specified entity type.
    ///
    /// ### metric
    /// Get threshold only for the specified metric, "entityType" must
    /// also be set if "metric" is set.
    ///
    /// ## Returns:
    ///
    /// vim.cluster.VsanDiagnosticsThreshold\[\]
    ///
    /// ## Errors:
    ///
    /// Failure
    pub async fn vsan_get_thresholds(&self, cluster: &crate::types::structs::ManagedObjectReference, entity_type: Option<&str>, metric: Option<&str>) -> Result<Option<Vec<crate::types::structs::VsanDiagnosticsThreshold>>> {
        let input = VsanGetThresholdsRequestType {cluster, entity_type, metric, };
        let bytes_opt = self.client.invoke_optional("vsan", "VsanDiagnosticsSystem", &self.mo_id, "VsanGetThresholds", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Query the completed diagnostics instances by the given query spec.
    ///
    /// ## Parameters:
    ///
    /// ### query_spec
    /// The spec for instance query.
    ///
    /// ### cluster
    /// The cluster where the diagnostics is performed, ignored when
    /// calling against ESXi hosts.
    /// 
    /// ***Required privileges:*** System.Read
    /// 
    /// Refers instance of *ClusterComputeResource*.
    ///
    /// ## Returns:
    ///
    /// The list of the completed diagnostics instances.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: if the query spec is not valid.
    /// 
    /// ***VsanFault***: if the caller doesn't have the required privilege or if
    /// the vSAN performance service is disabled.
    pub async fn query_io_diagnostics_instances(&self, query_spec: &crate::types::structs::VsanIoDiagnosticsInstanceQuerySpec, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::VsanIoDiagnosticsInstance>>> {
        let input = QueryIoDiagnosticsInstancesRequestType {query_spec, cluster, };
        let bytes_opt = self.client.invoke_optional("vsan", "VsanDiagnosticsSystem", &self.mo_id, "QueryIODiagnosticsInstances", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Query the IO diagnostics stats according to the given diagnostics instance
    /// name.
    ///
    /// ## Parameters:
    ///
    /// ### instance_name
    /// The completed diagnostics instance name.
    ///
    /// ### cluster
    /// The cluster where the diagnostics is performed.
    /// 
    /// ***Required privileges:*** System.Read
    /// 
    /// Refers instance of *ClusterComputeResource*.
    ///
    /// ## Returns:
    ///
    /// The diagnostics stats.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: if the given diagnostics instance name represent a
    /// running instance.
    /// 
    /// ***VsanFault***: if the caller doesn't have the required privilege or if
    /// the vSAN performance service is disabled.
    pub async fn query_io_diagnostics_stats(&self, instance_name: &str, cluster: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::VsanIoDiagnosticsTargetStats>>> {
        let input = QueryIoDiagnosticsStatsRequestType {instance_name, cluster, };
        let bytes_opt = self.client.invoke_optional("vsan", "VsanDiagnosticsSystem", &self.mo_id, "QueryIODiagnosticsStats", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Get the latest network events that triggered network alarms.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### cluster
    /// The cluster where the network diagnostics is performed.
    /// 
    /// Refers instance of *ComputeResource*.
    ///
    /// ### host
    /// Get only for the specified host.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ## Returns:
    ///
    /// vim.cluster.VsanNetworkDiagnostics\[\]
    ///
    /// ## Errors:
    ///
    /// Failure
    pub async fn vsan_query_network_diagnostics(&self, cluster: &crate::types::structs::ManagedObjectReference, host: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::VsanNetworkDiagnostics>>> {
        let input = VsanQueryNetworkDiagnosticsRequestType {cluster, host, };
        let bytes_opt = self.client.invoke_optional("vsan", "VsanDiagnosticsSystem", &self.mo_id, "VsanQueryNetworkDiagnostics", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Remove the IO trip analyzer recurrence(s) with the given name(s).
    /// 
    /// ***Required privileges:*** Global.Diagnostics
    ///
    /// ## Parameters:
    ///
    /// ### cluster
    /// The cluster on which the IO trip analyzer scheduler is
    /// configured.
    /// 
    /// Refers instance of *ComputeResource*.
    ///
    /// ### names
    /// The name(s) of the IO trip analyzer recurrence(s) to be
    /// removed.
    ///
    /// ## Errors:
    ///
    /// ***NotFound***: if the recurrence(s) name(s) not found.
    /// 
    /// ***VsanFault***: if internal vSAN error hit.
    pub async fn remove_io_trip_analyzer_recurrences(&self, cluster: &crate::types::structs::ManagedObjectReference, names: &[String]) -> Result<()> {
        let input = RemoveIoTripAnalyzerRecurrencesRequestType {cluster, names, };
        self.client.invoke_void("vsan", "VsanDiagnosticsSystem", &self.mo_id, "RemoveIOTripAnalyzerRecurrences", Some(&input)).await
    }
    /// Set the threshold.
    /// 
    /// The "entityType" and "metric" of the new threshold must be in current
    /// supported list (see *VsanDiagnosticsThreshold.entityType*),
    /// or fault "vmodl.fault.InvalidArgument" will be raised.
    /// If "yellow" or "red" value is "0" or not set in the new threshold, the
    /// existing "yellow" or "red" value of current threshold setting will keep
    /// unchanged.
    /// 
    /// ***Required privileges:*** Global.Diagnostics
    ///
    /// ## Parameters:
    ///
    /// ### cluster
    /// The cluster where the threshold is to set to
    /// 
    /// Refers instance of *ComputeResource*.
    ///
    /// ### thresholds
    /// The new threshold value to set
    ///
    /// ## Errors:
    ///
    /// Failure
    pub async fn vsan_set_thresholds(&self, cluster: &crate::types::structs::ManagedObjectReference, thresholds: Option<&[crate::types::structs::VsanDiagnosticsThreshold]>) -> Result<()> {
        let input = VsanSetThresholdsRequestType {cluster, thresholds, };
        self.client.invoke_void("vsan", "VsanDiagnosticsSystem", &self.mo_id, "VsanSetThresholds", Some(&input)).await
    }
    /// Set the policy of the vSAN namespace object that hold the vSAN trace files.
    /// 
    /// The cluster parameter is ignored if called on ESXi.
    /// Profile can be:
    /// - 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, a default profile with hostFailuresToTolerate
    /// setting will be used.
    ///
    /// ## Parameters:
    ///
    /// ### cluster
    /// vSAN cluster. Ignored if called against host.
    /// 
    /// ***Required privileges:*** Global.Settings
    /// 
    /// Refers instance of *ComputeResource*.
    ///
    /// ### trace_object_uuid
    /// -
    ///
    /// ### 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_set_trace_object_policy(&self, cluster: Option<&crate::types::structs::ManagedObjectReference>, trace_object_uuid: &str, profile: Option<&dyn crate::types::traits::VirtualMachineProfileSpecTrait>) -> Result<bool> {
        let input = VsanSetTraceObjectPolicyRequestType {cluster, trace_object_uuid, profile, };
        let bytes = self.client.invoke("vsan", "VsanDiagnosticsSystem", &self.mo_id, "VsanSetTraceObjectPolicy", Some(&input)).await?;
        let result: bool = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Start IO diagnostics task against the given targets running on vSAN datastore.
    /// 
    /// It's not supported to run multiple diagnostics tasks at the same time. You
    /// need either cancel the running task or wait until it completes before
    /// starting a new diagnostics task.
    ///
    /// ## Parameters:
    ///
    /// ### targets
    /// The targets to run the diagnostics.
    ///
    /// ### cluster
    /// The cluster where the targets belong to, ignored when calling
    /// against ESXi hosts.
    /// 
    /// ***Required privileges:*** Global.Diagnostics
    /// 
    /// Refers instance of *ClusterComputeResource*.
    ///
    /// ### duration
    /// The duration time in seconds to run diagnostics. The valid range
    /// is \[300, 3600\], default is 300.
    ///
    /// ## Returns:
    ///
    /// The task that runs the diagnostics.
    /// 
    /// Refers instance of *Task*.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: if the targets are not valid.
    /// 
    /// ***NotSupported***: if there's already a running diagnostics task.
    /// 
    /// ***VsanFault***: if the caller doesn't have the required privilege or
    /// if the pre-check tests failed.
    pub async fn start_io_diagnostics_task(&self, targets: &[crate::types::structs::VsanIoDiagnosticsTarget], cluster: Option<&crate::types::structs::ManagedObjectReference>, duration: Option<i64>) -> Result<crate::types::structs::ManagedObjectReference> {
        let input = StartIoDiagnosticsTaskRequestType {targets, cluster, duration, };
        let bytes = self.client.invoke("vsan", "VsanDiagnosticsSystem", &self.mo_id, "StartIODiagnosticsTask", Some(&input)).await?;
        let result: crate::types::structs::ManagedObjectReference = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
}
struct CreateIoTripAnalyzerRecurrencesRequestType<'a> {
    cluster: &'a crate::types::structs::ManagedObjectReference,
    recurrences: &'a [crate::types::structs::VsanIoTripAnalyzerRecurrence],
}

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

struct CreateIoTripAnalyzerRecurrencesRequestTypeSer<'b, 'a> {
    data: &'b CreateIoTripAnalyzerRecurrencesRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CreateIoTripAnalyzerRecurrencesRequestTypeSer<'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"), &"CreateIOTripAnalyzerRecurrencesRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("recurrences"), &self.data.recurrences as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct EditIoTripAnalyzerRecurrencesRequestType<'a> {
    cluster: &'a crate::types::structs::ManagedObjectReference,
    recurrences: &'a [crate::types::structs::VsanIoTripAnalyzerRecurrence],
}

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

struct EditIoTripAnalyzerRecurrencesRequestTypeSer<'b, 'a> {
    data: &'b EditIoTripAnalyzerRecurrencesRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for EditIoTripAnalyzerRecurrencesRequestTypeSer<'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"), &"EditIOTripAnalyzerRecurrencesRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("recurrences"), &self.data.recurrences as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct GetIoTripAnalyzerSchedulerConfigRequestType<'a> {
    cluster: &'a crate::types::structs::ManagedObjectReference,
}

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

struct GetIoTripAnalyzerSchedulerConfigRequestTypeSer<'b, 'a> {
    data: &'b GetIoTripAnalyzerSchedulerConfigRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for GetIoTripAnalyzerSchedulerConfigRequestTypeSer<'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"), &"GetIOTripAnalyzerSchedulerConfigRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct VsanGetThresholdsRequestType<'a> {
    cluster: &'a crate::types::structs::ManagedObjectReference,
    entity_type: Option<&'a str>,
    metric: Option<&'a str>,
}

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

struct VsanGetThresholdsRequestTypeSer<'b, 'a> {
    data: &'b VsanGetThresholdsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for VsanGetThresholdsRequestTypeSer<'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"), &"VsanGetThresholdsRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.entity_type else { continue; };
                    return Some((std::borrow::Cow::Borrowed("entityType"), val as &dyn miniserde::Serialize));
                }
                3 => {
                    let Some(ref val) = self.data.metric else { continue; };
                    return Some((std::borrow::Cow::Borrowed("metric"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct QueryIoDiagnosticsInstancesRequestType<'a> {
    query_spec: &'a crate::types::structs::VsanIoDiagnosticsInstanceQuerySpec,
    cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}

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

struct QueryIoDiagnosticsInstancesRequestTypeSer<'b, 'a> {
    data: &'b QueryIoDiagnosticsInstancesRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for QueryIoDiagnosticsInstancesRequestTypeSer<'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"), &"QueryIODiagnosticsInstancesRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("querySpec"), &self.data.query_spec 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 QueryIoDiagnosticsStatsRequestType<'a> {
    instance_name: &'a str,
    cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
}

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

struct QueryIoDiagnosticsStatsRequestTypeSer<'b, 'a> {
    data: &'b QueryIoDiagnosticsStatsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for QueryIoDiagnosticsStatsRequestTypeSer<'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"), &"QueryIODiagnosticsStatsRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("instanceName"), &self.data.instance_name 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 VsanQueryNetworkDiagnosticsRequestType<'a> {
    cluster: &'a crate::types::structs::ManagedObjectReference,
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
}

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

struct VsanQueryNetworkDiagnosticsRequestTypeSer<'b, 'a> {
    data: &'b VsanQueryNetworkDiagnosticsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for VsanQueryNetworkDiagnosticsRequestTypeSer<'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"), &"VsanQueryNetworkDiagnosticsRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct RemoveIoTripAnalyzerRecurrencesRequestType<'a> {
    cluster: &'a crate::types::structs::ManagedObjectReference,
    names: &'a [String],
}

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

struct RemoveIoTripAnalyzerRecurrencesRequestTypeSer<'b, 'a> {
    data: &'b RemoveIoTripAnalyzerRecurrencesRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RemoveIoTripAnalyzerRecurrencesRequestTypeSer<'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"), &"RemoveIOTripAnalyzerRecurrencesRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("names"), &self.data.names as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct VsanSetThresholdsRequestType<'a> {
    cluster: &'a crate::types::structs::ManagedObjectReference,
    thresholds: Option<&'a [crate::types::structs::VsanDiagnosticsThreshold]>,
}

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

struct VsanSetThresholdsRequestTypeSer<'b, 'a> {
    data: &'b VsanSetThresholdsRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for VsanSetThresholdsRequestTypeSer<'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"), &"VsanSetThresholdsRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("cluster"), &self.data.cluster as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.thresholds else { continue; };
                    return Some((std::borrow::Cow::Borrowed("thresholds"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct VsanSetTraceObjectPolicyRequestType<'a> {
    cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
    trace_object_uuid: &'a str,
    profile: Option<&'a dyn crate::types::traits::VirtualMachineProfileSpecTrait>,
}

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

struct VsanSetTraceObjectPolicyRequestTypeSer<'b, 'a> {
    data: &'b VsanSetTraceObjectPolicyRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for VsanSetTraceObjectPolicyRequestTypeSer<'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"), &"VsanSetTraceObjectPolicyRequestType")),
                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("traceObjectUuid"), &self.data.trace_object_uuid as &dyn miniserde::Serialize)),
                3 => {
                    let Some(ref val) = self.data.profile else { continue; };
                    return Some((std::borrow::Cow::Borrowed("profile"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct StartIoDiagnosticsTaskRequestType<'a> {
    targets: &'a [crate::types::structs::VsanIoDiagnosticsTarget],
    cluster: Option<&'a crate::types::structs::ManagedObjectReference>,
    duration: Option<i64>,
}

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

struct StartIoDiagnosticsTaskRequestTypeSer<'b, 'a> {
    data: &'b StartIoDiagnosticsTaskRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for StartIoDiagnosticsTaskRequestTypeSer<'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"), &"StartIODiagnosticsTaskRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("targets"), &self.data.targets 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));
                }
                3 => {
                    let Some(ref val) = self.data.duration else { continue; };
                    return Some((std::borrow::Cow::Borrowed("duration"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}