// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package storage

import (
	"fmt"
	storage "github.com/Azure/azure-service-operator/v2/api/keyvault/v1api20230701/storage"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/secrets"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,keyvault}
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Storage version of v1api20210401preview.Vault
// Generator information:
// - Generated from: /keyvault/resource-manager/Microsoft.KeyVault/preview/2021-04-01-preview/keyvault.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
type Vault struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Vault_Spec   `json:"spec,omitempty"`
	Status            Vault_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Vault{}

// GetConditions returns the conditions of the resource
func (vault *Vault) GetConditions() conditions.Conditions {
	return vault.Status.Conditions
}

// SetConditions sets the conditions on the resource status
func (vault *Vault) SetConditions(conditions conditions.Conditions) {
	vault.Status.Conditions = conditions
}

var _ conversion.Convertible = &Vault{}

// ConvertFrom populates our Vault from the provided hub Vault
func (vault *Vault) ConvertFrom(hub conversion.Hub) error {
	source, ok := hub.(*storage.Vault)
	if !ok {
		return fmt.Errorf("expected keyvault/v1api20230701/storage/Vault but received %T instead", hub)
	}

	return vault.AssignProperties_From_Vault(source)
}

// ConvertTo populates the provided hub Vault from our Vault
func (vault *Vault) ConvertTo(hub conversion.Hub) error {
	destination, ok := hub.(*storage.Vault)
	if !ok {
		return fmt.Errorf("expected keyvault/v1api20230701/storage/Vault but received %T instead", hub)
	}

	return vault.AssignProperties_To_Vault(destination)
}

var _ configmaps.Exporter = &Vault{}

// ConfigMapDestinationExpressions returns the Spec.OperatorSpec.ConfigMapExpressions property
func (vault *Vault) ConfigMapDestinationExpressions() []*core.DestinationExpression {
	if vault.Spec.OperatorSpec == nil {
		return nil
	}
	return vault.Spec.OperatorSpec.ConfigMapExpressions
}

var _ secrets.Exporter = &Vault{}

// SecretDestinationExpressions returns the Spec.OperatorSpec.SecretExpressions property
func (vault *Vault) SecretDestinationExpressions() []*core.DestinationExpression {
	if vault.Spec.OperatorSpec == nil {
		return nil
	}
	return vault.Spec.OperatorSpec.SecretExpressions
}

var _ genruntime.KubernetesResource = &Vault{}

// AzureName returns the Azure name of the resource
func (vault *Vault) AzureName() string {
	return vault.Spec.AzureName
}

// GetAPIVersion returns the ARM API version of the resource. This is always "2021-04-01-preview"
func (vault Vault) GetAPIVersion() string {
	return "2021-04-01-preview"
}

// GetResourceScope returns the scope of the resource
func (vault *Vault) GetResourceScope() genruntime.ResourceScope {
	return genruntime.ResourceScopeResourceGroup
}

// GetSpec returns the specification of this resource
func (vault *Vault) GetSpec() genruntime.ConvertibleSpec {
	return &vault.Spec
}

// GetStatus returns the status of this resource
func (vault *Vault) GetStatus() genruntime.ConvertibleStatus {
	return &vault.Status
}

// GetSupportedOperations returns the operations supported by the resource
func (vault *Vault) GetSupportedOperations() []genruntime.ResourceOperation {
	return []genruntime.ResourceOperation{
		genruntime.ResourceOperationDelete,
		genruntime.ResourceOperationGet,
		genruntime.ResourceOperationPut,
	}
}

// GetType returns the ARM Type of the resource. This is always "Microsoft.KeyVault/vaults"
func (vault *Vault) GetType() string {
	return "Microsoft.KeyVault/vaults"
}

// NewEmptyStatus returns a new empty (blank) status
func (vault *Vault) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Vault_STATUS{}
}

// Owner returns the ResourceReference of the owner
func (vault *Vault) Owner() *genruntime.ResourceReference {
	if vault.Spec.Owner == nil {
		return nil
	}

	group, kind := genruntime.LookupOwnerGroupKind(vault.Spec)
	return vault.Spec.Owner.AsResourceReference(group, kind)
}

// SetStatus sets the status of this resource
func (vault *Vault) SetStatus(status genruntime.ConvertibleStatus) error {
	// If we have exactly the right type of status, assign it
	if st, ok := status.(*Vault_STATUS); ok {
		vault.Status = *st
		return nil
	}

	// Convert status to required version
	var st Vault_STATUS
	err := status.ConvertStatusTo(&st)
	if err != nil {
		return eris.Wrap(err, "failed to convert status")
	}

	vault.Status = st
	return nil
}

// AssignProperties_From_Vault populates our Vault from the provided source Vault
func (vault *Vault) AssignProperties_From_Vault(source *storage.Vault) error {

	// ObjectMeta
	vault.ObjectMeta = *source.ObjectMeta.DeepCopy()

	// Spec
	var spec Vault_Spec
	err := spec.AssignProperties_From_Vault_Spec(&source.Spec)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_From_Vault_Spec() to populate field Spec")
	}
	vault.Spec = spec

	// Status
	var status Vault_STATUS
	err = status.AssignProperties_From_Vault_STATUS(&source.Status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_From_Vault_STATUS() to populate field Status")
	}
	vault.Status = status

	// Invoke the augmentConversionForVault interface (if implemented) to customize the conversion
	var vaultAsAny any = vault
	if augmentedVault, ok := vaultAsAny.(augmentConversionForVault); ok {
		err := augmentedVault.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Vault populates the provided destination Vault from our Vault
func (vault *Vault) AssignProperties_To_Vault(destination *storage.Vault) error {

	// ObjectMeta
	destination.ObjectMeta = *vault.ObjectMeta.DeepCopy()

	// Spec
	var spec storage.Vault_Spec
	err := vault.Spec.AssignProperties_To_Vault_Spec(&spec)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_Vault_Spec() to populate field Spec")
	}
	destination.Spec = spec

	// Status
	var status storage.Vault_STATUS
	err = vault.Status.AssignProperties_To_Vault_STATUS(&status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_Vault_STATUS() to populate field Status")
	}
	destination.Status = status

	// Invoke the augmentConversionForVault interface (if implemented) to customize the conversion
	var vaultAsAny any = vault
	if augmentedVault, ok := vaultAsAny.(augmentConversionForVault); ok {
		err := augmentedVault.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// OriginalGVK returns a GroupValueKind for the original API version used to create the resource
func (vault *Vault) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: vault.Spec.OriginalVersion,
		Kind:    "Vault",
	}
}

// +kubebuilder:object:root=true
// Storage version of v1api20210401preview.Vault
// Generator information:
// - Generated from: /keyvault/resource-manager/Microsoft.KeyVault/preview/2021-04-01-preview/keyvault.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}
type VaultList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Vault `json:"items"`
}

// Storage version of v1api20210401preview.APIVersion
// +kubebuilder:validation:Enum={"2021-04-01-preview"}
type APIVersion string

const APIVersion_Value = APIVersion("2021-04-01-preview")

type augmentConversionForVault interface {
	AssignPropertiesFrom(src *storage.Vault) error
	AssignPropertiesTo(dst *storage.Vault) error
}

// Storage version of v1api20210401preview.Vault_Spec
type Vault_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,omitempty"`
	Location        *string            `json:"location,omitempty"`
	OperatorSpec    *VaultOperatorSpec `json:"operatorSpec,omitempty"`
	OriginalVersion string             `json:"originalVersion,omitempty"`

	// +kubebuilder:validation:Required
	// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
	// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
	// reference to a resources.azure.com/ResourceGroup resource
	Owner       *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"`
	Properties  *VaultProperties                   `json:"properties,omitempty"`
	PropertyBag genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	Tags        map[string]string                  `json:"tags,omitempty"`
}

var _ genruntime.ConvertibleSpec = &Vault_Spec{}

// ConvertSpecFrom populates our Vault_Spec from the provided source
func (vault *Vault_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	src, ok := source.(*storage.Vault_Spec)
	if ok {
		// Populate our instance from source
		return vault.AssignProperties_From_Vault_Spec(src)
	}

	// Convert to an intermediate form
	src = &storage.Vault_Spec{}
	err := src.ConvertSpecFrom(source)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertSpecFrom()")
	}

	// Update our instance from src
	err = vault.AssignProperties_From_Vault_Spec(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecFrom()")
	}

	return nil
}

// ConvertSpecTo populates the provided destination from our Vault_Spec
func (vault *Vault_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	dst, ok := destination.(*storage.Vault_Spec)
	if ok {
		// Populate destination from our instance
		return vault.AssignProperties_To_Vault_Spec(dst)
	}

	// Convert to an intermediate form
	dst = &storage.Vault_Spec{}
	err := vault.AssignProperties_To_Vault_Spec(dst)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertSpecTo()")
	}

	// Update dst from our instance
	err = dst.ConvertSpecTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecTo()")
	}

	return nil
}

// AssignProperties_From_Vault_Spec populates our Vault_Spec from the provided source Vault_Spec
func (vault *Vault_Spec) AssignProperties_From_Vault_Spec(source *storage.Vault_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AzureName
	vault.AzureName = source.AzureName

	// Location
	vault.Location = genruntime.ClonePointerToString(source.Location)

	// OperatorSpec
	if source.OperatorSpec != nil {
		var operatorSpec VaultOperatorSpec
		err := operatorSpec.AssignProperties_From_VaultOperatorSpec(source.OperatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_VaultOperatorSpec() to populate field OperatorSpec")
		}
		vault.OperatorSpec = &operatorSpec
	} else {
		vault.OperatorSpec = nil
	}

	// OriginalVersion
	vault.OriginalVersion = source.OriginalVersion

	// Owner
	if source.Owner != nil {
		owner := source.Owner.Copy()
		vault.Owner = &owner
	} else {
		vault.Owner = nil
	}

	// Properties
	if source.Properties != nil {
		var property VaultProperties
		err := property.AssignProperties_From_VaultProperties(source.Properties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_VaultProperties() to populate field Properties")
		}
		vault.Properties = &property
	} else {
		vault.Properties = nil
	}

	// Tags
	vault.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// Update the property bag
	if len(propertyBag) > 0 {
		vault.PropertyBag = propertyBag
	} else {
		vault.PropertyBag = nil
	}

	// Invoke the augmentConversionForVault_Spec interface (if implemented) to customize the conversion
	var vaultAsAny any = vault
	if augmentedVault, ok := vaultAsAny.(augmentConversionForVault_Spec); ok {
		err := augmentedVault.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Vault_Spec populates the provided destination Vault_Spec from our Vault_Spec
func (vault *Vault_Spec) AssignProperties_To_Vault_Spec(destination *storage.Vault_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(vault.PropertyBag)

	// AzureName
	destination.AzureName = vault.AzureName

	// Location
	destination.Location = genruntime.ClonePointerToString(vault.Location)

	// OperatorSpec
	if vault.OperatorSpec != nil {
		var operatorSpec storage.VaultOperatorSpec
		err := vault.OperatorSpec.AssignProperties_To_VaultOperatorSpec(&operatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_VaultOperatorSpec() to populate field OperatorSpec")
		}
		destination.OperatorSpec = &operatorSpec
	} else {
		destination.OperatorSpec = nil
	}

	// OriginalVersion
	destination.OriginalVersion = vault.OriginalVersion

	// Owner
	if vault.Owner != nil {
		owner := vault.Owner.Copy()
		destination.Owner = &owner
	} else {
		destination.Owner = nil
	}

	// Properties
	if vault.Properties != nil {
		var property storage.VaultProperties
		err := vault.Properties.AssignProperties_To_VaultProperties(&property)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_VaultProperties() to populate field Properties")
		}
		destination.Properties = &property
	} else {
		destination.Properties = nil
	}

	// Tags
	destination.Tags = genruntime.CloneMapOfStringToString(vault.Tags)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForVault_Spec interface (if implemented) to customize the conversion
	var vaultAsAny any = vault
	if augmentedVault, ok := vaultAsAny.(augmentConversionForVault_Spec); ok {
		err := augmentedVault.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.Vault_STATUS
// Resource information with extended details.
type Vault_STATUS struct {
	Conditions  []conditions.Condition  `json:"conditions,omitempty"`
	Id          *string                 `json:"id,omitempty"`
	Location    *string                 `json:"location,omitempty"`
	Name        *string                 `json:"name,omitempty"`
	Properties  *VaultProperties_STATUS `json:"properties,omitempty"`
	PropertyBag genruntime.PropertyBag  `json:"$propertyBag,omitempty"`
	SystemData  *SystemData_STATUS      `json:"systemData,omitempty"`
	Tags        map[string]string       `json:"tags,omitempty"`
	Type        *string                 `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Vault_STATUS{}

// ConvertStatusFrom populates our Vault_STATUS from the provided source
func (vault *Vault_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	src, ok := source.(*storage.Vault_STATUS)
	if ok {
		// Populate our instance from source
		return vault.AssignProperties_From_Vault_STATUS(src)
	}

	// Convert to an intermediate form
	src = &storage.Vault_STATUS{}
	err := src.ConvertStatusFrom(source)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertStatusFrom()")
	}

	// Update our instance from src
	err = vault.AssignProperties_From_Vault_STATUS(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusFrom()")
	}

	return nil
}

// ConvertStatusTo populates the provided destination from our Vault_STATUS
func (vault *Vault_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	dst, ok := destination.(*storage.Vault_STATUS)
	if ok {
		// Populate destination from our instance
		return vault.AssignProperties_To_Vault_STATUS(dst)
	}

	// Convert to an intermediate form
	dst = &storage.Vault_STATUS{}
	err := vault.AssignProperties_To_Vault_STATUS(dst)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertStatusTo()")
	}

	// Update dst from our instance
	err = dst.ConvertStatusTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusTo()")
	}

	return nil
}

// AssignProperties_From_Vault_STATUS populates our Vault_STATUS from the provided source Vault_STATUS
func (vault *Vault_STATUS) AssignProperties_From_Vault_STATUS(source *storage.Vault_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Conditions
	vault.Conditions = genruntime.CloneSliceOfCondition(source.Conditions)

	// Id
	vault.Id = genruntime.ClonePointerToString(source.Id)

	// Location
	vault.Location = genruntime.ClonePointerToString(source.Location)

	// Name
	vault.Name = genruntime.ClonePointerToString(source.Name)

	// Properties
	if source.Properties != nil {
		var property VaultProperties_STATUS
		err := property.AssignProperties_From_VaultProperties_STATUS(source.Properties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_VaultProperties_STATUS() to populate field Properties")
		}
		vault.Properties = &property
	} else {
		vault.Properties = nil
	}

	// SystemData
	if source.SystemData != nil {
		var systemDatum SystemData_STATUS
		err := systemDatum.AssignProperties_From_SystemData_STATUS(source.SystemData)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData")
		}
		vault.SystemData = &systemDatum
	} else {
		vault.SystemData = nil
	}

	// Tags
	vault.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// Type
	vault.Type = genruntime.ClonePointerToString(source.Type)

	// Update the property bag
	if len(propertyBag) > 0 {
		vault.PropertyBag = propertyBag
	} else {
		vault.PropertyBag = nil
	}

	// Invoke the augmentConversionForVault_STATUS interface (if implemented) to customize the conversion
	var vaultAsAny any = vault
	if augmentedVault, ok := vaultAsAny.(augmentConversionForVault_STATUS); ok {
		err := augmentedVault.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Vault_STATUS populates the provided destination Vault_STATUS from our Vault_STATUS
func (vault *Vault_STATUS) AssignProperties_To_Vault_STATUS(destination *storage.Vault_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(vault.PropertyBag)

	// Conditions
	destination.Conditions = genruntime.CloneSliceOfCondition(vault.Conditions)

	// Id
	destination.Id = genruntime.ClonePointerToString(vault.Id)

	// Location
	destination.Location = genruntime.ClonePointerToString(vault.Location)

	// Name
	destination.Name = genruntime.ClonePointerToString(vault.Name)

	// Properties
	if vault.Properties != nil {
		var property storage.VaultProperties_STATUS
		err := vault.Properties.AssignProperties_To_VaultProperties_STATUS(&property)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_VaultProperties_STATUS() to populate field Properties")
		}
		destination.Properties = &property
	} else {
		destination.Properties = nil
	}

	// SystemData
	if vault.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := vault.SystemData.AssignProperties_To_SystemData_STATUS(&systemDatum)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SystemData_STATUS() to populate field SystemData")
		}
		destination.SystemData = &systemDatum
	} else {
		destination.SystemData = nil
	}

	// Tags
	destination.Tags = genruntime.CloneMapOfStringToString(vault.Tags)

	// Type
	destination.Type = genruntime.ClonePointerToString(vault.Type)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForVault_STATUS interface (if implemented) to customize the conversion
	var vaultAsAny any = vault
	if augmentedVault, ok := vaultAsAny.(augmentConversionForVault_STATUS); ok {
		err := augmentedVault.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForVault_Spec interface {
	AssignPropertiesFrom(src *storage.Vault_Spec) error
	AssignPropertiesTo(dst *storage.Vault_Spec) error
}

type augmentConversionForVault_STATUS interface {
	AssignPropertiesFrom(src *storage.Vault_STATUS) error
	AssignPropertiesTo(dst *storage.Vault_STATUS) error
}

// Storage version of v1api20210401preview.SystemData_STATUS
// Metadata pertaining to creation and last modification of the key vault resource.
type SystemData_STATUS struct {
	CreatedAt          *string                `json:"createdAt,omitempty"`
	CreatedBy          *string                `json:"createdBy,omitempty"`
	CreatedByType      *string                `json:"createdByType,omitempty"`
	LastModifiedAt     *string                `json:"lastModifiedAt,omitempty"`
	LastModifiedBy     *string                `json:"lastModifiedBy,omitempty"`
	LastModifiedByType *string                `json:"lastModifiedByType,omitempty"`
	PropertyBag        genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_SystemData_STATUS populates our SystemData_STATUS from the provided source SystemData_STATUS
func (data *SystemData_STATUS) AssignProperties_From_SystemData_STATUS(source *storage.SystemData_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// CreatedAt
	data.CreatedAt = genruntime.ClonePointerToString(source.CreatedAt)

	// CreatedBy
	data.CreatedBy = genruntime.ClonePointerToString(source.CreatedBy)

	// CreatedByType
	data.CreatedByType = genruntime.ClonePointerToString(source.CreatedByType)

	// LastModifiedAt
	data.LastModifiedAt = genruntime.ClonePointerToString(source.LastModifiedAt)

	// LastModifiedBy
	data.LastModifiedBy = genruntime.ClonePointerToString(source.LastModifiedBy)

	// LastModifiedByType
	data.LastModifiedByType = genruntime.ClonePointerToString(source.LastModifiedByType)

	// Update the property bag
	if len(propertyBag) > 0 {
		data.PropertyBag = propertyBag
	} else {
		data.PropertyBag = nil
	}

	// Invoke the augmentConversionForSystemData_STATUS interface (if implemented) to customize the conversion
	var dataAsAny any = data
	if augmentedData, ok := dataAsAny.(augmentConversionForSystemData_STATUS); ok {
		err := augmentedData.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_SystemData_STATUS populates the provided destination SystemData_STATUS from our SystemData_STATUS
func (data *SystemData_STATUS) AssignProperties_To_SystemData_STATUS(destination *storage.SystemData_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(data.PropertyBag)

	// CreatedAt
	destination.CreatedAt = genruntime.ClonePointerToString(data.CreatedAt)

	// CreatedBy
	destination.CreatedBy = genruntime.ClonePointerToString(data.CreatedBy)

	// CreatedByType
	destination.CreatedByType = genruntime.ClonePointerToString(data.CreatedByType)

	// LastModifiedAt
	destination.LastModifiedAt = genruntime.ClonePointerToString(data.LastModifiedAt)

	// LastModifiedBy
	destination.LastModifiedBy = genruntime.ClonePointerToString(data.LastModifiedBy)

	// LastModifiedByType
	destination.LastModifiedByType = genruntime.ClonePointerToString(data.LastModifiedByType)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForSystemData_STATUS interface (if implemented) to customize the conversion
	var dataAsAny any = data
	if augmentedData, ok := dataAsAny.(augmentConversionForSystemData_STATUS); ok {
		err := augmentedData.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.VaultOperatorSpec
// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type VaultOperatorSpec struct {
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`
	PropertyBag          genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	SecretExpressions    []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// AssignProperties_From_VaultOperatorSpec populates our VaultOperatorSpec from the provided source VaultOperatorSpec
func (operator *VaultOperatorSpec) AssignProperties_From_VaultOperatorSpec(source *storage.VaultOperatorSpec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// ConfigMapExpressions
	if source.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(source.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range source.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		operator.ConfigMapExpressions = configMapExpressionList
	} else {
		operator.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if source.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(source.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range source.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		operator.SecretExpressions = secretExpressionList
	} else {
		operator.SecretExpressions = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		operator.PropertyBag = propertyBag
	} else {
		operator.PropertyBag = nil
	}

	// Invoke the augmentConversionForVaultOperatorSpec interface (if implemented) to customize the conversion
	var operatorAsAny any = operator
	if augmentedOperator, ok := operatorAsAny.(augmentConversionForVaultOperatorSpec); ok {
		err := augmentedOperator.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_VaultOperatorSpec populates the provided destination VaultOperatorSpec from our VaultOperatorSpec
func (operator *VaultOperatorSpec) AssignProperties_To_VaultOperatorSpec(destination *storage.VaultOperatorSpec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(operator.PropertyBag)

	// ConfigMapExpressions
	if operator.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(operator.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range operator.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		destination.ConfigMapExpressions = configMapExpressionList
	} else {
		destination.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if operator.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(operator.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range operator.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		destination.SecretExpressions = secretExpressionList
	} else {
		destination.SecretExpressions = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForVaultOperatorSpec interface (if implemented) to customize the conversion
	var operatorAsAny any = operator
	if augmentedOperator, ok := operatorAsAny.(augmentConversionForVaultOperatorSpec); ok {
		err := augmentedOperator.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.VaultProperties
// Properties of the vault
type VaultProperties struct {
	AccessPolicies               []AccessPolicyEntry            `json:"accessPolicies,omitempty"`
	CreateMode                   *string                        `json:"createMode,omitempty"`
	EnablePurgeProtection        *bool                          `json:"enablePurgeProtection,omitempty"`
	EnableRbacAuthorization      *bool                          `json:"enableRbacAuthorization,omitempty"`
	EnableSoftDelete             *bool                          `json:"enableSoftDelete,omitempty"`
	EnabledForDeployment         *bool                          `json:"enabledForDeployment,omitempty"`
	EnabledForDiskEncryption     *bool                          `json:"enabledForDiskEncryption,omitempty"`
	EnabledForTemplateDeployment *bool                          `json:"enabledForTemplateDeployment,omitempty"`
	NetworkAcls                  *NetworkRuleSet                `json:"networkAcls,omitempty"`
	PropertyBag                  genruntime.PropertyBag         `json:"$propertyBag,omitempty"`
	ProvisioningState            *string                        `json:"provisioningState,omitempty"`
	Sku                          *Sku                           `json:"sku,omitempty"`
	SoftDeleteRetentionInDays    *int                           `json:"softDeleteRetentionInDays,omitempty"`
	TenantId                     *string                        `json:"tenantId,omitempty" optionalConfigMapPair:"TenantId"`
	TenantIdFromConfig           *genruntime.ConfigMapReference `json:"tenantIdFromConfig,omitempty" optionalConfigMapPair:"TenantId"`
	VaultUri                     *string                        `json:"vaultUri,omitempty"`
}

// AssignProperties_From_VaultProperties populates our VaultProperties from the provided source VaultProperties
func (properties *VaultProperties) AssignProperties_From_VaultProperties(source *storage.VaultProperties) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AccessPolicies
	if source.AccessPolicies != nil {
		accessPolicyList := make([]AccessPolicyEntry, len(source.AccessPolicies))
		for accessPolicyIndex, accessPolicyItem := range source.AccessPolicies {
			var accessPolicy AccessPolicyEntry
			err := accessPolicy.AssignProperties_From_AccessPolicyEntry(&accessPolicyItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_AccessPolicyEntry() to populate field AccessPolicies")
			}
			accessPolicyList[accessPolicyIndex] = accessPolicy
		}
		properties.AccessPolicies = accessPolicyList
	} else {
		properties.AccessPolicies = nil
	}

	// CreateMode
	properties.CreateMode = genruntime.ClonePointerToString(source.CreateMode)

	// EnablePurgeProtection
	if source.EnablePurgeProtection != nil {
		enablePurgeProtection := *source.EnablePurgeProtection
		properties.EnablePurgeProtection = &enablePurgeProtection
	} else {
		properties.EnablePurgeProtection = nil
	}

	// EnableRbacAuthorization
	if source.EnableRbacAuthorization != nil {
		enableRbacAuthorization := *source.EnableRbacAuthorization
		properties.EnableRbacAuthorization = &enableRbacAuthorization
	} else {
		properties.EnableRbacAuthorization = nil
	}

	// EnableSoftDelete
	if source.EnableSoftDelete != nil {
		enableSoftDelete := *source.EnableSoftDelete
		properties.EnableSoftDelete = &enableSoftDelete
	} else {
		properties.EnableSoftDelete = nil
	}

	// EnabledForDeployment
	if source.EnabledForDeployment != nil {
		enabledForDeployment := *source.EnabledForDeployment
		properties.EnabledForDeployment = &enabledForDeployment
	} else {
		properties.EnabledForDeployment = nil
	}

	// EnabledForDiskEncryption
	if source.EnabledForDiskEncryption != nil {
		enabledForDiskEncryption := *source.EnabledForDiskEncryption
		properties.EnabledForDiskEncryption = &enabledForDiskEncryption
	} else {
		properties.EnabledForDiskEncryption = nil
	}

	// EnabledForTemplateDeployment
	if source.EnabledForTemplateDeployment != nil {
		enabledForTemplateDeployment := *source.EnabledForTemplateDeployment
		properties.EnabledForTemplateDeployment = &enabledForTemplateDeployment
	} else {
		properties.EnabledForTemplateDeployment = nil
	}

	// NetworkAcls
	if source.NetworkAcls != nil {
		var networkAcl NetworkRuleSet
		err := networkAcl.AssignProperties_From_NetworkRuleSet(source.NetworkAcls)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NetworkRuleSet() to populate field NetworkAcls")
		}
		properties.NetworkAcls = &networkAcl
	} else {
		properties.NetworkAcls = nil
	}

	// ProvisioningState
	properties.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState)

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		propertyBag.Add("PublicNetworkAccess", *source.PublicNetworkAccess)
	} else {
		propertyBag.Remove("PublicNetworkAccess")
	}

	// Sku
	if source.Sku != nil {
		var sku Sku
		err := sku.AssignProperties_From_Sku(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Sku() to populate field Sku")
		}
		properties.Sku = &sku
	} else {
		properties.Sku = nil
	}

	// SoftDeleteRetentionInDays
	properties.SoftDeleteRetentionInDays = genruntime.ClonePointerToInt(source.SoftDeleteRetentionInDays)

	// TenantId
	properties.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// TenantIdFromConfig
	if source.TenantIdFromConfig != nil {
		tenantIdFromConfig := source.TenantIdFromConfig.Copy()
		properties.TenantIdFromConfig = &tenantIdFromConfig
	} else {
		properties.TenantIdFromConfig = nil
	}

	// VaultUri
	properties.VaultUri = genruntime.ClonePointerToString(source.VaultUri)

	// Update the property bag
	if len(propertyBag) > 0 {
		properties.PropertyBag = propertyBag
	} else {
		properties.PropertyBag = nil
	}

	// Invoke the augmentConversionForVaultProperties interface (if implemented) to customize the conversion
	var propertiesAsAny any = properties
	if augmentedProperties, ok := propertiesAsAny.(augmentConversionForVaultProperties); ok {
		err := augmentedProperties.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_VaultProperties populates the provided destination VaultProperties from our VaultProperties
func (properties *VaultProperties) AssignProperties_To_VaultProperties(destination *storage.VaultProperties) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(properties.PropertyBag)

	// AccessPolicies
	if properties.AccessPolicies != nil {
		accessPolicyList := make([]storage.AccessPolicyEntry, len(properties.AccessPolicies))
		for accessPolicyIndex, accessPolicyItem := range properties.AccessPolicies {
			var accessPolicy storage.AccessPolicyEntry
			err := accessPolicyItem.AssignProperties_To_AccessPolicyEntry(&accessPolicy)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_AccessPolicyEntry() to populate field AccessPolicies")
			}
			accessPolicyList[accessPolicyIndex] = accessPolicy
		}
		destination.AccessPolicies = accessPolicyList
	} else {
		destination.AccessPolicies = nil
	}

	// CreateMode
	destination.CreateMode = genruntime.ClonePointerToString(properties.CreateMode)

	// EnablePurgeProtection
	if properties.EnablePurgeProtection != nil {
		enablePurgeProtection := *properties.EnablePurgeProtection
		destination.EnablePurgeProtection = &enablePurgeProtection
	} else {
		destination.EnablePurgeProtection = nil
	}

	// EnableRbacAuthorization
	if properties.EnableRbacAuthorization != nil {
		enableRbacAuthorization := *properties.EnableRbacAuthorization
		destination.EnableRbacAuthorization = &enableRbacAuthorization
	} else {
		destination.EnableRbacAuthorization = nil
	}

	// EnableSoftDelete
	if properties.EnableSoftDelete != nil {
		enableSoftDelete := *properties.EnableSoftDelete
		destination.EnableSoftDelete = &enableSoftDelete
	} else {
		destination.EnableSoftDelete = nil
	}

	// EnabledForDeployment
	if properties.EnabledForDeployment != nil {
		enabledForDeployment := *properties.EnabledForDeployment
		destination.EnabledForDeployment = &enabledForDeployment
	} else {
		destination.EnabledForDeployment = nil
	}

	// EnabledForDiskEncryption
	if properties.EnabledForDiskEncryption != nil {
		enabledForDiskEncryption := *properties.EnabledForDiskEncryption
		destination.EnabledForDiskEncryption = &enabledForDiskEncryption
	} else {
		destination.EnabledForDiskEncryption = nil
	}

	// EnabledForTemplateDeployment
	if properties.EnabledForTemplateDeployment != nil {
		enabledForTemplateDeployment := *properties.EnabledForTemplateDeployment
		destination.EnabledForTemplateDeployment = &enabledForTemplateDeployment
	} else {
		destination.EnabledForTemplateDeployment = nil
	}

	// NetworkAcls
	if properties.NetworkAcls != nil {
		var networkAcl storage.NetworkRuleSet
		err := properties.NetworkAcls.AssignProperties_To_NetworkRuleSet(&networkAcl)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NetworkRuleSet() to populate field NetworkAcls")
		}
		destination.NetworkAcls = &networkAcl
	} else {
		destination.NetworkAcls = nil
	}

	// ProvisioningState
	destination.ProvisioningState = genruntime.ClonePointerToString(properties.ProvisioningState)

	// PublicNetworkAccess
	if propertyBag.Contains("PublicNetworkAccess") {
		var publicNetworkAccess string
		err := propertyBag.Pull("PublicNetworkAccess", &publicNetworkAccess)
		if err != nil {
			return eris.Wrap(err, "pulling 'PublicNetworkAccess' from propertyBag")
		}

		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// Sku
	if properties.Sku != nil {
		var sku storage.Sku
		err := properties.Sku.AssignProperties_To_Sku(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

	// SoftDeleteRetentionInDays
	destination.SoftDeleteRetentionInDays = genruntime.ClonePointerToInt(properties.SoftDeleteRetentionInDays)

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(properties.TenantId)

	// TenantIdFromConfig
	if properties.TenantIdFromConfig != nil {
		tenantIdFromConfig := properties.TenantIdFromConfig.Copy()
		destination.TenantIdFromConfig = &tenantIdFromConfig
	} else {
		destination.TenantIdFromConfig = nil
	}

	// VaultUri
	destination.VaultUri = genruntime.ClonePointerToString(properties.VaultUri)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForVaultProperties interface (if implemented) to customize the conversion
	var propertiesAsAny any = properties
	if augmentedProperties, ok := propertiesAsAny.(augmentConversionForVaultProperties); ok {
		err := augmentedProperties.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.VaultProperties_STATUS
// Properties of the vault
type VaultProperties_STATUS struct {
	AccessPolicies               []AccessPolicyEntry_STATUS             `json:"accessPolicies,omitempty"`
	CreateMode                   *string                                `json:"createMode,omitempty"`
	EnablePurgeProtection        *bool                                  `json:"enablePurgeProtection,omitempty"`
	EnableRbacAuthorization      *bool                                  `json:"enableRbacAuthorization,omitempty"`
	EnableSoftDelete             *bool                                  `json:"enableSoftDelete,omitempty"`
	EnabledForDeployment         *bool                                  `json:"enabledForDeployment,omitempty"`
	EnabledForDiskEncryption     *bool                                  `json:"enabledForDiskEncryption,omitempty"`
	EnabledForTemplateDeployment *bool                                  `json:"enabledForTemplateDeployment,omitempty"`
	HsmPoolResourceId            *string                                `json:"hsmPoolResourceId,omitempty"`
	NetworkAcls                  *NetworkRuleSet_STATUS                 `json:"networkAcls,omitempty"`
	PrivateEndpointConnections   []PrivateEndpointConnectionItem_STATUS `json:"privateEndpointConnections,omitempty"`
	PropertyBag                  genruntime.PropertyBag                 `json:"$propertyBag,omitempty"`
	ProvisioningState            *string                                `json:"provisioningState,omitempty"`
	Sku                          *Sku_STATUS                            `json:"sku,omitempty"`
	SoftDeleteRetentionInDays    *int                                   `json:"softDeleteRetentionInDays,omitempty"`
	TenantId                     *string                                `json:"tenantId,omitempty"`
	VaultUri                     *string                                `json:"vaultUri,omitempty"`
}

// AssignProperties_From_VaultProperties_STATUS populates our VaultProperties_STATUS from the provided source VaultProperties_STATUS
func (properties *VaultProperties_STATUS) AssignProperties_From_VaultProperties_STATUS(source *storage.VaultProperties_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AccessPolicies
	if source.AccessPolicies != nil {
		accessPolicyList := make([]AccessPolicyEntry_STATUS, len(source.AccessPolicies))
		for accessPolicyIndex, accessPolicyItem := range source.AccessPolicies {
			var accessPolicy AccessPolicyEntry_STATUS
			err := accessPolicy.AssignProperties_From_AccessPolicyEntry_STATUS(&accessPolicyItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_AccessPolicyEntry_STATUS() to populate field AccessPolicies")
			}
			accessPolicyList[accessPolicyIndex] = accessPolicy
		}
		properties.AccessPolicies = accessPolicyList
	} else {
		properties.AccessPolicies = nil
	}

	// CreateMode
	properties.CreateMode = genruntime.ClonePointerToString(source.CreateMode)

	// EnablePurgeProtection
	if source.EnablePurgeProtection != nil {
		enablePurgeProtection := *source.EnablePurgeProtection
		properties.EnablePurgeProtection = &enablePurgeProtection
	} else {
		properties.EnablePurgeProtection = nil
	}

	// EnableRbacAuthorization
	if source.EnableRbacAuthorization != nil {
		enableRbacAuthorization := *source.EnableRbacAuthorization
		properties.EnableRbacAuthorization = &enableRbacAuthorization
	} else {
		properties.EnableRbacAuthorization = nil
	}

	// EnableSoftDelete
	if source.EnableSoftDelete != nil {
		enableSoftDelete := *source.EnableSoftDelete
		properties.EnableSoftDelete = &enableSoftDelete
	} else {
		properties.EnableSoftDelete = nil
	}

	// EnabledForDeployment
	if source.EnabledForDeployment != nil {
		enabledForDeployment := *source.EnabledForDeployment
		properties.EnabledForDeployment = &enabledForDeployment
	} else {
		properties.EnabledForDeployment = nil
	}

	// EnabledForDiskEncryption
	if source.EnabledForDiskEncryption != nil {
		enabledForDiskEncryption := *source.EnabledForDiskEncryption
		properties.EnabledForDiskEncryption = &enabledForDiskEncryption
	} else {
		properties.EnabledForDiskEncryption = nil
	}

	// EnabledForTemplateDeployment
	if source.EnabledForTemplateDeployment != nil {
		enabledForTemplateDeployment := *source.EnabledForTemplateDeployment
		properties.EnabledForTemplateDeployment = &enabledForTemplateDeployment
	} else {
		properties.EnabledForTemplateDeployment = nil
	}

	// HsmPoolResourceId
	properties.HsmPoolResourceId = genruntime.ClonePointerToString(source.HsmPoolResourceId)

	// NetworkAcls
	if source.NetworkAcls != nil {
		var networkAcl NetworkRuleSet_STATUS
		err := networkAcl.AssignProperties_From_NetworkRuleSet_STATUS(source.NetworkAcls)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NetworkRuleSet_STATUS() to populate field NetworkAcls")
		}
		properties.NetworkAcls = &networkAcl
	} else {
		properties.NetworkAcls = nil
	}

	// PrivateEndpointConnections
	if source.PrivateEndpointConnections != nil {
		privateEndpointConnectionList := make([]PrivateEndpointConnectionItem_STATUS, len(source.PrivateEndpointConnections))
		for privateEndpointConnectionIndex, privateEndpointConnectionItem := range source.PrivateEndpointConnections {
			var privateEndpointConnection PrivateEndpointConnectionItem_STATUS
			err := privateEndpointConnection.AssignProperties_From_PrivateEndpointConnectionItem_STATUS(&privateEndpointConnectionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpointConnectionItem_STATUS() to populate field PrivateEndpointConnections")
			}
			privateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection
		}
		properties.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		properties.PrivateEndpointConnections = nil
	}

	// ProvisioningState
	properties.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState)

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		propertyBag.Add("PublicNetworkAccess", *source.PublicNetworkAccess)
	} else {
		propertyBag.Remove("PublicNetworkAccess")
	}

	// Sku
	if source.Sku != nil {
		var sku Sku_STATUS
		err := sku.AssignProperties_From_Sku_STATUS(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Sku_STATUS() to populate field Sku")
		}
		properties.Sku = &sku
	} else {
		properties.Sku = nil
	}

	// SoftDeleteRetentionInDays
	properties.SoftDeleteRetentionInDays = genruntime.ClonePointerToInt(source.SoftDeleteRetentionInDays)

	// TenantId
	properties.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// VaultUri
	properties.VaultUri = genruntime.ClonePointerToString(source.VaultUri)

	// Update the property bag
	if len(propertyBag) > 0 {
		properties.PropertyBag = propertyBag
	} else {
		properties.PropertyBag = nil
	}

	// Invoke the augmentConversionForVaultProperties_STATUS interface (if implemented) to customize the conversion
	var propertiesAsAny any = properties
	if augmentedProperties, ok := propertiesAsAny.(augmentConversionForVaultProperties_STATUS); ok {
		err := augmentedProperties.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_VaultProperties_STATUS populates the provided destination VaultProperties_STATUS from our VaultProperties_STATUS
func (properties *VaultProperties_STATUS) AssignProperties_To_VaultProperties_STATUS(destination *storage.VaultProperties_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(properties.PropertyBag)

	// AccessPolicies
	if properties.AccessPolicies != nil {
		accessPolicyList := make([]storage.AccessPolicyEntry_STATUS, len(properties.AccessPolicies))
		for accessPolicyIndex, accessPolicyItem := range properties.AccessPolicies {
			var accessPolicy storage.AccessPolicyEntry_STATUS
			err := accessPolicyItem.AssignProperties_To_AccessPolicyEntry_STATUS(&accessPolicy)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_AccessPolicyEntry_STATUS() to populate field AccessPolicies")
			}
			accessPolicyList[accessPolicyIndex] = accessPolicy
		}
		destination.AccessPolicies = accessPolicyList
	} else {
		destination.AccessPolicies = nil
	}

	// CreateMode
	destination.CreateMode = genruntime.ClonePointerToString(properties.CreateMode)

	// EnablePurgeProtection
	if properties.EnablePurgeProtection != nil {
		enablePurgeProtection := *properties.EnablePurgeProtection
		destination.EnablePurgeProtection = &enablePurgeProtection
	} else {
		destination.EnablePurgeProtection = nil
	}

	// EnableRbacAuthorization
	if properties.EnableRbacAuthorization != nil {
		enableRbacAuthorization := *properties.EnableRbacAuthorization
		destination.EnableRbacAuthorization = &enableRbacAuthorization
	} else {
		destination.EnableRbacAuthorization = nil
	}

	// EnableSoftDelete
	if properties.EnableSoftDelete != nil {
		enableSoftDelete := *properties.EnableSoftDelete
		destination.EnableSoftDelete = &enableSoftDelete
	} else {
		destination.EnableSoftDelete = nil
	}

	// EnabledForDeployment
	if properties.EnabledForDeployment != nil {
		enabledForDeployment := *properties.EnabledForDeployment
		destination.EnabledForDeployment = &enabledForDeployment
	} else {
		destination.EnabledForDeployment = nil
	}

	// EnabledForDiskEncryption
	if properties.EnabledForDiskEncryption != nil {
		enabledForDiskEncryption := *properties.EnabledForDiskEncryption
		destination.EnabledForDiskEncryption = &enabledForDiskEncryption
	} else {
		destination.EnabledForDiskEncryption = nil
	}

	// EnabledForTemplateDeployment
	if properties.EnabledForTemplateDeployment != nil {
		enabledForTemplateDeployment := *properties.EnabledForTemplateDeployment
		destination.EnabledForTemplateDeployment = &enabledForTemplateDeployment
	} else {
		destination.EnabledForTemplateDeployment = nil
	}

	// HsmPoolResourceId
	destination.HsmPoolResourceId = genruntime.ClonePointerToString(properties.HsmPoolResourceId)

	// NetworkAcls
	if properties.NetworkAcls != nil {
		var networkAcl storage.NetworkRuleSet_STATUS
		err := properties.NetworkAcls.AssignProperties_To_NetworkRuleSet_STATUS(&networkAcl)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NetworkRuleSet_STATUS() to populate field NetworkAcls")
		}
		destination.NetworkAcls = &networkAcl
	} else {
		destination.NetworkAcls = nil
	}

	// PrivateEndpointConnections
	if properties.PrivateEndpointConnections != nil {
		privateEndpointConnectionList := make([]storage.PrivateEndpointConnectionItem_STATUS, len(properties.PrivateEndpointConnections))
		for privateEndpointConnectionIndex, privateEndpointConnectionItem := range properties.PrivateEndpointConnections {
			var privateEndpointConnection storage.PrivateEndpointConnectionItem_STATUS
			err := privateEndpointConnectionItem.AssignProperties_To_PrivateEndpointConnectionItem_STATUS(&privateEndpointConnection)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PrivateEndpointConnectionItem_STATUS() to populate field PrivateEndpointConnections")
			}
			privateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection
		}
		destination.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		destination.PrivateEndpointConnections = nil
	}

	// ProvisioningState
	destination.ProvisioningState = genruntime.ClonePointerToString(properties.ProvisioningState)

	// PublicNetworkAccess
	if propertyBag.Contains("PublicNetworkAccess") {
		var publicNetworkAccess string
		err := propertyBag.Pull("PublicNetworkAccess", &publicNetworkAccess)
		if err != nil {
			return eris.Wrap(err, "pulling 'PublicNetworkAccess' from propertyBag")
		}

		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// Sku
	if properties.Sku != nil {
		var sku storage.Sku_STATUS
		err := properties.Sku.AssignProperties_To_Sku_STATUS(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku_STATUS() to populate field Sku")
		}
		destination.Sku = &sku
	} else {
		destination.Sku = nil
	}

	// SoftDeleteRetentionInDays
	destination.SoftDeleteRetentionInDays = genruntime.ClonePointerToInt(properties.SoftDeleteRetentionInDays)

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(properties.TenantId)

	// VaultUri
	destination.VaultUri = genruntime.ClonePointerToString(properties.VaultUri)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForVaultProperties_STATUS interface (if implemented) to customize the conversion
	var propertiesAsAny any = properties
	if augmentedProperties, ok := propertiesAsAny.(augmentConversionForVaultProperties_STATUS); ok {
		err := augmentedProperties.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.AccessPolicyEntry
// An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key
// vault's tenant ID.
type AccessPolicyEntry struct {
	ApplicationId           *string                        `json:"applicationId,omitempty" optionalConfigMapPair:"ApplicationId"`
	ApplicationIdFromConfig *genruntime.ConfigMapReference `json:"applicationIdFromConfig,omitempty" optionalConfigMapPair:"ApplicationId"`
	ObjectId                *string                        `json:"objectId,omitempty" optionalConfigMapPair:"ObjectId"`
	ObjectIdFromConfig      *genruntime.ConfigMapReference `json:"objectIdFromConfig,omitempty" optionalConfigMapPair:"ObjectId"`
	Permissions             *Permissions                   `json:"permissions,omitempty"`
	PropertyBag             genruntime.PropertyBag         `json:"$propertyBag,omitempty"`
	TenantId                *string                        `json:"tenantId,omitempty" optionalConfigMapPair:"TenantId"`
	TenantIdFromConfig      *genruntime.ConfigMapReference `json:"tenantIdFromConfig,omitempty" optionalConfigMapPair:"TenantId"`
}

// AssignProperties_From_AccessPolicyEntry populates our AccessPolicyEntry from the provided source AccessPolicyEntry
func (entry *AccessPolicyEntry) AssignProperties_From_AccessPolicyEntry(source *storage.AccessPolicyEntry) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// ApplicationId
	entry.ApplicationId = genruntime.ClonePointerToString(source.ApplicationId)

	// ApplicationIdFromConfig
	if source.ApplicationIdFromConfig != nil {
		applicationIdFromConfig := source.ApplicationIdFromConfig.Copy()
		entry.ApplicationIdFromConfig = &applicationIdFromConfig
	} else {
		entry.ApplicationIdFromConfig = nil
	}

	// ObjectId
	entry.ObjectId = genruntime.ClonePointerToString(source.ObjectId)

	// ObjectIdFromConfig
	if source.ObjectIdFromConfig != nil {
		objectIdFromConfig := source.ObjectIdFromConfig.Copy()
		entry.ObjectIdFromConfig = &objectIdFromConfig
	} else {
		entry.ObjectIdFromConfig = nil
	}

	// Permissions
	if source.Permissions != nil {
		var permission Permissions
		err := permission.AssignProperties_From_Permissions(source.Permissions)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Permissions() to populate field Permissions")
		}
		entry.Permissions = &permission
	} else {
		entry.Permissions = nil
	}

	// TenantId
	entry.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// TenantIdFromConfig
	if source.TenantIdFromConfig != nil {
		tenantIdFromConfig := source.TenantIdFromConfig.Copy()
		entry.TenantIdFromConfig = &tenantIdFromConfig
	} else {
		entry.TenantIdFromConfig = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		entry.PropertyBag = propertyBag
	} else {
		entry.PropertyBag = nil
	}

	// Invoke the augmentConversionForAccessPolicyEntry interface (if implemented) to customize the conversion
	var entryAsAny any = entry
	if augmentedEntry, ok := entryAsAny.(augmentConversionForAccessPolicyEntry); ok {
		err := augmentedEntry.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_AccessPolicyEntry populates the provided destination AccessPolicyEntry from our AccessPolicyEntry
func (entry *AccessPolicyEntry) AssignProperties_To_AccessPolicyEntry(destination *storage.AccessPolicyEntry) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(entry.PropertyBag)

	// ApplicationId
	destination.ApplicationId = genruntime.ClonePointerToString(entry.ApplicationId)

	// ApplicationIdFromConfig
	if entry.ApplicationIdFromConfig != nil {
		applicationIdFromConfig := entry.ApplicationIdFromConfig.Copy()
		destination.ApplicationIdFromConfig = &applicationIdFromConfig
	} else {
		destination.ApplicationIdFromConfig = nil
	}

	// ObjectId
	destination.ObjectId = genruntime.ClonePointerToString(entry.ObjectId)

	// ObjectIdFromConfig
	if entry.ObjectIdFromConfig != nil {
		objectIdFromConfig := entry.ObjectIdFromConfig.Copy()
		destination.ObjectIdFromConfig = &objectIdFromConfig
	} else {
		destination.ObjectIdFromConfig = nil
	}

	// Permissions
	if entry.Permissions != nil {
		var permission storage.Permissions
		err := entry.Permissions.AssignProperties_To_Permissions(&permission)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Permissions() to populate field Permissions")
		}
		destination.Permissions = &permission
	} else {
		destination.Permissions = nil
	}

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(entry.TenantId)

	// TenantIdFromConfig
	if entry.TenantIdFromConfig != nil {
		tenantIdFromConfig := entry.TenantIdFromConfig.Copy()
		destination.TenantIdFromConfig = &tenantIdFromConfig
	} else {
		destination.TenantIdFromConfig = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForAccessPolicyEntry interface (if implemented) to customize the conversion
	var entryAsAny any = entry
	if augmentedEntry, ok := entryAsAny.(augmentConversionForAccessPolicyEntry); ok {
		err := augmentedEntry.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.AccessPolicyEntry_STATUS
// An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key
// vault's tenant ID.
type AccessPolicyEntry_STATUS struct {
	ApplicationId *string                `json:"applicationId,omitempty"`
	ObjectId      *string                `json:"objectId,omitempty"`
	Permissions   *Permissions_STATUS    `json:"permissions,omitempty"`
	PropertyBag   genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	TenantId      *string                `json:"tenantId,omitempty"`
}

// AssignProperties_From_AccessPolicyEntry_STATUS populates our AccessPolicyEntry_STATUS from the provided source AccessPolicyEntry_STATUS
func (entry *AccessPolicyEntry_STATUS) AssignProperties_From_AccessPolicyEntry_STATUS(source *storage.AccessPolicyEntry_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// ApplicationId
	entry.ApplicationId = genruntime.ClonePointerToString(source.ApplicationId)

	// ObjectId
	entry.ObjectId = genruntime.ClonePointerToString(source.ObjectId)

	// Permissions
	if source.Permissions != nil {
		var permission Permissions_STATUS
		err := permission.AssignProperties_From_Permissions_STATUS(source.Permissions)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Permissions_STATUS() to populate field Permissions")
		}
		entry.Permissions = &permission
	} else {
		entry.Permissions = nil
	}

	// TenantId
	entry.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// Update the property bag
	if len(propertyBag) > 0 {
		entry.PropertyBag = propertyBag
	} else {
		entry.PropertyBag = nil
	}

	// Invoke the augmentConversionForAccessPolicyEntry_STATUS interface (if implemented) to customize the conversion
	var entryAsAny any = entry
	if augmentedEntry, ok := entryAsAny.(augmentConversionForAccessPolicyEntry_STATUS); ok {
		err := augmentedEntry.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_AccessPolicyEntry_STATUS populates the provided destination AccessPolicyEntry_STATUS from our AccessPolicyEntry_STATUS
func (entry *AccessPolicyEntry_STATUS) AssignProperties_To_AccessPolicyEntry_STATUS(destination *storage.AccessPolicyEntry_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(entry.PropertyBag)

	// ApplicationId
	destination.ApplicationId = genruntime.ClonePointerToString(entry.ApplicationId)

	// ObjectId
	destination.ObjectId = genruntime.ClonePointerToString(entry.ObjectId)

	// Permissions
	if entry.Permissions != nil {
		var permission storage.Permissions_STATUS
		err := entry.Permissions.AssignProperties_To_Permissions_STATUS(&permission)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Permissions_STATUS() to populate field Permissions")
		}
		destination.Permissions = &permission
	} else {
		destination.Permissions = nil
	}

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(entry.TenantId)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForAccessPolicyEntry_STATUS interface (if implemented) to customize the conversion
	var entryAsAny any = entry
	if augmentedEntry, ok := entryAsAny.(augmentConversionForAccessPolicyEntry_STATUS); ok {
		err := augmentedEntry.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForSystemData_STATUS interface {
	AssignPropertiesFrom(src *storage.SystemData_STATUS) error
	AssignPropertiesTo(dst *storage.SystemData_STATUS) error
}

type augmentConversionForVaultOperatorSpec interface {
	AssignPropertiesFrom(src *storage.VaultOperatorSpec) error
	AssignPropertiesTo(dst *storage.VaultOperatorSpec) error
}

type augmentConversionForVaultProperties interface {
	AssignPropertiesFrom(src *storage.VaultProperties) error
	AssignPropertiesTo(dst *storage.VaultProperties) error
}

type augmentConversionForVaultProperties_STATUS interface {
	AssignPropertiesFrom(src *storage.VaultProperties_STATUS) error
	AssignPropertiesTo(dst *storage.VaultProperties_STATUS) error
}

// Storage version of v1api20210401preview.NetworkRuleSet
// A set of rules governing the network accessibility of a vault.
type NetworkRuleSet struct {
	Bypass              *string                `json:"bypass,omitempty"`
	DefaultAction       *string                `json:"defaultAction,omitempty"`
	IpRules             []IPRule               `json:"ipRules,omitempty"`
	PropertyBag         genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	VirtualNetworkRules []VirtualNetworkRule   `json:"virtualNetworkRules,omitempty"`
}

// AssignProperties_From_NetworkRuleSet populates our NetworkRuleSet from the provided source NetworkRuleSet
func (ruleSet *NetworkRuleSet) AssignProperties_From_NetworkRuleSet(source *storage.NetworkRuleSet) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Bypass
	ruleSet.Bypass = genruntime.ClonePointerToString(source.Bypass)

	// DefaultAction
	ruleSet.DefaultAction = genruntime.ClonePointerToString(source.DefaultAction)

	// IpRules
	if source.IpRules != nil {
		ipRuleList := make([]IPRule, len(source.IpRules))
		for ipRuleIndex, ipRuleItem := range source.IpRules {
			var ipRule IPRule
			err := ipRule.AssignProperties_From_IPRule(&ipRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_IPRule() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		ruleSet.IpRules = ipRuleList
	} else {
		ruleSet.IpRules = nil
	}

	// VirtualNetworkRules
	if source.VirtualNetworkRules != nil {
		virtualNetworkRuleList := make([]VirtualNetworkRule, len(source.VirtualNetworkRules))
		for virtualNetworkRuleIndex, virtualNetworkRuleItem := range source.VirtualNetworkRules {
			var virtualNetworkRule VirtualNetworkRule
			err := virtualNetworkRule.AssignProperties_From_VirtualNetworkRule(&virtualNetworkRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_VirtualNetworkRule() to populate field VirtualNetworkRules")
			}
			virtualNetworkRuleList[virtualNetworkRuleIndex] = virtualNetworkRule
		}
		ruleSet.VirtualNetworkRules = virtualNetworkRuleList
	} else {
		ruleSet.VirtualNetworkRules = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		ruleSet.PropertyBag = propertyBag
	} else {
		ruleSet.PropertyBag = nil
	}

	// Invoke the augmentConversionForNetworkRuleSet interface (if implemented) to customize the conversion
	var ruleSetAsAny any = ruleSet
	if augmentedRuleSet, ok := ruleSetAsAny.(augmentConversionForNetworkRuleSet); ok {
		err := augmentedRuleSet.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_NetworkRuleSet populates the provided destination NetworkRuleSet from our NetworkRuleSet
func (ruleSet *NetworkRuleSet) AssignProperties_To_NetworkRuleSet(destination *storage.NetworkRuleSet) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(ruleSet.PropertyBag)

	// Bypass
	destination.Bypass = genruntime.ClonePointerToString(ruleSet.Bypass)

	// DefaultAction
	destination.DefaultAction = genruntime.ClonePointerToString(ruleSet.DefaultAction)

	// IpRules
	if ruleSet.IpRules != nil {
		ipRuleList := make([]storage.IPRule, len(ruleSet.IpRules))
		for ipRuleIndex, ipRuleItem := range ruleSet.IpRules {
			var ipRule storage.IPRule
			err := ipRuleItem.AssignProperties_To_IPRule(&ipRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_IPRule() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		destination.IpRules = ipRuleList
	} else {
		destination.IpRules = nil
	}

	// VirtualNetworkRules
	if ruleSet.VirtualNetworkRules != nil {
		virtualNetworkRuleList := make([]storage.VirtualNetworkRule, len(ruleSet.VirtualNetworkRules))
		for virtualNetworkRuleIndex, virtualNetworkRuleItem := range ruleSet.VirtualNetworkRules {
			var virtualNetworkRule storage.VirtualNetworkRule
			err := virtualNetworkRuleItem.AssignProperties_To_VirtualNetworkRule(&virtualNetworkRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_VirtualNetworkRule() to populate field VirtualNetworkRules")
			}
			virtualNetworkRuleList[virtualNetworkRuleIndex] = virtualNetworkRule
		}
		destination.VirtualNetworkRules = virtualNetworkRuleList
	} else {
		destination.VirtualNetworkRules = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForNetworkRuleSet interface (if implemented) to customize the conversion
	var ruleSetAsAny any = ruleSet
	if augmentedRuleSet, ok := ruleSetAsAny.(augmentConversionForNetworkRuleSet); ok {
		err := augmentedRuleSet.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.NetworkRuleSet_STATUS
// A set of rules governing the network accessibility of a vault.
type NetworkRuleSet_STATUS struct {
	Bypass              *string                     `json:"bypass,omitempty"`
	DefaultAction       *string                     `json:"defaultAction,omitempty"`
	IpRules             []IPRule_STATUS             `json:"ipRules,omitempty"`
	PropertyBag         genruntime.PropertyBag      `json:"$propertyBag,omitempty"`
	VirtualNetworkRules []VirtualNetworkRule_STATUS `json:"virtualNetworkRules,omitempty"`
}

// AssignProperties_From_NetworkRuleSet_STATUS populates our NetworkRuleSet_STATUS from the provided source NetworkRuleSet_STATUS
func (ruleSet *NetworkRuleSet_STATUS) AssignProperties_From_NetworkRuleSet_STATUS(source *storage.NetworkRuleSet_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Bypass
	ruleSet.Bypass = genruntime.ClonePointerToString(source.Bypass)

	// DefaultAction
	ruleSet.DefaultAction = genruntime.ClonePointerToString(source.DefaultAction)

	// IpRules
	if source.IpRules != nil {
		ipRuleList := make([]IPRule_STATUS, len(source.IpRules))
		for ipRuleIndex, ipRuleItem := range source.IpRules {
			var ipRule IPRule_STATUS
			err := ipRule.AssignProperties_From_IPRule_STATUS(&ipRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_IPRule_STATUS() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		ruleSet.IpRules = ipRuleList
	} else {
		ruleSet.IpRules = nil
	}

	// VirtualNetworkRules
	if source.VirtualNetworkRules != nil {
		virtualNetworkRuleList := make([]VirtualNetworkRule_STATUS, len(source.VirtualNetworkRules))
		for virtualNetworkRuleIndex, virtualNetworkRuleItem := range source.VirtualNetworkRules {
			var virtualNetworkRule VirtualNetworkRule_STATUS
			err := virtualNetworkRule.AssignProperties_From_VirtualNetworkRule_STATUS(&virtualNetworkRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_VirtualNetworkRule_STATUS() to populate field VirtualNetworkRules")
			}
			virtualNetworkRuleList[virtualNetworkRuleIndex] = virtualNetworkRule
		}
		ruleSet.VirtualNetworkRules = virtualNetworkRuleList
	} else {
		ruleSet.VirtualNetworkRules = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		ruleSet.PropertyBag = propertyBag
	} else {
		ruleSet.PropertyBag = nil
	}

	// Invoke the augmentConversionForNetworkRuleSet_STATUS interface (if implemented) to customize the conversion
	var ruleSetAsAny any = ruleSet
	if augmentedRuleSet, ok := ruleSetAsAny.(augmentConversionForNetworkRuleSet_STATUS); ok {
		err := augmentedRuleSet.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_NetworkRuleSet_STATUS populates the provided destination NetworkRuleSet_STATUS from our NetworkRuleSet_STATUS
func (ruleSet *NetworkRuleSet_STATUS) AssignProperties_To_NetworkRuleSet_STATUS(destination *storage.NetworkRuleSet_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(ruleSet.PropertyBag)

	// Bypass
	destination.Bypass = genruntime.ClonePointerToString(ruleSet.Bypass)

	// DefaultAction
	destination.DefaultAction = genruntime.ClonePointerToString(ruleSet.DefaultAction)

	// IpRules
	if ruleSet.IpRules != nil {
		ipRuleList := make([]storage.IPRule_STATUS, len(ruleSet.IpRules))
		for ipRuleIndex, ipRuleItem := range ruleSet.IpRules {
			var ipRule storage.IPRule_STATUS
			err := ipRuleItem.AssignProperties_To_IPRule_STATUS(&ipRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_IPRule_STATUS() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		destination.IpRules = ipRuleList
	} else {
		destination.IpRules = nil
	}

	// VirtualNetworkRules
	if ruleSet.VirtualNetworkRules != nil {
		virtualNetworkRuleList := make([]storage.VirtualNetworkRule_STATUS, len(ruleSet.VirtualNetworkRules))
		for virtualNetworkRuleIndex, virtualNetworkRuleItem := range ruleSet.VirtualNetworkRules {
			var virtualNetworkRule storage.VirtualNetworkRule_STATUS
			err := virtualNetworkRuleItem.AssignProperties_To_VirtualNetworkRule_STATUS(&virtualNetworkRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_VirtualNetworkRule_STATUS() to populate field VirtualNetworkRules")
			}
			virtualNetworkRuleList[virtualNetworkRuleIndex] = virtualNetworkRule
		}
		destination.VirtualNetworkRules = virtualNetworkRuleList
	} else {
		destination.VirtualNetworkRules = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForNetworkRuleSet_STATUS interface (if implemented) to customize the conversion
	var ruleSetAsAny any = ruleSet
	if augmentedRuleSet, ok := ruleSetAsAny.(augmentConversionForNetworkRuleSet_STATUS); ok {
		err := augmentedRuleSet.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.PrivateEndpointConnectionItem_STATUS
// Private endpoint connection item.
type PrivateEndpointConnectionItem_STATUS struct {
	Etag                              *string                                   `json:"etag,omitempty"`
	Id                                *string                                   `json:"id,omitempty"`
	PrivateEndpoint                   *PrivateEndpoint_STATUS                   `json:"privateEndpoint,omitempty"`
	PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState_STATUS `json:"privateLinkServiceConnectionState,omitempty"`
	PropertyBag                       genruntime.PropertyBag                    `json:"$propertyBag,omitempty"`
	ProvisioningState                 *string                                   `json:"provisioningState,omitempty"`
}

// AssignProperties_From_PrivateEndpointConnectionItem_STATUS populates our PrivateEndpointConnectionItem_STATUS from the provided source PrivateEndpointConnectionItem_STATUS
func (item *PrivateEndpointConnectionItem_STATUS) AssignProperties_From_PrivateEndpointConnectionItem_STATUS(source *storage.PrivateEndpointConnectionItem_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Etag
	item.Etag = genruntime.ClonePointerToString(source.Etag)

	// Id
	item.Id = genruntime.ClonePointerToString(source.Id)

	// PrivateEndpoint
	if source.PrivateEndpoint != nil {
		var privateEndpoint PrivateEndpoint_STATUS
		err := privateEndpoint.AssignProperties_From_PrivateEndpoint_STATUS(source.PrivateEndpoint)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpoint_STATUS() to populate field PrivateEndpoint")
		}
		item.PrivateEndpoint = &privateEndpoint
	} else {
		item.PrivateEndpoint = nil
	}

	// PrivateLinkServiceConnectionState
	if source.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState PrivateLinkServiceConnectionState_STATUS
		err := privateLinkServiceConnectionState.AssignProperties_From_PrivateLinkServiceConnectionState_STATUS(source.PrivateLinkServiceConnectionState)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceConnectionState_STATUS() to populate field PrivateLinkServiceConnectionState")
		}
		item.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		item.PrivateLinkServiceConnectionState = nil
	}

	// ProvisioningState
	item.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState)

	// Update the property bag
	if len(propertyBag) > 0 {
		item.PropertyBag = propertyBag
	} else {
		item.PropertyBag = nil
	}

	// Invoke the augmentConversionForPrivateEndpointConnectionItem_STATUS interface (if implemented) to customize the conversion
	var itemAsAny any = item
	if augmentedItem, ok := itemAsAny.(augmentConversionForPrivateEndpointConnectionItem_STATUS); ok {
		err := augmentedItem.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_PrivateEndpointConnectionItem_STATUS populates the provided destination PrivateEndpointConnectionItem_STATUS from our PrivateEndpointConnectionItem_STATUS
func (item *PrivateEndpointConnectionItem_STATUS) AssignProperties_To_PrivateEndpointConnectionItem_STATUS(destination *storage.PrivateEndpointConnectionItem_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(item.PropertyBag)

	// Etag
	destination.Etag = genruntime.ClonePointerToString(item.Etag)

	// Id
	destination.Id = genruntime.ClonePointerToString(item.Id)

	// PrivateEndpoint
	if item.PrivateEndpoint != nil {
		var privateEndpoint storage.PrivateEndpoint_STATUS
		err := item.PrivateEndpoint.AssignProperties_To_PrivateEndpoint_STATUS(&privateEndpoint)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PrivateEndpoint_STATUS() to populate field PrivateEndpoint")
		}
		destination.PrivateEndpoint = &privateEndpoint
	} else {
		destination.PrivateEndpoint = nil
	}

	// PrivateLinkServiceConnectionState
	if item.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState storage.PrivateLinkServiceConnectionState_STATUS
		err := item.PrivateLinkServiceConnectionState.AssignProperties_To_PrivateLinkServiceConnectionState_STATUS(&privateLinkServiceConnectionState)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceConnectionState_STATUS() to populate field PrivateLinkServiceConnectionState")
		}
		destination.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		destination.PrivateLinkServiceConnectionState = nil
	}

	// ProvisioningState
	destination.ProvisioningState = genruntime.ClonePointerToString(item.ProvisioningState)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForPrivateEndpointConnectionItem_STATUS interface (if implemented) to customize the conversion
	var itemAsAny any = item
	if augmentedItem, ok := itemAsAny.(augmentConversionForPrivateEndpointConnectionItem_STATUS); ok {
		err := augmentedItem.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.Sku
// SKU details
type Sku struct {
	Family      *string                `json:"family,omitempty"`
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_Sku populates our Sku from the provided source Sku
func (sku *Sku) AssignProperties_From_Sku(source *storage.Sku) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Family
	sku.Family = genruntime.ClonePointerToString(source.Family)

	// Name
	sku.Name = genruntime.ClonePointerToString(source.Name)

	// Update the property bag
	if len(propertyBag) > 0 {
		sku.PropertyBag = propertyBag
	} else {
		sku.PropertyBag = nil
	}

	// Invoke the augmentConversionForSku interface (if implemented) to customize the conversion
	var skuAsAny any = sku
	if augmentedSku, ok := skuAsAny.(augmentConversionForSku); ok {
		err := augmentedSku.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Sku populates the provided destination Sku from our Sku
func (sku *Sku) AssignProperties_To_Sku(destination *storage.Sku) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(sku.PropertyBag)

	// Family
	destination.Family = genruntime.ClonePointerToString(sku.Family)

	// Name
	destination.Name = genruntime.ClonePointerToString(sku.Name)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForSku interface (if implemented) to customize the conversion
	var skuAsAny any = sku
	if augmentedSku, ok := skuAsAny.(augmentConversionForSku); ok {
		err := augmentedSku.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.Sku_STATUS
// SKU details
type Sku_STATUS struct {
	Family      *string                `json:"family,omitempty"`
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_Sku_STATUS populates our Sku_STATUS from the provided source Sku_STATUS
func (sku *Sku_STATUS) AssignProperties_From_Sku_STATUS(source *storage.Sku_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Family
	sku.Family = genruntime.ClonePointerToString(source.Family)

	// Name
	sku.Name = genruntime.ClonePointerToString(source.Name)

	// Update the property bag
	if len(propertyBag) > 0 {
		sku.PropertyBag = propertyBag
	} else {
		sku.PropertyBag = nil
	}

	// Invoke the augmentConversionForSku_STATUS interface (if implemented) to customize the conversion
	var skuAsAny any = sku
	if augmentedSku, ok := skuAsAny.(augmentConversionForSku_STATUS); ok {
		err := augmentedSku.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Sku_STATUS populates the provided destination Sku_STATUS from our Sku_STATUS
func (sku *Sku_STATUS) AssignProperties_To_Sku_STATUS(destination *storage.Sku_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(sku.PropertyBag)

	// Family
	destination.Family = genruntime.ClonePointerToString(sku.Family)

	// Name
	destination.Name = genruntime.ClonePointerToString(sku.Name)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForSku_STATUS interface (if implemented) to customize the conversion
	var skuAsAny any = sku
	if augmentedSku, ok := skuAsAny.(augmentConversionForSku_STATUS); ok {
		err := augmentedSku.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForAccessPolicyEntry interface {
	AssignPropertiesFrom(src *storage.AccessPolicyEntry) error
	AssignPropertiesTo(dst *storage.AccessPolicyEntry) error
}

type augmentConversionForAccessPolicyEntry_STATUS interface {
	AssignPropertiesFrom(src *storage.AccessPolicyEntry_STATUS) error
	AssignPropertiesTo(dst *storage.AccessPolicyEntry_STATUS) error
}

type augmentConversionForNetworkRuleSet interface {
	AssignPropertiesFrom(src *storage.NetworkRuleSet) error
	AssignPropertiesTo(dst *storage.NetworkRuleSet) error
}

type augmentConversionForNetworkRuleSet_STATUS interface {
	AssignPropertiesFrom(src *storage.NetworkRuleSet_STATUS) error
	AssignPropertiesTo(dst *storage.NetworkRuleSet_STATUS) error
}

type augmentConversionForPrivateEndpointConnectionItem_STATUS interface {
	AssignPropertiesFrom(src *storage.PrivateEndpointConnectionItem_STATUS) error
	AssignPropertiesTo(dst *storage.PrivateEndpointConnectionItem_STATUS) error
}

type augmentConversionForSku interface {
	AssignPropertiesFrom(src *storage.Sku) error
	AssignPropertiesTo(dst *storage.Sku) error
}

type augmentConversionForSku_STATUS interface {
	AssignPropertiesFrom(src *storage.Sku_STATUS) error
	AssignPropertiesTo(dst *storage.Sku_STATUS) error
}

// Storage version of v1api20210401preview.IPRule
// A rule governing the accessibility of a vault from a specific ip address or ip range.
type IPRule struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Value       *string                `json:"value,omitempty"`
}

// AssignProperties_From_IPRule populates our IPRule from the provided source IPRule
func (rule *IPRule) AssignProperties_From_IPRule(source *storage.IPRule) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Value
	rule.Value = genruntime.ClonePointerToString(source.Value)

	// Update the property bag
	if len(propertyBag) > 0 {
		rule.PropertyBag = propertyBag
	} else {
		rule.PropertyBag = nil
	}

	// Invoke the augmentConversionForIPRule interface (if implemented) to customize the conversion
	var ruleAsAny any = rule
	if augmentedRule, ok := ruleAsAny.(augmentConversionForIPRule); ok {
		err := augmentedRule.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_IPRule populates the provided destination IPRule from our IPRule
func (rule *IPRule) AssignProperties_To_IPRule(destination *storage.IPRule) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(rule.PropertyBag)

	// Value
	destination.Value = genruntime.ClonePointerToString(rule.Value)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForIPRule interface (if implemented) to customize the conversion
	var ruleAsAny any = rule
	if augmentedRule, ok := ruleAsAny.(augmentConversionForIPRule); ok {
		err := augmentedRule.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.IPRule_STATUS
// A rule governing the accessibility of a vault from a specific ip address or ip range.
type IPRule_STATUS struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Value       *string                `json:"value,omitempty"`
}

// AssignProperties_From_IPRule_STATUS populates our IPRule_STATUS from the provided source IPRule_STATUS
func (rule *IPRule_STATUS) AssignProperties_From_IPRule_STATUS(source *storage.IPRule_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Value
	rule.Value = genruntime.ClonePointerToString(source.Value)

	// Update the property bag
	if len(propertyBag) > 0 {
		rule.PropertyBag = propertyBag
	} else {
		rule.PropertyBag = nil
	}

	// Invoke the augmentConversionForIPRule_STATUS interface (if implemented) to customize the conversion
	var ruleAsAny any = rule
	if augmentedRule, ok := ruleAsAny.(augmentConversionForIPRule_STATUS); ok {
		err := augmentedRule.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_IPRule_STATUS populates the provided destination IPRule_STATUS from our IPRule_STATUS
func (rule *IPRule_STATUS) AssignProperties_To_IPRule_STATUS(destination *storage.IPRule_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(rule.PropertyBag)

	// Value
	destination.Value = genruntime.ClonePointerToString(rule.Value)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForIPRule_STATUS interface (if implemented) to customize the conversion
	var ruleAsAny any = rule
	if augmentedRule, ok := ruleAsAny.(augmentConversionForIPRule_STATUS); ok {
		err := augmentedRule.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.Permissions
// Permissions the identity has for keys, secrets, certificates and storage.
type Permissions struct {
	Certificates []string               `json:"certificates,omitempty"`
	Keys         []string               `json:"keys,omitempty"`
	PropertyBag  genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Secrets      []string               `json:"secrets,omitempty"`
	Storage      []string               `json:"storage,omitempty"`
}

// AssignProperties_From_Permissions populates our Permissions from the provided source Permissions
func (permissions *Permissions) AssignProperties_From_Permissions(source *storage.Permissions) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Certificates
	permissions.Certificates = genruntime.CloneSliceOfString(source.Certificates)

	// Keys
	permissions.Keys = genruntime.CloneSliceOfString(source.Keys)

	// Secrets
	permissions.Secrets = genruntime.CloneSliceOfString(source.Secrets)

	// Storage
	permissions.Storage = genruntime.CloneSliceOfString(source.Storage)

	// Update the property bag
	if len(propertyBag) > 0 {
		permissions.PropertyBag = propertyBag
	} else {
		permissions.PropertyBag = nil
	}

	// Invoke the augmentConversionForPermissions interface (if implemented) to customize the conversion
	var permissionsAsAny any = permissions
	if augmentedPermissions, ok := permissionsAsAny.(augmentConversionForPermissions); ok {
		err := augmentedPermissions.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Permissions populates the provided destination Permissions from our Permissions
func (permissions *Permissions) AssignProperties_To_Permissions(destination *storage.Permissions) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(permissions.PropertyBag)

	// Certificates
	destination.Certificates = genruntime.CloneSliceOfString(permissions.Certificates)

	// Keys
	destination.Keys = genruntime.CloneSliceOfString(permissions.Keys)

	// Secrets
	destination.Secrets = genruntime.CloneSliceOfString(permissions.Secrets)

	// Storage
	destination.Storage = genruntime.CloneSliceOfString(permissions.Storage)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForPermissions interface (if implemented) to customize the conversion
	var permissionsAsAny any = permissions
	if augmentedPermissions, ok := permissionsAsAny.(augmentConversionForPermissions); ok {
		err := augmentedPermissions.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.Permissions_STATUS
// Permissions the identity has for keys, secrets, certificates and storage.
type Permissions_STATUS struct {
	Certificates []string               `json:"certificates,omitempty"`
	Keys         []string               `json:"keys,omitempty"`
	PropertyBag  genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Secrets      []string               `json:"secrets,omitempty"`
	Storage      []string               `json:"storage,omitempty"`
}

// AssignProperties_From_Permissions_STATUS populates our Permissions_STATUS from the provided source Permissions_STATUS
func (permissions *Permissions_STATUS) AssignProperties_From_Permissions_STATUS(source *storage.Permissions_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Certificates
	permissions.Certificates = genruntime.CloneSliceOfString(source.Certificates)

	// Keys
	permissions.Keys = genruntime.CloneSliceOfString(source.Keys)

	// Secrets
	permissions.Secrets = genruntime.CloneSliceOfString(source.Secrets)

	// Storage
	permissions.Storage = genruntime.CloneSliceOfString(source.Storage)

	// Update the property bag
	if len(propertyBag) > 0 {
		permissions.PropertyBag = propertyBag
	} else {
		permissions.PropertyBag = nil
	}

	// Invoke the augmentConversionForPermissions_STATUS interface (if implemented) to customize the conversion
	var permissionsAsAny any = permissions
	if augmentedPermissions, ok := permissionsAsAny.(augmentConversionForPermissions_STATUS); ok {
		err := augmentedPermissions.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_Permissions_STATUS populates the provided destination Permissions_STATUS from our Permissions_STATUS
func (permissions *Permissions_STATUS) AssignProperties_To_Permissions_STATUS(destination *storage.Permissions_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(permissions.PropertyBag)

	// Certificates
	destination.Certificates = genruntime.CloneSliceOfString(permissions.Certificates)

	// Keys
	destination.Keys = genruntime.CloneSliceOfString(permissions.Keys)

	// Secrets
	destination.Secrets = genruntime.CloneSliceOfString(permissions.Secrets)

	// Storage
	destination.Storage = genruntime.CloneSliceOfString(permissions.Storage)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForPermissions_STATUS interface (if implemented) to customize the conversion
	var permissionsAsAny any = permissions
	if augmentedPermissions, ok := permissionsAsAny.(augmentConversionForPermissions_STATUS); ok {
		err := augmentedPermissions.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.PrivateEndpoint_STATUS
// Private endpoint object properties.
type PrivateEndpoint_STATUS struct {
	Id          *string                `json:"id,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_PrivateEndpoint_STATUS populates our PrivateEndpoint_STATUS from the provided source PrivateEndpoint_STATUS
func (endpoint *PrivateEndpoint_STATUS) AssignProperties_From_PrivateEndpoint_STATUS(source *storage.PrivateEndpoint_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Id
	endpoint.Id = genruntime.ClonePointerToString(source.Id)

	// Update the property bag
	if len(propertyBag) > 0 {
		endpoint.PropertyBag = propertyBag
	} else {
		endpoint.PropertyBag = nil
	}

	// Invoke the augmentConversionForPrivateEndpoint_STATUS interface (if implemented) to customize the conversion
	var endpointAsAny any = endpoint
	if augmentedEndpoint, ok := endpointAsAny.(augmentConversionForPrivateEndpoint_STATUS); ok {
		err := augmentedEndpoint.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_PrivateEndpoint_STATUS populates the provided destination PrivateEndpoint_STATUS from our PrivateEndpoint_STATUS
func (endpoint *PrivateEndpoint_STATUS) AssignProperties_To_PrivateEndpoint_STATUS(destination *storage.PrivateEndpoint_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(endpoint.PropertyBag)

	// Id
	destination.Id = genruntime.ClonePointerToString(endpoint.Id)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForPrivateEndpoint_STATUS interface (if implemented) to customize the conversion
	var endpointAsAny any = endpoint
	if augmentedEndpoint, ok := endpointAsAny.(augmentConversionForPrivateEndpoint_STATUS); ok {
		err := augmentedEndpoint.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.PrivateLinkServiceConnectionState_STATUS
// An object that represents the approval state of the private link connection.
type PrivateLinkServiceConnectionState_STATUS struct {
	ActionsRequired *string                `json:"actionsRequired,omitempty"`
	Description     *string                `json:"description,omitempty"`
	PropertyBag     genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Status          *string                `json:"status,omitempty"`
}

// AssignProperties_From_PrivateLinkServiceConnectionState_STATUS populates our PrivateLinkServiceConnectionState_STATUS from the provided source PrivateLinkServiceConnectionState_STATUS
func (state *PrivateLinkServiceConnectionState_STATUS) AssignProperties_From_PrivateLinkServiceConnectionState_STATUS(source *storage.PrivateLinkServiceConnectionState_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// ActionsRequired
	state.ActionsRequired = genruntime.ClonePointerToString(source.ActionsRequired)

	// Description
	state.Description = genruntime.ClonePointerToString(source.Description)

	// Status
	state.Status = genruntime.ClonePointerToString(source.Status)

	// Update the property bag
	if len(propertyBag) > 0 {
		state.PropertyBag = propertyBag
	} else {
		state.PropertyBag = nil
	}

	// Invoke the augmentConversionForPrivateLinkServiceConnectionState_STATUS interface (if implemented) to customize the conversion
	var stateAsAny any = state
	if augmentedState, ok := stateAsAny.(augmentConversionForPrivateLinkServiceConnectionState_STATUS); ok {
		err := augmentedState.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_PrivateLinkServiceConnectionState_STATUS populates the provided destination PrivateLinkServiceConnectionState_STATUS from our PrivateLinkServiceConnectionState_STATUS
func (state *PrivateLinkServiceConnectionState_STATUS) AssignProperties_To_PrivateLinkServiceConnectionState_STATUS(destination *storage.PrivateLinkServiceConnectionState_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(state.PropertyBag)

	// ActionsRequired
	destination.ActionsRequired = genruntime.ClonePointerToString(state.ActionsRequired)

	// Description
	destination.Description = genruntime.ClonePointerToString(state.Description)

	// Status
	destination.Status = genruntime.ClonePointerToString(state.Status)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForPrivateLinkServiceConnectionState_STATUS interface (if implemented) to customize the conversion
	var stateAsAny any = state
	if augmentedState, ok := stateAsAny.(augmentConversionForPrivateLinkServiceConnectionState_STATUS); ok {
		err := augmentedState.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.VirtualNetworkRule
// A rule governing the accessibility of a vault from a specific virtual network.
type VirtualNetworkRule struct {
	IgnoreMissingVnetServiceEndpoint *bool                  `json:"ignoreMissingVnetServiceEndpoint,omitempty"`
	PropertyBag                      genruntime.PropertyBag `json:"$propertyBag,omitempty"`

	// +kubebuilder:validation:Required
	// Reference: Full resource id of a vnet subnet, such as
	// '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

// AssignProperties_From_VirtualNetworkRule populates our VirtualNetworkRule from the provided source VirtualNetworkRule
func (rule *VirtualNetworkRule) AssignProperties_From_VirtualNetworkRule(source *storage.VirtualNetworkRule) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// IgnoreMissingVnetServiceEndpoint
	if source.IgnoreMissingVnetServiceEndpoint != nil {
		ignoreMissingVnetServiceEndpoint := *source.IgnoreMissingVnetServiceEndpoint
		rule.IgnoreMissingVnetServiceEndpoint = &ignoreMissingVnetServiceEndpoint
	} else {
		rule.IgnoreMissingVnetServiceEndpoint = nil
	}

	// Reference
	if source.Reference != nil {
		reference := source.Reference.Copy()
		rule.Reference = &reference
	} else {
		rule.Reference = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		rule.PropertyBag = propertyBag
	} else {
		rule.PropertyBag = nil
	}

	// Invoke the augmentConversionForVirtualNetworkRule interface (if implemented) to customize the conversion
	var ruleAsAny any = rule
	if augmentedRule, ok := ruleAsAny.(augmentConversionForVirtualNetworkRule); ok {
		err := augmentedRule.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_VirtualNetworkRule populates the provided destination VirtualNetworkRule from our VirtualNetworkRule
func (rule *VirtualNetworkRule) AssignProperties_To_VirtualNetworkRule(destination *storage.VirtualNetworkRule) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(rule.PropertyBag)

	// IgnoreMissingVnetServiceEndpoint
	if rule.IgnoreMissingVnetServiceEndpoint != nil {
		ignoreMissingVnetServiceEndpoint := *rule.IgnoreMissingVnetServiceEndpoint
		destination.IgnoreMissingVnetServiceEndpoint = &ignoreMissingVnetServiceEndpoint
	} else {
		destination.IgnoreMissingVnetServiceEndpoint = nil
	}

	// Reference
	if rule.Reference != nil {
		reference := rule.Reference.Copy()
		destination.Reference = &reference
	} else {
		destination.Reference = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForVirtualNetworkRule interface (if implemented) to customize the conversion
	var ruleAsAny any = rule
	if augmentedRule, ok := ruleAsAny.(augmentConversionForVirtualNetworkRule); ok {
		err := augmentedRule.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20210401preview.VirtualNetworkRule_STATUS
// A rule governing the accessibility of a vault from a specific virtual network.
type VirtualNetworkRule_STATUS struct {
	Id                               *string                `json:"id,omitempty"`
	IgnoreMissingVnetServiceEndpoint *bool                  `json:"ignoreMissingVnetServiceEndpoint,omitempty"`
	PropertyBag                      genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_VirtualNetworkRule_STATUS populates our VirtualNetworkRule_STATUS from the provided source VirtualNetworkRule_STATUS
func (rule *VirtualNetworkRule_STATUS) AssignProperties_From_VirtualNetworkRule_STATUS(source *storage.VirtualNetworkRule_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Id
	rule.Id = genruntime.ClonePointerToString(source.Id)

	// IgnoreMissingVnetServiceEndpoint
	if source.IgnoreMissingVnetServiceEndpoint != nil {
		ignoreMissingVnetServiceEndpoint := *source.IgnoreMissingVnetServiceEndpoint
		rule.IgnoreMissingVnetServiceEndpoint = &ignoreMissingVnetServiceEndpoint
	} else {
		rule.IgnoreMissingVnetServiceEndpoint = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		rule.PropertyBag = propertyBag
	} else {
		rule.PropertyBag = nil
	}

	// Invoke the augmentConversionForVirtualNetworkRule_STATUS interface (if implemented) to customize the conversion
	var ruleAsAny any = rule
	if augmentedRule, ok := ruleAsAny.(augmentConversionForVirtualNetworkRule_STATUS); ok {
		err := augmentedRule.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_VirtualNetworkRule_STATUS populates the provided destination VirtualNetworkRule_STATUS from our VirtualNetworkRule_STATUS
func (rule *VirtualNetworkRule_STATUS) AssignProperties_To_VirtualNetworkRule_STATUS(destination *storage.VirtualNetworkRule_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(rule.PropertyBag)

	// Id
	destination.Id = genruntime.ClonePointerToString(rule.Id)

	// IgnoreMissingVnetServiceEndpoint
	if rule.IgnoreMissingVnetServiceEndpoint != nil {
		ignoreMissingVnetServiceEndpoint := *rule.IgnoreMissingVnetServiceEndpoint
		destination.IgnoreMissingVnetServiceEndpoint = &ignoreMissingVnetServiceEndpoint
	} else {
		destination.IgnoreMissingVnetServiceEndpoint = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// Invoke the augmentConversionForVirtualNetworkRule_STATUS interface (if implemented) to customize the conversion
	var ruleAsAny any = rule
	if augmentedRule, ok := ruleAsAny.(augmentConversionForVirtualNetworkRule_STATUS); ok {
		err := augmentedRule.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForIPRule interface {
	AssignPropertiesFrom(src *storage.IPRule) error
	AssignPropertiesTo(dst *storage.IPRule) error
}

type augmentConversionForIPRule_STATUS interface {
	AssignPropertiesFrom(src *storage.IPRule_STATUS) error
	AssignPropertiesTo(dst *storage.IPRule_STATUS) error
}

type augmentConversionForPermissions interface {
	AssignPropertiesFrom(src *storage.Permissions) error
	AssignPropertiesTo(dst *storage.Permissions) error
}

type augmentConversionForPermissions_STATUS interface {
	AssignPropertiesFrom(src *storage.Permissions_STATUS) error
	AssignPropertiesTo(dst *storage.Permissions_STATUS) error
}

type augmentConversionForPrivateEndpoint_STATUS interface {
	AssignPropertiesFrom(src *storage.PrivateEndpoint_STATUS) error
	AssignPropertiesTo(dst *storage.PrivateEndpoint_STATUS) error
}

type augmentConversionForPrivateLinkServiceConnectionState_STATUS interface {
	AssignPropertiesFrom(src *storage.PrivateLinkServiceConnectionState_STATUS) error
	AssignPropertiesTo(dst *storage.PrivateLinkServiceConnectionState_STATUS) error
}

type augmentConversionForVirtualNetworkRule interface {
	AssignPropertiesFrom(src *storage.VirtualNetworkRule) error
	AssignPropertiesTo(dst *storage.VirtualNetworkRule) error
}

type augmentConversionForVirtualNetworkRule_STATUS interface {
	AssignPropertiesFrom(src *storage.VirtualNetworkRule_STATUS) error
	AssignPropertiesTo(dst *storage.VirtualNetworkRule_STATUS) error
}

func init() {
	SchemeBuilder.Register(&Vault{}, &VaultList{})
}
