vim_rs 0.4.4

Rust Bindings for the VMware by Broadcom vCenter VI JSON API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
use std::sync::Arc;
use crate::core::client::{VimClient, Result};
/// This managed object type controls entitlements for a given VMware
/// platform.
/// 
/// VMware platforms include VirtualCenter, ESX Server, VMware Server,
/// Workstation and Player. Entitlements define what software capabilities
/// this host may use.
/// 
/// Entitlements are identified by a short string 'key'. Keys can represent either
/// a particular edition (Full, Starter) or a particular feature/function (featureKey)
/// (backup, nas). An edition implies zero one or more functions which are express,
/// denied or optional. For example a 'Full' edition includes 'iscsi' function but a
/// Starter edition might disallow it.
/// 
/// Which edition a given VMware platform uses can be defined at any time. Generally this
/// is done right after first install and boot as installation software may not set it.
/// For editions that are similar in nature, any future changes to edition
/// type will only impact future requests for functionality.
/// Current functionality is left unaffected. The same is true for optional
/// functions enabled/disabled after some period of time. For dissimilar editions,
/// such transitions may require entering maintenance mode first else an exception of
/// InvalidState will be thrown.
/// 
/// To specify the edition type and any optional functions, use updateLicense for
/// ESX Server and addLicense follow by LicenseAssingmentManager.updateAssignedLicense
/// for VirtualCenter.
/// 
/// When an edition is specified for a given host, the cost of that edition
/// (how many licenses are needed) is determined. The cost is computed
/// using the license's CostUnit value multiplied by the number of units activated.
/// For example, when a VMware platform is set to an edition which uses a 'cpuPackage'
/// on a two socket server, two licenses would be needed to successfully
/// install that edition.
/// 
/// Here is a diagram of the unit costs supported by this API and their relationships.
/// 
///        +------------------------------+   +--------+      +-------+
///        | +-----------+ +-----------+  |   | Server |      |  Host |
///        | |           | |           |  |   +--------+      +-------+
///        | |  cpuCore  | |   cpuCore |  |                   +-------+
///        | +-----------+ +-----------+  |   +--------+      |  Host |
///        |                  cpuPackage  |   |  VM    |      +-------+
///        +------------------------------+   +--------+
#[derive(Clone)]
pub struct LicenseManager {
    client: Arc<dyn VimClient>,
    mo_id: String,
}
impl LicenseManager {
    pub fn new(client: Arc<dyn VimClient>, mo_id: &str) -> Self {
        Self {
            client,
            mo_id: mo_id.to_string(),
        }
    }
    /// Adds a license to the inventory of available licenses.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### license_key
    /// A license. E.g. a serial license.
    ///
    /// ### labels
    /// array of key-value labels. Ignored by ESX Server.
    ///
    /// ## Returns:
    ///
    /// Returns information about the license specified in licenseKey.
    pub async fn add_license(&self, license_key: &str, labels: Option<&[crate::types::structs::KeyValue]>) -> Result<crate::types::structs::LicenseManagerLicenseInfo> {
        let input = AddLicenseRequestType {license_key, labels, };
        let bytes = self.client.invoke("", "LicenseManager", &self.mo_id, "AddLicense", Some(&input)).await?;
        let result: crate::types::structs::LicenseManagerLicenseInfo = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.QueryAssignedLicenses* instead.
    /// 
    /// Returns whether or not a given feature is enabled.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// Host to act on if LicenseManager is not on a host.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ### feature_key
    /// Name of the feature to enable.
    ///
    /// ## Returns:
    ///
    /// Returns true if the feature is enabled and false if it is not.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: If a feature name is not found.
    /// 
    /// ***InvalidState***: If the feature cannot be supported on the platform,
    /// potentially because the hardware configuration does not support it.
    pub async fn check_license_feature(&self, host: Option<&crate::types::structs::ManagedObjectReference>, feature_key: &str) -> Result<bool> {
        let input = CheckLicenseFeatureRequestType {host, feature_key, };
        let bytes = self.client.invoke("", "LicenseManager", &self.mo_id, "CheckLicenseFeature", Some(&input)).await?;
        let result: bool = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, use *LicenseManager.UpdateLicense*
    /// instead.
    /// 
    /// Allows for reconfiguration of the License Manager license source.
    /// 
    /// This changes the licensing source to be either served or local. Before changing
    /// the license source location, the API checks the number of licenses available at
    /// the new potential source to ensure there are at least as many licenses there as
    /// have been issued by the current source. If there are an equal or greater number of
    /// licenses at the new source, all licenses on the current source are released and
    /// then reacquired from the new source. If there are not enough licenses available on
    /// the new source to reissue all licenses, the operation fails.
    /// 
    /// This is used to configure the license source on an individual host.
    /// 
    /// **PLATFORM Specific Notes:**
    /// VirtualCenter - only supports a served source.
    /// the host parameter is mandatory.
    /// ESX Server - the host parameter is optional.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// Host for which the license manager should be reconfigured.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ### license_source
    /// ServedSource or LocalSource.
    ///
    /// ## Errors:
    ///
    /// ***LicenseServerUnavailable***: if the license server is unreachable.
    /// 
    /// ***CannotAccessLocalSource***: if the local source cannot be accessed.
    /// 
    /// ***InvalidLicense***: if the new license source is LocalLicenseSource and the
    /// license file is not valid.
    /// 
    /// ***NotEnoughLicenses***: if the new license source does not have enough licenses.
    pub async fn configure_license_source(&self, host: Option<&crate::types::structs::ManagedObjectReference>, license_source: &dyn crate::types::traits::LicenseSourceTrait) -> Result<()> {
        let input = ConfigureLicenseSourceRequestType {host, license_source, };
        self.client.invoke_void("", "LicenseManager", &self.mo_id, "ConfigureLicenseSource", Some(&input)).await
    }
    /// Decodes licensing information on the license specified.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### license_key
    /// A license. E.g. a serial license.
    ///
    /// ## Returns:
    ///
    /// Returns information about the license specified in licenseKey.
    pub async fn decode_license(&self, license_key: &str) -> Result<crate::types::structs::LicenseManagerLicenseInfo> {
        let input = DecodeLicenseRequestType {license_key, };
        let bytes = self.client.invoke("", "LicenseManager", &self.mo_id, "DecodeLicense", Some(&input)).await?;
        let result: crate::types::structs::LicenseManagerLicenseInfo = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.RemoveAssignedLicense* instead.
    /// 
    /// Release licenses for an optional feature.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// Host to act on if LicenseManager is not on a host.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ### feature_key
    /// key of the feature to disable.
    ///
    /// ## Returns:
    ///
    /// Returns true if the feature was disabled and false if not.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: If a feature name is not found or it is not optional.
    /// 
    /// ***LicenseServerUnavailable***: If the license server is unavailable.
    /// 
    /// ***InvalidState***: If the feature is in use.
    pub async fn disable_feature(&self, host: Option<&crate::types::structs::ManagedObjectReference>, feature_key: &str) -> Result<bool> {
        let input = DisableFeatureRequestType {host, feature_key, };
        let bytes = self.client.invoke("", "LicenseManager", &self.mo_id, "DisableFeature", Some(&input)).await?;
        let result: bool = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.UpdateAssignedLicense* instead.
    /// 
    /// Enable a feature that has an optional state.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// Host to act on if LicenseManager is not on a host.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ### feature_key
    /// Name of the feature to enable.
    ///
    /// ## Returns:
    ///
    /// Returns true if enabling the feature was successful, false otherwise.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: If a feature name is not found or it is not optional.
    /// 
    /// ***LicenseServerUnavailable***: If the license server is unavailable.
    /// 
    /// ***InvalidState***: If the feature cannot be supported on the platform,
    /// potentially because the hardware configuration does not support it.
    pub async fn enable_feature(&self, host: Option<&crate::types::structs::ManagedObjectReference>, feature_key: &str) -> Result<bool> {
        let input = EnableFeatureRequestType {host, feature_key, };
        let bytes = self.client.invoke("", "LicenseManager", &self.mo_id, "EnableFeature", Some(&input)).await?;
        let result: bool = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.QueryAssignedLicenses* instead.
    /// 
    /// Queries the current license source for total and available licenses available for
    /// each feature known to this system.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// Use the license source of the specified host.
    /// 
    /// Refers instance of *HostSystem*.
    pub async fn query_license_source_availability(&self, host: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::LicenseAvailabilityInfo>>> {
        let input = QueryLicenseSourceAvailabilityRequestType {host, };
        let bytes_opt = self.client.invoke_optional("", "LicenseManager", &self.mo_id, "QueryLicenseSourceAvailability", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.QueryAssignedLicenses* instead.
    /// 
    /// Queries the current license source for a list of available licenses that can be
    /// licensed from this system.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// Use the license source of the specified host.
    /// 
    /// Refers instance of *HostSystem*.
    pub async fn query_supported_features(&self, host: Option<&crate::types::structs::ManagedObjectReference>) -> Result<Option<Vec<crate::types::structs::LicenseFeatureInfo>>> {
        let input = QuerySupportedFeaturesRequestType {host, };
        let bytes_opt = self.client.invoke_optional("", "LicenseManager", &self.mo_id, "QuerySupportedFeatures", Some(&input)).await?;
        match bytes_opt {
            Some(ref b) => Ok(Some(crate::core::client::unmarshal_array(self.client.transport(), b)?)),
            None => Ok(None),
        }
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.QueryAssignedLicenses* instead.
    /// 
    /// Returns the license usage.
    /// 
    /// The license usage is a list of supported features and
    /// the number of licenses that have been reserved.
    /// 
    /// **PLATFORM Specific Notes:**
    /// VirtualCenter - Empty string returns the usage of non-host specific features.
    /// Must specify managed host to query.
    /// ESX Server - Host argument ignored.
    /// 
    /// ***Required privileges:*** System.Read
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// Host to query for usage. If missing, query the server the
    /// *LicenseManager* is on.
    /// 
    /// Refers instance of *HostSystem*.
    pub async fn query_license_usage(&self, host: Option<&crate::types::structs::ManagedObjectReference>) -> Result<crate::types::structs::LicenseUsageInfo> {
        let input = QueryLicenseUsageRequestType {host, };
        let bytes = self.client.invoke("", "LicenseManager", &self.mo_id, "QueryLicenseUsage", Some(&input)).await?;
        let result: crate::types::structs::LicenseUsageInfo = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Removed a license's label.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### license_key
    /// A license.
    ///
    /// ### label_key
    /// A label key.
    pub async fn remove_license_label(&self, license_key: &str, label_key: &str) -> Result<()> {
        let input = RemoveLicenseLabelRequestType {license_key, label_key, };
        self.client.invoke_void("", "LicenseManager", &self.mo_id, "RemoveLicenseLabel", Some(&input)).await
    }
    /// Remove license from the available set.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### license_key
    /// A licenses. E.g. a serial license.
    pub async fn remove_license(&self, license_key: &str) -> Result<()> {
        let input = RemoveLicenseRequestType {license_key, };
        self.client.invoke_void("", "LicenseManager", &self.mo_id, "RemoveLicense", Some(&input)).await
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.QueryAssignedLicenses* instead.
    /// 
    /// Defines the product's license edition.
    /// 
    /// The edition defines which product license
    /// the server requires. This, in turn, determines the core set of functionality
    /// provided by the product and the additional features that can be licensed.
    /// 
    /// To determine what featureKey the current platform will accept, use
    /// querySourceAvailablity() at runtime, or consult the documentation for the
    /// current platform.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### host
    /// Host to act on if LicenseManager is not on a host.
    /// 
    /// Refers instance of *HostSystem*.
    ///
    /// ### feature_key
    /// Name of edition feature to select. If featureKey is not
    /// set or set to empty string, the product becomes unlicensed.
    ///
    /// ## Errors:
    ///
    /// ***InvalidArgument***: If a feature key is not an edition feature key.
    /// 
    /// ***LicenseServerUnavailable***: If the license server is unavailable.
    /// 
    /// ***InvalidState***: If the feature cannot be supported on the platform,
    /// potentially because the hardware configuration does not support it.
    pub async fn set_license_edition(&self, host: Option<&crate::types::structs::ManagedObjectReference>, feature_key: Option<&str>) -> Result<()> {
        let input = SetLicenseEditionRequestType {host, feature_key, };
        self.client.invoke_void("", "LicenseManager", &self.mo_id, "SetLicenseEdition", Some(&input)).await
    }
    /// Update a license's label.
    /// 
    /// It creates a label entry if the labelKey doesn't already exist
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### license_key
    /// A license.
    ///
    /// ### label_key
    /// A label key.
    ///
    /// ### label_value
    /// Value for the label.
    pub async fn update_license_label(&self, license_key: &str, label_key: &str, label_value: &str) -> Result<()> {
        let input = UpdateLicenseLabelRequestType {license_key, label_key, label_value, };
        self.client.invoke_void("", "LicenseManager", &self.mo_id, "UpdateLicenseLabel", Some(&input)).await
    }
    /// Updates the available licenses to the one provided in licenseKey.
    /// 
    /// This is the same as removing all the licenses using
    /// *LicenseManager.RemoveLicense* and adding licenseKey using
    /// *LicenseManager.AddLicense*
    /// If the optional parameter labels is specify this is the same as calling
    /// updateLicense without the optioal parameter and calling updateLabel for each pair
    /// in the labels array.
    /// 
    /// ***Required privileges:*** Global.Licenses
    ///
    /// ## Parameters:
    ///
    /// ### license_key
    /// A license. E.g. a serial license.
    ///
    /// ### labels
    /// array of key-value labels.
    ///
    /// ## Returns:
    ///
    /// Returns information about the license specified in licenseKey.
    pub async fn update_license(&self, license_key: &str, labels: Option<&[crate::types::structs::KeyValue]>) -> Result<crate::types::structs::LicenseManagerLicenseInfo> {
        let input = UpdateLicenseRequestType {license_key, labels, };
        let bytes = self.client.invoke("", "LicenseManager", &self.mo_id, "UpdateLicense", Some(&input)).await?;
        let result: crate::types::structs::LicenseManagerLicenseInfo = crate::core::client::unmarshal(self.client.transport(), &bytes)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, this property is not used by the system.
    /// 
    /// Return current diagnostic information.
    pub async fn diagnostics(&self) -> Result<Option<crate::types::structs::LicenseDiagnostics>> {
        let pv_opt = self.client.fetch_property_raw("", "LicenseManager", &self.mo_id, "diagnostics").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// ***Required privileges:*** System.Read
    pub async fn evaluation(&self) -> Result<crate::types::structs::LicenseManagerEvaluationInfo> {
        let pv_opt = self.client.fetch_property_raw("", "LicenseManager", &self.mo_id, "evaluation").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property evaluation was empty".to_string()))?;
        let result: crate::types::structs::LicenseManagerEvaluationInfo = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Deprecated as of VI API 2.5, use *LicenseManager.QuerySupportedFeatures*
    /// instead.
    /// 
    /// The list of features that can be licensed.
    pub async fn feature_info(&self) -> Result<Option<Vec<crate::types::structs::LicenseFeatureInfo>>> {
        let pv_opt = self.client.fetch_property_raw("", "LicenseManager", &self.mo_id, "featureInfo").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// License Assignment Manager
    /// 
    /// ***Required privileges:*** System.View
    ///
    /// ## Returns:
    ///
    /// Refers instance of *LicenseAssignmentManager*.
    pub async fn license_assignment_manager(&self) -> Result<Option<crate::types::structs::ManagedObjectReference>> {
        let pv_opt = self.client.fetch_property_raw("", "LicenseManager", &self.mo_id, "licenseAssignmentManager").await?;
        match pv_opt {
            Some(pv) => Ok(Some(crate::core::client::extract_property(pv)?)),
            None => Ok(None),
        }
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.QueryAssignedLicenses* instead.
    /// 
    /// The product's license edition.
    /// 
    /// The edition defines which product license
    /// the server requires. This, in turn, determines the core set of functionalities
    /// provided by the product and the additional features that can be licensed. If
    /// no edition is set the property is set to the empty string ("").
    /// To set the edition use *LicenseManager.SetLicenseEdition*.
    pub async fn licensed_edition(&self) -> Result<String> {
        let pv_opt = self.client.fetch_property_raw("", "LicenseManager", &self.mo_id, "licensedEdition").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property licensedEdition was empty".to_string()))?;
        let result: String = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Get information about all the licenses available.
    pub async fn licenses(&self) -> Result<Vec<crate::types::structs::LicenseManagerLicenseInfo>> {
        let pv_opt = self.client.fetch_property_raw("", "LicenseManager", &self.mo_id, "licenses").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property licenses was empty".to_string()))?;
        let result: Vec<crate::types::structs::LicenseManagerLicenseInfo> = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, use
    /// *LicenseAssignmentManager.QueryAssignedLicenses* to get evaluation information.
    /// 
    /// Set or return a data object type of LocalLicense or LicenseServer.
    pub async fn source(&self) -> Result<Box<dyn crate::types::traits::LicenseSourceTrait>> {
        let pv_opt = self.client.fetch_property_raw("", "LicenseManager", &self.mo_id, "source").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property source was empty".to_string()))?;
        let result: Box<dyn crate::types::traits::LicenseSourceTrait> = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
    /// Deprecated as of vSphere API 4.0, this property is not used.
    /// 
    /// Current state of the license source.
    /// 
    /// License sources that are LocalSource
    /// are always available.
    pub async fn source_available(&self) -> Result<bool> {
        let pv_opt = self.client.fetch_property_raw("", "LicenseManager", &self.mo_id, "sourceAvailable").await?;
        let pv = pv_opt.ok_or_else(|| crate::core::client::VimError::ParseError("property sourceAvailable was empty".to_string()))?;
        let result: bool = crate::core::client::extract_property(pv)?;
        Ok(result)
    }
}
struct AddLicenseRequestType<'a> {
    license_key: &'a str,
    labels: Option<&'a [crate::types::structs::KeyValue]>,
}

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

struct AddLicenseRequestTypeSer<'b, 'a> {
    data: &'b AddLicenseRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for AddLicenseRequestTypeSer<'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"), &"AddLicenseRequestType")),
                1 => return Some((std::borrow::Cow::Borrowed("licenseKey"), &self.data.license_key as &dyn miniserde::Serialize)),
                2 => {
                    let Some(ref val) = self.data.labels else { continue; };
                    return Some((std::borrow::Cow::Borrowed("labels"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct CheckLicenseFeatureRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
    feature_key: &'a str,
}

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

struct CheckLicenseFeatureRequestTypeSer<'b, 'a> {
    data: &'b CheckLicenseFeatureRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for CheckLicenseFeatureRequestTypeSer<'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"), &"CheckLicenseFeatureRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                2 => return Some((std::borrow::Cow::Borrowed("featureKey"), &self.data.feature_key as &dyn miniserde::Serialize)),
                _ => return None,
            }
        }
    }
}
struct ConfigureLicenseSourceRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
    license_source: &'a dyn crate::types::traits::LicenseSourceTrait,
}

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

struct ConfigureLicenseSourceRequestTypeSer<'b, 'a> {
    data: &'b ConfigureLicenseSourceRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for ConfigureLicenseSourceRequestTypeSer<'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"), &"ConfigureLicenseSourceRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                2 => return Some((std::borrow::Cow::Borrowed("licenseSource"), &self.data.license_source as &dyn miniserde::Serialize)),
                _ => return None,
            }
        }
    }
}
struct DecodeLicenseRequestType<'a> {
    license_key: &'a str,
}

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

struct DecodeLicenseRequestTypeSer<'b, 'a> {
    data: &'b DecodeLicenseRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for DecodeLicenseRequestTypeSer<'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"), &"DecodeLicenseRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("licenseKey"), &self.data.license_key as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct DisableFeatureRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
    feature_key: &'a str,
}

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

struct DisableFeatureRequestTypeSer<'b, 'a> {
    data: &'b DisableFeatureRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for DisableFeatureRequestTypeSer<'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"), &"DisableFeatureRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                2 => return Some((std::borrow::Cow::Borrowed("featureKey"), &self.data.feature_key as &dyn miniserde::Serialize)),
                _ => return None,
            }
        }
    }
}
struct EnableFeatureRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
    feature_key: &'a str,
}

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

struct EnableFeatureRequestTypeSer<'b, 'a> {
    data: &'b EnableFeatureRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for EnableFeatureRequestTypeSer<'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"), &"EnableFeatureRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                2 => return Some((std::borrow::Cow::Borrowed("featureKey"), &self.data.feature_key as &dyn miniserde::Serialize)),
                _ => return None,
            }
        }
    }
}
struct QueryLicenseSourceAvailabilityRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
}

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

struct QueryLicenseSourceAvailabilityRequestTypeSer<'b, 'a> {
    data: &'b QueryLicenseSourceAvailabilityRequestType<'a>,
    seq: usize,
}

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

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

struct QuerySupportedFeaturesRequestTypeSer<'b, 'a> {
    data: &'b QuerySupportedFeaturesRequestType<'a>,
    seq: usize,
}

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

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

struct QueryLicenseUsageRequestTypeSer<'b, 'a> {
    data: &'b QueryLicenseUsageRequestType<'a>,
    seq: usize,
}

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

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

struct RemoveLicenseLabelRequestTypeSer<'b, 'a> {
    data: &'b RemoveLicenseLabelRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RemoveLicenseLabelRequestTypeSer<'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"), &"RemoveLicenseLabelRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("licenseKey"), &self.data.license_key as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("labelKey"), &self.data.label_key as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct RemoveLicenseRequestType<'a> {
    license_key: &'a str,
}

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

struct RemoveLicenseRequestTypeSer<'b, 'a> {
    data: &'b RemoveLicenseRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for RemoveLicenseRequestTypeSer<'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"), &"RemoveLicenseRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("licenseKey"), &self.data.license_key as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct SetLicenseEditionRequestType<'a> {
    host: Option<&'a crate::types::structs::ManagedObjectReference>,
    feature_key: Option<&'a str>,
}

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

struct SetLicenseEditionRequestTypeSer<'b, 'a> {
    data: &'b SetLicenseEditionRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for SetLicenseEditionRequestTypeSer<'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"), &"SetLicenseEditionRequestType")),
                1 => {
                    let Some(ref val) = self.data.host else { continue; };
                    return Some((std::borrow::Cow::Borrowed("host"), val as &dyn miniserde::Serialize));
                }
                2 => {
                    let Some(ref val) = self.data.feature_key else { continue; };
                    return Some((std::borrow::Cow::Borrowed("featureKey"), val as &dyn miniserde::Serialize));
                }
                _ => return None,
            }
        }
    }
}
struct UpdateLicenseLabelRequestType<'a> {
    license_key: &'a str,
    label_key: &'a str,
    label_value: &'a str,
}

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

struct UpdateLicenseLabelRequestTypeSer<'b, 'a> {
    data: &'b UpdateLicenseLabelRequestType<'a>,
    seq: usize,
}

impl<'b, 'a> miniserde::ser::Map for UpdateLicenseLabelRequestTypeSer<'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"), &"UpdateLicenseLabelRequestType")),
            1 => return Some((std::borrow::Cow::Borrowed("licenseKey"), &self.data.license_key as &dyn miniserde::Serialize)),
            2 => return Some((std::borrow::Cow::Borrowed("labelKey"), &self.data.label_key as &dyn miniserde::Serialize)),
            3 => return Some((std::borrow::Cow::Borrowed("labelValue"), &self.data.label_value as &dyn miniserde::Serialize)),
            _ => return None,
        }
    }
}
struct UpdateLicenseRequestType<'a> {
    license_key: &'a str,
    labels: Option<&'a [crate::types::structs::KeyValue]>,
}

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

struct UpdateLicenseRequestTypeSer<'b, 'a> {
    data: &'b UpdateLicenseRequestType<'a>,
    seq: usize,
}

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