From a19ce4c5b839bef3c061d7069145d18f20b45a5c Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Thu, 10 Feb 2022 11:51:40 +1300 Subject: [PATCH 01/17] Update config file --- v2/azure-arm.yaml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/v2/azure-arm.yaml b/v2/azure-arm.yaml index 5464fa980d0..13049669613 100644 --- a/v2/azure-arm.yaml +++ b/v2/azure-arm.yaml @@ -572,7 +572,13 @@ objectModelConfiguration: Encryption: DiskEncryptionSetId: $armReference: true - ImageDiskReference: + Snapshot: + $export: true + SnapshotProperties: + DiskAccessId: + $armReference: true + 2020-12-01: + DiskEncryptionSetParameters: Id: $armReference: true SourceVault: @@ -620,6 +626,15 @@ objectModelConfiguration: VirtualMachineScaleSetOSProfile: AdminPassword: $isSecret: true + 2021-07-01: + DiskEncryptionSetParameters: + Id: + $armReference: true + Image: + $export: true + SubResource: + Id: + $armReference: true containerregistry: 2021-09-01: Registry: From 09612e49ea6162f0933f8d74ffe8f91ff4dd7915 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Thu, 10 Feb 2022 11:53:32 +1300 Subject: [PATCH 02/17] Update generated code --- .../snapshot__status_arm_types_gen.go | 102 + .../snapshot__status_arm_types_gen_test.go | 252 ++ .../v1alpha1api20200930/snapshot_types_gen.go | 1894 ++++++++++ .../snapshot_types_gen_test.go | 642 ++++ .../snapshots__spec_arm_types_gen.go | 101 + .../snapshots__spec_arm_types_gen_test.go | 243 ++ .../snapshot_types_gen.go | 247 ++ .../snapshot_types_gen_test.go | 378 ++ .../virtual_machine_types_gen.go | 223 ++ .../virtual_machine_types_gen_test.go | 211 ++ .../groupversion_info_gen.go | 31 + .../image__status_arm_types_gen.go | 160 + .../image__status_arm_types_gen_test.go | 541 +++ .../v1alpha1api20210701/image_types_gen.go | 3147 +++++++++++++++++ .../image_types_gen_test.go | 1648 +++++++++ .../images__spec_arm_types_gen.go | 174 + .../images__spec_arm_types_gen_test.go | 594 ++++ .../groupversion_info_gen.go | 31 + .../image_types_gen.go | 320 ++ .../image_types_gen_test.go | 994 ++++++ v2/api/compute/versions_matrix.md | 580 +-- v2/api/resources.md | 8 + .../controllers/controller_resources_gen.go | 28 + 23 files changed, 12279 insertions(+), 270 deletions(-) create mode 100644 v2/api/compute/v1alpha1api20200930/snapshot__status_arm_types_gen.go create mode 100644 v2/api/compute/v1alpha1api20200930/snapshot__status_arm_types_gen_test.go create mode 100644 v2/api/compute/v1alpha1api20200930/snapshot_types_gen.go create mode 100644 v2/api/compute/v1alpha1api20200930/snapshot_types_gen_test.go create mode 100644 v2/api/compute/v1alpha1api20200930/snapshots__spec_arm_types_gen.go create mode 100644 v2/api/compute/v1alpha1api20200930/snapshots__spec_arm_types_gen_test.go create mode 100644 v2/api/compute/v1alpha1api20200930storage/snapshot_types_gen.go create mode 100644 v2/api/compute/v1alpha1api20200930storage/snapshot_types_gen_test.go create mode 100644 v2/api/compute/v1alpha1api20210701/groupversion_info_gen.go create mode 100644 v2/api/compute/v1alpha1api20210701/image__status_arm_types_gen.go create mode 100644 v2/api/compute/v1alpha1api20210701/image__status_arm_types_gen_test.go create mode 100644 v2/api/compute/v1alpha1api20210701/image_types_gen.go create mode 100644 v2/api/compute/v1alpha1api20210701/image_types_gen_test.go create mode 100644 v2/api/compute/v1alpha1api20210701/images__spec_arm_types_gen.go create mode 100644 v2/api/compute/v1alpha1api20210701/images__spec_arm_types_gen_test.go create mode 100644 v2/api/compute/v1alpha1api20210701storage/groupversion_info_gen.go create mode 100644 v2/api/compute/v1alpha1api20210701storage/image_types_gen.go create mode 100644 v2/api/compute/v1alpha1api20210701storage/image_types_gen_test.go diff --git a/v2/api/compute/v1alpha1api20200930/snapshot__status_arm_types_gen.go b/v2/api/compute/v1alpha1api20200930/snapshot__status_arm_types_gen.go new file mode 100644 index 00000000000..c82a27990fc --- /dev/null +++ b/v2/api/compute/v1alpha1api20200930/snapshot__status_arm_types_gen.go @@ -0,0 +1,102 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20200930 + +type Snapshot_StatusARM struct { + //ExtendedLocation: The extended location where the snapshot will be created. + //Extended location cannot be changed. + ExtendedLocation *ExtendedLocation_StatusARM `json:"extendedLocation,omitempty"` + + //Id: Resource Id + Id *string `json:"id,omitempty"` + + //Location: Resource location + Location *string `json:"location,omitempty"` + + //ManagedBy: Unused. Always Null. + ManagedBy *string `json:"managedBy,omitempty"` + + //Name: Resource name + Name *string `json:"name,omitempty"` + Properties *SnapshotProperties_StatusARM `json:"properties,omitempty"` + Sku *SnapshotSku_StatusARM `json:"sku,omitempty"` + + //Tags: Resource tags + Tags map[string]string `json:"tags,omitempty"` + + //Type: Resource type + Type *string `json:"type,omitempty"` +} + +type SnapshotProperties_StatusARM struct { + //CreationData: Disk source information. CreationData information cannot be + //changed after the disk has been created. + CreationData CreationData_StatusARM `json:"creationData"` + + //DiskAccessId: ARM id of the DiskAccess resource for using private endpoints on + //disks. + DiskAccessId *string `json:"diskAccessId,omitempty"` + + //DiskSizeBytes: The size of the disk in bytes. This field is read only. + DiskSizeBytes *int `json:"diskSizeBytes,omitempty"` + + //DiskSizeGB: If creationData.createOption is Empty, this field is mandatory and + //it indicates the size of the disk to create. If this field is present for + //updates or creation with other options, it indicates a resize. Resizes are only + //allowed if the disk is not attached to a running VM, and can only increase the + //disk's size. + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + //DiskState: The state of the snapshot. + DiskState *DiskState_Status `json:"diskState,omitempty"` + + //Encryption: Encryption property can be used to encrypt data at rest with + //customer managed keys or platform managed keys. + Encryption *Encryption_StatusARM `json:"encryption,omitempty"` + + //EncryptionSettingsCollection: Encryption settings collection used be Azure Disk + //Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection_StatusARM `json:"encryptionSettingsCollection,omitempty"` + + //HyperVGeneration: The hypervisor generation of the Virtual Machine. Applicable + //to OS disks only. + HyperVGeneration *SnapshotPropertiesStatusHyperVGeneration `json:"hyperVGeneration,omitempty"` + + //Incremental: Whether a snapshot is incremental. Incremental snapshots on the + //same disk occupy less space than full snapshots and can be diffed. + Incremental *bool `json:"incremental,omitempty"` + NetworkAccessPolicy *NetworkAccessPolicy_Status `json:"networkAccessPolicy,omitempty"` + + //OsType: The Operating System type. + OsType *SnapshotPropertiesStatusOsType `json:"osType,omitempty"` + + //ProvisioningState: The disk provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + + //PurchasePlan: Purchase plan information for the image from which the source disk + //for the snapshot was originally created. + PurchasePlan *PurchasePlan_StatusARM `json:"purchasePlan,omitempty"` + + //TimeCreated: The time when the snapshot was created. + TimeCreated *string `json:"timeCreated,omitempty"` + + //UniqueId: Unique Guid identifying the resource. + UniqueId *string `json:"uniqueId,omitempty"` +} + +type SnapshotSku_StatusARM struct { + //Name: The sku name. + Name *SnapshotSkuStatusName `json:"name,omitempty"` + + //Tier: The sku tier. + Tier *string `json:"tier,omitempty"` +} + +type SnapshotSkuStatusName string + +const ( + SnapshotSkuStatusNamePremiumLRS = SnapshotSkuStatusName("Premium_LRS") + SnapshotSkuStatusNameStandardLRS = SnapshotSkuStatusName("Standard_LRS") + SnapshotSkuStatusNameStandardZRS = SnapshotSkuStatusName("Standard_ZRS") +) diff --git a/v2/api/compute/v1alpha1api20200930/snapshot__status_arm_types_gen_test.go b/v2/api/compute/v1alpha1api20200930/snapshot__status_arm_types_gen_test.go new file mode 100644 index 00000000000..0a53661f61a --- /dev/null +++ b/v2/api/compute/v1alpha1api20200930/snapshot__status_arm_types_gen_test.go @@ -0,0 +1,252 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20200930 + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Snapshot_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Snapshot_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotStatusARM, SnapshotStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotStatusARM runs a test to see if a specific instance of Snapshot_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotStatusARM(subject Snapshot_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Snapshot_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Snapshot_StatusARM instances for property testing - lazily instantiated by SnapshotStatusARMGenerator() +var snapshotStatusARMGenerator gopter.Gen + +// SnapshotStatusARMGenerator returns a generator of Snapshot_StatusARM instances for property testing. +// We first initialize snapshotStatusARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func SnapshotStatusARMGenerator() gopter.Gen { + if snapshotStatusARMGenerator != nil { + return snapshotStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotStatusARM(generators) + snapshotStatusARMGenerator = gen.Struct(reflect.TypeOf(Snapshot_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotStatusARM(generators) + AddRelatedPropertyGeneratorsForSnapshotStatusARM(generators) + snapshotStatusARMGenerator = gen.Struct(reflect.TypeOf(Snapshot_StatusARM{}), generators) + + return snapshotStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotStatusARM(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["ManagedBy"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSnapshotStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshotStatusARM(gens map[string]gopter.Gen) { + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationStatusARMGenerator()) + gens["Properties"] = gen.PtrOf(SnapshotPropertiesStatusARMGenerator()) + gens["Sku"] = gen.PtrOf(SnapshotSkuStatusARMGenerator()) +} + +func Test_SnapshotProperties_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SnapshotProperties_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotPropertiesStatusARM, SnapshotPropertiesStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotPropertiesStatusARM runs a test to see if a specific instance of SnapshotProperties_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotPropertiesStatusARM(subject SnapshotProperties_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SnapshotProperties_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SnapshotProperties_StatusARM instances for property testing - lazily instantiated by +//SnapshotPropertiesStatusARMGenerator() +var snapshotPropertiesStatusARMGenerator gopter.Gen + +// SnapshotPropertiesStatusARMGenerator returns a generator of SnapshotProperties_StatusARM instances for property testing. +// We first initialize snapshotPropertiesStatusARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func SnapshotPropertiesStatusARMGenerator() gopter.Gen { + if snapshotPropertiesStatusARMGenerator != nil { + return snapshotPropertiesStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotPropertiesStatusARM(generators) + snapshotPropertiesStatusARMGenerator = gen.Struct(reflect.TypeOf(SnapshotProperties_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotPropertiesStatusARM(generators) + AddRelatedPropertyGeneratorsForSnapshotPropertiesStatusARM(generators) + snapshotPropertiesStatusARMGenerator = gen.Struct(reflect.TypeOf(SnapshotProperties_StatusARM{}), generators) + + return snapshotPropertiesStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotPropertiesStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotPropertiesStatusARM(gens map[string]gopter.Gen) { + gens["DiskAccessId"] = gen.PtrOf(gen.AlphaString()) + gens["DiskSizeBytes"] = gen.PtrOf(gen.Int()) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["DiskState"] = gen.PtrOf(gen.OneConstOf( + DiskState_StatusActiveSAS, + DiskState_StatusActiveUpload, + DiskState_StatusAttached, + DiskState_StatusReadyToUpload, + DiskState_StatusReserved, + DiskState_StatusUnattached)) + gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesStatusHyperVGenerationV1, SnapshotPropertiesStatusHyperVGenerationV2)) + gens["Incremental"] = gen.PtrOf(gen.Bool()) + gens["NetworkAccessPolicy"] = gen.PtrOf(gen.OneConstOf(NetworkAccessPolicy_StatusAllowAll, NetworkAccessPolicy_StatusAllowPrivate, NetworkAccessPolicy_StatusDenyAll)) + gens["OsType"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesStatusOsTypeLinux, SnapshotPropertiesStatusOsTypeWindows)) + gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) + gens["TimeCreated"] = gen.PtrOf(gen.AlphaString()) + gens["UniqueId"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSnapshotPropertiesStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshotPropertiesStatusARM(gens map[string]gopter.Gen) { + gens["CreationData"] = CreationDataStatusARMGenerator() + gens["Encryption"] = gen.PtrOf(EncryptionStatusARMGenerator()) + gens["EncryptionSettingsCollection"] = gen.PtrOf(EncryptionSettingsCollectionStatusARMGenerator()) + gens["PurchasePlan"] = gen.PtrOf(PurchasePlanStatusARMGenerator()) +} + +func Test_SnapshotSku_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SnapshotSku_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotSkuStatusARM, SnapshotSkuStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotSkuStatusARM runs a test to see if a specific instance of SnapshotSku_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotSkuStatusARM(subject SnapshotSku_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SnapshotSku_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SnapshotSku_StatusARM instances for property testing - lazily instantiated by +//SnapshotSkuStatusARMGenerator() +var snapshotSkuStatusARMGenerator gopter.Gen + +// SnapshotSkuStatusARMGenerator returns a generator of SnapshotSku_StatusARM instances for property testing. +func SnapshotSkuStatusARMGenerator() gopter.Gen { + if snapshotSkuStatusARMGenerator != nil { + return snapshotSkuStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotSkuStatusARM(generators) + snapshotSkuStatusARMGenerator = gen.Struct(reflect.TypeOf(SnapshotSku_StatusARM{}), generators) + + return snapshotSkuStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotSkuStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotSkuStatusARM(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.OneConstOf(SnapshotSkuStatusNamePremiumLRS, SnapshotSkuStatusNameStandardLRS, SnapshotSkuStatusNameStandardZRS)) + gens["Tier"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/compute/v1alpha1api20200930/snapshot_types_gen.go b/v2/api/compute/v1alpha1api20200930/snapshot_types_gen.go new file mode 100644 index 00000000000..d795bd8a9ed --- /dev/null +++ b/v2/api/compute/v1alpha1api20200930/snapshot_types_gen.go @@ -0,0 +1,1894 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20200930 + +import ( + "fmt" + "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20200930storage" + "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + kerrors "k8s.io/apimachinery/pkg/util/errors" + "sigs.k8s.io/controller-runtime/pkg/conversion" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// +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" +//Generated from: https://schema.management.azure.com/schemas/2020-09-30/Microsoft.Compute.json#/resourceDefinitions/snapshots +type Snapshot struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec Snapshots_Spec `json:"spec,omitempty"` + Status Snapshot_Status `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &Snapshot{} + +// GetConditions returns the conditions of the resource +func (snapshot *Snapshot) GetConditions() conditions.Conditions { + return snapshot.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (snapshot *Snapshot) SetConditions(conditions conditions.Conditions) { + snapshot.Status.Conditions = conditions +} + +var _ conversion.Convertible = &Snapshot{} + +// ConvertFrom populates our Snapshot from the provided hub Snapshot +func (snapshot *Snapshot) ConvertFrom(hub conversion.Hub) error { + source, ok := hub.(*v1alpha1api20200930storage.Snapshot) + if !ok { + return fmt.Errorf("expected storage:compute/v1alpha1api20200930storage/Snapshot but received %T instead", hub) + } + + return snapshot.AssignPropertiesFromSnapshot(source) +} + +// ConvertTo populates the provided hub Snapshot from our Snapshot +func (snapshot *Snapshot) ConvertTo(hub conversion.Hub) error { + destination, ok := hub.(*v1alpha1api20200930storage.Snapshot) + if !ok { + return fmt.Errorf("expected storage:compute/v1alpha1api20200930storage/Snapshot but received %T instead", hub) + } + + return snapshot.AssignPropertiesToSnapshot(destination) +} + +// +kubebuilder:webhook:path=/mutate-compute-azure-com-v1alpha1api20200930-snapshot,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=compute.azure.com,resources=snapshots,verbs=create;update,versions=v1alpha1api20200930,name=default.v1alpha1api20200930.snapshots.compute.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Defaulter = &Snapshot{} + +// Default applies defaults to the Snapshot resource +func (snapshot *Snapshot) Default() { + snapshot.defaultImpl() + var temp interface{} = snapshot + if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok { + runtimeDefaulter.CustomDefault() + } +} + +// defaultAzureName defaults the Azure name of the resource to the Kubernetes name +func (snapshot *Snapshot) defaultAzureName() { + if snapshot.Spec.AzureName == "" { + snapshot.Spec.AzureName = snapshot.Name + } +} + +// defaultImpl applies the code generated defaults to the Snapshot resource +func (snapshot *Snapshot) defaultImpl() { snapshot.defaultAzureName() } + +var _ genruntime.KubernetesResource = &Snapshot{} + +// AzureName returns the Azure name of the resource +func (snapshot *Snapshot) AzureName() string { + return snapshot.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-09-30" +func (snapshot Snapshot) GetAPIVersion() string { + return "2020-09-30" +} + +// GetResourceKind returns the kind of the resource +func (snapshot *Snapshot) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (snapshot *Snapshot) GetSpec() genruntime.ConvertibleSpec { + return &snapshot.Spec +} + +// GetStatus returns the status of this resource +func (snapshot *Snapshot) GetStatus() genruntime.ConvertibleStatus { + return &snapshot.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Compute/snapshots" +func (snapshot *Snapshot) GetType() string { + return "Microsoft.Compute/snapshots" +} + +// NewEmptyStatus returns a new empty (blank) status +func (snapshot *Snapshot) NewEmptyStatus() genruntime.ConvertibleStatus { + return &Snapshot_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (snapshot *Snapshot) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(snapshot.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Name: snapshot.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (snapshot *Snapshot) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*Snapshot_Status); ok { + snapshot.Status = *st + return nil + } + + // Convert status to required version + var st Snapshot_Status + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + snapshot.Status = st + return nil +} + +// +kubebuilder:webhook:path=/validate-compute-azure-com-v1alpha1api20200930-snapshot,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=compute.azure.com,resources=snapshots,verbs=create;update,versions=v1alpha1api20200930,name=validate.v1alpha1api20200930.snapshots.compute.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Validator = &Snapshot{} + +// ValidateCreate validates the creation of the resource +func (snapshot *Snapshot) ValidateCreate() error { + validations := snapshot.createValidations() + var temp interface{} = snapshot + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.CreateValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation() + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// ValidateDelete validates the deletion of the resource +func (snapshot *Snapshot) ValidateDelete() error { + validations := snapshot.deleteValidations() + var temp interface{} = snapshot + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.DeleteValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation() + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// ValidateUpdate validates an update of the resource +func (snapshot *Snapshot) ValidateUpdate(old runtime.Object) error { + validations := snapshot.updateValidations() + var temp interface{} = snapshot + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.UpdateValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation(old) + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// createValidations validates the creation of the resource +func (snapshot *Snapshot) createValidations() []func() error { + return []func() error{snapshot.validateResourceReferences} +} + +// deleteValidations validates the deletion of the resource +func (snapshot *Snapshot) deleteValidations() []func() error { + return nil +} + +// updateValidations validates the update of the resource +func (snapshot *Snapshot) updateValidations() []func(old runtime.Object) error { + return []func(old runtime.Object) error{ + func(old runtime.Object) error { + return snapshot.validateResourceReferences() + }, + } +} + +// validateResourceReferences validates all resource references +func (snapshot *Snapshot) validateResourceReferences() error { + refs, err := reflecthelpers.FindResourceReferences(&snapshot.Spec) + if err != nil { + return err + } + return genruntime.ValidateResourceReferences(refs) +} + +// AssignPropertiesFromSnapshot populates our Snapshot from the provided source Snapshot +func (snapshot *Snapshot) AssignPropertiesFromSnapshot(source *v1alpha1api20200930storage.Snapshot) error { + + // ObjectMeta + snapshot.ObjectMeta = *source.ObjectMeta.DeepCopy() + + // Spec + var spec Snapshots_Spec + err := spec.AssignPropertiesFromSnapshotsSpec(&source.Spec) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSnapshotsSpec() to populate field Spec") + } + snapshot.Spec = spec + + // Status + var status Snapshot_Status + err = status.AssignPropertiesFromSnapshotStatus(&source.Status) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSnapshotStatus() to populate field Status") + } + snapshot.Status = status + + // No error + return nil +} + +// AssignPropertiesToSnapshot populates the provided destination Snapshot from our Snapshot +func (snapshot *Snapshot) AssignPropertiesToSnapshot(destination *v1alpha1api20200930storage.Snapshot) error { + + // ObjectMeta + destination.ObjectMeta = *snapshot.ObjectMeta.DeepCopy() + + // Spec + var spec v1alpha1api20200930storage.Snapshots_Spec + err := snapshot.Spec.AssignPropertiesToSnapshotsSpec(&spec) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSnapshotsSpec() to populate field Spec") + } + destination.Spec = spec + + // Status + var status v1alpha1api20200930storage.Snapshot_Status + err = snapshot.Status.AssignPropertiesToSnapshotStatus(&status) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSnapshotStatus() to populate field Status") + } + destination.Status = status + + // No error + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (snapshot *Snapshot) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: snapshot.Spec.OriginalVersion(), + Kind: "Snapshot", + } +} + +// +kubebuilder:object:root=true +//Generated from: https://schema.management.azure.com/schemas/2020-09-30/Microsoft.Compute.json#/resourceDefinitions/snapshots +type SnapshotList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Snapshot `json:"items"` +} + +type Snapshot_Status struct { + //Conditions: The observed state of the resource + Conditions []conditions.Condition `json:"conditions,omitempty"` + + //CreationData: Disk source information. CreationData information cannot be + //changed after the disk has been created. + CreationData *CreationData_Status `json:"creationData,omitempty"` + + //DiskAccessId: ARM id of the DiskAccess resource for using private endpoints on + //disks. + DiskAccessId *string `json:"diskAccessId,omitempty"` + + //DiskSizeBytes: The size of the disk in bytes. This field is read only. + DiskSizeBytes *int `json:"diskSizeBytes,omitempty"` + + //DiskSizeGB: If creationData.createOption is Empty, this field is mandatory and + //it indicates the size of the disk to create. If this field is present for + //updates or creation with other options, it indicates a resize. Resizes are only + //allowed if the disk is not attached to a running VM, and can only increase the + //disk's size. + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + //DiskState: The state of the snapshot. + DiskState *DiskState_Status `json:"diskState,omitempty"` + + //Encryption: Encryption property can be used to encrypt data at rest with + //customer managed keys or platform managed keys. + Encryption *Encryption_Status `json:"encryption,omitempty"` + + //EncryptionSettingsCollection: Encryption settings collection used be Azure Disk + //Encryption, can contain multiple encryption settings per disk or snapshot. + EncryptionSettingsCollection *EncryptionSettingsCollection_Status `json:"encryptionSettingsCollection,omitempty"` + + //ExtendedLocation: The extended location where the snapshot will be created. + //Extended location cannot be changed. + ExtendedLocation *ExtendedLocation_Status `json:"extendedLocation,omitempty"` + + //HyperVGeneration: The hypervisor generation of the Virtual Machine. Applicable + //to OS disks only. + HyperVGeneration *SnapshotPropertiesStatusHyperVGeneration `json:"hyperVGeneration,omitempty"` + + //Id: Resource Id + Id *string `json:"id,omitempty"` + + //Incremental: Whether a snapshot is incremental. Incremental snapshots on the + //same disk occupy less space than full snapshots and can be diffed. + Incremental *bool `json:"incremental,omitempty"` + + //Location: Resource location + Location *string `json:"location,omitempty"` + + //ManagedBy: Unused. Always Null. + ManagedBy *string `json:"managedBy,omitempty"` + + //Name: Resource name + Name *string `json:"name,omitempty"` + NetworkAccessPolicy *NetworkAccessPolicy_Status `json:"networkAccessPolicy,omitempty"` + + //OsType: The Operating System type. + OsType *SnapshotPropertiesStatusOsType `json:"osType,omitempty"` + + //ProvisioningState: The disk provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + + //PurchasePlan: Purchase plan information for the image from which the source disk + //for the snapshot was originally created. + PurchasePlan *PurchasePlan_Status `json:"purchasePlan,omitempty"` + Sku *SnapshotSku_Status `json:"sku,omitempty"` + + //Tags: Resource tags + Tags map[string]string `json:"tags,omitempty"` + + //TimeCreated: The time when the snapshot was created. + TimeCreated *string `json:"timeCreated,omitempty"` + + //Type: Resource type + Type *string `json:"type,omitempty"` + + //UniqueId: Unique Guid identifying the resource. + UniqueId *string `json:"uniqueId,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &Snapshot_Status{} + +// ConvertStatusFrom populates our Snapshot_Status from the provided source +func (snapshot *Snapshot_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + src, ok := source.(*v1alpha1api20200930storage.Snapshot_Status) + if ok { + // Populate our instance from source + return snapshot.AssignPropertiesFromSnapshotStatus(src) + } + + // Convert to an intermediate form + src = &v1alpha1api20200930storage.Snapshot_Status{} + err := src.ConvertStatusFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusFrom()") + } + + // Update our instance from src + err = snapshot.AssignPropertiesFromSnapshotStatus(src) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertStatusFrom()") + } + + return nil +} + +// ConvertStatusTo populates the provided destination from our Snapshot_Status +func (snapshot *Snapshot_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + dst, ok := destination.(*v1alpha1api20200930storage.Snapshot_Status) + if ok { + // Populate destination from our instance + return snapshot.AssignPropertiesToSnapshotStatus(dst) + } + + // Convert to an intermediate form + dst = &v1alpha1api20200930storage.Snapshot_Status{} + err := snapshot.AssignPropertiesToSnapshotStatus(dst) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusTo()") + } + + // Update dst from our instance + err = dst.ConvertStatusTo(destination) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertStatusTo()") + } + + return nil +} + +var _ genruntime.FromARMConverter = &Snapshot_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (snapshot *Snapshot_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &Snapshot_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (snapshot *Snapshot_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(Snapshot_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Snapshot_StatusARM, got %T", armInput) + } + + // no assignment for property ‘Conditions’ + + // Set property ‘CreationData’: + // copying flattened property: + if typedInput.Properties != nil { + var temp CreationData_Status + var temp1 CreationData_Status + err := temp1.PopulateFromARM(owner, typedInput.Properties.CreationData) + if err != nil { + return err + } + temp = temp1 + snapshot.CreationData = &temp + } + + // Set property ‘DiskAccessId’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.DiskAccessId != nil { + diskAccessId := *typedInput.Properties.DiskAccessId + snapshot.DiskAccessId = &diskAccessId + } + } + + // Set property ‘DiskSizeBytes’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.DiskSizeBytes != nil { + diskSizeBytes := *typedInput.Properties.DiskSizeBytes + snapshot.DiskSizeBytes = &diskSizeBytes + } + } + + // Set property ‘DiskSizeGB’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.DiskSizeGB != nil { + diskSizeGB := *typedInput.Properties.DiskSizeGB + snapshot.DiskSizeGB = &diskSizeGB + } + } + + // Set property ‘DiskState’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.DiskState != nil { + diskState := *typedInput.Properties.DiskState + snapshot.DiskState = &diskState + } + } + + // Set property ‘Encryption’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Encryption != nil { + var encryption1 Encryption_Status + err := encryption1.PopulateFromARM(owner, *typedInput.Properties.Encryption) + if err != nil { + return err + } + encryption := encryption1 + snapshot.Encryption = &encryption + } + } + + // Set property ‘EncryptionSettingsCollection’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.EncryptionSettingsCollection != nil { + var encryptionSettingsCollection1 EncryptionSettingsCollection_Status + err := encryptionSettingsCollection1.PopulateFromARM(owner, *typedInput.Properties.EncryptionSettingsCollection) + if err != nil { + return err + } + encryptionSettingsCollection := encryptionSettingsCollection1 + snapshot.EncryptionSettingsCollection = &encryptionSettingsCollection + } + } + + // Set property ‘ExtendedLocation’: + if typedInput.ExtendedLocation != nil { + var extendedLocation1 ExtendedLocation_Status + err := extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation) + if err != nil { + return err + } + extendedLocation := extendedLocation1 + snapshot.ExtendedLocation = &extendedLocation + } + + // Set property ‘HyperVGeneration’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.HyperVGeneration != nil { + hyperVGeneration := *typedInput.Properties.HyperVGeneration + snapshot.HyperVGeneration = &hyperVGeneration + } + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + snapshot.Id = &id + } + + // Set property ‘Incremental’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.Incremental != nil { + incremental := *typedInput.Properties.Incremental + snapshot.Incremental = &incremental + } + } + + // Set property ‘Location’: + if typedInput.Location != nil { + location := *typedInput.Location + snapshot.Location = &location + } + + // Set property ‘ManagedBy’: + if typedInput.ManagedBy != nil { + managedBy := *typedInput.ManagedBy + snapshot.ManagedBy = &managedBy + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + snapshot.Name = &name + } + + // Set property ‘NetworkAccessPolicy’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.NetworkAccessPolicy != nil { + networkAccessPolicy := *typedInput.Properties.NetworkAccessPolicy + snapshot.NetworkAccessPolicy = &networkAccessPolicy + } + } + + // Set property ‘OsType’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.OsType != nil { + osType := *typedInput.Properties.OsType + snapshot.OsType = &osType + } + } + + // Set property ‘ProvisioningState’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ProvisioningState != nil { + provisioningState := *typedInput.Properties.ProvisioningState + snapshot.ProvisioningState = &provisioningState + } + } + + // Set property ‘PurchasePlan’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.PurchasePlan != nil { + var purchasePlan1 PurchasePlan_Status + err := purchasePlan1.PopulateFromARM(owner, *typedInput.Properties.PurchasePlan) + if err != nil { + return err + } + purchasePlan := purchasePlan1 + snapshot.PurchasePlan = &purchasePlan + } + } + + // Set property ‘Sku’: + if typedInput.Sku != nil { + var sku1 SnapshotSku_Status + err := sku1.PopulateFromARM(owner, *typedInput.Sku) + if err != nil { + return err + } + sku := sku1 + snapshot.Sku = &sku + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + snapshot.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + snapshot.Tags[key] = value + } + } + + // Set property ‘TimeCreated’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.TimeCreated != nil { + timeCreated := *typedInput.Properties.TimeCreated + snapshot.TimeCreated = &timeCreated + } + } + + // Set property ‘Type’: + if typedInput.Type != nil { + typeVar := *typedInput.Type + snapshot.Type = &typeVar + } + + // Set property ‘UniqueId’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.UniqueId != nil { + uniqueId := *typedInput.Properties.UniqueId + snapshot.UniqueId = &uniqueId + } + } + + // No error + return nil +} + +// AssignPropertiesFromSnapshotStatus populates our Snapshot_Status from the provided source Snapshot_Status +func (snapshot *Snapshot_Status) AssignPropertiesFromSnapshotStatus(source *v1alpha1api20200930storage.Snapshot_Status) error { + + // Conditions + snapshot.Conditions = genruntime.CloneSliceOfCondition(source.Conditions) + + // CreationData + if source.CreationData != nil { + var creationDatum CreationData_Status + err := creationDatum.AssignPropertiesFromCreationDataStatus(source.CreationData) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromCreationDataStatus() to populate field CreationData") + } + snapshot.CreationData = &creationDatum + } else { + snapshot.CreationData = nil + } + + // DiskAccessId + snapshot.DiskAccessId = genruntime.ClonePointerToString(source.DiskAccessId) + + // DiskSizeBytes + snapshot.DiskSizeBytes = genruntime.ClonePointerToInt(source.DiskSizeBytes) + + // DiskSizeGB + snapshot.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB) + + // DiskState + if source.DiskState != nil { + diskState := DiskState_Status(*source.DiskState) + snapshot.DiskState = &diskState + } else { + snapshot.DiskState = nil + } + + // Encryption + if source.Encryption != nil { + var encryption Encryption_Status + err := encryption.AssignPropertiesFromEncryptionStatus(source.Encryption) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromEncryptionStatus() to populate field Encryption") + } + snapshot.Encryption = &encryption + } else { + snapshot.Encryption = nil + } + + // EncryptionSettingsCollection + if source.EncryptionSettingsCollection != nil { + var encryptionSettingsCollection EncryptionSettingsCollection_Status + err := encryptionSettingsCollection.AssignPropertiesFromEncryptionSettingsCollectionStatus(source.EncryptionSettingsCollection) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromEncryptionSettingsCollectionStatus() to populate field EncryptionSettingsCollection") + } + snapshot.EncryptionSettingsCollection = &encryptionSettingsCollection + } else { + snapshot.EncryptionSettingsCollection = nil + } + + // ExtendedLocation + if source.ExtendedLocation != nil { + var extendedLocation ExtendedLocation_Status + err := extendedLocation.AssignPropertiesFromExtendedLocationStatus(source.ExtendedLocation) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromExtendedLocationStatus() to populate field ExtendedLocation") + } + snapshot.ExtendedLocation = &extendedLocation + } else { + snapshot.ExtendedLocation = nil + } + + // HyperVGeneration + if source.HyperVGeneration != nil { + hyperVGeneration := SnapshotPropertiesStatusHyperVGeneration(*source.HyperVGeneration) + snapshot.HyperVGeneration = &hyperVGeneration + } else { + snapshot.HyperVGeneration = nil + } + + // Id + snapshot.Id = genruntime.ClonePointerToString(source.Id) + + // Incremental + if source.Incremental != nil { + incremental := *source.Incremental + snapshot.Incremental = &incremental + } else { + snapshot.Incremental = nil + } + + // Location + snapshot.Location = genruntime.ClonePointerToString(source.Location) + + // ManagedBy + snapshot.ManagedBy = genruntime.ClonePointerToString(source.ManagedBy) + + // Name + snapshot.Name = genruntime.ClonePointerToString(source.Name) + + // NetworkAccessPolicy + if source.NetworkAccessPolicy != nil { + networkAccessPolicy := NetworkAccessPolicy_Status(*source.NetworkAccessPolicy) + snapshot.NetworkAccessPolicy = &networkAccessPolicy + } else { + snapshot.NetworkAccessPolicy = nil + } + + // OsType + if source.OsType != nil { + osType := SnapshotPropertiesStatusOsType(*source.OsType) + snapshot.OsType = &osType + } else { + snapshot.OsType = nil + } + + // ProvisioningState + snapshot.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState) + + // PurchasePlan + if source.PurchasePlan != nil { + var purchasePlan PurchasePlan_Status + err := purchasePlan.AssignPropertiesFromPurchasePlanStatus(source.PurchasePlan) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromPurchasePlanStatus() to populate field PurchasePlan") + } + snapshot.PurchasePlan = &purchasePlan + } else { + snapshot.PurchasePlan = nil + } + + // Sku + if source.Sku != nil { + var sku SnapshotSku_Status + err := sku.AssignPropertiesFromSnapshotSkuStatus(source.Sku) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSnapshotSkuStatus() to populate field Sku") + } + snapshot.Sku = &sku + } else { + snapshot.Sku = nil + } + + // Tags + snapshot.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // TimeCreated + snapshot.TimeCreated = genruntime.ClonePointerToString(source.TimeCreated) + + // Type + snapshot.Type = genruntime.ClonePointerToString(source.Type) + + // UniqueId + snapshot.UniqueId = genruntime.ClonePointerToString(source.UniqueId) + + // No error + return nil +} + +// AssignPropertiesToSnapshotStatus populates the provided destination Snapshot_Status from our Snapshot_Status +func (snapshot *Snapshot_Status) AssignPropertiesToSnapshotStatus(destination *v1alpha1api20200930storage.Snapshot_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Conditions + destination.Conditions = genruntime.CloneSliceOfCondition(snapshot.Conditions) + + // CreationData + if snapshot.CreationData != nil { + var creationDatum v1alpha1api20200930storage.CreationData_Status + err := snapshot.CreationData.AssignPropertiesToCreationDataStatus(&creationDatum) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToCreationDataStatus() to populate field CreationData") + } + destination.CreationData = &creationDatum + } else { + destination.CreationData = nil + } + + // DiskAccessId + destination.DiskAccessId = genruntime.ClonePointerToString(snapshot.DiskAccessId) + + // DiskSizeBytes + destination.DiskSizeBytes = genruntime.ClonePointerToInt(snapshot.DiskSizeBytes) + + // DiskSizeGB + destination.DiskSizeGB = genruntime.ClonePointerToInt(snapshot.DiskSizeGB) + + // DiskState + if snapshot.DiskState != nil { + diskState := string(*snapshot.DiskState) + destination.DiskState = &diskState + } else { + destination.DiskState = nil + } + + // Encryption + if snapshot.Encryption != nil { + var encryption v1alpha1api20200930storage.Encryption_Status + err := snapshot.Encryption.AssignPropertiesToEncryptionStatus(&encryption) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToEncryptionStatus() to populate field Encryption") + } + destination.Encryption = &encryption + } else { + destination.Encryption = nil + } + + // EncryptionSettingsCollection + if snapshot.EncryptionSettingsCollection != nil { + var encryptionSettingsCollection v1alpha1api20200930storage.EncryptionSettingsCollection_Status + err := snapshot.EncryptionSettingsCollection.AssignPropertiesToEncryptionSettingsCollectionStatus(&encryptionSettingsCollection) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToEncryptionSettingsCollectionStatus() to populate field EncryptionSettingsCollection") + } + destination.EncryptionSettingsCollection = &encryptionSettingsCollection + } else { + destination.EncryptionSettingsCollection = nil + } + + // ExtendedLocation + if snapshot.ExtendedLocation != nil { + var extendedLocation v1alpha1api20200930storage.ExtendedLocation_Status + err := snapshot.ExtendedLocation.AssignPropertiesToExtendedLocationStatus(&extendedLocation) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToExtendedLocationStatus() to populate field ExtendedLocation") + } + destination.ExtendedLocation = &extendedLocation + } else { + destination.ExtendedLocation = nil + } + + // HyperVGeneration + if snapshot.HyperVGeneration != nil { + hyperVGeneration := string(*snapshot.HyperVGeneration) + destination.HyperVGeneration = &hyperVGeneration + } else { + destination.HyperVGeneration = nil + } + + // Id + destination.Id = genruntime.ClonePointerToString(snapshot.Id) + + // Incremental + if snapshot.Incremental != nil { + incremental := *snapshot.Incremental + destination.Incremental = &incremental + } else { + destination.Incremental = nil + } + + // Location + destination.Location = genruntime.ClonePointerToString(snapshot.Location) + + // ManagedBy + destination.ManagedBy = genruntime.ClonePointerToString(snapshot.ManagedBy) + + // Name + destination.Name = genruntime.ClonePointerToString(snapshot.Name) + + // NetworkAccessPolicy + if snapshot.NetworkAccessPolicy != nil { + networkAccessPolicy := string(*snapshot.NetworkAccessPolicy) + destination.NetworkAccessPolicy = &networkAccessPolicy + } else { + destination.NetworkAccessPolicy = nil + } + + // OsType + if snapshot.OsType != nil { + osType := string(*snapshot.OsType) + destination.OsType = &osType + } else { + destination.OsType = nil + } + + // ProvisioningState + destination.ProvisioningState = genruntime.ClonePointerToString(snapshot.ProvisioningState) + + // PurchasePlan + if snapshot.PurchasePlan != nil { + var purchasePlan v1alpha1api20200930storage.PurchasePlan_Status + err := snapshot.PurchasePlan.AssignPropertiesToPurchasePlanStatus(&purchasePlan) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToPurchasePlanStatus() to populate field PurchasePlan") + } + destination.PurchasePlan = &purchasePlan + } else { + destination.PurchasePlan = nil + } + + // Sku + if snapshot.Sku != nil { + var sku v1alpha1api20200930storage.SnapshotSku_Status + err := snapshot.Sku.AssignPropertiesToSnapshotSkuStatus(&sku) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSnapshotSkuStatus() to populate field Sku") + } + destination.Sku = &sku + } else { + destination.Sku = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(snapshot.Tags) + + // TimeCreated + destination.TimeCreated = genruntime.ClonePointerToString(snapshot.TimeCreated) + + // Type + destination.Type = genruntime.ClonePointerToString(snapshot.Type) + + // UniqueId + destination.UniqueId = genruntime.ClonePointerToString(snapshot.UniqueId) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={"2020-09-30"} +type SnapshotsSpecAPIVersion string + +const SnapshotsSpecAPIVersion20200930 = SnapshotsSpecAPIVersion("2020-09-30") + +type Snapshots_Spec struct { + //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"` + + // +kubebuilder:validation:Required + //CreationData: Data used when creating a disk. + CreationData CreationData `json:"creationData"` + + //DiskAccessReference: ARM id of the DiskAccess resource for using private + //endpoints on disks. + DiskAccessReference *genruntime.ResourceReference `armReference:"DiskAccessId" json:"diskAccessReference,omitempty"` + + //DiskSizeGB: If creationData.createOption is Empty, this field is mandatory and + //it indicates the size of the disk to create. If this field is present for + //updates or creation with other options, it indicates a resize. Resizes are only + //allowed if the disk is not attached to a running VM, and can only increase the + //disk's size. + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + //DiskState: The state of the snapshot. + DiskState *SnapshotPropertiesDiskState `json:"diskState,omitempty"` + + //Encryption: Encryption at rest settings for disk or snapshot + Encryption *Encryption `json:"encryption,omitempty"` + + //EncryptionSettingsCollection: Encryption settings for disk or snapshot + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + + //ExtendedLocation: The complex type of the extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + //HyperVGeneration: The hypervisor generation of the Virtual Machine. Applicable + //to OS disks only. + HyperVGeneration *SnapshotPropertiesHyperVGeneration `json:"hyperVGeneration,omitempty"` + + //Incremental: Whether a snapshot is incremental. Incremental snapshots on the + //same disk occupy less space than full snapshots and can be diffed. + Incremental *bool `json:"incremental,omitempty"` + + //Location: Location to deploy resource to + Location string `json:"location,omitempty"` + NetworkAccessPolicy *SnapshotPropertiesNetworkAccessPolicy `json:"networkAccessPolicy,omitempty"` + + //OsType: The Operating System type. + OsType *SnapshotPropertiesOsType `json:"osType,omitempty"` + + // +kubebuilder:validation:Required + Owner genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner" kind:"ResourceGroup"` + + //PurchasePlan: Used for establishing the purchase context of any 3rd Party + //artifact through MarketPlace. + PurchasePlan *PurchasePlan `json:"purchasePlan,omitempty"` + + //Sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + //This is an optional parameter for incremental snapshot and the default behavior + //is the SKU will be set to the same sku as the previous snapshot + Sku *SnapshotSku `json:"sku,omitempty"` + + //Tags: Name-value pairs to add to the resource + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMTransformer = &Snapshots_Spec{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (snapshots *Snapshots_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if snapshots == nil { + return nil, nil + } + var result Snapshots_SpecARM + + // Set property ‘ExtendedLocation’: + if snapshots.ExtendedLocation != nil { + extendedLocationARM, err := (*snapshots.ExtendedLocation).ConvertToARM(resolved) + if err != nil { + return nil, err + } + extendedLocation := extendedLocationARM.(ExtendedLocationARM) + result.ExtendedLocation = &extendedLocation + } + + // Set property ‘Location’: + result.Location = snapshots.Location + + // Set property ‘Name’: + result.Name = resolved.Name + + // Set property ‘Properties’: + creationDataARM, err := snapshots.CreationData.ConvertToARM(resolved) + if err != nil { + return nil, err + } + result.Properties.CreationData = creationDataARM.(CreationDataARM) + if snapshots.DiskAccessReference != nil { + diskAccessIdARMID, err := resolved.ResolvedReferences.ARMIDOrErr(*snapshots.DiskAccessReference) + if err != nil { + return nil, err + } + diskAccessId := diskAccessIdARMID + result.Properties.DiskAccessId = &diskAccessId + } + if snapshots.DiskSizeGB != nil { + diskSizeGB := *snapshots.DiskSizeGB + result.Properties.DiskSizeGB = &diskSizeGB + } + if snapshots.DiskState != nil { + diskState := *snapshots.DiskState + result.Properties.DiskState = &diskState + } + if snapshots.Encryption != nil { + encryptionARM, err := (*snapshots.Encryption).ConvertToARM(resolved) + if err != nil { + return nil, err + } + encryption := encryptionARM.(EncryptionARM) + result.Properties.Encryption = &encryption + } + if snapshots.EncryptionSettingsCollection != nil { + encryptionSettingsCollectionARM, err := (*snapshots.EncryptionSettingsCollection).ConvertToARM(resolved) + if err != nil { + return nil, err + } + encryptionSettingsCollection := encryptionSettingsCollectionARM.(EncryptionSettingsCollectionARM) + result.Properties.EncryptionSettingsCollection = &encryptionSettingsCollection + } + if snapshots.HyperVGeneration != nil { + hyperVGeneration := *snapshots.HyperVGeneration + result.Properties.HyperVGeneration = &hyperVGeneration + } + if snapshots.Incremental != nil { + incremental := *snapshots.Incremental + result.Properties.Incremental = &incremental + } + if snapshots.NetworkAccessPolicy != nil { + networkAccessPolicy := *snapshots.NetworkAccessPolicy + result.Properties.NetworkAccessPolicy = &networkAccessPolicy + } + if snapshots.OsType != nil { + osType := *snapshots.OsType + result.Properties.OsType = &osType + } + if snapshots.PurchasePlan != nil { + purchasePlanARM, err := (*snapshots.PurchasePlan).ConvertToARM(resolved) + if err != nil { + return nil, err + } + purchasePlan := purchasePlanARM.(PurchasePlanARM) + result.Properties.PurchasePlan = &purchasePlan + } + + // Set property ‘Sku’: + if snapshots.Sku != nil { + skuARM, err := (*snapshots.Sku).ConvertToARM(resolved) + if err != nil { + return nil, err + } + sku := skuARM.(SnapshotSkuARM) + result.Sku = &sku + } + + // Set property ‘Tags’: + if snapshots.Tags != nil { + result.Tags = make(map[string]string) + for key, value := range snapshots.Tags { + result.Tags[key] = value + } + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (snapshots *Snapshots_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &Snapshots_SpecARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (snapshots *Snapshots_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(Snapshots_SpecARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Snapshots_SpecARM, got %T", armInput) + } + + // Set property ‘AzureName’: + snapshots.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name)) + + // Set property ‘CreationData’: + // copying flattened property: + var creationData CreationData + err := creationData.PopulateFromARM(owner, typedInput.Properties.CreationData) + if err != nil { + return err + } + snapshots.CreationData = creationData + + // no assignment for property ‘DiskAccessReference’ + + // Set property ‘DiskSizeGB’: + // copying flattened property: + if typedInput.Properties.DiskSizeGB != nil { + diskSizeGB := *typedInput.Properties.DiskSizeGB + snapshots.DiskSizeGB = &diskSizeGB + } + + // Set property ‘DiskState’: + // copying flattened property: + if typedInput.Properties.DiskState != nil { + diskState := *typedInput.Properties.DiskState + snapshots.DiskState = &diskState + } + + // Set property ‘Encryption’: + // copying flattened property: + if typedInput.Properties.Encryption != nil { + var encryption1 Encryption + err = encryption1.PopulateFromARM(owner, *typedInput.Properties.Encryption) + if err != nil { + return err + } + encryption := encryption1 + snapshots.Encryption = &encryption + } + + // Set property ‘EncryptionSettingsCollection’: + // copying flattened property: + if typedInput.Properties.EncryptionSettingsCollection != nil { + var encryptionSettingsCollection1 EncryptionSettingsCollection + err = encryptionSettingsCollection1.PopulateFromARM(owner, *typedInput.Properties.EncryptionSettingsCollection) + if err != nil { + return err + } + encryptionSettingsCollection := encryptionSettingsCollection1 + snapshots.EncryptionSettingsCollection = &encryptionSettingsCollection + } + + // Set property ‘ExtendedLocation’: + if typedInput.ExtendedLocation != nil { + var extendedLocation1 ExtendedLocation + err = extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation) + if err != nil { + return err + } + extendedLocation := extendedLocation1 + snapshots.ExtendedLocation = &extendedLocation + } + + // Set property ‘HyperVGeneration’: + // copying flattened property: + if typedInput.Properties.HyperVGeneration != nil { + hyperVGeneration := *typedInput.Properties.HyperVGeneration + snapshots.HyperVGeneration = &hyperVGeneration + } + + // Set property ‘Incremental’: + // copying flattened property: + if typedInput.Properties.Incremental != nil { + incremental := *typedInput.Properties.Incremental + snapshots.Incremental = &incremental + } + + // Set property ‘Location’: + snapshots.Location = typedInput.Location + + // Set property ‘NetworkAccessPolicy’: + // copying flattened property: + if typedInput.Properties.NetworkAccessPolicy != nil { + networkAccessPolicy := *typedInput.Properties.NetworkAccessPolicy + snapshots.NetworkAccessPolicy = &networkAccessPolicy + } + + // Set property ‘OsType’: + // copying flattened property: + if typedInput.Properties.OsType != nil { + osType := *typedInput.Properties.OsType + snapshots.OsType = &osType + } + + // Set property ‘Owner’: + snapshots.Owner = genruntime.KnownResourceReference{ + Name: owner.Name, + } + + // Set property ‘PurchasePlan’: + // copying flattened property: + if typedInput.Properties.PurchasePlan != nil { + var purchasePlan1 PurchasePlan + err = purchasePlan1.PopulateFromARM(owner, *typedInput.Properties.PurchasePlan) + if err != nil { + return err + } + purchasePlan := purchasePlan1 + snapshots.PurchasePlan = &purchasePlan + } + + // Set property ‘Sku’: + if typedInput.Sku != nil { + var sku1 SnapshotSku + err = sku1.PopulateFromARM(owner, *typedInput.Sku) + if err != nil { + return err + } + sku := sku1 + snapshots.Sku = &sku + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + snapshots.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + snapshots.Tags[key] = value + } + } + + // No error + return nil +} + +var _ genruntime.ConvertibleSpec = &Snapshots_Spec{} + +// ConvertSpecFrom populates our Snapshots_Spec from the provided source +func (snapshots *Snapshots_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + src, ok := source.(*v1alpha1api20200930storage.Snapshots_Spec) + if ok { + // Populate our instance from source + return snapshots.AssignPropertiesFromSnapshotsSpec(src) + } + + // Convert to an intermediate form + src = &v1alpha1api20200930storage.Snapshots_Spec{} + err := src.ConvertSpecFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertSpecFrom()") + } + + // Update our instance from src + err = snapshots.AssignPropertiesFromSnapshotsSpec(src) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertSpecFrom()") + } + + return nil +} + +// ConvertSpecTo populates the provided destination from our Snapshots_Spec +func (snapshots *Snapshots_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + dst, ok := destination.(*v1alpha1api20200930storage.Snapshots_Spec) + if ok { + // Populate destination from our instance + return snapshots.AssignPropertiesToSnapshotsSpec(dst) + } + + // Convert to an intermediate form + dst = &v1alpha1api20200930storage.Snapshots_Spec{} + err := snapshots.AssignPropertiesToSnapshotsSpec(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 +} + +// AssignPropertiesFromSnapshotsSpec populates our Snapshots_Spec from the provided source Snapshots_Spec +func (snapshots *Snapshots_Spec) AssignPropertiesFromSnapshotsSpec(source *v1alpha1api20200930storage.Snapshots_Spec) error { + + // AzureName + snapshots.AzureName = source.AzureName + + // CreationData + if source.CreationData != nil { + var creationDatum CreationData + err := creationDatum.AssignPropertiesFromCreationData(source.CreationData) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromCreationData() to populate field CreationData") + } + snapshots.CreationData = creationDatum + } else { + snapshots.CreationData = CreationData{} + } + + // DiskAccessReference + if source.DiskAccessReference != nil { + diskAccessReference := source.DiskAccessReference.Copy() + snapshots.DiskAccessReference = &diskAccessReference + } else { + snapshots.DiskAccessReference = nil + } + + // DiskSizeGB + snapshots.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB) + + // DiskState + if source.DiskState != nil { + diskState := SnapshotPropertiesDiskState(*source.DiskState) + snapshots.DiskState = &diskState + } else { + snapshots.DiskState = nil + } + + // Encryption + if source.Encryption != nil { + var encryption Encryption + err := encryption.AssignPropertiesFromEncryption(source.Encryption) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromEncryption() to populate field Encryption") + } + snapshots.Encryption = &encryption + } else { + snapshots.Encryption = nil + } + + // EncryptionSettingsCollection + if source.EncryptionSettingsCollection != nil { + var encryptionSettingsCollection EncryptionSettingsCollection + err := encryptionSettingsCollection.AssignPropertiesFromEncryptionSettingsCollection(source.EncryptionSettingsCollection) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromEncryptionSettingsCollection() to populate field EncryptionSettingsCollection") + } + snapshots.EncryptionSettingsCollection = &encryptionSettingsCollection + } else { + snapshots.EncryptionSettingsCollection = nil + } + + // ExtendedLocation + if source.ExtendedLocation != nil { + var extendedLocation ExtendedLocation + err := extendedLocation.AssignPropertiesFromExtendedLocation(source.ExtendedLocation) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromExtendedLocation() to populate field ExtendedLocation") + } + snapshots.ExtendedLocation = &extendedLocation + } else { + snapshots.ExtendedLocation = nil + } + + // HyperVGeneration + if source.HyperVGeneration != nil { + hyperVGeneration := SnapshotPropertiesHyperVGeneration(*source.HyperVGeneration) + snapshots.HyperVGeneration = &hyperVGeneration + } else { + snapshots.HyperVGeneration = nil + } + + // Incremental + if source.Incremental != nil { + incremental := *source.Incremental + snapshots.Incremental = &incremental + } else { + snapshots.Incremental = nil + } + + // Location + snapshots.Location = genruntime.GetOptionalStringValue(source.Location) + + // NetworkAccessPolicy + if source.NetworkAccessPolicy != nil { + networkAccessPolicy := SnapshotPropertiesNetworkAccessPolicy(*source.NetworkAccessPolicy) + snapshots.NetworkAccessPolicy = &networkAccessPolicy + } else { + snapshots.NetworkAccessPolicy = nil + } + + // OsType + if source.OsType != nil { + osType := SnapshotPropertiesOsType(*source.OsType) + snapshots.OsType = &osType + } else { + snapshots.OsType = nil + } + + // Owner + snapshots.Owner = source.Owner.Copy() + + // PurchasePlan + if source.PurchasePlan != nil { + var purchasePlan PurchasePlan + err := purchasePlan.AssignPropertiesFromPurchasePlan(source.PurchasePlan) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromPurchasePlan() to populate field PurchasePlan") + } + snapshots.PurchasePlan = &purchasePlan + } else { + snapshots.PurchasePlan = nil + } + + // Sku + if source.Sku != nil { + var sku SnapshotSku + err := sku.AssignPropertiesFromSnapshotSku(source.Sku) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSnapshotSku() to populate field Sku") + } + snapshots.Sku = &sku + } else { + snapshots.Sku = nil + } + + // Tags + snapshots.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // No error + return nil +} + +// AssignPropertiesToSnapshotsSpec populates the provided destination Snapshots_Spec from our Snapshots_Spec +func (snapshots *Snapshots_Spec) AssignPropertiesToSnapshotsSpec(destination *v1alpha1api20200930storage.Snapshots_Spec) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AzureName + destination.AzureName = snapshots.AzureName + + // CreationData + var creationDatum v1alpha1api20200930storage.CreationData + err := snapshots.CreationData.AssignPropertiesToCreationData(&creationDatum) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToCreationData() to populate field CreationData") + } + destination.CreationData = &creationDatum + + // DiskAccessReference + if snapshots.DiskAccessReference != nil { + diskAccessReference := snapshots.DiskAccessReference.Copy() + destination.DiskAccessReference = &diskAccessReference + } else { + destination.DiskAccessReference = nil + } + + // DiskSizeGB + destination.DiskSizeGB = genruntime.ClonePointerToInt(snapshots.DiskSizeGB) + + // DiskState + if snapshots.DiskState != nil { + diskState := string(*snapshots.DiskState) + destination.DiskState = &diskState + } else { + destination.DiskState = nil + } + + // Encryption + if snapshots.Encryption != nil { + var encryption v1alpha1api20200930storage.Encryption + err = snapshots.Encryption.AssignPropertiesToEncryption(&encryption) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToEncryption() to populate field Encryption") + } + destination.Encryption = &encryption + } else { + destination.Encryption = nil + } + + // EncryptionSettingsCollection + if snapshots.EncryptionSettingsCollection != nil { + var encryptionSettingsCollection v1alpha1api20200930storage.EncryptionSettingsCollection + err = snapshots.EncryptionSettingsCollection.AssignPropertiesToEncryptionSettingsCollection(&encryptionSettingsCollection) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToEncryptionSettingsCollection() to populate field EncryptionSettingsCollection") + } + destination.EncryptionSettingsCollection = &encryptionSettingsCollection + } else { + destination.EncryptionSettingsCollection = nil + } + + // ExtendedLocation + if snapshots.ExtendedLocation != nil { + var extendedLocation v1alpha1api20200930storage.ExtendedLocation + err = snapshots.ExtendedLocation.AssignPropertiesToExtendedLocation(&extendedLocation) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToExtendedLocation() to populate field ExtendedLocation") + } + destination.ExtendedLocation = &extendedLocation + } else { + destination.ExtendedLocation = nil + } + + // HyperVGeneration + if snapshots.HyperVGeneration != nil { + hyperVGeneration := string(*snapshots.HyperVGeneration) + destination.HyperVGeneration = &hyperVGeneration + } else { + destination.HyperVGeneration = nil + } + + // Incremental + if snapshots.Incremental != nil { + incremental := *snapshots.Incremental + destination.Incremental = &incremental + } else { + destination.Incremental = nil + } + + // Location + location := snapshots.Location + destination.Location = &location + + // NetworkAccessPolicy + if snapshots.NetworkAccessPolicy != nil { + networkAccessPolicy := string(*snapshots.NetworkAccessPolicy) + destination.NetworkAccessPolicy = &networkAccessPolicy + } else { + destination.NetworkAccessPolicy = nil + } + + // OriginalVersion + destination.OriginalVersion = snapshots.OriginalVersion() + + // OsType + if snapshots.OsType != nil { + osType := string(*snapshots.OsType) + destination.OsType = &osType + } else { + destination.OsType = nil + } + + // Owner + destination.Owner = snapshots.Owner.Copy() + + // PurchasePlan + if snapshots.PurchasePlan != nil { + var purchasePlan v1alpha1api20200930storage.PurchasePlan + err = snapshots.PurchasePlan.AssignPropertiesToPurchasePlan(&purchasePlan) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToPurchasePlan() to populate field PurchasePlan") + } + destination.PurchasePlan = &purchasePlan + } else { + destination.PurchasePlan = nil + } + + // Sku + if snapshots.Sku != nil { + var sku v1alpha1api20200930storage.SnapshotSku + err = snapshots.Sku.AssignPropertiesToSnapshotSku(&sku) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSnapshotSku() to populate field Sku") + } + destination.Sku = &sku + } else { + destination.Sku = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(snapshots.Tags) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// OriginalVersion returns the original API version used to create the resource. +func (snapshots *Snapshots_Spec) OriginalVersion() string { + return GroupVersion.Version +} + +// SetAzureName sets the Azure name of the resource +func (snapshots *Snapshots_Spec) SetAzureName(azureName string) { snapshots.AzureName = azureName } + +// +kubebuilder:validation:Enum={"ActiveSAS","ActiveUpload","Attached","ReadyToUpload","Reserved","Unattached"} +type SnapshotPropertiesDiskState string + +const ( + SnapshotPropertiesDiskStateActiveSAS = SnapshotPropertiesDiskState("ActiveSAS") + SnapshotPropertiesDiskStateActiveUpload = SnapshotPropertiesDiskState("ActiveUpload") + SnapshotPropertiesDiskStateAttached = SnapshotPropertiesDiskState("Attached") + SnapshotPropertiesDiskStateReadyToUpload = SnapshotPropertiesDiskState("ReadyToUpload") + SnapshotPropertiesDiskStateReserved = SnapshotPropertiesDiskState("Reserved") + SnapshotPropertiesDiskStateUnattached = SnapshotPropertiesDiskState("Unattached") +) + +// +kubebuilder:validation:Enum={"V1","V2"} +type SnapshotPropertiesHyperVGeneration string + +const ( + SnapshotPropertiesHyperVGenerationV1 = SnapshotPropertiesHyperVGeneration("V1") + SnapshotPropertiesHyperVGenerationV2 = SnapshotPropertiesHyperVGeneration("V2") +) + +// +kubebuilder:validation:Enum={"AllowAll","AllowPrivate","DenyAll"} +type SnapshotPropertiesNetworkAccessPolicy string + +const ( + SnapshotPropertiesNetworkAccessPolicyAllowAll = SnapshotPropertiesNetworkAccessPolicy("AllowAll") + SnapshotPropertiesNetworkAccessPolicyAllowPrivate = SnapshotPropertiesNetworkAccessPolicy("AllowPrivate") + SnapshotPropertiesNetworkAccessPolicyDenyAll = SnapshotPropertiesNetworkAccessPolicy("DenyAll") +) + +// +kubebuilder:validation:Enum={"Linux","Windows"} +type SnapshotPropertiesOsType string + +const ( + SnapshotPropertiesOsTypeLinux = SnapshotPropertiesOsType("Linux") + SnapshotPropertiesOsTypeWindows = SnapshotPropertiesOsType("Windows") +) + +type SnapshotPropertiesStatusHyperVGeneration string + +const ( + SnapshotPropertiesStatusHyperVGenerationV1 = SnapshotPropertiesStatusHyperVGeneration("V1") + SnapshotPropertiesStatusHyperVGenerationV2 = SnapshotPropertiesStatusHyperVGeneration("V2") +) + +type SnapshotPropertiesStatusOsType string + +const ( + SnapshotPropertiesStatusOsTypeLinux = SnapshotPropertiesStatusOsType("Linux") + SnapshotPropertiesStatusOsTypeWindows = SnapshotPropertiesStatusOsType("Windows") +) + +//Generated from: https://schema.management.azure.com/schemas/2020-09-30/Microsoft.Compute.json#/definitions/SnapshotSku +type SnapshotSku struct { + //Name: The sku name. + Name *SnapshotSkuName `json:"name,omitempty"` +} + +var _ genruntime.ARMTransformer = &SnapshotSku{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (snapshotSku *SnapshotSku) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if snapshotSku == nil { + return nil, nil + } + var result SnapshotSkuARM + + // Set property ‘Name’: + if snapshotSku.Name != nil { + name := *snapshotSku.Name + result.Name = &name + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (snapshotSku *SnapshotSku) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &SnapshotSkuARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (snapshotSku *SnapshotSku) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(SnapshotSkuARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected SnapshotSkuARM, got %T", armInput) + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + snapshotSku.Name = &name + } + + // No error + return nil +} + +// AssignPropertiesFromSnapshotSku populates our SnapshotSku from the provided source SnapshotSku +func (snapshotSku *SnapshotSku) AssignPropertiesFromSnapshotSku(source *v1alpha1api20200930storage.SnapshotSku) error { + + // Name + if source.Name != nil { + name := SnapshotSkuName(*source.Name) + snapshotSku.Name = &name + } else { + snapshotSku.Name = nil + } + + // No error + return nil +} + +// AssignPropertiesToSnapshotSku populates the provided destination SnapshotSku from our SnapshotSku +func (snapshotSku *SnapshotSku) AssignPropertiesToSnapshotSku(destination *v1alpha1api20200930storage.SnapshotSku) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Name + if snapshotSku.Name != nil { + name := string(*snapshotSku.Name) + destination.Name = &name + } else { + destination.Name = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +type SnapshotSku_Status struct { + //Name: The sku name. + Name *SnapshotSkuStatusName `json:"name,omitempty"` + + //Tier: The sku tier. + Tier *string `json:"tier,omitempty"` +} + +var _ genruntime.FromARMConverter = &SnapshotSku_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (snapshotSku *SnapshotSku_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &SnapshotSku_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (snapshotSku *SnapshotSku_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(SnapshotSku_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected SnapshotSku_StatusARM, got %T", armInput) + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + snapshotSku.Name = &name + } + + // Set property ‘Tier’: + if typedInput.Tier != nil { + tier := *typedInput.Tier + snapshotSku.Tier = &tier + } + + // No error + return nil +} + +// AssignPropertiesFromSnapshotSkuStatus populates our SnapshotSku_Status from the provided source SnapshotSku_Status +func (snapshotSku *SnapshotSku_Status) AssignPropertiesFromSnapshotSkuStatus(source *v1alpha1api20200930storage.SnapshotSku_Status) error { + + // Name + if source.Name != nil { + name := SnapshotSkuStatusName(*source.Name) + snapshotSku.Name = &name + } else { + snapshotSku.Name = nil + } + + // Tier + snapshotSku.Tier = genruntime.ClonePointerToString(source.Tier) + + // No error + return nil +} + +// AssignPropertiesToSnapshotSkuStatus populates the provided destination SnapshotSku_Status from our SnapshotSku_Status +func (snapshotSku *SnapshotSku_Status) AssignPropertiesToSnapshotSkuStatus(destination *v1alpha1api20200930storage.SnapshotSku_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Name + if snapshotSku.Name != nil { + name := string(*snapshotSku.Name) + destination.Name = &name + } else { + destination.Name = nil + } + + // Tier + destination.Tier = genruntime.ClonePointerToString(snapshotSku.Tier) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +func init() { + SchemeBuilder.Register(&Snapshot{}, &SnapshotList{}) +} diff --git a/v2/api/compute/v1alpha1api20200930/snapshot_types_gen_test.go b/v2/api/compute/v1alpha1api20200930/snapshot_types_gen_test.go new file mode 100644 index 00000000000..633e52a62c4 --- /dev/null +++ b/v2/api/compute/v1alpha1api20200930/snapshot_types_gen_test.go @@ -0,0 +1,642 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20200930 + +import ( + "encoding/json" + "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20200930storage" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Snapshot_WhenConvertedToHub_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Snapshot to hub returns original", + prop.ForAll(RunResourceConversionTestForSnapshot, SnapshotGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunResourceConversionTestForSnapshot tests if a specific instance of Snapshot round trips to the hub storage version and back losslessly +func RunResourceConversionTestForSnapshot(subject Snapshot) string { + // Copy subject to make sure conversion doesn't modify it + copied := subject.DeepCopy() + + // Convert to our hub version + var hub v1alpha1api20200930storage.Snapshot + err := copied.ConvertTo(&hub) + if err != nil { + return err.Error() + } + + // Convert from our hub version + var actual Snapshot + err = actual.ConvertFrom(&hub) + if err != nil { + return err.Error() + } + + // Compare actual with what we started with + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Snapshot_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Snapshot to Snapshot via AssignPropertiesToSnapshot & AssignPropertiesFromSnapshot returns original", + prop.ForAll(RunPropertyAssignmentTestForSnapshot, SnapshotGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSnapshot tests if a specific instance of Snapshot can be assigned to v1alpha1api20200930storage and back losslessly +func RunPropertyAssignmentTestForSnapshot(subject Snapshot) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20200930storage.Snapshot + err := copied.AssignPropertiesToSnapshot(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Snapshot + err = actual.AssignPropertiesFromSnapshot(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Snapshot_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Snapshot via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshot, SnapshotGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshot runs a test to see if a specific instance of Snapshot round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshot(subject Snapshot) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Snapshot + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Snapshot instances for property testing - lazily instantiated by SnapshotGenerator() +var snapshotGenerator gopter.Gen + +// SnapshotGenerator returns a generator of Snapshot instances for property testing. +func SnapshotGenerator() gopter.Gen { + if snapshotGenerator != nil { + return snapshotGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForSnapshot(generators) + snapshotGenerator = gen.Struct(reflect.TypeOf(Snapshot{}), generators) + + return snapshotGenerator +} + +// AddRelatedPropertyGeneratorsForSnapshot is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshot(gens map[string]gopter.Gen) { + gens["Spec"] = SnapshotsSpecGenerator() + gens["Status"] = SnapshotStatusGenerator() +} + +func Test_Snapshot_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Snapshot_Status to Snapshot_Status via AssignPropertiesToSnapshotStatus & AssignPropertiesFromSnapshotStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForSnapshotStatus, SnapshotStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSnapshotStatus tests if a specific instance of Snapshot_Status can be assigned to v1alpha1api20200930storage and back losslessly +func RunPropertyAssignmentTestForSnapshotStatus(subject Snapshot_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20200930storage.Snapshot_Status + err := copied.AssignPropertiesToSnapshotStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Snapshot_Status + err = actual.AssignPropertiesFromSnapshotStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Snapshot_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Snapshot_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotStatus, SnapshotStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotStatus runs a test to see if a specific instance of Snapshot_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotStatus(subject Snapshot_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Snapshot_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Snapshot_Status instances for property testing - lazily instantiated by SnapshotStatusGenerator() +var snapshotStatusGenerator gopter.Gen + +// SnapshotStatusGenerator returns a generator of Snapshot_Status instances for property testing. +// We first initialize snapshotStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func SnapshotStatusGenerator() gopter.Gen { + if snapshotStatusGenerator != nil { + return snapshotStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotStatus(generators) + snapshotStatusGenerator = gen.Struct(reflect.TypeOf(Snapshot_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotStatus(generators) + AddRelatedPropertyGeneratorsForSnapshotStatus(generators) + snapshotStatusGenerator = gen.Struct(reflect.TypeOf(Snapshot_Status{}), generators) + + return snapshotStatusGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotStatus(gens map[string]gopter.Gen) { + gens["DiskAccessId"] = gen.PtrOf(gen.AlphaString()) + gens["DiskSizeBytes"] = gen.PtrOf(gen.Int()) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["DiskState"] = gen.PtrOf(gen.OneConstOf( + DiskState_StatusActiveSAS, + DiskState_StatusActiveUpload, + DiskState_StatusAttached, + DiskState_StatusReadyToUpload, + DiskState_StatusReserved, + DiskState_StatusUnattached)) + gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesStatusHyperVGenerationV1, SnapshotPropertiesStatusHyperVGenerationV2)) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Incremental"] = gen.PtrOf(gen.Bool()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["ManagedBy"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["NetworkAccessPolicy"] = gen.PtrOf(gen.OneConstOf(NetworkAccessPolicy_StatusAllowAll, NetworkAccessPolicy_StatusAllowPrivate, NetworkAccessPolicy_StatusDenyAll)) + gens["OsType"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesStatusOsTypeLinux, SnapshotPropertiesStatusOsTypeWindows)) + gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) + gens["TimeCreated"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) + gens["UniqueId"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSnapshotStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshotStatus(gens map[string]gopter.Gen) { + gens["CreationData"] = gen.PtrOf(CreationDataStatusGenerator()) + gens["Encryption"] = gen.PtrOf(EncryptionStatusGenerator()) + gens["EncryptionSettingsCollection"] = gen.PtrOf(EncryptionSettingsCollectionStatusGenerator()) + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationStatusGenerator()) + gens["PurchasePlan"] = gen.PtrOf(PurchasePlanStatusGenerator()) + gens["Sku"] = gen.PtrOf(SnapshotSkuStatusGenerator()) +} + +func Test_Snapshots_Spec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Snapshots_Spec to Snapshots_Spec via AssignPropertiesToSnapshotsSpec & AssignPropertiesFromSnapshotsSpec returns original", + prop.ForAll(RunPropertyAssignmentTestForSnapshotsSpec, SnapshotsSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSnapshotsSpec tests if a specific instance of Snapshots_Spec can be assigned to v1alpha1api20200930storage and back losslessly +func RunPropertyAssignmentTestForSnapshotsSpec(subject Snapshots_Spec) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20200930storage.Snapshots_Spec + err := copied.AssignPropertiesToSnapshotsSpec(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Snapshots_Spec + err = actual.AssignPropertiesFromSnapshotsSpec(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Snapshots_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Snapshots_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotsSpec, SnapshotsSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotsSpec runs a test to see if a specific instance of Snapshots_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotsSpec(subject Snapshots_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Snapshots_Spec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Snapshots_Spec instances for property testing - lazily instantiated by SnapshotsSpecGenerator() +var snapshotsSpecGenerator gopter.Gen + +// SnapshotsSpecGenerator returns a generator of Snapshots_Spec instances for property testing. +// We first initialize snapshotsSpecGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func SnapshotsSpecGenerator() gopter.Gen { + if snapshotsSpecGenerator != nil { + return snapshotsSpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotsSpec(generators) + snapshotsSpecGenerator = gen.Struct(reflect.TypeOf(Snapshots_Spec{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotsSpec(generators) + AddRelatedPropertyGeneratorsForSnapshotsSpec(generators) + snapshotsSpecGenerator = gen.Struct(reflect.TypeOf(Snapshots_Spec{}), generators) + + return snapshotsSpecGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotsSpec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotsSpec(gens map[string]gopter.Gen) { + gens["AzureName"] = gen.AlphaString() + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["DiskState"] = gen.PtrOf(gen.OneConstOf( + SnapshotPropertiesDiskStateActiveSAS, + SnapshotPropertiesDiskStateActiveUpload, + SnapshotPropertiesDiskStateAttached, + SnapshotPropertiesDiskStateReadyToUpload, + SnapshotPropertiesDiskStateReserved, + SnapshotPropertiesDiskStateUnattached)) + gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesHyperVGenerationV1, SnapshotPropertiesHyperVGenerationV2)) + gens["Incremental"] = gen.PtrOf(gen.Bool()) + gens["Location"] = gen.AlphaString() + gens["NetworkAccessPolicy"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesNetworkAccessPolicyAllowAll, SnapshotPropertiesNetworkAccessPolicyAllowPrivate, SnapshotPropertiesNetworkAccessPolicyDenyAll)) + gens["OsType"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesOsTypeLinux, SnapshotPropertiesOsTypeWindows)) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSnapshotsSpec is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshotsSpec(gens map[string]gopter.Gen) { + gens["CreationData"] = CreationDataGenerator() + gens["Encryption"] = gen.PtrOf(EncryptionGenerator()) + gens["EncryptionSettingsCollection"] = gen.PtrOf(EncryptionSettingsCollectionGenerator()) + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationGenerator()) + gens["PurchasePlan"] = gen.PtrOf(PurchasePlanGenerator()) + gens["Sku"] = gen.PtrOf(SnapshotSkuGenerator()) +} + +func Test_SnapshotSku_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from SnapshotSku to SnapshotSku via AssignPropertiesToSnapshotSku & AssignPropertiesFromSnapshotSku returns original", + prop.ForAll(RunPropertyAssignmentTestForSnapshotSku, SnapshotSkuGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSnapshotSku tests if a specific instance of SnapshotSku can be assigned to v1alpha1api20200930storage and back losslessly +func RunPropertyAssignmentTestForSnapshotSku(subject SnapshotSku) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20200930storage.SnapshotSku + err := copied.AssignPropertiesToSnapshotSku(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual SnapshotSku + err = actual.AssignPropertiesFromSnapshotSku(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_SnapshotSku_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SnapshotSku via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotSku, SnapshotSkuGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotSku runs a test to see if a specific instance of SnapshotSku round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotSku(subject SnapshotSku) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SnapshotSku + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SnapshotSku instances for property testing - lazily instantiated by SnapshotSkuGenerator() +var snapshotSkuGenerator gopter.Gen + +// SnapshotSkuGenerator returns a generator of SnapshotSku instances for property testing. +func SnapshotSkuGenerator() gopter.Gen { + if snapshotSkuGenerator != nil { + return snapshotSkuGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotSku(generators) + snapshotSkuGenerator = gen.Struct(reflect.TypeOf(SnapshotSku{}), generators) + + return snapshotSkuGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotSku is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotSku(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.OneConstOf(SnapshotSkuNamePremiumLRS, SnapshotSkuNameStandardLRS, SnapshotSkuNameStandardZRS)) +} + +func Test_SnapshotSku_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from SnapshotSku_Status to SnapshotSku_Status via AssignPropertiesToSnapshotSkuStatus & AssignPropertiesFromSnapshotSkuStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForSnapshotSkuStatus, SnapshotSkuStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSnapshotSkuStatus tests if a specific instance of SnapshotSku_Status can be assigned to v1alpha1api20200930storage and back losslessly +func RunPropertyAssignmentTestForSnapshotSkuStatus(subject SnapshotSku_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20200930storage.SnapshotSku_Status + err := copied.AssignPropertiesToSnapshotSkuStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual SnapshotSku_Status + err = actual.AssignPropertiesFromSnapshotSkuStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_SnapshotSku_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SnapshotSku_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotSkuStatus, SnapshotSkuStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotSkuStatus runs a test to see if a specific instance of SnapshotSku_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotSkuStatus(subject SnapshotSku_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SnapshotSku_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SnapshotSku_Status instances for property testing - lazily instantiated by SnapshotSkuStatusGenerator() +var snapshotSkuStatusGenerator gopter.Gen + +// SnapshotSkuStatusGenerator returns a generator of SnapshotSku_Status instances for property testing. +func SnapshotSkuStatusGenerator() gopter.Gen { + if snapshotSkuStatusGenerator != nil { + return snapshotSkuStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotSkuStatus(generators) + snapshotSkuStatusGenerator = gen.Struct(reflect.TypeOf(SnapshotSku_Status{}), generators) + + return snapshotSkuStatusGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotSkuStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotSkuStatus(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.OneConstOf(SnapshotSkuStatusNamePremiumLRS, SnapshotSkuStatusNameStandardLRS, SnapshotSkuStatusNameStandardZRS)) + gens["Tier"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/compute/v1alpha1api20200930/snapshots__spec_arm_types_gen.go b/v2/api/compute/v1alpha1api20200930/snapshots__spec_arm_types_gen.go new file mode 100644 index 00000000000..ab533f55f00 --- /dev/null +++ b/v2/api/compute/v1alpha1api20200930/snapshots__spec_arm_types_gen.go @@ -0,0 +1,101 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20200930 + +import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + +type Snapshots_SpecARM struct { + //ExtendedLocation: The complex type of the extended location. + ExtendedLocation *ExtendedLocationARM `json:"extendedLocation,omitempty"` + + //Location: Location to deploy resource to + Location string `json:"location,omitempty"` + + //Name: The name of the snapshot that is being created. The name can't be changed + //after the snapshot is created. Supported characters for the name are a-z, A-Z, + //0-9 and _. The max name length is 80 characters. + Name string `json:"name"` + + //Properties: Snapshot resource properties. + Properties SnapshotPropertiesARM `json:"properties"` + + //Sku: The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS. + //This is an optional parameter for incremental snapshot and the default behavior + //is the SKU will be set to the same sku as the previous snapshot + Sku *SnapshotSkuARM `json:"sku,omitempty"` + + //Tags: Name-value pairs to add to the resource + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMResourceSpec = &Snapshots_SpecARM{} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-09-30" +func (snapshots Snapshots_SpecARM) GetAPIVersion() string { + return "2020-09-30" +} + +// GetName returns the Name of the resource +func (snapshots Snapshots_SpecARM) GetName() string { + return snapshots.Name +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Compute/snapshots" +func (snapshots Snapshots_SpecARM) GetType() string { + return "Microsoft.Compute/snapshots" +} + +//Generated from: https://schema.management.azure.com/schemas/2020-09-30/Microsoft.Compute.json#/definitions/SnapshotProperties +type SnapshotPropertiesARM struct { + //CreationData: Data used when creating a disk. + CreationData CreationDataARM `json:"creationData"` + DiskAccessId *string `json:"diskAccessId,omitempty"` + + //DiskSizeGB: If creationData.createOption is Empty, this field is mandatory and + //it indicates the size of the disk to create. If this field is present for + //updates or creation with other options, it indicates a resize. Resizes are only + //allowed if the disk is not attached to a running VM, and can only increase the + //disk's size. + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + //DiskState: The state of the snapshot. + DiskState *SnapshotPropertiesDiskState `json:"diskState,omitempty"` + + //Encryption: Encryption at rest settings for disk or snapshot + Encryption *EncryptionARM `json:"encryption,omitempty"` + + //EncryptionSettingsCollection: Encryption settings for disk or snapshot + EncryptionSettingsCollection *EncryptionSettingsCollectionARM `json:"encryptionSettingsCollection,omitempty"` + + //HyperVGeneration: The hypervisor generation of the Virtual Machine. Applicable + //to OS disks only. + HyperVGeneration *SnapshotPropertiesHyperVGeneration `json:"hyperVGeneration,omitempty"` + + //Incremental: Whether a snapshot is incremental. Incremental snapshots on the + //same disk occupy less space than full snapshots and can be diffed. + Incremental *bool `json:"incremental,omitempty"` + NetworkAccessPolicy *SnapshotPropertiesNetworkAccessPolicy `json:"networkAccessPolicy,omitempty"` + + //OsType: The Operating System type. + OsType *SnapshotPropertiesOsType `json:"osType,omitempty"` + + //PurchasePlan: Used for establishing the purchase context of any 3rd Party + //artifact through MarketPlace. + PurchasePlan *PurchasePlanARM `json:"purchasePlan,omitempty"` +} + +//Generated from: https://schema.management.azure.com/schemas/2020-09-30/Microsoft.Compute.json#/definitions/SnapshotSku +type SnapshotSkuARM struct { + //Name: The sku name. + Name *SnapshotSkuName `json:"name,omitempty"` +} + +// +kubebuilder:validation:Enum={"Premium_LRS","Standard_LRS","Standard_ZRS"} +type SnapshotSkuName string + +const ( + SnapshotSkuNamePremiumLRS = SnapshotSkuName("Premium_LRS") + SnapshotSkuNameStandardLRS = SnapshotSkuName("Standard_LRS") + SnapshotSkuNameStandardZRS = SnapshotSkuName("Standard_ZRS") +) diff --git a/v2/api/compute/v1alpha1api20200930/snapshots__spec_arm_types_gen_test.go b/v2/api/compute/v1alpha1api20200930/snapshots__spec_arm_types_gen_test.go new file mode 100644 index 00000000000..2e6cf188950 --- /dev/null +++ b/v2/api/compute/v1alpha1api20200930/snapshots__spec_arm_types_gen_test.go @@ -0,0 +1,243 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20200930 + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Snapshots_SpecARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Snapshots_SpecARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotsSpecARM, SnapshotsSpecARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotsSpecARM runs a test to see if a specific instance of Snapshots_SpecARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotsSpecARM(subject Snapshots_SpecARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Snapshots_SpecARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Snapshots_SpecARM instances for property testing - lazily instantiated by SnapshotsSpecARMGenerator() +var snapshotsSpecARMGenerator gopter.Gen + +// SnapshotsSpecARMGenerator returns a generator of Snapshots_SpecARM instances for property testing. +// We first initialize snapshotsSpecARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func SnapshotsSpecARMGenerator() gopter.Gen { + if snapshotsSpecARMGenerator != nil { + return snapshotsSpecARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotsSpecARM(generators) + snapshotsSpecARMGenerator = gen.Struct(reflect.TypeOf(Snapshots_SpecARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotsSpecARM(generators) + AddRelatedPropertyGeneratorsForSnapshotsSpecARM(generators) + snapshotsSpecARMGenerator = gen.Struct(reflect.TypeOf(Snapshots_SpecARM{}), generators) + + return snapshotsSpecARMGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotsSpecARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotsSpecARM(gens map[string]gopter.Gen) { + gens["Location"] = gen.AlphaString() + gens["Name"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSnapshotsSpecARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshotsSpecARM(gens map[string]gopter.Gen) { + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationARMGenerator()) + gens["Properties"] = SnapshotPropertiesARMGenerator() + gens["Sku"] = gen.PtrOf(SnapshotSkuARMGenerator()) +} + +func Test_SnapshotPropertiesARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SnapshotPropertiesARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotPropertiesARM, SnapshotPropertiesARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotPropertiesARM runs a test to see if a specific instance of SnapshotPropertiesARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotPropertiesARM(subject SnapshotPropertiesARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SnapshotPropertiesARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SnapshotPropertiesARM instances for property testing - lazily instantiated by +//SnapshotPropertiesARMGenerator() +var snapshotPropertiesARMGenerator gopter.Gen + +// SnapshotPropertiesARMGenerator returns a generator of SnapshotPropertiesARM instances for property testing. +// We first initialize snapshotPropertiesARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func SnapshotPropertiesARMGenerator() gopter.Gen { + if snapshotPropertiesARMGenerator != nil { + return snapshotPropertiesARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotPropertiesARM(generators) + snapshotPropertiesARMGenerator = gen.Struct(reflect.TypeOf(SnapshotPropertiesARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotPropertiesARM(generators) + AddRelatedPropertyGeneratorsForSnapshotPropertiesARM(generators) + snapshotPropertiesARMGenerator = gen.Struct(reflect.TypeOf(SnapshotPropertiesARM{}), generators) + + return snapshotPropertiesARMGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotPropertiesARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotPropertiesARM(gens map[string]gopter.Gen) { + gens["DiskAccessId"] = gen.PtrOf(gen.AlphaString()) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["DiskState"] = gen.PtrOf(gen.OneConstOf( + SnapshotPropertiesDiskStateActiveSAS, + SnapshotPropertiesDiskStateActiveUpload, + SnapshotPropertiesDiskStateAttached, + SnapshotPropertiesDiskStateReadyToUpload, + SnapshotPropertiesDiskStateReserved, + SnapshotPropertiesDiskStateUnattached)) + gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesHyperVGenerationV1, SnapshotPropertiesHyperVGenerationV2)) + gens["Incremental"] = gen.PtrOf(gen.Bool()) + gens["NetworkAccessPolicy"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesNetworkAccessPolicyAllowAll, SnapshotPropertiesNetworkAccessPolicyAllowPrivate, SnapshotPropertiesNetworkAccessPolicyDenyAll)) + gens["OsType"] = gen.PtrOf(gen.OneConstOf(SnapshotPropertiesOsTypeLinux, SnapshotPropertiesOsTypeWindows)) +} + +// AddRelatedPropertyGeneratorsForSnapshotPropertiesARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshotPropertiesARM(gens map[string]gopter.Gen) { + gens["CreationData"] = CreationDataARMGenerator() + gens["Encryption"] = gen.PtrOf(EncryptionARMGenerator()) + gens["EncryptionSettingsCollection"] = gen.PtrOf(EncryptionSettingsCollectionARMGenerator()) + gens["PurchasePlan"] = gen.PtrOf(PurchasePlanARMGenerator()) +} + +func Test_SnapshotSkuARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SnapshotSkuARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotSkuARM, SnapshotSkuARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotSkuARM runs a test to see if a specific instance of SnapshotSkuARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotSkuARM(subject SnapshotSkuARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SnapshotSkuARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SnapshotSkuARM instances for property testing - lazily instantiated by SnapshotSkuARMGenerator() +var snapshotSkuARMGenerator gopter.Gen + +// SnapshotSkuARMGenerator returns a generator of SnapshotSkuARM instances for property testing. +func SnapshotSkuARMGenerator() gopter.Gen { + if snapshotSkuARMGenerator != nil { + return snapshotSkuARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotSkuARM(generators) + snapshotSkuARMGenerator = gen.Struct(reflect.TypeOf(SnapshotSkuARM{}), generators) + + return snapshotSkuARMGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotSkuARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotSkuARM(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.OneConstOf(SnapshotSkuNamePremiumLRS, SnapshotSkuNameStandardLRS, SnapshotSkuNameStandardZRS)) +} diff --git a/v2/api/compute/v1alpha1api20200930storage/snapshot_types_gen.go b/v2/api/compute/v1alpha1api20200930storage/snapshot_types_gen.go new file mode 100644 index 00000000000..4cc26d2d2d0 --- /dev/null +++ b/v2/api/compute/v1alpha1api20200930storage/snapshot_types_gen.go @@ -0,0 +1,247 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20200930storage + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +kubebuilder:rbac:groups=compute.azure.com,resources=snapshots,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=compute.azure.com,resources={snapshots/status,snapshots/finalizers},verbs=get;update;patch + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +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 v1alpha1api20200930.Snapshot +//Generated from: https://schema.management.azure.com/schemas/2020-09-30/Microsoft.Compute.json#/resourceDefinitions/snapshots +type Snapshot struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec Snapshots_Spec `json:"spec,omitempty"` + Status Snapshot_Status `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &Snapshot{} + +// GetConditions returns the conditions of the resource +func (snapshot *Snapshot) GetConditions() conditions.Conditions { + return snapshot.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (snapshot *Snapshot) SetConditions(conditions conditions.Conditions) { + snapshot.Status.Conditions = conditions +} + +var _ genruntime.KubernetesResource = &Snapshot{} + +// AzureName returns the Azure name of the resource +func (snapshot *Snapshot) AzureName() string { + return snapshot.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2020-09-30" +func (snapshot Snapshot) GetAPIVersion() string { + return "2020-09-30" +} + +// GetResourceKind returns the kind of the resource +func (snapshot *Snapshot) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (snapshot *Snapshot) GetSpec() genruntime.ConvertibleSpec { + return &snapshot.Spec +} + +// GetStatus returns the status of this resource +func (snapshot *Snapshot) GetStatus() genruntime.ConvertibleStatus { + return &snapshot.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Compute/snapshots" +func (snapshot *Snapshot) GetType() string { + return "Microsoft.Compute/snapshots" +} + +// NewEmptyStatus returns a new empty (blank) status +func (snapshot *Snapshot) NewEmptyStatus() genruntime.ConvertibleStatus { + return &Snapshot_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (snapshot *Snapshot) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(snapshot.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Name: snapshot.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (snapshot *Snapshot) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*Snapshot_Status); ok { + snapshot.Status = *st + return nil + } + + // Convert status to required version + var st Snapshot_Status + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + snapshot.Status = st + return nil +} + +// Hub marks that this Snapshot is the hub type for conversion +func (snapshot *Snapshot) Hub() {} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (snapshot *Snapshot) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: snapshot.Spec.OriginalVersion, + Kind: "Snapshot", + } +} + +// +kubebuilder:object:root=true +//Storage version of v1alpha1api20200930.Snapshot +//Generated from: https://schema.management.azure.com/schemas/2020-09-30/Microsoft.Compute.json#/resourceDefinitions/snapshots +type SnapshotList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Snapshot `json:"items"` +} + +//Storage version of v1alpha1api20200930.Snapshot_Status +type Snapshot_Status struct { + Conditions []conditions.Condition `json:"conditions,omitempty"` + CreationData *CreationData_Status `json:"creationData,omitempty"` + DiskAccessId *string `json:"diskAccessId,omitempty"` + DiskSizeBytes *int `json:"diskSizeBytes,omitempty"` + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + DiskState *string `json:"diskState,omitempty"` + Encryption *Encryption_Status `json:"encryption,omitempty"` + EncryptionSettingsCollection *EncryptionSettingsCollection_Status `json:"encryptionSettingsCollection,omitempty"` + ExtendedLocation *ExtendedLocation_Status `json:"extendedLocation,omitempty"` + HyperVGeneration *string `json:"hyperVGeneration,omitempty"` + Id *string `json:"id,omitempty"` + Incremental *bool `json:"incremental,omitempty"` + Location *string `json:"location,omitempty"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + NetworkAccessPolicy *string `json:"networkAccessPolicy,omitempty"` + OsType *string `json:"osType,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PurchasePlan *PurchasePlan_Status `json:"purchasePlan,omitempty"` + Sku *SnapshotSku_Status `json:"sku,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + Type *string `json:"type,omitempty"` + UniqueId *string `json:"uniqueId,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &Snapshot_Status{} + +// ConvertStatusFrom populates our Snapshot_Status from the provided source +func (snapshot *Snapshot_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + if source == snapshot { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return source.ConvertStatusTo(snapshot) +} + +// ConvertStatusTo populates the provided destination from our Snapshot_Status +func (snapshot *Snapshot_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + if destination == snapshot { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return destination.ConvertStatusFrom(snapshot) +} + +//Storage version of v1alpha1api20200930.Snapshots_Spec +type Snapshots_Spec struct { + //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"` + CreationData *CreationData `json:"creationData,omitempty"` + + //DiskAccessReference: ARM id of the DiskAccess resource for using private + //endpoints on disks. + DiskAccessReference *genruntime.ResourceReference `armReference:"DiskAccessId" json:"diskAccessReference,omitempty"` + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + DiskState *string `json:"diskState,omitempty"` + Encryption *Encryption `json:"encryption,omitempty"` + EncryptionSettingsCollection *EncryptionSettingsCollection `json:"encryptionSettingsCollection,omitempty"` + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + HyperVGeneration *string `json:"hyperVGeneration,omitempty"` + Incremental *bool `json:"incremental,omitempty"` + Location *string `json:"location,omitempty"` + NetworkAccessPolicy *string `json:"networkAccessPolicy,omitempty"` + OriginalVersion string `json:"originalVersion"` + OsType *string `json:"osType,omitempty"` + + // +kubebuilder:validation:Required + Owner genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner" kind:"ResourceGroup"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + PurchasePlan *PurchasePlan `json:"purchasePlan,omitempty"` + Sku *SnapshotSku `json:"sku,omitempty"` + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ConvertibleSpec = &Snapshots_Spec{} + +// ConvertSpecFrom populates our Snapshots_Spec from the provided source +func (snapshots *Snapshots_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + if source == snapshots { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return source.ConvertSpecTo(snapshots) +} + +// ConvertSpecTo populates the provided destination from our Snapshots_Spec +func (snapshots *Snapshots_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + if destination == snapshots { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return destination.ConvertSpecFrom(snapshots) +} + +//Storage version of v1alpha1api20200930.SnapshotSku +//Generated from: https://schema.management.azure.com/schemas/2020-09-30/Microsoft.Compute.json#/definitions/SnapshotSku +type SnapshotSku struct { + Name *string `json:"name,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +//Storage version of v1alpha1api20200930.SnapshotSku_Status +type SnapshotSku_Status struct { + Name *string `json:"name,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Tier *string `json:"tier,omitempty"` +} + +func init() { + SchemeBuilder.Register(&Snapshot{}, &SnapshotList{}) +} diff --git a/v2/api/compute/v1alpha1api20200930storage/snapshot_types_gen_test.go b/v2/api/compute/v1alpha1api20200930storage/snapshot_types_gen_test.go new file mode 100644 index 00000000000..283e654e99a --- /dev/null +++ b/v2/api/compute/v1alpha1api20200930storage/snapshot_types_gen_test.go @@ -0,0 +1,378 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20200930storage + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Snapshot_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Snapshot via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshot, SnapshotGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshot runs a test to see if a specific instance of Snapshot round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshot(subject Snapshot) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Snapshot + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Snapshot instances for property testing - lazily instantiated by SnapshotGenerator() +var snapshotGenerator gopter.Gen + +// SnapshotGenerator returns a generator of Snapshot instances for property testing. +func SnapshotGenerator() gopter.Gen { + if snapshotGenerator != nil { + return snapshotGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForSnapshot(generators) + snapshotGenerator = gen.Struct(reflect.TypeOf(Snapshot{}), generators) + + return snapshotGenerator +} + +// AddRelatedPropertyGeneratorsForSnapshot is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshot(gens map[string]gopter.Gen) { + gens["Spec"] = SnapshotsSpecGenerator() + gens["Status"] = SnapshotStatusGenerator() +} + +func Test_Snapshot_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Snapshot_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotStatus, SnapshotStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotStatus runs a test to see if a specific instance of Snapshot_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotStatus(subject Snapshot_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Snapshot_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Snapshot_Status instances for property testing - lazily instantiated by SnapshotStatusGenerator() +var snapshotStatusGenerator gopter.Gen + +// SnapshotStatusGenerator returns a generator of Snapshot_Status instances for property testing. +// We first initialize snapshotStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func SnapshotStatusGenerator() gopter.Gen { + if snapshotStatusGenerator != nil { + return snapshotStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotStatus(generators) + snapshotStatusGenerator = gen.Struct(reflect.TypeOf(Snapshot_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotStatus(generators) + AddRelatedPropertyGeneratorsForSnapshotStatus(generators) + snapshotStatusGenerator = gen.Struct(reflect.TypeOf(Snapshot_Status{}), generators) + + return snapshotStatusGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotStatus(gens map[string]gopter.Gen) { + gens["DiskAccessId"] = gen.PtrOf(gen.AlphaString()) + gens["DiskSizeBytes"] = gen.PtrOf(gen.Int()) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["DiskState"] = gen.PtrOf(gen.AlphaString()) + gens["HyperVGeneration"] = gen.PtrOf(gen.AlphaString()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Incremental"] = gen.PtrOf(gen.Bool()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["ManagedBy"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["NetworkAccessPolicy"] = gen.PtrOf(gen.AlphaString()) + gens["OsType"] = gen.PtrOf(gen.AlphaString()) + gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) + gens["TimeCreated"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) + gens["UniqueId"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSnapshotStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshotStatus(gens map[string]gopter.Gen) { + gens["CreationData"] = gen.PtrOf(CreationDataStatusGenerator()) + gens["Encryption"] = gen.PtrOf(EncryptionStatusGenerator()) + gens["EncryptionSettingsCollection"] = gen.PtrOf(EncryptionSettingsCollectionStatusGenerator()) + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationStatusGenerator()) + gens["PurchasePlan"] = gen.PtrOf(PurchasePlanStatusGenerator()) + gens["Sku"] = gen.PtrOf(SnapshotSkuStatusGenerator()) +} + +func Test_Snapshots_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Snapshots_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotsSpec, SnapshotsSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotsSpec runs a test to see if a specific instance of Snapshots_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotsSpec(subject Snapshots_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Snapshots_Spec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Snapshots_Spec instances for property testing - lazily instantiated by SnapshotsSpecGenerator() +var snapshotsSpecGenerator gopter.Gen + +// SnapshotsSpecGenerator returns a generator of Snapshots_Spec instances for property testing. +// We first initialize snapshotsSpecGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func SnapshotsSpecGenerator() gopter.Gen { + if snapshotsSpecGenerator != nil { + return snapshotsSpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotsSpec(generators) + snapshotsSpecGenerator = gen.Struct(reflect.TypeOf(Snapshots_Spec{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotsSpec(generators) + AddRelatedPropertyGeneratorsForSnapshotsSpec(generators) + snapshotsSpecGenerator = gen.Struct(reflect.TypeOf(Snapshots_Spec{}), generators) + + return snapshotsSpecGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotsSpec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotsSpec(gens map[string]gopter.Gen) { + gens["AzureName"] = gen.AlphaString() + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["DiskState"] = gen.PtrOf(gen.AlphaString()) + gens["HyperVGeneration"] = gen.PtrOf(gen.AlphaString()) + gens["Incremental"] = gen.PtrOf(gen.Bool()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["NetworkAccessPolicy"] = gen.PtrOf(gen.AlphaString()) + gens["OriginalVersion"] = gen.AlphaString() + gens["OsType"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForSnapshotsSpec is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForSnapshotsSpec(gens map[string]gopter.Gen) { + gens["CreationData"] = gen.PtrOf(CreationDataGenerator()) + gens["Encryption"] = gen.PtrOf(EncryptionGenerator()) + gens["EncryptionSettingsCollection"] = gen.PtrOf(EncryptionSettingsCollectionGenerator()) + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationGenerator()) + gens["PurchasePlan"] = gen.PtrOf(PurchasePlanGenerator()) + gens["Sku"] = gen.PtrOf(SnapshotSkuGenerator()) +} + +func Test_SnapshotSku_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SnapshotSku via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotSku, SnapshotSkuGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotSku runs a test to see if a specific instance of SnapshotSku round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotSku(subject SnapshotSku) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SnapshotSku + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SnapshotSku instances for property testing - lazily instantiated by SnapshotSkuGenerator() +var snapshotSkuGenerator gopter.Gen + +// SnapshotSkuGenerator returns a generator of SnapshotSku instances for property testing. +func SnapshotSkuGenerator() gopter.Gen { + if snapshotSkuGenerator != nil { + return snapshotSkuGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotSku(generators) + snapshotSkuGenerator = gen.Struct(reflect.TypeOf(SnapshotSku{}), generators) + + return snapshotSkuGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotSku is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotSku(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_SnapshotSku_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SnapshotSku_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSnapshotSkuStatus, SnapshotSkuStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSnapshotSkuStatus runs a test to see if a specific instance of SnapshotSku_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForSnapshotSkuStatus(subject SnapshotSku_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SnapshotSku_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SnapshotSku_Status instances for property testing - lazily instantiated by SnapshotSkuStatusGenerator() +var snapshotSkuStatusGenerator gopter.Gen + +// SnapshotSkuStatusGenerator returns a generator of SnapshotSku_Status instances for property testing. +func SnapshotSkuStatusGenerator() gopter.Gen { + if snapshotSkuStatusGenerator != nil { + return snapshotSkuStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSnapshotSkuStatus(generators) + snapshotSkuStatusGenerator = gen.Struct(reflect.TypeOf(SnapshotSku_Status{}), generators) + + return snapshotSkuStatusGenerator +} + +// AddIndependentPropertyGeneratorsForSnapshotSkuStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSnapshotSkuStatus(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Tier"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/compute/v1alpha1api20201201storage/virtual_machine_types_gen.go b/v2/api/compute/v1alpha1api20201201storage/virtual_machine_types_gen.go index 0239ba029f6..02ce9fb1123 100644 --- a/v2/api/compute/v1alpha1api20201201storage/virtual_machine_types_gen.go +++ b/v2/api/compute/v1alpha1api20201201storage/virtual_machine_types_gen.go @@ -4,6 +4,7 @@ package v1alpha1api20201201storage import ( + "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701storage" "github.com/Azure/azure-service-operator/v2/pkg/genruntime" "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" "github.com/pkg/errors" @@ -291,6 +292,50 @@ type ExtendedLocation struct { Type *string `json:"type,omitempty"` } +// AssignPropertiesFromExtendedLocation populates our ExtendedLocation from the provided source ExtendedLocation +func (location *ExtendedLocation) AssignPropertiesFromExtendedLocation(source *v1alpha1api20210701storage.ExtendedLocation) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Name + location.Name = genruntime.ClonePointerToString(source.Name) + + // Type + location.Type = genruntime.ClonePointerToString(source.Type) + + // Update the property bag + if len(propertyBag) > 0 { + location.PropertyBag = propertyBag + } else { + location.PropertyBag = nil + } + + // No error + return nil +} + +// AssignPropertiesToExtendedLocation populates the provided destination ExtendedLocation from our ExtendedLocation +func (location *ExtendedLocation) AssignPropertiesToExtendedLocation(destination *v1alpha1api20210701storage.ExtendedLocation) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(location.PropertyBag) + + // Name + destination.Name = genruntime.ClonePointerToString(location.Name) + + // Type + destination.Type = genruntime.ClonePointerToString(location.Type) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + //Storage version of v1alpha1api20201201.ExtendedLocation_Status type ExtendedLocation_Status struct { Name *string `json:"name,omitempty"` @@ -298,6 +343,50 @@ type ExtendedLocation_Status struct { Type *string `json:"type,omitempty"` } +// AssignPropertiesFromExtendedLocationStatus populates our ExtendedLocation_Status from the provided source ExtendedLocation_Status +func (location *ExtendedLocation_Status) AssignPropertiesFromExtendedLocationStatus(source *v1alpha1api20210701storage.ExtendedLocation_Status) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Name + location.Name = genruntime.ClonePointerToString(source.Name) + + // Type + location.Type = genruntime.ClonePointerToString(source.Type) + + // Update the property bag + if len(propertyBag) > 0 { + location.PropertyBag = propertyBag + } else { + location.PropertyBag = nil + } + + // No error + return nil +} + +// AssignPropertiesToExtendedLocationStatus populates the provided destination ExtendedLocation_Status from our ExtendedLocation_Status +func (location *ExtendedLocation_Status) AssignPropertiesToExtendedLocationStatus(destination *v1alpha1api20210701storage.ExtendedLocation_Status) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(location.PropertyBag) + + // Name + destination.Name = genruntime.ClonePointerToString(location.Name) + + // Type + destination.Type = genruntime.ClonePointerToString(location.Type) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + //Storage version of v1alpha1api20201201.HardwareProfile //Generated from: https://schema.management.azure.com/schemas/2020-12-01/Microsoft.Compute.json#/definitions/HardwareProfile type HardwareProfile struct { @@ -408,12 +497,98 @@ type SubResource struct { Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"` } +// AssignPropertiesFromSubResource populates our SubResource from the provided source SubResource +func (resource *SubResource) AssignPropertiesFromSubResource(source *v1alpha1api20210701storage.SubResource) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Reference + if source.Reference != nil { + reference := source.Reference.Copy() + resource.Reference = &reference + } else { + resource.Reference = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + resource.PropertyBag = propertyBag + } else { + resource.PropertyBag = nil + } + + // No error + return nil +} + +// AssignPropertiesToSubResource populates the provided destination SubResource from our SubResource +func (resource *SubResource) AssignPropertiesToSubResource(destination *v1alpha1api20210701storage.SubResource) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(resource.PropertyBag) + + // Reference + if resource.Reference != nil { + reference := resource.Reference.Copy() + destination.Reference = &reference + } else { + destination.Reference = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + //Storage version of v1alpha1api20201201.SubResource_Status type SubResource_Status struct { Id *string `json:"id,omitempty"` PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` } +// AssignPropertiesFromSubResourceStatus populates our SubResource_Status from the provided source SubResource_Status +func (resource *SubResource_Status) AssignPropertiesFromSubResourceStatus(source *v1alpha1api20210701storage.SubResource_Status) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Id + resource.Id = genruntime.ClonePointerToString(source.Id) + + // Update the property bag + if len(propertyBag) > 0 { + resource.PropertyBag = propertyBag + } else { + resource.PropertyBag = nil + } + + // No error + return nil +} + +// AssignPropertiesToSubResourceStatus populates the provided destination SubResource_Status from our SubResource_Status +func (resource *SubResource_Status) AssignPropertiesToSubResourceStatus(destination *v1alpha1api20210701storage.SubResource_Status) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(resource.PropertyBag) + + // Id + destination.Id = genruntime.ClonePointerToString(resource.Id) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + //Storage version of v1alpha1api20201201.VirtualMachineExtension_Status type VirtualMachineExtension_Status struct { AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` @@ -958,6 +1133,54 @@ type DiskEncryptionSetParameters struct { Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"` } +// AssignPropertiesFromDiskEncryptionSetParameters populates our DiskEncryptionSetParameters from the provided source DiskEncryptionSetParameters +func (parameters *DiskEncryptionSetParameters) AssignPropertiesFromDiskEncryptionSetParameters(source *v1alpha1api20210701storage.DiskEncryptionSetParameters) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(source.PropertyBag) + + // Reference + if source.Reference != nil { + reference := source.Reference.Copy() + parameters.Reference = &reference + } else { + parameters.Reference = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + parameters.PropertyBag = propertyBag + } else { + parameters.PropertyBag = nil + } + + // No error + return nil +} + +// AssignPropertiesToDiskEncryptionSetParameters populates the provided destination DiskEncryptionSetParameters from our DiskEncryptionSetParameters +func (parameters *DiskEncryptionSetParameters) AssignPropertiesToDiskEncryptionSetParameters(destination *v1alpha1api20210701storage.DiskEncryptionSetParameters) error { + // Clone the existing property bag + propertyBag := genruntime.NewPropertyBag(parameters.PropertyBag) + + // Reference + if parameters.Reference != nil { + reference := parameters.Reference.Copy() + destination.Reference = &reference + } else { + destination.Reference = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + //Storage version of v1alpha1api20201201.KeyVaultKeyReference //Generated from: https://schema.management.azure.com/schemas/2020-12-01/Microsoft.Compute.json#/definitions/KeyVaultKeyReference type KeyVaultKeyReference struct { diff --git a/v2/api/compute/v1alpha1api20201201storage/virtual_machine_types_gen_test.go b/v2/api/compute/v1alpha1api20201201storage/virtual_machine_types_gen_test.go index 6b993314bc4..91ed6a56975 100644 --- a/v2/api/compute/v1alpha1api20201201storage/virtual_machine_types_gen_test.go +++ b/v2/api/compute/v1alpha1api20201201storage/virtual_machine_types_gen_test.go @@ -5,6 +5,7 @@ package v1alpha1api20201201storage import ( "encoding/json" + "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701storage" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/kr/pretty" @@ -636,6 +637,48 @@ func AddRelatedPropertyGeneratorsForDiagnosticsProfileStatus(gens map[string]gop gens["BootDiagnostics"] = gen.PtrOf(BootDiagnosticsStatusGenerator()) } +func Test_ExtendedLocation_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ExtendedLocation to ExtendedLocation via AssignPropertiesToExtendedLocation & AssignPropertiesFromExtendedLocation returns original", + prop.ForAll(RunPropertyAssignmentTestForExtendedLocation, ExtendedLocationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForExtendedLocation tests if a specific instance of ExtendedLocation can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForExtendedLocation(subject ExtendedLocation) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ExtendedLocation + err := copied.AssignPropertiesToExtendedLocation(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ExtendedLocation + err = actual.AssignPropertiesFromExtendedLocation(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_ExtendedLocation_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -696,6 +739,48 @@ func AddIndependentPropertyGeneratorsForExtendedLocation(gens map[string]gopter. gens["Type"] = gen.PtrOf(gen.AlphaString()) } +func Test_ExtendedLocation_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ExtendedLocation_Status to ExtendedLocation_Status via AssignPropertiesToExtendedLocationStatus & AssignPropertiesFromExtendedLocationStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForExtendedLocationStatus, ExtendedLocationStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForExtendedLocationStatus tests if a specific instance of ExtendedLocation_Status can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForExtendedLocationStatus(subject ExtendedLocation_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ExtendedLocation_Status + err := copied.AssignPropertiesToExtendedLocationStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ExtendedLocation_Status + err = actual.AssignPropertiesFromExtendedLocationStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_ExtendedLocation_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -1491,6 +1576,48 @@ func AddRelatedPropertyGeneratorsForStorageProfileStatus(gens map[string]gopter. gens["OsDisk"] = gen.PtrOf(OSDiskStatusGenerator()) } +func Test_SubResource_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from SubResource to SubResource via AssignPropertiesToSubResource & AssignPropertiesFromSubResource returns original", + prop.ForAll(RunPropertyAssignmentTestForSubResource, SubResourceGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSubResource tests if a specific instance of SubResource can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForSubResource(subject SubResource) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.SubResource + err := copied.AssignPropertiesToSubResource(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual SubResource + err = actual.AssignPropertiesFromSubResource(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_SubResource_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -1544,6 +1671,48 @@ func SubResourceGenerator() gopter.Gen { return subResourceGenerator } +func Test_SubResource_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from SubResource_Status to SubResource_Status via AssignPropertiesToSubResourceStatus & AssignPropertiesFromSubResourceStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForSubResourceStatus, SubResourceStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSubResourceStatus tests if a specific instance of SubResource_Status can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForSubResourceStatus(subject SubResource_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.SubResource_Status + err := copied.AssignPropertiesToSubResourceStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual SubResource_Status + err = actual.AssignPropertiesFromSubResourceStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_SubResource_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() @@ -5412,6 +5581,48 @@ func AddRelatedPropertyGeneratorsForApiErrorStatus(gens map[string]gopter.Gen) { gens["Innererror"] = gen.PtrOf(InnerErrorStatusGenerator()) } +func Test_DiskEncryptionSetParameters_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from DiskEncryptionSetParameters to DiskEncryptionSetParameters via AssignPropertiesToDiskEncryptionSetParameters & AssignPropertiesFromDiskEncryptionSetParameters returns original", + prop.ForAll(RunPropertyAssignmentTestForDiskEncryptionSetParameters, DiskEncryptionSetParametersGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForDiskEncryptionSetParameters tests if a specific instance of DiskEncryptionSetParameters can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForDiskEncryptionSetParameters(subject DiskEncryptionSetParameters) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.DiskEncryptionSetParameters + err := copied.AssignPropertiesToDiskEncryptionSetParameters(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual DiskEncryptionSetParameters + err = actual.AssignPropertiesFromDiskEncryptionSetParameters(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + func Test_DiskEncryptionSetParameters_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { t.Parallel() parameters := gopter.DefaultTestParameters() diff --git a/v2/api/compute/v1alpha1api20210701/groupversion_info_gen.go b/v2/api/compute/v1alpha1api20210701/groupversion_info_gen.go new file mode 100644 index 00000000000..e079c816684 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701/groupversion_info_gen.go @@ -0,0 +1,31 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by azure-service-operator-codegen. DO NOT EDIT. + +// Package v1alpha1api20210701 contains API Schema definitions for the compute v1alpha1api20210701 API group +// +kubebuilder:object:generate=true +// All object properties are optional by default, this will be overridden when needed: +// +kubebuilder:validation:Optional +// +groupName=compute.azure.com +package v1alpha1api20210701 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "compute.azure.com", Version: "v1alpha1api20210701"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder +) diff --git a/v2/api/compute/v1alpha1api20210701/image__status_arm_types_gen.go b/v2/api/compute/v1alpha1api20210701/image__status_arm_types_gen.go new file mode 100644 index 00000000000..29bcc75cf3c --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701/image__status_arm_types_gen.go @@ -0,0 +1,160 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20210701 + +type Image_StatusARM struct { + //ExtendedLocation: The extended location of the Image. + ExtendedLocation *ExtendedLocation_StatusARM `json:"extendedLocation,omitempty"` + + //Id: Resource Id + Id *string `json:"id,omitempty"` + + //Location: Resource location + Location *string `json:"location,omitempty"` + + //Name: Resource name + Name *string `json:"name,omitempty"` + Properties *ImageProperties_StatusARM `json:"properties,omitempty"` + + //Tags: Resource tags + Tags map[string]string `json:"tags,omitempty"` + + //Type: Resource type + Type *string `json:"type,omitempty"` +} + +type ExtendedLocation_StatusARM struct { + //Name: The name of the extended location. + Name *string `json:"name,omitempty"` + + //Type: The type of the extended location. + Type *ExtendedLocationType_Status `json:"type,omitempty"` +} + +type ImageProperties_StatusARM struct { + //HyperVGeneration: Specifies the HyperVGenerationType of the VirtualMachine + //created from the image. From API Version 2019-03-01 if the image source is a + //blob, then we need the user to specify the value, if the source is managed + //resource like disk or snapshot, we may require the user to specify the property + //if we cannot deduce it from the source managed resource. + HyperVGeneration *HyperVGenerationType_Status `json:"hyperVGeneration,omitempty"` + + //ProvisioningState: The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + + //SourceVirtualMachine: The source virtual machine from which Image is created. + SourceVirtualMachine *SubResource_StatusARM `json:"sourceVirtualMachine,omitempty"` + + //StorageProfile: Specifies the storage settings for the virtual machine disks. + StorageProfile *ImageStorageProfile_StatusARM `json:"storageProfile,omitempty"` +} + +type ExtendedLocationType_Status string + +const ExtendedLocationType_StatusEdgeZone = ExtendedLocationType_Status("EdgeZone") + +type ImageStorageProfile_StatusARM struct { + //DataDisks: Specifies the parameters that are used to add a data disk to a + //virtual machine. + //For more information about disks, see [About disks and VHDs for Azure virtual + //machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + DataDisks []ImageDataDisk_StatusARM `json:"dataDisks,omitempty"` + + //OsDisk: Specifies information about the operating system disk used by the + //virtual machine. + //For more information about disks, see [About disks and VHDs for Azure virtual + //machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + OsDisk *ImageOSDisk_StatusARM `json:"osDisk,omitempty"` + + //ZoneResilient: Specifies whether an image is zone resilient or not. Default is + //false. Zone resilient images can be created only in regions that provide Zone + //Redundant Storage (ZRS). + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} + +type SubResource_StatusARM struct { + //Id: Resource Id + Id *string `json:"id,omitempty"` +} + +type ImageDataDisk_StatusARM struct { + //BlobUri: The Virtual Hard Disk. + BlobUri *string `json:"blobUri,omitempty"` + + //Caching: Specifies the caching requirements. + //Possible values are: + //None + //ReadOnly + //ReadWrite + //Default: None for Standard storage. ReadOnly for Premium storage + Caching *ImageDataDiskStatusCaching `json:"caching,omitempty"` + + //DiskEncryptionSet: Specifies the customer managed disk encryption set resource + //id for the managed image disk. + DiskEncryptionSet *SubResource_StatusARM `json:"diskEncryptionSet,omitempty"` + + //DiskSizeGB: Specifies the size of empty data disks in gigabytes. This element + //can be used to overwrite the name of the disk in a virtual machine image. + //This value cannot be larger than 1023 GB + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + //Lun: Specifies the logical unit number of the data disk. This value is used to + //identify data disks within the VM and therefore must be unique for each data + //disk attached to a VM. + Lun int `json:"lun"` + + //ManagedDisk: The managedDisk. + ManagedDisk *SubResource_StatusARM `json:"managedDisk,omitempty"` + + //Snapshot: The snapshot. + Snapshot *SubResource_StatusARM `json:"snapshot,omitempty"` + + //StorageAccountType: Specifies the storage account type for the managed disk. + //NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS + //Disk. + StorageAccountType *StorageAccountType_Status `json:"storageAccountType,omitempty"` +} + +type ImageOSDisk_StatusARM struct { + //BlobUri: The Virtual Hard Disk. + BlobUri *string `json:"blobUri,omitempty"` + + //Caching: Specifies the caching requirements. + //Possible values are: + //None + //ReadOnly + //ReadWrite + //Default: None for Standard storage. ReadOnly for Premium storage + Caching *ImageOSDiskStatusCaching `json:"caching,omitempty"` + + //DiskEncryptionSet: Specifies the customer managed disk encryption set resource + //id for the managed image disk. + DiskEncryptionSet *SubResource_StatusARM `json:"diskEncryptionSet,omitempty"` + + //DiskSizeGB: Specifies the size of empty data disks in gigabytes. This element + //can be used to overwrite the name of the disk in a virtual machine image. + //This value cannot be larger than 1023 GB + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + //ManagedDisk: The managedDisk. + ManagedDisk *SubResource_StatusARM `json:"managedDisk,omitempty"` + + //OsState: The OS State. + OsState ImageOSDiskStatusOsState `json:"osState"` + + //OsType: This property allows you to specify the type of the OS that is included + //in the disk if creating a VM from a custom image. + //Possible values are: + //Windows + //Linux + OsType ImageOSDiskStatusOsType `json:"osType"` + + //Snapshot: The snapshot. + Snapshot *SubResource_StatusARM `json:"snapshot,omitempty"` + + //StorageAccountType: Specifies the storage account type for the managed disk. + //NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS + //Disk. + StorageAccountType *StorageAccountType_Status `json:"storageAccountType,omitempty"` +} diff --git a/v2/api/compute/v1alpha1api20210701/image__status_arm_types_gen_test.go b/v2/api/compute/v1alpha1api20210701/image__status_arm_types_gen_test.go new file mode 100644 index 00000000000..8f36108986e --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701/image__status_arm_types_gen_test.go @@ -0,0 +1,541 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20210701 + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Image_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Image_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStatusARM, ImageStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStatusARM runs a test to see if a specific instance of Image_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStatusARM(subject Image_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Image_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Image_StatusARM instances for property testing - lazily instantiated by ImageStatusARMGenerator() +var imageStatusARMGenerator gopter.Gen + +// ImageStatusARMGenerator returns a generator of Image_StatusARM instances for property testing. +// We first initialize imageStatusARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStatusARMGenerator() gopter.Gen { + if imageStatusARMGenerator != nil { + return imageStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStatusARM(generators) + imageStatusARMGenerator = gen.Struct(reflect.TypeOf(Image_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStatusARM(generators) + AddRelatedPropertyGeneratorsForImageStatusARM(generators) + imageStatusARMGenerator = gen.Struct(reflect.TypeOf(Image_StatusARM{}), generators) + + return imageStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForImageStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStatusARM(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImageStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStatusARM(gens map[string]gopter.Gen) { + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationStatusARMGenerator()) + gens["Properties"] = gen.PtrOf(ImagePropertiesStatusARMGenerator()) +} + +func Test_ExtendedLocation_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ExtendedLocation_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForExtendedLocationStatusARM, ExtendedLocationStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForExtendedLocationStatusARM runs a test to see if a specific instance of ExtendedLocation_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForExtendedLocationStatusARM(subject ExtendedLocation_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ExtendedLocation_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ExtendedLocation_StatusARM instances for property testing - lazily instantiated by +//ExtendedLocationStatusARMGenerator() +var extendedLocationStatusARMGenerator gopter.Gen + +// ExtendedLocationStatusARMGenerator returns a generator of ExtendedLocation_StatusARM instances for property testing. +func ExtendedLocationStatusARMGenerator() gopter.Gen { + if extendedLocationStatusARMGenerator != nil { + return extendedLocationStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForExtendedLocationStatusARM(generators) + extendedLocationStatusARMGenerator = gen.Struct(reflect.TypeOf(ExtendedLocation_StatusARM{}), generators) + + return extendedLocationStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForExtendedLocationStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForExtendedLocationStatusARM(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.OneConstOf(ExtendedLocationType_StatusEdgeZone)) +} + +func Test_ImageProperties_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageProperties_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImagePropertiesStatusARM, ImagePropertiesStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImagePropertiesStatusARM runs a test to see if a specific instance of ImageProperties_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImagePropertiesStatusARM(subject ImageProperties_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageProperties_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageProperties_StatusARM instances for property testing - lazily instantiated by +//ImagePropertiesStatusARMGenerator() +var imagePropertiesStatusARMGenerator gopter.Gen + +// ImagePropertiesStatusARMGenerator returns a generator of ImageProperties_StatusARM instances for property testing. +// We first initialize imagePropertiesStatusARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImagePropertiesStatusARMGenerator() gopter.Gen { + if imagePropertiesStatusARMGenerator != nil { + return imagePropertiesStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagePropertiesStatusARM(generators) + imagePropertiesStatusARMGenerator = gen.Struct(reflect.TypeOf(ImageProperties_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagePropertiesStatusARM(generators) + AddRelatedPropertyGeneratorsForImagePropertiesStatusARM(generators) + imagePropertiesStatusARMGenerator = gen.Struct(reflect.TypeOf(ImageProperties_StatusARM{}), generators) + + return imagePropertiesStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForImagePropertiesStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImagePropertiesStatusARM(gens map[string]gopter.Gen) { + gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(HyperVGenerationType_StatusV1, HyperVGenerationType_StatusV2)) + gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImagePropertiesStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImagePropertiesStatusARM(gens map[string]gopter.Gen) { + gens["SourceVirtualMachine"] = gen.PtrOf(SubResourceStatusARMGenerator()) + gens["StorageProfile"] = gen.PtrOf(ImageStorageProfileStatusARMGenerator()) +} + +func Test_ImageStorageProfile_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageStorageProfile_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStorageProfileStatusARM, ImageStorageProfileStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStorageProfileStatusARM runs a test to see if a specific instance of ImageStorageProfile_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStorageProfileStatusARM(subject ImageStorageProfile_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageStorageProfile_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageStorageProfile_StatusARM instances for property testing - lazily instantiated by +//ImageStorageProfileStatusARMGenerator() +var imageStorageProfileStatusARMGenerator gopter.Gen + +// ImageStorageProfileStatusARMGenerator returns a generator of ImageStorageProfile_StatusARM instances for property testing. +// We first initialize imageStorageProfileStatusARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStorageProfileStatusARMGenerator() gopter.Gen { + if imageStorageProfileStatusARMGenerator != nil { + return imageStorageProfileStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfileStatusARM(generators) + imageStorageProfileStatusARMGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfileStatusARM(generators) + AddRelatedPropertyGeneratorsForImageStorageProfileStatusARM(generators) + imageStorageProfileStatusARMGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile_StatusARM{}), generators) + + return imageStorageProfileStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForImageStorageProfileStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStorageProfileStatusARM(gens map[string]gopter.Gen) { + gens["ZoneResilient"] = gen.PtrOf(gen.Bool()) +} + +// AddRelatedPropertyGeneratorsForImageStorageProfileStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStorageProfileStatusARM(gens map[string]gopter.Gen) { + gens["DataDisks"] = gen.SliceOf(ImageDataDiskStatusARMGenerator()) + gens["OsDisk"] = gen.PtrOf(ImageOSDiskStatusARMGenerator()) +} + +func Test_SubResource_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SubResource_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubResourceStatusARM, SubResourceStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubResourceStatusARM runs a test to see if a specific instance of SubResource_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSubResourceStatusARM(subject SubResource_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SubResource_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SubResource_StatusARM instances for property testing - lazily instantiated by +//SubResourceStatusARMGenerator() +var subResourceStatusARMGenerator gopter.Gen + +// SubResourceStatusARMGenerator returns a generator of SubResource_StatusARM instances for property testing. +func SubResourceStatusARMGenerator() gopter.Gen { + if subResourceStatusARMGenerator != nil { + return subResourceStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSubResourceStatusARM(generators) + subResourceStatusARMGenerator = gen.Struct(reflect.TypeOf(SubResource_StatusARM{}), generators) + + return subResourceStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForSubResourceStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSubResourceStatusARM(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ImageDataDisk_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageDataDisk_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageDataDiskStatusARM, ImageDataDiskStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageDataDiskStatusARM runs a test to see if a specific instance of ImageDataDisk_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImageDataDiskStatusARM(subject ImageDataDisk_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageDataDisk_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageDataDisk_StatusARM instances for property testing - lazily instantiated by +//ImageDataDiskStatusARMGenerator() +var imageDataDiskStatusARMGenerator gopter.Gen + +// ImageDataDiskStatusARMGenerator returns a generator of ImageDataDisk_StatusARM instances for property testing. +// We first initialize imageDataDiskStatusARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageDataDiskStatusARMGenerator() gopter.Gen { + if imageDataDiskStatusARMGenerator != nil { + return imageDataDiskStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDiskStatusARM(generators) + imageDataDiskStatusARMGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDiskStatusARM(generators) + AddRelatedPropertyGeneratorsForImageDataDiskStatusARM(generators) + imageDataDiskStatusARMGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk_StatusARM{}), generators) + + return imageDataDiskStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForImageDataDiskStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageDataDiskStatusARM(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.OneConstOf(ImageDataDiskStatusCachingNone, ImageDataDiskStatusCachingReadOnly, ImageDataDiskStatusCachingReadWrite)) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["Lun"] = gen.Int() + gens["StorageAccountType"] = gen.PtrOf(gen.OneConstOf( + StorageAccountType_StatusPremiumLRS, + StorageAccountType_StatusPremiumZRS, + StorageAccountType_StatusStandardLRS, + StorageAccountType_StatusStandardSSDLRS, + StorageAccountType_StatusStandardSSDZRS, + StorageAccountType_StatusUltraSSDLRS)) +} + +// AddRelatedPropertyGeneratorsForImageDataDiskStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageDataDiskStatusARM(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(SubResourceStatusARMGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceStatusARMGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceStatusARMGenerator()) +} + +func Test_ImageOSDisk_StatusARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageOSDisk_StatusARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageOSDiskStatusARM, ImageOSDiskStatusARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageOSDiskStatusARM runs a test to see if a specific instance of ImageOSDisk_StatusARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImageOSDiskStatusARM(subject ImageOSDisk_StatusARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageOSDisk_StatusARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageOSDisk_StatusARM instances for property testing - lazily instantiated by +//ImageOSDiskStatusARMGenerator() +var imageOSDiskStatusARMGenerator gopter.Gen + +// ImageOSDiskStatusARMGenerator returns a generator of ImageOSDisk_StatusARM instances for property testing. +// We first initialize imageOSDiskStatusARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageOSDiskStatusARMGenerator() gopter.Gen { + if imageOSDiskStatusARMGenerator != nil { + return imageOSDiskStatusARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDiskStatusARM(generators) + imageOSDiskStatusARMGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk_StatusARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDiskStatusARM(generators) + AddRelatedPropertyGeneratorsForImageOSDiskStatusARM(generators) + imageOSDiskStatusARMGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk_StatusARM{}), generators) + + return imageOSDiskStatusARMGenerator +} + +// AddIndependentPropertyGeneratorsForImageOSDiskStatusARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageOSDiskStatusARM(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.OneConstOf(ImageOSDiskStatusCachingNone, ImageOSDiskStatusCachingReadOnly, ImageOSDiskStatusCachingReadWrite)) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["OsState"] = gen.OneConstOf(ImageOSDiskStatusOsStateGeneralized, ImageOSDiskStatusOsStateSpecialized) + gens["OsType"] = gen.OneConstOf(ImageOSDiskStatusOsTypeLinux, ImageOSDiskStatusOsTypeWindows) + gens["StorageAccountType"] = gen.PtrOf(gen.OneConstOf( + StorageAccountType_StatusPremiumLRS, + StorageAccountType_StatusPremiumZRS, + StorageAccountType_StatusStandardLRS, + StorageAccountType_StatusStandardSSDLRS, + StorageAccountType_StatusStandardSSDZRS, + StorageAccountType_StatusUltraSSDLRS)) +} + +// AddRelatedPropertyGeneratorsForImageOSDiskStatusARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageOSDiskStatusARM(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(SubResourceStatusARMGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceStatusARMGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceStatusARMGenerator()) +} diff --git a/v2/api/compute/v1alpha1api20210701/image_types_gen.go b/v2/api/compute/v1alpha1api20210701/image_types_gen.go new file mode 100644 index 00000000000..3ae675da9c4 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701/image_types_gen.go @@ -0,0 +1,3147 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20210701 + +import ( + "fmt" + "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701storage" + "github.com/Azure/azure-service-operator/v2/internal/reflecthelpers" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + kerrors "k8s.io/apimachinery/pkg/util/errors" + "sigs.k8s.io/controller-runtime/pkg/conversion" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// +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" +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/resourceDefinitions/images +type Image struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec Images_Spec `json:"spec,omitempty"` + Status Image_Status `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &Image{} + +// GetConditions returns the conditions of the resource +func (image *Image) GetConditions() conditions.Conditions { + return image.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (image *Image) SetConditions(conditions conditions.Conditions) { + image.Status.Conditions = conditions +} + +var _ conversion.Convertible = &Image{} + +// ConvertFrom populates our Image from the provided hub Image +func (image *Image) ConvertFrom(hub conversion.Hub) error { + source, ok := hub.(*v1alpha1api20210701storage.Image) + if !ok { + return fmt.Errorf("expected storage:compute/v1alpha1api20210701storage/Image but received %T instead", hub) + } + + return image.AssignPropertiesFromImage(source) +} + +// ConvertTo populates the provided hub Image from our Image +func (image *Image) ConvertTo(hub conversion.Hub) error { + destination, ok := hub.(*v1alpha1api20210701storage.Image) + if !ok { + return fmt.Errorf("expected storage:compute/v1alpha1api20210701storage/Image but received %T instead", hub) + } + + return image.AssignPropertiesToImage(destination) +} + +// +kubebuilder:webhook:path=/mutate-compute-azure-com-v1alpha1api20210701-image,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=compute.azure.com,resources=images,verbs=create;update,versions=v1alpha1api20210701,name=default.v1alpha1api20210701.images.compute.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Defaulter = &Image{} + +// Default applies defaults to the Image resource +func (image *Image) Default() { + image.defaultImpl() + var temp interface{} = image + if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok { + runtimeDefaulter.CustomDefault() + } +} + +// defaultAzureName defaults the Azure name of the resource to the Kubernetes name +func (image *Image) defaultAzureName() { + if image.Spec.AzureName == "" { + image.Spec.AzureName = image.Name + } +} + +// defaultImpl applies the code generated defaults to the Image resource +func (image *Image) defaultImpl() { image.defaultAzureName() } + +var _ genruntime.KubernetesResource = &Image{} + +// AzureName returns the Azure name of the resource +func (image *Image) AzureName() string { + return image.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2021-07-01" +func (image Image) GetAPIVersion() string { + return "2021-07-01" +} + +// GetResourceKind returns the kind of the resource +func (image *Image) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (image *Image) GetSpec() genruntime.ConvertibleSpec { + return &image.Spec +} + +// GetStatus returns the status of this resource +func (image *Image) GetStatus() genruntime.ConvertibleStatus { + return &image.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Compute/images" +func (image *Image) GetType() string { + return "Microsoft.Compute/images" +} + +// NewEmptyStatus returns a new empty (blank) status +func (image *Image) NewEmptyStatus() genruntime.ConvertibleStatus { + return &Image_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (image *Image) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(image.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Name: image.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (image *Image) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*Image_Status); ok { + image.Status = *st + return nil + } + + // Convert status to required version + var st Image_Status + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + image.Status = st + return nil +} + +// +kubebuilder:webhook:path=/validate-compute-azure-com-v1alpha1api20210701-image,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=compute.azure.com,resources=images,verbs=create;update,versions=v1alpha1api20210701,name=validate.v1alpha1api20210701.images.compute.azure.com,admissionReviewVersions=v1beta1 + +var _ admission.Validator = &Image{} + +// ValidateCreate validates the creation of the resource +func (image *Image) ValidateCreate() error { + validations := image.createValidations() + var temp interface{} = image + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.CreateValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation() + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// ValidateDelete validates the deletion of the resource +func (image *Image) ValidateDelete() error { + validations := image.deleteValidations() + var temp interface{} = image + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.DeleteValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation() + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// ValidateUpdate validates an update of the resource +func (image *Image) ValidateUpdate(old runtime.Object) error { + validations := image.updateValidations() + var temp interface{} = image + if runtimeValidator, ok := temp.(genruntime.Validator); ok { + validations = append(validations, runtimeValidator.UpdateValidations()...) + } + var errs []error + for _, validation := range validations { + err := validation(old) + if err != nil { + errs = append(errs, err) + } + } + return kerrors.NewAggregate(errs) +} + +// createValidations validates the creation of the resource +func (image *Image) createValidations() []func() error { + return []func() error{image.validateResourceReferences} +} + +// deleteValidations validates the deletion of the resource +func (image *Image) deleteValidations() []func() error { + return nil +} + +// updateValidations validates the update of the resource +func (image *Image) updateValidations() []func(old runtime.Object) error { + return []func(old runtime.Object) error{ + func(old runtime.Object) error { + return image.validateResourceReferences() + }, + } +} + +// validateResourceReferences validates all resource references +func (image *Image) validateResourceReferences() error { + refs, err := reflecthelpers.FindResourceReferences(&image.Spec) + if err != nil { + return err + } + return genruntime.ValidateResourceReferences(refs) +} + +// AssignPropertiesFromImage populates our Image from the provided source Image +func (image *Image) AssignPropertiesFromImage(source *v1alpha1api20210701storage.Image) error { + + // ObjectMeta + image.ObjectMeta = *source.ObjectMeta.DeepCopy() + + // Spec + var spec Images_Spec + err := spec.AssignPropertiesFromImagesSpec(&source.Spec) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromImagesSpec() to populate field Spec") + } + image.Spec = spec + + // Status + var status Image_Status + err = status.AssignPropertiesFromImageStatus(&source.Status) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromImageStatus() to populate field Status") + } + image.Status = status + + // No error + return nil +} + +// AssignPropertiesToImage populates the provided destination Image from our Image +func (image *Image) AssignPropertiesToImage(destination *v1alpha1api20210701storage.Image) error { + + // ObjectMeta + destination.ObjectMeta = *image.ObjectMeta.DeepCopy() + + // Spec + var spec v1alpha1api20210701storage.Images_Spec + err := image.Spec.AssignPropertiesToImagesSpec(&spec) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToImagesSpec() to populate field Spec") + } + destination.Spec = spec + + // Status + var status v1alpha1api20210701storage.Image_Status + err = image.Status.AssignPropertiesToImageStatus(&status) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToImageStatus() to populate field Status") + } + destination.Status = status + + // No error + return nil +} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (image *Image) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: image.Spec.OriginalVersion(), + Kind: "Image", + } +} + +// +kubebuilder:object:root=true +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/resourceDefinitions/images +type ImageList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Image `json:"items"` +} + +type Image_Status struct { + //Conditions: The observed state of the resource + Conditions []conditions.Condition `json:"conditions,omitempty"` + + //ExtendedLocation: The extended location of the Image. + ExtendedLocation *ExtendedLocation_Status `json:"extendedLocation,omitempty"` + + //HyperVGeneration: Specifies the HyperVGenerationType of the VirtualMachine + //created from the image. From API Version 2019-03-01 if the image source is a + //blob, then we need the user to specify the value, if the source is managed + //resource like disk or snapshot, we may require the user to specify the property + //if we cannot deduce it from the source managed resource. + HyperVGeneration *HyperVGenerationType_Status `json:"hyperVGeneration,omitempty"` + + //Id: Resource Id + Id *string `json:"id,omitempty"` + + //Location: Resource location + Location *string `json:"location,omitempty"` + + //Name: Resource name + Name *string `json:"name,omitempty"` + + //ProvisioningState: The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + + //SourceVirtualMachine: The source virtual machine from which Image is created. + SourceVirtualMachine *SubResource_Status `json:"sourceVirtualMachine,omitempty"` + + //StorageProfile: Specifies the storage settings for the virtual machine disks. + StorageProfile *ImageStorageProfile_Status `json:"storageProfile,omitempty"` + + //Tags: Resource tags + Tags map[string]string `json:"tags,omitempty"` + + //Type: Resource type + Type *string `json:"type,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &Image_Status{} + +// ConvertStatusFrom populates our Image_Status from the provided source +func (image *Image_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + src, ok := source.(*v1alpha1api20210701storage.Image_Status) + if ok { + // Populate our instance from source + return image.AssignPropertiesFromImageStatus(src) + } + + // Convert to an intermediate form + src = &v1alpha1api20210701storage.Image_Status{} + err := src.ConvertStatusFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusFrom()") + } + + // Update our instance from src + err = image.AssignPropertiesFromImageStatus(src) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertStatusFrom()") + } + + return nil +} + +// ConvertStatusTo populates the provided destination from our Image_Status +func (image *Image_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + dst, ok := destination.(*v1alpha1api20210701storage.Image_Status) + if ok { + // Populate destination from our instance + return image.AssignPropertiesToImageStatus(dst) + } + + // Convert to an intermediate form + dst = &v1alpha1api20210701storage.Image_Status{} + err := image.AssignPropertiesToImageStatus(dst) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertStatusTo()") + } + + // Update dst from our instance + err = dst.ConvertStatusTo(destination) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertStatusTo()") + } + + return nil +} + +var _ genruntime.FromARMConverter = &Image_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (image *Image_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &Image_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (image *Image_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(Image_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Image_StatusARM, got %T", armInput) + } + + // no assignment for property ‘Conditions’ + + // Set property ‘ExtendedLocation’: + if typedInput.ExtendedLocation != nil { + var extendedLocation1 ExtendedLocation_Status + err := extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation) + if err != nil { + return err + } + extendedLocation := extendedLocation1 + image.ExtendedLocation = &extendedLocation + } + + // Set property ‘HyperVGeneration’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.HyperVGeneration != nil { + hyperVGeneration := *typedInput.Properties.HyperVGeneration + image.HyperVGeneration = &hyperVGeneration + } + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + image.Id = &id + } + + // Set property ‘Location’: + if typedInput.Location != nil { + location := *typedInput.Location + image.Location = &location + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + image.Name = &name + } + + // Set property ‘ProvisioningState’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.ProvisioningState != nil { + provisioningState := *typedInput.Properties.ProvisioningState + image.ProvisioningState = &provisioningState + } + } + + // Set property ‘SourceVirtualMachine’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.SourceVirtualMachine != nil { + var sourceVirtualMachine1 SubResource_Status + err := sourceVirtualMachine1.PopulateFromARM(owner, *typedInput.Properties.SourceVirtualMachine) + if err != nil { + return err + } + sourceVirtualMachine := sourceVirtualMachine1 + image.SourceVirtualMachine = &sourceVirtualMachine + } + } + + // Set property ‘StorageProfile’: + // copying flattened property: + if typedInput.Properties != nil { + if typedInput.Properties.StorageProfile != nil { + var storageProfile1 ImageStorageProfile_Status + err := storageProfile1.PopulateFromARM(owner, *typedInput.Properties.StorageProfile) + if err != nil { + return err + } + storageProfile := storageProfile1 + image.StorageProfile = &storageProfile + } + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + image.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + image.Tags[key] = value + } + } + + // Set property ‘Type’: + if typedInput.Type != nil { + typeVar := *typedInput.Type + image.Type = &typeVar + } + + // No error + return nil +} + +// AssignPropertiesFromImageStatus populates our Image_Status from the provided source Image_Status +func (image *Image_Status) AssignPropertiesFromImageStatus(source *v1alpha1api20210701storage.Image_Status) error { + + // Conditions + image.Conditions = genruntime.CloneSliceOfCondition(source.Conditions) + + // ExtendedLocation + if source.ExtendedLocation != nil { + var extendedLocation ExtendedLocation_Status + err := extendedLocation.AssignPropertiesFromExtendedLocationStatus(source.ExtendedLocation) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromExtendedLocationStatus() to populate field ExtendedLocation") + } + image.ExtendedLocation = &extendedLocation + } else { + image.ExtendedLocation = nil + } + + // HyperVGeneration + if source.HyperVGeneration != nil { + hyperVGeneration := HyperVGenerationType_Status(*source.HyperVGeneration) + image.HyperVGeneration = &hyperVGeneration + } else { + image.HyperVGeneration = nil + } + + // Id + image.Id = genruntime.ClonePointerToString(source.Id) + + // Location + image.Location = genruntime.ClonePointerToString(source.Location) + + // Name + image.Name = genruntime.ClonePointerToString(source.Name) + + // ProvisioningState + image.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState) + + // SourceVirtualMachine + if source.SourceVirtualMachine != nil { + var sourceVirtualMachine SubResource_Status + err := sourceVirtualMachine.AssignPropertiesFromSubResourceStatus(source.SourceVirtualMachine) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResourceStatus() to populate field SourceVirtualMachine") + } + image.SourceVirtualMachine = &sourceVirtualMachine + } else { + image.SourceVirtualMachine = nil + } + + // StorageProfile + if source.StorageProfile != nil { + var storageProfile ImageStorageProfile_Status + err := storageProfile.AssignPropertiesFromImageStorageProfileStatus(source.StorageProfile) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromImageStorageProfileStatus() to populate field StorageProfile") + } + image.StorageProfile = &storageProfile + } else { + image.StorageProfile = nil + } + + // Tags + image.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // Type + image.Type = genruntime.ClonePointerToString(source.Type) + + // No error + return nil +} + +// AssignPropertiesToImageStatus populates the provided destination Image_Status from our Image_Status +func (image *Image_Status) AssignPropertiesToImageStatus(destination *v1alpha1api20210701storage.Image_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Conditions + destination.Conditions = genruntime.CloneSliceOfCondition(image.Conditions) + + // ExtendedLocation + if image.ExtendedLocation != nil { + var extendedLocation v1alpha1api20210701storage.ExtendedLocation_Status + err := image.ExtendedLocation.AssignPropertiesToExtendedLocationStatus(&extendedLocation) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToExtendedLocationStatus() to populate field ExtendedLocation") + } + destination.ExtendedLocation = &extendedLocation + } else { + destination.ExtendedLocation = nil + } + + // HyperVGeneration + if image.HyperVGeneration != nil { + hyperVGeneration := string(*image.HyperVGeneration) + destination.HyperVGeneration = &hyperVGeneration + } else { + destination.HyperVGeneration = nil + } + + // Id + destination.Id = genruntime.ClonePointerToString(image.Id) + + // Location + destination.Location = genruntime.ClonePointerToString(image.Location) + + // Name + destination.Name = genruntime.ClonePointerToString(image.Name) + + // ProvisioningState + destination.ProvisioningState = genruntime.ClonePointerToString(image.ProvisioningState) + + // SourceVirtualMachine + if image.SourceVirtualMachine != nil { + var sourceVirtualMachine v1alpha1api20210701storage.SubResource_Status + err := image.SourceVirtualMachine.AssignPropertiesToSubResourceStatus(&sourceVirtualMachine) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResourceStatus() to populate field SourceVirtualMachine") + } + destination.SourceVirtualMachine = &sourceVirtualMachine + } else { + destination.SourceVirtualMachine = nil + } + + // StorageProfile + if image.StorageProfile != nil { + var storageProfile v1alpha1api20210701storage.ImageStorageProfile_Status + err := image.StorageProfile.AssignPropertiesToImageStorageProfileStatus(&storageProfile) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToImageStorageProfileStatus() to populate field StorageProfile") + } + destination.StorageProfile = &storageProfile + } else { + destination.StorageProfile = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(image.Tags) + + // Type + destination.Type = genruntime.ClonePointerToString(image.Type) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={"2021-07-01"} +type ImagesSpecAPIVersion string + +const ImagesSpecAPIVersion20210701 = ImagesSpecAPIVersion("2021-07-01") + +type Images_Spec struct { + //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"` + + //ExtendedLocation: The complex type of the extended location. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + + //HyperVGeneration: Specifies the HyperVGenerationType of the VirtualMachine + //created from the image. From API Version 2019-03-01 if the image source is a + //blob, then we need the user to specify the value, if the source is managed + //resource like disk or snapshot, we may require the user to specify the property + //if we cannot deduce it from the source managed resource. + HyperVGeneration *ImagePropertiesHyperVGeneration `json:"hyperVGeneration,omitempty"` + + //Location: Location to deploy resource to + Location string `json:"location,omitempty"` + + // +kubebuilder:validation:Required + Owner genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner" kind:"ResourceGroup"` + SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` + + //StorageProfile: Describes a storage profile. + StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` + + //Tags: Name-value pairs to add to the resource + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMTransformer = &Images_Spec{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (images *Images_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if images == nil { + return nil, nil + } + var result Images_SpecARM + + // Set property ‘ExtendedLocation’: + if images.ExtendedLocation != nil { + extendedLocationARM, err := (*images.ExtendedLocation).ConvertToARM(resolved) + if err != nil { + return nil, err + } + extendedLocation := extendedLocationARM.(ExtendedLocationARM) + result.ExtendedLocation = &extendedLocation + } + + // Set property ‘Location’: + result.Location = images.Location + + // Set property ‘Name’: + result.Name = resolved.Name + + // Set property ‘Properties’: + if images.HyperVGeneration != nil { + hyperVGeneration := *images.HyperVGeneration + result.Properties.HyperVGeneration = &hyperVGeneration + } + if images.SourceVirtualMachine != nil { + sourceVirtualMachineARM, err := (*images.SourceVirtualMachine).ConvertToARM(resolved) + if err != nil { + return nil, err + } + sourceVirtualMachine := sourceVirtualMachineARM.(SubResourceARM) + result.Properties.SourceVirtualMachine = &sourceVirtualMachine + } + if images.StorageProfile != nil { + storageProfileARM, err := (*images.StorageProfile).ConvertToARM(resolved) + if err != nil { + return nil, err + } + storageProfile := storageProfileARM.(ImageStorageProfileARM) + result.Properties.StorageProfile = &storageProfile + } + + // Set property ‘Tags’: + if images.Tags != nil { + result.Tags = make(map[string]string) + for key, value := range images.Tags { + result.Tags[key] = value + } + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (images *Images_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &Images_SpecARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (images *Images_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(Images_SpecARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected Images_SpecARM, got %T", armInput) + } + + // Set property ‘AzureName’: + images.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name)) + + // Set property ‘ExtendedLocation’: + if typedInput.ExtendedLocation != nil { + var extendedLocation1 ExtendedLocation + err := extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation) + if err != nil { + return err + } + extendedLocation := extendedLocation1 + images.ExtendedLocation = &extendedLocation + } + + // Set property ‘HyperVGeneration’: + // copying flattened property: + if typedInput.Properties.HyperVGeneration != nil { + hyperVGeneration := *typedInput.Properties.HyperVGeneration + images.HyperVGeneration = &hyperVGeneration + } + + // Set property ‘Location’: + images.Location = typedInput.Location + + // Set property ‘Owner’: + images.Owner = genruntime.KnownResourceReference{ + Name: owner.Name, + } + + // Set property ‘SourceVirtualMachine’: + // copying flattened property: + if typedInput.Properties.SourceVirtualMachine != nil { + var sourceVirtualMachine1 SubResource + err := sourceVirtualMachine1.PopulateFromARM(owner, *typedInput.Properties.SourceVirtualMachine) + if err != nil { + return err + } + sourceVirtualMachine := sourceVirtualMachine1 + images.SourceVirtualMachine = &sourceVirtualMachine + } + + // Set property ‘StorageProfile’: + // copying flattened property: + if typedInput.Properties.StorageProfile != nil { + var storageProfile1 ImageStorageProfile + err := storageProfile1.PopulateFromARM(owner, *typedInput.Properties.StorageProfile) + if err != nil { + return err + } + storageProfile := storageProfile1 + images.StorageProfile = &storageProfile + } + + // Set property ‘Tags’: + if typedInput.Tags != nil { + images.Tags = make(map[string]string) + for key, value := range typedInput.Tags { + images.Tags[key] = value + } + } + + // No error + return nil +} + +var _ genruntime.ConvertibleSpec = &Images_Spec{} + +// ConvertSpecFrom populates our Images_Spec from the provided source +func (images *Images_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + src, ok := source.(*v1alpha1api20210701storage.Images_Spec) + if ok { + // Populate our instance from source + return images.AssignPropertiesFromImagesSpec(src) + } + + // Convert to an intermediate form + src = &v1alpha1api20210701storage.Images_Spec{} + err := src.ConvertSpecFrom(source) + if err != nil { + return errors.Wrap(err, "initial step of conversion in ConvertSpecFrom()") + } + + // Update our instance from src + err = images.AssignPropertiesFromImagesSpec(src) + if err != nil { + return errors.Wrap(err, "final step of conversion in ConvertSpecFrom()") + } + + return nil +} + +// ConvertSpecTo populates the provided destination from our Images_Spec +func (images *Images_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + dst, ok := destination.(*v1alpha1api20210701storage.Images_Spec) + if ok { + // Populate destination from our instance + return images.AssignPropertiesToImagesSpec(dst) + } + + // Convert to an intermediate form + dst = &v1alpha1api20210701storage.Images_Spec{} + err := images.AssignPropertiesToImagesSpec(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 +} + +// AssignPropertiesFromImagesSpec populates our Images_Spec from the provided source Images_Spec +func (images *Images_Spec) AssignPropertiesFromImagesSpec(source *v1alpha1api20210701storage.Images_Spec) error { + + // AzureName + images.AzureName = source.AzureName + + // ExtendedLocation + if source.ExtendedLocation != nil { + var extendedLocation ExtendedLocation + err := extendedLocation.AssignPropertiesFromExtendedLocation(source.ExtendedLocation) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromExtendedLocation() to populate field ExtendedLocation") + } + images.ExtendedLocation = &extendedLocation + } else { + images.ExtendedLocation = nil + } + + // HyperVGeneration + if source.HyperVGeneration != nil { + hyperVGeneration := ImagePropertiesHyperVGeneration(*source.HyperVGeneration) + images.HyperVGeneration = &hyperVGeneration + } else { + images.HyperVGeneration = nil + } + + // Location + images.Location = genruntime.GetOptionalStringValue(source.Location) + + // Owner + images.Owner = source.Owner.Copy() + + // SourceVirtualMachine + if source.SourceVirtualMachine != nil { + var sourceVirtualMachine SubResource + err := sourceVirtualMachine.AssignPropertiesFromSubResource(source.SourceVirtualMachine) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResource() to populate field SourceVirtualMachine") + } + images.SourceVirtualMachine = &sourceVirtualMachine + } else { + images.SourceVirtualMachine = nil + } + + // StorageProfile + if source.StorageProfile != nil { + var storageProfile ImageStorageProfile + err := storageProfile.AssignPropertiesFromImageStorageProfile(source.StorageProfile) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromImageStorageProfile() to populate field StorageProfile") + } + images.StorageProfile = &storageProfile + } else { + images.StorageProfile = nil + } + + // Tags + images.Tags = genruntime.CloneMapOfStringToString(source.Tags) + + // No error + return nil +} + +// AssignPropertiesToImagesSpec populates the provided destination Images_Spec from our Images_Spec +func (images *Images_Spec) AssignPropertiesToImagesSpec(destination *v1alpha1api20210701storage.Images_Spec) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // AzureName + destination.AzureName = images.AzureName + + // ExtendedLocation + if images.ExtendedLocation != nil { + var extendedLocation v1alpha1api20210701storage.ExtendedLocation + err := images.ExtendedLocation.AssignPropertiesToExtendedLocation(&extendedLocation) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToExtendedLocation() to populate field ExtendedLocation") + } + destination.ExtendedLocation = &extendedLocation + } else { + destination.ExtendedLocation = nil + } + + // HyperVGeneration + if images.HyperVGeneration != nil { + hyperVGeneration := string(*images.HyperVGeneration) + destination.HyperVGeneration = &hyperVGeneration + } else { + destination.HyperVGeneration = nil + } + + // Location + location := images.Location + destination.Location = &location + + // OriginalVersion + destination.OriginalVersion = images.OriginalVersion() + + // Owner + destination.Owner = images.Owner.Copy() + + // SourceVirtualMachine + if images.SourceVirtualMachine != nil { + var sourceVirtualMachine v1alpha1api20210701storage.SubResource + err := images.SourceVirtualMachine.AssignPropertiesToSubResource(&sourceVirtualMachine) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResource() to populate field SourceVirtualMachine") + } + destination.SourceVirtualMachine = &sourceVirtualMachine + } else { + destination.SourceVirtualMachine = nil + } + + // StorageProfile + if images.StorageProfile != nil { + var storageProfile v1alpha1api20210701storage.ImageStorageProfile + err := images.StorageProfile.AssignPropertiesToImageStorageProfile(&storageProfile) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToImageStorageProfile() to populate field StorageProfile") + } + destination.StorageProfile = &storageProfile + } else { + destination.StorageProfile = nil + } + + // Tags + destination.Tags = genruntime.CloneMapOfStringToString(images.Tags) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// OriginalVersion returns the original API version used to create the resource. +func (images *Images_Spec) OriginalVersion() string { + return GroupVersion.Version +} + +// SetAzureName sets the Azure name of the resource +func (images *Images_Spec) SetAzureName(azureName string) { images.AzureName = azureName } + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ExtendedLocation +type ExtendedLocation struct { + //Name: The name of the extended location. + Name *string `json:"name,omitempty"` + + //Type: The type of the extended location. + Type *ExtendedLocationType `json:"type,omitempty"` +} + +var _ genruntime.ARMTransformer = &ExtendedLocation{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (location *ExtendedLocation) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if location == nil { + return nil, nil + } + var result ExtendedLocationARM + + // Set property ‘Name’: + if location.Name != nil { + name := *location.Name + result.Name = &name + } + + // Set property ‘Type’: + if location.Type != nil { + typeVar := *location.Type + result.Type = &typeVar + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (location *ExtendedLocation) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &ExtendedLocationARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (location *ExtendedLocation) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(ExtendedLocationARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ExtendedLocationARM, got %T", armInput) + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + location.Name = &name + } + + // Set property ‘Type’: + if typedInput.Type != nil { + typeVar := *typedInput.Type + location.Type = &typeVar + } + + // No error + return nil +} + +// AssignPropertiesFromExtendedLocation populates our ExtendedLocation from the provided source ExtendedLocation +func (location *ExtendedLocation) AssignPropertiesFromExtendedLocation(source *v1alpha1api20210701storage.ExtendedLocation) error { + + // Name + location.Name = genruntime.ClonePointerToString(source.Name) + + // Type + if source.Type != nil { + typeVar := ExtendedLocationType(*source.Type) + location.Type = &typeVar + } else { + location.Type = nil + } + + // No error + return nil +} + +// AssignPropertiesToExtendedLocation populates the provided destination ExtendedLocation from our ExtendedLocation +func (location *ExtendedLocation) AssignPropertiesToExtendedLocation(destination *v1alpha1api20210701storage.ExtendedLocation) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Name + destination.Name = genruntime.ClonePointerToString(location.Name) + + // Type + if location.Type != nil { + typeVar := string(*location.Type) + destination.Type = &typeVar + } else { + destination.Type = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +type ExtendedLocation_Status struct { + //Name: The name of the extended location. + Name *string `json:"name,omitempty"` + + //Type: The type of the extended location. + Type *ExtendedLocationType_Status `json:"type,omitempty"` +} + +var _ genruntime.FromARMConverter = &ExtendedLocation_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (location *ExtendedLocation_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &ExtendedLocation_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (location *ExtendedLocation_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(ExtendedLocation_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ExtendedLocation_StatusARM, got %T", armInput) + } + + // Set property ‘Name’: + if typedInput.Name != nil { + name := *typedInput.Name + location.Name = &name + } + + // Set property ‘Type’: + if typedInput.Type != nil { + typeVar := *typedInput.Type + location.Type = &typeVar + } + + // No error + return nil +} + +// AssignPropertiesFromExtendedLocationStatus populates our ExtendedLocation_Status from the provided source ExtendedLocation_Status +func (location *ExtendedLocation_Status) AssignPropertiesFromExtendedLocationStatus(source *v1alpha1api20210701storage.ExtendedLocation_Status) error { + + // Name + location.Name = genruntime.ClonePointerToString(source.Name) + + // Type + if source.Type != nil { + typeVar := ExtendedLocationType_Status(*source.Type) + location.Type = &typeVar + } else { + location.Type = nil + } + + // No error + return nil +} + +// AssignPropertiesToExtendedLocationStatus populates the provided destination ExtendedLocation_Status from our ExtendedLocation_Status +func (location *ExtendedLocation_Status) AssignPropertiesToExtendedLocationStatus(destination *v1alpha1api20210701storage.ExtendedLocation_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Name + destination.Name = genruntime.ClonePointerToString(location.Name) + + // Type + if location.Type != nil { + typeVar := string(*location.Type) + destination.Type = &typeVar + } else { + destination.Type = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +type HyperVGenerationType_Status string + +const ( + HyperVGenerationType_StatusV1 = HyperVGenerationType_Status("V1") + HyperVGenerationType_StatusV2 = HyperVGenerationType_Status("V2") +) + +// +kubebuilder:validation:Enum={"V1","V2"} +type ImagePropertiesHyperVGeneration string + +const ( + ImagePropertiesHyperVGenerationV1 = ImagePropertiesHyperVGeneration("V1") + ImagePropertiesHyperVGenerationV2 = ImagePropertiesHyperVGeneration("V2") +) + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageStorageProfile +type ImageStorageProfile struct { + //DataDisks: Specifies the parameters that are used to add a data disk to a + //virtual machine. + //For more information about disks, see [About disks and VHDs for Azure virtual + //machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + DataDisks []ImageDataDisk `json:"dataDisks,omitempty"` + + //OsDisk: Describes an Operating System disk. + OsDisk *ImageOSDisk `json:"osDisk,omitempty"` + + //ZoneResilient: Specifies whether an image is zone resilient or not. Default is + //false. Zone resilient images can be created only in regions that provide Zone + //Redundant Storage (ZRS). + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} + +var _ genruntime.ARMTransformer = &ImageStorageProfile{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (profile *ImageStorageProfile) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if profile == nil { + return nil, nil + } + var result ImageStorageProfileARM + + // Set property ‘DataDisks’: + for _, item := range profile.DataDisks { + itemARM, err := item.ConvertToARM(resolved) + if err != nil { + return nil, err + } + result.DataDisks = append(result.DataDisks, itemARM.(ImageDataDiskARM)) + } + + // Set property ‘OsDisk’: + if profile.OsDisk != nil { + osDiskARM, err := (*profile.OsDisk).ConvertToARM(resolved) + if err != nil { + return nil, err + } + osDisk := osDiskARM.(ImageOSDiskARM) + result.OsDisk = &osDisk + } + + // Set property ‘ZoneResilient’: + if profile.ZoneResilient != nil { + zoneResilient := *profile.ZoneResilient + result.ZoneResilient = &zoneResilient + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (profile *ImageStorageProfile) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &ImageStorageProfileARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (profile *ImageStorageProfile) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(ImageStorageProfileARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ImageStorageProfileARM, got %T", armInput) + } + + // Set property ‘DataDisks’: + for _, item := range typedInput.DataDisks { + var item1 ImageDataDisk + err := item1.PopulateFromARM(owner, item) + if err != nil { + return err + } + profile.DataDisks = append(profile.DataDisks, item1) + } + + // Set property ‘OsDisk’: + if typedInput.OsDisk != nil { + var osDisk1 ImageOSDisk + err := osDisk1.PopulateFromARM(owner, *typedInput.OsDisk) + if err != nil { + return err + } + osDisk := osDisk1 + profile.OsDisk = &osDisk + } + + // Set property ‘ZoneResilient’: + if typedInput.ZoneResilient != nil { + zoneResilient := *typedInput.ZoneResilient + profile.ZoneResilient = &zoneResilient + } + + // No error + return nil +} + +// AssignPropertiesFromImageStorageProfile populates our ImageStorageProfile from the provided source ImageStorageProfile +func (profile *ImageStorageProfile) AssignPropertiesFromImageStorageProfile(source *v1alpha1api20210701storage.ImageStorageProfile) error { + + // DataDisks + if source.DataDisks != nil { + dataDiskList := make([]ImageDataDisk, len(source.DataDisks)) + for dataDiskIndex, dataDiskItem := range source.DataDisks { + // Shadow the loop variable to avoid aliasing + dataDiskItem := dataDiskItem + var dataDisk ImageDataDisk + err := dataDisk.AssignPropertiesFromImageDataDisk(&dataDiskItem) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromImageDataDisk() to populate field DataDisks") + } + dataDiskList[dataDiskIndex] = dataDisk + } + profile.DataDisks = dataDiskList + } else { + profile.DataDisks = nil + } + + // OsDisk + if source.OsDisk != nil { + var osDisk ImageOSDisk + err := osDisk.AssignPropertiesFromImageOSDisk(source.OsDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromImageOSDisk() to populate field OsDisk") + } + profile.OsDisk = &osDisk + } else { + profile.OsDisk = nil + } + + // ZoneResilient + if source.ZoneResilient != nil { + zoneResilient := *source.ZoneResilient + profile.ZoneResilient = &zoneResilient + } else { + profile.ZoneResilient = nil + } + + // No error + return nil +} + +// AssignPropertiesToImageStorageProfile populates the provided destination ImageStorageProfile from our ImageStorageProfile +func (profile *ImageStorageProfile) AssignPropertiesToImageStorageProfile(destination *v1alpha1api20210701storage.ImageStorageProfile) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // DataDisks + if profile.DataDisks != nil { + dataDiskList := make([]v1alpha1api20210701storage.ImageDataDisk, len(profile.DataDisks)) + for dataDiskIndex, dataDiskItem := range profile.DataDisks { + // Shadow the loop variable to avoid aliasing + dataDiskItem := dataDiskItem + var dataDisk v1alpha1api20210701storage.ImageDataDisk + err := dataDiskItem.AssignPropertiesToImageDataDisk(&dataDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToImageDataDisk() to populate field DataDisks") + } + dataDiskList[dataDiskIndex] = dataDisk + } + destination.DataDisks = dataDiskList + } else { + destination.DataDisks = nil + } + + // OsDisk + if profile.OsDisk != nil { + var osDisk v1alpha1api20210701storage.ImageOSDisk + err := profile.OsDisk.AssignPropertiesToImageOSDisk(&osDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToImageOSDisk() to populate field OsDisk") + } + destination.OsDisk = &osDisk + } else { + destination.OsDisk = nil + } + + // ZoneResilient + if profile.ZoneResilient != nil { + zoneResilient := *profile.ZoneResilient + destination.ZoneResilient = &zoneResilient + } else { + destination.ZoneResilient = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +type ImageStorageProfile_Status struct { + //DataDisks: Specifies the parameters that are used to add a data disk to a + //virtual machine. + //For more information about disks, see [About disks and VHDs for Azure virtual + //machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + DataDisks []ImageDataDisk_Status `json:"dataDisks,omitempty"` + + //OsDisk: Specifies information about the operating system disk used by the + //virtual machine. + //For more information about disks, see [About disks and VHDs for Azure virtual + //machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + OsDisk *ImageOSDisk_Status `json:"osDisk,omitempty"` + + //ZoneResilient: Specifies whether an image is zone resilient or not. Default is + //false. Zone resilient images can be created only in regions that provide Zone + //Redundant Storage (ZRS). + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} + +var _ genruntime.FromARMConverter = &ImageStorageProfile_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (profile *ImageStorageProfile_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &ImageStorageProfile_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (profile *ImageStorageProfile_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(ImageStorageProfile_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ImageStorageProfile_StatusARM, got %T", armInput) + } + + // Set property ‘DataDisks’: + for _, item := range typedInput.DataDisks { + var item1 ImageDataDisk_Status + err := item1.PopulateFromARM(owner, item) + if err != nil { + return err + } + profile.DataDisks = append(profile.DataDisks, item1) + } + + // Set property ‘OsDisk’: + if typedInput.OsDisk != nil { + var osDisk1 ImageOSDisk_Status + err := osDisk1.PopulateFromARM(owner, *typedInput.OsDisk) + if err != nil { + return err + } + osDisk := osDisk1 + profile.OsDisk = &osDisk + } + + // Set property ‘ZoneResilient’: + if typedInput.ZoneResilient != nil { + zoneResilient := *typedInput.ZoneResilient + profile.ZoneResilient = &zoneResilient + } + + // No error + return nil +} + +// AssignPropertiesFromImageStorageProfileStatus populates our ImageStorageProfile_Status from the provided source ImageStorageProfile_Status +func (profile *ImageStorageProfile_Status) AssignPropertiesFromImageStorageProfileStatus(source *v1alpha1api20210701storage.ImageStorageProfile_Status) error { + + // DataDisks + if source.DataDisks != nil { + dataDiskList := make([]ImageDataDisk_Status, len(source.DataDisks)) + for dataDiskIndex, dataDiskItem := range source.DataDisks { + // Shadow the loop variable to avoid aliasing + dataDiskItem := dataDiskItem + var dataDisk ImageDataDisk_Status + err := dataDisk.AssignPropertiesFromImageDataDiskStatus(&dataDiskItem) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromImageDataDiskStatus() to populate field DataDisks") + } + dataDiskList[dataDiskIndex] = dataDisk + } + profile.DataDisks = dataDiskList + } else { + profile.DataDisks = nil + } + + // OsDisk + if source.OsDisk != nil { + var osDisk ImageOSDisk_Status + err := osDisk.AssignPropertiesFromImageOSDiskStatus(source.OsDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromImageOSDiskStatus() to populate field OsDisk") + } + profile.OsDisk = &osDisk + } else { + profile.OsDisk = nil + } + + // ZoneResilient + if source.ZoneResilient != nil { + zoneResilient := *source.ZoneResilient + profile.ZoneResilient = &zoneResilient + } else { + profile.ZoneResilient = nil + } + + // No error + return nil +} + +// AssignPropertiesToImageStorageProfileStatus populates the provided destination ImageStorageProfile_Status from our ImageStorageProfile_Status +func (profile *ImageStorageProfile_Status) AssignPropertiesToImageStorageProfileStatus(destination *v1alpha1api20210701storage.ImageStorageProfile_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // DataDisks + if profile.DataDisks != nil { + dataDiskList := make([]v1alpha1api20210701storage.ImageDataDisk_Status, len(profile.DataDisks)) + for dataDiskIndex, dataDiskItem := range profile.DataDisks { + // Shadow the loop variable to avoid aliasing + dataDiskItem := dataDiskItem + var dataDisk v1alpha1api20210701storage.ImageDataDisk_Status + err := dataDiskItem.AssignPropertiesToImageDataDiskStatus(&dataDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToImageDataDiskStatus() to populate field DataDisks") + } + dataDiskList[dataDiskIndex] = dataDisk + } + destination.DataDisks = dataDiskList + } else { + destination.DataDisks = nil + } + + // OsDisk + if profile.OsDisk != nil { + var osDisk v1alpha1api20210701storage.ImageOSDisk_Status + err := profile.OsDisk.AssignPropertiesToImageOSDiskStatus(&osDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToImageOSDiskStatus() to populate field OsDisk") + } + destination.OsDisk = &osDisk + } else { + destination.OsDisk = nil + } + + // ZoneResilient + if profile.ZoneResilient != nil { + zoneResilient := *profile.ZoneResilient + destination.ZoneResilient = &zoneResilient + } else { + destination.ZoneResilient = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/SubResource +type SubResource struct { + //Reference: Resource Id + Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"` +} + +var _ genruntime.ARMTransformer = &SubResource{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (resource *SubResource) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if resource == nil { + return nil, nil + } + var result SubResourceARM + + // Set property ‘Id’: + if resource.Reference != nil { + referenceARMID, err := resolved.ResolvedReferences.ARMIDOrErr(*resource.Reference) + if err != nil { + return nil, err + } + reference := referenceARMID + result.Id = &reference + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (resource *SubResource) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &SubResourceARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (resource *SubResource) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + _, ok := armInput.(SubResourceARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected SubResourceARM, got %T", armInput) + } + + // no assignment for property ‘Reference’ + + // No error + return nil +} + +// AssignPropertiesFromSubResource populates our SubResource from the provided source SubResource +func (resource *SubResource) AssignPropertiesFromSubResource(source *v1alpha1api20210701storage.SubResource) error { + + // Reference + if source.Reference != nil { + reference := source.Reference.Copy() + resource.Reference = &reference + } else { + resource.Reference = nil + } + + // No error + return nil +} + +// AssignPropertiesToSubResource populates the provided destination SubResource from our SubResource +func (resource *SubResource) AssignPropertiesToSubResource(destination *v1alpha1api20210701storage.SubResource) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Reference + if resource.Reference != nil { + reference := resource.Reference.Copy() + destination.Reference = &reference + } else { + destination.Reference = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +type SubResource_Status struct { + //Id: Resource Id + Id *string `json:"id,omitempty"` +} + +var _ genruntime.FromARMConverter = &SubResource_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (resource *SubResource_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &SubResource_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (resource *SubResource_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(SubResource_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected SubResource_StatusARM, got %T", armInput) + } + + // Set property ‘Id’: + if typedInput.Id != nil { + id := *typedInput.Id + resource.Id = &id + } + + // No error + return nil +} + +// AssignPropertiesFromSubResourceStatus populates our SubResource_Status from the provided source SubResource_Status +func (resource *SubResource_Status) AssignPropertiesFromSubResourceStatus(source *v1alpha1api20210701storage.SubResource_Status) error { + + // Id + resource.Id = genruntime.ClonePointerToString(source.Id) + + // No error + return nil +} + +// AssignPropertiesToSubResourceStatus populates the provided destination SubResource_Status from our SubResource_Status +func (resource *SubResource_Status) AssignPropertiesToSubResourceStatus(destination *v1alpha1api20210701storage.SubResource_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Id + destination.Id = genruntime.ClonePointerToString(resource.Id) + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageDataDisk +type ImageDataDisk struct { + //BlobUri: The Virtual Hard Disk. + BlobUri *string `json:"blobUri,omitempty"` + + //Caching: Specifies the caching requirements. + //Possible values are: + //None + //ReadOnly + //ReadWrite + //Default: None for Standard storage. ReadOnly for Premium storage. + Caching *ImageDataDiskCaching `json:"caching,omitempty"` + + //DiskEncryptionSet: Describes the parameter of customer managed disk encryption + //set resource id that can be specified for disk. + //NOTE: The disk encryption set resource id can only be specified for managed + //disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + + //DiskSizeGB: Specifies the size of empty data disks in gigabytes. This element + //can be used to overwrite the name of the disk in a virtual machine image. + //This value cannot be larger than 1023 GB + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + // +kubebuilder:validation:Required + //Lun: Specifies the logical unit number of the data disk. This value is used to + //identify data disks within the VM and therefore must be unique for each data + //disk attached to a VM. + Lun int `json:"lun"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + Snapshot *SubResource `json:"snapshot,omitempty"` + + //StorageAccountType: Specifies the storage account type for the managed disk. + //NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS + //Disk. + StorageAccountType *ImageDataDiskStorageAccountType `json:"storageAccountType,omitempty"` +} + +var _ genruntime.ARMTransformer = &ImageDataDisk{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (disk *ImageDataDisk) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if disk == nil { + return nil, nil + } + var result ImageDataDiskARM + + // Set property ‘BlobUri’: + if disk.BlobUri != nil { + blobUri := *disk.BlobUri + result.BlobUri = &blobUri + } + + // Set property ‘Caching’: + if disk.Caching != nil { + caching := *disk.Caching + result.Caching = &caching + } + + // Set property ‘DiskEncryptionSet’: + if disk.DiskEncryptionSet != nil { + diskEncryptionSetARM, err := (*disk.DiskEncryptionSet).ConvertToARM(resolved) + if err != nil { + return nil, err + } + diskEncryptionSet := diskEncryptionSetARM.(DiskEncryptionSetParametersARM) + result.DiskEncryptionSet = &diskEncryptionSet + } + + // Set property ‘DiskSizeGB’: + if disk.DiskSizeGB != nil { + diskSizeGB := *disk.DiskSizeGB + result.DiskSizeGB = &diskSizeGB + } + + // Set property ‘Lun’: + result.Lun = disk.Lun + + // Set property ‘ManagedDisk’: + if disk.ManagedDisk != nil { + managedDiskARM, err := (*disk.ManagedDisk).ConvertToARM(resolved) + if err != nil { + return nil, err + } + managedDisk := managedDiskARM.(SubResourceARM) + result.ManagedDisk = &managedDisk + } + + // Set property ‘Snapshot’: + if disk.Snapshot != nil { + snapshotARM, err := (*disk.Snapshot).ConvertToARM(resolved) + if err != nil { + return nil, err + } + snapshot := snapshotARM.(SubResourceARM) + result.Snapshot = &snapshot + } + + // Set property ‘StorageAccountType’: + if disk.StorageAccountType != nil { + storageAccountType := *disk.StorageAccountType + result.StorageAccountType = &storageAccountType + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (disk *ImageDataDisk) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &ImageDataDiskARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (disk *ImageDataDisk) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(ImageDataDiskARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ImageDataDiskARM, got %T", armInput) + } + + // Set property ‘BlobUri’: + if typedInput.BlobUri != nil { + blobUri := *typedInput.BlobUri + disk.BlobUri = &blobUri + } + + // Set property ‘Caching’: + if typedInput.Caching != nil { + caching := *typedInput.Caching + disk.Caching = &caching + } + + // Set property ‘DiskEncryptionSet’: + if typedInput.DiskEncryptionSet != nil { + var diskEncryptionSet1 DiskEncryptionSetParameters + err := diskEncryptionSet1.PopulateFromARM(owner, *typedInput.DiskEncryptionSet) + if err != nil { + return err + } + diskEncryptionSet := diskEncryptionSet1 + disk.DiskEncryptionSet = &diskEncryptionSet + } + + // Set property ‘DiskSizeGB’: + if typedInput.DiskSizeGB != nil { + diskSizeGB := *typedInput.DiskSizeGB + disk.DiskSizeGB = &diskSizeGB + } + + // Set property ‘Lun’: + disk.Lun = typedInput.Lun + + // Set property ‘ManagedDisk’: + if typedInput.ManagedDisk != nil { + var managedDisk1 SubResource + err := managedDisk1.PopulateFromARM(owner, *typedInput.ManagedDisk) + if err != nil { + return err + } + managedDisk := managedDisk1 + disk.ManagedDisk = &managedDisk + } + + // Set property ‘Snapshot’: + if typedInput.Snapshot != nil { + var snapshot1 SubResource + err := snapshot1.PopulateFromARM(owner, *typedInput.Snapshot) + if err != nil { + return err + } + snapshot := snapshot1 + disk.Snapshot = &snapshot + } + + // Set property ‘StorageAccountType’: + if typedInput.StorageAccountType != nil { + storageAccountType := *typedInput.StorageAccountType + disk.StorageAccountType = &storageAccountType + } + + // No error + return nil +} + +// AssignPropertiesFromImageDataDisk populates our ImageDataDisk from the provided source ImageDataDisk +func (disk *ImageDataDisk) AssignPropertiesFromImageDataDisk(source *v1alpha1api20210701storage.ImageDataDisk) error { + + // BlobUri + disk.BlobUri = genruntime.ClonePointerToString(source.BlobUri) + + // Caching + if source.Caching != nil { + caching := ImageDataDiskCaching(*source.Caching) + disk.Caching = &caching + } else { + disk.Caching = nil + } + + // DiskEncryptionSet + if source.DiskEncryptionSet != nil { + var diskEncryptionSet DiskEncryptionSetParameters + err := diskEncryptionSet.AssignPropertiesFromDiskEncryptionSetParameters(source.DiskEncryptionSet) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromDiskEncryptionSetParameters() to populate field DiskEncryptionSet") + } + disk.DiskEncryptionSet = &diskEncryptionSet + } else { + disk.DiskEncryptionSet = nil + } + + // DiskSizeGB + disk.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB) + + // Lun + disk.Lun = genruntime.GetOptionalIntValue(source.Lun) + + // ManagedDisk + if source.ManagedDisk != nil { + var managedDisk SubResource + err := managedDisk.AssignPropertiesFromSubResource(source.ManagedDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResource() to populate field ManagedDisk") + } + disk.ManagedDisk = &managedDisk + } else { + disk.ManagedDisk = nil + } + + // Snapshot + if source.Snapshot != nil { + var snapshot SubResource + err := snapshot.AssignPropertiesFromSubResource(source.Snapshot) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResource() to populate field Snapshot") + } + disk.Snapshot = &snapshot + } else { + disk.Snapshot = nil + } + + // StorageAccountType + if source.StorageAccountType != nil { + storageAccountType := ImageDataDiskStorageAccountType(*source.StorageAccountType) + disk.StorageAccountType = &storageAccountType + } else { + disk.StorageAccountType = nil + } + + // No error + return nil +} + +// AssignPropertiesToImageDataDisk populates the provided destination ImageDataDisk from our ImageDataDisk +func (disk *ImageDataDisk) AssignPropertiesToImageDataDisk(destination *v1alpha1api20210701storage.ImageDataDisk) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // BlobUri + destination.BlobUri = genruntime.ClonePointerToString(disk.BlobUri) + + // Caching + if disk.Caching != nil { + caching := string(*disk.Caching) + destination.Caching = &caching + } else { + destination.Caching = nil + } + + // DiskEncryptionSet + if disk.DiskEncryptionSet != nil { + var diskEncryptionSet v1alpha1api20210701storage.DiskEncryptionSetParameters + err := disk.DiskEncryptionSet.AssignPropertiesToDiskEncryptionSetParameters(&diskEncryptionSet) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToDiskEncryptionSetParameters() to populate field DiskEncryptionSet") + } + destination.DiskEncryptionSet = &diskEncryptionSet + } else { + destination.DiskEncryptionSet = nil + } + + // DiskSizeGB + destination.DiskSizeGB = genruntime.ClonePointerToInt(disk.DiskSizeGB) + + // Lun + lun := disk.Lun + destination.Lun = &lun + + // ManagedDisk + if disk.ManagedDisk != nil { + var managedDisk v1alpha1api20210701storage.SubResource + err := disk.ManagedDisk.AssignPropertiesToSubResource(&managedDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResource() to populate field ManagedDisk") + } + destination.ManagedDisk = &managedDisk + } else { + destination.ManagedDisk = nil + } + + // Snapshot + if disk.Snapshot != nil { + var snapshot v1alpha1api20210701storage.SubResource + err := disk.Snapshot.AssignPropertiesToSubResource(&snapshot) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResource() to populate field Snapshot") + } + destination.Snapshot = &snapshot + } else { + destination.Snapshot = nil + } + + // StorageAccountType + if disk.StorageAccountType != nil { + storageAccountType := string(*disk.StorageAccountType) + destination.StorageAccountType = &storageAccountType + } else { + destination.StorageAccountType = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +type ImageDataDisk_Status struct { + //BlobUri: The Virtual Hard Disk. + BlobUri *string `json:"blobUri,omitempty"` + + //Caching: Specifies the caching requirements. + //Possible values are: + //None + //ReadOnly + //ReadWrite + //Default: None for Standard storage. ReadOnly for Premium storage + Caching *ImageDataDiskStatusCaching `json:"caching,omitempty"` + + //DiskEncryptionSet: Specifies the customer managed disk encryption set resource + //id for the managed image disk. + DiskEncryptionSet *SubResource_Status `json:"diskEncryptionSet,omitempty"` + + //DiskSizeGB: Specifies the size of empty data disks in gigabytes. This element + //can be used to overwrite the name of the disk in a virtual machine image. + //This value cannot be larger than 1023 GB + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + // +kubebuilder:validation:Required + //Lun: Specifies the logical unit number of the data disk. This value is used to + //identify data disks within the VM and therefore must be unique for each data + //disk attached to a VM. + Lun int `json:"lun"` + + //ManagedDisk: The managedDisk. + ManagedDisk *SubResource_Status `json:"managedDisk,omitempty"` + + //Snapshot: The snapshot. + Snapshot *SubResource_Status `json:"snapshot,omitempty"` + + //StorageAccountType: Specifies the storage account type for the managed disk. + //NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS + //Disk. + StorageAccountType *StorageAccountType_Status `json:"storageAccountType,omitempty"` +} + +var _ genruntime.FromARMConverter = &ImageDataDisk_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (disk *ImageDataDisk_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &ImageDataDisk_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (disk *ImageDataDisk_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(ImageDataDisk_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ImageDataDisk_StatusARM, got %T", armInput) + } + + // Set property ‘BlobUri’: + if typedInput.BlobUri != nil { + blobUri := *typedInput.BlobUri + disk.BlobUri = &blobUri + } + + // Set property ‘Caching’: + if typedInput.Caching != nil { + caching := *typedInput.Caching + disk.Caching = &caching + } + + // Set property ‘DiskEncryptionSet’: + if typedInput.DiskEncryptionSet != nil { + var diskEncryptionSet1 SubResource_Status + err := diskEncryptionSet1.PopulateFromARM(owner, *typedInput.DiskEncryptionSet) + if err != nil { + return err + } + diskEncryptionSet := diskEncryptionSet1 + disk.DiskEncryptionSet = &diskEncryptionSet + } + + // Set property ‘DiskSizeGB’: + if typedInput.DiskSizeGB != nil { + diskSizeGB := *typedInput.DiskSizeGB + disk.DiskSizeGB = &diskSizeGB + } + + // Set property ‘Lun’: + disk.Lun = typedInput.Lun + + // Set property ‘ManagedDisk’: + if typedInput.ManagedDisk != nil { + var managedDisk1 SubResource_Status + err := managedDisk1.PopulateFromARM(owner, *typedInput.ManagedDisk) + if err != nil { + return err + } + managedDisk := managedDisk1 + disk.ManagedDisk = &managedDisk + } + + // Set property ‘Snapshot’: + if typedInput.Snapshot != nil { + var snapshot1 SubResource_Status + err := snapshot1.PopulateFromARM(owner, *typedInput.Snapshot) + if err != nil { + return err + } + snapshot := snapshot1 + disk.Snapshot = &snapshot + } + + // Set property ‘StorageAccountType’: + if typedInput.StorageAccountType != nil { + storageAccountType := *typedInput.StorageAccountType + disk.StorageAccountType = &storageAccountType + } + + // No error + return nil +} + +// AssignPropertiesFromImageDataDiskStatus populates our ImageDataDisk_Status from the provided source ImageDataDisk_Status +func (disk *ImageDataDisk_Status) AssignPropertiesFromImageDataDiskStatus(source *v1alpha1api20210701storage.ImageDataDisk_Status) error { + + // BlobUri + disk.BlobUri = genruntime.ClonePointerToString(source.BlobUri) + + // Caching + if source.Caching != nil { + caching := ImageDataDiskStatusCaching(*source.Caching) + disk.Caching = &caching + } else { + disk.Caching = nil + } + + // DiskEncryptionSet + if source.DiskEncryptionSet != nil { + var diskEncryptionSet SubResource_Status + err := diskEncryptionSet.AssignPropertiesFromSubResourceStatus(source.DiskEncryptionSet) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResourceStatus() to populate field DiskEncryptionSet") + } + disk.DiskEncryptionSet = &diskEncryptionSet + } else { + disk.DiskEncryptionSet = nil + } + + // DiskSizeGB + disk.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB) + + // Lun + disk.Lun = genruntime.GetOptionalIntValue(source.Lun) + + // ManagedDisk + if source.ManagedDisk != nil { + var managedDisk SubResource_Status + err := managedDisk.AssignPropertiesFromSubResourceStatus(source.ManagedDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResourceStatus() to populate field ManagedDisk") + } + disk.ManagedDisk = &managedDisk + } else { + disk.ManagedDisk = nil + } + + // Snapshot + if source.Snapshot != nil { + var snapshot SubResource_Status + err := snapshot.AssignPropertiesFromSubResourceStatus(source.Snapshot) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResourceStatus() to populate field Snapshot") + } + disk.Snapshot = &snapshot + } else { + disk.Snapshot = nil + } + + // StorageAccountType + if source.StorageAccountType != nil { + storageAccountType := StorageAccountType_Status(*source.StorageAccountType) + disk.StorageAccountType = &storageAccountType + } else { + disk.StorageAccountType = nil + } + + // No error + return nil +} + +// AssignPropertiesToImageDataDiskStatus populates the provided destination ImageDataDisk_Status from our ImageDataDisk_Status +func (disk *ImageDataDisk_Status) AssignPropertiesToImageDataDiskStatus(destination *v1alpha1api20210701storage.ImageDataDisk_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // BlobUri + destination.BlobUri = genruntime.ClonePointerToString(disk.BlobUri) + + // Caching + if disk.Caching != nil { + caching := string(*disk.Caching) + destination.Caching = &caching + } else { + destination.Caching = nil + } + + // DiskEncryptionSet + if disk.DiskEncryptionSet != nil { + var diskEncryptionSet v1alpha1api20210701storage.SubResource_Status + err := disk.DiskEncryptionSet.AssignPropertiesToSubResourceStatus(&diskEncryptionSet) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResourceStatus() to populate field DiskEncryptionSet") + } + destination.DiskEncryptionSet = &diskEncryptionSet + } else { + destination.DiskEncryptionSet = nil + } + + // DiskSizeGB + destination.DiskSizeGB = genruntime.ClonePointerToInt(disk.DiskSizeGB) + + // Lun + lun := disk.Lun + destination.Lun = &lun + + // ManagedDisk + if disk.ManagedDisk != nil { + var managedDisk v1alpha1api20210701storage.SubResource_Status + err := disk.ManagedDisk.AssignPropertiesToSubResourceStatus(&managedDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResourceStatus() to populate field ManagedDisk") + } + destination.ManagedDisk = &managedDisk + } else { + destination.ManagedDisk = nil + } + + // Snapshot + if disk.Snapshot != nil { + var snapshot v1alpha1api20210701storage.SubResource_Status + err := disk.Snapshot.AssignPropertiesToSubResourceStatus(&snapshot) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResourceStatus() to populate field Snapshot") + } + destination.Snapshot = &snapshot + } else { + destination.Snapshot = nil + } + + // StorageAccountType + if disk.StorageAccountType != nil { + storageAccountType := string(*disk.StorageAccountType) + destination.StorageAccountType = &storageAccountType + } else { + destination.StorageAccountType = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageOSDisk +type ImageOSDisk struct { + //BlobUri: The Virtual Hard Disk. + BlobUri *string `json:"blobUri,omitempty"` + + //Caching: Specifies the caching requirements. + //Possible values are: + //None + //ReadOnly + //ReadWrite + //Default: None for Standard storage. ReadOnly for Premium storage. + Caching *ImageOSDiskCaching `json:"caching,omitempty"` + + //DiskEncryptionSet: Describes the parameter of customer managed disk encryption + //set resource id that can be specified for disk. + //NOTE: The disk encryption set resource id can only be specified for managed + //disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + + //DiskSizeGB: Specifies the size of empty data disks in gigabytes. This element + //can be used to overwrite the name of the disk in a virtual machine image. + //This value cannot be larger than 1023 GB + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + + // +kubebuilder:validation:Required + //OsState: The OS State. + OsState ImageOSDiskOsState `json:"osState"` + + // +kubebuilder:validation:Required + //OsType: This property allows you to specify the type of the OS that is included + //in the disk if creating a VM from a custom image. + //Possible values are: + //Windows + //Linux. + OsType ImageOSDiskOsType `json:"osType"` + Snapshot *SubResource `json:"snapshot,omitempty"` + + //StorageAccountType: Specifies the storage account type for the managed disk. + //NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS + //Disk. + StorageAccountType *ImageOSDiskStorageAccountType `json:"storageAccountType,omitempty"` +} + +var _ genruntime.ARMTransformer = &ImageOSDisk{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (disk *ImageOSDisk) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if disk == nil { + return nil, nil + } + var result ImageOSDiskARM + + // Set property ‘BlobUri’: + if disk.BlobUri != nil { + blobUri := *disk.BlobUri + result.BlobUri = &blobUri + } + + // Set property ‘Caching’: + if disk.Caching != nil { + caching := *disk.Caching + result.Caching = &caching + } + + // Set property ‘DiskEncryptionSet’: + if disk.DiskEncryptionSet != nil { + diskEncryptionSetARM, err := (*disk.DiskEncryptionSet).ConvertToARM(resolved) + if err != nil { + return nil, err + } + diskEncryptionSet := diskEncryptionSetARM.(DiskEncryptionSetParametersARM) + result.DiskEncryptionSet = &diskEncryptionSet + } + + // Set property ‘DiskSizeGB’: + if disk.DiskSizeGB != nil { + diskSizeGB := *disk.DiskSizeGB + result.DiskSizeGB = &diskSizeGB + } + + // Set property ‘ManagedDisk’: + if disk.ManagedDisk != nil { + managedDiskARM, err := (*disk.ManagedDisk).ConvertToARM(resolved) + if err != nil { + return nil, err + } + managedDisk := managedDiskARM.(SubResourceARM) + result.ManagedDisk = &managedDisk + } + + // Set property ‘OsState’: + result.OsState = disk.OsState + + // Set property ‘OsType’: + result.OsType = disk.OsType + + // Set property ‘Snapshot’: + if disk.Snapshot != nil { + snapshotARM, err := (*disk.Snapshot).ConvertToARM(resolved) + if err != nil { + return nil, err + } + snapshot := snapshotARM.(SubResourceARM) + result.Snapshot = &snapshot + } + + // Set property ‘StorageAccountType’: + if disk.StorageAccountType != nil { + storageAccountType := *disk.StorageAccountType + result.StorageAccountType = &storageAccountType + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (disk *ImageOSDisk) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &ImageOSDiskARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (disk *ImageOSDisk) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(ImageOSDiskARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ImageOSDiskARM, got %T", armInput) + } + + // Set property ‘BlobUri’: + if typedInput.BlobUri != nil { + blobUri := *typedInput.BlobUri + disk.BlobUri = &blobUri + } + + // Set property ‘Caching’: + if typedInput.Caching != nil { + caching := *typedInput.Caching + disk.Caching = &caching + } + + // Set property ‘DiskEncryptionSet’: + if typedInput.DiskEncryptionSet != nil { + var diskEncryptionSet1 DiskEncryptionSetParameters + err := diskEncryptionSet1.PopulateFromARM(owner, *typedInput.DiskEncryptionSet) + if err != nil { + return err + } + diskEncryptionSet := diskEncryptionSet1 + disk.DiskEncryptionSet = &diskEncryptionSet + } + + // Set property ‘DiskSizeGB’: + if typedInput.DiskSizeGB != nil { + diskSizeGB := *typedInput.DiskSizeGB + disk.DiskSizeGB = &diskSizeGB + } + + // Set property ‘ManagedDisk’: + if typedInput.ManagedDisk != nil { + var managedDisk1 SubResource + err := managedDisk1.PopulateFromARM(owner, *typedInput.ManagedDisk) + if err != nil { + return err + } + managedDisk := managedDisk1 + disk.ManagedDisk = &managedDisk + } + + // Set property ‘OsState’: + disk.OsState = typedInput.OsState + + // Set property ‘OsType’: + disk.OsType = typedInput.OsType + + // Set property ‘Snapshot’: + if typedInput.Snapshot != nil { + var snapshot1 SubResource + err := snapshot1.PopulateFromARM(owner, *typedInput.Snapshot) + if err != nil { + return err + } + snapshot := snapshot1 + disk.Snapshot = &snapshot + } + + // Set property ‘StorageAccountType’: + if typedInput.StorageAccountType != nil { + storageAccountType := *typedInput.StorageAccountType + disk.StorageAccountType = &storageAccountType + } + + // No error + return nil +} + +// AssignPropertiesFromImageOSDisk populates our ImageOSDisk from the provided source ImageOSDisk +func (disk *ImageOSDisk) AssignPropertiesFromImageOSDisk(source *v1alpha1api20210701storage.ImageOSDisk) error { + + // BlobUri + disk.BlobUri = genruntime.ClonePointerToString(source.BlobUri) + + // Caching + if source.Caching != nil { + caching := ImageOSDiskCaching(*source.Caching) + disk.Caching = &caching + } else { + disk.Caching = nil + } + + // DiskEncryptionSet + if source.DiskEncryptionSet != nil { + var diskEncryptionSet DiskEncryptionSetParameters + err := diskEncryptionSet.AssignPropertiesFromDiskEncryptionSetParameters(source.DiskEncryptionSet) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromDiskEncryptionSetParameters() to populate field DiskEncryptionSet") + } + disk.DiskEncryptionSet = &diskEncryptionSet + } else { + disk.DiskEncryptionSet = nil + } + + // DiskSizeGB + disk.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB) + + // ManagedDisk + if source.ManagedDisk != nil { + var managedDisk SubResource + err := managedDisk.AssignPropertiesFromSubResource(source.ManagedDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResource() to populate field ManagedDisk") + } + disk.ManagedDisk = &managedDisk + } else { + disk.ManagedDisk = nil + } + + // OsState + if source.OsState != nil { + disk.OsState = ImageOSDiskOsState(*source.OsState) + } else { + disk.OsState = "" + } + + // OsType + if source.OsType != nil { + disk.OsType = ImageOSDiskOsType(*source.OsType) + } else { + disk.OsType = "" + } + + // Snapshot + if source.Snapshot != nil { + var snapshot SubResource + err := snapshot.AssignPropertiesFromSubResource(source.Snapshot) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResource() to populate field Snapshot") + } + disk.Snapshot = &snapshot + } else { + disk.Snapshot = nil + } + + // StorageAccountType + if source.StorageAccountType != nil { + storageAccountType := ImageOSDiskStorageAccountType(*source.StorageAccountType) + disk.StorageAccountType = &storageAccountType + } else { + disk.StorageAccountType = nil + } + + // No error + return nil +} + +// AssignPropertiesToImageOSDisk populates the provided destination ImageOSDisk from our ImageOSDisk +func (disk *ImageOSDisk) AssignPropertiesToImageOSDisk(destination *v1alpha1api20210701storage.ImageOSDisk) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // BlobUri + destination.BlobUri = genruntime.ClonePointerToString(disk.BlobUri) + + // Caching + if disk.Caching != nil { + caching := string(*disk.Caching) + destination.Caching = &caching + } else { + destination.Caching = nil + } + + // DiskEncryptionSet + if disk.DiskEncryptionSet != nil { + var diskEncryptionSet v1alpha1api20210701storage.DiskEncryptionSetParameters + err := disk.DiskEncryptionSet.AssignPropertiesToDiskEncryptionSetParameters(&diskEncryptionSet) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToDiskEncryptionSetParameters() to populate field DiskEncryptionSet") + } + destination.DiskEncryptionSet = &diskEncryptionSet + } else { + destination.DiskEncryptionSet = nil + } + + // DiskSizeGB + destination.DiskSizeGB = genruntime.ClonePointerToInt(disk.DiskSizeGB) + + // ManagedDisk + if disk.ManagedDisk != nil { + var managedDisk v1alpha1api20210701storage.SubResource + err := disk.ManagedDisk.AssignPropertiesToSubResource(&managedDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResource() to populate field ManagedDisk") + } + destination.ManagedDisk = &managedDisk + } else { + destination.ManagedDisk = nil + } + + // OsState + osState := string(disk.OsState) + destination.OsState = &osState + + // OsType + osType := string(disk.OsType) + destination.OsType = &osType + + // Snapshot + if disk.Snapshot != nil { + var snapshot v1alpha1api20210701storage.SubResource + err := disk.Snapshot.AssignPropertiesToSubResource(&snapshot) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResource() to populate field Snapshot") + } + destination.Snapshot = &snapshot + } else { + destination.Snapshot = nil + } + + // StorageAccountType + if disk.StorageAccountType != nil { + storageAccountType := string(*disk.StorageAccountType) + destination.StorageAccountType = &storageAccountType + } else { + destination.StorageAccountType = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +type ImageOSDisk_Status struct { + //BlobUri: The Virtual Hard Disk. + BlobUri *string `json:"blobUri,omitempty"` + + //Caching: Specifies the caching requirements. + //Possible values are: + //None + //ReadOnly + //ReadWrite + //Default: None for Standard storage. ReadOnly for Premium storage + Caching *ImageOSDiskStatusCaching `json:"caching,omitempty"` + + //DiskEncryptionSet: Specifies the customer managed disk encryption set resource + //id for the managed image disk. + DiskEncryptionSet *SubResource_Status `json:"diskEncryptionSet,omitempty"` + + //DiskSizeGB: Specifies the size of empty data disks in gigabytes. This element + //can be used to overwrite the name of the disk in a virtual machine image. + //This value cannot be larger than 1023 GB + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + //ManagedDisk: The managedDisk. + ManagedDisk *SubResource_Status `json:"managedDisk,omitempty"` + + // +kubebuilder:validation:Required + //OsState: The OS State. + OsState ImageOSDiskStatusOsState `json:"osState"` + + // +kubebuilder:validation:Required + //OsType: This property allows you to specify the type of the OS that is included + //in the disk if creating a VM from a custom image. + //Possible values are: + //Windows + //Linux + OsType ImageOSDiskStatusOsType `json:"osType"` + + //Snapshot: The snapshot. + Snapshot *SubResource_Status `json:"snapshot,omitempty"` + + //StorageAccountType: Specifies the storage account type for the managed disk. + //NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS + //Disk. + StorageAccountType *StorageAccountType_Status `json:"storageAccountType,omitempty"` +} + +var _ genruntime.FromARMConverter = &ImageOSDisk_Status{} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (disk *ImageOSDisk_Status) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &ImageOSDisk_StatusARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (disk *ImageOSDisk_Status) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + typedInput, ok := armInput.(ImageOSDisk_StatusARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected ImageOSDisk_StatusARM, got %T", armInput) + } + + // Set property ‘BlobUri’: + if typedInput.BlobUri != nil { + blobUri := *typedInput.BlobUri + disk.BlobUri = &blobUri + } + + // Set property ‘Caching’: + if typedInput.Caching != nil { + caching := *typedInput.Caching + disk.Caching = &caching + } + + // Set property ‘DiskEncryptionSet’: + if typedInput.DiskEncryptionSet != nil { + var diskEncryptionSet1 SubResource_Status + err := diskEncryptionSet1.PopulateFromARM(owner, *typedInput.DiskEncryptionSet) + if err != nil { + return err + } + diskEncryptionSet := diskEncryptionSet1 + disk.DiskEncryptionSet = &diskEncryptionSet + } + + // Set property ‘DiskSizeGB’: + if typedInput.DiskSizeGB != nil { + diskSizeGB := *typedInput.DiskSizeGB + disk.DiskSizeGB = &diskSizeGB + } + + // Set property ‘ManagedDisk’: + if typedInput.ManagedDisk != nil { + var managedDisk1 SubResource_Status + err := managedDisk1.PopulateFromARM(owner, *typedInput.ManagedDisk) + if err != nil { + return err + } + managedDisk := managedDisk1 + disk.ManagedDisk = &managedDisk + } + + // Set property ‘OsState’: + disk.OsState = typedInput.OsState + + // Set property ‘OsType’: + disk.OsType = typedInput.OsType + + // Set property ‘Snapshot’: + if typedInput.Snapshot != nil { + var snapshot1 SubResource_Status + err := snapshot1.PopulateFromARM(owner, *typedInput.Snapshot) + if err != nil { + return err + } + snapshot := snapshot1 + disk.Snapshot = &snapshot + } + + // Set property ‘StorageAccountType’: + if typedInput.StorageAccountType != nil { + storageAccountType := *typedInput.StorageAccountType + disk.StorageAccountType = &storageAccountType + } + + // No error + return nil +} + +// AssignPropertiesFromImageOSDiskStatus populates our ImageOSDisk_Status from the provided source ImageOSDisk_Status +func (disk *ImageOSDisk_Status) AssignPropertiesFromImageOSDiskStatus(source *v1alpha1api20210701storage.ImageOSDisk_Status) error { + + // BlobUri + disk.BlobUri = genruntime.ClonePointerToString(source.BlobUri) + + // Caching + if source.Caching != nil { + caching := ImageOSDiskStatusCaching(*source.Caching) + disk.Caching = &caching + } else { + disk.Caching = nil + } + + // DiskEncryptionSet + if source.DiskEncryptionSet != nil { + var diskEncryptionSet SubResource_Status + err := diskEncryptionSet.AssignPropertiesFromSubResourceStatus(source.DiskEncryptionSet) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResourceStatus() to populate field DiskEncryptionSet") + } + disk.DiskEncryptionSet = &diskEncryptionSet + } else { + disk.DiskEncryptionSet = nil + } + + // DiskSizeGB + disk.DiskSizeGB = genruntime.ClonePointerToInt(source.DiskSizeGB) + + // ManagedDisk + if source.ManagedDisk != nil { + var managedDisk SubResource_Status + err := managedDisk.AssignPropertiesFromSubResourceStatus(source.ManagedDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResourceStatus() to populate field ManagedDisk") + } + disk.ManagedDisk = &managedDisk + } else { + disk.ManagedDisk = nil + } + + // OsState + if source.OsState != nil { + disk.OsState = ImageOSDiskStatusOsState(*source.OsState) + } else { + disk.OsState = "" + } + + // OsType + if source.OsType != nil { + disk.OsType = ImageOSDiskStatusOsType(*source.OsType) + } else { + disk.OsType = "" + } + + // Snapshot + if source.Snapshot != nil { + var snapshot SubResource_Status + err := snapshot.AssignPropertiesFromSubResourceStatus(source.Snapshot) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesFromSubResourceStatus() to populate field Snapshot") + } + disk.Snapshot = &snapshot + } else { + disk.Snapshot = nil + } + + // StorageAccountType + if source.StorageAccountType != nil { + storageAccountType := StorageAccountType_Status(*source.StorageAccountType) + disk.StorageAccountType = &storageAccountType + } else { + disk.StorageAccountType = nil + } + + // No error + return nil +} + +// AssignPropertiesToImageOSDiskStatus populates the provided destination ImageOSDisk_Status from our ImageOSDisk_Status +func (disk *ImageOSDisk_Status) AssignPropertiesToImageOSDiskStatus(destination *v1alpha1api20210701storage.ImageOSDisk_Status) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // BlobUri + destination.BlobUri = genruntime.ClonePointerToString(disk.BlobUri) + + // Caching + if disk.Caching != nil { + caching := string(*disk.Caching) + destination.Caching = &caching + } else { + destination.Caching = nil + } + + // DiskEncryptionSet + if disk.DiskEncryptionSet != nil { + var diskEncryptionSet v1alpha1api20210701storage.SubResource_Status + err := disk.DiskEncryptionSet.AssignPropertiesToSubResourceStatus(&diskEncryptionSet) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResourceStatus() to populate field DiskEncryptionSet") + } + destination.DiskEncryptionSet = &diskEncryptionSet + } else { + destination.DiskEncryptionSet = nil + } + + // DiskSizeGB + destination.DiskSizeGB = genruntime.ClonePointerToInt(disk.DiskSizeGB) + + // ManagedDisk + if disk.ManagedDisk != nil { + var managedDisk v1alpha1api20210701storage.SubResource_Status + err := disk.ManagedDisk.AssignPropertiesToSubResourceStatus(&managedDisk) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResourceStatus() to populate field ManagedDisk") + } + destination.ManagedDisk = &managedDisk + } else { + destination.ManagedDisk = nil + } + + // OsState + osState := string(disk.OsState) + destination.OsState = &osState + + // OsType + osType := string(disk.OsType) + destination.OsType = &osType + + // Snapshot + if disk.Snapshot != nil { + var snapshot v1alpha1api20210701storage.SubResource_Status + err := disk.Snapshot.AssignPropertiesToSubResourceStatus(&snapshot) + if err != nil { + return errors.Wrap(err, "calling AssignPropertiesToSubResourceStatus() to populate field Snapshot") + } + destination.Snapshot = &snapshot + } else { + destination.Snapshot = nil + } + + // StorageAccountType + if disk.StorageAccountType != nil { + storageAccountType := string(*disk.StorageAccountType) + destination.StorageAccountType = &storageAccountType + } else { + destination.StorageAccountType = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/DiskEncryptionSetParameters +type DiskEncryptionSetParameters struct { + //Reference: Resource Id + Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"` +} + +var _ genruntime.ARMTransformer = &DiskEncryptionSetParameters{} + +// ConvertToARM converts from a Kubernetes CRD object to an ARM object +func (parameters *DiskEncryptionSetParameters) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) { + if parameters == nil { + return nil, nil + } + var result DiskEncryptionSetParametersARM + + // Set property ‘Id’: + if parameters.Reference != nil { + referenceARMID, err := resolved.ResolvedReferences.ARMIDOrErr(*parameters.Reference) + if err != nil { + return nil, err + } + reference := referenceARMID + result.Id = &reference + } + return result, nil +} + +// NewEmptyARMValue returns an empty ARM value suitable for deserializing into +func (parameters *DiskEncryptionSetParameters) NewEmptyARMValue() genruntime.ARMResourceStatus { + return &DiskEncryptionSetParametersARM{} +} + +// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object +func (parameters *DiskEncryptionSetParameters) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error { + _, ok := armInput.(DiskEncryptionSetParametersARM) + if !ok { + return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected DiskEncryptionSetParametersARM, got %T", armInput) + } + + // no assignment for property ‘Reference’ + + // No error + return nil +} + +// AssignPropertiesFromDiskEncryptionSetParameters populates our DiskEncryptionSetParameters from the provided source DiskEncryptionSetParameters +func (parameters *DiskEncryptionSetParameters) AssignPropertiesFromDiskEncryptionSetParameters(source *v1alpha1api20210701storage.DiskEncryptionSetParameters) error { + + // Reference + if source.Reference != nil { + reference := source.Reference.Copy() + parameters.Reference = &reference + } else { + parameters.Reference = nil + } + + // No error + return nil +} + +// AssignPropertiesToDiskEncryptionSetParameters populates the provided destination DiskEncryptionSetParameters from our DiskEncryptionSetParameters +func (parameters *DiskEncryptionSetParameters) AssignPropertiesToDiskEncryptionSetParameters(destination *v1alpha1api20210701storage.DiskEncryptionSetParameters) error { + // Create a new property bag + propertyBag := genruntime.NewPropertyBag() + + // Reference + if parameters.Reference != nil { + reference := parameters.Reference.Copy() + destination.Reference = &reference + } else { + destination.Reference = nil + } + + // Update the property bag + if len(propertyBag) > 0 { + destination.PropertyBag = propertyBag + } else { + destination.PropertyBag = nil + } + + // No error + return nil +} + +// +kubebuilder:validation:Enum={"None","ReadOnly","ReadWrite"} +type ImageDataDiskCaching string + +const ( + ImageDataDiskCachingNone = ImageDataDiskCaching("None") + ImageDataDiskCachingReadOnly = ImageDataDiskCaching("ReadOnly") + ImageDataDiskCachingReadWrite = ImageDataDiskCaching("ReadWrite") +) + +type ImageDataDiskStatusCaching string + +const ( + ImageDataDiskStatusCachingNone = ImageDataDiskStatusCaching("None") + ImageDataDiskStatusCachingReadOnly = ImageDataDiskStatusCaching("ReadOnly") + ImageDataDiskStatusCachingReadWrite = ImageDataDiskStatusCaching("ReadWrite") +) + +// +kubebuilder:validation:Enum={"Premium_LRS","Premium_ZRS","Standard_LRS","StandardSSD_LRS","StandardSSD_ZRS","UltraSSD_LRS"} +type ImageDataDiskStorageAccountType string + +const ( + ImageDataDiskStorageAccountTypePremiumLRS = ImageDataDiskStorageAccountType("Premium_LRS") + ImageDataDiskStorageAccountTypePremiumZRS = ImageDataDiskStorageAccountType("Premium_ZRS") + ImageDataDiskStorageAccountTypeStandardLRS = ImageDataDiskStorageAccountType("Standard_LRS") + ImageDataDiskStorageAccountTypeStandardSSDLRS = ImageDataDiskStorageAccountType("StandardSSD_LRS") + ImageDataDiskStorageAccountTypeStandardSSDZRS = ImageDataDiskStorageAccountType("StandardSSD_ZRS") + ImageDataDiskStorageAccountTypeUltraSSDLRS = ImageDataDiskStorageAccountType("UltraSSD_LRS") +) + +// +kubebuilder:validation:Enum={"None","ReadOnly","ReadWrite"} +type ImageOSDiskCaching string + +const ( + ImageOSDiskCachingNone = ImageOSDiskCaching("None") + ImageOSDiskCachingReadOnly = ImageOSDiskCaching("ReadOnly") + ImageOSDiskCachingReadWrite = ImageOSDiskCaching("ReadWrite") +) + +// +kubebuilder:validation:Enum={"Generalized","Specialized"} +type ImageOSDiskOsState string + +const ( + ImageOSDiskOsStateGeneralized = ImageOSDiskOsState("Generalized") + ImageOSDiskOsStateSpecialized = ImageOSDiskOsState("Specialized") +) + +// +kubebuilder:validation:Enum={"Linux","Windows"} +type ImageOSDiskOsType string + +const ( + ImageOSDiskOsTypeLinux = ImageOSDiskOsType("Linux") + ImageOSDiskOsTypeWindows = ImageOSDiskOsType("Windows") +) + +type ImageOSDiskStatusCaching string + +const ( + ImageOSDiskStatusCachingNone = ImageOSDiskStatusCaching("None") + ImageOSDiskStatusCachingReadOnly = ImageOSDiskStatusCaching("ReadOnly") + ImageOSDiskStatusCachingReadWrite = ImageOSDiskStatusCaching("ReadWrite") +) + +type ImageOSDiskStatusOsState string + +const ( + ImageOSDiskStatusOsStateGeneralized = ImageOSDiskStatusOsState("Generalized") + ImageOSDiskStatusOsStateSpecialized = ImageOSDiskStatusOsState("Specialized") +) + +type ImageOSDiskStatusOsType string + +const ( + ImageOSDiskStatusOsTypeLinux = ImageOSDiskStatusOsType("Linux") + ImageOSDiskStatusOsTypeWindows = ImageOSDiskStatusOsType("Windows") +) + +// +kubebuilder:validation:Enum={"Premium_LRS","Premium_ZRS","Standard_LRS","StandardSSD_LRS","StandardSSD_ZRS","UltraSSD_LRS"} +type ImageOSDiskStorageAccountType string + +const ( + ImageOSDiskStorageAccountTypePremiumLRS = ImageOSDiskStorageAccountType("Premium_LRS") + ImageOSDiskStorageAccountTypePremiumZRS = ImageOSDiskStorageAccountType("Premium_ZRS") + ImageOSDiskStorageAccountTypeStandardLRS = ImageOSDiskStorageAccountType("Standard_LRS") + ImageOSDiskStorageAccountTypeStandardSSDLRS = ImageOSDiskStorageAccountType("StandardSSD_LRS") + ImageOSDiskStorageAccountTypeStandardSSDZRS = ImageOSDiskStorageAccountType("StandardSSD_ZRS") + ImageOSDiskStorageAccountTypeUltraSSDLRS = ImageOSDiskStorageAccountType("UltraSSD_LRS") +) + +type StorageAccountType_Status string + +const ( + StorageAccountType_StatusPremiumLRS = StorageAccountType_Status("Premium_LRS") + StorageAccountType_StatusPremiumZRS = StorageAccountType_Status("Premium_ZRS") + StorageAccountType_StatusStandardLRS = StorageAccountType_Status("Standard_LRS") + StorageAccountType_StatusStandardSSDLRS = StorageAccountType_Status("StandardSSD_LRS") + StorageAccountType_StatusStandardSSDZRS = StorageAccountType_Status("StandardSSD_ZRS") + StorageAccountType_StatusUltraSSDLRS = StorageAccountType_Status("UltraSSD_LRS") +) + +func init() { + SchemeBuilder.Register(&Image{}, &ImageList{}) +} diff --git a/v2/api/compute/v1alpha1api20210701/image_types_gen_test.go b/v2/api/compute/v1alpha1api20210701/image_types_gen_test.go new file mode 100644 index 00000000000..b2213bd47c0 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701/image_types_gen_test.go @@ -0,0 +1,1648 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20210701 + +import ( + "encoding/json" + "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701storage" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Image_WhenConvertedToHub_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Image to hub returns original", + prop.ForAll(RunResourceConversionTestForImage, ImageGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunResourceConversionTestForImage tests if a specific instance of Image round trips to the hub storage version and back losslessly +func RunResourceConversionTestForImage(subject Image) string { + // Copy subject to make sure conversion doesn't modify it + copied := subject.DeepCopy() + + // Convert to our hub version + var hub v1alpha1api20210701storage.Image + err := copied.ConvertTo(&hub) + if err != nil { + return err.Error() + } + + // Convert from our hub version + var actual Image + err = actual.ConvertFrom(&hub) + if err != nil { + return err.Error() + } + + // Compare actual with what we started with + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Image_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Image to Image via AssignPropertiesToImage & AssignPropertiesFromImage returns original", + prop.ForAll(RunPropertyAssignmentTestForImage, ImageGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImage tests if a specific instance of Image can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImage(subject Image) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.Image + err := copied.AssignPropertiesToImage(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Image + err = actual.AssignPropertiesFromImage(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Image_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Image via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImage, ImageGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImage runs a test to see if a specific instance of Image round trips to JSON and back losslessly +func RunJSONSerializationTestForImage(subject Image) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Image + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Image instances for property testing - lazily instantiated by ImageGenerator() +var imageGenerator gopter.Gen + +// ImageGenerator returns a generator of Image instances for property testing. +func ImageGenerator() gopter.Gen { + if imageGenerator != nil { + return imageGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForImage(generators) + imageGenerator = gen.Struct(reflect.TypeOf(Image{}), generators) + + return imageGenerator +} + +// AddRelatedPropertyGeneratorsForImage is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImage(gens map[string]gopter.Gen) { + gens["Spec"] = ImagesSpecGenerator() + gens["Status"] = ImageStatusGenerator() +} + +func Test_Image_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Image_Status to Image_Status via AssignPropertiesToImageStatus & AssignPropertiesFromImageStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForImageStatus, ImageStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImageStatus tests if a specific instance of Image_Status can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImageStatus(subject Image_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.Image_Status + err := copied.AssignPropertiesToImageStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Image_Status + err = actual.AssignPropertiesFromImageStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Image_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Image_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStatus, ImageStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStatus runs a test to see if a specific instance of Image_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStatus(subject Image_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Image_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Image_Status instances for property testing - lazily instantiated by ImageStatusGenerator() +var imageStatusGenerator gopter.Gen + +// ImageStatusGenerator returns a generator of Image_Status instances for property testing. +// We first initialize imageStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStatusGenerator() gopter.Gen { + if imageStatusGenerator != nil { + return imageStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStatus(generators) + imageStatusGenerator = gen.Struct(reflect.TypeOf(Image_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStatus(generators) + AddRelatedPropertyGeneratorsForImageStatus(generators) + imageStatusGenerator = gen.Struct(reflect.TypeOf(Image_Status{}), generators) + + return imageStatusGenerator +} + +// AddIndependentPropertyGeneratorsForImageStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStatus(gens map[string]gopter.Gen) { + gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(HyperVGenerationType_StatusV1, HyperVGenerationType_StatusV2)) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImageStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStatus(gens map[string]gopter.Gen) { + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationStatusGenerator()) + gens["SourceVirtualMachine"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["StorageProfile"] = gen.PtrOf(ImageStorageProfileStatusGenerator()) +} + +func Test_Images_Spec_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from Images_Spec to Images_Spec via AssignPropertiesToImagesSpec & AssignPropertiesFromImagesSpec returns original", + prop.ForAll(RunPropertyAssignmentTestForImagesSpec, ImagesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImagesSpec tests if a specific instance of Images_Spec can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImagesSpec(subject Images_Spec) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.Images_Spec + err := copied.AssignPropertiesToImagesSpec(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual Images_Spec + err = actual.AssignPropertiesFromImagesSpec(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_Images_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Images_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImagesSpec, ImagesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImagesSpec runs a test to see if a specific instance of Images_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForImagesSpec(subject Images_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Images_Spec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Images_Spec instances for property testing - lazily instantiated by ImagesSpecGenerator() +var imagesSpecGenerator gopter.Gen + +// ImagesSpecGenerator returns a generator of Images_Spec instances for property testing. +// We first initialize imagesSpecGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImagesSpecGenerator() gopter.Gen { + if imagesSpecGenerator != nil { + return imagesSpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagesSpec(generators) + imagesSpecGenerator = gen.Struct(reflect.TypeOf(Images_Spec{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagesSpec(generators) + AddRelatedPropertyGeneratorsForImagesSpec(generators) + imagesSpecGenerator = gen.Struct(reflect.TypeOf(Images_Spec{}), generators) + + return imagesSpecGenerator +} + +// AddIndependentPropertyGeneratorsForImagesSpec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImagesSpec(gens map[string]gopter.Gen) { + gens["AzureName"] = gen.AlphaString() + gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(ImagePropertiesHyperVGenerationV1, ImagePropertiesHyperVGenerationV2)) + gens["Location"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImagesSpec is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImagesSpec(gens map[string]gopter.Gen) { + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationGenerator()) + gens["SourceVirtualMachine"] = gen.PtrOf(SubResourceGenerator()) + gens["StorageProfile"] = gen.PtrOf(ImageStorageProfileGenerator()) +} + +func Test_ExtendedLocation_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ExtendedLocation to ExtendedLocation via AssignPropertiesToExtendedLocation & AssignPropertiesFromExtendedLocation returns original", + prop.ForAll(RunPropertyAssignmentTestForExtendedLocation, ExtendedLocationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForExtendedLocation tests if a specific instance of ExtendedLocation can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForExtendedLocation(subject ExtendedLocation) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ExtendedLocation + err := copied.AssignPropertiesToExtendedLocation(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ExtendedLocation + err = actual.AssignPropertiesFromExtendedLocation(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ExtendedLocation_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ExtendedLocation via JSON returns original", + prop.ForAll(RunJSONSerializationTestForExtendedLocation, ExtendedLocationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForExtendedLocation runs a test to see if a specific instance of ExtendedLocation round trips to JSON and back losslessly +func RunJSONSerializationTestForExtendedLocation(subject ExtendedLocation) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ExtendedLocation + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ExtendedLocation instances for property testing - lazily instantiated by ExtendedLocationGenerator() +var extendedLocationGenerator gopter.Gen + +// ExtendedLocationGenerator returns a generator of ExtendedLocation instances for property testing. +func ExtendedLocationGenerator() gopter.Gen { + if extendedLocationGenerator != nil { + return extendedLocationGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForExtendedLocation(generators) + extendedLocationGenerator = gen.Struct(reflect.TypeOf(ExtendedLocation{}), generators) + + return extendedLocationGenerator +} + +// AddIndependentPropertyGeneratorsForExtendedLocation is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForExtendedLocation(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.OneConstOf(ExtendedLocationTypeEdgeZone)) +} + +func Test_ExtendedLocation_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ExtendedLocation_Status to ExtendedLocation_Status via AssignPropertiesToExtendedLocationStatus & AssignPropertiesFromExtendedLocationStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForExtendedLocationStatus, ExtendedLocationStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForExtendedLocationStatus tests if a specific instance of ExtendedLocation_Status can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForExtendedLocationStatus(subject ExtendedLocation_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ExtendedLocation_Status + err := copied.AssignPropertiesToExtendedLocationStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ExtendedLocation_Status + err = actual.AssignPropertiesFromExtendedLocationStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ExtendedLocation_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ExtendedLocation_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForExtendedLocationStatus, ExtendedLocationStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForExtendedLocationStatus runs a test to see if a specific instance of ExtendedLocation_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForExtendedLocationStatus(subject ExtendedLocation_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ExtendedLocation_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ExtendedLocation_Status instances for property testing - lazily instantiated by +//ExtendedLocationStatusGenerator() +var extendedLocationStatusGenerator gopter.Gen + +// ExtendedLocationStatusGenerator returns a generator of ExtendedLocation_Status instances for property testing. +func ExtendedLocationStatusGenerator() gopter.Gen { + if extendedLocationStatusGenerator != nil { + return extendedLocationStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForExtendedLocationStatus(generators) + extendedLocationStatusGenerator = gen.Struct(reflect.TypeOf(ExtendedLocation_Status{}), generators) + + return extendedLocationStatusGenerator +} + +// AddIndependentPropertyGeneratorsForExtendedLocationStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForExtendedLocationStatus(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.OneConstOf(ExtendedLocationType_StatusEdgeZone)) +} + +func Test_ImageStorageProfile_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ImageStorageProfile to ImageStorageProfile via AssignPropertiesToImageStorageProfile & AssignPropertiesFromImageStorageProfile returns original", + prop.ForAll(RunPropertyAssignmentTestForImageStorageProfile, ImageStorageProfileGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImageStorageProfile tests if a specific instance of ImageStorageProfile can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImageStorageProfile(subject ImageStorageProfile) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ImageStorageProfile + err := copied.AssignPropertiesToImageStorageProfile(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ImageStorageProfile + err = actual.AssignPropertiesFromImageStorageProfile(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ImageStorageProfile_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageStorageProfile via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStorageProfile, ImageStorageProfileGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStorageProfile runs a test to see if a specific instance of ImageStorageProfile round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStorageProfile(subject ImageStorageProfile) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageStorageProfile + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageStorageProfile instances for property testing - lazily instantiated by +//ImageStorageProfileGenerator() +var imageStorageProfileGenerator gopter.Gen + +// ImageStorageProfileGenerator returns a generator of ImageStorageProfile instances for property testing. +// We first initialize imageStorageProfileGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStorageProfileGenerator() gopter.Gen { + if imageStorageProfileGenerator != nil { + return imageStorageProfileGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfile(generators) + imageStorageProfileGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfile(generators) + AddRelatedPropertyGeneratorsForImageStorageProfile(generators) + imageStorageProfileGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile{}), generators) + + return imageStorageProfileGenerator +} + +// AddIndependentPropertyGeneratorsForImageStorageProfile is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStorageProfile(gens map[string]gopter.Gen) { + gens["ZoneResilient"] = gen.PtrOf(gen.Bool()) +} + +// AddRelatedPropertyGeneratorsForImageStorageProfile is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStorageProfile(gens map[string]gopter.Gen) { + gens["DataDisks"] = gen.SliceOf(ImageDataDiskGenerator()) + gens["OsDisk"] = gen.PtrOf(ImageOSDiskGenerator()) +} + +func Test_ImageStorageProfile_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ImageStorageProfile_Status to ImageStorageProfile_Status via AssignPropertiesToImageStorageProfileStatus & AssignPropertiesFromImageStorageProfileStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForImageStorageProfileStatus, ImageStorageProfileStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImageStorageProfileStatus tests if a specific instance of ImageStorageProfile_Status can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImageStorageProfileStatus(subject ImageStorageProfile_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ImageStorageProfile_Status + err := copied.AssignPropertiesToImageStorageProfileStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ImageStorageProfile_Status + err = actual.AssignPropertiesFromImageStorageProfileStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ImageStorageProfile_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageStorageProfile_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStorageProfileStatus, ImageStorageProfileStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStorageProfileStatus runs a test to see if a specific instance of ImageStorageProfile_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStorageProfileStatus(subject ImageStorageProfile_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageStorageProfile_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageStorageProfile_Status instances for property testing - lazily instantiated by +//ImageStorageProfileStatusGenerator() +var imageStorageProfileStatusGenerator gopter.Gen + +// ImageStorageProfileStatusGenerator returns a generator of ImageStorageProfile_Status instances for property testing. +// We first initialize imageStorageProfileStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStorageProfileStatusGenerator() gopter.Gen { + if imageStorageProfileStatusGenerator != nil { + return imageStorageProfileStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfileStatus(generators) + imageStorageProfileStatusGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfileStatus(generators) + AddRelatedPropertyGeneratorsForImageStorageProfileStatus(generators) + imageStorageProfileStatusGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile_Status{}), generators) + + return imageStorageProfileStatusGenerator +} + +// AddIndependentPropertyGeneratorsForImageStorageProfileStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStorageProfileStatus(gens map[string]gopter.Gen) { + gens["ZoneResilient"] = gen.PtrOf(gen.Bool()) +} + +// AddRelatedPropertyGeneratorsForImageStorageProfileStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStorageProfileStatus(gens map[string]gopter.Gen) { + gens["DataDisks"] = gen.SliceOf(ImageDataDiskStatusGenerator()) + gens["OsDisk"] = gen.PtrOf(ImageOSDiskStatusGenerator()) +} + +func Test_SubResource_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from SubResource to SubResource via AssignPropertiesToSubResource & AssignPropertiesFromSubResource returns original", + prop.ForAll(RunPropertyAssignmentTestForSubResource, SubResourceGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSubResource tests if a specific instance of SubResource can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForSubResource(subject SubResource) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.SubResource + err := copied.AssignPropertiesToSubResource(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual SubResource + err = actual.AssignPropertiesFromSubResource(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_SubResource_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SubResource via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubResource, SubResourceGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubResource runs a test to see if a specific instance of SubResource round trips to JSON and back losslessly +func RunJSONSerializationTestForSubResource(subject SubResource) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SubResource + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SubResource instances for property testing - lazily instantiated by SubResourceGenerator() +var subResourceGenerator gopter.Gen + +// SubResourceGenerator returns a generator of SubResource instances for property testing. +func SubResourceGenerator() gopter.Gen { + if subResourceGenerator != nil { + return subResourceGenerator + } + + generators := make(map[string]gopter.Gen) + subResourceGenerator = gen.Struct(reflect.TypeOf(SubResource{}), generators) + + return subResourceGenerator +} + +func Test_SubResource_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from SubResource_Status to SubResource_Status via AssignPropertiesToSubResourceStatus & AssignPropertiesFromSubResourceStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForSubResourceStatus, SubResourceStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForSubResourceStatus tests if a specific instance of SubResource_Status can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForSubResourceStatus(subject SubResource_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.SubResource_Status + err := copied.AssignPropertiesToSubResourceStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual SubResource_Status + err = actual.AssignPropertiesFromSubResourceStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_SubResource_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SubResource_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubResourceStatus, SubResourceStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubResourceStatus runs a test to see if a specific instance of SubResource_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForSubResourceStatus(subject SubResource_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SubResource_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SubResource_Status instances for property testing - lazily instantiated by SubResourceStatusGenerator() +var subResourceStatusGenerator gopter.Gen + +// SubResourceStatusGenerator returns a generator of SubResource_Status instances for property testing. +func SubResourceStatusGenerator() gopter.Gen { + if subResourceStatusGenerator != nil { + return subResourceStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSubResourceStatus(generators) + subResourceStatusGenerator = gen.Struct(reflect.TypeOf(SubResource_Status{}), generators) + + return subResourceStatusGenerator +} + +// AddIndependentPropertyGeneratorsForSubResourceStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSubResourceStatus(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ImageDataDisk_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ImageDataDisk to ImageDataDisk via AssignPropertiesToImageDataDisk & AssignPropertiesFromImageDataDisk returns original", + prop.ForAll(RunPropertyAssignmentTestForImageDataDisk, ImageDataDiskGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImageDataDisk tests if a specific instance of ImageDataDisk can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImageDataDisk(subject ImageDataDisk) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ImageDataDisk + err := copied.AssignPropertiesToImageDataDisk(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ImageDataDisk + err = actual.AssignPropertiesFromImageDataDisk(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ImageDataDisk_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageDataDisk via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageDataDisk, ImageDataDiskGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageDataDisk runs a test to see if a specific instance of ImageDataDisk round trips to JSON and back losslessly +func RunJSONSerializationTestForImageDataDisk(subject ImageDataDisk) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageDataDisk + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageDataDisk instances for property testing - lazily instantiated by ImageDataDiskGenerator() +var imageDataDiskGenerator gopter.Gen + +// ImageDataDiskGenerator returns a generator of ImageDataDisk instances for property testing. +// We first initialize imageDataDiskGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageDataDiskGenerator() gopter.Gen { + if imageDataDiskGenerator != nil { + return imageDataDiskGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDisk(generators) + imageDataDiskGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDisk(generators) + AddRelatedPropertyGeneratorsForImageDataDisk(generators) + imageDataDiskGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk{}), generators) + + return imageDataDiskGenerator +} + +// AddIndependentPropertyGeneratorsForImageDataDisk is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageDataDisk(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.OneConstOf(ImageDataDiskCachingNone, ImageDataDiskCachingReadOnly, ImageDataDiskCachingReadWrite)) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["Lun"] = gen.Int() + gens["StorageAccountType"] = gen.PtrOf(gen.OneConstOf( + ImageDataDiskStorageAccountTypePremiumLRS, + ImageDataDiskStorageAccountTypePremiumZRS, + ImageDataDiskStorageAccountTypeStandardLRS, + ImageDataDiskStorageAccountTypeStandardSSDLRS, + ImageDataDiskStorageAccountTypeStandardSSDZRS, + ImageDataDiskStorageAccountTypeUltraSSDLRS)) +} + +// AddRelatedPropertyGeneratorsForImageDataDisk is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageDataDisk(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(DiskEncryptionSetParametersGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceGenerator()) +} + +func Test_ImageDataDisk_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ImageDataDisk_Status to ImageDataDisk_Status via AssignPropertiesToImageDataDiskStatus & AssignPropertiesFromImageDataDiskStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForImageDataDiskStatus, ImageDataDiskStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImageDataDiskStatus tests if a specific instance of ImageDataDisk_Status can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImageDataDiskStatus(subject ImageDataDisk_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ImageDataDisk_Status + err := copied.AssignPropertiesToImageDataDiskStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ImageDataDisk_Status + err = actual.AssignPropertiesFromImageDataDiskStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ImageDataDisk_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageDataDisk_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageDataDiskStatus, ImageDataDiskStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageDataDiskStatus runs a test to see if a specific instance of ImageDataDisk_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForImageDataDiskStatus(subject ImageDataDisk_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageDataDisk_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageDataDisk_Status instances for property testing - lazily instantiated by +//ImageDataDiskStatusGenerator() +var imageDataDiskStatusGenerator gopter.Gen + +// ImageDataDiskStatusGenerator returns a generator of ImageDataDisk_Status instances for property testing. +// We first initialize imageDataDiskStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageDataDiskStatusGenerator() gopter.Gen { + if imageDataDiskStatusGenerator != nil { + return imageDataDiskStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDiskStatus(generators) + imageDataDiskStatusGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDiskStatus(generators) + AddRelatedPropertyGeneratorsForImageDataDiskStatus(generators) + imageDataDiskStatusGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk_Status{}), generators) + + return imageDataDiskStatusGenerator +} + +// AddIndependentPropertyGeneratorsForImageDataDiskStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageDataDiskStatus(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.OneConstOf(ImageDataDiskStatusCachingNone, ImageDataDiskStatusCachingReadOnly, ImageDataDiskStatusCachingReadWrite)) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["Lun"] = gen.Int() + gens["StorageAccountType"] = gen.PtrOf(gen.OneConstOf( + StorageAccountType_StatusPremiumLRS, + StorageAccountType_StatusPremiumZRS, + StorageAccountType_StatusStandardLRS, + StorageAccountType_StatusStandardSSDLRS, + StorageAccountType_StatusStandardSSDZRS, + StorageAccountType_StatusUltraSSDLRS)) +} + +// AddRelatedPropertyGeneratorsForImageDataDiskStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageDataDiskStatus(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceStatusGenerator()) +} + +func Test_ImageOSDisk_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ImageOSDisk to ImageOSDisk via AssignPropertiesToImageOSDisk & AssignPropertiesFromImageOSDisk returns original", + prop.ForAll(RunPropertyAssignmentTestForImageOSDisk, ImageOSDiskGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImageOSDisk tests if a specific instance of ImageOSDisk can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImageOSDisk(subject ImageOSDisk) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ImageOSDisk + err := copied.AssignPropertiesToImageOSDisk(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ImageOSDisk + err = actual.AssignPropertiesFromImageOSDisk(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ImageOSDisk_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageOSDisk via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageOSDisk, ImageOSDiskGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageOSDisk runs a test to see if a specific instance of ImageOSDisk round trips to JSON and back losslessly +func RunJSONSerializationTestForImageOSDisk(subject ImageOSDisk) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageOSDisk + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageOSDisk instances for property testing - lazily instantiated by ImageOSDiskGenerator() +var imageOSDiskGenerator gopter.Gen + +// ImageOSDiskGenerator returns a generator of ImageOSDisk instances for property testing. +// We first initialize imageOSDiskGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageOSDiskGenerator() gopter.Gen { + if imageOSDiskGenerator != nil { + return imageOSDiskGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDisk(generators) + imageOSDiskGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDisk(generators) + AddRelatedPropertyGeneratorsForImageOSDisk(generators) + imageOSDiskGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk{}), generators) + + return imageOSDiskGenerator +} + +// AddIndependentPropertyGeneratorsForImageOSDisk is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageOSDisk(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.OneConstOf(ImageOSDiskCachingNone, ImageOSDiskCachingReadOnly, ImageOSDiskCachingReadWrite)) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["OsState"] = gen.OneConstOf(ImageOSDiskOsStateGeneralized, ImageOSDiskOsStateSpecialized) + gens["OsType"] = gen.OneConstOf(ImageOSDiskOsTypeLinux, ImageOSDiskOsTypeWindows) + gens["StorageAccountType"] = gen.PtrOf(gen.OneConstOf( + ImageOSDiskStorageAccountTypePremiumLRS, + ImageOSDiskStorageAccountTypePremiumZRS, + ImageOSDiskStorageAccountTypeStandardLRS, + ImageOSDiskStorageAccountTypeStandardSSDLRS, + ImageOSDiskStorageAccountTypeStandardSSDZRS, + ImageOSDiskStorageAccountTypeUltraSSDLRS)) +} + +// AddRelatedPropertyGeneratorsForImageOSDisk is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageOSDisk(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(DiskEncryptionSetParametersGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceGenerator()) +} + +func Test_ImageOSDisk_Status_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from ImageOSDisk_Status to ImageOSDisk_Status via AssignPropertiesToImageOSDiskStatus & AssignPropertiesFromImageOSDiskStatus returns original", + prop.ForAll(RunPropertyAssignmentTestForImageOSDiskStatus, ImageOSDiskStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForImageOSDiskStatus tests if a specific instance of ImageOSDisk_Status can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForImageOSDiskStatus(subject ImageOSDisk_Status) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.ImageOSDisk_Status + err := copied.AssignPropertiesToImageOSDiskStatus(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual ImageOSDisk_Status + err = actual.AssignPropertiesFromImageOSDiskStatus(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_ImageOSDisk_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageOSDisk_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageOSDiskStatus, ImageOSDiskStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageOSDiskStatus runs a test to see if a specific instance of ImageOSDisk_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForImageOSDiskStatus(subject ImageOSDisk_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageOSDisk_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageOSDisk_Status instances for property testing - lazily instantiated by ImageOSDiskStatusGenerator() +var imageOSDiskStatusGenerator gopter.Gen + +// ImageOSDiskStatusGenerator returns a generator of ImageOSDisk_Status instances for property testing. +// We first initialize imageOSDiskStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageOSDiskStatusGenerator() gopter.Gen { + if imageOSDiskStatusGenerator != nil { + return imageOSDiskStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDiskStatus(generators) + imageOSDiskStatusGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDiskStatus(generators) + AddRelatedPropertyGeneratorsForImageOSDiskStatus(generators) + imageOSDiskStatusGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk_Status{}), generators) + + return imageOSDiskStatusGenerator +} + +// AddIndependentPropertyGeneratorsForImageOSDiskStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageOSDiskStatus(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.OneConstOf(ImageOSDiskStatusCachingNone, ImageOSDiskStatusCachingReadOnly, ImageOSDiskStatusCachingReadWrite)) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["OsState"] = gen.OneConstOf(ImageOSDiskStatusOsStateGeneralized, ImageOSDiskStatusOsStateSpecialized) + gens["OsType"] = gen.OneConstOf(ImageOSDiskStatusOsTypeLinux, ImageOSDiskStatusOsTypeWindows) + gens["StorageAccountType"] = gen.PtrOf(gen.OneConstOf( + StorageAccountType_StatusPremiumLRS, + StorageAccountType_StatusPremiumZRS, + StorageAccountType_StatusStandardLRS, + StorageAccountType_StatusStandardSSDLRS, + StorageAccountType_StatusStandardSSDZRS, + StorageAccountType_StatusUltraSSDLRS)) +} + +// AddRelatedPropertyGeneratorsForImageOSDiskStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageOSDiskStatus(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceStatusGenerator()) +} + +func Test_DiskEncryptionSetParameters_WhenPropertiesConverted_RoundTripsWithoutLoss(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip from DiskEncryptionSetParameters to DiskEncryptionSetParameters via AssignPropertiesToDiskEncryptionSetParameters & AssignPropertiesFromDiskEncryptionSetParameters returns original", + prop.ForAll(RunPropertyAssignmentTestForDiskEncryptionSetParameters, DiskEncryptionSetParametersGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(false, 240, os.Stdout)) +} + +// RunPropertyAssignmentTestForDiskEncryptionSetParameters tests if a specific instance of DiskEncryptionSetParameters can be assigned to v1alpha1api20210701storage and back losslessly +func RunPropertyAssignmentTestForDiskEncryptionSetParameters(subject DiskEncryptionSetParameters) string { + // Copy subject to make sure assignment doesn't modify it + copied := subject.DeepCopy() + + // Use AssignPropertiesTo() for the first stage of conversion + var other v1alpha1api20210701storage.DiskEncryptionSetParameters + err := copied.AssignPropertiesToDiskEncryptionSetParameters(&other) + if err != nil { + return err.Error() + } + + // Use AssignPropertiesFrom() to convert back to our original type + var actual DiskEncryptionSetParameters + err = actual.AssignPropertiesFromDiskEncryptionSetParameters(&other) + if err != nil { + return err.Error() + } + + //Check for a match + match := cmp.Equal(subject, actual) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +func Test_DiskEncryptionSetParameters_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of DiskEncryptionSetParameters via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDiskEncryptionSetParameters, DiskEncryptionSetParametersGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDiskEncryptionSetParameters runs a test to see if a specific instance of DiskEncryptionSetParameters round trips to JSON and back losslessly +func RunJSONSerializationTestForDiskEncryptionSetParameters(subject DiskEncryptionSetParameters) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual DiskEncryptionSetParameters + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of DiskEncryptionSetParameters instances for property testing - lazily instantiated by +//DiskEncryptionSetParametersGenerator() +var diskEncryptionSetParametersGenerator gopter.Gen + +// DiskEncryptionSetParametersGenerator returns a generator of DiskEncryptionSetParameters instances for property testing. +func DiskEncryptionSetParametersGenerator() gopter.Gen { + if diskEncryptionSetParametersGenerator != nil { + return diskEncryptionSetParametersGenerator + } + + generators := make(map[string]gopter.Gen) + diskEncryptionSetParametersGenerator = gen.Struct(reflect.TypeOf(DiskEncryptionSetParameters{}), generators) + + return diskEncryptionSetParametersGenerator +} diff --git a/v2/api/compute/v1alpha1api20210701/images__spec_arm_types_gen.go b/v2/api/compute/v1alpha1api20210701/images__spec_arm_types_gen.go new file mode 100644 index 00000000000..781b2cea439 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701/images__spec_arm_types_gen.go @@ -0,0 +1,174 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20210701 + +import "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + +type Images_SpecARM struct { + //ExtendedLocation: The complex type of the extended location. + ExtendedLocation *ExtendedLocationARM `json:"extendedLocation,omitempty"` + + //Location: Location to deploy resource to + Location string `json:"location,omitempty"` + + //Name: The name of the image. + Name string `json:"name"` + + //Properties: Describes the properties of an Image. + Properties ImagePropertiesARM `json:"properties"` + + //Tags: Name-value pairs to add to the resource + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ARMResourceSpec = &Images_SpecARM{} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2021-07-01" +func (images Images_SpecARM) GetAPIVersion() string { + return "2021-07-01" +} + +// GetName returns the Name of the resource +func (images Images_SpecARM) GetName() string { + return images.Name +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Compute/images" +func (images Images_SpecARM) GetType() string { + return "Microsoft.Compute/images" +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ExtendedLocation +type ExtendedLocationARM struct { + //Name: The name of the extended location. + Name *string `json:"name,omitempty"` + + //Type: The type of the extended location. + Type *ExtendedLocationType `json:"type,omitempty"` +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageProperties +type ImagePropertiesARM struct { + //HyperVGeneration: Specifies the HyperVGenerationType of the VirtualMachine + //created from the image. From API Version 2019-03-01 if the image source is a + //blob, then we need the user to specify the value, if the source is managed + //resource like disk or snapshot, we may require the user to specify the property + //if we cannot deduce it from the source managed resource. + HyperVGeneration *ImagePropertiesHyperVGeneration `json:"hyperVGeneration,omitempty"` + SourceVirtualMachine *SubResourceARM `json:"sourceVirtualMachine,omitempty"` + + //StorageProfile: Describes a storage profile. + StorageProfile *ImageStorageProfileARM `json:"storageProfile,omitempty"` +} + +// +kubebuilder:validation:Enum={"EdgeZone"} +type ExtendedLocationType string + +const ExtendedLocationTypeEdgeZone = ExtendedLocationType("EdgeZone") + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageStorageProfile +type ImageStorageProfileARM struct { + //DataDisks: Specifies the parameters that are used to add a data disk to a + //virtual machine. + //For more information about disks, see [About disks and VHDs for Azure virtual + //machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + DataDisks []ImageDataDiskARM `json:"dataDisks,omitempty"` + + //OsDisk: Describes an Operating System disk. + OsDisk *ImageOSDiskARM `json:"osDisk,omitempty"` + + //ZoneResilient: Specifies whether an image is zone resilient or not. Default is + //false. Zone resilient images can be created only in regions that provide Zone + //Redundant Storage (ZRS). + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/SubResource +type SubResourceARM struct { + Id *string `json:"id,omitempty"` +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageDataDisk +type ImageDataDiskARM struct { + //BlobUri: The Virtual Hard Disk. + BlobUri *string `json:"blobUri,omitempty"` + + //Caching: Specifies the caching requirements. + //Possible values are: + //None + //ReadOnly + //ReadWrite + //Default: None for Standard storage. ReadOnly for Premium storage. + Caching *ImageDataDiskCaching `json:"caching,omitempty"` + + //DiskEncryptionSet: Describes the parameter of customer managed disk encryption + //set resource id that can be specified for disk. + //NOTE: The disk encryption set resource id can only be specified for managed + //disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. + DiskEncryptionSet *DiskEncryptionSetParametersARM `json:"diskEncryptionSet,omitempty"` + + //DiskSizeGB: Specifies the size of empty data disks in gigabytes. This element + //can be used to overwrite the name of the disk in a virtual machine image. + //This value cannot be larger than 1023 GB + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + + //Lun: Specifies the logical unit number of the data disk. This value is used to + //identify data disks within the VM and therefore must be unique for each data + //disk attached to a VM. + Lun int `json:"lun"` + ManagedDisk *SubResourceARM `json:"managedDisk,omitempty"` + Snapshot *SubResourceARM `json:"snapshot,omitempty"` + + //StorageAccountType: Specifies the storage account type for the managed disk. + //NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS + //Disk. + StorageAccountType *ImageDataDiskStorageAccountType `json:"storageAccountType,omitempty"` +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageOSDisk +type ImageOSDiskARM struct { + //BlobUri: The Virtual Hard Disk. + BlobUri *string `json:"blobUri,omitempty"` + + //Caching: Specifies the caching requirements. + //Possible values are: + //None + //ReadOnly + //ReadWrite + //Default: None for Standard storage. ReadOnly for Premium storage. + Caching *ImageOSDiskCaching `json:"caching,omitempty"` + + //DiskEncryptionSet: Describes the parameter of customer managed disk encryption + //set resource id that can be specified for disk. + //NOTE: The disk encryption set resource id can only be specified for managed + //disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. + DiskEncryptionSet *DiskEncryptionSetParametersARM `json:"diskEncryptionSet,omitempty"` + + //DiskSizeGB: Specifies the size of empty data disks in gigabytes. This element + //can be used to overwrite the name of the disk in a virtual machine image. + //This value cannot be larger than 1023 GB + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + ManagedDisk *SubResourceARM `json:"managedDisk,omitempty"` + + //OsState: The OS State. + OsState ImageOSDiskOsState `json:"osState"` + + //OsType: This property allows you to specify the type of the OS that is included + //in the disk if creating a VM from a custom image. + //Possible values are: + //Windows + //Linux. + OsType ImageOSDiskOsType `json:"osType"` + Snapshot *SubResourceARM `json:"snapshot,omitempty"` + + //StorageAccountType: Specifies the storage account type for the managed disk. + //NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS + //Disk. + StorageAccountType *ImageOSDiskStorageAccountType `json:"storageAccountType,omitempty"` +} + +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/DiskEncryptionSetParameters +type DiskEncryptionSetParametersARM struct { + Id *string `json:"id,omitempty"` +} diff --git a/v2/api/compute/v1alpha1api20210701/images__spec_arm_types_gen_test.go b/v2/api/compute/v1alpha1api20210701/images__spec_arm_types_gen_test.go new file mode 100644 index 00000000000..fa21db28ad8 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701/images__spec_arm_types_gen_test.go @@ -0,0 +1,594 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20210701 + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Images_SpecARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Images_SpecARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImagesSpecARM, ImagesSpecARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImagesSpecARM runs a test to see if a specific instance of Images_SpecARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImagesSpecARM(subject Images_SpecARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Images_SpecARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Images_SpecARM instances for property testing - lazily instantiated by ImagesSpecARMGenerator() +var imagesSpecARMGenerator gopter.Gen + +// ImagesSpecARMGenerator returns a generator of Images_SpecARM instances for property testing. +// We first initialize imagesSpecARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImagesSpecARMGenerator() gopter.Gen { + if imagesSpecARMGenerator != nil { + return imagesSpecARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagesSpecARM(generators) + imagesSpecARMGenerator = gen.Struct(reflect.TypeOf(Images_SpecARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagesSpecARM(generators) + AddRelatedPropertyGeneratorsForImagesSpecARM(generators) + imagesSpecARMGenerator = gen.Struct(reflect.TypeOf(Images_SpecARM{}), generators) + + return imagesSpecARMGenerator +} + +// AddIndependentPropertyGeneratorsForImagesSpecARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImagesSpecARM(gens map[string]gopter.Gen) { + gens["Location"] = gen.AlphaString() + gens["Name"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImagesSpecARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImagesSpecARM(gens map[string]gopter.Gen) { + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationARMGenerator()) + gens["Properties"] = ImagePropertiesARMGenerator() +} + +func Test_ExtendedLocationARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ExtendedLocationARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForExtendedLocationARM, ExtendedLocationARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForExtendedLocationARM runs a test to see if a specific instance of ExtendedLocationARM round trips to JSON and back losslessly +func RunJSONSerializationTestForExtendedLocationARM(subject ExtendedLocationARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ExtendedLocationARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ExtendedLocationARM instances for property testing - lazily instantiated by +//ExtendedLocationARMGenerator() +var extendedLocationARMGenerator gopter.Gen + +// ExtendedLocationARMGenerator returns a generator of ExtendedLocationARM instances for property testing. +func ExtendedLocationARMGenerator() gopter.Gen { + if extendedLocationARMGenerator != nil { + return extendedLocationARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForExtendedLocationARM(generators) + extendedLocationARMGenerator = gen.Struct(reflect.TypeOf(ExtendedLocationARM{}), generators) + + return extendedLocationARMGenerator +} + +// AddIndependentPropertyGeneratorsForExtendedLocationARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForExtendedLocationARM(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.OneConstOf(ExtendedLocationTypeEdgeZone)) +} + +func Test_ImagePropertiesARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImagePropertiesARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImagePropertiesARM, ImagePropertiesARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImagePropertiesARM runs a test to see if a specific instance of ImagePropertiesARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImagePropertiesARM(subject ImagePropertiesARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImagePropertiesARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImagePropertiesARM instances for property testing - lazily instantiated by ImagePropertiesARMGenerator() +var imagePropertiesARMGenerator gopter.Gen + +// ImagePropertiesARMGenerator returns a generator of ImagePropertiesARM instances for property testing. +// We first initialize imagePropertiesARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImagePropertiesARMGenerator() gopter.Gen { + if imagePropertiesARMGenerator != nil { + return imagePropertiesARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagePropertiesARM(generators) + imagePropertiesARMGenerator = gen.Struct(reflect.TypeOf(ImagePropertiesARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagePropertiesARM(generators) + AddRelatedPropertyGeneratorsForImagePropertiesARM(generators) + imagePropertiesARMGenerator = gen.Struct(reflect.TypeOf(ImagePropertiesARM{}), generators) + + return imagePropertiesARMGenerator +} + +// AddIndependentPropertyGeneratorsForImagePropertiesARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImagePropertiesARM(gens map[string]gopter.Gen) { + gens["HyperVGeneration"] = gen.PtrOf(gen.OneConstOf(ImagePropertiesHyperVGenerationV1, ImagePropertiesHyperVGenerationV2)) +} + +// AddRelatedPropertyGeneratorsForImagePropertiesARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImagePropertiesARM(gens map[string]gopter.Gen) { + gens["SourceVirtualMachine"] = gen.PtrOf(SubResourceARMGenerator()) + gens["StorageProfile"] = gen.PtrOf(ImageStorageProfileARMGenerator()) +} + +func Test_ImageStorageProfileARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageStorageProfileARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStorageProfileARM, ImageStorageProfileARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStorageProfileARM runs a test to see if a specific instance of ImageStorageProfileARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStorageProfileARM(subject ImageStorageProfileARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageStorageProfileARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageStorageProfileARM instances for property testing - lazily instantiated by +//ImageStorageProfileARMGenerator() +var imageStorageProfileARMGenerator gopter.Gen + +// ImageStorageProfileARMGenerator returns a generator of ImageStorageProfileARM instances for property testing. +// We first initialize imageStorageProfileARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStorageProfileARMGenerator() gopter.Gen { + if imageStorageProfileARMGenerator != nil { + return imageStorageProfileARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfileARM(generators) + imageStorageProfileARMGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfileARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfileARM(generators) + AddRelatedPropertyGeneratorsForImageStorageProfileARM(generators) + imageStorageProfileARMGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfileARM{}), generators) + + return imageStorageProfileARMGenerator +} + +// AddIndependentPropertyGeneratorsForImageStorageProfileARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStorageProfileARM(gens map[string]gopter.Gen) { + gens["ZoneResilient"] = gen.PtrOf(gen.Bool()) +} + +// AddRelatedPropertyGeneratorsForImageStorageProfileARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStorageProfileARM(gens map[string]gopter.Gen) { + gens["DataDisks"] = gen.SliceOf(ImageDataDiskARMGenerator()) + gens["OsDisk"] = gen.PtrOf(ImageOSDiskARMGenerator()) +} + +func Test_SubResourceARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SubResourceARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubResourceARM, SubResourceARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubResourceARM runs a test to see if a specific instance of SubResourceARM round trips to JSON and back losslessly +func RunJSONSerializationTestForSubResourceARM(subject SubResourceARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SubResourceARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SubResourceARM instances for property testing - lazily instantiated by SubResourceARMGenerator() +var subResourceARMGenerator gopter.Gen + +// SubResourceARMGenerator returns a generator of SubResourceARM instances for property testing. +func SubResourceARMGenerator() gopter.Gen { + if subResourceARMGenerator != nil { + return subResourceARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSubResourceARM(generators) + subResourceARMGenerator = gen.Struct(reflect.TypeOf(SubResourceARM{}), generators) + + return subResourceARMGenerator +} + +// AddIndependentPropertyGeneratorsForSubResourceARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSubResourceARM(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ImageDataDiskARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageDataDiskARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageDataDiskARM, ImageDataDiskARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageDataDiskARM runs a test to see if a specific instance of ImageDataDiskARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImageDataDiskARM(subject ImageDataDiskARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageDataDiskARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageDataDiskARM instances for property testing - lazily instantiated by ImageDataDiskARMGenerator() +var imageDataDiskARMGenerator gopter.Gen + +// ImageDataDiskARMGenerator returns a generator of ImageDataDiskARM instances for property testing. +// We first initialize imageDataDiskARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageDataDiskARMGenerator() gopter.Gen { + if imageDataDiskARMGenerator != nil { + return imageDataDiskARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDiskARM(generators) + imageDataDiskARMGenerator = gen.Struct(reflect.TypeOf(ImageDataDiskARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDiskARM(generators) + AddRelatedPropertyGeneratorsForImageDataDiskARM(generators) + imageDataDiskARMGenerator = gen.Struct(reflect.TypeOf(ImageDataDiskARM{}), generators) + + return imageDataDiskARMGenerator +} + +// AddIndependentPropertyGeneratorsForImageDataDiskARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageDataDiskARM(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.OneConstOf(ImageDataDiskCachingNone, ImageDataDiskCachingReadOnly, ImageDataDiskCachingReadWrite)) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["Lun"] = gen.Int() + gens["StorageAccountType"] = gen.PtrOf(gen.OneConstOf( + ImageDataDiskStorageAccountTypePremiumLRS, + ImageDataDiskStorageAccountTypePremiumZRS, + ImageDataDiskStorageAccountTypeStandardLRS, + ImageDataDiskStorageAccountTypeStandardSSDLRS, + ImageDataDiskStorageAccountTypeStandardSSDZRS, + ImageDataDiskStorageAccountTypeUltraSSDLRS)) +} + +// AddRelatedPropertyGeneratorsForImageDataDiskARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageDataDiskARM(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(DiskEncryptionSetParametersARMGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceARMGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceARMGenerator()) +} + +func Test_ImageOSDiskARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageOSDiskARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageOSDiskARM, ImageOSDiskARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageOSDiskARM runs a test to see if a specific instance of ImageOSDiskARM round trips to JSON and back losslessly +func RunJSONSerializationTestForImageOSDiskARM(subject ImageOSDiskARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageOSDiskARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageOSDiskARM instances for property testing - lazily instantiated by ImageOSDiskARMGenerator() +var imageOSDiskARMGenerator gopter.Gen + +// ImageOSDiskARMGenerator returns a generator of ImageOSDiskARM instances for property testing. +// We first initialize imageOSDiskARMGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageOSDiskARMGenerator() gopter.Gen { + if imageOSDiskARMGenerator != nil { + return imageOSDiskARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDiskARM(generators) + imageOSDiskARMGenerator = gen.Struct(reflect.TypeOf(ImageOSDiskARM{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDiskARM(generators) + AddRelatedPropertyGeneratorsForImageOSDiskARM(generators) + imageOSDiskARMGenerator = gen.Struct(reflect.TypeOf(ImageOSDiskARM{}), generators) + + return imageOSDiskARMGenerator +} + +// AddIndependentPropertyGeneratorsForImageOSDiskARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageOSDiskARM(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.OneConstOf(ImageOSDiskCachingNone, ImageOSDiskCachingReadOnly, ImageOSDiskCachingReadWrite)) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["OsState"] = gen.OneConstOf(ImageOSDiskOsStateGeneralized, ImageOSDiskOsStateSpecialized) + gens["OsType"] = gen.OneConstOf(ImageOSDiskOsTypeLinux, ImageOSDiskOsTypeWindows) + gens["StorageAccountType"] = gen.PtrOf(gen.OneConstOf( + ImageOSDiskStorageAccountTypePremiumLRS, + ImageOSDiskStorageAccountTypePremiumZRS, + ImageOSDiskStorageAccountTypeStandardLRS, + ImageOSDiskStorageAccountTypeStandardSSDLRS, + ImageOSDiskStorageAccountTypeStandardSSDZRS, + ImageOSDiskStorageAccountTypeUltraSSDLRS)) +} + +// AddRelatedPropertyGeneratorsForImageOSDiskARM is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageOSDiskARM(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(DiskEncryptionSetParametersARMGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceARMGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceARMGenerator()) +} + +func Test_DiskEncryptionSetParametersARM_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of DiskEncryptionSetParametersARM via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDiskEncryptionSetParametersARM, DiskEncryptionSetParametersARMGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDiskEncryptionSetParametersARM runs a test to see if a specific instance of DiskEncryptionSetParametersARM round trips to JSON and back losslessly +func RunJSONSerializationTestForDiskEncryptionSetParametersARM(subject DiskEncryptionSetParametersARM) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual DiskEncryptionSetParametersARM + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of DiskEncryptionSetParametersARM instances for property testing - lazily instantiated by +//DiskEncryptionSetParametersARMGenerator() +var diskEncryptionSetParametersARMGenerator gopter.Gen + +// DiskEncryptionSetParametersARMGenerator returns a generator of DiskEncryptionSetParametersARM instances for property testing. +func DiskEncryptionSetParametersARMGenerator() gopter.Gen { + if diskEncryptionSetParametersARMGenerator != nil { + return diskEncryptionSetParametersARMGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForDiskEncryptionSetParametersARM(generators) + diskEncryptionSetParametersARMGenerator = gen.Struct(reflect.TypeOf(DiskEncryptionSetParametersARM{}), generators) + + return diskEncryptionSetParametersARMGenerator +} + +// AddIndependentPropertyGeneratorsForDiskEncryptionSetParametersARM is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForDiskEncryptionSetParametersARM(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} diff --git a/v2/api/compute/v1alpha1api20210701storage/groupversion_info_gen.go b/v2/api/compute/v1alpha1api20210701storage/groupversion_info_gen.go new file mode 100644 index 00000000000..177ff5bb961 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701storage/groupversion_info_gen.go @@ -0,0 +1,31 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by azure-service-operator-codegen. DO NOT EDIT. + +// Package v1alpha1api20210701storage contains API Schema definitions for the compute v1alpha1api20210701storage API group +// +kubebuilder:object:generate=true +// All object properties are optional by default, this will be overridden when needed: +// +kubebuilder:validation:Optional +// +groupName=compute.azure.com +package v1alpha1api20210701storage + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "compute.azure.com", Version: "v1alpha1api20210701storage"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme + + localSchemeBuilder = SchemeBuilder.SchemeBuilder +) diff --git a/v2/api/compute/v1alpha1api20210701storage/image_types_gen.go b/v2/api/compute/v1alpha1api20210701storage/image_types_gen.go new file mode 100644 index 00000000000..dd385562028 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701storage/image_types_gen.go @@ -0,0 +1,320 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20210701storage + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "github.com/pkg/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// +kubebuilder:rbac:groups=compute.azure.com,resources=images,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=compute.azure.com,resources={images/status,images/finalizers},verbs=get;update;patch + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +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 v1alpha1api20210701.Image +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/resourceDefinitions/images +type Image struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec Images_Spec `json:"spec,omitempty"` + Status Image_Status `json:"status,omitempty"` +} + +var _ conditions.Conditioner = &Image{} + +// GetConditions returns the conditions of the resource +func (image *Image) GetConditions() conditions.Conditions { + return image.Status.Conditions +} + +// SetConditions sets the conditions on the resource status +func (image *Image) SetConditions(conditions conditions.Conditions) { + image.Status.Conditions = conditions +} + +var _ genruntime.KubernetesResource = &Image{} + +// AzureName returns the Azure name of the resource +func (image *Image) AzureName() string { + return image.Spec.AzureName +} + +// GetAPIVersion returns the ARM API version of the resource. This is always "2021-07-01" +func (image Image) GetAPIVersion() string { + return "2021-07-01" +} + +// GetResourceKind returns the kind of the resource +func (image *Image) GetResourceKind() genruntime.ResourceKind { + return genruntime.ResourceKindNormal +} + +// GetSpec returns the specification of this resource +func (image *Image) GetSpec() genruntime.ConvertibleSpec { + return &image.Spec +} + +// GetStatus returns the status of this resource +func (image *Image) GetStatus() genruntime.ConvertibleStatus { + return &image.Status +} + +// GetType returns the ARM Type of the resource. This is always "Microsoft.Compute/images" +func (image *Image) GetType() string { + return "Microsoft.Compute/images" +} + +// NewEmptyStatus returns a new empty (blank) status +func (image *Image) NewEmptyStatus() genruntime.ConvertibleStatus { + return &Image_Status{} +} + +// Owner returns the ResourceReference of the owner, or nil if there is no owner +func (image *Image) Owner() *genruntime.ResourceReference { + group, kind := genruntime.LookupOwnerGroupKind(image.Spec) + return &genruntime.ResourceReference{ + Group: group, + Kind: kind, + Name: image.Spec.Owner.Name, + } +} + +// SetStatus sets the status of this resource +func (image *Image) SetStatus(status genruntime.ConvertibleStatus) error { + // If we have exactly the right type of status, assign it + if st, ok := status.(*Image_Status); ok { + image.Status = *st + return nil + } + + // Convert status to required version + var st Image_Status + err := status.ConvertStatusTo(&st) + if err != nil { + return errors.Wrap(err, "failed to convert status") + } + + image.Status = st + return nil +} + +// Hub marks that this Image is the hub type for conversion +func (image *Image) Hub() {} + +// OriginalGVK returns a GroupValueKind for the original API version used to create the resource +func (image *Image) OriginalGVK() *schema.GroupVersionKind { + return &schema.GroupVersionKind{ + Group: GroupVersion.Group, + Version: image.Spec.OriginalVersion, + Kind: "Image", + } +} + +// +kubebuilder:object:root=true +//Storage version of v1alpha1api20210701.Image +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/resourceDefinitions/images +type ImageList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Image `json:"items"` +} + +//Storage version of v1alpha1api20210701.Image_Status +type Image_Status struct { + Conditions []conditions.Condition `json:"conditions,omitempty"` + ExtendedLocation *ExtendedLocation_Status `json:"extendedLocation,omitempty"` + HyperVGeneration *string `json:"hyperVGeneration,omitempty"` + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SourceVirtualMachine *SubResource_Status `json:"sourceVirtualMachine,omitempty"` + StorageProfile *ImageStorageProfile_Status `json:"storageProfile,omitempty"` + Tags map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ genruntime.ConvertibleStatus = &Image_Status{} + +// ConvertStatusFrom populates our Image_Status from the provided source +func (image *Image_Status) ConvertStatusFrom(source genruntime.ConvertibleStatus) error { + if source == image { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return source.ConvertStatusTo(image) +} + +// ConvertStatusTo populates the provided destination from our Image_Status +func (image *Image_Status) ConvertStatusTo(destination genruntime.ConvertibleStatus) error { + if destination == image { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus") + } + + return destination.ConvertStatusFrom(image) +} + +//Storage version of v1alpha1api20210701.Images_Spec +type Images_Spec struct { + //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"` + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + HyperVGeneration *string `json:"hyperVGeneration,omitempty"` + Location *string `json:"location,omitempty"` + OriginalVersion string `json:"originalVersion"` + + // +kubebuilder:validation:Required + Owner genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner" kind:"ResourceGroup"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` + StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` + Tags map[string]string `json:"tags,omitempty"` +} + +var _ genruntime.ConvertibleSpec = &Images_Spec{} + +// ConvertSpecFrom populates our Images_Spec from the provided source +func (images *Images_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error { + if source == images { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return source.ConvertSpecTo(images) +} + +// ConvertSpecTo populates the provided destination from our Images_Spec +func (images *Images_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error { + if destination == images { + return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec") + } + + return destination.ConvertSpecFrom(images) +} + +//Storage version of v1alpha1api20210701.ExtendedLocation +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ExtendedLocation +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Type *string `json:"type,omitempty"` +} + +//Storage version of v1alpha1api20210701.ExtendedLocation_Status +type ExtendedLocation_Status struct { + Name *string `json:"name,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Type *string `json:"type,omitempty"` +} + +//Storage version of v1alpha1api20210701.ImageStorageProfile +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageStorageProfile +type ImageStorageProfile struct { + DataDisks []ImageDataDisk `json:"dataDisks,omitempty"` + OsDisk *ImageOSDisk `json:"osDisk,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} + +//Storage version of v1alpha1api20210701.ImageStorageProfile_Status +type ImageStorageProfile_Status struct { + DataDisks []ImageDataDisk_Status `json:"dataDisks,omitempty"` + OsDisk *ImageOSDisk_Status `json:"osDisk,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} + +//Storage version of v1alpha1api20210701.SubResource +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/SubResource +type SubResource struct { + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + + //Reference: Resource Id + Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"` +} + +//Storage version of v1alpha1api20210701.SubResource_Status +type SubResource_Status struct { + Id *string `json:"id,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` +} + +//Storage version of v1alpha1api20210701.ImageDataDisk +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageDataDisk +type ImageDataDisk struct { + BlobUri *string `json:"blobUri,omitempty"` + Caching *string `json:"caching,omitempty"` + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + Lun *int `json:"lun,omitempty"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Snapshot *SubResource `json:"snapshot,omitempty"` + StorageAccountType *string `json:"storageAccountType,omitempty"` +} + +//Storage version of v1alpha1api20210701.ImageDataDisk_Status +type ImageDataDisk_Status struct { + BlobUri *string `json:"blobUri,omitempty"` + Caching *string `json:"caching,omitempty"` + DiskEncryptionSet *SubResource_Status `json:"diskEncryptionSet,omitempty"` + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + Lun *int `json:"lun,omitempty"` + ManagedDisk *SubResource_Status `json:"managedDisk,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Snapshot *SubResource_Status `json:"snapshot,omitempty"` + StorageAccountType *string `json:"storageAccountType,omitempty"` +} + +//Storage version of v1alpha1api20210701.ImageOSDisk +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/ImageOSDisk +type ImageOSDisk struct { + BlobUri *string `json:"blobUri,omitempty"` + Caching *string `json:"caching,omitempty"` + DiskEncryptionSet *DiskEncryptionSetParameters `json:"diskEncryptionSet,omitempty"` + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + OsState *string `json:"osState,omitempty"` + OsType *string `json:"osType,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Snapshot *SubResource `json:"snapshot,omitempty"` + StorageAccountType *string `json:"storageAccountType,omitempty"` +} + +//Storage version of v1alpha1api20210701.ImageOSDisk_Status +type ImageOSDisk_Status struct { + BlobUri *string `json:"blobUri,omitempty"` + Caching *string `json:"caching,omitempty"` + DiskEncryptionSet *SubResource_Status `json:"diskEncryptionSet,omitempty"` + DiskSizeGB *int `json:"diskSizeGB,omitempty"` + ManagedDisk *SubResource_Status `json:"managedDisk,omitempty"` + OsState *string `json:"osState,omitempty"` + OsType *string `json:"osType,omitempty"` + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + Snapshot *SubResource_Status `json:"snapshot,omitempty"` + StorageAccountType *string `json:"storageAccountType,omitempty"` +} + +//Storage version of v1alpha1api20210701.DiskEncryptionSetParameters +//Generated from: https://schema.management.azure.com/schemas/2021-07-01/Microsoft.Compute.json#/definitions/DiskEncryptionSetParameters +type DiskEncryptionSetParameters struct { + PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"` + + //Reference: Resource Id + Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"` +} + +func init() { + SchemeBuilder.Register(&Image{}, &ImageList{}) +} diff --git a/v2/api/compute/v1alpha1api20210701storage/image_types_gen_test.go b/v2/api/compute/v1alpha1api20210701storage/image_types_gen_test.go new file mode 100644 index 00000000000..34d67119fc5 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701storage/image_types_gen_test.go @@ -0,0 +1,994 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package v1alpha1api20210701storage + +import ( + "encoding/json" + "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/cmpopts" + "github.com/kr/pretty" + "github.com/kylelemons/godebug/diff" + "github.com/leanovate/gopter" + "github.com/leanovate/gopter/gen" + "github.com/leanovate/gopter/prop" + "os" + "reflect" + "testing" +) + +func Test_Image_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Image via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImage, ImageGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImage runs a test to see if a specific instance of Image round trips to JSON and back losslessly +func RunJSONSerializationTestForImage(subject Image) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Image + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Image instances for property testing - lazily instantiated by ImageGenerator() +var imageGenerator gopter.Gen + +// ImageGenerator returns a generator of Image instances for property testing. +func ImageGenerator() gopter.Gen { + if imageGenerator != nil { + return imageGenerator + } + + generators := make(map[string]gopter.Gen) + AddRelatedPropertyGeneratorsForImage(generators) + imageGenerator = gen.Struct(reflect.TypeOf(Image{}), generators) + + return imageGenerator +} + +// AddRelatedPropertyGeneratorsForImage is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImage(gens map[string]gopter.Gen) { + gens["Spec"] = ImagesSpecGenerator() + gens["Status"] = ImageStatusGenerator() +} + +func Test_Image_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Image_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStatus, ImageStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStatus runs a test to see if a specific instance of Image_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStatus(subject Image_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Image_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Image_Status instances for property testing - lazily instantiated by ImageStatusGenerator() +var imageStatusGenerator gopter.Gen + +// ImageStatusGenerator returns a generator of Image_Status instances for property testing. +// We first initialize imageStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStatusGenerator() gopter.Gen { + if imageStatusGenerator != nil { + return imageStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStatus(generators) + imageStatusGenerator = gen.Struct(reflect.TypeOf(Image_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStatus(generators) + AddRelatedPropertyGeneratorsForImageStatus(generators) + imageStatusGenerator = gen.Struct(reflect.TypeOf(Image_Status{}), generators) + + return imageStatusGenerator +} + +// AddIndependentPropertyGeneratorsForImageStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStatus(gens map[string]gopter.Gen) { + gens["HyperVGeneration"] = gen.PtrOf(gen.AlphaString()) + gens["Id"] = gen.PtrOf(gen.AlphaString()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["ProvisioningState"] = gen.PtrOf(gen.AlphaString()) + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImageStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStatus(gens map[string]gopter.Gen) { + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationStatusGenerator()) + gens["SourceVirtualMachine"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["StorageProfile"] = gen.PtrOf(ImageStorageProfileStatusGenerator()) +} + +func Test_Images_Spec_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of Images_Spec via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImagesSpec, ImagesSpecGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImagesSpec runs a test to see if a specific instance of Images_Spec round trips to JSON and back losslessly +func RunJSONSerializationTestForImagesSpec(subject Images_Spec) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual Images_Spec + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of Images_Spec instances for property testing - lazily instantiated by ImagesSpecGenerator() +var imagesSpecGenerator gopter.Gen + +// ImagesSpecGenerator returns a generator of Images_Spec instances for property testing. +// We first initialize imagesSpecGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImagesSpecGenerator() gopter.Gen { + if imagesSpecGenerator != nil { + return imagesSpecGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagesSpec(generators) + imagesSpecGenerator = gen.Struct(reflect.TypeOf(Images_Spec{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImagesSpec(generators) + AddRelatedPropertyGeneratorsForImagesSpec(generators) + imagesSpecGenerator = gen.Struct(reflect.TypeOf(Images_Spec{}), generators) + + return imagesSpecGenerator +} + +// AddIndependentPropertyGeneratorsForImagesSpec is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImagesSpec(gens map[string]gopter.Gen) { + gens["AzureName"] = gen.AlphaString() + gens["HyperVGeneration"] = gen.PtrOf(gen.AlphaString()) + gens["Location"] = gen.PtrOf(gen.AlphaString()) + gens["OriginalVersion"] = gen.AlphaString() + gens["Tags"] = gen.MapOf(gen.AlphaString(), gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImagesSpec is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImagesSpec(gens map[string]gopter.Gen) { + gens["ExtendedLocation"] = gen.PtrOf(ExtendedLocationGenerator()) + gens["SourceVirtualMachine"] = gen.PtrOf(SubResourceGenerator()) + gens["StorageProfile"] = gen.PtrOf(ImageStorageProfileGenerator()) +} + +func Test_ExtendedLocation_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ExtendedLocation via JSON returns original", + prop.ForAll(RunJSONSerializationTestForExtendedLocation, ExtendedLocationGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForExtendedLocation runs a test to see if a specific instance of ExtendedLocation round trips to JSON and back losslessly +func RunJSONSerializationTestForExtendedLocation(subject ExtendedLocation) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ExtendedLocation + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ExtendedLocation instances for property testing - lazily instantiated by ExtendedLocationGenerator() +var extendedLocationGenerator gopter.Gen + +// ExtendedLocationGenerator returns a generator of ExtendedLocation instances for property testing. +func ExtendedLocationGenerator() gopter.Gen { + if extendedLocationGenerator != nil { + return extendedLocationGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForExtendedLocation(generators) + extendedLocationGenerator = gen.Struct(reflect.TypeOf(ExtendedLocation{}), generators) + + return extendedLocationGenerator +} + +// AddIndependentPropertyGeneratorsForExtendedLocation is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForExtendedLocation(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ExtendedLocation_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ExtendedLocation_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForExtendedLocationStatus, ExtendedLocationStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForExtendedLocationStatus runs a test to see if a specific instance of ExtendedLocation_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForExtendedLocationStatus(subject ExtendedLocation_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ExtendedLocation_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ExtendedLocation_Status instances for property testing - lazily instantiated by +//ExtendedLocationStatusGenerator() +var extendedLocationStatusGenerator gopter.Gen + +// ExtendedLocationStatusGenerator returns a generator of ExtendedLocation_Status instances for property testing. +func ExtendedLocationStatusGenerator() gopter.Gen { + if extendedLocationStatusGenerator != nil { + return extendedLocationStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForExtendedLocationStatus(generators) + extendedLocationStatusGenerator = gen.Struct(reflect.TypeOf(ExtendedLocation_Status{}), generators) + + return extendedLocationStatusGenerator +} + +// AddIndependentPropertyGeneratorsForExtendedLocationStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForExtendedLocationStatus(gens map[string]gopter.Gen) { + gens["Name"] = gen.PtrOf(gen.AlphaString()) + gens["Type"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ImageStorageProfile_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageStorageProfile via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStorageProfile, ImageStorageProfileGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStorageProfile runs a test to see if a specific instance of ImageStorageProfile round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStorageProfile(subject ImageStorageProfile) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageStorageProfile + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageStorageProfile instances for property testing - lazily instantiated by +//ImageStorageProfileGenerator() +var imageStorageProfileGenerator gopter.Gen + +// ImageStorageProfileGenerator returns a generator of ImageStorageProfile instances for property testing. +// We first initialize imageStorageProfileGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStorageProfileGenerator() gopter.Gen { + if imageStorageProfileGenerator != nil { + return imageStorageProfileGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfile(generators) + imageStorageProfileGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfile(generators) + AddRelatedPropertyGeneratorsForImageStorageProfile(generators) + imageStorageProfileGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile{}), generators) + + return imageStorageProfileGenerator +} + +// AddIndependentPropertyGeneratorsForImageStorageProfile is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStorageProfile(gens map[string]gopter.Gen) { + gens["ZoneResilient"] = gen.PtrOf(gen.Bool()) +} + +// AddRelatedPropertyGeneratorsForImageStorageProfile is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStorageProfile(gens map[string]gopter.Gen) { + gens["DataDisks"] = gen.SliceOf(ImageDataDiskGenerator()) + gens["OsDisk"] = gen.PtrOf(ImageOSDiskGenerator()) +} + +func Test_ImageStorageProfile_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageStorageProfile_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageStorageProfileStatus, ImageStorageProfileStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageStorageProfileStatus runs a test to see if a specific instance of ImageStorageProfile_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForImageStorageProfileStatus(subject ImageStorageProfile_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageStorageProfile_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageStorageProfile_Status instances for property testing - lazily instantiated by +//ImageStorageProfileStatusGenerator() +var imageStorageProfileStatusGenerator gopter.Gen + +// ImageStorageProfileStatusGenerator returns a generator of ImageStorageProfile_Status instances for property testing. +// We first initialize imageStorageProfileStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageStorageProfileStatusGenerator() gopter.Gen { + if imageStorageProfileStatusGenerator != nil { + return imageStorageProfileStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfileStatus(generators) + imageStorageProfileStatusGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageStorageProfileStatus(generators) + AddRelatedPropertyGeneratorsForImageStorageProfileStatus(generators) + imageStorageProfileStatusGenerator = gen.Struct(reflect.TypeOf(ImageStorageProfile_Status{}), generators) + + return imageStorageProfileStatusGenerator +} + +// AddIndependentPropertyGeneratorsForImageStorageProfileStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageStorageProfileStatus(gens map[string]gopter.Gen) { + gens["ZoneResilient"] = gen.PtrOf(gen.Bool()) +} + +// AddRelatedPropertyGeneratorsForImageStorageProfileStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageStorageProfileStatus(gens map[string]gopter.Gen) { + gens["DataDisks"] = gen.SliceOf(ImageDataDiskStatusGenerator()) + gens["OsDisk"] = gen.PtrOf(ImageOSDiskStatusGenerator()) +} + +func Test_SubResource_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SubResource via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubResource, SubResourceGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubResource runs a test to see if a specific instance of SubResource round trips to JSON and back losslessly +func RunJSONSerializationTestForSubResource(subject SubResource) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SubResource + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SubResource instances for property testing - lazily instantiated by SubResourceGenerator() +var subResourceGenerator gopter.Gen + +// SubResourceGenerator returns a generator of SubResource instances for property testing. +func SubResourceGenerator() gopter.Gen { + if subResourceGenerator != nil { + return subResourceGenerator + } + + generators := make(map[string]gopter.Gen) + subResourceGenerator = gen.Struct(reflect.TypeOf(SubResource{}), generators) + + return subResourceGenerator +} + +func Test_SubResource_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of SubResource_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForSubResourceStatus, SubResourceStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForSubResourceStatus runs a test to see if a specific instance of SubResource_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForSubResourceStatus(subject SubResource_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual SubResource_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of SubResource_Status instances for property testing - lazily instantiated by SubResourceStatusGenerator() +var subResourceStatusGenerator gopter.Gen + +// SubResourceStatusGenerator returns a generator of SubResource_Status instances for property testing. +func SubResourceStatusGenerator() gopter.Gen { + if subResourceStatusGenerator != nil { + return subResourceStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForSubResourceStatus(generators) + subResourceStatusGenerator = gen.Struct(reflect.TypeOf(SubResource_Status{}), generators) + + return subResourceStatusGenerator +} + +// AddIndependentPropertyGeneratorsForSubResourceStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForSubResourceStatus(gens map[string]gopter.Gen) { + gens["Id"] = gen.PtrOf(gen.AlphaString()) +} + +func Test_ImageDataDisk_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageDataDisk via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageDataDisk, ImageDataDiskGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageDataDisk runs a test to see if a specific instance of ImageDataDisk round trips to JSON and back losslessly +func RunJSONSerializationTestForImageDataDisk(subject ImageDataDisk) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageDataDisk + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageDataDisk instances for property testing - lazily instantiated by ImageDataDiskGenerator() +var imageDataDiskGenerator gopter.Gen + +// ImageDataDiskGenerator returns a generator of ImageDataDisk instances for property testing. +// We first initialize imageDataDiskGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageDataDiskGenerator() gopter.Gen { + if imageDataDiskGenerator != nil { + return imageDataDiskGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDisk(generators) + imageDataDiskGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDisk(generators) + AddRelatedPropertyGeneratorsForImageDataDisk(generators) + imageDataDiskGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk{}), generators) + + return imageDataDiskGenerator +} + +// AddIndependentPropertyGeneratorsForImageDataDisk is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageDataDisk(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.AlphaString()) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["Lun"] = gen.PtrOf(gen.Int()) + gens["StorageAccountType"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImageDataDisk is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageDataDisk(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(DiskEncryptionSetParametersGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceGenerator()) +} + +func Test_ImageDataDisk_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageDataDisk_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageDataDiskStatus, ImageDataDiskStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageDataDiskStatus runs a test to see if a specific instance of ImageDataDisk_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForImageDataDiskStatus(subject ImageDataDisk_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageDataDisk_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageDataDisk_Status instances for property testing - lazily instantiated by +//ImageDataDiskStatusGenerator() +var imageDataDiskStatusGenerator gopter.Gen + +// ImageDataDiskStatusGenerator returns a generator of ImageDataDisk_Status instances for property testing. +// We first initialize imageDataDiskStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageDataDiskStatusGenerator() gopter.Gen { + if imageDataDiskStatusGenerator != nil { + return imageDataDiskStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDiskStatus(generators) + imageDataDiskStatusGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageDataDiskStatus(generators) + AddRelatedPropertyGeneratorsForImageDataDiskStatus(generators) + imageDataDiskStatusGenerator = gen.Struct(reflect.TypeOf(ImageDataDisk_Status{}), generators) + + return imageDataDiskStatusGenerator +} + +// AddIndependentPropertyGeneratorsForImageDataDiskStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageDataDiskStatus(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.AlphaString()) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["Lun"] = gen.PtrOf(gen.Int()) + gens["StorageAccountType"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImageDataDiskStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageDataDiskStatus(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceStatusGenerator()) +} + +func Test_ImageOSDisk_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageOSDisk via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageOSDisk, ImageOSDiskGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageOSDisk runs a test to see if a specific instance of ImageOSDisk round trips to JSON and back losslessly +func RunJSONSerializationTestForImageOSDisk(subject ImageOSDisk) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageOSDisk + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageOSDisk instances for property testing - lazily instantiated by ImageOSDiskGenerator() +var imageOSDiskGenerator gopter.Gen + +// ImageOSDiskGenerator returns a generator of ImageOSDisk instances for property testing. +// We first initialize imageOSDiskGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageOSDiskGenerator() gopter.Gen { + if imageOSDiskGenerator != nil { + return imageOSDiskGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDisk(generators) + imageOSDiskGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDisk(generators) + AddRelatedPropertyGeneratorsForImageOSDisk(generators) + imageOSDiskGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk{}), generators) + + return imageOSDiskGenerator +} + +// AddIndependentPropertyGeneratorsForImageOSDisk is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageOSDisk(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.AlphaString()) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["OsState"] = gen.PtrOf(gen.AlphaString()) + gens["OsType"] = gen.PtrOf(gen.AlphaString()) + gens["StorageAccountType"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImageOSDisk is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageOSDisk(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(DiskEncryptionSetParametersGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceGenerator()) +} + +func Test_ImageOSDisk_Status_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of ImageOSDisk_Status via JSON returns original", + prop.ForAll(RunJSONSerializationTestForImageOSDiskStatus, ImageOSDiskStatusGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForImageOSDiskStatus runs a test to see if a specific instance of ImageOSDisk_Status round trips to JSON and back losslessly +func RunJSONSerializationTestForImageOSDiskStatus(subject ImageOSDisk_Status) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual ImageOSDisk_Status + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of ImageOSDisk_Status instances for property testing - lazily instantiated by ImageOSDiskStatusGenerator() +var imageOSDiskStatusGenerator gopter.Gen + +// ImageOSDiskStatusGenerator returns a generator of ImageOSDisk_Status instances for property testing. +// We first initialize imageOSDiskStatusGenerator with a simplified generator based on the +// fields with primitive types then replacing it with a more complex one that also handles complex fields +// to ensure any cycles in the object graph properly terminate. +func ImageOSDiskStatusGenerator() gopter.Gen { + if imageOSDiskStatusGenerator != nil { + return imageOSDiskStatusGenerator + } + + generators := make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDiskStatus(generators) + imageOSDiskStatusGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk_Status{}), generators) + + // The above call to gen.Struct() captures the map, so create a new one + generators = make(map[string]gopter.Gen) + AddIndependentPropertyGeneratorsForImageOSDiskStatus(generators) + AddRelatedPropertyGeneratorsForImageOSDiskStatus(generators) + imageOSDiskStatusGenerator = gen.Struct(reflect.TypeOf(ImageOSDisk_Status{}), generators) + + return imageOSDiskStatusGenerator +} + +// AddIndependentPropertyGeneratorsForImageOSDiskStatus is a factory method for creating gopter generators +func AddIndependentPropertyGeneratorsForImageOSDiskStatus(gens map[string]gopter.Gen) { + gens["BlobUri"] = gen.PtrOf(gen.AlphaString()) + gens["Caching"] = gen.PtrOf(gen.AlphaString()) + gens["DiskSizeGB"] = gen.PtrOf(gen.Int()) + gens["OsState"] = gen.PtrOf(gen.AlphaString()) + gens["OsType"] = gen.PtrOf(gen.AlphaString()) + gens["StorageAccountType"] = gen.PtrOf(gen.AlphaString()) +} + +// AddRelatedPropertyGeneratorsForImageOSDiskStatus is a factory method for creating gopter generators +func AddRelatedPropertyGeneratorsForImageOSDiskStatus(gens map[string]gopter.Gen) { + gens["DiskEncryptionSet"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["ManagedDisk"] = gen.PtrOf(SubResourceStatusGenerator()) + gens["Snapshot"] = gen.PtrOf(SubResourceStatusGenerator()) +} + +func Test_DiskEncryptionSetParameters_WhenSerializedToJson_DeserializesAsEqual(t *testing.T) { + t.Parallel() + parameters := gopter.DefaultTestParameters() + parameters.MaxSize = 10 + properties := gopter.NewProperties(parameters) + properties.Property( + "Round trip of DiskEncryptionSetParameters via JSON returns original", + prop.ForAll(RunJSONSerializationTestForDiskEncryptionSetParameters, DiskEncryptionSetParametersGenerator())) + properties.TestingRun(t, gopter.NewFormatedReporter(true, 240, os.Stdout)) +} + +// RunJSONSerializationTestForDiskEncryptionSetParameters runs a test to see if a specific instance of DiskEncryptionSetParameters round trips to JSON and back losslessly +func RunJSONSerializationTestForDiskEncryptionSetParameters(subject DiskEncryptionSetParameters) string { + // Serialize to JSON + bin, err := json.Marshal(subject) + if err != nil { + return err.Error() + } + + // Deserialize back into memory + var actual DiskEncryptionSetParameters + err = json.Unmarshal(bin, &actual) + if err != nil { + return err.Error() + } + + // Check for outcome + match := cmp.Equal(subject, actual, cmpopts.EquateEmpty()) + if !match { + actualFmt := pretty.Sprint(actual) + subjectFmt := pretty.Sprint(subject) + result := diff.Diff(subjectFmt, actualFmt) + return result + } + + return "" +} + +// Generator of DiskEncryptionSetParameters instances for property testing - lazily instantiated by +//DiskEncryptionSetParametersGenerator() +var diskEncryptionSetParametersGenerator gopter.Gen + +// DiskEncryptionSetParametersGenerator returns a generator of DiskEncryptionSetParameters instances for property testing. +func DiskEncryptionSetParametersGenerator() gopter.Gen { + if diskEncryptionSetParametersGenerator != nil { + return diskEncryptionSetParametersGenerator + } + + generators := make(map[string]gopter.Gen) + diskEncryptionSetParametersGenerator = gen.Struct(reflect.TypeOf(DiskEncryptionSetParameters{}), generators) + + return diskEncryptionSetParametersGenerator +} diff --git a/v2/api/compute/versions_matrix.md b/v2/api/compute/versions_matrix.md index 2ce1e7891ce..ae45c97d8eb 100644 --- a/v2/api/compute/versions_matrix.md +++ b/v2/api/compute/versions_matrix.md @@ -1,270 +1,310 @@ -| Types defined in package "compute" | v1alpha1api20200930 | v1alpha1api20201201 | -|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|---------------------| -| AdditionalCapabilities | | v1alpha1api20201201 | -| AdditionalCapabilities_Status | | v1alpha1api20201201 | -| AdditionalUnattendContent | | v1alpha1api20201201 | -| AdditionalUnattendContentComponentName | | v1alpha1api20201201 | -| AdditionalUnattendContentPassName | | v1alpha1api20201201 | -| AdditionalUnattendContentSettingName | | v1alpha1api20201201 | -| AdditionalUnattendContentStatusComponentName | | v1alpha1api20201201 | -| AdditionalUnattendContentStatusPassName | | v1alpha1api20201201 | -| AdditionalUnattendContentStatusSettingName | | v1alpha1api20201201 | -| AdditionalUnattendContent_Status | | v1alpha1api20201201 | -| ApiEntityReference | | v1alpha1api20201201 | -| ApiEntityReference_Status | | v1alpha1api20201201 | -| ApiErrorBase_Status | | v1alpha1api20201201 | -| ApiError_Status | | v1alpha1api20201201 | -| AutomaticOSUpgradePolicy | | v1alpha1api20201201 | -| AutomaticOSUpgradePolicy_Status | | v1alpha1api20201201 | -| AutomaticRepairsPolicy | | v1alpha1api20201201 | -| AutomaticRepairsPolicy_Status | | v1alpha1api20201201 | -| AvailablePatchSummaryStatusStatus | | v1alpha1api20201201 | -| AvailablePatchSummary_Status | | v1alpha1api20201201 | -| BillingProfile | | v1alpha1api20201201 | -| BillingProfile_Status | | v1alpha1api20201201 | -| BootDiagnostics | | v1alpha1api20201201 | -| BootDiagnosticsInstanceView_Status | | v1alpha1api20201201 | -| BootDiagnostics_Status | | v1alpha1api20201201 | -| Caching_Status | | v1alpha1api20201201 | -| CreateOption_Status | | v1alpha1api20201201 | -| CreationData | v1alpha1api20200930 | | -| CreationDataCreateOption | v1alpha1api20200930 | | -| CreationDataStatusCreateOption | v1alpha1api20200930 | | -| CreationData_Status | v1alpha1api20200930 | | -| DataDisk | | v1alpha1api20201201 | -| DataDiskCaching | | v1alpha1api20201201 | -| DataDiskCreateOption | | v1alpha1api20201201 | -| DataDiskDetachOption | | v1alpha1api20201201 | -| DataDisk_Status | | v1alpha1api20201201 | -| DetachOption_Status | | v1alpha1api20201201 | -| DiagnosticsProfile | | v1alpha1api20201201 | -| DiagnosticsProfile_Status | | v1alpha1api20201201 | -| DiffDiskOption_Status | | v1alpha1api20201201 | -| DiffDiskPlacement_Status | | v1alpha1api20201201 | -| DiffDiskSettings | | v1alpha1api20201201 | -| DiffDiskSettingsOption | | v1alpha1api20201201 | -| DiffDiskSettingsPlacement | | v1alpha1api20201201 | -| DiffDiskSettings_Status | | v1alpha1api20201201 | -| Disk | v1alpha1api20200930 | | -| DiskEncryptionSetParameters | | v1alpha1api20201201 | -| DiskEncryptionSettings | | v1alpha1api20201201 | -| DiskEncryptionSettings_Status | | v1alpha1api20201201 | -| DiskInstanceView_Status | | v1alpha1api20201201 | -| DiskProperties | v1alpha1api20200930 | | -| DiskPropertiesHyperVGeneration | v1alpha1api20200930 | | -| DiskPropertiesNetworkAccessPolicy | v1alpha1api20200930 | | -| DiskPropertiesOsType | v1alpha1api20200930 | | -| DiskPropertiesStatusHyperVGeneration | v1alpha1api20200930 | | -| DiskPropertiesStatusOsType | v1alpha1api20200930 | | -| DiskProperties_Status | v1alpha1api20200930 | | -| DiskSku | v1alpha1api20200930 | | -| DiskSkuName | v1alpha1api20200930 | | -| DiskSkuStatusName | v1alpha1api20200930 | | -| DiskSku_Status | v1alpha1api20200930 | | -| DiskState_Status | v1alpha1api20200930 | | -| Disk_Status | v1alpha1api20200930 | | -| DisksSpecAPIVersion | v1alpha1api20200930 | | -| Disks_Spec | v1alpha1api20200930 | | -| Encryption | v1alpha1api20200930 | | -| EncryptionSettingsCollection | v1alpha1api20200930 | | -| EncryptionSettingsCollection_Status | v1alpha1api20200930 | | -| EncryptionSettingsElement | v1alpha1api20200930 | | -| EncryptionSettingsElement_Status | v1alpha1api20200930 | | -| EncryptionType | v1alpha1api20200930 | | -| EncryptionType_Status | v1alpha1api20200930 | | -| Encryption_Status | v1alpha1api20200930 | | -| EvictionPolicy_Status | | v1alpha1api20201201 | -| ExtendedLocation | v1alpha1api20200930 | v1alpha1api20201201 | -| ExtendedLocationType | v1alpha1api20200930 | v1alpha1api20201201 | -| ExtendedLocationType_Status | v1alpha1api20200930 | v1alpha1api20201201 | -| ExtendedLocation_Status | v1alpha1api20200930 | v1alpha1api20201201 | -| GenericExtension | | v1alpha1api20201201 | -| HardwareProfile | | v1alpha1api20201201 | -| HardwareProfileStatusVmSize | | v1alpha1api20201201 | -| HardwareProfileVmSize | | v1alpha1api20201201 | -| HardwareProfile_Status | | v1alpha1api20201201 | -| ImageDiskReference | v1alpha1api20200930 | | -| ImageDiskReference_Status | v1alpha1api20200930 | | -| ImageReference | | v1alpha1api20201201 | -| ImageReference_Status | | v1alpha1api20201201 | -| InnerError_Status | | v1alpha1api20201201 | -| InstanceViewStatusStatusLevel | | v1alpha1api20201201 | -| InstanceViewStatus_Status | | v1alpha1api20201201 | -| KeyVaultAndKeyReference | v1alpha1api20200930 | | -| KeyVaultAndKeyReference_Status | v1alpha1api20200930 | | -| KeyVaultAndSecretReference | v1alpha1api20200930 | | -| KeyVaultAndSecretReference_Status | v1alpha1api20200930 | | -| KeyVaultKeyReference | | v1alpha1api20201201 | -| KeyVaultKeyReference_Status | | v1alpha1api20201201 | -| KeyVaultSecretReference | | v1alpha1api20201201 | -| KeyVaultSecretReference_Status | | v1alpha1api20201201 | -| LastPatchInstallationSummaryStatusStatus | | v1alpha1api20201201 | -| LastPatchInstallationSummary_Status | | v1alpha1api20201201 | -| LinuxConfiguration | | v1alpha1api20201201 | -| LinuxConfiguration_Status | | v1alpha1api20201201 | -| LinuxPatchSettings | | v1alpha1api20201201 | -| LinuxPatchSettingsPatchMode | | v1alpha1api20201201 | -| LinuxPatchSettingsStatusPatchMode | | v1alpha1api20201201 | -| LinuxPatchSettings_Status | | v1alpha1api20201201 | -| MaintenanceRedeployStatusStatusLastOperationResultCode | | v1alpha1api20201201 | -| MaintenanceRedeployStatus_Status | | v1alpha1api20201201 | -| ManagedDiskParameters | | v1alpha1api20201201 | -| ManagedDiskParametersStorageAccountType | | v1alpha1api20201201 | -| ManagedDiskParameters_Status | | v1alpha1api20201201 | -| NetworkAccessPolicy_Status | v1alpha1api20200930 | | -| NetworkInterfaceReferenceProperties | | v1alpha1api20201201 | -| NetworkInterfaceReferenceProperties_Status | | v1alpha1api20201201 | -| NetworkInterfaceReference_Status | | v1alpha1api20201201 | -| NetworkProfile_Status | | v1alpha1api20201201 | -| OSDisk | | v1alpha1api20201201 | -| OSDiskCaching | | v1alpha1api20201201 | -| OSDiskCreateOption | | v1alpha1api20201201 | -| OSDiskOsType | | v1alpha1api20201201 | -| OSDiskStatusOsType | | v1alpha1api20201201 | -| OSDisk_Status | | v1alpha1api20201201 | -| OSProfile | | v1alpha1api20201201 | -| OSProfile_Status | | v1alpha1api20201201 | -| OrchestrationMode_Status | | v1alpha1api20201201 | -| PatchSettings | | v1alpha1api20201201 | -| PatchSettingsPatchMode | | v1alpha1api20201201 | -| PatchSettingsStatusPatchMode | | v1alpha1api20201201 | -| PatchSettings_Status | | v1alpha1api20201201 | -| Plan | | v1alpha1api20201201 | -| Plan_Status | | v1alpha1api20201201 | -| Priority_Status | | v1alpha1api20201201 | -| PurchasePlan | v1alpha1api20200930 | | -| PurchasePlan_Status | v1alpha1api20200930 | | -| RollingUpgradePolicy | | v1alpha1api20201201 | -| RollingUpgradePolicy_Status | | v1alpha1api20201201 | -| ScaleInPolicy | | v1alpha1api20201201 | -| ScaleInPolicyRules | | v1alpha1api20201201 | -| ScaleInPolicyStatusRules | | v1alpha1api20201201 | -| ScaleInPolicy_Status | | v1alpha1api20201201 | -| ScheduledEventsProfile | | v1alpha1api20201201 | -| ScheduledEventsProfile_Status | | v1alpha1api20201201 | -| SecurityProfile | | v1alpha1api20201201 | -| SecurityProfileSecurityType | | v1alpha1api20201201 | -| SecurityProfileStatusSecurityType | | v1alpha1api20201201 | -| SecurityProfile_Status | | v1alpha1api20201201 | -| ShareInfoElement_Status | v1alpha1api20200930 | | -| Sku | | v1alpha1api20201201 | -| Sku_Status | | v1alpha1api20201201 | -| SourceVault | v1alpha1api20200930 | | -| SourceVault_Status | v1alpha1api20200930 | | -| SshConfiguration | | v1alpha1api20201201 | -| SshConfiguration_Status | | v1alpha1api20201201 | -| SshPublicKey | | v1alpha1api20201201 | -| SshPublicKey_Status | | v1alpha1api20201201 | -| StorageAccountType_Status | | v1alpha1api20201201 | -| StorageProfile | | v1alpha1api20201201 | -| StorageProfile_Status | | v1alpha1api20201201 | -| SubResource | | v1alpha1api20201201 | -| SubResource_Status | | v1alpha1api20201201 | -| TerminateNotificationProfile | | v1alpha1api20201201 | -| TerminateNotificationProfile_Status | | v1alpha1api20201201 | -| UefiSettings | | v1alpha1api20201201 | -| UefiSettings_Status | | v1alpha1api20201201 | -| UpgradePolicy | | v1alpha1api20201201 | -| UpgradePolicyMode | | v1alpha1api20201201 | -| UpgradePolicyStatusMode | | v1alpha1api20201201 | -| UpgradePolicy_Status | | v1alpha1api20201201 | -| VaultCertificate | | v1alpha1api20201201 | -| VaultCertificate_Status | | v1alpha1api20201201 | -| VaultSecretGroup | | v1alpha1api20201201 | -| VaultSecretGroup_Status | | v1alpha1api20201201 | -| VirtualHardDisk | | v1alpha1api20201201 | -| VirtualHardDisk_Status | | v1alpha1api20201201 | -| VirtualMachine | | v1alpha1api20201201 | -| VirtualMachineAgentInstanceView_Status | | v1alpha1api20201201 | -| VirtualMachineExtensionHandlerInstanceView_Status | | v1alpha1api20201201 | -| VirtualMachineExtensionInstanceView_Status | | v1alpha1api20201201 | -| VirtualMachineExtensionProperties_Status | | v1alpha1api20201201 | -| VirtualMachineExtension_Status | | v1alpha1api20201201 | -| VirtualMachineHealthStatus_Status | | v1alpha1api20201201 | -| VirtualMachineIdentity | | v1alpha1api20201201 | -| VirtualMachineIdentityStatusType | | v1alpha1api20201201 | -| VirtualMachineIdentityType | | v1alpha1api20201201 | -| VirtualMachineIdentity_Status | | v1alpha1api20201201 | -| VirtualMachineIdentity_Status_UserAssignedIdentities | | v1alpha1api20201201 | -| VirtualMachineInstanceViewStatusHyperVGeneration | | v1alpha1api20201201 | -| VirtualMachineInstanceView_Status | | v1alpha1api20201201 | -| VirtualMachinePatchStatus_Status | | v1alpha1api20201201 | -| VirtualMachineProperties_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSet | | v1alpha1api20201201 | -| VirtualMachineScaleSetDataDisk | | v1alpha1api20201201 | -| VirtualMachineScaleSetDataDiskCaching | | v1alpha1api20201201 | -| VirtualMachineScaleSetDataDiskCreateOption | | v1alpha1api20201201 | -| VirtualMachineScaleSetDataDisk_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetExtensionProfile_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetExtensionProperties_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetExtension_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetIPConfigurationPropertiesStatusPrivateIPAddressVersion | | v1alpha1api20201201 | -| VirtualMachineScaleSetIPConfigurationProperties_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetIPConfiguration_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetIdentity | | v1alpha1api20201201 | -| VirtualMachineScaleSetIdentityStatusType | | v1alpha1api20201201 | -| VirtualMachineScaleSetIdentityType | | v1alpha1api20201201 | -| VirtualMachineScaleSetIdentity_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetIdentity_Status_UserAssignedIdentities | | v1alpha1api20201201 | -| VirtualMachineScaleSetIpTag | | v1alpha1api20201201 | -| VirtualMachineScaleSetIpTag_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetManagedDiskParameters | | v1alpha1api20201201 | -| VirtualMachineScaleSetManagedDiskParametersStorageAccountType | | v1alpha1api20201201 | -| VirtualMachineScaleSetManagedDiskParameters_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetNetworkConfigurationDnsSettings | | v1alpha1api20201201 | -| VirtualMachineScaleSetNetworkConfigurationDnsSettings_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetNetworkConfigurationProperties_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetNetworkConfiguration_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetNetworkProfile_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetOSDisk | | v1alpha1api20201201 | -| VirtualMachineScaleSetOSDiskCaching | | v1alpha1api20201201 | -| VirtualMachineScaleSetOSDiskCreateOption | | v1alpha1api20201201 | -| VirtualMachineScaleSetOSDiskOsType | | v1alpha1api20201201 | -| VirtualMachineScaleSetOSDiskStatusOsType | | v1alpha1api20201201 | -| VirtualMachineScaleSetOSDisk_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetOSProfile | | v1alpha1api20201201 | -| VirtualMachineScaleSetOSProfile_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetProperties_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings | | v1alpha1api20201201 | -| VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetPublicIPAddressConfigurationProperties | | v1alpha1api20201201 | -| VirtualMachineScaleSetPublicIPAddressConfigurationPropertiesPublicIPAddressVersion | | v1alpha1api20201201 | -| VirtualMachineScaleSetPublicIPAddressConfigurationPropertiesStatusPublicIPAddressVersion | | v1alpha1api20201201 | -| VirtualMachineScaleSetPublicIPAddressConfigurationProperties_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetPublicIPAddressConfiguration_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetStorageProfile | | v1alpha1api20201201 | -| VirtualMachineScaleSetStorageProfile_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetVMProfile_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSet_Status | | v1alpha1api20201201 | -| VirtualMachineScaleSetsSpecAPIVersion | | v1alpha1api20201201 | -| VirtualMachineScaleSetsSpecPropertiesOrchestrationMode | | v1alpha1api20201201 | -| VirtualMachineScaleSetsSpecPropertiesVirtualMachineProfileEvictionPolicy | | v1alpha1api20201201 | -| VirtualMachineScaleSetsSpecPropertiesVirtualMachineProfileNetworkProfileNetworkInterfaceConfigurationsPropertiesIpConfigurationsPropertiesPrivateIPAddressVersion | | v1alpha1api20201201 | -| VirtualMachineScaleSetsSpecPropertiesVirtualMachineProfilePriority | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_ExtensionProfile | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_ExtensionProfile_Extensions | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations_Properties | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations_Properties_IpConfigurations | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations_Properties_IpConfigurations_Properties | | v1alpha1api20201201 | -| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations_Properties_IpConfigurations_Properties_PublicIPAddressConfiguration | | v1alpha1api20201201 | -| VirtualMachine_Status | | v1alpha1api20201201 | -| VirtualMachinesSpecAPIVersion | | v1alpha1api20201201 | -| VirtualMachinesSpecPropertiesEvictionPolicy | | v1alpha1api20201201 | -| VirtualMachinesSpecPropertiesPriority | | v1alpha1api20201201 | -| VirtualMachines_Spec | | v1alpha1api20201201 | -| VirtualMachines_Spec_Properties | | v1alpha1api20201201 | -| VirtualMachines_Spec_Properties_NetworkProfile | | v1alpha1api20201201 | -| VirtualMachines_Spec_Properties_NetworkProfile_NetworkInterfaces | | v1alpha1api20201201 | -| WinRMConfiguration | | v1alpha1api20201201 | -| WinRMConfiguration_Status | | v1alpha1api20201201 | -| WinRMListener | | v1alpha1api20201201 | -| WinRMListenerProtocol | | v1alpha1api20201201 | -| WinRMListenerStatusProtocol | | v1alpha1api20201201 | -| WinRMListener_Status | | v1alpha1api20201201 | -| WindowsConfiguration | | v1alpha1api20201201 | -| WindowsConfiguration_Status | | v1alpha1api20201201 | +| Types defined in package "compute" | v1alpha1api20200930 | v1alpha1api20201201 | v1alpha1api20210701 | +|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|---------------------|---------------------| +| AdditionalCapabilities | | v1alpha1api20201201 | | +| AdditionalCapabilities_Status | | v1alpha1api20201201 | | +| AdditionalUnattendContent | | v1alpha1api20201201 | | +| AdditionalUnattendContentComponentName | | v1alpha1api20201201 | | +| AdditionalUnattendContentPassName | | v1alpha1api20201201 | | +| AdditionalUnattendContentSettingName | | v1alpha1api20201201 | | +| AdditionalUnattendContentStatusComponentName | | v1alpha1api20201201 | | +| AdditionalUnattendContentStatusPassName | | v1alpha1api20201201 | | +| AdditionalUnattendContentStatusSettingName | | v1alpha1api20201201 | | +| AdditionalUnattendContent_Status | | v1alpha1api20201201 | | +| ApiEntityReference | | v1alpha1api20201201 | | +| ApiEntityReference_Status | | v1alpha1api20201201 | | +| ApiErrorBase_Status | | v1alpha1api20201201 | | +| ApiError_Status | | v1alpha1api20201201 | | +| AutomaticOSUpgradePolicy | | v1alpha1api20201201 | | +| AutomaticOSUpgradePolicy_Status | | v1alpha1api20201201 | | +| AutomaticRepairsPolicy | | v1alpha1api20201201 | | +| AutomaticRepairsPolicy_Status | | v1alpha1api20201201 | | +| AvailablePatchSummaryStatusStatus | | v1alpha1api20201201 | | +| AvailablePatchSummary_Status | | v1alpha1api20201201 | | +| BillingProfile | | v1alpha1api20201201 | | +| BillingProfile_Status | | v1alpha1api20201201 | | +| BootDiagnostics | | v1alpha1api20201201 | | +| BootDiagnosticsInstanceView_Status | | v1alpha1api20201201 | | +| BootDiagnostics_Status | | v1alpha1api20201201 | | +| Caching_Status | | v1alpha1api20201201 | | +| CreateOption_Status | | v1alpha1api20201201 | | +| CreationData | v1alpha1api20200930 | | | +| CreationDataCreateOption | v1alpha1api20200930 | | | +| CreationDataStatusCreateOption | v1alpha1api20200930 | | | +| CreationData_Status | v1alpha1api20200930 | | | +| DataDisk | | v1alpha1api20201201 | | +| DataDiskCaching | | v1alpha1api20201201 | | +| DataDiskCreateOption | | v1alpha1api20201201 | | +| DataDiskDetachOption | | v1alpha1api20201201 | | +| DataDisk_Status | | v1alpha1api20201201 | | +| DetachOption_Status | | v1alpha1api20201201 | | +| DiagnosticsProfile | | v1alpha1api20201201 | | +| DiagnosticsProfile_Status | | v1alpha1api20201201 | | +| DiffDiskOption_Status | | v1alpha1api20201201 | | +| DiffDiskPlacement_Status | | v1alpha1api20201201 | | +| DiffDiskSettings | | v1alpha1api20201201 | | +| DiffDiskSettingsOption | | v1alpha1api20201201 | | +| DiffDiskSettingsPlacement | | v1alpha1api20201201 | | +| DiffDiskSettings_Status | | v1alpha1api20201201 | | +| Disk | v1alpha1api20200930 | | | +| DiskEncryptionSetParameters | | v1alpha1api20201201 | v1alpha1api20210701 | +| DiskEncryptionSettings | | v1alpha1api20201201 | | +| DiskEncryptionSettings_Status | | v1alpha1api20201201 | | +| DiskInstanceView_Status | | v1alpha1api20201201 | | +| DiskProperties | v1alpha1api20200930 | | | +| DiskPropertiesHyperVGeneration | v1alpha1api20200930 | | | +| DiskPropertiesNetworkAccessPolicy | v1alpha1api20200930 | | | +| DiskPropertiesOsType | v1alpha1api20200930 | | | +| DiskPropertiesStatusHyperVGeneration | v1alpha1api20200930 | | | +| DiskPropertiesStatusOsType | v1alpha1api20200930 | | | +| DiskProperties_Status | v1alpha1api20200930 | | | +| DiskSku | v1alpha1api20200930 | | | +| DiskSkuName | v1alpha1api20200930 | | | +| DiskSkuStatusName | v1alpha1api20200930 | | | +| DiskSku_Status | v1alpha1api20200930 | | | +| DiskState_Status | v1alpha1api20200930 | | | +| Disk_Status | v1alpha1api20200930 | | | +| DisksSpecAPIVersion | v1alpha1api20200930 | | | +| Disks_Spec | v1alpha1api20200930 | | | +| Encryption | v1alpha1api20200930 | | | +| EncryptionSettingsCollection | v1alpha1api20200930 | | | +| EncryptionSettingsCollection_Status | v1alpha1api20200930 | | | +| EncryptionSettingsElement | v1alpha1api20200930 | | | +| EncryptionSettingsElement_Status | v1alpha1api20200930 | | | +| EncryptionType | v1alpha1api20200930 | | | +| EncryptionType_Status | v1alpha1api20200930 | | | +| Encryption_Status | v1alpha1api20200930 | | | +| EvictionPolicy_Status | | v1alpha1api20201201 | | +| ExtendedLocation | v1alpha1api20200930 | v1alpha1api20201201 | v1alpha1api20210701 | +| ExtendedLocationType | v1alpha1api20200930 | v1alpha1api20201201 | v1alpha1api20210701 | +| ExtendedLocationType_Status | v1alpha1api20200930 | v1alpha1api20201201 | v1alpha1api20210701 | +| ExtendedLocation_Status | v1alpha1api20200930 | v1alpha1api20201201 | v1alpha1api20210701 | +| GenericExtension | | v1alpha1api20201201 | | +| HardwareProfile | | v1alpha1api20201201 | | +| HardwareProfileStatusVmSize | | v1alpha1api20201201 | | +| HardwareProfileVmSize | | v1alpha1api20201201 | | +| HardwareProfile_Status | | v1alpha1api20201201 | | +| HyperVGenerationType_Status | | | v1alpha1api20210701 | +| Image | | | v1alpha1api20210701 | +| ImageDataDisk | | | v1alpha1api20210701 | +| ImageDataDiskCaching | | | v1alpha1api20210701 | +| ImageDataDiskStatusCaching | | | v1alpha1api20210701 | +| ImageDataDiskStorageAccountType | | | v1alpha1api20210701 | +| ImageDataDisk_Status | | | v1alpha1api20210701 | +| ImageDiskReference | v1alpha1api20200930 | | | +| ImageDiskReference_Status | v1alpha1api20200930 | | | +| ImageOSDisk | | | v1alpha1api20210701 | +| ImageOSDiskCaching | | | v1alpha1api20210701 | +| ImageOSDiskOsState | | | v1alpha1api20210701 | +| ImageOSDiskOsType | | | v1alpha1api20210701 | +| ImageOSDiskStatusCaching | | | v1alpha1api20210701 | +| ImageOSDiskStatusOsState | | | v1alpha1api20210701 | +| ImageOSDiskStatusOsType | | | v1alpha1api20210701 | +| ImageOSDiskStorageAccountType | | | v1alpha1api20210701 | +| ImageOSDisk_Status | | | v1alpha1api20210701 | +| ImageProperties | | | v1alpha1api20210701 | +| ImagePropertiesHyperVGeneration | | | v1alpha1api20210701 | +| ImageProperties_Status | | | v1alpha1api20210701 | +| ImageReference | | v1alpha1api20201201 | | +| ImageReference_Status | | v1alpha1api20201201 | | +| ImageStorageProfile | | | v1alpha1api20210701 | +| ImageStorageProfile_Status | | | v1alpha1api20210701 | +| Image_Status | | | v1alpha1api20210701 | +| ImagesSpecAPIVersion | | | v1alpha1api20210701 | +| Images_Spec | | | v1alpha1api20210701 | +| InnerError_Status | | v1alpha1api20201201 | | +| InstanceViewStatusStatusLevel | | v1alpha1api20201201 | | +| InstanceViewStatus_Status | | v1alpha1api20201201 | | +| KeyVaultAndKeyReference | v1alpha1api20200930 | | | +| KeyVaultAndKeyReference_Status | v1alpha1api20200930 | | | +| KeyVaultAndSecretReference | v1alpha1api20200930 | | | +| KeyVaultAndSecretReference_Status | v1alpha1api20200930 | | | +| KeyVaultKeyReference | | v1alpha1api20201201 | | +| KeyVaultKeyReference_Status | | v1alpha1api20201201 | | +| KeyVaultSecretReference | | v1alpha1api20201201 | | +| KeyVaultSecretReference_Status | | v1alpha1api20201201 | | +| LastPatchInstallationSummaryStatusStatus | | v1alpha1api20201201 | | +| LastPatchInstallationSummary_Status | | v1alpha1api20201201 | | +| LinuxConfiguration | | v1alpha1api20201201 | | +| LinuxConfiguration_Status | | v1alpha1api20201201 | | +| LinuxPatchSettings | | v1alpha1api20201201 | | +| LinuxPatchSettingsPatchMode | | v1alpha1api20201201 | | +| LinuxPatchSettingsStatusPatchMode | | v1alpha1api20201201 | | +| LinuxPatchSettings_Status | | v1alpha1api20201201 | | +| MaintenanceRedeployStatusStatusLastOperationResultCode | | v1alpha1api20201201 | | +| MaintenanceRedeployStatus_Status | | v1alpha1api20201201 | | +| ManagedDiskParameters | | v1alpha1api20201201 | | +| ManagedDiskParametersStorageAccountType | | v1alpha1api20201201 | | +| ManagedDiskParameters_Status | | v1alpha1api20201201 | | +| NetworkAccessPolicy_Status | v1alpha1api20200930 | | | +| NetworkInterfaceReferenceProperties | | v1alpha1api20201201 | | +| NetworkInterfaceReferenceProperties_Status | | v1alpha1api20201201 | | +| NetworkInterfaceReference_Status | | v1alpha1api20201201 | | +| NetworkProfile_Status | | v1alpha1api20201201 | | +| OSDisk | | v1alpha1api20201201 | | +| OSDiskCaching | | v1alpha1api20201201 | | +| OSDiskCreateOption | | v1alpha1api20201201 | | +| OSDiskOsType | | v1alpha1api20201201 | | +| OSDiskStatusOsType | | v1alpha1api20201201 | | +| OSDisk_Status | | v1alpha1api20201201 | | +| OSProfile | | v1alpha1api20201201 | | +| OSProfile_Status | | v1alpha1api20201201 | | +| OrchestrationMode_Status | | v1alpha1api20201201 | | +| PatchSettings | | v1alpha1api20201201 | | +| PatchSettingsPatchMode | | v1alpha1api20201201 | | +| PatchSettingsStatusPatchMode | | v1alpha1api20201201 | | +| PatchSettings_Status | | v1alpha1api20201201 | | +| Plan | | v1alpha1api20201201 | | +| Plan_Status | | v1alpha1api20201201 | | +| Priority_Status | | v1alpha1api20201201 | | +| PurchasePlan | v1alpha1api20200930 | | | +| PurchasePlan_Status | v1alpha1api20200930 | | | +| RollingUpgradePolicy | | v1alpha1api20201201 | | +| RollingUpgradePolicy_Status | | v1alpha1api20201201 | | +| ScaleInPolicy | | v1alpha1api20201201 | | +| ScaleInPolicyRules | | v1alpha1api20201201 | | +| ScaleInPolicyStatusRules | | v1alpha1api20201201 | | +| ScaleInPolicy_Status | | v1alpha1api20201201 | | +| ScheduledEventsProfile | | v1alpha1api20201201 | | +| ScheduledEventsProfile_Status | | v1alpha1api20201201 | | +| SecurityProfile | | v1alpha1api20201201 | | +| SecurityProfileSecurityType | | v1alpha1api20201201 | | +| SecurityProfileStatusSecurityType | | v1alpha1api20201201 | | +| SecurityProfile_Status | | v1alpha1api20201201 | | +| ShareInfoElement_Status | v1alpha1api20200930 | | | +| Sku | | v1alpha1api20201201 | | +| Sku_Status | | v1alpha1api20201201 | | +| Snapshot | v1alpha1api20200930 | | | +| SnapshotProperties | v1alpha1api20200930 | | | +| SnapshotPropertiesDiskState | v1alpha1api20200930 | | | +| SnapshotPropertiesHyperVGeneration | v1alpha1api20200930 | | | +| SnapshotPropertiesNetworkAccessPolicy | v1alpha1api20200930 | | | +| SnapshotPropertiesOsType | v1alpha1api20200930 | | | +| SnapshotPropertiesStatusHyperVGeneration | v1alpha1api20200930 | | | +| SnapshotPropertiesStatusOsType | v1alpha1api20200930 | | | +| SnapshotProperties_Status | v1alpha1api20200930 | | | +| SnapshotSku | v1alpha1api20200930 | | | +| SnapshotSkuName | v1alpha1api20200930 | | | +| SnapshotSkuStatusName | v1alpha1api20200930 | | | +| SnapshotSku_Status | v1alpha1api20200930 | | | +| Snapshot_Status | v1alpha1api20200930 | | | +| SnapshotsSpecAPIVersion | v1alpha1api20200930 | | | +| Snapshots_Spec | v1alpha1api20200930 | | | +| SourceVault | v1alpha1api20200930 | | | +| SourceVault_Status | v1alpha1api20200930 | | | +| SshConfiguration | | v1alpha1api20201201 | | +| SshConfiguration_Status | | v1alpha1api20201201 | | +| SshPublicKey | | v1alpha1api20201201 | | +| SshPublicKey_Status | | v1alpha1api20201201 | | +| StorageAccountType_Status | | v1alpha1api20201201 | v1alpha1api20210701 | +| StorageProfile | | v1alpha1api20201201 | | +| StorageProfile_Status | | v1alpha1api20201201 | | +| SubResource | | v1alpha1api20201201 | v1alpha1api20210701 | +| SubResource_Status | | v1alpha1api20201201 | v1alpha1api20210701 | +| TerminateNotificationProfile | | v1alpha1api20201201 | | +| TerminateNotificationProfile_Status | | v1alpha1api20201201 | | +| UefiSettings | | v1alpha1api20201201 | | +| UefiSettings_Status | | v1alpha1api20201201 | | +| UpgradePolicy | | v1alpha1api20201201 | | +| UpgradePolicyMode | | v1alpha1api20201201 | | +| UpgradePolicyStatusMode | | v1alpha1api20201201 | | +| UpgradePolicy_Status | | v1alpha1api20201201 | | +| VaultCertificate | | v1alpha1api20201201 | | +| VaultCertificate_Status | | v1alpha1api20201201 | | +| VaultSecretGroup | | v1alpha1api20201201 | | +| VaultSecretGroup_Status | | v1alpha1api20201201 | | +| VirtualHardDisk | | v1alpha1api20201201 | | +| VirtualHardDisk_Status | | v1alpha1api20201201 | | +| VirtualMachine | | v1alpha1api20201201 | | +| VirtualMachineAgentInstanceView_Status | | v1alpha1api20201201 | | +| VirtualMachineExtensionHandlerInstanceView_Status | | v1alpha1api20201201 | | +| VirtualMachineExtensionInstanceView_Status | | v1alpha1api20201201 | | +| VirtualMachineExtensionProperties_Status | | v1alpha1api20201201 | | +| VirtualMachineExtension_Status | | v1alpha1api20201201 | | +| VirtualMachineHealthStatus_Status | | v1alpha1api20201201 | | +| VirtualMachineIdentity | | v1alpha1api20201201 | | +| VirtualMachineIdentityStatusType | | v1alpha1api20201201 | | +| VirtualMachineIdentityType | | v1alpha1api20201201 | | +| VirtualMachineIdentity_Status | | v1alpha1api20201201 | | +| VirtualMachineIdentity_Status_UserAssignedIdentities | | v1alpha1api20201201 | | +| VirtualMachineInstanceViewStatusHyperVGeneration | | v1alpha1api20201201 | | +| VirtualMachineInstanceView_Status | | v1alpha1api20201201 | | +| VirtualMachinePatchStatus_Status | | v1alpha1api20201201 | | +| VirtualMachineProperties_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSet | | v1alpha1api20201201 | | +| VirtualMachineScaleSetDataDisk | | v1alpha1api20201201 | | +| VirtualMachineScaleSetDataDiskCaching | | v1alpha1api20201201 | | +| VirtualMachineScaleSetDataDiskCreateOption | | v1alpha1api20201201 | | +| VirtualMachineScaleSetDataDisk_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetExtensionProfile_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetExtensionProperties_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetExtension_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIPConfigurationPropertiesStatusPrivateIPAddressVersion | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIPConfigurationProperties_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIPConfiguration_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIdentity | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIdentityStatusType | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIdentityType | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIdentity_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIdentity_Status_UserAssignedIdentities | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIpTag | | v1alpha1api20201201 | | +| VirtualMachineScaleSetIpTag_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetManagedDiskParameters | | v1alpha1api20201201 | | +| VirtualMachineScaleSetManagedDiskParametersStorageAccountType | | v1alpha1api20201201 | | +| VirtualMachineScaleSetManagedDiskParameters_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetNetworkConfigurationDnsSettings | | v1alpha1api20201201 | | +| VirtualMachineScaleSetNetworkConfigurationDnsSettings_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetNetworkConfigurationProperties_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetNetworkConfiguration_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetNetworkProfile_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetOSDisk | | v1alpha1api20201201 | | +| VirtualMachineScaleSetOSDiskCaching | | v1alpha1api20201201 | | +| VirtualMachineScaleSetOSDiskCreateOption | | v1alpha1api20201201 | | +| VirtualMachineScaleSetOSDiskOsType | | v1alpha1api20201201 | | +| VirtualMachineScaleSetOSDiskStatusOsType | | v1alpha1api20201201 | | +| VirtualMachineScaleSetOSDisk_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetOSProfile | | v1alpha1api20201201 | | +| VirtualMachineScaleSetOSProfile_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetProperties_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings | | v1alpha1api20201201 | | +| VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetPublicIPAddressConfigurationProperties | | v1alpha1api20201201 | | +| VirtualMachineScaleSetPublicIPAddressConfigurationPropertiesPublicIPAddressVersion | | v1alpha1api20201201 | | +| VirtualMachineScaleSetPublicIPAddressConfigurationPropertiesStatusPublicIPAddressVersion | | v1alpha1api20201201 | | +| VirtualMachineScaleSetPublicIPAddressConfigurationProperties_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetPublicIPAddressConfiguration_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetStorageProfile | | v1alpha1api20201201 | | +| VirtualMachineScaleSetStorageProfile_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetVMProfile_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSet_Status | | v1alpha1api20201201 | | +| VirtualMachineScaleSetsSpecAPIVersion | | v1alpha1api20201201 | | +| VirtualMachineScaleSetsSpecPropertiesOrchestrationMode | | v1alpha1api20201201 | | +| VirtualMachineScaleSetsSpecPropertiesVirtualMachineProfileEvictionPolicy | | v1alpha1api20201201 | | +| VirtualMachineScaleSetsSpecPropertiesVirtualMachineProfileNetworkProfileNetworkInterfaceConfigurationsPropertiesIpConfigurationsPropertiesPrivateIPAddressVersion | | v1alpha1api20201201 | | +| VirtualMachineScaleSetsSpecPropertiesVirtualMachineProfilePriority | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_ExtensionProfile | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_ExtensionProfile_Extensions | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations_Properties | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations_Properties_IpConfigurations | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations_Properties_IpConfigurations_Properties | | v1alpha1api20201201 | | +| VirtualMachineScaleSets_Spec_Properties_VirtualMachineProfile_NetworkProfile_NetworkInterfaceConfigurations_Properties_IpConfigurations_Properties_PublicIPAddressConfiguration | | v1alpha1api20201201 | | +| VirtualMachine_Status | | v1alpha1api20201201 | | +| VirtualMachinesSpecAPIVersion | | v1alpha1api20201201 | | +| VirtualMachinesSpecPropertiesEvictionPolicy | | v1alpha1api20201201 | | +| VirtualMachinesSpecPropertiesPriority | | v1alpha1api20201201 | | +| VirtualMachines_Spec | | v1alpha1api20201201 | | +| VirtualMachines_Spec_Properties | | v1alpha1api20201201 | | +| VirtualMachines_Spec_Properties_NetworkProfile | | v1alpha1api20201201 | | +| VirtualMachines_Spec_Properties_NetworkProfile_NetworkInterfaces | | v1alpha1api20201201 | | +| WinRMConfiguration | | v1alpha1api20201201 | | +| WinRMConfiguration_Status | | v1alpha1api20201201 | | +| WinRMListener | | v1alpha1api20201201 | | +| WinRMListenerProtocol | | v1alpha1api20201201 | | +| WinRMListenerStatusProtocol | | v1alpha1api20201201 | | +| WinRMListener_Status | | v1alpha1api20201201 | | +| WindowsConfiguration | | v1alpha1api20201201 | | +| WindowsConfiguration_Status | | v1alpha1api20201201 | | diff --git a/v2/api/resources.md b/v2/api/resources.md index 6ed13d954dd..82f5314fb84 100644 --- a/v2/api/resources.md +++ b/v2/api/resources.md @@ -46,6 +46,7 @@ Use CRD version `v1alpha1api20210301` ### ARM version 2020-09-30 - Disk ([sample](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/compute/v1alpha1api20200930_disk.yaml)) +- Snapshot ([sample](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml)) Use CRD version `v1alpha1api20200930` @@ -57,6 +58,13 @@ Use CRD version `v1alpha1api20200930` Use CRD version `v1alpha1api20201201` + +### ARM version 2021-07-01 + +- Image ([sample](https://github.com/Azure/azure-service-operator/tree/main/v2/config/samples/compute/v1alpha1api20210701_image.yaml)) + +Use CRD version `v1alpha1api20210701` + ## containerregistry diff --git a/v2/internal/controllers/controller_resources_gen.go b/v2/internal/controllers/controller_resources_gen.go index 5fec1a43b90..31491f7fbf8 100644 --- a/v2/internal/controllers/controller_resources_gen.go +++ b/v2/internal/controllers/controller_resources_gen.go @@ -20,6 +20,8 @@ import ( computev1alpha1api20200930storage "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20200930storage" computev1alpha1api20201201 "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20201201" computev1alpha1api20201201storage "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20201201storage" + computev1alpha1api20210701 "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701" + computev1alpha1api20210701storage "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701storage" containerregistrycustomizations "github.com/Azure/azure-service-operator/v2/api/containerregistry/customizations" containerregistryv1alpha1api20210901 "github.com/Azure/azure-service-operator/v2/api/containerregistry/v1alpha1api20210901" containerregistryv1alpha1api20210901storage "github.com/Azure/azure-service-operator/v2/api/containerregistry/v1alpha1api20210901storage" @@ -121,6 +123,16 @@ func getKnownStorageTypes() []registration.StorageType { Indexes: []registration.Index{}, Watches: []registration.Watch{}, }) + result = append(result, registration.StorageType{ + Obj: new(computev1alpha1api20200930storage.Snapshot), + Indexes: []registration.Index{}, + Watches: []registration.Watch{ + { + Src: &source.Kind{Type: &v1.Secret{}}, + MakeEventHandler: watchSecretsFactory([]string{}, &computev1alpha1api20200930storage.SnapshotList{}), + }, + }, + }) result = append(result, registration.StorageType{ Obj: new(computev1alpha1api20201201storage.VirtualMachine), Indexes: []registration.Index{ @@ -151,6 +163,16 @@ func getKnownStorageTypes() []registration.StorageType { }, }, }) + result = append(result, registration.StorageType{ + Obj: new(computev1alpha1api20210701storage.Image), + Indexes: []registration.Index{}, + Watches: []registration.Watch{ + { + Src: &source.Kind{Type: &v1.Secret{}}, + MakeEventHandler: watchSecretsFactory([]string{}, &computev1alpha1api20210701storage.ImageList{}), + }, + }, + }) result = append(result, registration.StorageType{ Obj: new(containerregistryv1alpha1api20210901storage.Registry), Indexes: []registration.Index{}, @@ -459,11 +481,15 @@ func getKnownTypes() []client.Object { result = append(result, new(cachev1alpha1api20210301storage.RedisEnterprise)) result = append(result, new(cachev1alpha1api20210301storage.RedisEnterpriseDatabase)) result = append(result, new(computev1alpha1api20200930.Disk)) + result = append(result, new(computev1alpha1api20200930.Snapshot)) result = append(result, new(computev1alpha1api20200930storage.Disk)) + result = append(result, new(computev1alpha1api20200930storage.Snapshot)) result = append(result, new(computev1alpha1api20201201.VirtualMachine)) result = append(result, new(computev1alpha1api20201201.VirtualMachineScaleSet)) result = append(result, new(computev1alpha1api20201201storage.VirtualMachine)) result = append(result, new(computev1alpha1api20201201storage.VirtualMachineScaleSet)) + result = append(result, new(computev1alpha1api20210701.Image)) + result = append(result, new(computev1alpha1api20210701storage.Image)) result = append(result, new(containerregistryv1alpha1api20210901.Registry)) result = append(result, new(containerregistryv1alpha1api20210901storage.Registry)) result = append(result, new(containerservicev1alpha1api20210501.ManagedCluster)) @@ -589,6 +615,8 @@ func createScheme() *runtime.Scheme { _ = computev1alpha1api20200930storage.AddToScheme(scheme) _ = computev1alpha1api20201201.AddToScheme(scheme) _ = computev1alpha1api20201201storage.AddToScheme(scheme) + _ = computev1alpha1api20210701.AddToScheme(scheme) + _ = computev1alpha1api20210701storage.AddToScheme(scheme) _ = containerregistryv1alpha1api20210901.AddToScheme(scheme) _ = containerregistryv1alpha1api20210901storage.AddToScheme(scheme) _ = containerservicev1alpha1api20210501.AddToScheme(scheme) From b89f2935e26a0a5d81cde0a11308adeea364f90d Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Thu, 10 Feb 2022 11:53:50 +1300 Subject: [PATCH 03/17] Improve NotConfiguredError message --- v2/tools/generator/internal/config/not_configured_error.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v2/tools/generator/internal/config/not_configured_error.go b/v2/tools/generator/internal/config/not_configured_error.go index 42f2354c774..1420e2c57dd 100644 --- a/v2/tools/generator/internal/config/not_configured_error.go +++ b/v2/tools/generator/internal/config/not_configured_error.go @@ -50,8 +50,9 @@ func (e NotConfiguredError) Error() string { sort.Strings(e.options) return fmt.Sprintf( - "%s (available %s are %s", + "%s (%d available %s are %s)", e.message, + len(e.options), e.optionKind, strings.Join(e.options, "; ")) } From 63ee3775fcde3bed86f350b8eca7a8098e99da76 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Thu, 10 Feb 2022 15:42:27 +1300 Subject: [PATCH 04/17] Generate deepcopy files --- .../zz_generated.deepcopy.go | 619 ++++++++++ .../zz_generated.deepcopy.go | 364 ++++++ .../zz_generated.deepcopy.go | 1086 +++++++++++++++++ .../zz_generated.deepcopy.go | 693 +++++++++++ 4 files changed, 2762 insertions(+) create mode 100644 v2/api/compute/v1alpha1api20210701/zz_generated.deepcopy.go create mode 100644 v2/api/compute/v1alpha1api20210701storage/zz_generated.deepcopy.go diff --git a/v2/api/compute/v1alpha1api20200930/zz_generated.deepcopy.go b/v2/api/compute/v1alpha1api20200930/zz_generated.deepcopy.go index 7e0cb5d1eb3..f4913b0361e 100644 --- a/v2/api/compute/v1alpha1api20200930/zz_generated.deepcopy.go +++ b/v2/api/compute/v1alpha1api20200930/zz_generated.deepcopy.go @@ -1736,6 +1736,625 @@ func (in *ShareInfoElement_StatusARM) DeepCopy() *ShareInfoElement_StatusARM { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Snapshot) DeepCopyInto(out *Snapshot) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshot. +func (in *Snapshot) DeepCopy() *Snapshot { + if in == nil { + return nil + } + out := new(Snapshot) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Snapshot) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotList) DeepCopyInto(out *SnapshotList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Snapshot, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotList. +func (in *SnapshotList) DeepCopy() *SnapshotList { + if in == nil { + return nil + } + out := new(SnapshotList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SnapshotList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotPropertiesARM) DeepCopyInto(out *SnapshotPropertiesARM) { + *out = *in + in.CreationData.DeepCopyInto(&out.CreationData) + if in.DiskAccessId != nil { + in, out := &in.DiskAccessId, &out.DiskAccessId + *out = new(string) + **out = **in + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.DiskState != nil { + in, out := &in.DiskState, &out.DiskState + *out = new(SnapshotPropertiesDiskState) + **out = **in + } + if in.Encryption != nil { + in, out := &in.Encryption, &out.Encryption + *out = new(EncryptionARM) + (*in).DeepCopyInto(*out) + } + if in.EncryptionSettingsCollection != nil { + in, out := &in.EncryptionSettingsCollection, &out.EncryptionSettingsCollection + *out = new(EncryptionSettingsCollectionARM) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(SnapshotPropertiesHyperVGeneration) + **out = **in + } + if in.Incremental != nil { + in, out := &in.Incremental, &out.Incremental + *out = new(bool) + **out = **in + } + if in.NetworkAccessPolicy != nil { + in, out := &in.NetworkAccessPolicy, &out.NetworkAccessPolicy + *out = new(SnapshotPropertiesNetworkAccessPolicy) + **out = **in + } + if in.OsType != nil { + in, out := &in.OsType, &out.OsType + *out = new(SnapshotPropertiesOsType) + **out = **in + } + if in.PurchasePlan != nil { + in, out := &in.PurchasePlan, &out.PurchasePlan + *out = new(PurchasePlanARM) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotPropertiesARM. +func (in *SnapshotPropertiesARM) DeepCopy() *SnapshotPropertiesARM { + if in == nil { + return nil + } + out := new(SnapshotPropertiesARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotProperties_StatusARM) DeepCopyInto(out *SnapshotProperties_StatusARM) { + *out = *in + in.CreationData.DeepCopyInto(&out.CreationData) + if in.DiskAccessId != nil { + in, out := &in.DiskAccessId, &out.DiskAccessId + *out = new(string) + **out = **in + } + if in.DiskSizeBytes != nil { + in, out := &in.DiskSizeBytes, &out.DiskSizeBytes + *out = new(int) + **out = **in + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.DiskState != nil { + in, out := &in.DiskState, &out.DiskState + *out = new(DiskState_Status) + **out = **in + } + if in.Encryption != nil { + in, out := &in.Encryption, &out.Encryption + *out = new(Encryption_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.EncryptionSettingsCollection != nil { + in, out := &in.EncryptionSettingsCollection, &out.EncryptionSettingsCollection + *out = new(EncryptionSettingsCollection_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(SnapshotPropertiesStatusHyperVGeneration) + **out = **in + } + if in.Incremental != nil { + in, out := &in.Incremental, &out.Incremental + *out = new(bool) + **out = **in + } + if in.NetworkAccessPolicy != nil { + in, out := &in.NetworkAccessPolicy, &out.NetworkAccessPolicy + *out = new(NetworkAccessPolicy_Status) + **out = **in + } + if in.OsType != nil { + in, out := &in.OsType, &out.OsType + *out = new(SnapshotPropertiesStatusOsType) + **out = **in + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(string) + **out = **in + } + if in.PurchasePlan != nil { + in, out := &in.PurchasePlan, &out.PurchasePlan + *out = new(PurchasePlan_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.TimeCreated != nil { + in, out := &in.TimeCreated, &out.TimeCreated + *out = new(string) + **out = **in + } + if in.UniqueId != nil { + in, out := &in.UniqueId, &out.UniqueId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotProperties_StatusARM. +func (in *SnapshotProperties_StatusARM) DeepCopy() *SnapshotProperties_StatusARM { + if in == nil { + return nil + } + out := new(SnapshotProperties_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotSku) DeepCopyInto(out *SnapshotSku) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(SnapshotSkuName) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSku. +func (in *SnapshotSku) DeepCopy() *SnapshotSku { + if in == nil { + return nil + } + out := new(SnapshotSku) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotSkuARM) DeepCopyInto(out *SnapshotSkuARM) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(SnapshotSkuName) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSkuARM. +func (in *SnapshotSkuARM) DeepCopy() *SnapshotSkuARM { + if in == nil { + return nil + } + out := new(SnapshotSkuARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotSku_Status) DeepCopyInto(out *SnapshotSku_Status) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(SnapshotSkuStatusName) + **out = **in + } + if in.Tier != nil { + in, out := &in.Tier, &out.Tier + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSku_Status. +func (in *SnapshotSku_Status) DeepCopy() *SnapshotSku_Status { + if in == nil { + return nil + } + out := new(SnapshotSku_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotSku_StatusARM) DeepCopyInto(out *SnapshotSku_StatusARM) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(SnapshotSkuStatusName) + **out = **in + } + if in.Tier != nil { + in, out := &in.Tier, &out.Tier + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSku_StatusARM. +func (in *SnapshotSku_StatusARM) DeepCopy() *SnapshotSku_StatusARM { + if in == nil { + return nil + } + out := new(SnapshotSku_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Snapshot_Status) DeepCopyInto(out *Snapshot_Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CreationData != nil { + in, out := &in.CreationData, &out.CreationData + *out = new(CreationData_Status) + (*in).DeepCopyInto(*out) + } + if in.DiskAccessId != nil { + in, out := &in.DiskAccessId, &out.DiskAccessId + *out = new(string) + **out = **in + } + if in.DiskSizeBytes != nil { + in, out := &in.DiskSizeBytes, &out.DiskSizeBytes + *out = new(int) + **out = **in + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.DiskState != nil { + in, out := &in.DiskState, &out.DiskState + *out = new(DiskState_Status) + **out = **in + } + if in.Encryption != nil { + in, out := &in.Encryption, &out.Encryption + *out = new(Encryption_Status) + (*in).DeepCopyInto(*out) + } + if in.EncryptionSettingsCollection != nil { + in, out := &in.EncryptionSettingsCollection, &out.EncryptionSettingsCollection + *out = new(EncryptionSettingsCollection_Status) + (*in).DeepCopyInto(*out) + } + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation_Status) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(SnapshotPropertiesStatusHyperVGeneration) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Incremental != nil { + in, out := &in.Incremental, &out.Incremental + *out = new(bool) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.ManagedBy != nil { + in, out := &in.ManagedBy, &out.ManagedBy + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NetworkAccessPolicy != nil { + in, out := &in.NetworkAccessPolicy, &out.NetworkAccessPolicy + *out = new(NetworkAccessPolicy_Status) + **out = **in + } + if in.OsType != nil { + in, out := &in.OsType, &out.OsType + *out = new(SnapshotPropertiesStatusOsType) + **out = **in + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(string) + **out = **in + } + if in.PurchasePlan != nil { + in, out := &in.PurchasePlan, &out.PurchasePlan + *out = new(PurchasePlan_Status) + (*in).DeepCopyInto(*out) + } + if in.Sku != nil { + in, out := &in.Sku, &out.Sku + *out = new(SnapshotSku_Status) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TimeCreated != nil { + in, out := &in.TimeCreated, &out.TimeCreated + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.UniqueId != nil { + in, out := &in.UniqueId, &out.UniqueId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshot_Status. +func (in *Snapshot_Status) DeepCopy() *Snapshot_Status { + if in == nil { + return nil + } + out := new(Snapshot_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Snapshot_StatusARM) DeepCopyInto(out *Snapshot_StatusARM) { + *out = *in + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.ManagedBy != nil { + in, out := &in.ManagedBy, &out.ManagedBy + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Properties != nil { + in, out := &in.Properties, &out.Properties + *out = new(SnapshotProperties_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.Sku != nil { + in, out := &in.Sku, &out.Sku + *out = new(SnapshotSku_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshot_StatusARM. +func (in *Snapshot_StatusARM) DeepCopy() *Snapshot_StatusARM { + if in == nil { + return nil + } + out := new(Snapshot_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Snapshots_Spec) DeepCopyInto(out *Snapshots_Spec) { + *out = *in + in.CreationData.DeepCopyInto(&out.CreationData) + if in.DiskAccessReference != nil { + in, out := &in.DiskAccessReference, &out.DiskAccessReference + *out = new(genruntime.ResourceReference) + **out = **in + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.DiskState != nil { + in, out := &in.DiskState, &out.DiskState + *out = new(SnapshotPropertiesDiskState) + **out = **in + } + if in.Encryption != nil { + in, out := &in.Encryption, &out.Encryption + *out = new(Encryption) + (*in).DeepCopyInto(*out) + } + if in.EncryptionSettingsCollection != nil { + in, out := &in.EncryptionSettingsCollection, &out.EncryptionSettingsCollection + *out = new(EncryptionSettingsCollection) + (*in).DeepCopyInto(*out) + } + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(SnapshotPropertiesHyperVGeneration) + **out = **in + } + if in.Incremental != nil { + in, out := &in.Incremental, &out.Incremental + *out = new(bool) + **out = **in + } + if in.NetworkAccessPolicy != nil { + in, out := &in.NetworkAccessPolicy, &out.NetworkAccessPolicy + *out = new(SnapshotPropertiesNetworkAccessPolicy) + **out = **in + } + if in.OsType != nil { + in, out := &in.OsType, &out.OsType + *out = new(SnapshotPropertiesOsType) + **out = **in + } + out.Owner = in.Owner + if in.PurchasePlan != nil { + in, out := &in.PurchasePlan, &out.PurchasePlan + *out = new(PurchasePlan) + (*in).DeepCopyInto(*out) + } + if in.Sku != nil { + in, out := &in.Sku, &out.Sku + *out = new(SnapshotSku) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshots_Spec. +func (in *Snapshots_Spec) DeepCopy() *Snapshots_Spec { + if in == nil { + return nil + } + out := new(Snapshots_Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Snapshots_SpecARM) DeepCopyInto(out *Snapshots_SpecARM) { + *out = *in + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocationARM) + (*in).DeepCopyInto(*out) + } + in.Properties.DeepCopyInto(&out.Properties) + if in.Sku != nil { + in, out := &in.Sku, &out.Sku + *out = new(SnapshotSkuARM) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshots_SpecARM. +func (in *Snapshots_SpecARM) DeepCopy() *Snapshots_SpecARM { + if in == nil { + return nil + } + out := new(Snapshots_SpecARM) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SourceVault) DeepCopyInto(out *SourceVault) { *out = *in diff --git a/v2/api/compute/v1alpha1api20200930storage/zz_generated.deepcopy.go b/v2/api/compute/v1alpha1api20200930storage/zz_generated.deepcopy.go index 2f75b2b7a34..aaf1ace2af8 100644 --- a/v2/api/compute/v1alpha1api20200930storage/zz_generated.deepcopy.go +++ b/v2/api/compute/v1alpha1api20200930storage/zz_generated.deepcopy.go @@ -1155,6 +1155,370 @@ func (in *ShareInfoElement_Status) DeepCopy() *ShareInfoElement_Status { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Snapshot) DeepCopyInto(out *Snapshot) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshot. +func (in *Snapshot) DeepCopy() *Snapshot { + if in == nil { + return nil + } + out := new(Snapshot) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Snapshot) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotList) DeepCopyInto(out *SnapshotList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Snapshot, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotList. +func (in *SnapshotList) DeepCopy() *SnapshotList { + if in == nil { + return nil + } + out := new(SnapshotList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SnapshotList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotSku) DeepCopyInto(out *SnapshotSku) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSku. +func (in *SnapshotSku) DeepCopy() *SnapshotSku { + if in == nil { + return nil + } + out := new(SnapshotSku) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SnapshotSku_Status) DeepCopyInto(out *SnapshotSku_Status) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Tier != nil { + in, out := &in.Tier, &out.Tier + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSku_Status. +func (in *SnapshotSku_Status) DeepCopy() *SnapshotSku_Status { + if in == nil { + return nil + } + out := new(SnapshotSku_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Snapshot_Status) DeepCopyInto(out *Snapshot_Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CreationData != nil { + in, out := &in.CreationData, &out.CreationData + *out = new(CreationData_Status) + (*in).DeepCopyInto(*out) + } + if in.DiskAccessId != nil { + in, out := &in.DiskAccessId, &out.DiskAccessId + *out = new(string) + **out = **in + } + if in.DiskSizeBytes != nil { + in, out := &in.DiskSizeBytes, &out.DiskSizeBytes + *out = new(int) + **out = **in + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.DiskState != nil { + in, out := &in.DiskState, &out.DiskState + *out = new(string) + **out = **in + } + if in.Encryption != nil { + in, out := &in.Encryption, &out.Encryption + *out = new(Encryption_Status) + (*in).DeepCopyInto(*out) + } + if in.EncryptionSettingsCollection != nil { + in, out := &in.EncryptionSettingsCollection, &out.EncryptionSettingsCollection + *out = new(EncryptionSettingsCollection_Status) + (*in).DeepCopyInto(*out) + } + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation_Status) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(string) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Incremental != nil { + in, out := &in.Incremental, &out.Incremental + *out = new(bool) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.ManagedBy != nil { + in, out := &in.ManagedBy, &out.ManagedBy + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NetworkAccessPolicy != nil { + in, out := &in.NetworkAccessPolicy, &out.NetworkAccessPolicy + *out = new(string) + **out = **in + } + if in.OsType != nil { + in, out := &in.OsType, &out.OsType + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(string) + **out = **in + } + if in.PurchasePlan != nil { + in, out := &in.PurchasePlan, &out.PurchasePlan + *out = new(PurchasePlan_Status) + (*in).DeepCopyInto(*out) + } + if in.Sku != nil { + in, out := &in.Sku, &out.Sku + *out = new(SnapshotSku_Status) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.TimeCreated != nil { + in, out := &in.TimeCreated, &out.TimeCreated + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } + if in.UniqueId != nil { + in, out := &in.UniqueId, &out.UniqueId + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshot_Status. +func (in *Snapshot_Status) DeepCopy() *Snapshot_Status { + if in == nil { + return nil + } + out := new(Snapshot_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Snapshots_Spec) DeepCopyInto(out *Snapshots_Spec) { + *out = *in + if in.CreationData != nil { + in, out := &in.CreationData, &out.CreationData + *out = new(CreationData) + (*in).DeepCopyInto(*out) + } + if in.DiskAccessReference != nil { + in, out := &in.DiskAccessReference, &out.DiskAccessReference + *out = new(genruntime.ResourceReference) + **out = **in + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.DiskState != nil { + in, out := &in.DiskState, &out.DiskState + *out = new(string) + **out = **in + } + if in.Encryption != nil { + in, out := &in.Encryption, &out.Encryption + *out = new(Encryption) + (*in).DeepCopyInto(*out) + } + if in.EncryptionSettingsCollection != nil { + in, out := &in.EncryptionSettingsCollection, &out.EncryptionSettingsCollection + *out = new(EncryptionSettingsCollection) + (*in).DeepCopyInto(*out) + } + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(string) + **out = **in + } + if in.Incremental != nil { + in, out := &in.Incremental, &out.Incremental + *out = new(bool) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.NetworkAccessPolicy != nil { + in, out := &in.NetworkAccessPolicy, &out.NetworkAccessPolicy + *out = new(string) + **out = **in + } + if in.OsType != nil { + in, out := &in.OsType, &out.OsType + *out = new(string) + **out = **in + } + out.Owner = in.Owner + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.PurchasePlan != nil { + in, out := &in.PurchasePlan, &out.PurchasePlan + *out = new(PurchasePlan) + (*in).DeepCopyInto(*out) + } + if in.Sku != nil { + in, out := &in.Sku, &out.Sku + *out = new(SnapshotSku) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshots_Spec. +func (in *Snapshots_Spec) DeepCopy() *Snapshots_Spec { + if in == nil { + return nil + } + out := new(Snapshots_Spec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SourceVault) DeepCopyInto(out *SourceVault) { *out = *in diff --git a/v2/api/compute/v1alpha1api20210701/zz_generated.deepcopy.go b/v2/api/compute/v1alpha1api20210701/zz_generated.deepcopy.go new file mode 100644 index 00000000000..82d97bb282a --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701/zz_generated.deepcopy.go @@ -0,0 +1,1086 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1api20210701 + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskEncryptionSetParameters) DeepCopyInto(out *DiskEncryptionSetParameters) { + *out = *in + if in.Reference != nil { + in, out := &in.Reference, &out.Reference + *out = new(genruntime.ResourceReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskEncryptionSetParameters. +func (in *DiskEncryptionSetParameters) DeepCopy() *DiskEncryptionSetParameters { + if in == nil { + return nil + } + out := new(DiskEncryptionSetParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskEncryptionSetParametersARM) DeepCopyInto(out *DiskEncryptionSetParametersARM) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskEncryptionSetParametersARM. +func (in *DiskEncryptionSetParametersARM) DeepCopy() *DiskEncryptionSetParametersARM { + if in == nil { + return nil + } + out := new(DiskEncryptionSetParametersARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtendedLocation) DeepCopyInto(out *ExtendedLocation) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(ExtendedLocationType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtendedLocation. +func (in *ExtendedLocation) DeepCopy() *ExtendedLocation { + if in == nil { + return nil + } + out := new(ExtendedLocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtendedLocationARM) DeepCopyInto(out *ExtendedLocationARM) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(ExtendedLocationType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtendedLocationARM. +func (in *ExtendedLocationARM) DeepCopy() *ExtendedLocationARM { + if in == nil { + return nil + } + out := new(ExtendedLocationARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtendedLocation_Status) DeepCopyInto(out *ExtendedLocation_Status) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(ExtendedLocationType_Status) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtendedLocation_Status. +func (in *ExtendedLocation_Status) DeepCopy() *ExtendedLocation_Status { + if in == nil { + return nil + } + out := new(ExtendedLocation_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtendedLocation_StatusARM) DeepCopyInto(out *ExtendedLocation_StatusARM) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(ExtendedLocationType_Status) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtendedLocation_StatusARM. +func (in *ExtendedLocation_StatusARM) DeepCopy() *ExtendedLocation_StatusARM { + if in == nil { + return nil + } + out := new(ExtendedLocation_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Image) DeepCopyInto(out *Image) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. +func (in *Image) DeepCopy() *Image { + if in == nil { + return nil + } + out := new(Image) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Image) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageDataDisk) DeepCopyInto(out *ImageDataDisk) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(ImageDataDiskCaching) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(DiskEncryptionSetParameters) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(ImageDataDiskStorageAccountType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageDataDisk. +func (in *ImageDataDisk) DeepCopy() *ImageDataDisk { + if in == nil { + return nil + } + out := new(ImageDataDisk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageDataDiskARM) DeepCopyInto(out *ImageDataDiskARM) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(ImageDataDiskCaching) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(DiskEncryptionSetParametersARM) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResourceARM) + (*in).DeepCopyInto(*out) + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResourceARM) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(ImageDataDiskStorageAccountType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageDataDiskARM. +func (in *ImageDataDiskARM) DeepCopy() *ImageDataDiskARM { + if in == nil { + return nil + } + out := new(ImageDataDiskARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageDataDisk_Status) DeepCopyInto(out *ImageDataDisk_Status) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(ImageDataDiskStatusCaching) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(StorageAccountType_Status) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageDataDisk_Status. +func (in *ImageDataDisk_Status) DeepCopy() *ImageDataDisk_Status { + if in == nil { + return nil + } + out := new(ImageDataDisk_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageDataDisk_StatusARM) DeepCopyInto(out *ImageDataDisk_StatusARM) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(ImageDataDiskStatusCaching) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(SubResource_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(StorageAccountType_Status) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageDataDisk_StatusARM. +func (in *ImageDataDisk_StatusARM) DeepCopy() *ImageDataDisk_StatusARM { + if in == nil { + return nil + } + out := new(ImageDataDisk_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageList) DeepCopyInto(out *ImageList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Image, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageList. +func (in *ImageList) DeepCopy() *ImageList { + if in == nil { + return nil + } + out := new(ImageList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ImageList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageOSDisk) DeepCopyInto(out *ImageOSDisk) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(ImageOSDiskCaching) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(DiskEncryptionSetParameters) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(ImageOSDiskStorageAccountType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageOSDisk. +func (in *ImageOSDisk) DeepCopy() *ImageOSDisk { + if in == nil { + return nil + } + out := new(ImageOSDisk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageOSDiskARM) DeepCopyInto(out *ImageOSDiskARM) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(ImageOSDiskCaching) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(DiskEncryptionSetParametersARM) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResourceARM) + (*in).DeepCopyInto(*out) + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResourceARM) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(ImageOSDiskStorageAccountType) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageOSDiskARM. +func (in *ImageOSDiskARM) DeepCopy() *ImageOSDiskARM { + if in == nil { + return nil + } + out := new(ImageOSDiskARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageOSDisk_Status) DeepCopyInto(out *ImageOSDisk_Status) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(ImageOSDiskStatusCaching) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(StorageAccountType_Status) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageOSDisk_Status. +func (in *ImageOSDisk_Status) DeepCopy() *ImageOSDisk_Status { + if in == nil { + return nil + } + out := new(ImageOSDisk_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageOSDisk_StatusARM) DeepCopyInto(out *ImageOSDisk_StatusARM) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(ImageOSDiskStatusCaching) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(SubResource_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(StorageAccountType_Status) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageOSDisk_StatusARM. +func (in *ImageOSDisk_StatusARM) DeepCopy() *ImageOSDisk_StatusARM { + if in == nil { + return nil + } + out := new(ImageOSDisk_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImagePropertiesARM) DeepCopyInto(out *ImagePropertiesARM) { + *out = *in + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(ImagePropertiesHyperVGeneration) + **out = **in + } + if in.SourceVirtualMachine != nil { + in, out := &in.SourceVirtualMachine, &out.SourceVirtualMachine + *out = new(SubResourceARM) + (*in).DeepCopyInto(*out) + } + if in.StorageProfile != nil { + in, out := &in.StorageProfile, &out.StorageProfile + *out = new(ImageStorageProfileARM) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImagePropertiesARM. +func (in *ImagePropertiesARM) DeepCopy() *ImagePropertiesARM { + if in == nil { + return nil + } + out := new(ImagePropertiesARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageProperties_StatusARM) DeepCopyInto(out *ImageProperties_StatusARM) { + *out = *in + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(HyperVGenerationType_Status) + **out = **in + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(string) + **out = **in + } + if in.SourceVirtualMachine != nil { + in, out := &in.SourceVirtualMachine, &out.SourceVirtualMachine + *out = new(SubResource_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.StorageProfile != nil { + in, out := &in.StorageProfile, &out.StorageProfile + *out = new(ImageStorageProfile_StatusARM) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageProperties_StatusARM. +func (in *ImageProperties_StatusARM) DeepCopy() *ImageProperties_StatusARM { + if in == nil { + return nil + } + out := new(ImageProperties_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageStorageProfile) DeepCopyInto(out *ImageStorageProfile) { + *out = *in + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]ImageDataDisk, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OsDisk != nil { + in, out := &in.OsDisk, &out.OsDisk + *out = new(ImageOSDisk) + (*in).DeepCopyInto(*out) + } + if in.ZoneResilient != nil { + in, out := &in.ZoneResilient, &out.ZoneResilient + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageStorageProfile. +func (in *ImageStorageProfile) DeepCopy() *ImageStorageProfile { + if in == nil { + return nil + } + out := new(ImageStorageProfile) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageStorageProfileARM) DeepCopyInto(out *ImageStorageProfileARM) { + *out = *in + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]ImageDataDiskARM, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OsDisk != nil { + in, out := &in.OsDisk, &out.OsDisk + *out = new(ImageOSDiskARM) + (*in).DeepCopyInto(*out) + } + if in.ZoneResilient != nil { + in, out := &in.ZoneResilient, &out.ZoneResilient + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageStorageProfileARM. +func (in *ImageStorageProfileARM) DeepCopy() *ImageStorageProfileARM { + if in == nil { + return nil + } + out := new(ImageStorageProfileARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageStorageProfile_Status) DeepCopyInto(out *ImageStorageProfile_Status) { + *out = *in + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]ImageDataDisk_Status, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OsDisk != nil { + in, out := &in.OsDisk, &out.OsDisk + *out = new(ImageOSDisk_Status) + (*in).DeepCopyInto(*out) + } + if in.ZoneResilient != nil { + in, out := &in.ZoneResilient, &out.ZoneResilient + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageStorageProfile_Status. +func (in *ImageStorageProfile_Status) DeepCopy() *ImageStorageProfile_Status { + if in == nil { + return nil + } + out := new(ImageStorageProfile_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageStorageProfile_StatusARM) DeepCopyInto(out *ImageStorageProfile_StatusARM) { + *out = *in + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]ImageDataDisk_StatusARM, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OsDisk != nil { + in, out := &in.OsDisk, &out.OsDisk + *out = new(ImageOSDisk_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.ZoneResilient != nil { + in, out := &in.ZoneResilient, &out.ZoneResilient + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageStorageProfile_StatusARM. +func (in *ImageStorageProfile_StatusARM) DeepCopy() *ImageStorageProfile_StatusARM { + if in == nil { + return nil + } + out := new(ImageStorageProfile_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Image_Status) DeepCopyInto(out *Image_Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation_Status) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(HyperVGenerationType_Status) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(string) + **out = **in + } + if in.SourceVirtualMachine != nil { + in, out := &in.SourceVirtualMachine, &out.SourceVirtualMachine + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.StorageProfile != nil { + in, out := &in.StorageProfile, &out.StorageProfile + *out = new(ImageStorageProfile_Status) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image_Status. +func (in *Image_Status) DeepCopy() *Image_Status { + if in == nil { + return nil + } + out := new(Image_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Image_StatusARM) DeepCopyInto(out *Image_StatusARM) { + *out = *in + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Properties != nil { + in, out := &in.Properties, &out.Properties + *out = new(ImageProperties_StatusARM) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image_StatusARM. +func (in *Image_StatusARM) DeepCopy() *Image_StatusARM { + if in == nil { + return nil + } + out := new(Image_StatusARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Images_Spec) DeepCopyInto(out *Images_Spec) { + *out = *in + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(ImagePropertiesHyperVGeneration) + **out = **in + } + out.Owner = in.Owner + if in.SourceVirtualMachine != nil { + in, out := &in.SourceVirtualMachine, &out.SourceVirtualMachine + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.StorageProfile != nil { + in, out := &in.StorageProfile, &out.StorageProfile + *out = new(ImageStorageProfile) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Images_Spec. +func (in *Images_Spec) DeepCopy() *Images_Spec { + if in == nil { + return nil + } + out := new(Images_Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Images_SpecARM) DeepCopyInto(out *Images_SpecARM) { + *out = *in + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocationARM) + (*in).DeepCopyInto(*out) + } + in.Properties.DeepCopyInto(&out.Properties) + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Images_SpecARM. +func (in *Images_SpecARM) DeepCopy() *Images_SpecARM { + if in == nil { + return nil + } + out := new(Images_SpecARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubResource) DeepCopyInto(out *SubResource) { + *out = *in + if in.Reference != nil { + in, out := &in.Reference, &out.Reference + *out = new(genruntime.ResourceReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResource. +func (in *SubResource) DeepCopy() *SubResource { + if in == nil { + return nil + } + out := new(SubResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubResourceARM) DeepCopyInto(out *SubResourceARM) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResourceARM. +func (in *SubResourceARM) DeepCopy() *SubResourceARM { + if in == nil { + return nil + } + out := new(SubResourceARM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubResource_Status) DeepCopyInto(out *SubResource_Status) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResource_Status. +func (in *SubResource_Status) DeepCopy() *SubResource_Status { + if in == nil { + return nil + } + out := new(SubResource_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubResource_StatusARM) DeepCopyInto(out *SubResource_StatusARM) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResource_StatusARM. +func (in *SubResource_StatusARM) DeepCopy() *SubResource_StatusARM { + if in == nil { + return nil + } + out := new(SubResource_StatusARM) + in.DeepCopyInto(out) + return out +} diff --git a/v2/api/compute/v1alpha1api20210701storage/zz_generated.deepcopy.go b/v2/api/compute/v1alpha1api20210701storage/zz_generated.deepcopy.go new file mode 100644 index 00000000000..49287e5b695 --- /dev/null +++ b/v2/api/compute/v1alpha1api20210701storage/zz_generated.deepcopy.go @@ -0,0 +1,693 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1api20210701storage + +import ( + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DiskEncryptionSetParameters) DeepCopyInto(out *DiskEncryptionSetParameters) { + *out = *in + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Reference != nil { + in, out := &in.Reference, &out.Reference + *out = new(genruntime.ResourceReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DiskEncryptionSetParameters. +func (in *DiskEncryptionSetParameters) DeepCopy() *DiskEncryptionSetParameters { + if in == nil { + return nil + } + out := new(DiskEncryptionSetParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtendedLocation) DeepCopyInto(out *ExtendedLocation) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtendedLocation. +func (in *ExtendedLocation) DeepCopy() *ExtendedLocation { + if in == nil { + return nil + } + out := new(ExtendedLocation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ExtendedLocation_Status) DeepCopyInto(out *ExtendedLocation_Status) { + *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtendedLocation_Status. +func (in *ExtendedLocation_Status) DeepCopy() *ExtendedLocation_Status { + if in == nil { + return nil + } + out := new(ExtendedLocation_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Image) DeepCopyInto(out *Image) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. +func (in *Image) DeepCopy() *Image { + if in == nil { + return nil + } + out := new(Image) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Image) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageDataDisk) DeepCopyInto(out *ImageDataDisk) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(string) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(DiskEncryptionSetParameters) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.Lun != nil { + in, out := &in.Lun, &out.Lun + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageDataDisk. +func (in *ImageDataDisk) DeepCopy() *ImageDataDisk { + if in == nil { + return nil + } + out := new(ImageDataDisk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageDataDisk_Status) DeepCopyInto(out *ImageDataDisk_Status) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(string) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.Lun != nil { + in, out := &in.Lun, &out.Lun + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageDataDisk_Status. +func (in *ImageDataDisk_Status) DeepCopy() *ImageDataDisk_Status { + if in == nil { + return nil + } + out := new(ImageDataDisk_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageList) DeepCopyInto(out *ImageList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Image, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageList. +func (in *ImageList) DeepCopy() *ImageList { + if in == nil { + return nil + } + out := new(ImageList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ImageList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageOSDisk) DeepCopyInto(out *ImageOSDisk) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(string) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(DiskEncryptionSetParameters) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.OsState != nil { + in, out := &in.OsState, &out.OsState + *out = new(string) + **out = **in + } + if in.OsType != nil { + in, out := &in.OsType, &out.OsType + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageOSDisk. +func (in *ImageOSDisk) DeepCopy() *ImageOSDisk { + if in == nil { + return nil + } + out := new(ImageOSDisk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageOSDisk_Status) DeepCopyInto(out *ImageOSDisk_Status) { + *out = *in + if in.BlobUri != nil { + in, out := &in.BlobUri, &out.BlobUri + *out = new(string) + **out = **in + } + if in.Caching != nil { + in, out := &in.Caching, &out.Caching + *out = new(string) + **out = **in + } + if in.DiskEncryptionSet != nil { + in, out := &in.DiskEncryptionSet, &out.DiskEncryptionSet + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.DiskSizeGB != nil { + in, out := &in.DiskSizeGB, &out.DiskSizeGB + *out = new(int) + **out = **in + } + if in.ManagedDisk != nil { + in, out := &in.ManagedDisk, &out.ManagedDisk + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.OsState != nil { + in, out := &in.OsState, &out.OsState + *out = new(string) + **out = **in + } + if in.OsType != nil { + in, out := &in.OsType, &out.OsType + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Snapshot != nil { + in, out := &in.Snapshot, &out.Snapshot + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.StorageAccountType != nil { + in, out := &in.StorageAccountType, &out.StorageAccountType + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageOSDisk_Status. +func (in *ImageOSDisk_Status) DeepCopy() *ImageOSDisk_Status { + if in == nil { + return nil + } + out := new(ImageOSDisk_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageStorageProfile) DeepCopyInto(out *ImageStorageProfile) { + *out = *in + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]ImageDataDisk, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OsDisk != nil { + in, out := &in.OsDisk, &out.OsDisk + *out = new(ImageOSDisk) + (*in).DeepCopyInto(*out) + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ZoneResilient != nil { + in, out := &in.ZoneResilient, &out.ZoneResilient + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageStorageProfile. +func (in *ImageStorageProfile) DeepCopy() *ImageStorageProfile { + if in == nil { + return nil + } + out := new(ImageStorageProfile) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageStorageProfile_Status) DeepCopyInto(out *ImageStorageProfile_Status) { + *out = *in + if in.DataDisks != nil { + in, out := &in.DataDisks, &out.DataDisks + *out = make([]ImageDataDisk_Status, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OsDisk != nil { + in, out := &in.OsDisk, &out.OsDisk + *out = new(ImageOSDisk_Status) + (*in).DeepCopyInto(*out) + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ZoneResilient != nil { + in, out := &in.ZoneResilient, &out.ZoneResilient + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageStorageProfile_Status. +func (in *ImageStorageProfile_Status) DeepCopy() *ImageStorageProfile_Status { + if in == nil { + return nil + } + out := new(ImageStorageProfile_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Image_Status) DeepCopyInto(out *Image_Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]conditions.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation_Status) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(string) + **out = **in + } + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.ProvisioningState != nil { + in, out := &in.ProvisioningState, &out.ProvisioningState + *out = new(string) + **out = **in + } + if in.SourceVirtualMachine != nil { + in, out := &in.SourceVirtualMachine, &out.SourceVirtualMachine + *out = new(SubResource_Status) + (*in).DeepCopyInto(*out) + } + if in.StorageProfile != nil { + in, out := &in.StorageProfile, &out.StorageProfile + *out = new(ImageStorageProfile_Status) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image_Status. +func (in *Image_Status) DeepCopy() *Image_Status { + if in == nil { + return nil + } + out := new(Image_Status) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Images_Spec) DeepCopyInto(out *Images_Spec) { + *out = *in + if in.ExtendedLocation != nil { + in, out := &in.ExtendedLocation, &out.ExtendedLocation + *out = new(ExtendedLocation) + (*in).DeepCopyInto(*out) + } + if in.HyperVGeneration != nil { + in, out := &in.HyperVGeneration, &out.HyperVGeneration + *out = new(string) + **out = **in + } + if in.Location != nil { + in, out := &in.Location, &out.Location + *out = new(string) + **out = **in + } + out.Owner = in.Owner + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.SourceVirtualMachine != nil { + in, out := &in.SourceVirtualMachine, &out.SourceVirtualMachine + *out = new(SubResource) + (*in).DeepCopyInto(*out) + } + if in.StorageProfile != nil { + in, out := &in.StorageProfile, &out.StorageProfile + *out = new(ImageStorageProfile) + (*in).DeepCopyInto(*out) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Images_Spec. +func (in *Images_Spec) DeepCopy() *Images_Spec { + if in == nil { + return nil + } + out := new(Images_Spec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubResource) DeepCopyInto(out *SubResource) { + *out = *in + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Reference != nil { + in, out := &in.Reference, &out.Reference + *out = new(genruntime.ResourceReference) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResource. +func (in *SubResource) DeepCopy() *SubResource { + if in == nil { + return nil + } + out := new(SubResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubResource_Status) DeepCopyInto(out *SubResource_Status) { + *out = *in + if in.Id != nil { + in, out := &in.Id, &out.Id + *out = new(string) + **out = **in + } + if in.PropertyBag != nil { + in, out := &in.PropertyBag, &out.PropertyBag + *out = make(genruntime.PropertyBag, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubResource_Status. +func (in *SubResource_Status) DeepCopy() *SubResource_Status { + if in == nil { + return nil + } + out := new(SubResource_Status) + in.DeepCopyInto(out) + return out +} From ddda170cdc6a3ef07e97ae742c864d3a5405c2c5 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Fri, 11 Feb 2022 13:05:21 +1300 Subject: [PATCH 05/17] Default to verbose when running just one test --- Taskfile.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index de0b28e026c..bf60f0d0431 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -252,7 +252,11 @@ tasks: deps: [controller:run-kustomize-for-envtest] cmds: # -race fails at the moment in controller-runtime - - go test -timeout 15m -run '{{default ".*" .TEST_FILTER}}' ./internal/controllers + + - go test -timeout 15m -run '{{default ".*" .TEST_FILTER}}' {{.VERBOSE}} ./internal/controllers + vars: + VERBOSE: + sh: if [ $TEST_FILTER ]; then echo "-v"; fi controller:test-integration-envtest-cover: desc: Run integration tests with envtest using record/replay and output coverage. From cdca870604ade281c7e1eb2a929e70221cf64d0b Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Mon, 14 Feb 2022 12:50:10 +1300 Subject: [PATCH 06/17] Add log header function --- v2/internal/testcommon/kube_per_test_context.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/v2/internal/testcommon/kube_per_test_context.go b/v2/internal/testcommon/kube_per_test_context.go index 41be37364c3..bafc2cf22b4 100644 --- a/v2/internal/testcommon/kube_per_test_context.go +++ b/v2/internal/testcommon/kube_per_test_context.go @@ -9,6 +9,7 @@ import ( "context" "fmt" "math" + "strings" "testing" "time" @@ -438,6 +439,14 @@ func (tc *KubePerTestContext) DeleteResourcesAndWait(objs ...client.Object) { } } +// LogSection creates a distinctive header in the log to aid scanning +func (tc *KubePerTestContext) LogSection(section string) { + line := strings.Repeat("=", 50) + tc.T.Log(line) + tc.T.Log(section) + tc.T.Log(line) +} + type Subtest struct { Name string Test func(testContext *KubePerTestContext) From 17d7f12dc2ccac38a9a53a1bf314f665594fb04a Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Thu, 10 Feb 2022 15:36:17 +1300 Subject: [PATCH 07/17] Create CRD test for snapshots --- .../compute/v1alpha1api20200930_snapshot.yaml | 12 + .../controllers/crd_compute_snapshot_test.go | 56 ++ .../recordings/Test_Compute_Image_CRUD.yaml | 641 ++++++++++++++++++ .../Test_Compute_Snapshot_CRUD.yaml | 641 ++++++++++++++++++ 4 files changed, 1350 insertions(+) create mode 100644 v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml create mode 100644 v2/internal/controllers/crd_compute_snapshot_test.go create mode 100644 v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml create mode 100644 v2/internal/controllers/recordings/Test_Compute_Snapshot_CRUD.yaml diff --git a/v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml b/v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml new file mode 100644 index 00000000000..3b20ba8eee7 --- /dev/null +++ b/v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml @@ -0,0 +1,12 @@ +apiVersion: compute.azure.com/v1alpha1api20201201 +kind: Snapshot +metadata: + name: samplesnapshot + namespace: default +spec: + location: westcentralus + owner: + name: aso-sample-rg + creationData: + creatOption: empty + diskSizeGB: 64 diff --git a/v2/internal/controllers/crd_compute_snapshot_test.go b/v2/internal/controllers/crd_compute_snapshot_test.go new file mode 100644 index 00000000000..6fdd50c5c4e --- /dev/null +++ b/v2/internal/controllers/crd_compute_snapshot_test.go @@ -0,0 +1,56 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +package controllers_test + +import ( + "testing" + + "github.com/Azure/go-autorest/autorest/to" + . "github.com/onsi/gomega" + + compute "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20200930" + "github.com/Azure/azure-service-operator/v2/internal/testcommon" +) + +func Test_Compute_Snapshot_CRUD(t *testing.T) { + t.Parallel() + + tc := globalTestContext.ForTest(t) + rg := tc.CreateTestResourceGroupAndWait() + + snapshot := &compute.Snapshot{ + ObjectMeta: tc.MakeObjectMeta("ss"), + Spec: compute.Snapshots_Spec{ + CreationData: compute.CreationData{ + CreateOption: compute.CreationDataCreateOptionEmpty, + }, + DiskSizeGB: to.IntPtr(32), + Location: tc.AzureRegion, + Owner: testcommon.AsOwner(rg), + }, + } + + tc.CreateResourceAndWait(snapshot) + tc.Expect(snapshot.Status.Id).ToNot(BeNil()) + armId := *snapshot.Status.Id + + // Perform a simple patch to resize the disk + old := snapshot.DeepCopy() + snapshot.Spec.DiskSizeGB = to.IntPtr(64) + tc.PatchResourceAndWait(old, snapshot) + + tc.Expect(snapshot.Status.DiskSizeGB).ToNot(BeNil()) + tc.Expect(*snapshot.Status.DiskSizeGB).To(Equal(64)) + + // Delete VM and resources. + tc.DeleteResourcesAndWait(snapshot, rg) + + // Ensure that the resource was really deleted in Azure + exists, retryAfter, err := tc.AzureClient.HeadByID(tc.Ctx, armId, string(compute.SnapshotsSpecAPIVersion20200930)) + tc.Expect(err).ToNot(HaveOccurred()) + tc.Expect(retryAfter).To(BeZero()) + tc.Expect(exists).To(BeFalse()) +} diff --git a/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml b/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml new file mode 100644 index 00000000000..001ed6e1c49 --- /dev/null +++ b/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml @@ -0,0 +1,641 @@ +--- +version: 1 +interactions: +- request: + body: '{"name":"asotest-rg-ywquvq","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "93" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq?api-version=2020-06-01 + method: PUT + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq","name":"asotest-rg-ywquvq","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "276" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq","name":"asotest-rg-ywquvq","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"location":"westus2","name":"asotest-ss-ipdbqn","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":32}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "120" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"location\": \"westus2\",\r\n + \ \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n + \ },\r\n \"diskSizeGB\": 32,\r\n \"provisioningState\": \"Updating\",\r\n + \ \"isArmResource\": true\r\n }\r\n}" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/2fd2159f-7cac-47c4-abda-41685a17c429?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + Cache-Control: + - no-cache + Content-Length: + - "236" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/2fd2159f-7cac-47c4-abda-41685a17c429?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + Pragma: + - no-cache + Retry-After: + - "2" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;999,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7997 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/2fd2159f-7cac-47c4-abda-41685a17c429?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"startTime\": \"2022-02-10T22:22:38.7646868+00:00\",\r\n \"endTime\": + \"2022-02-10T22:22:39.0771375+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": + {\r\n \"output\": {\"name\":\"asotest-ss-ipdbqn\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn\",\"type\":\"Microsoft.Compute/snapshots\",\"location\":\"westus2\",\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"properties\":{\"creationData\":{\"createOption\":\"Empty\"},\"diskSizeGB\":32,\"encryption\":{\"type\":\"EncryptionAtRestWithPlatformKey\"},\"incremental\":false,\"networkAccessPolicy\":\"AllowAll\",\"timeCreated\":\"2022-02-10T22:22:38.7646868+00:00\",\"provisioningState\":\"Succeeded\",\"diskState\":\"Unattached\",\"diskSizeBytes\":34359738368,\"uniqueId\":\"30709bff-c9fc-4ec5-97e4-ad305d66b0e7\"}}\r\n + \ },\r\n \"name\": \"2fd2159f-7cac-47c4-abda-41685a17c429\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/GetOperation3Min;49996,Microsoft.Compute/GetOperation30Min;399993 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn\",\r\n + \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n + \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n + \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": + \"Empty\"\r\n },\r\n \"diskSizeGB\": 32,\r\n \"encryption\": {\r\n + \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": + false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": + \"2022-02-10T22:22:38.7646868+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 34359738368,\r\n + \ \"uniqueId\": \"30709bff-c9fc-4ec5-97e4-ad305d66b0e7\"\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119990 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"location":"westus2","name":"asotest-ss-ipdbqn","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":64}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "120" + Content-Type: + - application/json + Test-Request-Attempt: + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"location\": \"westus2\",\r\n + \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n + \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": + \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"provisioningState\": + \"Updating\",\r\n \"isArmResource\": true,\r\n \"colocationConstraints\": + {},\r\n \"faultDomain\": 0\r\n }\r\n}" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/7cf1a977-c51b-417c-bf32-7cf9aa4bd96e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + Cache-Control: + - no-cache + Content-Length: + - "364" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/7cf1a977-c51b-417c-bf32-7cf9aa4bd96e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + Pragma: + - no-cache + Retry-After: + - "2" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;998,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7996 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/7cf1a977-c51b-417c-bf32-7cf9aa4bd96e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"startTime\": \"2022-02-10T22:22:54.7178124+00:00\",\r\n \"endTime\": + \"2022-02-10T22:22:54.9052753+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": + {\r\n \"output\": {\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn\",\r\n + \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n + \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n + \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": + \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"encryption\": {\r\n + \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": + false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": + \"2022-02-10T22:22:38.7646868+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 68719476736,\r\n + \ \"uniqueId\": \"30709bff-c9fc-4ec5-97e4-ad305d66b0e7\"\r\n }\r\n}\r\n },\r\n + \ \"name\": \"7cf1a977-c51b-417c-bf32-7cf9aa4bd96e\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/GetOperation3Min;49997,Microsoft.Compute/GetOperation30Min;399992 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn\",\r\n + \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n + \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n + \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": + \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"encryption\": {\r\n + \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": + false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": + \"2022-02-10T22:22:38.7646868+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 68719476736,\r\n + \ \"uniqueId\": \"30709bff-c9fc-4ec5-97e4-ad305d66b0e7\"\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/LowCostGet3Min;14996,Microsoft.Compute/LowCostGet30Min;119988 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + method: DELETE + response: + body: "" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/210b3d57-7515-4d41-b2f6-36c44669f5fd?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + Cache-Control: + - no-cache + Content-Length: + - "0" + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/210b3d57-7515-4d41-b2f6-36c44669f5fd?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/DeleteDisks3Min;2999,Microsoft.Compute/DeleteDisks30Min;23997 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq?api-version=2020-06-01 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1BU09URVNUOjJEUkc6MkRZV1FVVlEtV0VTVFVTMiIsImpvYkxvY2F0aW9uIjoid2VzdHVzMiJ9?api-version=2020-06-01 + Pragma: + - no-cache + Retry-After: + - "15" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "2" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": + \"Snapshot asotest-ss-ipdbqn is not found.\"\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Length: + - "107" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119985 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + status: 404 Not Found + code: 404 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq","name":"asotest-rg-ywquvq","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "2" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq","name":"asotest-rg-ywquvq","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "3" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq","name":"asotest-rg-ywquvq","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "4" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq","name":"asotest-rg-ywquvq","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "5" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq?api-version=2020-06-01 + method: GET + response: + body: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group ''asotest-rg-ywquvq'' + could not be found."}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "109" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Failure-Cause: + - gateway + status: 404 Not Found + code: 404 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "3" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + method: GET + response: + body: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group ''asotest-rg-ywquvq'' + could not be found."}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "109" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Failure-Cause: + - gateway + status: 404 Not Found + code: 404 + duration: "" diff --git a/v2/internal/controllers/recordings/Test_Compute_Snapshot_CRUD.yaml b/v2/internal/controllers/recordings/Test_Compute_Snapshot_CRUD.yaml new file mode 100644 index 00000000000..8ba516031e5 --- /dev/null +++ b/v2/internal/controllers/recordings/Test_Compute_Snapshot_CRUD.yaml @@ -0,0 +1,641 @@ +--- +version: 1 +interactions: +- request: + body: '{"name":"asotest-rg-owoazy","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "93" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy?api-version=2020-06-01 + method: PUT + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy","name":"asotest-rg-owoazy","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "276" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 201 Created + code: 201 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy","name":"asotest-rg-owoazy","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Succeeded"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"location":"westus2","name":"asotest-ss-xsdrzf","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":32}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "120" + Content-Type: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"location\": \"westus2\",\r\n + \ \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n + \ },\r\n \"diskSizeGB\": 32,\r\n \"provisioningState\": \"Updating\",\r\n + \ \"isArmResource\": true\r\n }\r\n}" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/1a9ce802-cb38-4e9c-ae8b-3335f32e438e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + Cache-Control: + - no-cache + Content-Length: + - "236" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/1a9ce802-cb38-4e9c-ae8b-3335f32e438e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + Pragma: + - no-cache + Retry-After: + - "2" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;999,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7999 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/1a9ce802-cb38-4e9c-ae8b-3335f32e438e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"startTime\": \"2022-02-13T22:03:20.0563383+00:00\",\r\n \"endTime\": + \"2022-02-13T22:03:20.3688369+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": + {\r\n \"output\": {\"name\":\"asotest-ss-xsdrzf\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf\",\"type\":\"Microsoft.Compute/snapshots\",\"location\":\"westus2\",\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"properties\":{\"creationData\":{\"createOption\":\"Empty\"},\"diskSizeGB\":32,\"encryption\":{\"type\":\"EncryptionAtRestWithPlatformKey\"},\"incremental\":false,\"networkAccessPolicy\":\"AllowAll\",\"timeCreated\":\"2022-02-13T22:03:20.0719492+00:00\",\"provisioningState\":\"Succeeded\",\"diskState\":\"Unattached\",\"diskSizeBytes\":34359738368,\"uniqueId\":\"ebfe30d0-c50c-4607-9e90-4d4ce5cb3691\"}}\r\n + \ },\r\n \"name\": \"1a9ce802-cb38-4e9c-ae8b-3335f32e438e\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/GetOperation3Min;49998,Microsoft.Compute/GetOperation30Min;399998 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf\",\r\n + \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n + \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n + \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": + \"Empty\"\r\n },\r\n \"diskSizeGB\": 32,\r\n \"encryption\": {\r\n + \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": + false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": + \"2022-02-13T22:03:20.0719492+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 34359738368,\r\n + \ \"uniqueId\": \"ebfe30d0-c50c-4607-9e90-4d4ce5cb3691\"\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/LowCostGet3Min;14997,Microsoft.Compute/LowCostGet30Min;119997 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + status: 200 OK + code: 200 + duration: "" +- request: + body: '{"location":"westus2","name":"asotest-ss-xsdrzf","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":64}}' + form: {} + headers: + Accept: + - application/json + Content-Length: + - "120" + Content-Type: + - application/json + Test-Request-Attempt: + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + method: PUT + response: + body: "{\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"location\": \"westus2\",\r\n + \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n + \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": + \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"provisioningState\": + \"Updating\",\r\n \"isArmResource\": true,\r\n \"colocationConstraints\": + {},\r\n \"faultDomain\": 0\r\n }\r\n}" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/131389d4-1519-4f24-a3d1-f837654c6e1e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + Cache-Control: + - no-cache + Content-Length: + - "364" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/131389d4-1519-4f24-a3d1-f837654c6e1e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + Pragma: + - no-cache + Retry-After: + - "2" + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;998,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7998 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/131389d4-1519-4f24-a3d1-f837654c6e1e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"startTime\": \"2022-02-13T22:03:34.634517+00:00\",\r\n \"endTime\": + \"2022-02-13T22:03:34.790765+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": + {\r\n \"output\": {\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf\",\r\n + \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n + \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n + \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": + \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"encryption\": {\r\n + \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": + false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": + \"2022-02-13T22:03:20.0719492+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 68719476736,\r\n + \ \"uniqueId\": \"ebfe30d0-c50c-4607-9e90-4d4ce5cb3691\"\r\n }\r\n}\r\n },\r\n + \ \"name\": \"131389d4-1519-4f24-a3d1-f837654c6e1e\"\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/GetOperation3Min;49997,Microsoft.Compute/GetOperation30Min;399997 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf\",\r\n + \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n + \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n + \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": + \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"encryption\": {\r\n + \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": + false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": + \"2022-02-13T22:03:20.0719492+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 68719476736,\r\n + \ \"uniqueId\": \"ebfe30d0-c50c-4607-9e90-4d4ce5cb3691\"\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/LowCostGet3Min;14996,Microsoft.Compute/LowCostGet30Min;119996 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + method: DELETE + response: + body: "" + headers: + Azure-Asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/c2e6bb30-5240-47a9-86bf-67c471e15072?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + Cache-Control: + - no-cache + Content-Length: + - "0" + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/c2e6bb30-5240-47a9-86bf-67c471e15072?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/DeleteDisks3Min;2999,Microsoft.Compute/DeleteDisks30Min;23999 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy?api-version=2020-06-01 + method: DELETE + response: + body: "" + headers: + Cache-Control: + - no-cache + Content-Length: + - "0" + Expires: + - "-1" + Location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1BU09URVNUOjJEUkc6MkRPV09BWlktV0VTVFVTMiIsImpvYkxvY2F0aW9uIjoid2VzdHVzMiJ9?api-version=2020-06-01 + Pragma: + - no-cache + Retry-After: + - "15" + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + status: 202 Accepted + code: 202 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "2" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + method: GET + response: + body: "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": + \"Snapshot asotest-ss-xsdrzf is not found.\"\r\n }\r\n}" + headers: + Cache-Control: + - no-cache + Content-Length: + - "107" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Server: + - Microsoft-HTTPAPI/2.0 + - Microsoft-HTTPAPI/2.0 + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Ratelimit-Remaining-Resource: + - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119993 + X-Ms-Served-By: + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + status: 404 Not Found + code: 404 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy","name":"asotest-rg-owoazy","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "2" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy","name":"asotest-rg-owoazy","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "3" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy","name":"asotest-rg-owoazy","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "4" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy?api-version=2020-06-01 + method: GET + response: + body: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy","name":"asotest-rg-owoazy","type":"Microsoft.Resources/resourceGroups","location":"westus2","tags":{"CreatedAt":"2001-02-03T04:05:06Z"},"properties":{"provisioningState":"Deleting"}}' + headers: + Cache-Control: + - no-cache + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + Vary: + - Accept-Encoding + X-Content-Type-Options: + - nosniff + status: 200 OK + code: 200 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "5" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy?api-version=2020-06-01 + method: GET + response: + body: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group ''asotest-rg-owoazy'' + could not be found."}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "109" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Failure-Cause: + - gateway + status: 404 Not Found + code: 404 + duration: "" +- request: + body: "" + form: {} + headers: + Accept: + - application/json + Test-Request-Attempt: + - "3" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + method: GET + response: + body: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group ''asotest-rg-owoazy'' + could not be found."}}' + headers: + Cache-Control: + - no-cache + Content-Length: + - "109" + Content-Type: + - application/json; charset=utf-8 + Expires: + - "-1" + Pragma: + - no-cache + Strict-Transport-Security: + - max-age=31536000; includeSubDomains + X-Content-Type-Options: + - nosniff + X-Ms-Failure-Cause: + - gateway + status: 404 Not Found + code: 404 + duration: "" From 0d0c64d81ffd2fd22109f54383d5cc289e73d4b7 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Fri, 11 Feb 2022 15:19:04 +1300 Subject: [PATCH 08/17] Create CRD test for images --- .../controllers/crd_compute_image_test.go | 81 +++++++++ .../recordings/Test_Compute_Image_CRUD.yaml | 162 ++++++++---------- 2 files changed, 153 insertions(+), 90 deletions(-) create mode 100644 v2/internal/controllers/crd_compute_image_test.go diff --git a/v2/internal/controllers/crd_compute_image_test.go b/v2/internal/controllers/crd_compute_image_test.go new file mode 100644 index 00000000000..5e7fa82bbfc --- /dev/null +++ b/v2/internal/controllers/crd_compute_image_test.go @@ -0,0 +1,81 @@ +/* +Copyright (c) Microsoft Corporation. +Licensed under the MIT license. +*/ + +package controllers_test + +import ( + "testing" + + "github.com/Azure/go-autorest/autorest/to" + . "github.com/onsi/gomega" + + compute2020 "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20200930" + compute2021 "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701" + "github.com/Azure/azure-service-operator/v2/internal/testcommon" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" +) + +func Test_Compute_Image_CRUD(t *testing.T) { + t.Parallel() + + tc := globalTestContext.ForTest(t) + + tc.LogSection("Create Resource Group") + rg := tc.CreateTestResourceGroupAndWait() + + tc.LogSection("Create Snapshot") + snapshot := &compute2020.Snapshot{ + ObjectMeta: tc.MakeObjectMeta("snapshot"), + Spec: compute2020.Snapshots_Spec{ + CreationData: compute2020.CreationData{ + CreateOption: compute2020.CreationDataCreateOptionEmpty, + }, + DiskSizeGB: to.IntPtr(32), + Location: tc.AzureRegion, + Owner: testcommon.AsOwner(rg), + }, + } + + tc.CreateResourceAndWait(snapshot) + tc.Expect(snapshot.Status.Id).ToNot(BeNil()) + snapshotARMId := *snapshot.Status.Id + + tc.LogSection("Create Image") + v2 := compute2021.ImagePropertiesHyperVGenerationV2 + image := &compute2021.Image{ + ObjectMeta: tc.MakeObjectMeta("image"), + Spec: compute2021.Images_Spec{ + HyperVGeneration: &v2, + Location: tc.AzureRegion, + Owner: testcommon.AsOwner(rg), + StorageProfile: &compute2021.ImageStorageProfile{ + OsDisk: &compute2021.ImageOSDisk{ + DiskSizeGB: to.IntPtr(32), + OsType: compute2021.ImageOSDiskOsTypeLinux, + OsState: compute2021.ImageOSDiskOsStateGeneralized, + Snapshot: &compute2021.SubResource{ + Reference: &genruntime.ResourceReference{ + ARMID: snapshotARMId, + }, + }, + }, + }, + }, + } + + tc.CreateResourceAndWait(image) + tc.Expect(image.Status.Id).ToNot(BeNil()) + imageARMId := *image.Status.Id + + tc.LogSection("Clean up") + // Delete VM and resources. + tc.DeleteResourcesAndWait(image, rg) + + // Ensure that the resource was really deleted in Azure + exists, retryAfter, err := tc.AzureClient.HeadByID(tc.Ctx, imageARMId, string(compute2021.ImagesSpecAPIVersion20210701)) + tc.Expect(err).ToNot(HaveOccurred()) + tc.Expect(retryAfter).To(BeZero()) + tc.Expect(exists).To(BeFalse()) +} diff --git a/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml b/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml index 001ed6e1c49..219071e4795 100644 --- a/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml +++ b/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml @@ -66,37 +66,37 @@ interactions: code: 200 duration: "" - request: - body: '{"location":"westus2","name":"asotest-ss-ipdbqn","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":32}}' + body: '{"location":"westus2","name":"asotest-snapshot-ipdbqn","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":32}}' form: {} headers: Accept: - application/json Content-Length: - - "120" + - "126" Content-Type: - application/json Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn?api-version=2020-09-30 method: PUT response: - body: "{\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"location\": \"westus2\",\r\n + body: "{\r\n \"name\": \"asotest-snapshot-ipdbqn\",\r\n \"location\": \"westus2\",\r\n \ \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n \ },\r\n \"diskSizeGB\": 32,\r\n \"provisioningState\": \"Updating\",\r\n \ \"isArmResource\": true\r\n }\r\n}" headers: Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/2fd2159f-7cac-47c4-abda-41685a17c429?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9208528a-dc87-45aa-a25e-69d9f2679ce8?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 Cache-Control: - no-cache Content-Length: - - "236" + - "242" Content-Type: - application/json; charset=utf-8 Expires: - "-1" Location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/2fd2159f-7cac-47c4-abda-41685a17c429?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9208528a-dc87-45aa-a25e-69d9f2679ce8?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 Pragma: - no-cache Retry-After: @@ -111,7 +111,7 @@ interactions: X-Ms-Ratelimit-Remaining-Resource: - Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;999,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7997 X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 status: 202 Accepted code: 202 duration: "" @@ -121,13 +121,13 @@ interactions: headers: Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/2fd2159f-7cac-47c4-abda-41685a17c429?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9208528a-dc87-45aa-a25e-69d9f2679ce8?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 method: GET response: - body: "{\r\n \"startTime\": \"2022-02-10T22:22:38.7646868+00:00\",\r\n \"endTime\": - \"2022-02-10T22:22:39.0771375+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": - {\r\n \"output\": {\"name\":\"asotest-ss-ipdbqn\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn\",\"type\":\"Microsoft.Compute/snapshots\",\"location\":\"westus2\",\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"properties\":{\"creationData\":{\"createOption\":\"Empty\"},\"diskSizeGB\":32,\"encryption\":{\"type\":\"EncryptionAtRestWithPlatformKey\"},\"incremental\":false,\"networkAccessPolicy\":\"AllowAll\",\"timeCreated\":\"2022-02-10T22:22:38.7646868+00:00\",\"provisioningState\":\"Succeeded\",\"diskState\":\"Unattached\",\"diskSizeBytes\":34359738368,\"uniqueId\":\"30709bff-c9fc-4ec5-97e4-ad305d66b0e7\"}}\r\n - \ },\r\n \"name\": \"2fd2159f-7cac-47c4-abda-41685a17c429\"\r\n}" + body: "{\r\n \"startTime\": \"2022-02-13T23:46:32.4606651+00:00\",\r\n \"endTime\": + \"2022-02-13T23:46:32.6481673+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": + {\r\n \"output\": {\"name\":\"asotest-snapshot-ipdbqn\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn\",\"type\":\"Microsoft.Compute/snapshots\",\"location\":\"westus2\",\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"properties\":{\"creationData\":{\"createOption\":\"Empty\"},\"diskSizeGB\":32,\"encryption\":{\"type\":\"EncryptionAtRestWithPlatformKey\"},\"incremental\":false,\"networkAccessPolicy\":\"AllowAll\",\"timeCreated\":\"2022-02-13T23:46:32.4763243+00:00\",\"provisioningState\":\"Succeeded\",\"diskState\":\"Unattached\",\"diskSizeBytes\":34359738368,\"uniqueId\":\"cb0abd0d-7b25-4c91-922e-6b32bee0dcf3\"}}\r\n + \ },\r\n \"name\": \"9208528a-dc87-45aa-a25e-69d9f2679ce8\"\r\n}" headers: Cache-Control: - no-cache @@ -147,9 +147,9 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/GetOperation3Min;49996,Microsoft.Compute/GetOperation30Min;399993 + - Microsoft.Compute/GetOperation3Min;49998,Microsoft.Compute/GetOperation30Min;399988 X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 status: 200 OK code: 200 duration: "" @@ -161,19 +161,19 @@ interactions: - application/json Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn?api-version=2020-09-30 method: GET response: - body: "{\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn\",\r\n + body: "{\r\n \"name\": \"asotest-snapshot-ipdbqn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn\",\r\n \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 32,\r\n \"encryption\": {\r\n \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": - \"2022-02-10T22:22:38.7646868+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-02-13T23:46:32.4763243+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 34359738368,\r\n - \ \"uniqueId\": \"30709bff-c9fc-4ec5-97e4-ad305d66b0e7\"\r\n }\r\n}" + \ \"uniqueId\": \"cb0abd0d-7b25-4c91-922e-6b32bee0dcf3\"\r\n }\r\n}" headers: Cache-Control: - no-cache @@ -193,50 +193,51 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119990 + - Microsoft.Compute/LowCostGet3Min;14998,Microsoft.Compute/LowCostGet30Min;119987 X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 status: 200 OK code: 200 duration: "" - request: - body: '{"location":"westus2","name":"asotest-ss-ipdbqn","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":64}}' + body: '{"location":"westus2","name":"asotest-image-hzqmvz","properties":{"hyperVGeneration":"V2","storageProfile":{"osDisk":{"diskSizeGB":32,"osState":"Generalized","osType":"Linux","snapshot":{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn"}}}}}' form: {} headers: Accept: - application/json Content-Length: - - "120" + - "345" Content-Type: - application/json Test-Request-Attempt: - - "1" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/images/asotest-image-hzqmvz?api-version=2021-07-01 method: PUT response: - body: "{\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"location\": \"westus2\",\r\n - \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n - \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": - \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"provisioningState\": - \"Updating\",\r\n \"isArmResource\": true,\r\n \"colocationConstraints\": - {},\r\n \"faultDomain\": 0\r\n }\r\n}" - headers: + body: "{\r\n \"name\": \"asotest-image-hzqmvz\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/images/asotest-image-hzqmvz\",\r\n + \ \"type\": \"Microsoft.Compute/images\",\r\n \"location\": \"westus2\",\r\n + \ \"properties\": {\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n + \ \"osType\": \"Linux\",\r\n \"osState\": \"Generalized\",\r\n + \ \"diskSizeGB\": 32,\r\n \"snapshot\": {\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn\"\r\n + \ },\r\n \"caching\": \"None\",\r\n \"storageAccountType\": + \"Standard_LRS\"\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"provisioningState\": + \"Creating\",\r\n \"hyperVGeneration\": \"V2\"\r\n }\r\n}" + headers: + Azure-Asyncnotification: + - Enabled Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/7cf1a977-c51b-417c-bf32-7cf9aa4bd96e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/21aad6e5-0bb1-43e8-a1a4-ee6754d43717?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 Cache-Control: - no-cache Content-Length: - - "364" + - "799" Content-Type: - application/json; charset=utf-8 Expires: - "-1" - Location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/7cf1a977-c51b-417c-bf32-7cf9aa4bd96e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 Pragma: - no-cache - Retry-After: - - "2" Server: - Microsoft-HTTPAPI/2.0 - Microsoft-HTTPAPI/2.0 @@ -245,11 +246,9 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;998,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7996 - X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 - status: 202 Accepted - code: 202 + - Microsoft.Compute/CreateImages3Min;39,Microsoft.Compute/CreateImages30Min;196 + status: 201 Created + code: 201 duration: "" - request: body: "" @@ -257,22 +256,12 @@ interactions: headers: Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/7cf1a977-c51b-417c-bf32-7cf9aa4bd96e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/21aad6e5-0bb1-43e8-a1a4-ee6754d43717?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 method: GET response: - body: "{\r\n \"startTime\": \"2022-02-10T22:22:54.7178124+00:00\",\r\n \"endTime\": - \"2022-02-10T22:22:54.9052753+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": - {\r\n \"output\": {\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn\",\r\n - \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n - \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n - \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": - \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"encryption\": {\r\n - \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": - false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": - \"2022-02-10T22:22:38.7646868+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n - \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 68719476736,\r\n - \ \"uniqueId\": \"30709bff-c9fc-4ec5-97e4-ad305d66b0e7\"\r\n }\r\n}\r\n },\r\n - \ \"name\": \"7cf1a977-c51b-417c-bf32-7cf9aa4bd96e\"\r\n}" + body: "{\r\n \"startTime\": \"2022-02-13T23:46:54.5013272+00:00\",\r\n \"endTime\": + \"2022-02-13T23:46:59.6419286+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"name\": + \"21aad6e5-0bb1-43e8-a1a4-ee6754d43717\"\r\n}" headers: Cache-Control: - no-cache @@ -292,9 +281,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/GetOperation3Min;49997,Microsoft.Compute/GetOperation30Min;399992 - X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + - Microsoft.Compute/GetOperation3Min;14999,Microsoft.Compute/GetOperation30Min;29996 status: 200 OK code: 200 duration: "" @@ -305,20 +292,19 @@ interactions: Accept: - application/json Test-Request-Attempt: - - "1" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + - "0" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/images/asotest-image-hzqmvz?api-version=2021-07-01 method: GET response: - body: "{\r\n \"name\": \"asotest-ss-ipdbqn\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn\",\r\n - \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n - \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n - \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": - \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"encryption\": {\r\n - \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": - false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": - \"2022-02-10T22:22:38.7646868+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n - \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 68719476736,\r\n - \ \"uniqueId\": \"30709bff-c9fc-4ec5-97e4-ad305d66b0e7\"\r\n }\r\n}" + body: "{\r\n \"name\": \"asotest-image-hzqmvz\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/images/asotest-image-hzqmvz\",\r\n + \ \"type\": \"Microsoft.Compute/images\",\r\n \"location\": \"westus2\",\r\n + \ \"properties\": {\r\n \"storageProfile\": {\r\n \"osDisk\": {\r\n + \ \"osType\": \"Linux\",\r\n \"osState\": \"Generalized\",\r\n + \ \"diskSizeGB\": 32,\r\n \"snapshot\": {\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn\"\r\n + \ },\r\n \"caching\": \"None\",\r\n \"storageAccountType\": + \"Standard_LRS\"\r\n },\r\n \"dataDisks\": []\r\n },\r\n \"provisioningState\": + \"Succeeded\",\r\n \"hyperVGeneration\": \"V2\"\r\n }\r\n}" headers: Cache-Control: - no-cache @@ -338,9 +324,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/LowCostGet3Min;14996,Microsoft.Compute/LowCostGet30Min;119988 - X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + - Microsoft.Compute/GetImages3Min;358,Microsoft.Compute/GetImages30Min;1791 status: 200 OK code: 200 duration: "" @@ -352,13 +336,15 @@ interactions: - application/json Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/images/asotest-image-hzqmvz?api-version=2021-07-01 method: DELETE response: body: "" headers: + Azure-Asyncnotification: + - Enabled Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/210b3d57-7515-4d41-b2f6-36c44669f5fd?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/17cee97c-c10f-4998-a45e-6763bdcb07f0?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 Cache-Control: - no-cache Content-Length: @@ -366,7 +352,7 @@ interactions: Expires: - "-1" Location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/210b3d57-7515-4d41-b2f6-36c44669f5fd?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/17cee97c-c10f-4998-a45e-6763bdcb07f0?p=b26caeba-1a35-4884-92ce-d47b44b28157&monitor=true&api-version=2021-07-01 Pragma: - no-cache Server: @@ -377,9 +363,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/DeleteDisks3Min;2999,Microsoft.Compute/DeleteDisks30Min;23997 - X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + - Microsoft.Compute/DeleteImages3Min;119,Microsoft.Compute/DeleteImages30Min;597 status: 202 Accepted code: 202 duration: "" @@ -422,17 +406,17 @@ interactions: Accept: - application/json Test-Request-Attempt: - - "2" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + - "1" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/images/asotest-image-hzqmvz?api-version=2021-07-01 method: GET response: body: "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": - \"Snapshot asotest-ss-ipdbqn is not found.\"\r\n }\r\n}" + \"The entity was not found in this Azure location.\"\r\n }\r\n}" headers: Cache-Control: - no-cache Content-Length: - - "107" + - "115" Content-Type: - application/json; charset=utf-8 Expires: @@ -447,9 +431,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119985 - X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132861948992283548 + - Microsoft.Compute/GetImages3Min;357,Microsoft.Compute/GetImages30Min;1790 status: 404 Not Found code: 404 duration: "" @@ -613,8 +595,8 @@ interactions: Accept: - application/json Test-Request-Attempt: - - "3" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-ss-ipdbqn?api-version=2020-09-30 + - "2" + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/images/asotest-image-hzqmvz?api-version=2021-07-01 method: GET response: body: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group ''asotest-rg-ywquvq'' From d94daad9f6a534c30e48814adefcc09ab1360fc5 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Mon, 14 Feb 2022 13:17:19 +1300 Subject: [PATCH 09/17] Add sections to Snapshot test --- v2/internal/controllers/crd_compute_snapshot_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/v2/internal/controllers/crd_compute_snapshot_test.go b/v2/internal/controllers/crd_compute_snapshot_test.go index 6fdd50c5c4e..8e779ac9164 100644 --- a/v2/internal/controllers/crd_compute_snapshot_test.go +++ b/v2/internal/controllers/crd_compute_snapshot_test.go @@ -19,10 +19,12 @@ func Test_Compute_Snapshot_CRUD(t *testing.T) { t.Parallel() tc := globalTestContext.ForTest(t) + tc.LogSection("Create Resource Group") rg := tc.CreateTestResourceGroupAndWait() + tc.LogSection("Create Snapshot") snapshot := &compute.Snapshot{ - ObjectMeta: tc.MakeObjectMeta("ss"), + ObjectMeta: tc.MakeObjectMeta("snapshot"), Spec: compute.Snapshots_Spec{ CreationData: compute.CreationData{ CreateOption: compute.CreationDataCreateOptionEmpty, @@ -38,6 +40,7 @@ func Test_Compute_Snapshot_CRUD(t *testing.T) { armId := *snapshot.Status.Id // Perform a simple patch to resize the disk + tc.LogSection("Patch Snapshot") old := snapshot.DeepCopy() snapshot.Spec.DiskSizeGB = to.IntPtr(64) tc.PatchResourceAndWait(old, snapshot) @@ -46,6 +49,7 @@ func Test_Compute_Snapshot_CRUD(t *testing.T) { tc.Expect(*snapshot.Status.DiskSizeGB).To(Equal(64)) // Delete VM and resources. + tc.LogSection("Clean up") tc.DeleteResourcesAndWait(snapshot, rg) // Ensure that the resource was really deleted in Azure From d64c5807422dfa337f3ba00c8416416f9e7f9b5d Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Mon, 14 Feb 2022 14:34:05 +1300 Subject: [PATCH 10/17] add missing sample --- .../compute/v1alpha1api20210701_image.yaml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 v2/config/samples/compute/v1alpha1api20210701_image.yaml diff --git a/v2/config/samples/compute/v1alpha1api20210701_image.yaml b/v2/config/samples/compute/v1alpha1api20210701_image.yaml new file mode 100644 index 00000000000..b5d728a6c8c --- /dev/null +++ b/v2/config/samples/compute/v1alpha1api20210701_image.yaml @@ -0,0 +1,32 @@ +apiVersion: compute.azure.com/v1alpha1api20201201 +kind: Snapshot +metadata: + name: aso-sample-snapshot + namespace: default +spec: + location: westcentralus + owner: + name: aso-sample-rg + creationData: + creatOption: empty + diskSizeGB: 64 +--- +apiVersion: compute.azure.com/v1alpha1api20210701 +kind: Image +metadata: + name: aso-sample-image + namespace: default +spec: + hyperVGeneration: "v2" + location: westcentralus + owner: + name: aso-sample-rg + storageProfile: + osDisk: + diskSizeGB: 32 + osType: linux + osState: generalized + snapshot: + Reference: + armID: aso-sample-snapshot + From 70fe2ad6b3fa28111880ccc4cd59660565be69c8 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Mon, 14 Feb 2022 14:34:38 +1300 Subject: [PATCH 11/17] Update configuration --- v2/azure-arm.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/v2/azure-arm.yaml b/v2/azure-arm.yaml index 13049669613..c6d027e5035 100644 --- a/v2/azure-arm.yaml +++ b/v2/azure-arm.yaml @@ -572,11 +572,17 @@ objectModelConfiguration: Encryption: DiskEncryptionSetId: $armReference: true + ImageDiskReference: + Id: + $armReference: true Snapshot: $export: true SnapshotProperties: DiskAccessId: $armReference: true + SourceVault: + Id: + $armReference: true 2020-12-01: DiskEncryptionSetParameters: Id: From 868ac6735acef7740c482a5e5f52d7d52bd8df64 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Mon, 14 Feb 2022 14:35:05 +1300 Subject: [PATCH 12/17] Change name in sample --- v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml b/v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml index 3b20ba8eee7..05baba245f4 100644 --- a/v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml +++ b/v2/config/samples/compute/v1alpha1api20200930_snapshot.yaml @@ -1,7 +1,7 @@ apiVersion: compute.azure.com/v1alpha1api20201201 kind: Snapshot metadata: - name: samplesnapshot + name: aso-sample-snapshot namespace: default spec: location: westcentralus From 29781a652182b7250ab66b766ee22279d5a8f2ef Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Mon, 14 Feb 2022 14:35:30 +1300 Subject: [PATCH 13/17] Update generated files --- .../image_extension_types_gen.go | 20 +++++++++++++++++++ .../snapshot_extension_types_gen.go | 20 +++++++++++++++++++ .../controllers/controller_resources_gen.go | 16 ++++----------- 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 v2/api/compute/customizations/image_extension_types_gen.go create mode 100644 v2/api/compute/customizations/snapshot_extension_types_gen.go diff --git a/v2/api/compute/customizations/image_extension_types_gen.go b/v2/api/compute/customizations/image_extension_types_gen.go new file mode 100644 index 00000000000..246e5f39cea --- /dev/null +++ b/v2/api/compute/customizations/image_extension_types_gen.go @@ -0,0 +1,20 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package customizations + +import ( + compute "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701" + "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20210701storage" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" +) + +type ImageExtension struct { +} + +// GetExtendedResources Returns the KubernetesResource slice for Resource versions +func (extension *ImageExtension) GetExtendedResources() []genruntime.KubernetesResource { + return []genruntime.KubernetesResource{ + &compute.Image{}, + &v1alpha1api20210701storage.Image{}} +} diff --git a/v2/api/compute/customizations/snapshot_extension_types_gen.go b/v2/api/compute/customizations/snapshot_extension_types_gen.go new file mode 100644 index 00000000000..40cadfe7ef0 --- /dev/null +++ b/v2/api/compute/customizations/snapshot_extension_types_gen.go @@ -0,0 +1,20 @@ +// Code generated by azure-service-operator-codegen. DO NOT EDIT. +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +package customizations + +import ( + compute "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20200930" + "github.com/Azure/azure-service-operator/v2/api/compute/v1alpha1api20200930storage" + "github.com/Azure/azure-service-operator/v2/pkg/genruntime" +) + +type SnapshotExtension struct { +} + +// GetExtendedResources Returns the KubernetesResource slice for Resource versions +func (extension *SnapshotExtension) GetExtendedResources() []genruntime.KubernetesResource { + return []genruntime.KubernetesResource{ + &compute.Snapshot{}, + &v1alpha1api20200930storage.Snapshot{}} +} diff --git a/v2/internal/controllers/controller_resources_gen.go b/v2/internal/controllers/controller_resources_gen.go index 31491f7fbf8..4e79f543a46 100644 --- a/v2/internal/controllers/controller_resources_gen.go +++ b/v2/internal/controllers/controller_resources_gen.go @@ -126,12 +126,7 @@ func getKnownStorageTypes() []registration.StorageType { result = append(result, registration.StorageType{ Obj: new(computev1alpha1api20200930storage.Snapshot), Indexes: []registration.Index{}, - Watches: []registration.Watch{ - { - Src: &source.Kind{Type: &v1.Secret{}}, - MakeEventHandler: watchSecretsFactory([]string{}, &computev1alpha1api20200930storage.SnapshotList{}), - }, - }, + Watches: []registration.Watch{}, }) result = append(result, registration.StorageType{ Obj: new(computev1alpha1api20201201storage.VirtualMachine), @@ -166,12 +161,7 @@ func getKnownStorageTypes() []registration.StorageType { result = append(result, registration.StorageType{ Obj: new(computev1alpha1api20210701storage.Image), Indexes: []registration.Index{}, - Watches: []registration.Watch{ - { - Src: &source.Kind{Type: &v1.Secret{}}, - MakeEventHandler: watchSecretsFactory([]string{}, &computev1alpha1api20210701storage.ImageList{}), - }, - }, + Watches: []registration.Watch{}, }) result = append(result, registration.StorageType{ Obj: new(containerregistryv1alpha1api20210901storage.Registry), @@ -662,6 +652,8 @@ func getResourceExtensions() []genruntime.ResourceExtension { result = append(result, &cachecustomizations.RedisLinkedServerExtension{}) result = append(result, &cachecustomizations.RedisPatchScheduleExtension{}) result = append(result, &computecustomizations.DiskExtension{}) + result = append(result, &computecustomizations.ImageExtension{}) + result = append(result, &computecustomizations.SnapshotExtension{}) result = append(result, &computecustomizations.VirtualMachineExtension{}) result = append(result, &computecustomizations.VirtualMachineScaleSetExtension{}) result = append(result, &containerregistrycustomizations.RegistryExtension{}) From 0edce7dc52b7a7a0c41484be79e8a3f282ea0c99 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Mon, 14 Feb 2022 16:17:51 +1300 Subject: [PATCH 14/17] Update recording for Snapshot tests --- .../Test_Compute_Snapshot_CRUD.yaml | 89 ++++++++++--------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/v2/internal/controllers/recordings/Test_Compute_Snapshot_CRUD.yaml b/v2/internal/controllers/recordings/Test_Compute_Snapshot_CRUD.yaml index 8ba516031e5..4ebf57e8802 100644 --- a/v2/internal/controllers/recordings/Test_Compute_Snapshot_CRUD.yaml +++ b/v2/internal/controllers/recordings/Test_Compute_Snapshot_CRUD.yaml @@ -66,37 +66,37 @@ interactions: code: 200 duration: "" - request: - body: '{"location":"westus2","name":"asotest-ss-xsdrzf","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":32}}' + body: '{"location":"westus2","name":"asotest-snapshot-xsdrzf","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":32}}' form: {} headers: Accept: - application/json Content-Length: - - "120" + - "126" Content-Type: - application/json Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf?api-version=2020-09-30 method: PUT response: - body: "{\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"location\": \"westus2\",\r\n + body: "{\r\n \"name\": \"asotest-snapshot-xsdrzf\",\r\n \"location\": \"westus2\",\r\n \ \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n \ },\r\n \"diskSizeGB\": 32,\r\n \"provisioningState\": \"Updating\",\r\n \ \"isArmResource\": true\r\n }\r\n}" headers: Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/1a9ce802-cb38-4e9c-ae8b-3335f32e438e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9bba0c71-735a-44a9-a66a-22a82fd85b27?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 Cache-Control: - no-cache Content-Length: - - "236" + - "242" Content-Type: - application/json; charset=utf-8 Expires: - "-1" Location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/1a9ce802-cb38-4e9c-ae8b-3335f32e438e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9bba0c71-735a-44a9-a66a-22a82fd85b27?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 Pragma: - no-cache Retry-After: @@ -121,13 +121,13 @@ interactions: headers: Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/1a9ce802-cb38-4e9c-ae8b-3335f32e438e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9bba0c71-735a-44a9-a66a-22a82fd85b27?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 method: GET response: - body: "{\r\n \"startTime\": \"2022-02-13T22:03:20.0563383+00:00\",\r\n \"endTime\": - \"2022-02-13T22:03:20.3688369+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": - {\r\n \"output\": {\"name\":\"asotest-ss-xsdrzf\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf\",\"type\":\"Microsoft.Compute/snapshots\",\"location\":\"westus2\",\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"properties\":{\"creationData\":{\"createOption\":\"Empty\"},\"diskSizeGB\":32,\"encryption\":{\"type\":\"EncryptionAtRestWithPlatformKey\"},\"incremental\":false,\"networkAccessPolicy\":\"AllowAll\",\"timeCreated\":\"2022-02-13T22:03:20.0719492+00:00\",\"provisioningState\":\"Succeeded\",\"diskState\":\"Unattached\",\"diskSizeBytes\":34359738368,\"uniqueId\":\"ebfe30d0-c50c-4607-9e90-4d4ce5cb3691\"}}\r\n - \ },\r\n \"name\": \"1a9ce802-cb38-4e9c-ae8b-3335f32e438e\"\r\n}" + body: "{\r\n \"startTime\": \"2022-02-14T03:02:35.5262024+00:00\",\r\n \"endTime\": + \"2022-02-14T03:02:35.9011914+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": + {\r\n \"output\": {\"name\":\"asotest-snapshot-xsdrzf\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf\",\"type\":\"Microsoft.Compute/snapshots\",\"location\":\"westus2\",\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"properties\":{\"creationData\":{\"createOption\":\"Empty\"},\"diskSizeGB\":32,\"encryption\":{\"type\":\"EncryptionAtRestWithPlatformKey\"},\"incremental\":false,\"networkAccessPolicy\":\"AllowAll\",\"timeCreated\":\"2022-02-14T03:02:35.5262024+00:00\",\"provisioningState\":\"Succeeded\",\"diskState\":\"Unattached\",\"diskSizeBytes\":34359738368,\"uniqueId\":\"bfb1aba1-eca4-4254-9dc4-b5623bfeae21\"}}\r\n + \ },\r\n \"name\": \"9bba0c71-735a-44a9-a66a-22a82fd85b27\"\r\n}" headers: Cache-Control: - no-cache @@ -161,19 +161,19 @@ interactions: - application/json Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf?api-version=2020-09-30 method: GET response: - body: "{\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf\",\r\n + body: "{\r\n \"name\": \"asotest-snapshot-xsdrzf\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf\",\r\n \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 32,\r\n \"encryption\": {\r\n \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": - \"2022-02-13T22:03:20.0719492+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-02-14T03:02:35.5262024+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 34359738368,\r\n - \ \"uniqueId\": \"ebfe30d0-c50c-4607-9e90-4d4ce5cb3691\"\r\n }\r\n}" + \ \"uniqueId\": \"bfb1aba1-eca4-4254-9dc4-b5623bfeae21\"\r\n }\r\n}" headers: Cache-Control: - no-cache @@ -193,28 +193,28 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/LowCostGet3Min;14997,Microsoft.Compute/LowCostGet30Min;119997 + - Microsoft.Compute/LowCostGet3Min;14998,Microsoft.Compute/LowCostGet30Min;119996 X-Ms-Served-By: - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 status: 200 OK code: 200 duration: "" - request: - body: '{"location":"westus2","name":"asotest-ss-xsdrzf","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":64}}' + body: '{"location":"westus2","name":"asotest-snapshot-xsdrzf","properties":{"creationData":{"createOption":"Empty"},"diskSizeGB":64}}' form: {} headers: Accept: - application/json Content-Length: - - "120" + - "126" Content-Type: - application/json Test-Request-Attempt: - "1" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf?api-version=2020-09-30 method: PUT response: - body: "{\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"location\": \"westus2\",\r\n + body: "{\r\n \"name\": \"asotest-snapshot-xsdrzf\",\r\n \"location\": \"westus2\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"provisioningState\": @@ -222,17 +222,17 @@ interactions: {},\r\n \"faultDomain\": 0\r\n }\r\n}" headers: Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/131389d4-1519-4f24-a3d1-f837654c6e1e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/cc5b9a87-2e62-4f84-aabc-5bcf8f6dbda0?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 Cache-Control: - no-cache Content-Length: - - "364" + - "370" Content-Type: - application/json; charset=utf-8 Expires: - "-1" Location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/131389d4-1519-4f24-a3d1-f837654c6e1e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/cc5b9a87-2e62-4f84-aabc-5bcf8f6dbda0?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 Pragma: - no-cache Retry-After: @@ -257,22 +257,23 @@ interactions: headers: Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/131389d4-1519-4f24-a3d1-f837654c6e1e?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/cc5b9a87-2e62-4f84-aabc-5bcf8f6dbda0?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 method: GET response: - body: "{\r\n \"startTime\": \"2022-02-13T22:03:34.634517+00:00\",\r\n \"endTime\": - \"2022-02-13T22:03:34.790765+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": - {\r\n \"output\": {\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf\",\r\n + body: "{\r\n \"startTime\": \"2022-02-14T03:02:50.7919098+00:00\",\r\n \"endTime\": + \"2022-02-14T03:02:51.0106649+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": + {\r\n \"output\": {\r\n \"name\": \"asotest-snapshot-xsdrzf\",\r\n \"id\": + \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf\",\r\n \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"encryption\": {\r\n \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": - \"2022-02-13T22:03:20.0719492+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-02-14T03:02:35.5262024+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 68719476736,\r\n - \ \"uniqueId\": \"ebfe30d0-c50c-4607-9e90-4d4ce5cb3691\"\r\n }\r\n}\r\n },\r\n - \ \"name\": \"131389d4-1519-4f24-a3d1-f837654c6e1e\"\r\n}" + \ \"uniqueId\": \"bfb1aba1-eca4-4254-9dc4-b5623bfeae21\"\r\n }\r\n}\r\n },\r\n + \ \"name\": \"cc5b9a87-2e62-4f84-aabc-5bcf8f6dbda0\"\r\n}" headers: Cache-Control: - no-cache @@ -306,19 +307,19 @@ interactions: - application/json Test-Request-Attempt: - "1" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf?api-version=2020-09-30 method: GET response: - body: "{\r\n \"name\": \"asotest-ss-xsdrzf\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf\",\r\n + body: "{\r\n \"name\": \"asotest-snapshot-xsdrzf\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf\",\r\n \ \"type\": \"Microsoft.Compute/snapshots\",\r\n \"location\": \"westus2\",\r\n \ \"sku\": {\r\n \"name\": \"Standard_LRS\",\r\n \"tier\": \"Standard\"\r\n \ },\r\n \"properties\": {\r\n \"creationData\": {\r\n \"createOption\": \"Empty\"\r\n },\r\n \"diskSizeGB\": 64,\r\n \"encryption\": {\r\n \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": - \"2022-02-13T22:03:20.0719492+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-02-14T03:02:35.5262024+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 68719476736,\r\n - \ \"uniqueId\": \"ebfe30d0-c50c-4607-9e90-4d4ce5cb3691\"\r\n }\r\n}" + \ \"uniqueId\": \"bfb1aba1-eca4-4254-9dc4-b5623bfeae21\"\r\n }\r\n}" headers: Cache-Control: - no-cache @@ -338,7 +339,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/LowCostGet3Min;14996,Microsoft.Compute/LowCostGet30Min;119996 + - Microsoft.Compute/LowCostGet3Min;14995,Microsoft.Compute/LowCostGet30Min;119993 X-Ms-Served-By: - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 status: 200 OK @@ -352,13 +353,13 @@ interactions: - application/json Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf?api-version=2020-09-30 method: DELETE response: body: "" headers: Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/c2e6bb30-5240-47a9-86bf-67c471e15072?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/c76f58b8-87eb-46b9-9eec-03a2fe8df3dc?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 Cache-Control: - no-cache Content-Length: @@ -366,7 +367,7 @@ interactions: Expires: - "-1" Location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/c2e6bb30-5240-47a9-86bf-67c471e15072?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/c76f58b8-87eb-46b9-9eec-03a2fe8df3dc?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 Pragma: - no-cache Server: @@ -423,16 +424,16 @@ interactions: - application/json Test-Request-Attempt: - "2" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf?api-version=2020-09-30 method: GET response: body: "{\r\n \"error\": {\r\n \"code\": \"NotFound\",\r\n \"message\": - \"Snapshot asotest-ss-xsdrzf is not found.\"\r\n }\r\n}" + \"Snapshot asotest-snapshot-xsdrzf is not found.\"\r\n }\r\n}" headers: Cache-Control: - no-cache Content-Length: - - "107" + - "113" Content-Type: - application/json; charset=utf-8 Expires: @@ -447,7 +448,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119993 + - Microsoft.Compute/LowCostGet3Min;14993,Microsoft.Compute/LowCostGet30Min;119991 X-Ms-Served-By: - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 status: 404 Not Found @@ -614,7 +615,7 @@ interactions: - application/json Test-Request-Attempt: - "3" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-ss-xsdrzf?api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-owoazy/providers/Microsoft.Compute/snapshots/asotest-snapshot-xsdrzf?api-version=2020-09-30 method: GET response: body: '{"error":{"code":"ResourceGroupNotFound","message":"Resource group ''asotest-rg-owoazy'' From 6d7300d61c8f8266c6594631c4333b66b9d27f57 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Wed, 16 Feb 2022 09:55:24 +1300 Subject: [PATCH 15/17] Update based on PR feedback --- Taskfile.yml | 1 - .../samples/compute/v1alpha1api20210701_image.yaml | 13 ------------- v2/internal/controllers/crd_compute_image_test.go | 5 +++++ .../controllers/crd_compute_snapshot_test.go | 2 ++ 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index bf60f0d0431..20c89bd6a96 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -252,7 +252,6 @@ tasks: deps: [controller:run-kustomize-for-envtest] cmds: # -race fails at the moment in controller-runtime - - go test -timeout 15m -run '{{default ".*" .TEST_FILTER}}' {{.VERBOSE}} ./internal/controllers vars: VERBOSE: diff --git a/v2/config/samples/compute/v1alpha1api20210701_image.yaml b/v2/config/samples/compute/v1alpha1api20210701_image.yaml index b5d728a6c8c..e1c96f3caf6 100644 --- a/v2/config/samples/compute/v1alpha1api20210701_image.yaml +++ b/v2/config/samples/compute/v1alpha1api20210701_image.yaml @@ -1,16 +1,3 @@ -apiVersion: compute.azure.com/v1alpha1api20201201 -kind: Snapshot -metadata: - name: aso-sample-snapshot - namespace: default -spec: - location: westcentralus - owner: - name: aso-sample-rg - creationData: - creatOption: empty - diskSizeGB: 64 ---- apiVersion: compute.azure.com/v1alpha1api20210701 kind: Image metadata: diff --git a/v2/internal/controllers/crd_compute_image_test.go b/v2/internal/controllers/crd_compute_image_test.go index 5e7fa82bbfc..5978b6b31b9 100644 --- a/v2/internal/controllers/crd_compute_image_test.go +++ b/v2/internal/controllers/crd_compute_image_test.go @@ -67,6 +67,11 @@ func Test_Compute_Image_CRUD(t *testing.T) { tc.CreateResourceAndWait(image) tc.Expect(image.Status.Id).ToNot(BeNil()) + tc.Expect(image.Status.StorageProfile).ToNot(BeNil()) + tc.Expect(image.Status.StorageProfile.OsDisk).ToNot(BeNil()) + tc.Expect(*image.Status.StorageProfile.OsDisk.DiskSizeGB).To(Equal(*image.Spec.StorageProfile.OsDisk.DiskSizeGB)) + tc.Expect(image.Status.StorageProfile.OsDisk.OsType).To(Equal(image.Spec.StorageProfile.OsDisk.OsType)) + tc.Expect(image.Status.StorageProfile.OsDisk.OsState).To(Equal(image.Spec.StorageProfile.OsDisk.OsState)) imageARMId := *image.Status.Id tc.LogSection("Clean up") diff --git a/v2/internal/controllers/crd_compute_snapshot_test.go b/v2/internal/controllers/crd_compute_snapshot_test.go index 8e779ac9164..c6c7e962d7c 100644 --- a/v2/internal/controllers/crd_compute_snapshot_test.go +++ b/v2/internal/controllers/crd_compute_snapshot_test.go @@ -37,6 +37,8 @@ func Test_Compute_Snapshot_CRUD(t *testing.T) { tc.CreateResourceAndWait(snapshot) tc.Expect(snapshot.Status.Id).ToNot(BeNil()) + tc.Expect(*snapshot.Status.DiskSizeGB).To(Equal(*snapshot.Spec.DiskSizeGB)) + tc.Expect(*snapshot.Status.Location).To(Equal(snapshot.Spec.Location)) armId := *snapshot.Status.Id // Perform a simple patch to resize the disk From 1f8c2b76a3ad509459052f15a5753acafe09fd0e Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Wed, 16 Feb 2022 10:51:48 +1300 Subject: [PATCH 16/17] mend --- v2/internal/controllers/crd_compute_image_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2/internal/controllers/crd_compute_image_test.go b/v2/internal/controllers/crd_compute_image_test.go index 5978b6b31b9..acb783cf97e 100644 --- a/v2/internal/controllers/crd_compute_image_test.go +++ b/v2/internal/controllers/crd_compute_image_test.go @@ -70,8 +70,8 @@ func Test_Compute_Image_CRUD(t *testing.T) { tc.Expect(image.Status.StorageProfile).ToNot(BeNil()) tc.Expect(image.Status.StorageProfile.OsDisk).ToNot(BeNil()) tc.Expect(*image.Status.StorageProfile.OsDisk.DiskSizeGB).To(Equal(*image.Spec.StorageProfile.OsDisk.DiskSizeGB)) - tc.Expect(image.Status.StorageProfile.OsDisk.OsType).To(Equal(image.Spec.StorageProfile.OsDisk.OsType)) - tc.Expect(image.Status.StorageProfile.OsDisk.OsState).To(Equal(image.Spec.StorageProfile.OsDisk.OsState)) + tc.Expect(string(image.Status.StorageProfile.OsDisk.OsType)).To(Equal(string(image.Spec.StorageProfile.OsDisk.OsType))) + tc.Expect(string(image.Status.StorageProfile.OsDisk.OsState)).To(Equal(string(image.Spec.StorageProfile.OsDisk.OsState))) imageARMId := *image.Status.Id tc.LogSection("Clean up") From 46e8535b5fc3b7b43a2908dd11002f41d3d90271 Mon Sep 17 00:00:00 2001 From: Bevan Arps Date: Wed, 16 Feb 2022 10:57:29 +1300 Subject: [PATCH 17/17] Update recording --- .../recordings/Test_Compute_Image_CRUD.yaml | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml b/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml index 219071e4795..c80f2f18f93 100644 --- a/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml +++ b/v2/internal/controllers/recordings/Test_Compute_Image_CRUD.yaml @@ -86,7 +86,7 @@ interactions: \ \"isArmResource\": true\r\n }\r\n}" headers: Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9208528a-dc87-45aa-a25e-69d9f2679ce8?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/608ed98e-b27a-4b1e-8eb9-ea187592dad1?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 Cache-Control: - no-cache Content-Length: @@ -96,7 +96,7 @@ interactions: Expires: - "-1" Location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9208528a-dc87-45aa-a25e-69d9f2679ce8?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/608ed98e-b27a-4b1e-8eb9-ea187592dad1?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&monitor=true&api-version=2020-09-30 Pragma: - no-cache Retry-After: @@ -109,9 +109,9 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;999,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7997 + - Microsoft.Compute/HighCostSnapshotCreateHydrate3Min;999,Microsoft.Compute/HighCostSnapshotCreateHydrate30Min;7998 X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132834609333251693 status: 202 Accepted code: 202 duration: "" @@ -121,13 +121,13 @@ interactions: headers: Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/9208528a-dc87-45aa-a25e-69d9f2679ce8?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/DiskOperations/608ed98e-b27a-4b1e-8eb9-ea187592dad1?p=330bd1e4-9ec8-43c5-83fb-8151747429a9&api-version=2020-09-30 method: GET response: - body: "{\r\n \"startTime\": \"2022-02-13T23:46:32.4606651+00:00\",\r\n \"endTime\": - \"2022-02-13T23:46:32.6481673+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": - {\r\n \"output\": {\"name\":\"asotest-snapshot-ipdbqn\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn\",\"type\":\"Microsoft.Compute/snapshots\",\"location\":\"westus2\",\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"properties\":{\"creationData\":{\"createOption\":\"Empty\"},\"diskSizeGB\":32,\"encryption\":{\"type\":\"EncryptionAtRestWithPlatformKey\"},\"incremental\":false,\"networkAccessPolicy\":\"AllowAll\",\"timeCreated\":\"2022-02-13T23:46:32.4763243+00:00\",\"provisioningState\":\"Succeeded\",\"diskState\":\"Unattached\",\"diskSizeBytes\":34359738368,\"uniqueId\":\"cb0abd0d-7b25-4c91-922e-6b32bee0dcf3\"}}\r\n - \ },\r\n \"name\": \"9208528a-dc87-45aa-a25e-69d9f2679ce8\"\r\n}" + body: "{\r\n \"startTime\": \"2022-02-15T21:53:37.7430665+00:00\",\r\n \"endTime\": + \"2022-02-15T21:53:37.9305533+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"properties\": + {\r\n \"output\": {\"name\":\"asotest-snapshot-ipdbqn\",\"id\":\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/asotest-rg-ywquvq/providers/Microsoft.Compute/snapshots/asotest-snapshot-ipdbqn\",\"type\":\"Microsoft.Compute/snapshots\",\"location\":\"westus2\",\"sku\":{\"name\":\"Standard_LRS\",\"tier\":\"Standard\"},\"properties\":{\"creationData\":{\"createOption\":\"Empty\"},\"diskSizeGB\":32,\"encryption\":{\"type\":\"EncryptionAtRestWithPlatformKey\"},\"incremental\":false,\"networkAccessPolicy\":\"AllowAll\",\"timeCreated\":\"2022-02-15T21:53:37.7430665+00:00\",\"provisioningState\":\"Succeeded\",\"diskState\":\"Unattached\",\"diskSizeBytes\":34359738368,\"uniqueId\":\"b17c44f6-52f7-4812-8852-f71a57838d0b\"}}\r\n + \ },\r\n \"name\": \"608ed98e-b27a-4b1e-8eb9-ea187592dad1\"\r\n}" headers: Cache-Control: - no-cache @@ -147,9 +147,9 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/GetOperation3Min;49998,Microsoft.Compute/GetOperation30Min;399988 + - Microsoft.Compute/GetOperation3Min;49998,Microsoft.Compute/GetOperation30Min;399991 X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132834609333251693 status: 200 OK code: 200 duration: "" @@ -171,9 +171,9 @@ interactions: \"Empty\"\r\n },\r\n \"diskSizeGB\": 32,\r\n \"encryption\": {\r\n \ \"type\": \"EncryptionAtRestWithPlatformKey\"\r\n },\r\n \"incremental\": false,\r\n \"networkAccessPolicy\": \"AllowAll\",\r\n \"timeCreated\": - \"2022-02-13T23:46:32.4763243+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n + \"2022-02-15T21:53:37.7430665+00:00\",\r\n \"provisioningState\": \"Succeeded\",\r\n \ \"diskState\": \"Unattached\",\r\n \"diskSizeBytes\": 34359738368,\r\n - \ \"uniqueId\": \"cb0abd0d-7b25-4c91-922e-6b32bee0dcf3\"\r\n }\r\n}" + \ \"uniqueId\": \"b17c44f6-52f7-4812-8852-f71a57838d0b\"\r\n }\r\n}" headers: Cache-Control: - no-cache @@ -193,9 +193,9 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/LowCostGet3Min;14998,Microsoft.Compute/LowCostGet30Min;119987 + - Microsoft.Compute/LowCostGet3Min;14998,Microsoft.Compute/LowCostGet30Min;119992 X-Ms-Served-By: - - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132754234314773538 + - 330bd1e4-9ec8-43c5-83fb-8151747429a9_132834609333251693 status: 200 OK code: 200 duration: "" @@ -227,7 +227,7 @@ interactions: Azure-Asyncnotification: - Enabled Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/21aad6e5-0bb1-43e8-a1a4-ee6754d43717?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/34990551-b7b6-4042-9154-a5db21d6cd6e?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 Cache-Control: - no-cache Content-Length: @@ -246,7 +246,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/CreateImages3Min;39,Microsoft.Compute/CreateImages30Min;196 + - Microsoft.Compute/CreateImages3Min;39,Microsoft.Compute/CreateImages30Min;198 status: 201 Created code: 201 duration: "" @@ -256,12 +256,12 @@ interactions: headers: Test-Request-Attempt: - "0" - url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/21aad6e5-0bb1-43e8-a1a4-ee6754d43717?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 + url: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/34990551-b7b6-4042-9154-a5db21d6cd6e?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 method: GET response: - body: "{\r\n \"startTime\": \"2022-02-13T23:46:54.5013272+00:00\",\r\n \"endTime\": - \"2022-02-13T23:46:59.6419286+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"name\": - \"21aad6e5-0bb1-43e8-a1a4-ee6754d43717\"\r\n}" + body: "{\r\n \"startTime\": \"2022-02-15T21:53:57.3220071+00:00\",\r\n \"endTime\": + \"2022-02-15T21:54:02.4157396+00:00\",\r\n \"status\": \"Succeeded\",\r\n \"name\": + \"34990551-b7b6-4042-9154-a5db21d6cd6e\"\r\n}" headers: Cache-Control: - no-cache @@ -324,7 +324,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/GetImages3Min;358,Microsoft.Compute/GetImages30Min;1791 + - Microsoft.Compute/GetImages3Min;358,Microsoft.Compute/GetImages30Min;1792 status: 200 OK code: 200 duration: "" @@ -344,7 +344,7 @@ interactions: Azure-Asyncnotification: - Enabled Azure-Asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/17cee97c-c10f-4998-a45e-6763bdcb07f0?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/4c77892c-ce01-4a09-a5e6-c8373e445f7e?p=b26caeba-1a35-4884-92ce-d47b44b28157&api-version=2021-07-01 Cache-Control: - no-cache Content-Length: @@ -352,7 +352,7 @@ interactions: Expires: - "-1" Location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/17cee97c-c10f-4998-a45e-6763bdcb07f0?p=b26caeba-1a35-4884-92ce-d47b44b28157&monitor=true&api-version=2021-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Compute/locations/westus2/operations/4c77892c-ce01-4a09-a5e6-c8373e445f7e?p=b26caeba-1a35-4884-92ce-d47b44b28157&monitor=true&api-version=2021-07-01 Pragma: - no-cache Server: @@ -363,7 +363,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/DeleteImages3Min;119,Microsoft.Compute/DeleteImages30Min;597 + - Microsoft.Compute/DeleteImages3Min;119,Microsoft.Compute/DeleteImages30Min;598 status: 202 Accepted code: 202 duration: "" @@ -431,7 +431,7 @@ interactions: X-Content-Type-Options: - nosniff X-Ms-Ratelimit-Remaining-Resource: - - Microsoft.Compute/GetImages3Min;357,Microsoft.Compute/GetImages30Min;1790 + - Microsoft.Compute/GetImages3Min;357,Microsoft.Compute/GetImages30Min;1791 status: 404 Not Found code: 404 duration: ""