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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/cache/v1api20250401/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/cache/v1api20250401/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,cache}
// +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"
// Generator information:
// - Generated from: /redisenterprise/resource-manager/Microsoft.Cache/RedisEnterprise/stable/2025-04-01/redisenterprise.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}
type RedisEnterpriseDatabase struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              RedisEnterpriseDatabase_Spec   `json:"spec,omitempty"`
	Status            RedisEnterpriseDatabase_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &RedisEnterpriseDatabase{}

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

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

var _ conversion.Convertible = &RedisEnterpriseDatabase{}

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

	return database.AssignProperties_From_RedisEnterpriseDatabase(source)
}

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

	return database.AssignProperties_To_RedisEnterpriseDatabase(destination)
}

var _ configmaps.Exporter = &RedisEnterpriseDatabase{}

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

var _ secrets.Exporter = &RedisEnterpriseDatabase{}

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

var _ genruntime.ImportableResource = &RedisEnterpriseDatabase{}

// InitializeSpec initializes the spec for this resource from the given status
func (database *RedisEnterpriseDatabase) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*RedisEnterpriseDatabase_STATUS); ok {
		return database.Spec.Initialize_From_RedisEnterpriseDatabase_STATUS(s)
	}

	return fmt.Errorf("expected Status of type RedisEnterpriseDatabase_STATUS but received %T instead", status)
}

var _ genruntime.KubernetesResource = &RedisEnterpriseDatabase{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2025-04-01"
func (database RedisEnterpriseDatabase) GetAPIVersion() string {
	return "2025-04-01"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Cache/redisEnterprise/databases"
func (database *RedisEnterpriseDatabase) GetType() string {
	return "Microsoft.Cache/redisEnterprise/databases"
}

// NewEmptyStatus returns a new empty (blank) status
func (database *RedisEnterpriseDatabase) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &RedisEnterpriseDatabase_STATUS{}
}

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

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

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

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

	database.Status = st
	return nil
}

// AssignProperties_From_RedisEnterpriseDatabase populates our RedisEnterpriseDatabase from the provided source RedisEnterpriseDatabase
func (database *RedisEnterpriseDatabase) AssignProperties_From_RedisEnterpriseDatabase(source *storage.RedisEnterpriseDatabase) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_RedisEnterpriseDatabase populates the provided destination RedisEnterpriseDatabase from our RedisEnterpriseDatabase
func (database *RedisEnterpriseDatabase) AssignProperties_To_RedisEnterpriseDatabase(destination *storage.RedisEnterpriseDatabase) error {

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

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

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

	// No error
	return nil
}

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /redisenterprise/resource-manager/Microsoft.Cache/RedisEnterprise/stable/2025-04-01/redisenterprise.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}
type RedisEnterpriseDatabaseList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []RedisEnterpriseDatabase `json:"items"`
}

type RedisEnterpriseDatabase_Spec struct {
	// AccessKeysAuthentication: This property can be Enabled/Disabled to allow or deny access with the current access keys.
	// Can be updated even after database is created.
	AccessKeysAuthentication *DatabaseProperties_AccessKeysAuthentication `json:"accessKeysAuthentication,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"`

	// ClientProtocol: Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is
	// TLS-encrypted.
	ClientProtocol *DatabaseProperties_ClientProtocol `json:"clientProtocol,omitempty"`

	// ClusteringPolicy: Clustering policy - default is OSSCluster. This property must be chosen at create time, and cannot be
	// changed without deleting the database.
	ClusteringPolicy *DatabaseProperties_ClusteringPolicy `json:"clusteringPolicy,omitempty"`

	// DeferUpgrade: Option to defer upgrade when newest version is released - default is NotDeferred. Learn more:
	// https://aka.ms/redisversionupgrade
	DeferUpgrade *DatabaseProperties_DeferUpgrade `json:"deferUpgrade,omitempty"`

	// EvictionPolicy: Redis eviction policy - default is VolatileLRU
	EvictionPolicy *DatabaseProperties_EvictionPolicy `json:"evictionPolicy,omitempty"`

	// GeoReplication: Optional set of properties to configure geo replication for this database.
	GeoReplication *DatabaseProperties_GeoReplication `json:"geoReplication,omitempty"`

	// Modules: Optional set of redis modules to enable in this database - modules can only be added at creation time.
	Modules []Module `json:"modules,omitempty"`

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *RedisEnterpriseDatabaseOperatorSpec `json:"operatorSpec,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 cache.azure.com/RedisEnterprise resource
	Owner *genruntime.KnownResourceReference `group:"cache.azure.com" json:"owner,omitempty" kind:"RedisEnterprise"`

	// Persistence: Persistence settings
	Persistence *Persistence `json:"persistence,omitempty"`

	// Port: TCP port of the database endpoint. Specified at create time. Defaults to an available port.
	Port *int `json:"port,omitempty"`
}

var _ genruntime.ARMTransformer = &RedisEnterpriseDatabase_Spec{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (database *RedisEnterpriseDatabase_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if database == nil {
		return nil, nil
	}
	result := &arm.RedisEnterpriseDatabase_Spec{}

	// Set property "Name":
	result.Name = resolved.Name

	// Set property "Properties":
	if database.AccessKeysAuthentication != nil ||
		database.ClientProtocol != nil ||
		database.ClusteringPolicy != nil ||
		database.DeferUpgrade != nil ||
		database.EvictionPolicy != nil ||
		database.GeoReplication != nil ||
		database.Modules != nil ||
		database.Persistence != nil ||
		database.Port != nil {
		result.Properties = &arm.DatabaseProperties{}
	}
	if database.AccessKeysAuthentication != nil {
		var temp string
		temp = string(*database.AccessKeysAuthentication)
		accessKeysAuthentication := arm.DatabaseProperties_AccessKeysAuthentication(temp)
		result.Properties.AccessKeysAuthentication = &accessKeysAuthentication
	}
	if database.ClientProtocol != nil {
		var temp string
		temp = string(*database.ClientProtocol)
		clientProtocol := arm.DatabaseProperties_ClientProtocol(temp)
		result.Properties.ClientProtocol = &clientProtocol
	}
	if database.ClusteringPolicy != nil {
		var temp string
		temp = string(*database.ClusteringPolicy)
		clusteringPolicy := arm.DatabaseProperties_ClusteringPolicy(temp)
		result.Properties.ClusteringPolicy = &clusteringPolicy
	}
	if database.DeferUpgrade != nil {
		var temp string
		temp = string(*database.DeferUpgrade)
		deferUpgrade := arm.DatabaseProperties_DeferUpgrade(temp)
		result.Properties.DeferUpgrade = &deferUpgrade
	}
	if database.EvictionPolicy != nil {
		var temp string
		temp = string(*database.EvictionPolicy)
		evictionPolicy := arm.DatabaseProperties_EvictionPolicy(temp)
		result.Properties.EvictionPolicy = &evictionPolicy
	}
	if database.GeoReplication != nil {
		geoReplication_ARM, err := database.GeoReplication.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		geoReplication := *geoReplication_ARM.(*arm.DatabaseProperties_GeoReplication)
		result.Properties.GeoReplication = &geoReplication
	}
	for _, item := range database.Modules {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.Modules = append(result.Properties.Modules, *item_ARM.(*arm.Module))
	}
	if database.Persistence != nil {
		persistence_ARM, err := database.Persistence.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		persistence := *persistence_ARM.(*arm.Persistence)
		result.Properties.Persistence = &persistence
	}
	if database.Port != nil {
		port := *database.Port
		result.Properties.Port = &port
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (database *RedisEnterpriseDatabase_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.RedisEnterpriseDatabase_Spec{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (database *RedisEnterpriseDatabase_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.RedisEnterpriseDatabase_Spec)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.RedisEnterpriseDatabase_Spec, got %T", armInput)
	}

	// Set property "AccessKeysAuthentication":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AccessKeysAuthentication != nil {
			var temp string
			temp = string(*typedInput.Properties.AccessKeysAuthentication)
			accessKeysAuthentication := DatabaseProperties_AccessKeysAuthentication(temp)
			database.AccessKeysAuthentication = &accessKeysAuthentication
		}
	}

	// Set property "AzureName":
	database.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name))

	// Set property "ClientProtocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ClientProtocol != nil {
			var temp string
			temp = string(*typedInput.Properties.ClientProtocol)
			clientProtocol := DatabaseProperties_ClientProtocol(temp)
			database.ClientProtocol = &clientProtocol
		}
	}

	// Set property "ClusteringPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ClusteringPolicy != nil {
			var temp string
			temp = string(*typedInput.Properties.ClusteringPolicy)
			clusteringPolicy := DatabaseProperties_ClusteringPolicy(temp)
			database.ClusteringPolicy = &clusteringPolicy
		}
	}

	// Set property "DeferUpgrade":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeferUpgrade != nil {
			var temp string
			temp = string(*typedInput.Properties.DeferUpgrade)
			deferUpgrade := DatabaseProperties_DeferUpgrade(temp)
			database.DeferUpgrade = &deferUpgrade
		}
	}

	// Set property "EvictionPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EvictionPolicy != nil {
			var temp string
			temp = string(*typedInput.Properties.EvictionPolicy)
			evictionPolicy := DatabaseProperties_EvictionPolicy(temp)
			database.EvictionPolicy = &evictionPolicy
		}
	}

	// Set property "GeoReplication":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.GeoReplication != nil {
			var geoReplication1 DatabaseProperties_GeoReplication
			err := geoReplication1.PopulateFromARM(owner, *typedInput.Properties.GeoReplication)
			if err != nil {
				return err
			}
			geoReplication := geoReplication1
			database.GeoReplication = &geoReplication
		}
	}

	// Set property "Modules":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.Modules {
			var item1 Module
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			database.Modules = append(database.Modules, item1)
		}
	}

	// no assignment for property "OperatorSpec"

	// Set property "Owner":
	database.Owner = &genruntime.KnownResourceReference{
		Name:  owner.Name,
		ARMID: owner.ARMID,
	}

	// Set property "Persistence":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Persistence != nil {
			var persistence1 Persistence
			err := persistence1.PopulateFromARM(owner, *typedInput.Properties.Persistence)
			if err != nil {
				return err
			}
			persistence := persistence1
			database.Persistence = &persistence
		}
	}

	// Set property "Port":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Port != nil {
			port := *typedInput.Properties.Port
			database.Port = &port
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &RedisEnterpriseDatabase_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.RedisEnterpriseDatabase_Spec{}
	err := database.AssignProperties_To_RedisEnterpriseDatabase_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_RedisEnterpriseDatabase_Spec populates our RedisEnterpriseDatabase_Spec from the provided source RedisEnterpriseDatabase_Spec
func (database *RedisEnterpriseDatabase_Spec) AssignProperties_From_RedisEnterpriseDatabase_Spec(source *storage.RedisEnterpriseDatabase_Spec) error {

	// AccessKeysAuthentication
	if source.AccessKeysAuthentication != nil {
		accessKeysAuthentication := *source.AccessKeysAuthentication
		accessKeysAuthenticationTemp := genruntime.ToEnum(accessKeysAuthentication, databaseProperties_AccessKeysAuthentication_Values)
		database.AccessKeysAuthentication = &accessKeysAuthenticationTemp
	} else {
		database.AccessKeysAuthentication = nil
	}

	// AzureName
	database.AzureName = source.AzureName

	// ClientProtocol
	if source.ClientProtocol != nil {
		clientProtocol := *source.ClientProtocol
		clientProtocolTemp := genruntime.ToEnum(clientProtocol, databaseProperties_ClientProtocol_Values)
		database.ClientProtocol = &clientProtocolTemp
	} else {
		database.ClientProtocol = nil
	}

	// ClusteringPolicy
	if source.ClusteringPolicy != nil {
		clusteringPolicy := *source.ClusteringPolicy
		clusteringPolicyTemp := genruntime.ToEnum(clusteringPolicy, databaseProperties_ClusteringPolicy_Values)
		database.ClusteringPolicy = &clusteringPolicyTemp
	} else {
		database.ClusteringPolicy = nil
	}

	// DeferUpgrade
	if source.DeferUpgrade != nil {
		deferUpgrade := *source.DeferUpgrade
		deferUpgradeTemp := genruntime.ToEnum(deferUpgrade, databaseProperties_DeferUpgrade_Values)
		database.DeferUpgrade = &deferUpgradeTemp
	} else {
		database.DeferUpgrade = nil
	}

	// EvictionPolicy
	if source.EvictionPolicy != nil {
		evictionPolicy := *source.EvictionPolicy
		evictionPolicyTemp := genruntime.ToEnum(evictionPolicy, databaseProperties_EvictionPolicy_Values)
		database.EvictionPolicy = &evictionPolicyTemp
	} else {
		database.EvictionPolicy = nil
	}

	// GeoReplication
	if source.GeoReplication != nil {
		var geoReplication DatabaseProperties_GeoReplication
		err := geoReplication.AssignProperties_From_DatabaseProperties_GeoReplication(source.GeoReplication)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DatabaseProperties_GeoReplication() to populate field GeoReplication")
		}
		database.GeoReplication = &geoReplication
	} else {
		database.GeoReplication = nil
	}

	// Modules
	if source.Modules != nil {
		moduleList := make([]Module, len(source.Modules))
		for moduleIndex, moduleItem := range source.Modules {
			var module Module
			err := module.AssignProperties_From_Module(&moduleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Module() to populate field Modules")
			}
			moduleList[moduleIndex] = module
		}
		database.Modules = moduleList
	} else {
		database.Modules = nil
	}

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

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

	// Persistence
	if source.Persistence != nil {
		var persistence Persistence
		err := persistence.AssignProperties_From_Persistence(source.Persistence)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Persistence() to populate field Persistence")
		}
		database.Persistence = &persistence
	} else {
		database.Persistence = nil
	}

	// Port
	database.Port = genruntime.ClonePointerToInt(source.Port)

	// No error
	return nil
}

// AssignProperties_To_RedisEnterpriseDatabase_Spec populates the provided destination RedisEnterpriseDatabase_Spec from our RedisEnterpriseDatabase_Spec
func (database *RedisEnterpriseDatabase_Spec) AssignProperties_To_RedisEnterpriseDatabase_Spec(destination *storage.RedisEnterpriseDatabase_Spec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AccessKeysAuthentication
	if database.AccessKeysAuthentication != nil {
		accessKeysAuthentication := string(*database.AccessKeysAuthentication)
		destination.AccessKeysAuthentication = &accessKeysAuthentication
	} else {
		destination.AccessKeysAuthentication = nil
	}

	// AzureName
	destination.AzureName = database.AzureName

	// ClientProtocol
	if database.ClientProtocol != nil {
		clientProtocol := string(*database.ClientProtocol)
		destination.ClientProtocol = &clientProtocol
	} else {
		destination.ClientProtocol = nil
	}

	// ClusteringPolicy
	if database.ClusteringPolicy != nil {
		clusteringPolicy := string(*database.ClusteringPolicy)
		destination.ClusteringPolicy = &clusteringPolicy
	} else {
		destination.ClusteringPolicy = nil
	}

	// DeferUpgrade
	if database.DeferUpgrade != nil {
		deferUpgrade := string(*database.DeferUpgrade)
		destination.DeferUpgrade = &deferUpgrade
	} else {
		destination.DeferUpgrade = nil
	}

	// EvictionPolicy
	if database.EvictionPolicy != nil {
		evictionPolicy := string(*database.EvictionPolicy)
		destination.EvictionPolicy = &evictionPolicy
	} else {
		destination.EvictionPolicy = nil
	}

	// GeoReplication
	if database.GeoReplication != nil {
		var geoReplication storage.DatabaseProperties_GeoReplication
		err := database.GeoReplication.AssignProperties_To_DatabaseProperties_GeoReplication(&geoReplication)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DatabaseProperties_GeoReplication() to populate field GeoReplication")
		}
		destination.GeoReplication = &geoReplication
	} else {
		destination.GeoReplication = nil
	}

	// Modules
	if database.Modules != nil {
		moduleList := make([]storage.Module, len(database.Modules))
		for moduleIndex, moduleItem := range database.Modules {
			var module storage.Module
			err := moduleItem.AssignProperties_To_Module(&module)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Module() to populate field Modules")
			}
			moduleList[moduleIndex] = module
		}
		destination.Modules = moduleList
	} else {
		destination.Modules = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = database.OriginalVersion()

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

	// Persistence
	if database.Persistence != nil {
		var persistence storage.Persistence
		err := database.Persistence.AssignProperties_To_Persistence(&persistence)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Persistence() to populate field Persistence")
		}
		destination.Persistence = &persistence
	} else {
		destination.Persistence = nil
	}

	// Port
	destination.Port = genruntime.ClonePointerToInt(database.Port)

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

	// No error
	return nil
}

// Initialize_From_RedisEnterpriseDatabase_STATUS populates our RedisEnterpriseDatabase_Spec from the provided source RedisEnterpriseDatabase_STATUS
func (database *RedisEnterpriseDatabase_Spec) Initialize_From_RedisEnterpriseDatabase_STATUS(source *RedisEnterpriseDatabase_STATUS) error {

	// AccessKeysAuthentication
	if source.AccessKeysAuthentication != nil {
		accessKeysAuthentication := genruntime.ToEnum(string(*source.AccessKeysAuthentication), databaseProperties_AccessKeysAuthentication_Values)
		database.AccessKeysAuthentication = &accessKeysAuthentication
	} else {
		database.AccessKeysAuthentication = nil
	}

	// ClientProtocol
	if source.ClientProtocol != nil {
		clientProtocol := genruntime.ToEnum(string(*source.ClientProtocol), databaseProperties_ClientProtocol_Values)
		database.ClientProtocol = &clientProtocol
	} else {
		database.ClientProtocol = nil
	}

	// ClusteringPolicy
	if source.ClusteringPolicy != nil {
		clusteringPolicy := genruntime.ToEnum(string(*source.ClusteringPolicy), databaseProperties_ClusteringPolicy_Values)
		database.ClusteringPolicy = &clusteringPolicy
	} else {
		database.ClusteringPolicy = nil
	}

	// DeferUpgrade
	if source.DeferUpgrade != nil {
		deferUpgrade := genruntime.ToEnum(string(*source.DeferUpgrade), databaseProperties_DeferUpgrade_Values)
		database.DeferUpgrade = &deferUpgrade
	} else {
		database.DeferUpgrade = nil
	}

	// EvictionPolicy
	if source.EvictionPolicy != nil {
		evictionPolicy := genruntime.ToEnum(string(*source.EvictionPolicy), databaseProperties_EvictionPolicy_Values)
		database.EvictionPolicy = &evictionPolicy
	} else {
		database.EvictionPolicy = nil
	}

	// GeoReplication
	if source.GeoReplication != nil {
		var geoReplication DatabaseProperties_GeoReplication
		err := geoReplication.Initialize_From_DatabaseProperties_GeoReplication_STATUS(source.GeoReplication)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_DatabaseProperties_GeoReplication_STATUS() to populate field GeoReplication")
		}
		database.GeoReplication = &geoReplication
	} else {
		database.GeoReplication = nil
	}

	// Modules
	if source.Modules != nil {
		moduleList := make([]Module, len(source.Modules))
		for moduleIndex, moduleItem := range source.Modules {
			var module Module
			err := module.Initialize_From_Module_STATUS(&moduleItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_Module_STATUS() to populate field Modules")
			}
			moduleList[moduleIndex] = module
		}
		database.Modules = moduleList
	} else {
		database.Modules = nil
	}

	// Persistence
	if source.Persistence != nil {
		var persistence Persistence
		err := persistence.Initialize_From_Persistence_STATUS(source.Persistence)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_Persistence_STATUS() to populate field Persistence")
		}
		database.Persistence = &persistence
	} else {
		database.Persistence = nil
	}

	// Port
	database.Port = genruntime.ClonePointerToInt(source.Port)

	// No error
	return nil
}

// OriginalVersion returns the original API version used to create the resource.
func (database *RedisEnterpriseDatabase_Spec) OriginalVersion() string {
	return GroupVersion.Version
}

// SetAzureName sets the Azure name of the resource
func (database *RedisEnterpriseDatabase_Spec) SetAzureName(azureName string) {
	database.AzureName = azureName
}

type RedisEnterpriseDatabase_STATUS struct {
	// AccessKeysAuthentication: This property can be Enabled/Disabled to allow or deny access with the current access keys.
	// Can be updated even after database is created.
	AccessKeysAuthentication *DatabaseProperties_AccessKeysAuthentication_STATUS `json:"accessKeysAuthentication,omitempty"`

	// ClientProtocol: Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is
	// TLS-encrypted.
	ClientProtocol *DatabaseProperties_ClientProtocol_STATUS `json:"clientProtocol,omitempty"`

	// ClusteringPolicy: Clustering policy - default is OSSCluster. This property must be chosen at create time, and cannot be
	// changed without deleting the database.
	ClusteringPolicy *DatabaseProperties_ClusteringPolicy_STATUS `json:"clusteringPolicy,omitempty"`

	// Conditions: The observed state of the resource
	Conditions []conditions.Condition `json:"conditions,omitempty"`

	// DeferUpgrade: Option to defer upgrade when newest version is released - default is NotDeferred. Learn more:
	// https://aka.ms/redisversionupgrade
	DeferUpgrade *DatabaseProperties_DeferUpgrade_STATUS `json:"deferUpgrade,omitempty"`

	// EvictionPolicy: Redis eviction policy - default is VolatileLRU
	EvictionPolicy *DatabaseProperties_EvictionPolicy_STATUS `json:"evictionPolicy,omitempty"`

	// GeoReplication: Optional set of properties to configure geo replication for this database.
	GeoReplication *DatabaseProperties_GeoReplication_STATUS `json:"geoReplication,omitempty"`

	// Id: Fully qualified resource ID for the resource. Ex -
	// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	Id *string `json:"id,omitempty"`

	// Modules: Optional set of redis modules to enable in this database - modules can only be added at creation time.
	Modules []Module_STATUS `json:"modules,omitempty"`

	// Name: The name of the resource
	Name *string `json:"name,omitempty"`

	// Persistence: Persistence settings
	Persistence *Persistence_STATUS `json:"persistence,omitempty"`

	// Port: TCP port of the database endpoint. Specified at create time. Defaults to an available port.
	Port *int `json:"port,omitempty"`

	// ProvisioningState: Current provisioning status of the database
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// RedisVersion: Version of Redis the database is running on, e.g. '6.0'
	RedisVersion *string `json:"redisVersion,omitempty"`

	// ResourceState: Current resource status of the database
	ResourceState *ResourceState_STATUS `json:"resourceState,omitempty"`

	// SystemData: Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

	// Type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &RedisEnterpriseDatabase_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.RedisEnterpriseDatabase_STATUS{}
	err := database.AssignProperties_To_RedisEnterpriseDatabase_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
}

var _ genruntime.FromARMConverter = &RedisEnterpriseDatabase_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (database *RedisEnterpriseDatabase_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.RedisEnterpriseDatabase_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (database *RedisEnterpriseDatabase_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.RedisEnterpriseDatabase_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.RedisEnterpriseDatabase_STATUS, got %T", armInput)
	}

	// Set property "AccessKeysAuthentication":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AccessKeysAuthentication != nil {
			var temp string
			temp = string(*typedInput.Properties.AccessKeysAuthentication)
			accessKeysAuthentication := DatabaseProperties_AccessKeysAuthentication_STATUS(temp)
			database.AccessKeysAuthentication = &accessKeysAuthentication
		}
	}

	// Set property "ClientProtocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ClientProtocol != nil {
			var temp string
			temp = string(*typedInput.Properties.ClientProtocol)
			clientProtocol := DatabaseProperties_ClientProtocol_STATUS(temp)
			database.ClientProtocol = &clientProtocol
		}
	}

	// Set property "ClusteringPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ClusteringPolicy != nil {
			var temp string
			temp = string(*typedInput.Properties.ClusteringPolicy)
			clusteringPolicy := DatabaseProperties_ClusteringPolicy_STATUS(temp)
			database.ClusteringPolicy = &clusteringPolicy
		}
	}

	// no assignment for property "Conditions"

	// Set property "DeferUpgrade":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeferUpgrade != nil {
			var temp string
			temp = string(*typedInput.Properties.DeferUpgrade)
			deferUpgrade := DatabaseProperties_DeferUpgrade_STATUS(temp)
			database.DeferUpgrade = &deferUpgrade
		}
	}

	// Set property "EvictionPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EvictionPolicy != nil {
			var temp string
			temp = string(*typedInput.Properties.EvictionPolicy)
			evictionPolicy := DatabaseProperties_EvictionPolicy_STATUS(temp)
			database.EvictionPolicy = &evictionPolicy
		}
	}

	// Set property "GeoReplication":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.GeoReplication != nil {
			var geoReplication1 DatabaseProperties_GeoReplication_STATUS
			err := geoReplication1.PopulateFromARM(owner, *typedInput.Properties.GeoReplication)
			if err != nil {
				return err
			}
			geoReplication := geoReplication1
			database.GeoReplication = &geoReplication
		}
	}

	// Set property "Id":
	if typedInput.Id != nil {
		id := *typedInput.Id
		database.Id = &id
	}

	// Set property "Modules":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.Modules {
			var item1 Module_STATUS
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			database.Modules = append(database.Modules, item1)
		}
	}

	// Set property "Name":
	if typedInput.Name != nil {
		name := *typedInput.Name
		database.Name = &name
	}

	// Set property "Persistence":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Persistence != nil {
			var persistence1 Persistence_STATUS
			err := persistence1.PopulateFromARM(owner, *typedInput.Properties.Persistence)
			if err != nil {
				return err
			}
			persistence := persistence1
			database.Persistence = &persistence
		}
	}

	// Set property "Port":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Port != nil {
			port := *typedInput.Properties.Port
			database.Port = &port
		}
	}

	// Set property "ProvisioningState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProvisioningState != nil {
			var temp string
			temp = string(*typedInput.Properties.ProvisioningState)
			provisioningState := ProvisioningState_STATUS(temp)
			database.ProvisioningState = &provisioningState
		}
	}

	// Set property "RedisVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RedisVersion != nil {
			redisVersion := *typedInput.Properties.RedisVersion
			database.RedisVersion = &redisVersion
		}
	}

	// Set property "ResourceState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ResourceState != nil {
			var temp string
			temp = string(*typedInput.Properties.ResourceState)
			resourceState := ResourceState_STATUS(temp)
			database.ResourceState = &resourceState
		}
	}

	// Set property "SystemData":
	if typedInput.SystemData != nil {
		var systemData1 SystemData_STATUS
		err := systemData1.PopulateFromARM(owner, *typedInput.SystemData)
		if err != nil {
			return err
		}
		systemData := systemData1
		database.SystemData = &systemData
	}

	// Set property "Type":
	if typedInput.Type != nil {
		typeVar := *typedInput.Type
		database.Type = &typeVar
	}

	// No error
	return nil
}

// AssignProperties_From_RedisEnterpriseDatabase_STATUS populates our RedisEnterpriseDatabase_STATUS from the provided source RedisEnterpriseDatabase_STATUS
func (database *RedisEnterpriseDatabase_STATUS) AssignProperties_From_RedisEnterpriseDatabase_STATUS(source *storage.RedisEnterpriseDatabase_STATUS) error {

	// AccessKeysAuthentication
	if source.AccessKeysAuthentication != nil {
		accessKeysAuthentication := *source.AccessKeysAuthentication
		accessKeysAuthenticationTemp := genruntime.ToEnum(accessKeysAuthentication, databaseProperties_AccessKeysAuthentication_STATUS_Values)
		database.AccessKeysAuthentication = &accessKeysAuthenticationTemp
	} else {
		database.AccessKeysAuthentication = nil
	}

	// ClientProtocol
	if source.ClientProtocol != nil {
		clientProtocol := *source.ClientProtocol
		clientProtocolTemp := genruntime.ToEnum(clientProtocol, databaseProperties_ClientProtocol_STATUS_Values)
		database.ClientProtocol = &clientProtocolTemp
	} else {
		database.ClientProtocol = nil
	}

	// ClusteringPolicy
	if source.ClusteringPolicy != nil {
		clusteringPolicy := *source.ClusteringPolicy
		clusteringPolicyTemp := genruntime.ToEnum(clusteringPolicy, databaseProperties_ClusteringPolicy_STATUS_Values)
		database.ClusteringPolicy = &clusteringPolicyTemp
	} else {
		database.ClusteringPolicy = nil
	}

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

	// DeferUpgrade
	if source.DeferUpgrade != nil {
		deferUpgrade := *source.DeferUpgrade
		deferUpgradeTemp := genruntime.ToEnum(deferUpgrade, databaseProperties_DeferUpgrade_STATUS_Values)
		database.DeferUpgrade = &deferUpgradeTemp
	} else {
		database.DeferUpgrade = nil
	}

	// EvictionPolicy
	if source.EvictionPolicy != nil {
		evictionPolicy := *source.EvictionPolicy
		evictionPolicyTemp := genruntime.ToEnum(evictionPolicy, databaseProperties_EvictionPolicy_STATUS_Values)
		database.EvictionPolicy = &evictionPolicyTemp
	} else {
		database.EvictionPolicy = nil
	}

	// GeoReplication
	if source.GeoReplication != nil {
		var geoReplication DatabaseProperties_GeoReplication_STATUS
		err := geoReplication.AssignProperties_From_DatabaseProperties_GeoReplication_STATUS(source.GeoReplication)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DatabaseProperties_GeoReplication_STATUS() to populate field GeoReplication")
		}
		database.GeoReplication = &geoReplication
	} else {
		database.GeoReplication = nil
	}

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

	// Modules
	if source.Modules != nil {
		moduleList := make([]Module_STATUS, len(source.Modules))
		for moduleIndex, moduleItem := range source.Modules {
			var module Module_STATUS
			err := module.AssignProperties_From_Module_STATUS(&moduleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Module_STATUS() to populate field Modules")
			}
			moduleList[moduleIndex] = module
		}
		database.Modules = moduleList
	} else {
		database.Modules = nil
	}

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

	// Persistence
	if source.Persistence != nil {
		var persistence Persistence_STATUS
		err := persistence.AssignProperties_From_Persistence_STATUS(source.Persistence)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Persistence_STATUS() to populate field Persistence")
		}
		database.Persistence = &persistence
	} else {
		database.Persistence = nil
	}

	// Port
	database.Port = genruntime.ClonePointerToInt(source.Port)

	// ProvisioningState
	if source.ProvisioningState != nil {
		provisioningState := *source.ProvisioningState
		provisioningStateTemp := genruntime.ToEnum(provisioningState, provisioningState_STATUS_Values)
		database.ProvisioningState = &provisioningStateTemp
	} else {
		database.ProvisioningState = nil
	}

	// RedisVersion
	database.RedisVersion = genruntime.ClonePointerToString(source.RedisVersion)

	// ResourceState
	if source.ResourceState != nil {
		resourceState := *source.ResourceState
		resourceStateTemp := genruntime.ToEnum(resourceState, resourceState_STATUS_Values)
		database.ResourceState = &resourceStateTemp
	} else {
		database.ResourceState = 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")
		}
		database.SystemData = &systemDatum
	} else {
		database.SystemData = nil
	}

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

	// No error
	return nil
}

// AssignProperties_To_RedisEnterpriseDatabase_STATUS populates the provided destination RedisEnterpriseDatabase_STATUS from our RedisEnterpriseDatabase_STATUS
func (database *RedisEnterpriseDatabase_STATUS) AssignProperties_To_RedisEnterpriseDatabase_STATUS(destination *storage.RedisEnterpriseDatabase_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AccessKeysAuthentication
	if database.AccessKeysAuthentication != nil {
		accessKeysAuthentication := string(*database.AccessKeysAuthentication)
		destination.AccessKeysAuthentication = &accessKeysAuthentication
	} else {
		destination.AccessKeysAuthentication = nil
	}

	// ClientProtocol
	if database.ClientProtocol != nil {
		clientProtocol := string(*database.ClientProtocol)
		destination.ClientProtocol = &clientProtocol
	} else {
		destination.ClientProtocol = nil
	}

	// ClusteringPolicy
	if database.ClusteringPolicy != nil {
		clusteringPolicy := string(*database.ClusteringPolicy)
		destination.ClusteringPolicy = &clusteringPolicy
	} else {
		destination.ClusteringPolicy = nil
	}

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

	// DeferUpgrade
	if database.DeferUpgrade != nil {
		deferUpgrade := string(*database.DeferUpgrade)
		destination.DeferUpgrade = &deferUpgrade
	} else {
		destination.DeferUpgrade = nil
	}

	// EvictionPolicy
	if database.EvictionPolicy != nil {
		evictionPolicy := string(*database.EvictionPolicy)
		destination.EvictionPolicy = &evictionPolicy
	} else {
		destination.EvictionPolicy = nil
	}

	// GeoReplication
	if database.GeoReplication != nil {
		var geoReplication storage.DatabaseProperties_GeoReplication_STATUS
		err := database.GeoReplication.AssignProperties_To_DatabaseProperties_GeoReplication_STATUS(&geoReplication)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DatabaseProperties_GeoReplication_STATUS() to populate field GeoReplication")
		}
		destination.GeoReplication = &geoReplication
	} else {
		destination.GeoReplication = nil
	}

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

	// Modules
	if database.Modules != nil {
		moduleList := make([]storage.Module_STATUS, len(database.Modules))
		for moduleIndex, moduleItem := range database.Modules {
			var module storage.Module_STATUS
			err := moduleItem.AssignProperties_To_Module_STATUS(&module)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Module_STATUS() to populate field Modules")
			}
			moduleList[moduleIndex] = module
		}
		destination.Modules = moduleList
	} else {
		destination.Modules = nil
	}

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

	// Persistence
	if database.Persistence != nil {
		var persistence storage.Persistence_STATUS
		err := database.Persistence.AssignProperties_To_Persistence_STATUS(&persistence)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Persistence_STATUS() to populate field Persistence")
		}
		destination.Persistence = &persistence
	} else {
		destination.Persistence = nil
	}

	// Port
	destination.Port = genruntime.ClonePointerToInt(database.Port)

	// ProvisioningState
	if database.ProvisioningState != nil {
		provisioningState := string(*database.ProvisioningState)
		destination.ProvisioningState = &provisioningState
	} else {
		destination.ProvisioningState = nil
	}

	// RedisVersion
	destination.RedisVersion = genruntime.ClonePointerToString(database.RedisVersion)

	// ResourceState
	if database.ResourceState != nil {
		resourceState := string(*database.ResourceState)
		destination.ResourceState = &resourceState
	} else {
		destination.ResourceState = nil
	}

	// SystemData
	if database.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := database.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
	}

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type DatabaseProperties_AccessKeysAuthentication string

const (
	DatabaseProperties_AccessKeysAuthentication_Disabled = DatabaseProperties_AccessKeysAuthentication("Disabled")
	DatabaseProperties_AccessKeysAuthentication_Enabled  = DatabaseProperties_AccessKeysAuthentication("Enabled")
)

// Mapping from string to DatabaseProperties_AccessKeysAuthentication
var databaseProperties_AccessKeysAuthentication_Values = map[string]DatabaseProperties_AccessKeysAuthentication{
	"disabled": DatabaseProperties_AccessKeysAuthentication_Disabled,
	"enabled":  DatabaseProperties_AccessKeysAuthentication_Enabled,
}

type DatabaseProperties_AccessKeysAuthentication_STATUS string

const (
	DatabaseProperties_AccessKeysAuthentication_STATUS_Disabled = DatabaseProperties_AccessKeysAuthentication_STATUS("Disabled")
	DatabaseProperties_AccessKeysAuthentication_STATUS_Enabled  = DatabaseProperties_AccessKeysAuthentication_STATUS("Enabled")
)

// Mapping from string to DatabaseProperties_AccessKeysAuthentication_STATUS
var databaseProperties_AccessKeysAuthentication_STATUS_Values = map[string]DatabaseProperties_AccessKeysAuthentication_STATUS{
	"disabled": DatabaseProperties_AccessKeysAuthentication_STATUS_Disabled,
	"enabled":  DatabaseProperties_AccessKeysAuthentication_STATUS_Enabled,
}

// +kubebuilder:validation:Enum={"Encrypted","Plaintext"}
type DatabaseProperties_ClientProtocol string

const (
	DatabaseProperties_ClientProtocol_Encrypted = DatabaseProperties_ClientProtocol("Encrypted")
	DatabaseProperties_ClientProtocol_Plaintext = DatabaseProperties_ClientProtocol("Plaintext")
)

// Mapping from string to DatabaseProperties_ClientProtocol
var databaseProperties_ClientProtocol_Values = map[string]DatabaseProperties_ClientProtocol{
	"encrypted": DatabaseProperties_ClientProtocol_Encrypted,
	"plaintext": DatabaseProperties_ClientProtocol_Plaintext,
}

type DatabaseProperties_ClientProtocol_STATUS string

const (
	DatabaseProperties_ClientProtocol_STATUS_Encrypted = DatabaseProperties_ClientProtocol_STATUS("Encrypted")
	DatabaseProperties_ClientProtocol_STATUS_Plaintext = DatabaseProperties_ClientProtocol_STATUS("Plaintext")
)

// Mapping from string to DatabaseProperties_ClientProtocol_STATUS
var databaseProperties_ClientProtocol_STATUS_Values = map[string]DatabaseProperties_ClientProtocol_STATUS{
	"encrypted": DatabaseProperties_ClientProtocol_STATUS_Encrypted,
	"plaintext": DatabaseProperties_ClientProtocol_STATUS_Plaintext,
}

// +kubebuilder:validation:Enum={"EnterpriseCluster","OSSCluster"}
type DatabaseProperties_ClusteringPolicy string

const (
	DatabaseProperties_ClusteringPolicy_EnterpriseCluster = DatabaseProperties_ClusteringPolicy("EnterpriseCluster")
	DatabaseProperties_ClusteringPolicy_OSSCluster        = DatabaseProperties_ClusteringPolicy("OSSCluster")
)

// Mapping from string to DatabaseProperties_ClusteringPolicy
var databaseProperties_ClusteringPolicy_Values = map[string]DatabaseProperties_ClusteringPolicy{
	"enterprisecluster": DatabaseProperties_ClusteringPolicy_EnterpriseCluster,
	"osscluster":        DatabaseProperties_ClusteringPolicy_OSSCluster,
}

type DatabaseProperties_ClusteringPolicy_STATUS string

const (
	DatabaseProperties_ClusteringPolicy_STATUS_EnterpriseCluster = DatabaseProperties_ClusteringPolicy_STATUS("EnterpriseCluster")
	DatabaseProperties_ClusteringPolicy_STATUS_OSSCluster        = DatabaseProperties_ClusteringPolicy_STATUS("OSSCluster")
)

// Mapping from string to DatabaseProperties_ClusteringPolicy_STATUS
var databaseProperties_ClusteringPolicy_STATUS_Values = map[string]DatabaseProperties_ClusteringPolicy_STATUS{
	"enterprisecluster": DatabaseProperties_ClusteringPolicy_STATUS_EnterpriseCluster,
	"osscluster":        DatabaseProperties_ClusteringPolicy_STATUS_OSSCluster,
}

// +kubebuilder:validation:Enum={"Deferred","NotDeferred"}
type DatabaseProperties_DeferUpgrade string

const (
	DatabaseProperties_DeferUpgrade_Deferred    = DatabaseProperties_DeferUpgrade("Deferred")
	DatabaseProperties_DeferUpgrade_NotDeferred = DatabaseProperties_DeferUpgrade("NotDeferred")
)

// Mapping from string to DatabaseProperties_DeferUpgrade
var databaseProperties_DeferUpgrade_Values = map[string]DatabaseProperties_DeferUpgrade{
	"deferred":    DatabaseProperties_DeferUpgrade_Deferred,
	"notdeferred": DatabaseProperties_DeferUpgrade_NotDeferred,
}

type DatabaseProperties_DeferUpgrade_STATUS string

const (
	DatabaseProperties_DeferUpgrade_STATUS_Deferred    = DatabaseProperties_DeferUpgrade_STATUS("Deferred")
	DatabaseProperties_DeferUpgrade_STATUS_NotDeferred = DatabaseProperties_DeferUpgrade_STATUS("NotDeferred")
)

// Mapping from string to DatabaseProperties_DeferUpgrade_STATUS
var databaseProperties_DeferUpgrade_STATUS_Values = map[string]DatabaseProperties_DeferUpgrade_STATUS{
	"deferred":    DatabaseProperties_DeferUpgrade_STATUS_Deferred,
	"notdeferred": DatabaseProperties_DeferUpgrade_STATUS_NotDeferred,
}

// +kubebuilder:validation:Enum={"AllKeysLFU","AllKeysLRU","AllKeysRandom","NoEviction","VolatileLFU","VolatileLRU","VolatileRandom","VolatileTTL"}
type DatabaseProperties_EvictionPolicy string

const (
	DatabaseProperties_EvictionPolicy_AllKeysLFU     = DatabaseProperties_EvictionPolicy("AllKeysLFU")
	DatabaseProperties_EvictionPolicy_AllKeysLRU     = DatabaseProperties_EvictionPolicy("AllKeysLRU")
	DatabaseProperties_EvictionPolicy_AllKeysRandom  = DatabaseProperties_EvictionPolicy("AllKeysRandom")
	DatabaseProperties_EvictionPolicy_NoEviction     = DatabaseProperties_EvictionPolicy("NoEviction")
	DatabaseProperties_EvictionPolicy_VolatileLFU    = DatabaseProperties_EvictionPolicy("VolatileLFU")
	DatabaseProperties_EvictionPolicy_VolatileLRU    = DatabaseProperties_EvictionPolicy("VolatileLRU")
	DatabaseProperties_EvictionPolicy_VolatileRandom = DatabaseProperties_EvictionPolicy("VolatileRandom")
	DatabaseProperties_EvictionPolicy_VolatileTTL    = DatabaseProperties_EvictionPolicy("VolatileTTL")
)

// Mapping from string to DatabaseProperties_EvictionPolicy
var databaseProperties_EvictionPolicy_Values = map[string]DatabaseProperties_EvictionPolicy{
	"allkeyslfu":     DatabaseProperties_EvictionPolicy_AllKeysLFU,
	"allkeyslru":     DatabaseProperties_EvictionPolicy_AllKeysLRU,
	"allkeysrandom":  DatabaseProperties_EvictionPolicy_AllKeysRandom,
	"noeviction":     DatabaseProperties_EvictionPolicy_NoEviction,
	"volatilelfu":    DatabaseProperties_EvictionPolicy_VolatileLFU,
	"volatilelru":    DatabaseProperties_EvictionPolicy_VolatileLRU,
	"volatilerandom": DatabaseProperties_EvictionPolicy_VolatileRandom,
	"volatilettl":    DatabaseProperties_EvictionPolicy_VolatileTTL,
}

type DatabaseProperties_EvictionPolicy_STATUS string

const (
	DatabaseProperties_EvictionPolicy_STATUS_AllKeysLFU     = DatabaseProperties_EvictionPolicy_STATUS("AllKeysLFU")
	DatabaseProperties_EvictionPolicy_STATUS_AllKeysLRU     = DatabaseProperties_EvictionPolicy_STATUS("AllKeysLRU")
	DatabaseProperties_EvictionPolicy_STATUS_AllKeysRandom  = DatabaseProperties_EvictionPolicy_STATUS("AllKeysRandom")
	DatabaseProperties_EvictionPolicy_STATUS_NoEviction     = DatabaseProperties_EvictionPolicy_STATUS("NoEviction")
	DatabaseProperties_EvictionPolicy_STATUS_VolatileLFU    = DatabaseProperties_EvictionPolicy_STATUS("VolatileLFU")
	DatabaseProperties_EvictionPolicy_STATUS_VolatileLRU    = DatabaseProperties_EvictionPolicy_STATUS("VolatileLRU")
	DatabaseProperties_EvictionPolicy_STATUS_VolatileRandom = DatabaseProperties_EvictionPolicy_STATUS("VolatileRandom")
	DatabaseProperties_EvictionPolicy_STATUS_VolatileTTL    = DatabaseProperties_EvictionPolicy_STATUS("VolatileTTL")
)

// Mapping from string to DatabaseProperties_EvictionPolicy_STATUS
var databaseProperties_EvictionPolicy_STATUS_Values = map[string]DatabaseProperties_EvictionPolicy_STATUS{
	"allkeyslfu":     DatabaseProperties_EvictionPolicy_STATUS_AllKeysLFU,
	"allkeyslru":     DatabaseProperties_EvictionPolicy_STATUS_AllKeysLRU,
	"allkeysrandom":  DatabaseProperties_EvictionPolicy_STATUS_AllKeysRandom,
	"noeviction":     DatabaseProperties_EvictionPolicy_STATUS_NoEviction,
	"volatilelfu":    DatabaseProperties_EvictionPolicy_STATUS_VolatileLFU,
	"volatilelru":    DatabaseProperties_EvictionPolicy_STATUS_VolatileLRU,
	"volatilerandom": DatabaseProperties_EvictionPolicy_STATUS_VolatileRandom,
	"volatilettl":    DatabaseProperties_EvictionPolicy_STATUS_VolatileTTL,
}

type DatabaseProperties_GeoReplication struct {
	// GroupNickname: Name for the group of linked database resources
	GroupNickname *string `json:"groupNickname,omitempty"`

	// LinkedDatabases: List of database resources to link with this database
	LinkedDatabases []LinkedDatabase `json:"linkedDatabases,omitempty"`
}

var _ genruntime.ARMTransformer = &DatabaseProperties_GeoReplication{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (replication *DatabaseProperties_GeoReplication) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if replication == nil {
		return nil, nil
	}
	result := &arm.DatabaseProperties_GeoReplication{}

	// Set property "GroupNickname":
	if replication.GroupNickname != nil {
		groupNickname := *replication.GroupNickname
		result.GroupNickname = &groupNickname
	}

	// Set property "LinkedDatabases":
	for _, item := range replication.LinkedDatabases {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.LinkedDatabases = append(result.LinkedDatabases, *item_ARM.(*arm.LinkedDatabase))
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (replication *DatabaseProperties_GeoReplication) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.DatabaseProperties_GeoReplication{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (replication *DatabaseProperties_GeoReplication) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.DatabaseProperties_GeoReplication)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.DatabaseProperties_GeoReplication, got %T", armInput)
	}

	// Set property "GroupNickname":
	if typedInput.GroupNickname != nil {
		groupNickname := *typedInput.GroupNickname
		replication.GroupNickname = &groupNickname
	}

	// Set property "LinkedDatabases":
	for _, item := range typedInput.LinkedDatabases {
		var item1 LinkedDatabase
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		replication.LinkedDatabases = append(replication.LinkedDatabases, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_DatabaseProperties_GeoReplication populates our DatabaseProperties_GeoReplication from the provided source DatabaseProperties_GeoReplication
func (replication *DatabaseProperties_GeoReplication) AssignProperties_From_DatabaseProperties_GeoReplication(source *storage.DatabaseProperties_GeoReplication) error {

	// GroupNickname
	replication.GroupNickname = genruntime.ClonePointerToString(source.GroupNickname)

	// LinkedDatabases
	if source.LinkedDatabases != nil {
		linkedDatabaseList := make([]LinkedDatabase, len(source.LinkedDatabases))
		for linkedDatabaseIndex, linkedDatabaseItem := range source.LinkedDatabases {
			var linkedDatabase LinkedDatabase
			err := linkedDatabase.AssignProperties_From_LinkedDatabase(&linkedDatabaseItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_LinkedDatabase() to populate field LinkedDatabases")
			}
			linkedDatabaseList[linkedDatabaseIndex] = linkedDatabase
		}
		replication.LinkedDatabases = linkedDatabaseList
	} else {
		replication.LinkedDatabases = nil
	}

	// No error
	return nil
}

// AssignProperties_To_DatabaseProperties_GeoReplication populates the provided destination DatabaseProperties_GeoReplication from our DatabaseProperties_GeoReplication
func (replication *DatabaseProperties_GeoReplication) AssignProperties_To_DatabaseProperties_GeoReplication(destination *storage.DatabaseProperties_GeoReplication) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// GroupNickname
	destination.GroupNickname = genruntime.ClonePointerToString(replication.GroupNickname)

	// LinkedDatabases
	if replication.LinkedDatabases != nil {
		linkedDatabaseList := make([]storage.LinkedDatabase, len(replication.LinkedDatabases))
		for linkedDatabaseIndex, linkedDatabaseItem := range replication.LinkedDatabases {
			var linkedDatabase storage.LinkedDatabase
			err := linkedDatabaseItem.AssignProperties_To_LinkedDatabase(&linkedDatabase)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_LinkedDatabase() to populate field LinkedDatabases")
			}
			linkedDatabaseList[linkedDatabaseIndex] = linkedDatabase
		}
		destination.LinkedDatabases = linkedDatabaseList
	} else {
		destination.LinkedDatabases = nil
	}

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

	// No error
	return nil
}

// Initialize_From_DatabaseProperties_GeoReplication_STATUS populates our DatabaseProperties_GeoReplication from the provided source DatabaseProperties_GeoReplication_STATUS
func (replication *DatabaseProperties_GeoReplication) Initialize_From_DatabaseProperties_GeoReplication_STATUS(source *DatabaseProperties_GeoReplication_STATUS) error {

	// GroupNickname
	replication.GroupNickname = genruntime.ClonePointerToString(source.GroupNickname)

	// LinkedDatabases
	if source.LinkedDatabases != nil {
		linkedDatabaseList := make([]LinkedDatabase, len(source.LinkedDatabases))
		for linkedDatabaseIndex, linkedDatabaseItem := range source.LinkedDatabases {
			var linkedDatabase LinkedDatabase
			err := linkedDatabase.Initialize_From_LinkedDatabase_STATUS(&linkedDatabaseItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_LinkedDatabase_STATUS() to populate field LinkedDatabases")
			}
			linkedDatabaseList[linkedDatabaseIndex] = linkedDatabase
		}
		replication.LinkedDatabases = linkedDatabaseList
	} else {
		replication.LinkedDatabases = nil
	}

	// No error
	return nil
}

type DatabaseProperties_GeoReplication_STATUS struct {
	// GroupNickname: Name for the group of linked database resources
	GroupNickname *string `json:"groupNickname,omitempty"`

	// LinkedDatabases: List of database resources to link with this database
	LinkedDatabases []LinkedDatabase_STATUS `json:"linkedDatabases,omitempty"`
}

var _ genruntime.FromARMConverter = &DatabaseProperties_GeoReplication_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (replication *DatabaseProperties_GeoReplication_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.DatabaseProperties_GeoReplication_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (replication *DatabaseProperties_GeoReplication_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.DatabaseProperties_GeoReplication_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.DatabaseProperties_GeoReplication_STATUS, got %T", armInput)
	}

	// Set property "GroupNickname":
	if typedInput.GroupNickname != nil {
		groupNickname := *typedInput.GroupNickname
		replication.GroupNickname = &groupNickname
	}

	// Set property "LinkedDatabases":
	for _, item := range typedInput.LinkedDatabases {
		var item1 LinkedDatabase_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		replication.LinkedDatabases = append(replication.LinkedDatabases, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_DatabaseProperties_GeoReplication_STATUS populates our DatabaseProperties_GeoReplication_STATUS from the provided source DatabaseProperties_GeoReplication_STATUS
func (replication *DatabaseProperties_GeoReplication_STATUS) AssignProperties_From_DatabaseProperties_GeoReplication_STATUS(source *storage.DatabaseProperties_GeoReplication_STATUS) error {

	// GroupNickname
	replication.GroupNickname = genruntime.ClonePointerToString(source.GroupNickname)

	// LinkedDatabases
	if source.LinkedDatabases != nil {
		linkedDatabaseList := make([]LinkedDatabase_STATUS, len(source.LinkedDatabases))
		for linkedDatabaseIndex, linkedDatabaseItem := range source.LinkedDatabases {
			var linkedDatabase LinkedDatabase_STATUS
			err := linkedDatabase.AssignProperties_From_LinkedDatabase_STATUS(&linkedDatabaseItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_LinkedDatabase_STATUS() to populate field LinkedDatabases")
			}
			linkedDatabaseList[linkedDatabaseIndex] = linkedDatabase
		}
		replication.LinkedDatabases = linkedDatabaseList
	} else {
		replication.LinkedDatabases = nil
	}

	// No error
	return nil
}

// AssignProperties_To_DatabaseProperties_GeoReplication_STATUS populates the provided destination DatabaseProperties_GeoReplication_STATUS from our DatabaseProperties_GeoReplication_STATUS
func (replication *DatabaseProperties_GeoReplication_STATUS) AssignProperties_To_DatabaseProperties_GeoReplication_STATUS(destination *storage.DatabaseProperties_GeoReplication_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// GroupNickname
	destination.GroupNickname = genruntime.ClonePointerToString(replication.GroupNickname)

	// LinkedDatabases
	if replication.LinkedDatabases != nil {
		linkedDatabaseList := make([]storage.LinkedDatabase_STATUS, len(replication.LinkedDatabases))
		for linkedDatabaseIndex, linkedDatabaseItem := range replication.LinkedDatabases {
			var linkedDatabase storage.LinkedDatabase_STATUS
			err := linkedDatabaseItem.AssignProperties_To_LinkedDatabase_STATUS(&linkedDatabase)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_LinkedDatabase_STATUS() to populate field LinkedDatabases")
			}
			linkedDatabaseList[linkedDatabaseIndex] = linkedDatabase
		}
		destination.LinkedDatabases = linkedDatabaseList
	} else {
		destination.LinkedDatabases = nil
	}

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

	// No error
	return nil
}

// Specifies configuration of a redis module
type Module struct {
	// Args: Configuration options for the module, e.g. 'ERROR_RATE 0.01 INITIAL_SIZE 400'.
	Args *string `json:"args,omitempty"`

	// +kubebuilder:validation:Required
	// Name: The name of the module, e.g. 'RedisBloom', 'RediSearch', 'RedisTimeSeries'
	Name *string `json:"name,omitempty"`
}

var _ genruntime.ARMTransformer = &Module{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (module *Module) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if module == nil {
		return nil, nil
	}
	result := &arm.Module{}

	// Set property "Args":
	if module.Args != nil {
		args := *module.Args
		result.Args = &args
	}

	// Set property "Name":
	if module.Name != nil {
		name := *module.Name
		result.Name = &name
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (module *Module) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Module{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (module *Module) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Module)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Module, got %T", armInput)
	}

	// Set property "Args":
	if typedInput.Args != nil {
		args := *typedInput.Args
		module.Args = &args
	}

	// Set property "Name":
	if typedInput.Name != nil {
		name := *typedInput.Name
		module.Name = &name
	}

	// No error
	return nil
}

// AssignProperties_From_Module populates our Module from the provided source Module
func (module *Module) AssignProperties_From_Module(source *storage.Module) error {

	// Args
	module.Args = genruntime.ClonePointerToString(source.Args)

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

	// No error
	return nil
}

// AssignProperties_To_Module populates the provided destination Module from our Module
func (module *Module) AssignProperties_To_Module(destination *storage.Module) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Args
	destination.Args = genruntime.ClonePointerToString(module.Args)

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

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

	// No error
	return nil
}

// Initialize_From_Module_STATUS populates our Module from the provided source Module_STATUS
func (module *Module) Initialize_From_Module_STATUS(source *Module_STATUS) error {

	// Args
	module.Args = genruntime.ClonePointerToString(source.Args)

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

	// No error
	return nil
}

// Specifies configuration of a redis module
type Module_STATUS struct {
	// Args: Configuration options for the module, e.g. 'ERROR_RATE 0.01 INITIAL_SIZE 400'.
	Args *string `json:"args,omitempty"`

	// Name: The name of the module, e.g. 'RedisBloom', 'RediSearch', 'RedisTimeSeries'
	Name *string `json:"name,omitempty"`

	// Version: The version of the module, e.g. '1.0'.
	Version *string `json:"version,omitempty"`
}

var _ genruntime.FromARMConverter = &Module_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (module *Module_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Module_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (module *Module_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Module_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Module_STATUS, got %T", armInput)
	}

	// Set property "Args":
	if typedInput.Args != nil {
		args := *typedInput.Args
		module.Args = &args
	}

	// Set property "Name":
	if typedInput.Name != nil {
		name := *typedInput.Name
		module.Name = &name
	}

	// Set property "Version":
	if typedInput.Version != nil {
		version := *typedInput.Version
		module.Version = &version
	}

	// No error
	return nil
}

// AssignProperties_From_Module_STATUS populates our Module_STATUS from the provided source Module_STATUS
func (module *Module_STATUS) AssignProperties_From_Module_STATUS(source *storage.Module_STATUS) error {

	// Args
	module.Args = genruntime.ClonePointerToString(source.Args)

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

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

	// No error
	return nil
}

// AssignProperties_To_Module_STATUS populates the provided destination Module_STATUS from our Module_STATUS
func (module *Module_STATUS) AssignProperties_To_Module_STATUS(destination *storage.Module_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Args
	destination.Args = genruntime.ClonePointerToString(module.Args)

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

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

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

	// No error
	return nil
}

// Persistence-related configuration for the Redis Enterprise database
type Persistence struct {
	// AofEnabled: Sets whether AOF is enabled. Note that at most one of AOF or RDB persistence may be enabled.
	AofEnabled *bool `json:"aofEnabled,omitempty"`

	// AofFrequency: Sets the frequency at which data is written to disk. Defaults to '1s', meaning 'every second'. Note that
	// the 'always' setting is deprecated, because of its performance impact.
	AofFrequency *Persistence_AofFrequency `json:"aofFrequency,omitempty"`

	// RdbEnabled: Sets whether RDB is enabled. Note that at most one of AOF or RDB persistence may be enabled.
	RdbEnabled *bool `json:"rdbEnabled,omitempty"`

	// RdbFrequency: Sets the frequency at which a snapshot of the database is created.
	RdbFrequency *Persistence_RdbFrequency `json:"rdbFrequency,omitempty"`
}

var _ genruntime.ARMTransformer = &Persistence{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (persistence *Persistence) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if persistence == nil {
		return nil, nil
	}
	result := &arm.Persistence{}

	// Set property "AofEnabled":
	if persistence.AofEnabled != nil {
		aofEnabled := *persistence.AofEnabled
		result.AofEnabled = &aofEnabled
	}

	// Set property "AofFrequency":
	if persistence.AofFrequency != nil {
		var temp string
		temp = string(*persistence.AofFrequency)
		aofFrequency := arm.Persistence_AofFrequency(temp)
		result.AofFrequency = &aofFrequency
	}

	// Set property "RdbEnabled":
	if persistence.RdbEnabled != nil {
		rdbEnabled := *persistence.RdbEnabled
		result.RdbEnabled = &rdbEnabled
	}

	// Set property "RdbFrequency":
	if persistence.RdbFrequency != nil {
		var temp string
		temp = string(*persistence.RdbFrequency)
		rdbFrequency := arm.Persistence_RdbFrequency(temp)
		result.RdbFrequency = &rdbFrequency
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (persistence *Persistence) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Persistence{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (persistence *Persistence) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Persistence)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Persistence, got %T", armInput)
	}

	// Set property "AofEnabled":
	if typedInput.AofEnabled != nil {
		aofEnabled := *typedInput.AofEnabled
		persistence.AofEnabled = &aofEnabled
	}

	// Set property "AofFrequency":
	if typedInput.AofFrequency != nil {
		var temp string
		temp = string(*typedInput.AofFrequency)
		aofFrequency := Persistence_AofFrequency(temp)
		persistence.AofFrequency = &aofFrequency
	}

	// Set property "RdbEnabled":
	if typedInput.RdbEnabled != nil {
		rdbEnabled := *typedInput.RdbEnabled
		persistence.RdbEnabled = &rdbEnabled
	}

	// Set property "RdbFrequency":
	if typedInput.RdbFrequency != nil {
		var temp string
		temp = string(*typedInput.RdbFrequency)
		rdbFrequency := Persistence_RdbFrequency(temp)
		persistence.RdbFrequency = &rdbFrequency
	}

	// No error
	return nil
}

// AssignProperties_From_Persistence populates our Persistence from the provided source Persistence
func (persistence *Persistence) AssignProperties_From_Persistence(source *storage.Persistence) error {

	// AofEnabled
	if source.AofEnabled != nil {
		aofEnabled := *source.AofEnabled
		persistence.AofEnabled = &aofEnabled
	} else {
		persistence.AofEnabled = nil
	}

	// AofFrequency
	if source.AofFrequency != nil {
		aofFrequency := *source.AofFrequency
		aofFrequencyTemp := genruntime.ToEnum(aofFrequency, persistence_AofFrequency_Values)
		persistence.AofFrequency = &aofFrequencyTemp
	} else {
		persistence.AofFrequency = nil
	}

	// RdbEnabled
	if source.RdbEnabled != nil {
		rdbEnabled := *source.RdbEnabled
		persistence.RdbEnabled = &rdbEnabled
	} else {
		persistence.RdbEnabled = nil
	}

	// RdbFrequency
	if source.RdbFrequency != nil {
		rdbFrequency := *source.RdbFrequency
		rdbFrequencyTemp := genruntime.ToEnum(rdbFrequency, persistence_RdbFrequency_Values)
		persistence.RdbFrequency = &rdbFrequencyTemp
	} else {
		persistence.RdbFrequency = nil
	}

	// No error
	return nil
}

// AssignProperties_To_Persistence populates the provided destination Persistence from our Persistence
func (persistence *Persistence) AssignProperties_To_Persistence(destination *storage.Persistence) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AofEnabled
	if persistence.AofEnabled != nil {
		aofEnabled := *persistence.AofEnabled
		destination.AofEnabled = &aofEnabled
	} else {
		destination.AofEnabled = nil
	}

	// AofFrequency
	if persistence.AofFrequency != nil {
		aofFrequency := string(*persistence.AofFrequency)
		destination.AofFrequency = &aofFrequency
	} else {
		destination.AofFrequency = nil
	}

	// RdbEnabled
	if persistence.RdbEnabled != nil {
		rdbEnabled := *persistence.RdbEnabled
		destination.RdbEnabled = &rdbEnabled
	} else {
		destination.RdbEnabled = nil
	}

	// RdbFrequency
	if persistence.RdbFrequency != nil {
		rdbFrequency := string(*persistence.RdbFrequency)
		destination.RdbFrequency = &rdbFrequency
	} else {
		destination.RdbFrequency = nil
	}

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

	// No error
	return nil
}

// Initialize_From_Persistence_STATUS populates our Persistence from the provided source Persistence_STATUS
func (persistence *Persistence) Initialize_From_Persistence_STATUS(source *Persistence_STATUS) error {

	// AofEnabled
	if source.AofEnabled != nil {
		aofEnabled := *source.AofEnabled
		persistence.AofEnabled = &aofEnabled
	} else {
		persistence.AofEnabled = nil
	}

	// AofFrequency
	if source.AofFrequency != nil {
		aofFrequency := genruntime.ToEnum(string(*source.AofFrequency), persistence_AofFrequency_Values)
		persistence.AofFrequency = &aofFrequency
	} else {
		persistence.AofFrequency = nil
	}

	// RdbEnabled
	if source.RdbEnabled != nil {
		rdbEnabled := *source.RdbEnabled
		persistence.RdbEnabled = &rdbEnabled
	} else {
		persistence.RdbEnabled = nil
	}

	// RdbFrequency
	if source.RdbFrequency != nil {
		rdbFrequency := genruntime.ToEnum(string(*source.RdbFrequency), persistence_RdbFrequency_Values)
		persistence.RdbFrequency = &rdbFrequency
	} else {
		persistence.RdbFrequency = nil
	}

	// No error
	return nil
}

// Persistence-related configuration for the Redis Enterprise database
type Persistence_STATUS struct {
	// AofEnabled: Sets whether AOF is enabled. Note that at most one of AOF or RDB persistence may be enabled.
	AofEnabled *bool `json:"aofEnabled,omitempty"`

	// AofFrequency: Sets the frequency at which data is written to disk. Defaults to '1s', meaning 'every second'. Note that
	// the 'always' setting is deprecated, because of its performance impact.
	AofFrequency *Persistence_AofFrequency_STATUS `json:"aofFrequency,omitempty"`

	// RdbEnabled: Sets whether RDB is enabled. Note that at most one of AOF or RDB persistence may be enabled.
	RdbEnabled *bool `json:"rdbEnabled,omitempty"`

	// RdbFrequency: Sets the frequency at which a snapshot of the database is created.
	RdbFrequency *Persistence_RdbFrequency_STATUS `json:"rdbFrequency,omitempty"`
}

var _ genruntime.FromARMConverter = &Persistence_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (persistence *Persistence_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Persistence_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (persistence *Persistence_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Persistence_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Persistence_STATUS, got %T", armInput)
	}

	// Set property "AofEnabled":
	if typedInput.AofEnabled != nil {
		aofEnabled := *typedInput.AofEnabled
		persistence.AofEnabled = &aofEnabled
	}

	// Set property "AofFrequency":
	if typedInput.AofFrequency != nil {
		var temp string
		temp = string(*typedInput.AofFrequency)
		aofFrequency := Persistence_AofFrequency_STATUS(temp)
		persistence.AofFrequency = &aofFrequency
	}

	// Set property "RdbEnabled":
	if typedInput.RdbEnabled != nil {
		rdbEnabled := *typedInput.RdbEnabled
		persistence.RdbEnabled = &rdbEnabled
	}

	// Set property "RdbFrequency":
	if typedInput.RdbFrequency != nil {
		var temp string
		temp = string(*typedInput.RdbFrequency)
		rdbFrequency := Persistence_RdbFrequency_STATUS(temp)
		persistence.RdbFrequency = &rdbFrequency
	}

	// No error
	return nil
}

// AssignProperties_From_Persistence_STATUS populates our Persistence_STATUS from the provided source Persistence_STATUS
func (persistence *Persistence_STATUS) AssignProperties_From_Persistence_STATUS(source *storage.Persistence_STATUS) error {

	// AofEnabled
	if source.AofEnabled != nil {
		aofEnabled := *source.AofEnabled
		persistence.AofEnabled = &aofEnabled
	} else {
		persistence.AofEnabled = nil
	}

	// AofFrequency
	if source.AofFrequency != nil {
		aofFrequency := *source.AofFrequency
		aofFrequencyTemp := genruntime.ToEnum(aofFrequency, persistence_AofFrequency_STATUS_Values)
		persistence.AofFrequency = &aofFrequencyTemp
	} else {
		persistence.AofFrequency = nil
	}

	// RdbEnabled
	if source.RdbEnabled != nil {
		rdbEnabled := *source.RdbEnabled
		persistence.RdbEnabled = &rdbEnabled
	} else {
		persistence.RdbEnabled = nil
	}

	// RdbFrequency
	if source.RdbFrequency != nil {
		rdbFrequency := *source.RdbFrequency
		rdbFrequencyTemp := genruntime.ToEnum(rdbFrequency, persistence_RdbFrequency_STATUS_Values)
		persistence.RdbFrequency = &rdbFrequencyTemp
	} else {
		persistence.RdbFrequency = nil
	}

	// No error
	return nil
}

// AssignProperties_To_Persistence_STATUS populates the provided destination Persistence_STATUS from our Persistence_STATUS
func (persistence *Persistence_STATUS) AssignProperties_To_Persistence_STATUS(destination *storage.Persistence_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AofEnabled
	if persistence.AofEnabled != nil {
		aofEnabled := *persistence.AofEnabled
		destination.AofEnabled = &aofEnabled
	} else {
		destination.AofEnabled = nil
	}

	// AofFrequency
	if persistence.AofFrequency != nil {
		aofFrequency := string(*persistence.AofFrequency)
		destination.AofFrequency = &aofFrequency
	} else {
		destination.AofFrequency = nil
	}

	// RdbEnabled
	if persistence.RdbEnabled != nil {
		rdbEnabled := *persistence.RdbEnabled
		destination.RdbEnabled = &rdbEnabled
	} else {
		destination.RdbEnabled = nil
	}

	// RdbFrequency
	if persistence.RdbFrequency != nil {
		rdbFrequency := string(*persistence.RdbFrequency)
		destination.RdbFrequency = &rdbFrequency
	} else {
		destination.RdbFrequency = nil
	}

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

	// No error
	return nil
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type RedisEnterpriseDatabaseOperatorSpec struct {
	// ConfigMapExpressions: configures where to place operator written dynamic ConfigMaps (created with CEL expressions).
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`

	// SecretExpressions: configures where to place operator written dynamic secrets (created with CEL expressions).
	SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// AssignProperties_From_RedisEnterpriseDatabaseOperatorSpec populates our RedisEnterpriseDatabaseOperatorSpec from the provided source RedisEnterpriseDatabaseOperatorSpec
func (operator *RedisEnterpriseDatabaseOperatorSpec) AssignProperties_From_RedisEnterpriseDatabaseOperatorSpec(source *storage.RedisEnterpriseDatabaseOperatorSpec) error {

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

	// No error
	return nil
}

// AssignProperties_To_RedisEnterpriseDatabaseOperatorSpec populates the provided destination RedisEnterpriseDatabaseOperatorSpec from our RedisEnterpriseDatabaseOperatorSpec
func (operator *RedisEnterpriseDatabaseOperatorSpec) AssignProperties_To_RedisEnterpriseDatabaseOperatorSpec(destination *storage.RedisEnterpriseDatabaseOperatorSpec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

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

	// No error
	return nil
}

// Metadata pertaining to creation and last modification of the resource.
type SystemData_STATUS struct {
	// CreatedAt: The timestamp of resource creation (UTC).
	CreatedAt *string `json:"createdAt,omitempty"`

	// CreatedBy: The identity that created the resource.
	CreatedBy *string `json:"createdBy,omitempty"`

	// CreatedByType: The type of identity that created the resource.
	CreatedByType *SystemData_CreatedByType_STATUS `json:"createdByType,omitempty"`

	// LastModifiedAt: The timestamp of resource last modification (UTC)
	LastModifiedAt *string `json:"lastModifiedAt,omitempty"`

	// LastModifiedBy: The identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

	// LastModifiedByType: The type of identity that last modified the resource.
	LastModifiedByType *SystemData_LastModifiedByType_STATUS `json:"lastModifiedByType,omitempty"`
}

var _ genruntime.FromARMConverter = &SystemData_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (data *SystemData_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.SystemData_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (data *SystemData_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.SystemData_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.SystemData_STATUS, got %T", armInput)
	}

	// Set property "CreatedAt":
	if typedInput.CreatedAt != nil {
		createdAt := *typedInput.CreatedAt
		data.CreatedAt = &createdAt
	}

	// Set property "CreatedBy":
	if typedInput.CreatedBy != nil {
		createdBy := *typedInput.CreatedBy
		data.CreatedBy = &createdBy
	}

	// Set property "CreatedByType":
	if typedInput.CreatedByType != nil {
		var temp string
		temp = string(*typedInput.CreatedByType)
		createdByType := SystemData_CreatedByType_STATUS(temp)
		data.CreatedByType = &createdByType
	}

	// Set property "LastModifiedAt":
	if typedInput.LastModifiedAt != nil {
		lastModifiedAt := *typedInput.LastModifiedAt
		data.LastModifiedAt = &lastModifiedAt
	}

	// Set property "LastModifiedBy":
	if typedInput.LastModifiedBy != nil {
		lastModifiedBy := *typedInput.LastModifiedBy
		data.LastModifiedBy = &lastModifiedBy
	}

	// Set property "LastModifiedByType":
	if typedInput.LastModifiedByType != nil {
		var temp string
		temp = string(*typedInput.LastModifiedByType)
		lastModifiedByType := SystemData_LastModifiedByType_STATUS(temp)
		data.LastModifiedByType = &lastModifiedByType
	}

	// No error
	return nil
}

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

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

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

	// CreatedByType
	if source.CreatedByType != nil {
		createdByType := *source.CreatedByType
		createdByTypeTemp := genruntime.ToEnum(createdByType, systemData_CreatedByType_STATUS_Values)
		data.CreatedByType = &createdByTypeTemp
	} else {
		data.CreatedByType = nil
	}

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

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

	// LastModifiedByType
	if source.LastModifiedByType != nil {
		lastModifiedByType := *source.LastModifiedByType
		lastModifiedByTypeTemp := genruntime.ToEnum(lastModifiedByType, systemData_LastModifiedByType_STATUS_Values)
		data.LastModifiedByType = &lastModifiedByTypeTemp
	} else {
		data.LastModifiedByType = nil
	}

	// 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 {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

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

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

	// CreatedByType
	if data.CreatedByType != nil {
		createdByType := string(*data.CreatedByType)
		destination.CreatedByType = &createdByType
	} else {
		destination.CreatedByType = nil
	}

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

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

	// LastModifiedByType
	if data.LastModifiedByType != nil {
		lastModifiedByType := string(*data.LastModifiedByType)
		destination.LastModifiedByType = &lastModifiedByType
	} else {
		destination.LastModifiedByType = nil
	}

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

	// No error
	return nil
}

// Specifies details of a linked database resource.
type LinkedDatabase struct {
	// Reference: Resource ID of a database resource to link with this database.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &LinkedDatabase{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (database *LinkedDatabase) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if database == nil {
		return nil, nil
	}
	result := &arm.LinkedDatabase{}

	// Set property "Id":
	if database.Reference != nil {
		referenceARMID, err := resolved.ResolvedReferences.Lookup(*database.Reference)
		if err != nil {
			return nil, err
		}
		reference := referenceARMID
		result.Id = &reference
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (database *LinkedDatabase) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.LinkedDatabase{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (database *LinkedDatabase) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	_, ok := armInput.(arm.LinkedDatabase)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.LinkedDatabase, got %T", armInput)
	}

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_LinkedDatabase populates our LinkedDatabase from the provided source LinkedDatabase
func (database *LinkedDatabase) AssignProperties_From_LinkedDatabase(source *storage.LinkedDatabase) error {

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

	// No error
	return nil
}

// AssignProperties_To_LinkedDatabase populates the provided destination LinkedDatabase from our LinkedDatabase
func (database *LinkedDatabase) AssignProperties_To_LinkedDatabase(destination *storage.LinkedDatabase) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

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

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

	// No error
	return nil
}

// Initialize_From_LinkedDatabase_STATUS populates our LinkedDatabase from the provided source LinkedDatabase_STATUS
func (database *LinkedDatabase) Initialize_From_LinkedDatabase_STATUS(source *LinkedDatabase_STATUS) error {

	// Reference
	if source.Id != nil {
		reference := genruntime.CreateResourceReferenceFromARMID(*source.Id)
		database.Reference = &reference
	} else {
		database.Reference = nil
	}

	// No error
	return nil
}

// Specifies details of a linked database resource.
type LinkedDatabase_STATUS struct {
	// Id: Resource ID of a database resource to link with this database.
	Id *string `json:"id,omitempty"`

	// State: State of the link between the database resources.
	State *LinkedDatabase_State_STATUS `json:"state,omitempty"`
}

var _ genruntime.FromARMConverter = &LinkedDatabase_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (database *LinkedDatabase_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.LinkedDatabase_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (database *LinkedDatabase_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.LinkedDatabase_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.LinkedDatabase_STATUS, got %T", armInput)
	}

	// Set property "Id":
	if typedInput.Id != nil {
		id := *typedInput.Id
		database.Id = &id
	}

	// Set property "State":
	if typedInput.State != nil {
		var temp string
		temp = string(*typedInput.State)
		state := LinkedDatabase_State_STATUS(temp)
		database.State = &state
	}

	// No error
	return nil
}

// AssignProperties_From_LinkedDatabase_STATUS populates our LinkedDatabase_STATUS from the provided source LinkedDatabase_STATUS
func (database *LinkedDatabase_STATUS) AssignProperties_From_LinkedDatabase_STATUS(source *storage.LinkedDatabase_STATUS) error {

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

	// State
	if source.State != nil {
		state := *source.State
		stateTemp := genruntime.ToEnum(state, linkedDatabase_State_STATUS_Values)
		database.State = &stateTemp
	} else {
		database.State = nil
	}

	// No error
	return nil
}

// AssignProperties_To_LinkedDatabase_STATUS populates the provided destination LinkedDatabase_STATUS from our LinkedDatabase_STATUS
func (database *LinkedDatabase_STATUS) AssignProperties_To_LinkedDatabase_STATUS(destination *storage.LinkedDatabase_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

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

	// State
	if database.State != nil {
		state := string(*database.State)
		destination.State = &state
	} else {
		destination.State = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"1s","always"}
type Persistence_AofFrequency string

const (
	Persistence_AofFrequency_1S     = Persistence_AofFrequency("1s")
	Persistence_AofFrequency_Always = Persistence_AofFrequency("always")
)

// Mapping from string to Persistence_AofFrequency
var persistence_AofFrequency_Values = map[string]Persistence_AofFrequency{
	"1s":     Persistence_AofFrequency_1S,
	"always": Persistence_AofFrequency_Always,
}

type Persistence_AofFrequency_STATUS string

const (
	Persistence_AofFrequency_STATUS_1S     = Persistence_AofFrequency_STATUS("1s")
	Persistence_AofFrequency_STATUS_Always = Persistence_AofFrequency_STATUS("always")
)

// Mapping from string to Persistence_AofFrequency_STATUS
var persistence_AofFrequency_STATUS_Values = map[string]Persistence_AofFrequency_STATUS{
	"1s":     Persistence_AofFrequency_STATUS_1S,
	"always": Persistence_AofFrequency_STATUS_Always,
}

// +kubebuilder:validation:Enum={"12h","1h","6h"}
type Persistence_RdbFrequency string

const (
	Persistence_RdbFrequency_12H = Persistence_RdbFrequency("12h")
	Persistence_RdbFrequency_1H  = Persistence_RdbFrequency("1h")
	Persistence_RdbFrequency_6H  = Persistence_RdbFrequency("6h")
)

// Mapping from string to Persistence_RdbFrequency
var persistence_RdbFrequency_Values = map[string]Persistence_RdbFrequency{
	"12h": Persistence_RdbFrequency_12H,
	"1h":  Persistence_RdbFrequency_1H,
	"6h":  Persistence_RdbFrequency_6H,
}

type Persistence_RdbFrequency_STATUS string

const (
	Persistence_RdbFrequency_STATUS_12H = Persistence_RdbFrequency_STATUS("12h")
	Persistence_RdbFrequency_STATUS_1H  = Persistence_RdbFrequency_STATUS("1h")
	Persistence_RdbFrequency_STATUS_6H  = Persistence_RdbFrequency_STATUS("6h")
)

// Mapping from string to Persistence_RdbFrequency_STATUS
var persistence_RdbFrequency_STATUS_Values = map[string]Persistence_RdbFrequency_STATUS{
	"12h": Persistence_RdbFrequency_STATUS_12H,
	"1h":  Persistence_RdbFrequency_STATUS_1H,
	"6h":  Persistence_RdbFrequency_STATUS_6H,
}

type SystemData_CreatedByType_STATUS string

const (
	SystemData_CreatedByType_STATUS_Application     = SystemData_CreatedByType_STATUS("Application")
	SystemData_CreatedByType_STATUS_Key             = SystemData_CreatedByType_STATUS("Key")
	SystemData_CreatedByType_STATUS_ManagedIdentity = SystemData_CreatedByType_STATUS("ManagedIdentity")
	SystemData_CreatedByType_STATUS_User            = SystemData_CreatedByType_STATUS("User")
)

// Mapping from string to SystemData_CreatedByType_STATUS
var systemData_CreatedByType_STATUS_Values = map[string]SystemData_CreatedByType_STATUS{
	"application":     SystemData_CreatedByType_STATUS_Application,
	"key":             SystemData_CreatedByType_STATUS_Key,
	"managedidentity": SystemData_CreatedByType_STATUS_ManagedIdentity,
	"user":            SystemData_CreatedByType_STATUS_User,
}

type SystemData_LastModifiedByType_STATUS string

const (
	SystemData_LastModifiedByType_STATUS_Application     = SystemData_LastModifiedByType_STATUS("Application")
	SystemData_LastModifiedByType_STATUS_Key             = SystemData_LastModifiedByType_STATUS("Key")
	SystemData_LastModifiedByType_STATUS_ManagedIdentity = SystemData_LastModifiedByType_STATUS("ManagedIdentity")
	SystemData_LastModifiedByType_STATUS_User            = SystemData_LastModifiedByType_STATUS("User")
)

// Mapping from string to SystemData_LastModifiedByType_STATUS
var systemData_LastModifiedByType_STATUS_Values = map[string]SystemData_LastModifiedByType_STATUS{
	"application":     SystemData_LastModifiedByType_STATUS_Application,
	"key":             SystemData_LastModifiedByType_STATUS_Key,
	"managedidentity": SystemData_LastModifiedByType_STATUS_ManagedIdentity,
	"user":            SystemData_LastModifiedByType_STATUS_User,
}

type LinkedDatabase_State_STATUS string

const (
	LinkedDatabase_State_STATUS_LinkFailed   = LinkedDatabase_State_STATUS("LinkFailed")
	LinkedDatabase_State_STATUS_Linked       = LinkedDatabase_State_STATUS("Linked")
	LinkedDatabase_State_STATUS_Linking      = LinkedDatabase_State_STATUS("Linking")
	LinkedDatabase_State_STATUS_UnlinkFailed = LinkedDatabase_State_STATUS("UnlinkFailed")
	LinkedDatabase_State_STATUS_Unlinking    = LinkedDatabase_State_STATUS("Unlinking")
)

// Mapping from string to LinkedDatabase_State_STATUS
var linkedDatabase_State_STATUS_Values = map[string]LinkedDatabase_State_STATUS{
	"linkfailed":   LinkedDatabase_State_STATUS_LinkFailed,
	"linked":       LinkedDatabase_State_STATUS_Linked,
	"linking":      LinkedDatabase_State_STATUS_Linking,
	"unlinkfailed": LinkedDatabase_State_STATUS_UnlinkFailed,
	"unlinking":    LinkedDatabase_State_STATUS_Unlinking,
}

func init() {
	SchemeBuilder.Register(&RedisEnterpriseDatabase{}, &RedisEnterpriseDatabaseList{})
}
