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

import (
	"context"
	v20210601s "github.com/Azure/azure-service-operator/v2/api/dbforpostgresql/v1api20210601/storage"
	v20221201s "github.com/Azure/azure-service-operator/v2/api/dbforpostgresql/v1api20221201/storage"
	"github.com/Azure/azure-service-operator/v2/internal/genericarmclient"
	"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/go-logr/logr"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,dbforpostgresql}
// +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 v1api20220120preview.FlexibleServer
// Generator information:
// - Generated from: /postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-01-20-preview/postgresql.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}
type FlexibleServer struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              FlexibleServer_Spec   `json:"spec,omitempty"`
	Status            FlexibleServer_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &FlexibleServer{}

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

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

var _ conversion.Convertible = &FlexibleServer{}

// ConvertFrom populates our FlexibleServer from the provided hub FlexibleServer
func (server *FlexibleServer) ConvertFrom(hub conversion.Hub) error {
	// intermediate variable for conversion
	var source v20210601s.FlexibleServer

	err := source.ConvertFrom(hub)
	if err != nil {
		return eris.Wrap(err, "converting from hub to source")
	}

	err = server.AssignProperties_From_FlexibleServer(&source)
	if err != nil {
		return eris.Wrap(err, "converting from source to server")
	}

	return nil
}

// ConvertTo populates the provided hub FlexibleServer from our FlexibleServer
func (server *FlexibleServer) ConvertTo(hub conversion.Hub) error {
	// intermediate variable for conversion
	var destination v20210601s.FlexibleServer
	err := server.AssignProperties_To_FlexibleServer(&destination)
	if err != nil {
		return eris.Wrap(err, "converting to destination from server")
	}
	err = destination.ConvertTo(hub)
	if err != nil {
		return eris.Wrap(err, "converting from destination to hub")
	}

	return nil
}

var _ configmaps.Exporter = &FlexibleServer{}

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

var _ secrets.Exporter = &FlexibleServer{}

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

var _ genruntime.KubernetesConfigExporter = &FlexibleServer{}

// ExportKubernetesConfigMaps defines a resource which can create ConfigMaps in Kubernetes.
func (server *FlexibleServer) ExportKubernetesConfigMaps(_ context.Context, _ genruntime.MetaObject, _ *genericarmclient.GenericClient, _ logr.Logger) ([]client.Object, error) {
	collector := configmaps.NewCollector(server.Namespace)
	if server.Spec.OperatorSpec != nil && server.Spec.OperatorSpec.ConfigMaps != nil {
		if server.Status.FullyQualifiedDomainName != nil {
			collector.AddValue(server.Spec.OperatorSpec.ConfigMaps.FullyQualifiedDomainName, *server.Status.FullyQualifiedDomainName)
		}
	}
	result, err := collector.Values()
	if err != nil {
		return nil, err
	}
	return configmaps.SliceToClientObjectSlice(result), nil
}

var _ genruntime.KubernetesResource = &FlexibleServer{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2022-01-20-preview"
func (server FlexibleServer) GetAPIVersion() string {
	return "2022-01-20-preview"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.DBforPostgreSQL/flexibleServers"
func (server *FlexibleServer) GetType() string {
	return "Microsoft.DBforPostgreSQL/flexibleServers"
}

// NewEmptyStatus returns a new empty (blank) status
func (server *FlexibleServer) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &FlexibleServer_STATUS{}
}

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

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

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

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

	server.Status = st
	return nil
}

// AssignProperties_From_FlexibleServer populates our FlexibleServer from the provided source FlexibleServer
func (server *FlexibleServer) AssignProperties_From_FlexibleServer(source *v20210601s.FlexibleServer) error {

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

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

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

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

	// No error
	return nil
}

// AssignProperties_To_FlexibleServer populates the provided destination FlexibleServer from our FlexibleServer
func (server *FlexibleServer) AssignProperties_To_FlexibleServer(destination *v20210601s.FlexibleServer) error {

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

	// Spec
	var spec v20210601s.FlexibleServer_Spec
	err := server.Spec.AssignProperties_To_FlexibleServer_Spec(&spec)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_FlexibleServer_Spec() to populate field Spec")
	}
	destination.Spec = spec

	// Status
	var status v20210601s.FlexibleServer_STATUS
	err = server.Status.AssignProperties_To_FlexibleServer_STATUS(&status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_FlexibleServer_STATUS() to populate field Status")
	}
	destination.Status = status

	// Invoke the augmentConversionForFlexibleServer interface (if implemented) to customize the conversion
	var serverAsAny any = server
	if augmentedServer, ok := serverAsAny.(augmentConversionForFlexibleServer); ok {
		err := augmentedServer.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 (server *FlexibleServer) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: server.Spec.OriginalVersion,
		Kind:    "FlexibleServer",
	}
}

// +kubebuilder:object:root=true
// Storage version of v1api20220120preview.FlexibleServer
// Generator information:
// - Generated from: /postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2022-01-20-preview/postgresql.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}
type FlexibleServerList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []FlexibleServer `json:"items"`
}

// Storage version of v1api20220120preview.APIVersion
// +kubebuilder:validation:Enum={"2022-01-20-preview"}
type APIVersion string

const APIVersion_Value = APIVersion("2022-01-20-preview")

type augmentConversionForFlexibleServer interface {
	AssignPropertiesFrom(src *v20210601s.FlexibleServer) error
	AssignPropertiesTo(dst *v20210601s.FlexibleServer) error
}

// Storage version of v1api20220120preview.FlexibleServer_Spec
type FlexibleServer_Spec struct {
	AdministratorLogin         *string                     `json:"administratorLogin,omitempty"`
	AdministratorLoginPassword *genruntime.SecretReference `json:"administratorLoginPassword,omitempty"`
	AvailabilityZone           *string                     `json:"availabilityZone,omitempty"`

	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName         string                      `json:"azureName,omitempty"`
	Backup            *Backup                     `json:"backup,omitempty"`
	CreateMode        *string                     `json:"createMode,omitempty"`
	HighAvailability  *HighAvailability           `json:"highAvailability,omitempty"`
	Location          *string                     `json:"location,omitempty"`
	MaintenanceWindow *MaintenanceWindow          `json:"maintenanceWindow,omitempty"`
	Network           *Network                    `json:"network,omitempty"`
	OperatorSpec      *FlexibleServerOperatorSpec `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"`
	PointInTimeUTC *string                            `json:"pointInTimeUTC,omitempty"`
	PropertyBag    genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	Sku            *Sku                               `json:"sku,omitempty"`

	// SourceServerResourceReference: The source server resource ID to restore from. It's required when 'createMode' is
	// 'PointInTimeRestore'.
	SourceServerResourceReference *genruntime.ResourceReference `armReference:"SourceServerResourceId" json:"sourceServerResourceReference,omitempty"`
	Storage                       *Storage                      `json:"storage,omitempty"`
	Tags                          map[string]string             `json:"tags,omitempty"`
	Version                       *string                       `json:"version,omitempty"`
}

var _ genruntime.ConvertibleSpec = &FlexibleServer_Spec{}

// ConvertSpecFrom populates our FlexibleServer_Spec from the provided source
func (server *FlexibleServer_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	src, ok := source.(*v20210601s.FlexibleServer_Spec)
	if ok {
		// Populate our instance from source
		return server.AssignProperties_From_FlexibleServer_Spec(src)
	}

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

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

	return nil
}

// ConvertSpecTo populates the provided destination from our FlexibleServer_Spec
func (server *FlexibleServer_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	dst, ok := destination.(*v20210601s.FlexibleServer_Spec)
	if ok {
		// Populate destination from our instance
		return server.AssignProperties_To_FlexibleServer_Spec(dst)
	}

	// Convert to an intermediate form
	dst = &v20210601s.FlexibleServer_Spec{}
	err := server.AssignProperties_To_FlexibleServer_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_FlexibleServer_Spec populates our FlexibleServer_Spec from the provided source FlexibleServer_Spec
func (server *FlexibleServer_Spec) AssignProperties_From_FlexibleServer_Spec(source *v20210601s.FlexibleServer_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AdministratorLogin
	server.AdministratorLogin = genruntime.ClonePointerToString(source.AdministratorLogin)

	// AdministratorLoginPassword
	if source.AdministratorLoginPassword != nil {
		administratorLoginPassword := source.AdministratorLoginPassword.Copy()
		server.AdministratorLoginPassword = &administratorLoginPassword
	} else {
		server.AdministratorLoginPassword = nil
	}

	// AvailabilityZone
	server.AvailabilityZone = genruntime.ClonePointerToString(source.AvailabilityZone)

	// AzureName
	server.AzureName = source.AzureName

	// Backup
	if source.Backup != nil {
		var backup Backup
		err := backup.AssignProperties_From_Backup(source.Backup)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Backup() to populate field Backup")
		}
		server.Backup = &backup
	} else {
		server.Backup = nil
	}

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

	// HighAvailability
	if source.HighAvailability != nil {
		var highAvailability HighAvailability
		err := highAvailability.AssignProperties_From_HighAvailability(source.HighAvailability)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_HighAvailability() to populate field HighAvailability")
		}
		server.HighAvailability = &highAvailability
	} else {
		server.HighAvailability = nil
	}

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

	// MaintenanceWindow
	if source.MaintenanceWindow != nil {
		var maintenanceWindow MaintenanceWindow
		err := maintenanceWindow.AssignProperties_From_MaintenanceWindow(source.MaintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_MaintenanceWindow() to populate field MaintenanceWindow")
		}
		server.MaintenanceWindow = &maintenanceWindow
	} else {
		server.MaintenanceWindow = nil
	}

	// Network
	if source.Network != nil {
		var network Network
		err := network.AssignProperties_From_Network(source.Network)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Network() to populate field Network")
		}
		server.Network = &network
	} else {
		server.Network = nil
	}

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

	// OriginalVersion
	server.OriginalVersion = source.OriginalVersion

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

	// PointInTimeUTC
	server.PointInTimeUTC = genruntime.ClonePointerToString(source.PointInTimeUTC)

	// 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")
		}
		server.Sku = &sku
	} else {
		server.Sku = nil
	}

	// SourceServerResourceReference
	if source.SourceServerResourceReference != nil {
		sourceServerResourceReference := source.SourceServerResourceReference.Copy()
		server.SourceServerResourceReference = &sourceServerResourceReference
	} else {
		server.SourceServerResourceReference = nil
	}

	// Storage
	if source.Storage != nil {
		var storage Storage
		err := storage.AssignProperties_From_Storage(source.Storage)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Storage() to populate field Storage")
		}
		server.Storage = &storage
	} else {
		server.Storage = nil
	}

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

	// Version
	server.Version = genruntime.ClonePointerToString(source.Version)

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

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

	// No error
	return nil
}

// AssignProperties_To_FlexibleServer_Spec populates the provided destination FlexibleServer_Spec from our FlexibleServer_Spec
func (server *FlexibleServer_Spec) AssignProperties_To_FlexibleServer_Spec(destination *v20210601s.FlexibleServer_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(server.PropertyBag)

	// AdministratorLogin
	destination.AdministratorLogin = genruntime.ClonePointerToString(server.AdministratorLogin)

	// AdministratorLoginPassword
	if server.AdministratorLoginPassword != nil {
		administratorLoginPassword := server.AdministratorLoginPassword.Copy()
		destination.AdministratorLoginPassword = &administratorLoginPassword
	} else {
		destination.AdministratorLoginPassword = nil
	}

	// AvailabilityZone
	destination.AvailabilityZone = genruntime.ClonePointerToString(server.AvailabilityZone)

	// AzureName
	destination.AzureName = server.AzureName

	// Backup
	if server.Backup != nil {
		var backup v20210601s.Backup
		err := server.Backup.AssignProperties_To_Backup(&backup)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Backup() to populate field Backup")
		}
		destination.Backup = &backup
	} else {
		destination.Backup = nil
	}

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

	// HighAvailability
	if server.HighAvailability != nil {
		var highAvailability v20210601s.HighAvailability
		err := server.HighAvailability.AssignProperties_To_HighAvailability(&highAvailability)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_HighAvailability() to populate field HighAvailability")
		}
		destination.HighAvailability = &highAvailability
	} else {
		destination.HighAvailability = nil
	}

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

	// MaintenanceWindow
	if server.MaintenanceWindow != nil {
		var maintenanceWindow v20210601s.MaintenanceWindow
		err := server.MaintenanceWindow.AssignProperties_To_MaintenanceWindow(&maintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_MaintenanceWindow() to populate field MaintenanceWindow")
		}
		destination.MaintenanceWindow = &maintenanceWindow
	} else {
		destination.MaintenanceWindow = nil
	}

	// Network
	if server.Network != nil {
		var network v20210601s.Network
		err := server.Network.AssignProperties_To_Network(&network)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Network() to populate field Network")
		}
		destination.Network = &network
	} else {
		destination.Network = nil
	}

	// OperatorSpec
	if server.OperatorSpec != nil {
		var operatorSpec v20210601s.FlexibleServerOperatorSpec
		err := server.OperatorSpec.AssignProperties_To_FlexibleServerOperatorSpec(&operatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FlexibleServerOperatorSpec() to populate field OperatorSpec")
		}
		destination.OperatorSpec = &operatorSpec
	} else {
		destination.OperatorSpec = nil
	}

	// OriginalVersion
	destination.OriginalVersion = server.OriginalVersion

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

	// PointInTimeUTC
	destination.PointInTimeUTC = genruntime.ClonePointerToString(server.PointInTimeUTC)

	// Sku
	if server.Sku != nil {
		var sku v20210601s.Sku
		err := server.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
	}

	// SourceServerResourceReference
	if server.SourceServerResourceReference != nil {
		sourceServerResourceReference := server.SourceServerResourceReference.Copy()
		destination.SourceServerResourceReference = &sourceServerResourceReference
	} else {
		destination.SourceServerResourceReference = nil
	}

	// Storage
	if server.Storage != nil {
		var storage v20210601s.Storage
		err := server.Storage.AssignProperties_To_Storage(&storage)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Storage() to populate field Storage")
		}
		destination.Storage = &storage
	} else {
		destination.Storage = nil
	}

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

	// Version
	destination.Version = genruntime.ClonePointerToString(server.Version)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.FlexibleServer_STATUS
type FlexibleServer_STATUS struct {
	AdministratorLogin       *string                   `json:"administratorLogin,omitempty"`
	AvailabilityZone         *string                   `json:"availabilityZone,omitempty"`
	Backup                   *Backup_STATUS            `json:"backup,omitempty"`
	Conditions               []conditions.Condition    `json:"conditions,omitempty"`
	CreateMode               *string                   `json:"createMode,omitempty"`
	FullyQualifiedDomainName *string                   `json:"fullyQualifiedDomainName,omitempty"`
	HighAvailability         *HighAvailability_STATUS  `json:"highAvailability,omitempty"`
	Id                       *string                   `json:"id,omitempty"`
	Location                 *string                   `json:"location,omitempty"`
	MaintenanceWindow        *MaintenanceWindow_STATUS `json:"maintenanceWindow,omitempty"`
	MinorVersion             *string                   `json:"minorVersion,omitempty"`
	Name                     *string                   `json:"name,omitempty"`
	Network                  *Network_STATUS           `json:"network,omitempty"`
	PointInTimeUTC           *string                   `json:"pointInTimeUTC,omitempty"`
	PropertyBag              genruntime.PropertyBag    `json:"$propertyBag,omitempty"`
	Sku                      *Sku_STATUS               `json:"sku,omitempty"`
	SourceServerResourceId   *string                   `json:"sourceServerResourceId,omitempty"`
	State                    *string                   `json:"state,omitempty"`
	Storage                  *Storage_STATUS           `json:"storage,omitempty"`
	SystemData               *SystemData_STATUS        `json:"systemData,omitempty"`
	Tags                     map[string]string         `json:"tags,omitempty"`
	Type                     *string                   `json:"type,omitempty"`
	Version                  *string                   `json:"version,omitempty"`
}

var _ genruntime.ConvertibleStatus = &FlexibleServer_STATUS{}

// ConvertStatusFrom populates our FlexibleServer_STATUS from the provided source
func (server *FlexibleServer_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	src, ok := source.(*v20210601s.FlexibleServer_STATUS)
	if ok {
		// Populate our instance from source
		return server.AssignProperties_From_FlexibleServer_STATUS(src)
	}

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

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

	return nil
}

// ConvertStatusTo populates the provided destination from our FlexibleServer_STATUS
func (server *FlexibleServer_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	dst, ok := destination.(*v20210601s.FlexibleServer_STATUS)
	if ok {
		// Populate destination from our instance
		return server.AssignProperties_To_FlexibleServer_STATUS(dst)
	}

	// Convert to an intermediate form
	dst = &v20210601s.FlexibleServer_STATUS{}
	err := server.AssignProperties_To_FlexibleServer_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_FlexibleServer_STATUS populates our FlexibleServer_STATUS from the provided source FlexibleServer_STATUS
func (server *FlexibleServer_STATUS) AssignProperties_From_FlexibleServer_STATUS(source *v20210601s.FlexibleServer_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AdministratorLogin
	server.AdministratorLogin = genruntime.ClonePointerToString(source.AdministratorLogin)

	// AvailabilityZone
	server.AvailabilityZone = genruntime.ClonePointerToString(source.AvailabilityZone)

	// Backup
	if source.Backup != nil {
		var backup Backup_STATUS
		err := backup.AssignProperties_From_Backup_STATUS(source.Backup)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Backup_STATUS() to populate field Backup")
		}
		server.Backup = &backup
	} else {
		server.Backup = nil
	}

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

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

	// FullyQualifiedDomainName
	server.FullyQualifiedDomainName = genruntime.ClonePointerToString(source.FullyQualifiedDomainName)

	// HighAvailability
	if source.HighAvailability != nil {
		var highAvailability HighAvailability_STATUS
		err := highAvailability.AssignProperties_From_HighAvailability_STATUS(source.HighAvailability)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_HighAvailability_STATUS() to populate field HighAvailability")
		}
		server.HighAvailability = &highAvailability
	} else {
		server.HighAvailability = nil
	}

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

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

	// MaintenanceWindow
	if source.MaintenanceWindow != nil {
		var maintenanceWindow MaintenanceWindow_STATUS
		err := maintenanceWindow.AssignProperties_From_MaintenanceWindow_STATUS(source.MaintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_MaintenanceWindow_STATUS() to populate field MaintenanceWindow")
		}
		server.MaintenanceWindow = &maintenanceWindow
	} else {
		server.MaintenanceWindow = nil
	}

	// MinorVersion
	server.MinorVersion = genruntime.ClonePointerToString(source.MinorVersion)

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

	// Network
	if source.Network != nil {
		var network Network_STATUS
		err := network.AssignProperties_From_Network_STATUS(source.Network)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Network_STATUS() to populate field Network")
		}
		server.Network = &network
	} else {
		server.Network = nil
	}

	// PointInTimeUTC
	server.PointInTimeUTC = genruntime.ClonePointerToString(source.PointInTimeUTC)

	// 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")
		}
		server.Sku = &sku
	} else {
		server.Sku = nil
	}

	// SourceServerResourceId
	server.SourceServerResourceId = genruntime.ClonePointerToString(source.SourceServerResourceId)

	// State
	server.State = genruntime.ClonePointerToString(source.State)

	// Storage
	if source.Storage != nil {
		var storage Storage_STATUS
		err := storage.AssignProperties_From_Storage_STATUS(source.Storage)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Storage_STATUS() to populate field Storage")
		}
		server.Storage = &storage
	} else {
		server.Storage = 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")
		}
		server.SystemData = &systemDatum
	} else {
		server.SystemData = nil
	}

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

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

	// Version
	server.Version = genruntime.ClonePointerToString(source.Version)

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

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

	// No error
	return nil
}

// AssignProperties_To_FlexibleServer_STATUS populates the provided destination FlexibleServer_STATUS from our FlexibleServer_STATUS
func (server *FlexibleServer_STATUS) AssignProperties_To_FlexibleServer_STATUS(destination *v20210601s.FlexibleServer_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(server.PropertyBag)

	// AdministratorLogin
	destination.AdministratorLogin = genruntime.ClonePointerToString(server.AdministratorLogin)

	// AvailabilityZone
	destination.AvailabilityZone = genruntime.ClonePointerToString(server.AvailabilityZone)

	// Backup
	if server.Backup != nil {
		var backup v20210601s.Backup_STATUS
		err := server.Backup.AssignProperties_To_Backup_STATUS(&backup)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Backup_STATUS() to populate field Backup")
		}
		destination.Backup = &backup
	} else {
		destination.Backup = nil
	}

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

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

	// FullyQualifiedDomainName
	destination.FullyQualifiedDomainName = genruntime.ClonePointerToString(server.FullyQualifiedDomainName)

	// HighAvailability
	if server.HighAvailability != nil {
		var highAvailability v20210601s.HighAvailability_STATUS
		err := server.HighAvailability.AssignProperties_To_HighAvailability_STATUS(&highAvailability)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_HighAvailability_STATUS() to populate field HighAvailability")
		}
		destination.HighAvailability = &highAvailability
	} else {
		destination.HighAvailability = nil
	}

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

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

	// MaintenanceWindow
	if server.MaintenanceWindow != nil {
		var maintenanceWindow v20210601s.MaintenanceWindow_STATUS
		err := server.MaintenanceWindow.AssignProperties_To_MaintenanceWindow_STATUS(&maintenanceWindow)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_MaintenanceWindow_STATUS() to populate field MaintenanceWindow")
		}
		destination.MaintenanceWindow = &maintenanceWindow
	} else {
		destination.MaintenanceWindow = nil
	}

	// MinorVersion
	destination.MinorVersion = genruntime.ClonePointerToString(server.MinorVersion)

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

	// Network
	if server.Network != nil {
		var network v20210601s.Network_STATUS
		err := server.Network.AssignProperties_To_Network_STATUS(&network)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Network_STATUS() to populate field Network")
		}
		destination.Network = &network
	} else {
		destination.Network = nil
	}

	// PointInTimeUTC
	destination.PointInTimeUTC = genruntime.ClonePointerToString(server.PointInTimeUTC)

	// Sku
	if server.Sku != nil {
		var sku v20210601s.Sku_STATUS
		err := server.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
	}

	// SourceServerResourceId
	destination.SourceServerResourceId = genruntime.ClonePointerToString(server.SourceServerResourceId)

	// State
	destination.State = genruntime.ClonePointerToString(server.State)

	// Storage
	if server.Storage != nil {
		var storage v20210601s.Storage_STATUS
		err := server.Storage.AssignProperties_To_Storage_STATUS(&storage)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Storage_STATUS() to populate field Storage")
		}
		destination.Storage = &storage
	} else {
		destination.Storage = nil
	}

	// SystemData
	if server.SystemData != nil {
		var systemDatum v20210601s.SystemData_STATUS
		err := server.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(server.Tags)

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

	// Version
	destination.Version = genruntime.ClonePointerToString(server.Version)

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

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

	// No error
	return nil
}

type augmentConversionForFlexibleServer_Spec interface {
	AssignPropertiesFrom(src *v20210601s.FlexibleServer_Spec) error
	AssignPropertiesTo(dst *v20210601s.FlexibleServer_Spec) error
}

type augmentConversionForFlexibleServer_STATUS interface {
	AssignPropertiesFrom(src *v20210601s.FlexibleServer_STATUS) error
	AssignPropertiesTo(dst *v20210601s.FlexibleServer_STATUS) error
}

// Storage version of v1api20220120preview.Backup
// Backup properties of a server
type Backup struct {
	BackupRetentionDays *int                   `json:"backupRetentionDays,omitempty"`
	GeoRedundantBackup  *string                `json:"geoRedundantBackup,omitempty"`
	PropertyBag         genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_Backup populates our Backup from the provided source Backup
func (backup *Backup) AssignProperties_From_Backup(source *v20210601s.Backup) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// BackupRetentionDays
	backup.BackupRetentionDays = genruntime.ClonePointerToInt(source.BackupRetentionDays)

	// GeoRedundantBackup
	backup.GeoRedundantBackup = genruntime.ClonePointerToString(source.GeoRedundantBackup)

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

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

	// No error
	return nil
}

// AssignProperties_To_Backup populates the provided destination Backup from our Backup
func (backup *Backup) AssignProperties_To_Backup(destination *v20210601s.Backup) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(backup.PropertyBag)

	// BackupRetentionDays
	destination.BackupRetentionDays = genruntime.ClonePointerToInt(backup.BackupRetentionDays)

	// GeoRedundantBackup
	destination.GeoRedundantBackup = genruntime.ClonePointerToString(backup.GeoRedundantBackup)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.Backup_STATUS
// Backup properties of a server
type Backup_STATUS struct {
	BackupRetentionDays *int                   `json:"backupRetentionDays,omitempty"`
	EarliestRestoreDate *string                `json:"earliestRestoreDate,omitempty"`
	GeoRedundantBackup  *string                `json:"geoRedundantBackup,omitempty"`
	PropertyBag         genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_Backup_STATUS populates our Backup_STATUS from the provided source Backup_STATUS
func (backup *Backup_STATUS) AssignProperties_From_Backup_STATUS(source *v20210601s.Backup_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// BackupRetentionDays
	backup.BackupRetentionDays = genruntime.ClonePointerToInt(source.BackupRetentionDays)

	// EarliestRestoreDate
	backup.EarliestRestoreDate = genruntime.ClonePointerToString(source.EarliestRestoreDate)

	// GeoRedundantBackup
	backup.GeoRedundantBackup = genruntime.ClonePointerToString(source.GeoRedundantBackup)

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

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

	// No error
	return nil
}

// AssignProperties_To_Backup_STATUS populates the provided destination Backup_STATUS from our Backup_STATUS
func (backup *Backup_STATUS) AssignProperties_To_Backup_STATUS(destination *v20210601s.Backup_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(backup.PropertyBag)

	// BackupRetentionDays
	destination.BackupRetentionDays = genruntime.ClonePointerToInt(backup.BackupRetentionDays)

	// EarliestRestoreDate
	destination.EarliestRestoreDate = genruntime.ClonePointerToString(backup.EarliestRestoreDate)

	// GeoRedundantBackup
	destination.GeoRedundantBackup = genruntime.ClonePointerToString(backup.GeoRedundantBackup)

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

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

	// No error
	return nil
}

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

// AssignProperties_From_FlexibleServerOperatorSpec populates our FlexibleServerOperatorSpec from the provided source FlexibleServerOperatorSpec
func (operator *FlexibleServerOperatorSpec) AssignProperties_From_FlexibleServerOperatorSpec(source *v20210601s.FlexibleServerOperatorSpec) 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
	}

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

		operator.ConfigMaps = &configMap
	} else {
		operator.ConfigMaps = 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
	}

	// Secrets
	if source.Secrets != nil {
		var secret FlexibleServerOperatorSecrets
		err := secret.AssignProperties_From_FlexibleServerOperatorSecrets(source.Secrets)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_FlexibleServerOperatorSecrets() to populate field Secrets")
		}
		operator.Secrets = &secret
	} else {
		operator.Secrets = nil
	}

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

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

	// No error
	return nil
}

// AssignProperties_To_FlexibleServerOperatorSpec populates the provided destination FlexibleServerOperatorSpec from our FlexibleServerOperatorSpec
func (operator *FlexibleServerOperatorSpec) AssignProperties_To_FlexibleServerOperatorSpec(destination *v20210601s.FlexibleServerOperatorSpec) 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
	}

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

	// 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
	}

	// Secrets
	if operator.Secrets != nil {
		var secret v20210601s.FlexibleServerOperatorSecrets
		err := operator.Secrets.AssignProperties_To_FlexibleServerOperatorSecrets(&secret)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_FlexibleServerOperatorSecrets() to populate field Secrets")
		}
		destination.Secrets = &secret
	} else {
		destination.Secrets = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.HighAvailability
// High availability properties of a server
type HighAvailability struct {
	Mode                    *string                `json:"mode,omitempty"`
	PropertyBag             genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StandbyAvailabilityZone *string                `json:"standbyAvailabilityZone,omitempty"`
}

// AssignProperties_From_HighAvailability populates our HighAvailability from the provided source HighAvailability
func (availability *HighAvailability) AssignProperties_From_HighAvailability(source *v20210601s.HighAvailability) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Mode
	availability.Mode = genruntime.ClonePointerToString(source.Mode)

	// StandbyAvailabilityZone
	availability.StandbyAvailabilityZone = genruntime.ClonePointerToString(source.StandbyAvailabilityZone)

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

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

	// No error
	return nil
}

// AssignProperties_To_HighAvailability populates the provided destination HighAvailability from our HighAvailability
func (availability *HighAvailability) AssignProperties_To_HighAvailability(destination *v20210601s.HighAvailability) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(availability.PropertyBag)

	// Mode
	destination.Mode = genruntime.ClonePointerToString(availability.Mode)

	// StandbyAvailabilityZone
	destination.StandbyAvailabilityZone = genruntime.ClonePointerToString(availability.StandbyAvailabilityZone)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.HighAvailability_STATUS
// High availability properties of a server
type HighAvailability_STATUS struct {
	Mode                    *string                `json:"mode,omitempty"`
	PropertyBag             genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StandbyAvailabilityZone *string                `json:"standbyAvailabilityZone,omitempty"`
	State                   *string                `json:"state,omitempty"`
}

// AssignProperties_From_HighAvailability_STATUS populates our HighAvailability_STATUS from the provided source HighAvailability_STATUS
func (availability *HighAvailability_STATUS) AssignProperties_From_HighAvailability_STATUS(source *v20210601s.HighAvailability_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// Mode
	availability.Mode = genruntime.ClonePointerToString(source.Mode)

	// StandbyAvailabilityZone
	availability.StandbyAvailabilityZone = genruntime.ClonePointerToString(source.StandbyAvailabilityZone)

	// State
	availability.State = genruntime.ClonePointerToString(source.State)

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

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

	// No error
	return nil
}

// AssignProperties_To_HighAvailability_STATUS populates the provided destination HighAvailability_STATUS from our HighAvailability_STATUS
func (availability *HighAvailability_STATUS) AssignProperties_To_HighAvailability_STATUS(destination *v20210601s.HighAvailability_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(availability.PropertyBag)

	// Mode
	destination.Mode = genruntime.ClonePointerToString(availability.Mode)

	// StandbyAvailabilityZone
	destination.StandbyAvailabilityZone = genruntime.ClonePointerToString(availability.StandbyAvailabilityZone)

	// State
	destination.State = genruntime.ClonePointerToString(availability.State)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.MaintenanceWindow
// Maintenance window properties of a server.
type MaintenanceWindow struct {
	CustomWindow *string                `json:"customWindow,omitempty"`
	DayOfWeek    *int                   `json:"dayOfWeek,omitempty"`
	PropertyBag  genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StartHour    *int                   `json:"startHour,omitempty"`
	StartMinute  *int                   `json:"startMinute,omitempty"`
}

// AssignProperties_From_MaintenanceWindow populates our MaintenanceWindow from the provided source MaintenanceWindow
func (window *MaintenanceWindow) AssignProperties_From_MaintenanceWindow(source *v20210601s.MaintenanceWindow) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// CustomWindow
	window.CustomWindow = genruntime.ClonePointerToString(source.CustomWindow)

	// DayOfWeek
	window.DayOfWeek = genruntime.ClonePointerToInt(source.DayOfWeek)

	// StartHour
	window.StartHour = genruntime.ClonePointerToInt(source.StartHour)

	// StartMinute
	window.StartMinute = genruntime.ClonePointerToInt(source.StartMinute)

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

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

	// No error
	return nil
}

// AssignProperties_To_MaintenanceWindow populates the provided destination MaintenanceWindow from our MaintenanceWindow
func (window *MaintenanceWindow) AssignProperties_To_MaintenanceWindow(destination *v20210601s.MaintenanceWindow) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(window.PropertyBag)

	// CustomWindow
	destination.CustomWindow = genruntime.ClonePointerToString(window.CustomWindow)

	// DayOfWeek
	destination.DayOfWeek = genruntime.ClonePointerToInt(window.DayOfWeek)

	// StartHour
	destination.StartHour = genruntime.ClonePointerToInt(window.StartHour)

	// StartMinute
	destination.StartMinute = genruntime.ClonePointerToInt(window.StartMinute)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.MaintenanceWindow_STATUS
// Maintenance window properties of a server.
type MaintenanceWindow_STATUS struct {
	CustomWindow *string                `json:"customWindow,omitempty"`
	DayOfWeek    *int                   `json:"dayOfWeek,omitempty"`
	PropertyBag  genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StartHour    *int                   `json:"startHour,omitempty"`
	StartMinute  *int                   `json:"startMinute,omitempty"`
}

// AssignProperties_From_MaintenanceWindow_STATUS populates our MaintenanceWindow_STATUS from the provided source MaintenanceWindow_STATUS
func (window *MaintenanceWindow_STATUS) AssignProperties_From_MaintenanceWindow_STATUS(source *v20210601s.MaintenanceWindow_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// CustomWindow
	window.CustomWindow = genruntime.ClonePointerToString(source.CustomWindow)

	// DayOfWeek
	window.DayOfWeek = genruntime.ClonePointerToInt(source.DayOfWeek)

	// StartHour
	window.StartHour = genruntime.ClonePointerToInt(source.StartHour)

	// StartMinute
	window.StartMinute = genruntime.ClonePointerToInt(source.StartMinute)

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

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

	// No error
	return nil
}

// AssignProperties_To_MaintenanceWindow_STATUS populates the provided destination MaintenanceWindow_STATUS from our MaintenanceWindow_STATUS
func (window *MaintenanceWindow_STATUS) AssignProperties_To_MaintenanceWindow_STATUS(destination *v20210601s.MaintenanceWindow_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(window.PropertyBag)

	// CustomWindow
	destination.CustomWindow = genruntime.ClonePointerToString(window.CustomWindow)

	// DayOfWeek
	destination.DayOfWeek = genruntime.ClonePointerToInt(window.DayOfWeek)

	// StartHour
	destination.StartHour = genruntime.ClonePointerToInt(window.StartHour)

	// StartMinute
	destination.StartMinute = genruntime.ClonePointerToInt(window.StartMinute)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.Network
// Network properties of a server
type Network struct {
	// DelegatedSubnetResourceReference: delegated subnet arm resource id.
	DelegatedSubnetResourceReference *genruntime.ResourceReference `armReference:"DelegatedSubnetResourceId" json:"delegatedSubnetResourceReference,omitempty"`

	// PrivateDnsZoneArmResourceReference: private dns zone arm resource id.
	PrivateDnsZoneArmResourceReference *genruntime.ResourceReference `armReference:"PrivateDnsZoneArmResourceId" json:"privateDnsZoneArmResourceReference,omitempty"`
	PropertyBag                        genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_Network populates our Network from the provided source Network
func (network *Network) AssignProperties_From_Network(source *v20210601s.Network) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// DelegatedSubnetResourceReference
	if source.DelegatedSubnetResourceReference != nil {
		delegatedSubnetResourceReference := source.DelegatedSubnetResourceReference.Copy()
		network.DelegatedSubnetResourceReference = &delegatedSubnetResourceReference
	} else {
		network.DelegatedSubnetResourceReference = nil
	}

	// PrivateDnsZoneArmResourceReference
	if source.PrivateDnsZoneArmResourceReference != nil {
		privateDnsZoneArmResourceReference := source.PrivateDnsZoneArmResourceReference.Copy()
		network.PrivateDnsZoneArmResourceReference = &privateDnsZoneArmResourceReference
	} else {
		network.PrivateDnsZoneArmResourceReference = nil
	}

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

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

	// No error
	return nil
}

// AssignProperties_To_Network populates the provided destination Network from our Network
func (network *Network) AssignProperties_To_Network(destination *v20210601s.Network) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(network.PropertyBag)

	// DelegatedSubnetResourceReference
	if network.DelegatedSubnetResourceReference != nil {
		delegatedSubnetResourceReference := network.DelegatedSubnetResourceReference.Copy()
		destination.DelegatedSubnetResourceReference = &delegatedSubnetResourceReference
	} else {
		destination.DelegatedSubnetResourceReference = nil
	}

	// PrivateDnsZoneArmResourceReference
	if network.PrivateDnsZoneArmResourceReference != nil {
		privateDnsZoneArmResourceReference := network.PrivateDnsZoneArmResourceReference.Copy()
		destination.PrivateDnsZoneArmResourceReference = &privateDnsZoneArmResourceReference
	} else {
		destination.PrivateDnsZoneArmResourceReference = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.Network_STATUS
// Network properties of a server
type Network_STATUS struct {
	DelegatedSubnetResourceId   *string                `json:"delegatedSubnetResourceId,omitempty"`
	PrivateDnsZoneArmResourceId *string                `json:"privateDnsZoneArmResourceId,omitempty"`
	PropertyBag                 genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	PublicNetworkAccess         *string                `json:"publicNetworkAccess,omitempty"`
}

// AssignProperties_From_Network_STATUS populates our Network_STATUS from the provided source Network_STATUS
func (network *Network_STATUS) AssignProperties_From_Network_STATUS(source *v20210601s.Network_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// DelegatedSubnetResourceId
	network.DelegatedSubnetResourceId = genruntime.ClonePointerToString(source.DelegatedSubnetResourceId)

	// PrivateDnsZoneArmResourceId
	network.PrivateDnsZoneArmResourceId = genruntime.ClonePointerToString(source.PrivateDnsZoneArmResourceId)

	// PublicNetworkAccess
	network.PublicNetworkAccess = genruntime.ClonePointerToString(source.PublicNetworkAccess)

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

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

	// No error
	return nil
}

// AssignProperties_To_Network_STATUS populates the provided destination Network_STATUS from our Network_STATUS
func (network *Network_STATUS) AssignProperties_To_Network_STATUS(destination *v20210601s.Network_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(network.PropertyBag)

	// DelegatedSubnetResourceId
	destination.DelegatedSubnetResourceId = genruntime.ClonePointerToString(network.DelegatedSubnetResourceId)

	// PrivateDnsZoneArmResourceId
	destination.PrivateDnsZoneArmResourceId = genruntime.ClonePointerToString(network.PrivateDnsZoneArmResourceId)

	// PublicNetworkAccess
	destination.PublicNetworkAccess = genruntime.ClonePointerToString(network.PublicNetworkAccess)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.Sku
// Sku information related properties of a server.
type Sku struct {
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Tier        *string                `json:"tier,omitempty"`
}

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

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

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

	// 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 *v20210601s.Sku) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(sku.PropertyBag)

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

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

	// 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 v1api20220120preview.Sku_STATUS
// Sku information related properties of a server.
type Sku_STATUS struct {
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Tier        *string                `json:"tier,omitempty"`
}

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

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

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

	// 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 *v20210601s.Sku_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(sku.PropertyBag)

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

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

	// 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
}

// Storage version of v1api20220120preview.Storage
// Storage properties of a server
type Storage struct {
	PropertyBag   genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StorageSizeGB *int                   `json:"storageSizeGB,omitempty"`
}

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

	// StorageSizeGB
	storage.StorageSizeGB = genruntime.ClonePointerToInt(source.StorageSizeGB)

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

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

	// No error
	return nil
}

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

	// StorageSizeGB
	destination.StorageSizeGB = genruntime.ClonePointerToInt(storage.StorageSizeGB)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.Storage_STATUS
// Storage properties of a server
type Storage_STATUS struct {
	PropertyBag   genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	StorageSizeGB *int                   `json:"storageSizeGB,omitempty"`
}

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

	// StorageSizeGB
	storage.StorageSizeGB = genruntime.ClonePointerToInt(source.StorageSizeGB)

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

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

	// No error
	return nil
}

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

	// StorageSizeGB
	destination.StorageSizeGB = genruntime.ClonePointerToInt(storage.StorageSizeGB)

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.SystemData_STATUS
// Metadata pertaining to creation and last modification of the 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 *v20210601s.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 *v20210601s.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
}

type augmentConversionForBackup interface {
	AssignPropertiesFrom(src *v20210601s.Backup) error
	AssignPropertiesTo(dst *v20210601s.Backup) error
}

type augmentConversionForBackup_STATUS interface {
	AssignPropertiesFrom(src *v20210601s.Backup_STATUS) error
	AssignPropertiesTo(dst *v20210601s.Backup_STATUS) error
}

type augmentConversionForFlexibleServerOperatorSpec interface {
	AssignPropertiesFrom(src *v20210601s.FlexibleServerOperatorSpec) error
	AssignPropertiesTo(dst *v20210601s.FlexibleServerOperatorSpec) error
}

type augmentConversionForHighAvailability interface {
	AssignPropertiesFrom(src *v20210601s.HighAvailability) error
	AssignPropertiesTo(dst *v20210601s.HighAvailability) error
}

type augmentConversionForHighAvailability_STATUS interface {
	AssignPropertiesFrom(src *v20210601s.HighAvailability_STATUS) error
	AssignPropertiesTo(dst *v20210601s.HighAvailability_STATUS) error
}

type augmentConversionForMaintenanceWindow interface {
	AssignPropertiesFrom(src *v20210601s.MaintenanceWindow) error
	AssignPropertiesTo(dst *v20210601s.MaintenanceWindow) error
}

type augmentConversionForMaintenanceWindow_STATUS interface {
	AssignPropertiesFrom(src *v20210601s.MaintenanceWindow_STATUS) error
	AssignPropertiesTo(dst *v20210601s.MaintenanceWindow_STATUS) error
}

type augmentConversionForNetwork interface {
	AssignPropertiesFrom(src *v20210601s.Network) error
	AssignPropertiesTo(dst *v20210601s.Network) error
}

type augmentConversionForNetwork_STATUS interface {
	AssignPropertiesFrom(src *v20210601s.Network_STATUS) error
	AssignPropertiesTo(dst *v20210601s.Network_STATUS) error
}

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

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

type augmentConversionForStorage interface {
	AssignPropertiesFrom(src *v20210601s.Storage) error
	AssignPropertiesTo(dst *v20210601s.Storage) error
}

type augmentConversionForStorage_STATUS interface {
	AssignPropertiesFrom(src *v20210601s.Storage_STATUS) error
	AssignPropertiesTo(dst *v20210601s.Storage_STATUS) error
}

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

// Storage version of v1api20220120preview.FlexibleServerOperatorConfigMaps
type FlexibleServerOperatorConfigMaps struct {
	FullyQualifiedDomainName *genruntime.ConfigMapDestination `json:"fullyQualifiedDomainName,omitempty"`
	PropertyBag              genruntime.PropertyBag           `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_FlexibleServerOperatorConfigMaps populates our FlexibleServerOperatorConfigMaps from the provided source FlexibleServerOperatorConfigMaps
func (maps *FlexibleServerOperatorConfigMaps) AssignProperties_From_FlexibleServerOperatorConfigMaps(source *v20221201s.FlexibleServerOperatorConfigMaps) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// FullyQualifiedDomainName
	if source.FullyQualifiedDomainName != nil {
		fullyQualifiedDomainName := source.FullyQualifiedDomainName.Copy()
		maps.FullyQualifiedDomainName = &fullyQualifiedDomainName
	} else {
		maps.FullyQualifiedDomainName = nil
	}

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

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

	// No error
	return nil
}

// AssignProperties_To_FlexibleServerOperatorConfigMaps populates the provided destination FlexibleServerOperatorConfigMaps from our FlexibleServerOperatorConfigMaps
func (maps *FlexibleServerOperatorConfigMaps) AssignProperties_To_FlexibleServerOperatorConfigMaps(destination *v20221201s.FlexibleServerOperatorConfigMaps) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(maps.PropertyBag)

	// FullyQualifiedDomainName
	if maps.FullyQualifiedDomainName != nil {
		fullyQualifiedDomainName := maps.FullyQualifiedDomainName.Copy()
		destination.FullyQualifiedDomainName = &fullyQualifiedDomainName
	} else {
		destination.FullyQualifiedDomainName = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220120preview.FlexibleServerOperatorSecrets
type FlexibleServerOperatorSecrets struct {
	FullyQualifiedDomainName *genruntime.SecretDestination `json:"fullyQualifiedDomainName,omitempty"`
	PropertyBag              genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_FlexibleServerOperatorSecrets populates our FlexibleServerOperatorSecrets from the provided source FlexibleServerOperatorSecrets
func (secrets *FlexibleServerOperatorSecrets) AssignProperties_From_FlexibleServerOperatorSecrets(source *v20210601s.FlexibleServerOperatorSecrets) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// FullyQualifiedDomainName
	if source.FullyQualifiedDomainName != nil {
		fullyQualifiedDomainName := source.FullyQualifiedDomainName.Copy()
		secrets.FullyQualifiedDomainName = &fullyQualifiedDomainName
	} else {
		secrets.FullyQualifiedDomainName = nil
	}

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

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

	// No error
	return nil
}

// AssignProperties_To_FlexibleServerOperatorSecrets populates the provided destination FlexibleServerOperatorSecrets from our FlexibleServerOperatorSecrets
func (secrets *FlexibleServerOperatorSecrets) AssignProperties_To_FlexibleServerOperatorSecrets(destination *v20210601s.FlexibleServerOperatorSecrets) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(secrets.PropertyBag)

	// FullyQualifiedDomainName
	if secrets.FullyQualifiedDomainName != nil {
		fullyQualifiedDomainName := secrets.FullyQualifiedDomainName.Copy()
		destination.FullyQualifiedDomainName = &fullyQualifiedDomainName
	} else {
		destination.FullyQualifiedDomainName = nil
	}

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

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

	// No error
	return nil
}

type augmentConversionForFlexibleServerOperatorConfigMaps interface {
	AssignPropertiesFrom(src *v20221201s.FlexibleServerOperatorConfigMaps) error
	AssignPropertiesTo(dst *v20221201s.FlexibleServerOperatorConfigMaps) error
}

type augmentConversionForFlexibleServerOperatorSecrets interface {
	AssignPropertiesFrom(src *v20210601s.FlexibleServerOperatorSecrets) error
	AssignPropertiesTo(dst *v20210601s.FlexibleServerOperatorSecrets) error
}

func init() {
	SchemeBuilder.Register(&FlexibleServer{}, &FlexibleServerList{})
}
