/
virtual_machine_types_gen.go
12294 lines (10508 loc) · 448 KB
/
virtual_machine_types_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package storage
import (
"fmt"
v20210701s "github.com/Azure/azure-service-operator/v2/api/compute/v1api20210701/storage"
v20220301s "github.com/Azure/azure-service-operator/v2/api/compute/v1api20220301/storage"
"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
"github.com/pkg/errors"
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Storage version of v1api20201201.VirtualMachine
// Generator information:
// - Generated from: /compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2020-12-01/compute.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}
type VirtualMachine struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec VirtualMachine_Spec `json:"spec,omitempty"`
Status VirtualMachine_STATUS `json:"status,omitempty"`
}
var _ conditions.Conditioner = &VirtualMachine{}
// GetConditions returns the conditions of the resource
func (machine *VirtualMachine) GetConditions() conditions.Conditions {
return machine.Status.Conditions
}
// SetConditions sets the conditions on the resource status
func (machine *VirtualMachine) SetConditions(conditions conditions.Conditions) {
machine.Status.Conditions = conditions
}
var _ conversion.Convertible = &VirtualMachine{}
// ConvertFrom populates our VirtualMachine from the provided hub VirtualMachine
func (machine *VirtualMachine) ConvertFrom(hub conversion.Hub) error {
source, ok := hub.(*v20220301s.VirtualMachine)
if !ok {
return fmt.Errorf("expected compute/v1api20220301/storage/VirtualMachine but received %T instead", hub)
}
return machine.AssignProperties_From_VirtualMachine(source)
}
// ConvertTo populates the provided hub VirtualMachine from our VirtualMachine
func (machine *VirtualMachine) ConvertTo(hub conversion.Hub) error {
destination, ok := hub.(*v20220301s.VirtualMachine)
if !ok {
return fmt.Errorf("expected compute/v1api20220301/storage/VirtualMachine but received %T instead", hub)
}
return machine.AssignProperties_To_VirtualMachine(destination)
}
var _ genruntime.KubernetesResource = &VirtualMachine{}
// AzureName returns the Azure name of the resource
func (machine *VirtualMachine) AzureName() string {
return machine.Spec.AzureName
}
// GetAPIVersion returns the ARM API version of the resource. This is always "2020-12-01"
func (machine VirtualMachine) GetAPIVersion() string {
return string(APIVersion_Value)
}
// GetResourceScope returns the scope of the resource
func (machine *VirtualMachine) GetResourceScope() genruntime.ResourceScope {
return genruntime.ResourceScopeResourceGroup
}
// GetSpec returns the specification of this resource
func (machine *VirtualMachine) GetSpec() genruntime.ConvertibleSpec {
return &machine.Spec
}
// GetStatus returns the status of this resource
func (machine *VirtualMachine) GetStatus() genruntime.ConvertibleStatus {
return &machine.Status
}
// GetSupportedOperations returns the operations supported by the resource
func (machine *VirtualMachine) GetSupportedOperations() []genruntime.ResourceOperation {
return []genruntime.ResourceOperation{
genruntime.ResourceOperationDelete,
genruntime.ResourceOperationGet,
genruntime.ResourceOperationPut,
}
}
// GetType returns the ARM Type of the resource. This is always "Microsoft.Compute/virtualMachines"
func (machine *VirtualMachine) GetType() string {
return "Microsoft.Compute/virtualMachines"
}
// NewEmptyStatus returns a new empty (blank) status
func (machine *VirtualMachine) NewEmptyStatus() genruntime.ConvertibleStatus {
return &VirtualMachine_STATUS{}
}
// Owner returns the ResourceReference of the owner
func (machine *VirtualMachine) Owner() *genruntime.ResourceReference {
group, kind := genruntime.LookupOwnerGroupKind(machine.Spec)
return machine.Spec.Owner.AsResourceReference(group, kind)
}
// SetStatus sets the status of this resource
func (machine *VirtualMachine) SetStatus(status genruntime.ConvertibleStatus) error {
// If we have exactly the right type of status, assign it
if st, ok := status.(*VirtualMachine_STATUS); ok {
machine.Status = *st
return nil
}
// Convert status to required version
var st VirtualMachine_STATUS
err := status.ConvertStatusTo(&st)
if err != nil {
return errors.Wrap(err, "failed to convert status")
}
machine.Status = st
return nil
}
// AssignProperties_From_VirtualMachine populates our VirtualMachine from the provided source VirtualMachine
func (machine *VirtualMachine) AssignProperties_From_VirtualMachine(source *v20220301s.VirtualMachine) error {
// ObjectMeta
machine.ObjectMeta = *source.ObjectMeta.DeepCopy()
// Spec
var spec VirtualMachine_Spec
err := spec.AssignProperties_From_VirtualMachine_Spec(&source.Spec)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_VirtualMachine_Spec() to populate field Spec")
}
machine.Spec = spec
// Status
var status VirtualMachine_STATUS
err = status.AssignProperties_From_VirtualMachine_STATUS(&source.Status)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_VirtualMachine_STATUS() to populate field Status")
}
machine.Status = status
// Invoke the augmentConversionForVirtualMachine interface (if implemented) to customize the conversion
var machineAsAny any = machine
if augmentedMachine, ok := machineAsAny.(augmentConversionForVirtualMachine); ok {
err := augmentedMachine.AssignPropertiesFrom(source)
if err != nil {
return errors.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
}
}
// No error
return nil
}
// AssignProperties_To_VirtualMachine populates the provided destination VirtualMachine from our VirtualMachine
func (machine *VirtualMachine) AssignProperties_To_VirtualMachine(destination *v20220301s.VirtualMachine) error {
// ObjectMeta
destination.ObjectMeta = *machine.ObjectMeta.DeepCopy()
// Spec
var spec v20220301s.VirtualMachine_Spec
err := machine.Spec.AssignProperties_To_VirtualMachine_Spec(&spec)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_VirtualMachine_Spec() to populate field Spec")
}
destination.Spec = spec
// Status
var status v20220301s.VirtualMachine_STATUS
err = machine.Status.AssignProperties_To_VirtualMachine_STATUS(&status)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_VirtualMachine_STATUS() to populate field Status")
}
destination.Status = status
// Invoke the augmentConversionForVirtualMachine interface (if implemented) to customize the conversion
var machineAsAny any = machine
if augmentedMachine, ok := machineAsAny.(augmentConversionForVirtualMachine); ok {
err := augmentedMachine.AssignPropertiesTo(destination)
if err != nil {
return errors.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
}
}
// No error
return nil
}
// OriginalGVK returns a GroupValueKind for the original API version used to create the resource
func (machine *VirtualMachine) OriginalGVK() *schema.GroupVersionKind {
return &schema.GroupVersionKind{
Group: GroupVersion.Group,
Version: machine.Spec.OriginalVersion,
Kind: "VirtualMachine",
}
}
// +kubebuilder:object:root=true
// Storage version of v1api20201201.VirtualMachine
// Generator information:
// - Generated from: /compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2020-12-01/compute.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}
type VirtualMachineList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []VirtualMachine `json:"items"`
}
// Storage version of v1api20201201.APIVersion
// +kubebuilder:validation:Enum={"2020-12-01"}
type APIVersion string
const APIVersion_Value = APIVersion("2020-12-01")
type augmentConversionForVirtualMachine interface {
AssignPropertiesFrom(src *v20220301s.VirtualMachine) error
AssignPropertiesTo(dst *v20220301s.VirtualMachine) error
}
// Storage version of v1api20201201.VirtualMachine_Spec
type VirtualMachine_Spec struct {
AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"`
AvailabilitySet *SubResource `json:"availabilitySet,omitempty"`
// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
// doesn't have to be.
AzureName string `json:"azureName,omitempty"`
BillingProfile *BillingProfile `json:"billingProfile,omitempty"`
DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"`
EvictionPolicy *string `json:"evictionPolicy,omitempty"`
ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"`
ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"`
HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"`
Host *SubResource `json:"host,omitempty"`
HostGroup *SubResource `json:"hostGroup,omitempty"`
Identity *VirtualMachineIdentity `json:"identity,omitempty"`
LicenseType *string `json:"licenseType,omitempty"`
Location *string `json:"location,omitempty"`
NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"`
OriginalVersion string `json:"originalVersion,omitempty"`
OsProfile *OSProfile `json:"osProfile,omitempty"`
// +kubebuilder:validation:Required
// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
// reference to a resources.azure.com/ResourceGroup resource
Owner *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"`
Plan *Plan `json:"plan,omitempty"`
PlatformFaultDomain *int `json:"platformFaultDomain,omitempty"`
Priority *string `json:"priority,omitempty"`
PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"`
SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"`
StorageProfile *StorageProfile `json:"storageProfile,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
VirtualMachineScaleSet *SubResource `json:"virtualMachineScaleSet,omitempty"`
Zones []string `json:"zones,omitempty"`
}
var _ genruntime.ConvertibleSpec = &VirtualMachine_Spec{}
// ConvertSpecFrom populates our VirtualMachine_Spec from the provided source
func (machine *VirtualMachine_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
src, ok := source.(*v20220301s.VirtualMachine_Spec)
if ok {
// Populate our instance from source
return machine.AssignProperties_From_VirtualMachine_Spec(src)
}
// Convert to an intermediate form
src = &v20220301s.VirtualMachine_Spec{}
err := src.ConvertSpecFrom(source)
if err != nil {
return errors.Wrap(err, "initial step of conversion in ConvertSpecFrom()")
}
// Update our instance from src
err = machine.AssignProperties_From_VirtualMachine_Spec(src)
if err != nil {
return errors.Wrap(err, "final step of conversion in ConvertSpecFrom()")
}
return nil
}
// ConvertSpecTo populates the provided destination from our VirtualMachine_Spec
func (machine *VirtualMachine_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
dst, ok := destination.(*v20220301s.VirtualMachine_Spec)
if ok {
// Populate destination from our instance
return machine.AssignProperties_To_VirtualMachine_Spec(dst)
}
// Convert to an intermediate form
dst = &v20220301s.VirtualMachine_Spec{}
err := machine.AssignProperties_To_VirtualMachine_Spec(dst)
if err != nil {
return errors.Wrap(err, "initial step of conversion in ConvertSpecTo()")
}
// Update dst from our instance
err = dst.ConvertSpecTo(destination)
if err != nil {
return errors.Wrap(err, "final step of conversion in ConvertSpecTo()")
}
return nil
}
// AssignProperties_From_VirtualMachine_Spec populates our VirtualMachine_Spec from the provided source VirtualMachine_Spec
func (machine *VirtualMachine_Spec) AssignProperties_From_VirtualMachine_Spec(source *v20220301s.VirtualMachine_Spec) error {
// Clone the existing property bag
propertyBag := genruntime.NewPropertyBag(source.PropertyBag)
// AdditionalCapabilities
if source.AdditionalCapabilities != nil {
var additionalCapability AdditionalCapabilities
err := additionalCapability.AssignProperties_From_AdditionalCapabilities(source.AdditionalCapabilities)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_AdditionalCapabilities() to populate field AdditionalCapabilities")
}
machine.AdditionalCapabilities = &additionalCapability
} else {
machine.AdditionalCapabilities = nil
}
// ApplicationProfile
if source.ApplicationProfile != nil {
propertyBag.Add("ApplicationProfile", *source.ApplicationProfile)
} else {
propertyBag.Remove("ApplicationProfile")
}
// AvailabilitySet
if source.AvailabilitySet != nil {
var subResourceStash v20210701s.SubResource
err := subResourceStash.AssignProperties_From_SubResource(source.AvailabilitySet)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field SubResourceStash from AvailabilitySet")
}
var availabilitySet SubResource
err = availabilitySet.AssignProperties_From_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field AvailabilitySet from SubResourceStash")
}
machine.AvailabilitySet = &availabilitySet
} else {
machine.AvailabilitySet = nil
}
// AzureName
machine.AzureName = source.AzureName
// BillingProfile
if source.BillingProfile != nil {
var billingProfile BillingProfile
err := billingProfile.AssignProperties_From_BillingProfile(source.BillingProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_BillingProfile() to populate field BillingProfile")
}
machine.BillingProfile = &billingProfile
} else {
machine.BillingProfile = nil
}
// CapacityReservation
if source.CapacityReservation != nil {
propertyBag.Add("CapacityReservation", *source.CapacityReservation)
} else {
propertyBag.Remove("CapacityReservation")
}
// DiagnosticsProfile
if source.DiagnosticsProfile != nil {
var diagnosticsProfile DiagnosticsProfile
err := diagnosticsProfile.AssignProperties_From_DiagnosticsProfile(source.DiagnosticsProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_DiagnosticsProfile() to populate field DiagnosticsProfile")
}
machine.DiagnosticsProfile = &diagnosticsProfile
} else {
machine.DiagnosticsProfile = nil
}
// EvictionPolicy
machine.EvictionPolicy = genruntime.ClonePointerToString(source.EvictionPolicy)
// ExtendedLocation
if source.ExtendedLocation != nil {
var extendedLocationStash v20210701s.ExtendedLocation
err := extendedLocationStash.AssignProperties_From_ExtendedLocation(source.ExtendedLocation)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_ExtendedLocation() to populate field ExtendedLocationStash from ExtendedLocation")
}
var extendedLocation ExtendedLocation
err = extendedLocation.AssignProperties_From_ExtendedLocation(&extendedLocationStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_ExtendedLocation() to populate field ExtendedLocation from ExtendedLocationStash")
}
machine.ExtendedLocation = &extendedLocation
} else {
machine.ExtendedLocation = nil
}
// ExtensionsTimeBudget
machine.ExtensionsTimeBudget = genruntime.ClonePointerToString(source.ExtensionsTimeBudget)
// HardwareProfile
if source.HardwareProfile != nil {
var hardwareProfile HardwareProfile
err := hardwareProfile.AssignProperties_From_HardwareProfile(source.HardwareProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_HardwareProfile() to populate field HardwareProfile")
}
machine.HardwareProfile = &hardwareProfile
} else {
machine.HardwareProfile = nil
}
// Host
if source.Host != nil {
var subResourceStash v20210701s.SubResource
err := subResourceStash.AssignProperties_From_SubResource(source.Host)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field SubResourceStash from Host")
}
var host SubResource
err = host.AssignProperties_From_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field Host from SubResourceStash")
}
machine.Host = &host
} else {
machine.Host = nil
}
// HostGroup
if source.HostGroup != nil {
var subResourceStash v20210701s.SubResource
err := subResourceStash.AssignProperties_From_SubResource(source.HostGroup)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field SubResourceStash from HostGroup")
}
var hostGroup SubResource
err = hostGroup.AssignProperties_From_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field HostGroup from SubResourceStash")
}
machine.HostGroup = &hostGroup
} else {
machine.HostGroup = nil
}
// Identity
if source.Identity != nil {
var identity VirtualMachineIdentity
err := identity.AssignProperties_From_VirtualMachineIdentity(source.Identity)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_VirtualMachineIdentity() to populate field Identity")
}
machine.Identity = &identity
} else {
machine.Identity = nil
}
// LicenseType
machine.LicenseType = genruntime.ClonePointerToString(source.LicenseType)
// Location
machine.Location = genruntime.ClonePointerToString(source.Location)
// NetworkProfile
if source.NetworkProfile != nil {
var networkProfile NetworkProfile
err := networkProfile.AssignProperties_From_NetworkProfile(source.NetworkProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_NetworkProfile() to populate field NetworkProfile")
}
machine.NetworkProfile = &networkProfile
} else {
machine.NetworkProfile = nil
}
// OriginalVersion
machine.OriginalVersion = source.OriginalVersion
// OsProfile
if source.OsProfile != nil {
var osProfile OSProfile
err := osProfile.AssignProperties_From_OSProfile(source.OsProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_OSProfile() to populate field OsProfile")
}
machine.OsProfile = &osProfile
} else {
machine.OsProfile = nil
}
// Owner
if source.Owner != nil {
owner := source.Owner.Copy()
machine.Owner = &owner
} else {
machine.Owner = nil
}
// Plan
if source.Plan != nil {
var plan Plan
err := plan.AssignProperties_From_Plan(source.Plan)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_Plan() to populate field Plan")
}
machine.Plan = &plan
} else {
machine.Plan = nil
}
// PlatformFaultDomain
machine.PlatformFaultDomain = genruntime.ClonePointerToInt(source.PlatformFaultDomain)
// Priority
machine.Priority = genruntime.ClonePointerToString(source.Priority)
// ProximityPlacementGroup
if source.ProximityPlacementGroup != nil {
var subResourceStash v20210701s.SubResource
err := subResourceStash.AssignProperties_From_SubResource(source.ProximityPlacementGroup)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field SubResourceStash from ProximityPlacementGroup")
}
var proximityPlacementGroup SubResource
err = proximityPlacementGroup.AssignProperties_From_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field ProximityPlacementGroup from SubResourceStash")
}
machine.ProximityPlacementGroup = &proximityPlacementGroup
} else {
machine.ProximityPlacementGroup = nil
}
// ScheduledEventsProfile
if source.ScheduledEventsProfile != nil {
propertyBag.Add("ScheduledEventsProfile", *source.ScheduledEventsProfile)
} else {
propertyBag.Remove("ScheduledEventsProfile")
}
// SecurityProfile
if source.SecurityProfile != nil {
var securityProfile SecurityProfile
err := securityProfile.AssignProperties_From_SecurityProfile(source.SecurityProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SecurityProfile() to populate field SecurityProfile")
}
machine.SecurityProfile = &securityProfile
} else {
machine.SecurityProfile = nil
}
// StorageProfile
if source.StorageProfile != nil {
var storageProfile StorageProfile
err := storageProfile.AssignProperties_From_StorageProfile(source.StorageProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_StorageProfile() to populate field StorageProfile")
}
machine.StorageProfile = &storageProfile
} else {
machine.StorageProfile = nil
}
// Tags
machine.Tags = genruntime.CloneMapOfStringToString(source.Tags)
// UserData
if source.UserData != nil {
propertyBag.Add("UserData", *source.UserData)
} else {
propertyBag.Remove("UserData")
}
// VirtualMachineScaleSet
if source.VirtualMachineScaleSet != nil {
var subResourceStash v20210701s.SubResource
err := subResourceStash.AssignProperties_From_SubResource(source.VirtualMachineScaleSet)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field SubResourceStash from VirtualMachineScaleSet")
}
var virtualMachineScaleSet SubResource
err = virtualMachineScaleSet.AssignProperties_From_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_From_SubResource() to populate field VirtualMachineScaleSet from SubResourceStash")
}
machine.VirtualMachineScaleSet = &virtualMachineScaleSet
} else {
machine.VirtualMachineScaleSet = nil
}
// Zones
machine.Zones = genruntime.CloneSliceOfString(source.Zones)
// Update the property bag
if len(propertyBag) > 0 {
machine.PropertyBag = propertyBag
} else {
machine.PropertyBag = nil
}
// Invoke the augmentConversionForVirtualMachine_Spec interface (if implemented) to customize the conversion
var machineAsAny any = machine
if augmentedMachine, ok := machineAsAny.(augmentConversionForVirtualMachine_Spec); ok {
err := augmentedMachine.AssignPropertiesFrom(source)
if err != nil {
return errors.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
}
}
// No error
return nil
}
// AssignProperties_To_VirtualMachine_Spec populates the provided destination VirtualMachine_Spec from our VirtualMachine_Spec
func (machine *VirtualMachine_Spec) AssignProperties_To_VirtualMachine_Spec(destination *v20220301s.VirtualMachine_Spec) error {
// Clone the existing property bag
propertyBag := genruntime.NewPropertyBag(machine.PropertyBag)
// AdditionalCapabilities
if machine.AdditionalCapabilities != nil {
var additionalCapability v20220301s.AdditionalCapabilities
err := machine.AdditionalCapabilities.AssignProperties_To_AdditionalCapabilities(&additionalCapability)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_AdditionalCapabilities() to populate field AdditionalCapabilities")
}
destination.AdditionalCapabilities = &additionalCapability
} else {
destination.AdditionalCapabilities = nil
}
// ApplicationProfile
if propertyBag.Contains("ApplicationProfile") {
var applicationProfile v20220301s.ApplicationProfile
err := propertyBag.Pull("ApplicationProfile", &applicationProfile)
if err != nil {
return errors.Wrap(err, "pulling 'ApplicationProfile' from propertyBag")
}
destination.ApplicationProfile = &applicationProfile
} else {
destination.ApplicationProfile = nil
}
// AvailabilitySet
if machine.AvailabilitySet != nil {
var subResourceStash v20210701s.SubResource
err := machine.AvailabilitySet.AssignProperties_To_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field SubResourceStash from AvailabilitySet")
}
var availabilitySet v20220301s.SubResource
err = subResourceStash.AssignProperties_To_SubResource(&availabilitySet)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field AvailabilitySet from SubResourceStash")
}
destination.AvailabilitySet = &availabilitySet
} else {
destination.AvailabilitySet = nil
}
// AzureName
destination.AzureName = machine.AzureName
// BillingProfile
if machine.BillingProfile != nil {
var billingProfile v20220301s.BillingProfile
err := machine.BillingProfile.AssignProperties_To_BillingProfile(&billingProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_BillingProfile() to populate field BillingProfile")
}
destination.BillingProfile = &billingProfile
} else {
destination.BillingProfile = nil
}
// CapacityReservation
if propertyBag.Contains("CapacityReservation") {
var capacityReservation v20220301s.CapacityReservationProfile
err := propertyBag.Pull("CapacityReservation", &capacityReservation)
if err != nil {
return errors.Wrap(err, "pulling 'CapacityReservation' from propertyBag")
}
destination.CapacityReservation = &capacityReservation
} else {
destination.CapacityReservation = nil
}
// DiagnosticsProfile
if machine.DiagnosticsProfile != nil {
var diagnosticsProfile v20220301s.DiagnosticsProfile
err := machine.DiagnosticsProfile.AssignProperties_To_DiagnosticsProfile(&diagnosticsProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_DiagnosticsProfile() to populate field DiagnosticsProfile")
}
destination.DiagnosticsProfile = &diagnosticsProfile
} else {
destination.DiagnosticsProfile = nil
}
// EvictionPolicy
destination.EvictionPolicy = genruntime.ClonePointerToString(machine.EvictionPolicy)
// ExtendedLocation
if machine.ExtendedLocation != nil {
var extendedLocationStash v20210701s.ExtendedLocation
err := machine.ExtendedLocation.AssignProperties_To_ExtendedLocation(&extendedLocationStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocationStash from ExtendedLocation")
}
var extendedLocation v20220301s.ExtendedLocation
err = extendedLocationStash.AssignProperties_To_ExtendedLocation(&extendedLocation)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocation from ExtendedLocationStash")
}
destination.ExtendedLocation = &extendedLocation
} else {
destination.ExtendedLocation = nil
}
// ExtensionsTimeBudget
destination.ExtensionsTimeBudget = genruntime.ClonePointerToString(machine.ExtensionsTimeBudget)
// HardwareProfile
if machine.HardwareProfile != nil {
var hardwareProfile v20220301s.HardwareProfile
err := machine.HardwareProfile.AssignProperties_To_HardwareProfile(&hardwareProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_HardwareProfile() to populate field HardwareProfile")
}
destination.HardwareProfile = &hardwareProfile
} else {
destination.HardwareProfile = nil
}
// Host
if machine.Host != nil {
var subResourceStash v20210701s.SubResource
err := machine.Host.AssignProperties_To_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field SubResourceStash from Host")
}
var host v20220301s.SubResource
err = subResourceStash.AssignProperties_To_SubResource(&host)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field Host from SubResourceStash")
}
destination.Host = &host
} else {
destination.Host = nil
}
// HostGroup
if machine.HostGroup != nil {
var subResourceStash v20210701s.SubResource
err := machine.HostGroup.AssignProperties_To_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field SubResourceStash from HostGroup")
}
var hostGroup v20220301s.SubResource
err = subResourceStash.AssignProperties_To_SubResource(&hostGroup)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field HostGroup from SubResourceStash")
}
destination.HostGroup = &hostGroup
} else {
destination.HostGroup = nil
}
// Identity
if machine.Identity != nil {
var identity v20220301s.VirtualMachineIdentity
err := machine.Identity.AssignProperties_To_VirtualMachineIdentity(&identity)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_VirtualMachineIdentity() to populate field Identity")
}
destination.Identity = &identity
} else {
destination.Identity = nil
}
// LicenseType
destination.LicenseType = genruntime.ClonePointerToString(machine.LicenseType)
// Location
destination.Location = genruntime.ClonePointerToString(machine.Location)
// NetworkProfile
if machine.NetworkProfile != nil {
var networkProfile v20220301s.NetworkProfile
err := machine.NetworkProfile.AssignProperties_To_NetworkProfile(&networkProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_NetworkProfile() to populate field NetworkProfile")
}
destination.NetworkProfile = &networkProfile
} else {
destination.NetworkProfile = nil
}
// OriginalVersion
destination.OriginalVersion = machine.OriginalVersion
// OsProfile
if machine.OsProfile != nil {
var osProfile v20220301s.OSProfile
err := machine.OsProfile.AssignProperties_To_OSProfile(&osProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_OSProfile() to populate field OsProfile")
}
destination.OsProfile = &osProfile
} else {
destination.OsProfile = nil
}
// Owner
if machine.Owner != nil {
owner := machine.Owner.Copy()
destination.Owner = &owner
} else {
destination.Owner = nil
}
// Plan
if machine.Plan != nil {
var plan v20220301s.Plan
err := machine.Plan.AssignProperties_To_Plan(&plan)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_Plan() to populate field Plan")
}
destination.Plan = &plan
} else {
destination.Plan = nil
}
// PlatformFaultDomain
destination.PlatformFaultDomain = genruntime.ClonePointerToInt(machine.PlatformFaultDomain)
// Priority
destination.Priority = genruntime.ClonePointerToString(machine.Priority)
// ProximityPlacementGroup
if machine.ProximityPlacementGroup != nil {
var subResourceStash v20210701s.SubResource
err := machine.ProximityPlacementGroup.AssignProperties_To_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field SubResourceStash from ProximityPlacementGroup")
}
var proximityPlacementGroup v20220301s.SubResource
err = subResourceStash.AssignProperties_To_SubResource(&proximityPlacementGroup)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field ProximityPlacementGroup from SubResourceStash")
}
destination.ProximityPlacementGroup = &proximityPlacementGroup
} else {
destination.ProximityPlacementGroup = nil
}
// ScheduledEventsProfile
if propertyBag.Contains("ScheduledEventsProfile") {
var scheduledEventsProfile v20220301s.ScheduledEventsProfile
err := propertyBag.Pull("ScheduledEventsProfile", &scheduledEventsProfile)
if err != nil {
return errors.Wrap(err, "pulling 'ScheduledEventsProfile' from propertyBag")
}
destination.ScheduledEventsProfile = &scheduledEventsProfile
} else {
destination.ScheduledEventsProfile = nil
}
// SecurityProfile
if machine.SecurityProfile != nil {
var securityProfile v20220301s.SecurityProfile
err := machine.SecurityProfile.AssignProperties_To_SecurityProfile(&securityProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SecurityProfile() to populate field SecurityProfile")
}
destination.SecurityProfile = &securityProfile
} else {
destination.SecurityProfile = nil
}
// StorageProfile
if machine.StorageProfile != nil {
var storageProfile v20220301s.StorageProfile
err := machine.StorageProfile.AssignProperties_To_StorageProfile(&storageProfile)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_StorageProfile() to populate field StorageProfile")
}
destination.StorageProfile = &storageProfile
} else {
destination.StorageProfile = nil
}
// Tags
destination.Tags = genruntime.CloneMapOfStringToString(machine.Tags)
// UserData
if propertyBag.Contains("UserData") {
var userDatum string
err := propertyBag.Pull("UserData", &userDatum)
if err != nil {
return errors.Wrap(err, "pulling 'UserData' from propertyBag")
}
destination.UserData = &userDatum
} else {
destination.UserData = nil
}
// VirtualMachineScaleSet
if machine.VirtualMachineScaleSet != nil {
var subResourceStash v20210701s.SubResource
err := machine.VirtualMachineScaleSet.AssignProperties_To_SubResource(&subResourceStash)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field SubResourceStash from VirtualMachineScaleSet")
}
var virtualMachineScaleSet v20220301s.SubResource
err = subResourceStash.AssignProperties_To_SubResource(&virtualMachineScaleSet)
if err != nil {
return errors.Wrap(err, "calling AssignProperties_To_SubResource() to populate field VirtualMachineScaleSet from SubResourceStash")
}
destination.VirtualMachineScaleSet = &virtualMachineScaleSet
} else {
destination.VirtualMachineScaleSet = nil
}
// Zones
destination.Zones = genruntime.CloneSliceOfString(machine.Zones)
// Update the property bag
if len(propertyBag) > 0 {
destination.PropertyBag = propertyBag
} else {
destination.PropertyBag = nil
}
// Invoke the augmentConversionForVirtualMachine_Spec interface (if implemented) to customize the conversion
var machineAsAny any = machine
if augmentedMachine, ok := machineAsAny.(augmentConversionForVirtualMachine_Spec); ok {
err := augmentedMachine.AssignPropertiesTo(destination)
if err != nil {
return errors.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
}
}
// No error
return nil
}
// Storage version of v1api20201201.VirtualMachine_STATUS
// Describes a Virtual Machine.
type VirtualMachine_STATUS struct {
AdditionalCapabilities *AdditionalCapabilities_STATUS `json:"additionalCapabilities,omitempty"`
AvailabilitySet *SubResource_STATUS `json:"availabilitySet,omitempty"`
BillingProfile *BillingProfile_STATUS `json:"billingProfile,omitempty"`
Conditions []conditions.Condition `json:"conditions,omitempty"`
DiagnosticsProfile *DiagnosticsProfile_STATUS `json:"diagnosticsProfile,omitempty"`
EvictionPolicy *string `json:"evictionPolicy,omitempty"`
ExtendedLocation *ExtendedLocation_STATUS `json:"extendedLocation,omitempty"`
ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"`
HardwareProfile *HardwareProfile_STATUS `json:"hardwareProfile,omitempty"`
Host *SubResource_STATUS `json:"host,omitempty"`
HostGroup *SubResource_STATUS `json:"hostGroup,omitempty"`
Id *string `json:"id,omitempty"`
Identity *VirtualMachineIdentity_STATUS `json:"identity,omitempty"`
InstanceView *VirtualMachineInstanceView_STATUS `json:"instanceView,omitempty"`
LicenseType *string `json:"licenseType,omitempty"`
Location *string `json:"location,omitempty"`