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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/cache/v1api20230401/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/cache/v1api20230401/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: /redis/resource-manager/Microsoft.Cache/Redis/stable/2023-04-01/redis.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}
type Redis struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Redis_Spec   `json:"spec,omitempty"`
	Status            Redis_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Redis{}

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

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

var _ conversion.Convertible = &Redis{}

// ConvertFrom populates our Redis from the provided hub Redis
func (redis *Redis) ConvertFrom(hub conversion.Hub) error {
	// intermediate variable for conversion
	var source storage.Redis

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

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

	return nil
}

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

	return nil
}

var _ configmaps.Exporter = &Redis{}

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

var _ secrets.Exporter = &Redis{}

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

var _ genruntime.KubernetesResource = &Redis{}

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

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

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

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

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

// GetSupportedOperations returns the operations supported by the resource
func (redis *Redis) 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/redis"
func (redis *Redis) GetType() string {
	return "Microsoft.Cache/redis"
}

// NewEmptyStatus returns a new empty (blank) status
func (redis *Redis) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Redis_STATUS{}
}

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

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

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

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

	redis.Status = st
	return nil
}

// AssignProperties_From_Redis populates our Redis from the provided source Redis
func (redis *Redis) AssignProperties_From_Redis(source *storage.Redis) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Redis populates the provided destination Redis from our Redis
func (redis *Redis) AssignProperties_To_Redis(destination *storage.Redis) error {

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

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

	// Status
	var status storage.Redis_STATUS
	err = redis.Status.AssignProperties_To_Redis_STATUS(&status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_Redis_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 (redis *Redis) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: redis.Spec.OriginalVersion(),
		Kind:    "Redis",
	}
}

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /redis/resource-manager/Microsoft.Cache/Redis/stable/2023-04-01/redis.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}
type RedisList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Redis `json:"items"`
}

// +kubebuilder:validation:Enum={"2023-04-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2023-04-01")

type Redis_Spec struct {
	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName string `json:"azureName,omitempty"`

	// EnableNonSslPort: Specifies whether the non-ssl Redis server port (6379) is enabled.
	EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"`

	// Identity: The identity of the resource.
	Identity *ManagedServiceIdentity `json:"identity,omitempty"`

	// +kubebuilder:validation:Required
	// Location: The geo-location where the resource lives
	Location *string `json:"location,omitempty"`

	// MinimumTlsVersion: Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1',
	// '1.2')
	MinimumTlsVersion *RedisCreateProperties_MinimumTlsVersion `json:"minimumTlsVersion,omitempty"`

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

	// PublicNetworkAccess: Whether or not public endpoint access is allowed for this cache.  Value is optional, but if passed
	// in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is
	// 'Enabled'. Note: This setting is important for caches with private endpoints. It has *no effect* on caches that are
	// joined to, or injected into, a virtual network subnet.
	PublicNetworkAccess *RedisCreateProperties_PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

	// RedisConfiguration: All Redis Settings. Few possible keys:
	// rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value
	// etc.
	RedisConfiguration *RedisCreateProperties_RedisConfiguration `json:"redisConfiguration,omitempty"`

	// RedisVersion: Redis version. This should be in the form 'major[.minor]' (only 'major' is required) or the value 'latest'
	// which refers to the latest stable Redis version that is available. Supported versions: 4.0, 6.0 (latest). Default value
	// is 'latest'.
	RedisVersion *string `json:"redisVersion,omitempty"`

	// ReplicasPerMaster: The number of replicas to be created per primary.
	ReplicasPerMaster *int `json:"replicasPerMaster,omitempty"`

	// ReplicasPerPrimary: The number of replicas to be created per primary.
	ReplicasPerPrimary *int `json:"replicasPerPrimary,omitempty"`

	// ShardCount: The number of shards to be created on a Premium Cluster Cache.
	ShardCount *int `json:"shardCount,omitempty"`

	// +kubebuilder:validation:Required
	// Sku: The SKU of the Redis cache to deploy.
	Sku *Sku `json:"sku,omitempty"`

	// +kubebuilder:validation:Pattern="^\\d+\\.\\d+\\.\\d+\\.\\d+$"
	// StaticIP: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual
	// Network; auto assigned by default.
	StaticIP *string `json:"staticIP,omitempty"`

	// SubnetReference: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format:
	// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1
	SubnetReference *genruntime.ResourceReference `armReference:"SubnetId" json:"subnetReference,omitempty"`

	// Tags: Resource tags.
	Tags map[string]string `json:"tags,omitempty"`

	// TenantSettings: A dictionary of tenant settings
	TenantSettings map[string]string `json:"tenantSettings,omitempty"`

	// Zones: A list of availability zones denoting where the resource needs to come from.
	Zones []string `json:"zones,omitempty"`
}

var _ genruntime.ARMTransformer = &Redis_Spec{}

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

	// Set property "Identity":
	if redis.Identity != nil {
		identity_ARM, err := redis.Identity.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		identity := *identity_ARM.(*arm.ManagedServiceIdentity)
		result.Identity = &identity
	}

	// Set property "Location":
	if redis.Location != nil {
		location := *redis.Location
		result.Location = &location
	}

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

	// Set property "Properties":
	if redis.EnableNonSslPort != nil ||
		redis.MinimumTlsVersion != nil ||
		redis.PublicNetworkAccess != nil ||
		redis.RedisConfiguration != nil ||
		redis.RedisVersion != nil ||
		redis.ReplicasPerMaster != nil ||
		redis.ReplicasPerPrimary != nil ||
		redis.ShardCount != nil ||
		redis.Sku != nil ||
		redis.StaticIP != nil ||
		redis.SubnetReference != nil ||
		redis.TenantSettings != nil {
		result.Properties = &arm.RedisCreateProperties{}
	}
	if redis.EnableNonSslPort != nil {
		enableNonSslPort := *redis.EnableNonSslPort
		result.Properties.EnableNonSslPort = &enableNonSslPort
	}
	if redis.MinimumTlsVersion != nil {
		var temp string
		temp = string(*redis.MinimumTlsVersion)
		minimumTlsVersion := arm.RedisCreateProperties_MinimumTlsVersion(temp)
		result.Properties.MinimumTlsVersion = &minimumTlsVersion
	}
	if redis.PublicNetworkAccess != nil {
		var temp string
		temp = string(*redis.PublicNetworkAccess)
		publicNetworkAccess := arm.RedisCreateProperties_PublicNetworkAccess(temp)
		result.Properties.PublicNetworkAccess = &publicNetworkAccess
	}
	if redis.RedisConfiguration != nil {
		redisConfiguration_ARM, err := redis.RedisConfiguration.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		redisConfiguration := *redisConfiguration_ARM.(*arm.RedisCreateProperties_RedisConfiguration)
		result.Properties.RedisConfiguration = &redisConfiguration
	}
	if redis.RedisVersion != nil {
		redisVersion := *redis.RedisVersion
		result.Properties.RedisVersion = &redisVersion
	}
	if redis.ReplicasPerMaster != nil {
		replicasPerMaster := *redis.ReplicasPerMaster
		result.Properties.ReplicasPerMaster = &replicasPerMaster
	}
	if redis.ReplicasPerPrimary != nil {
		replicasPerPrimary := *redis.ReplicasPerPrimary
		result.Properties.ReplicasPerPrimary = &replicasPerPrimary
	}
	if redis.ShardCount != nil {
		shardCount := *redis.ShardCount
		result.Properties.ShardCount = &shardCount
	}
	if redis.Sku != nil {
		sku_ARM, err := redis.Sku.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		sku := *sku_ARM.(*arm.Sku)
		result.Properties.Sku = &sku
	}
	if redis.StaticIP != nil {
		staticIP := *redis.StaticIP
		result.Properties.StaticIP = &staticIP
	}
	if redis.SubnetReference != nil {
		subnetIdARMID, err := resolved.ResolvedReferences.Lookup(*redis.SubnetReference)
		if err != nil {
			return nil, err
		}
		subnetId := subnetIdARMID
		result.Properties.SubnetId = &subnetId
	}
	if redis.TenantSettings != nil {
		result.Properties.TenantSettings = make(map[string]string, len(redis.TenantSettings))
		for key, value := range redis.TenantSettings {
			result.Properties.TenantSettings[key] = value
		}
	}

	// Set property "Tags":
	if redis.Tags != nil {
		result.Tags = make(map[string]string, len(redis.Tags))
		for key, value := range redis.Tags {
			result.Tags[key] = value
		}
	}

	// Set property "Zones":
	for _, item := range redis.Zones {
		result.Zones = append(result.Zones, item)
	}
	return result, nil
}

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

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

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

	// Set property "EnableNonSslPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableNonSslPort != nil {
			enableNonSslPort := *typedInput.Properties.EnableNonSslPort
			redis.EnableNonSslPort = &enableNonSslPort
		}
	}

	// Set property "Identity":
	if typedInput.Identity != nil {
		var identity1 ManagedServiceIdentity
		err := identity1.PopulateFromARM(owner, *typedInput.Identity)
		if err != nil {
			return err
		}
		identity := identity1
		redis.Identity = &identity
	}

	// Set property "Location":
	if typedInput.Location != nil {
		location := *typedInput.Location
		redis.Location = &location
	}

	// Set property "MinimumTlsVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MinimumTlsVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.MinimumTlsVersion)
			minimumTlsVersion := RedisCreateProperties_MinimumTlsVersion(temp)
			redis.MinimumTlsVersion = &minimumTlsVersion
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "PublicNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicNetworkAccess)
			publicNetworkAccess := RedisCreateProperties_PublicNetworkAccess(temp)
			redis.PublicNetworkAccess = &publicNetworkAccess
		}
	}

	// Set property "RedisConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RedisConfiguration != nil {
			var redisConfiguration1 RedisCreateProperties_RedisConfiguration
			err := redisConfiguration1.PopulateFromARM(owner, *typedInput.Properties.RedisConfiguration)
			if err != nil {
				return err
			}
			redisConfiguration := redisConfiguration1
			redis.RedisConfiguration = &redisConfiguration
		}
	}

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

	// Set property "ReplicasPerMaster":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ReplicasPerMaster != nil {
			replicasPerMaster := *typedInput.Properties.ReplicasPerMaster
			redis.ReplicasPerMaster = &replicasPerMaster
		}
	}

	// Set property "ReplicasPerPrimary":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ReplicasPerPrimary != nil {
			replicasPerPrimary := *typedInput.Properties.ReplicasPerPrimary
			redis.ReplicasPerPrimary = &replicasPerPrimary
		}
	}

	// Set property "ShardCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ShardCount != nil {
			shardCount := *typedInput.Properties.ShardCount
			redis.ShardCount = &shardCount
		}
	}

	// Set property "Sku":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Sku != nil {
			var sku1 Sku
			err := sku1.PopulateFromARM(owner, *typedInput.Properties.Sku)
			if err != nil {
				return err
			}
			sku := sku1
			redis.Sku = &sku
		}
	}

	// Set property "StaticIP":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.StaticIP != nil {
			staticIP := *typedInput.Properties.StaticIP
			redis.StaticIP = &staticIP
		}
	}

	// no assignment for property "SubnetReference"

	// Set property "Tags":
	if typedInput.Tags != nil {
		redis.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			redis.Tags[key] = value
		}
	}

	// Set property "TenantSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TenantSettings != nil {
			redis.TenantSettings = make(map[string]string, len(typedInput.Properties.TenantSettings))
			for key, value := range typedInput.Properties.TenantSettings {
				redis.TenantSettings[key] = value
			}
		}
	}

	// Set property "Zones":
	for _, item := range typedInput.Zones {
		redis.Zones = append(redis.Zones, item)
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Redis_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Redis_Spec{}
	err := redis.AssignProperties_To_Redis_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_Redis_Spec populates our Redis_Spec from the provided source Redis_Spec
func (redis *Redis_Spec) AssignProperties_From_Redis_Spec(source *storage.Redis_Spec) error {

	// AzureName
	redis.AzureName = source.AzureName

	// EnableNonSslPort
	if source.EnableNonSslPort != nil {
		enableNonSslPort := *source.EnableNonSslPort
		redis.EnableNonSslPort = &enableNonSslPort
	} else {
		redis.EnableNonSslPort = nil
	}

	// Identity
	if source.Identity != nil {
		var identity ManagedServiceIdentity
		err := identity.AssignProperties_From_ManagedServiceIdentity(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ManagedServiceIdentity() to populate field Identity")
		}
		redis.Identity = &identity
	} else {
		redis.Identity = nil
	}

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

	// MinimumTlsVersion
	if source.MinimumTlsVersion != nil {
		minimumTlsVersion := *source.MinimumTlsVersion
		minimumTlsVersionTemp := genruntime.ToEnum(minimumTlsVersion, redisCreateProperties_MinimumTlsVersion_Values)
		redis.MinimumTlsVersion = &minimumTlsVersionTemp
	} else {
		redis.MinimumTlsVersion = nil
	}

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

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

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		publicNetworkAccess := *source.PublicNetworkAccess
		publicNetworkAccessTemp := genruntime.ToEnum(publicNetworkAccess, redisCreateProperties_PublicNetworkAccess_Values)
		redis.PublicNetworkAccess = &publicNetworkAccessTemp
	} else {
		redis.PublicNetworkAccess = nil
	}

	// RedisConfiguration
	if source.RedisConfiguration != nil {
		var redisConfiguration RedisCreateProperties_RedisConfiguration
		err := redisConfiguration.AssignProperties_From_RedisCreateProperties_RedisConfiguration(source.RedisConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_RedisCreateProperties_RedisConfiguration() to populate field RedisConfiguration")
		}
		redis.RedisConfiguration = &redisConfiguration
	} else {
		redis.RedisConfiguration = nil
	}

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

	// ReplicasPerMaster
	redis.ReplicasPerMaster = genruntime.ClonePointerToInt(source.ReplicasPerMaster)

	// ReplicasPerPrimary
	redis.ReplicasPerPrimary = genruntime.ClonePointerToInt(source.ReplicasPerPrimary)

	// ShardCount
	redis.ShardCount = genruntime.ClonePointerToInt(source.ShardCount)

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

	// StaticIP
	redis.StaticIP = genruntime.ClonePointerToString(source.StaticIP)

	// SubnetReference
	if source.SubnetReference != nil {
		subnetReference := source.SubnetReference.Copy()
		redis.SubnetReference = &subnetReference
	} else {
		redis.SubnetReference = nil
	}

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

	// TenantSettings
	redis.TenantSettings = genruntime.CloneMapOfStringToString(source.TenantSettings)

	// Zones
	redis.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = redis.AzureName

	// EnableNonSslPort
	if redis.EnableNonSslPort != nil {
		enableNonSslPort := *redis.EnableNonSslPort
		destination.EnableNonSslPort = &enableNonSslPort
	} else {
		destination.EnableNonSslPort = nil
	}

	// Identity
	if redis.Identity != nil {
		var identity storage.ManagedServiceIdentity
		err := redis.Identity.AssignProperties_To_ManagedServiceIdentity(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ManagedServiceIdentity() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

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

	// MinimumTlsVersion
	if redis.MinimumTlsVersion != nil {
		minimumTlsVersion := string(*redis.MinimumTlsVersion)
		destination.MinimumTlsVersion = &minimumTlsVersion
	} else {
		destination.MinimumTlsVersion = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = redis.OriginalVersion()

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

	// PublicNetworkAccess
	if redis.PublicNetworkAccess != nil {
		publicNetworkAccess := string(*redis.PublicNetworkAccess)
		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// RedisConfiguration
	if redis.RedisConfiguration != nil {
		var redisConfiguration storage.RedisCreateProperties_RedisConfiguration
		err := redis.RedisConfiguration.AssignProperties_To_RedisCreateProperties_RedisConfiguration(&redisConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_RedisCreateProperties_RedisConfiguration() to populate field RedisConfiguration")
		}
		destination.RedisConfiguration = &redisConfiguration
	} else {
		destination.RedisConfiguration = nil
	}

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

	// ReplicasPerMaster
	destination.ReplicasPerMaster = genruntime.ClonePointerToInt(redis.ReplicasPerMaster)

	// ReplicasPerPrimary
	destination.ReplicasPerPrimary = genruntime.ClonePointerToInt(redis.ReplicasPerPrimary)

	// ShardCount
	destination.ShardCount = genruntime.ClonePointerToInt(redis.ShardCount)

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

	// StaticIP
	destination.StaticIP = genruntime.ClonePointerToString(redis.StaticIP)

	// SubnetReference
	if redis.SubnetReference != nil {
		subnetReference := redis.SubnetReference.Copy()
		destination.SubnetReference = &subnetReference
	} else {
		destination.SubnetReference = nil
	}

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

	// TenantSettings
	destination.TenantSettings = genruntime.CloneMapOfStringToString(redis.TenantSettings)

	// Zones
	destination.Zones = genruntime.CloneSliceOfString(redis.Zones)

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

	// No error
	return nil
}

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

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

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

	// EnableNonSslPort: Specifies whether the non-ssl Redis server port (6379) is enabled.
	EnableNonSslPort *bool `json:"enableNonSslPort,omitempty"`

	// HostName: Redis host name.
	HostName *string `json:"hostName,omitempty"`

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

	// Identity: The identity of the resource.
	Identity *ManagedServiceIdentity_STATUS `json:"identity,omitempty"`

	// Instances: List of the Redis instances associated with the cache
	Instances []RedisInstanceDetails_STATUS `json:"instances,omitempty"`

	// LinkedServers: List of the linked servers associated with the cache
	LinkedServers []RedisLinkedServer_STATUS `json:"linkedServers,omitempty"`

	// Location: The geo-location where the resource lives
	Location *string `json:"location,omitempty"`

	// MinimumTlsVersion: Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1',
	// '1.2')
	MinimumTlsVersion *RedisProperties_MinimumTlsVersion_STATUS `json:"minimumTlsVersion,omitempty"`

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

	// Port: Redis non-SSL port.
	Port *int `json:"port,omitempty"`

	// PrivateEndpointConnections: List of private endpoint connection associated with the specified redis cache
	PrivateEndpointConnections []PrivateEndpointConnection_STATUS `json:"privateEndpointConnections,omitempty"`

	// ProvisioningState: Redis instance provisioning status.
	ProvisioningState *RedisProperties_ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// PublicNetworkAccess: Whether or not public endpoint access is allowed for this cache.  Value is optional, but if passed
	// in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is
	// 'Enabled'. Note: This setting is important for caches with private endpoints. It has *no effect* on caches that are
	// joined to, or injected into, a virtual network subnet.
	PublicNetworkAccess *RedisProperties_PublicNetworkAccess_STATUS `json:"publicNetworkAccess,omitempty"`

	// RedisConfiguration: All Redis Settings. Few possible keys:
	// rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value
	// etc.
	RedisConfiguration *RedisProperties_RedisConfiguration_STATUS `json:"redisConfiguration,omitempty"`

	// RedisVersion: Redis version. This should be in the form 'major[.minor]' (only 'major' is required) or the value 'latest'
	// which refers to the latest stable Redis version that is available. Supported versions: 4.0, 6.0 (latest). Default value
	// is 'latest'.
	RedisVersion *string `json:"redisVersion,omitempty"`

	// ReplicasPerMaster: The number of replicas to be created per primary.
	ReplicasPerMaster *int `json:"replicasPerMaster,omitempty"`

	// ReplicasPerPrimary: The number of replicas to be created per primary.
	ReplicasPerPrimary *int `json:"replicasPerPrimary,omitempty"`

	// ShardCount: The number of shards to be created on a Premium Cluster Cache.
	ShardCount *int `json:"shardCount,omitempty"`

	// Sku: The SKU of the Redis cache to deploy.
	Sku *Sku_STATUS `json:"sku,omitempty"`

	// SslPort: Redis SSL port.
	SslPort *int `json:"sslPort,omitempty"`

	// StaticIP: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual
	// Network; auto assigned by default.
	StaticIP *string `json:"staticIP,omitempty"`

	// SubnetId: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format:
	// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1
	SubnetId *string `json:"subnetId,omitempty"`

	// Tags: Resource tags.
	Tags map[string]string `json:"tags,omitempty"`

	// TenantSettings: A dictionary of tenant settings
	TenantSettings map[string]string `json:"tenantSettings,omitempty"`

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

	// Zones: A list of availability zones denoting where the resource needs to come from.
	Zones []string `json:"zones,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Redis_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Redis_STATUS{}
	err := redis.AssignProperties_To_Redis_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 = &Redis_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "EnableNonSslPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableNonSslPort != nil {
			enableNonSslPort := *typedInput.Properties.EnableNonSslPort
			redis.EnableNonSslPort = &enableNonSslPort
		}
	}

	// Set property "HostName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HostName != nil {
			hostName := *typedInput.Properties.HostName
			redis.HostName = &hostName
		}
	}

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

	// Set property "Identity":
	if typedInput.Identity != nil {
		var identity1 ManagedServiceIdentity_STATUS
		err := identity1.PopulateFromARM(owner, *typedInput.Identity)
		if err != nil {
			return err
		}
		identity := identity1
		redis.Identity = &identity
	}

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

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

	// Set property "Location":
	if typedInput.Location != nil {
		location := *typedInput.Location
		redis.Location = &location
	}

	// Set property "MinimumTlsVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MinimumTlsVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.MinimumTlsVersion)
			minimumTlsVersion := RedisProperties_MinimumTlsVersion_STATUS(temp)
			redis.MinimumTlsVersion = &minimumTlsVersion
		}
	}

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

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

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

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

	// Set property "PublicNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicNetworkAccess)
			publicNetworkAccess := RedisProperties_PublicNetworkAccess_STATUS(temp)
			redis.PublicNetworkAccess = &publicNetworkAccess
		}
	}

	// Set property "RedisConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RedisConfiguration != nil {
			var redisConfiguration1 RedisProperties_RedisConfiguration_STATUS
			err := redisConfiguration1.PopulateFromARM(owner, *typedInput.Properties.RedisConfiguration)
			if err != nil {
				return err
			}
			redisConfiguration := redisConfiguration1
			redis.RedisConfiguration = &redisConfiguration
		}
	}

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

	// Set property "ReplicasPerMaster":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ReplicasPerMaster != nil {
			replicasPerMaster := *typedInput.Properties.ReplicasPerMaster
			redis.ReplicasPerMaster = &replicasPerMaster
		}
	}

	// Set property "ReplicasPerPrimary":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ReplicasPerPrimary != nil {
			replicasPerPrimary := *typedInput.Properties.ReplicasPerPrimary
			redis.ReplicasPerPrimary = &replicasPerPrimary
		}
	}

	// Set property "ShardCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ShardCount != nil {
			shardCount := *typedInput.Properties.ShardCount
			redis.ShardCount = &shardCount
		}
	}

	// Set property "Sku":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Sku != nil {
			var sku1 Sku_STATUS
			err := sku1.PopulateFromARM(owner, *typedInput.Properties.Sku)
			if err != nil {
				return err
			}
			sku := sku1
			redis.Sku = &sku
		}
	}

	// Set property "SslPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SslPort != nil {
			sslPort := *typedInput.Properties.SslPort
			redis.SslPort = &sslPort
		}
	}

	// Set property "StaticIP":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.StaticIP != nil {
			staticIP := *typedInput.Properties.StaticIP
			redis.StaticIP = &staticIP
		}
	}

	// Set property "SubnetId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SubnetId != nil {
			subnetId := *typedInput.Properties.SubnetId
			redis.SubnetId = &subnetId
		}
	}

	// Set property "Tags":
	if typedInput.Tags != nil {
		redis.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			redis.Tags[key] = value
		}
	}

	// Set property "TenantSettings":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TenantSettings != nil {
			redis.TenantSettings = make(map[string]string, len(typedInput.Properties.TenantSettings))
			for key, value := range typedInput.Properties.TenantSettings {
				redis.TenantSettings[key] = value
			}
		}
	}

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

	// Set property "Zones":
	for _, item := range typedInput.Zones {
		redis.Zones = append(redis.Zones, item)
	}

	// No error
	return nil
}

// AssignProperties_From_Redis_STATUS populates our Redis_STATUS from the provided source Redis_STATUS
func (redis *Redis_STATUS) AssignProperties_From_Redis_STATUS(source *storage.Redis_STATUS) error {

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

	// EnableNonSslPort
	if source.EnableNonSslPort != nil {
		enableNonSslPort := *source.EnableNonSslPort
		redis.EnableNonSslPort = &enableNonSslPort
	} else {
		redis.EnableNonSslPort = nil
	}

	// HostName
	redis.HostName = genruntime.ClonePointerToString(source.HostName)

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

	// Identity
	if source.Identity != nil {
		var identity ManagedServiceIdentity_STATUS
		err := identity.AssignProperties_From_ManagedServiceIdentity_STATUS(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ManagedServiceIdentity_STATUS() to populate field Identity")
		}
		redis.Identity = &identity
	} else {
		redis.Identity = nil
	}

	// Instances
	if source.Instances != nil {
		instanceList := make([]RedisInstanceDetails_STATUS, len(source.Instances))
		for instanceIndex, instanceItem := range source.Instances {
			var instance RedisInstanceDetails_STATUS
			err := instance.AssignProperties_From_RedisInstanceDetails_STATUS(&instanceItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_RedisInstanceDetails_STATUS() to populate field Instances")
			}
			instanceList[instanceIndex] = instance
		}
		redis.Instances = instanceList
	} else {
		redis.Instances = nil
	}

	// LinkedServers
	if source.LinkedServers != nil {
		linkedServerList := make([]RedisLinkedServer_STATUS, len(source.LinkedServers))
		for linkedServerIndex, linkedServerItem := range source.LinkedServers {
			var linkedServer RedisLinkedServer_STATUS
			err := linkedServer.AssignProperties_From_RedisLinkedServer_STATUS(&linkedServerItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_RedisLinkedServer_STATUS() to populate field LinkedServers")
			}
			linkedServerList[linkedServerIndex] = linkedServer
		}
		redis.LinkedServers = linkedServerList
	} else {
		redis.LinkedServers = nil
	}

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

	// MinimumTlsVersion
	if source.MinimumTlsVersion != nil {
		minimumTlsVersion := *source.MinimumTlsVersion
		minimumTlsVersionTemp := genruntime.ToEnum(minimumTlsVersion, redisProperties_MinimumTlsVersion_STATUS_Values)
		redis.MinimumTlsVersion = &minimumTlsVersionTemp
	} else {
		redis.MinimumTlsVersion = nil
	}

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

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

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

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

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		publicNetworkAccess := *source.PublicNetworkAccess
		publicNetworkAccessTemp := genruntime.ToEnum(publicNetworkAccess, redisProperties_PublicNetworkAccess_STATUS_Values)
		redis.PublicNetworkAccess = &publicNetworkAccessTemp
	} else {
		redis.PublicNetworkAccess = nil
	}

	// RedisConfiguration
	if source.RedisConfiguration != nil {
		var redisConfiguration RedisProperties_RedisConfiguration_STATUS
		err := redisConfiguration.AssignProperties_From_RedisProperties_RedisConfiguration_STATUS(source.RedisConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_RedisProperties_RedisConfiguration_STATUS() to populate field RedisConfiguration")
		}
		redis.RedisConfiguration = &redisConfiguration
	} else {
		redis.RedisConfiguration = nil
	}

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

	// ReplicasPerMaster
	redis.ReplicasPerMaster = genruntime.ClonePointerToInt(source.ReplicasPerMaster)

	// ReplicasPerPrimary
	redis.ReplicasPerPrimary = genruntime.ClonePointerToInt(source.ReplicasPerPrimary)

	// ShardCount
	redis.ShardCount = genruntime.ClonePointerToInt(source.ShardCount)

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

	// SslPort
	redis.SslPort = genruntime.ClonePointerToInt(source.SslPort)

	// StaticIP
	redis.StaticIP = genruntime.ClonePointerToString(source.StaticIP)

	// SubnetId
	redis.SubnetId = genruntime.ClonePointerToString(source.SubnetId)

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

	// TenantSettings
	redis.TenantSettings = genruntime.CloneMapOfStringToString(source.TenantSettings)

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

	// Zones
	redis.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

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

	// EnableNonSslPort
	if redis.EnableNonSslPort != nil {
		enableNonSslPort := *redis.EnableNonSslPort
		destination.EnableNonSslPort = &enableNonSslPort
	} else {
		destination.EnableNonSslPort = nil
	}

	// HostName
	destination.HostName = genruntime.ClonePointerToString(redis.HostName)

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

	// Identity
	if redis.Identity != nil {
		var identity storage.ManagedServiceIdentity_STATUS
		err := redis.Identity.AssignProperties_To_ManagedServiceIdentity_STATUS(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ManagedServiceIdentity_STATUS() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

	// Instances
	if redis.Instances != nil {
		instanceList := make([]storage.RedisInstanceDetails_STATUS, len(redis.Instances))
		for instanceIndex, instanceItem := range redis.Instances {
			var instance storage.RedisInstanceDetails_STATUS
			err := instanceItem.AssignProperties_To_RedisInstanceDetails_STATUS(&instance)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_RedisInstanceDetails_STATUS() to populate field Instances")
			}
			instanceList[instanceIndex] = instance
		}
		destination.Instances = instanceList
	} else {
		destination.Instances = nil
	}

	// LinkedServers
	if redis.LinkedServers != nil {
		linkedServerList := make([]storage.RedisLinkedServer_STATUS, len(redis.LinkedServers))
		for linkedServerIndex, linkedServerItem := range redis.LinkedServers {
			var linkedServer storage.RedisLinkedServer_STATUS
			err := linkedServerItem.AssignProperties_To_RedisLinkedServer_STATUS(&linkedServer)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_RedisLinkedServer_STATUS() to populate field LinkedServers")
			}
			linkedServerList[linkedServerIndex] = linkedServer
		}
		destination.LinkedServers = linkedServerList
	} else {
		destination.LinkedServers = nil
	}

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

	// MinimumTlsVersion
	if redis.MinimumTlsVersion != nil {
		minimumTlsVersion := string(*redis.MinimumTlsVersion)
		destination.MinimumTlsVersion = &minimumTlsVersion
	} else {
		destination.MinimumTlsVersion = nil
	}

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

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

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

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

	// PublicNetworkAccess
	if redis.PublicNetworkAccess != nil {
		publicNetworkAccess := string(*redis.PublicNetworkAccess)
		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// RedisConfiguration
	if redis.RedisConfiguration != nil {
		var redisConfiguration storage.RedisProperties_RedisConfiguration_STATUS
		err := redis.RedisConfiguration.AssignProperties_To_RedisProperties_RedisConfiguration_STATUS(&redisConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_RedisProperties_RedisConfiguration_STATUS() to populate field RedisConfiguration")
		}
		destination.RedisConfiguration = &redisConfiguration
	} else {
		destination.RedisConfiguration = nil
	}

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

	// ReplicasPerMaster
	destination.ReplicasPerMaster = genruntime.ClonePointerToInt(redis.ReplicasPerMaster)

	// ReplicasPerPrimary
	destination.ReplicasPerPrimary = genruntime.ClonePointerToInt(redis.ReplicasPerPrimary)

	// ShardCount
	destination.ShardCount = genruntime.ClonePointerToInt(redis.ShardCount)

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

	// SslPort
	destination.SslPort = genruntime.ClonePointerToInt(redis.SslPort)

	// StaticIP
	destination.StaticIP = genruntime.ClonePointerToString(redis.StaticIP)

	// SubnetId
	destination.SubnetId = genruntime.ClonePointerToString(redis.SubnetId)

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

	// TenantSettings
	destination.TenantSettings = genruntime.CloneMapOfStringToString(redis.TenantSettings)

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

	// Zones
	destination.Zones = genruntime.CloneSliceOfString(redis.Zones)

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

	// No error
	return nil
}

// Managed service identity (system assigned and/or user assigned identities)
type ManagedServiceIdentity struct {
	// +kubebuilder:validation:Required
	// Type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
	Type                   *ManagedServiceIdentityType   `json:"type,omitempty"`
	UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"`
}

var _ genruntime.ARMTransformer = &ManagedServiceIdentity{}

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

	// Set property "Type":
	if identity.Type != nil {
		var temp string
		temp = string(*identity.Type)
		typeVar := arm.ManagedServiceIdentityType(temp)
		result.Type = &typeVar
	}

	// Set property "UserAssignedIdentities":
	result.UserAssignedIdentities = make(map[string]arm.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities))
	for _, ident := range identity.UserAssignedIdentities {
		identARMID, err := resolved.ResolvedReferences.Lookup(ident.Reference)
		if err != nil {
			return nil, err
		}
		key := identARMID
		result.UserAssignedIdentities[key] = arm.UserAssignedIdentityDetails{}
	}
	return result, nil
}

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

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

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := ManagedServiceIdentityType(temp)
		identity.Type = &typeVar
	}

	// no assignment for property "UserAssignedIdentities"

	// No error
	return nil
}

// AssignProperties_From_ManagedServiceIdentity populates our ManagedServiceIdentity from the provided source ManagedServiceIdentity
func (identity *ManagedServiceIdentity) AssignProperties_From_ManagedServiceIdentity(source *storage.ManagedServiceIdentity) error {

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, managedServiceIdentityType_Values)
		identity.Type = &typeTemp
	} else {
		identity.Type = nil
	}

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]UserAssignedIdentityDetails, len(source.UserAssignedIdentities))
		for userAssignedIdentityIndex, userAssignedIdentityItem := range source.UserAssignedIdentities {
			var userAssignedIdentity UserAssignedIdentityDetails
			err := userAssignedIdentity.AssignProperties_From_UserAssignedIdentityDetails(&userAssignedIdentityItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentityDetails() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity
		}
		identity.UserAssignedIdentities = userAssignedIdentityList
	} else {
		identity.UserAssignedIdentities = nil
	}

	// No error
	return nil
}

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

	// Type
	if identity.Type != nil {
		typeVar := string(*identity.Type)
		destination.Type = &typeVar
	} else {
		destination.Type = nil
	}

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]storage.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities))
		for userAssignedIdentityIndex, userAssignedIdentityItem := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.UserAssignedIdentityDetails
			err := userAssignedIdentityItem.AssignProperties_To_UserAssignedIdentityDetails(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentityDetails() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity
		}
		destination.UserAssignedIdentities = userAssignedIdentityList
	} else {
		destination.UserAssignedIdentities = nil
	}

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

	// No error
	return nil
}

// Managed service identity (system assigned and/or user assigned identities)
type ManagedServiceIdentity_STATUS struct {
	// PrincipalId: The service principal ID of the system assigned identity. This property will only be provided for a system
	// assigned identity.
	PrincipalId *string `json:"principalId,omitempty"`

	// TenantId: The tenant ID of the system assigned identity. This property will only be provided for a system assigned
	// identity.
	TenantId *string `json:"tenantId,omitempty"`

	// Type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
	Type                   *ManagedServiceIdentityType_STATUS     `json:"type,omitempty"`
	UserAssignedIdentities map[string]UserAssignedIdentity_STATUS `json:"userAssignedIdentities,omitempty"`
}

var _ genruntime.FromARMConverter = &ManagedServiceIdentity_STATUS{}

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

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

	// Set property "PrincipalId":
	if typedInput.PrincipalId != nil {
		principalId := *typedInput.PrincipalId
		identity.PrincipalId = &principalId
	}

	// Set property "TenantId":
	if typedInput.TenantId != nil {
		tenantId := *typedInput.TenantId
		identity.TenantId = &tenantId
	}

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := ManagedServiceIdentityType_STATUS(temp)
		identity.Type = &typeVar
	}

	// Set property "UserAssignedIdentities":
	if typedInput.UserAssignedIdentities != nil {
		identity.UserAssignedIdentities = make(map[string]UserAssignedIdentity_STATUS, len(typedInput.UserAssignedIdentities))
		for key, value := range typedInput.UserAssignedIdentities {
			var value1 UserAssignedIdentity_STATUS
			err := value1.PopulateFromARM(owner, value)
			if err != nil {
				return err
			}
			identity.UserAssignedIdentities[key] = value1
		}
	}

	// No error
	return nil
}

// AssignProperties_From_ManagedServiceIdentity_STATUS populates our ManagedServiceIdentity_STATUS from the provided source ManagedServiceIdentity_STATUS
func (identity *ManagedServiceIdentity_STATUS) AssignProperties_From_ManagedServiceIdentity_STATUS(source *storage.ManagedServiceIdentity_STATUS) error {

	// PrincipalId
	identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId)

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

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, managedServiceIdentityType_STATUS_Values)
		identity.Type = &typeTemp
	} else {
		identity.Type = nil
	}

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]UserAssignedIdentity_STATUS, len(source.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range source.UserAssignedIdentities {
			var userAssignedIdentity UserAssignedIdentity_STATUS
			err := userAssignedIdentity.AssignProperties_From_UserAssignedIdentity_STATUS(&userAssignedIdentityValue)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentity_STATUS() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity
		}
		identity.UserAssignedIdentities = userAssignedIdentityMap
	} else {
		identity.UserAssignedIdentities = nil
	}

	// No error
	return nil
}

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

	// PrincipalId
	destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId)

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

	// Type
	if identity.Type != nil {
		typeVar := string(*identity.Type)
		destination.Type = &typeVar
	} else {
		destination.Type = nil
	}

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]storage.UserAssignedIdentity_STATUS, len(identity.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.UserAssignedIdentity_STATUS
			err := userAssignedIdentityValue.AssignProperties_To_UserAssignedIdentity_STATUS(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentity_STATUS() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity
		}
		destination.UserAssignedIdentities = userAssignedIdentityMap
	} else {
		destination.UserAssignedIdentities = nil
	}

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

	// No error
	return nil
}

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

var _ genruntime.FromARMConverter = &PrivateEndpointConnection_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpointConnection_STATUS populates our PrivateEndpointConnection_STATUS from the provided source PrivateEndpointConnection_STATUS
func (connection *PrivateEndpointConnection_STATUS) AssignProperties_From_PrivateEndpointConnection_STATUS(source *storage.PrivateEndpointConnection_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"1.0","1.1","1.2"}
type RedisCreateProperties_MinimumTlsVersion string

const (
	RedisCreateProperties_MinimumTlsVersion_10 = RedisCreateProperties_MinimumTlsVersion("1.0")
	RedisCreateProperties_MinimumTlsVersion_11 = RedisCreateProperties_MinimumTlsVersion("1.1")
	RedisCreateProperties_MinimumTlsVersion_12 = RedisCreateProperties_MinimumTlsVersion("1.2")
)

// Mapping from string to RedisCreateProperties_MinimumTlsVersion
var redisCreateProperties_MinimumTlsVersion_Values = map[string]RedisCreateProperties_MinimumTlsVersion{
	"1.0": RedisCreateProperties_MinimumTlsVersion_10,
	"1.1": RedisCreateProperties_MinimumTlsVersion_11,
	"1.2": RedisCreateProperties_MinimumTlsVersion_12,
}

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

const (
	RedisCreateProperties_PublicNetworkAccess_Disabled = RedisCreateProperties_PublicNetworkAccess("Disabled")
	RedisCreateProperties_PublicNetworkAccess_Enabled  = RedisCreateProperties_PublicNetworkAccess("Enabled")
)

// Mapping from string to RedisCreateProperties_PublicNetworkAccess
var redisCreateProperties_PublicNetworkAccess_Values = map[string]RedisCreateProperties_PublicNetworkAccess{
	"disabled": RedisCreateProperties_PublicNetworkAccess_Disabled,
	"enabled":  RedisCreateProperties_PublicNetworkAccess_Enabled,
}

type RedisCreateProperties_RedisConfiguration struct {
	// AofBackupEnabled: Specifies whether the aof backup is enabled
	AofBackupEnabled *string `json:"aof-backup-enabled,omitempty"`

	// AofStorageConnectionString0: First storage account connection string
	AofStorageConnectionString0 *string `json:"aof-storage-connection-string-0,omitempty"`

	// AofStorageConnectionString1: Second storage account connection string
	AofStorageConnectionString1 *string `json:"aof-storage-connection-string-1,omitempty"`

	// Authnotrequired: Specifies whether the authentication is disabled. Setting this property is highly discouraged from
	// security point of view.
	Authnotrequired *string `json:"authnotrequired,omitempty"`

	// MaxfragmentationmemoryReserved: Value in megabytes reserved for fragmentation per shard
	MaxfragmentationmemoryReserved *string `json:"maxfragmentationmemory-reserved,omitempty"`

	// MaxmemoryDelta: Value in megabytes reserved for non-cache usage per shard e.g. failover.
	MaxmemoryDelta *string `json:"maxmemory-delta,omitempty"`

	// MaxmemoryPolicy: The eviction strategy used when your data won't fit within its memory limit.
	MaxmemoryPolicy *string `json:"maxmemory-policy,omitempty"`

	// MaxmemoryReserved: Value in megabytes reserved for non-cache usage per shard e.g. failover.
	MaxmemoryReserved *string `json:"maxmemory-reserved,omitempty"`

	// PreferredDataPersistenceAuthMethod: Preferred auth method to communicate to storage account used for data persistence,
	// specify SAS or ManagedIdentity, default value is SAS
	PreferredDataPersistenceAuthMethod *string `json:"preferred-data-persistence-auth-method,omitempty"`

	// RdbBackupEnabled: Specifies whether the rdb backup is enabled
	RdbBackupEnabled *string `json:"rdb-backup-enabled,omitempty"`

	// RdbBackupFrequency: Specifies the frequency for creating rdb backup in minutes. Valid values: (15, 30, 60, 360, 720,
	// 1440)
	RdbBackupFrequency *string `json:"rdb-backup-frequency,omitempty"`

	// RdbBackupMaxSnapshotCount: Specifies the maximum number of snapshots for rdb backup
	RdbBackupMaxSnapshotCount *string `json:"rdb-backup-max-snapshot-count,omitempty"`

	// RdbStorageConnectionString: The storage account connection string for storing rdb file
	RdbStorageConnectionString *string `json:"rdb-storage-connection-string,omitempty"`

	// StorageSubscriptionId: SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity.
	StorageSubscriptionId *string `json:"storage-subscription-id,omitempty"`
}

var _ genruntime.ARMTransformer = &RedisCreateProperties_RedisConfiguration{}

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

	// Set property "AofBackupEnabled":
	if configuration.AofBackupEnabled != nil {
		aofBackupEnabled := *configuration.AofBackupEnabled
		result.AofBackupEnabled = &aofBackupEnabled
	}

	// Set property "AofStorageConnectionString0":
	if configuration.AofStorageConnectionString0 != nil {
		aofStorageConnectionString0 := *configuration.AofStorageConnectionString0
		result.AofStorageConnectionString0 = &aofStorageConnectionString0
	}

	// Set property "AofStorageConnectionString1":
	if configuration.AofStorageConnectionString1 != nil {
		aofStorageConnectionString1 := *configuration.AofStorageConnectionString1
		result.AofStorageConnectionString1 = &aofStorageConnectionString1
	}

	// Set property "Authnotrequired":
	if configuration.Authnotrequired != nil {
		authnotrequired := *configuration.Authnotrequired
		result.Authnotrequired = &authnotrequired
	}

	// Set property "MaxfragmentationmemoryReserved":
	if configuration.MaxfragmentationmemoryReserved != nil {
		maxfragmentationmemoryReserved := *configuration.MaxfragmentationmemoryReserved
		result.MaxfragmentationmemoryReserved = &maxfragmentationmemoryReserved
	}

	// Set property "MaxmemoryDelta":
	if configuration.MaxmemoryDelta != nil {
		maxmemoryDelta := *configuration.MaxmemoryDelta
		result.MaxmemoryDelta = &maxmemoryDelta
	}

	// Set property "MaxmemoryPolicy":
	if configuration.MaxmemoryPolicy != nil {
		maxmemoryPolicy := *configuration.MaxmemoryPolicy
		result.MaxmemoryPolicy = &maxmemoryPolicy
	}

	// Set property "MaxmemoryReserved":
	if configuration.MaxmemoryReserved != nil {
		maxmemoryReserved := *configuration.MaxmemoryReserved
		result.MaxmemoryReserved = &maxmemoryReserved
	}

	// Set property "PreferredDataPersistenceAuthMethod":
	if configuration.PreferredDataPersistenceAuthMethod != nil {
		preferredDataPersistenceAuthMethod := *configuration.PreferredDataPersistenceAuthMethod
		result.PreferredDataPersistenceAuthMethod = &preferredDataPersistenceAuthMethod
	}

	// Set property "RdbBackupEnabled":
	if configuration.RdbBackupEnabled != nil {
		rdbBackupEnabled := *configuration.RdbBackupEnabled
		result.RdbBackupEnabled = &rdbBackupEnabled
	}

	// Set property "RdbBackupFrequency":
	if configuration.RdbBackupFrequency != nil {
		rdbBackupFrequency := *configuration.RdbBackupFrequency
		result.RdbBackupFrequency = &rdbBackupFrequency
	}

	// Set property "RdbBackupMaxSnapshotCount":
	if configuration.RdbBackupMaxSnapshotCount != nil {
		rdbBackupMaxSnapshotCount := *configuration.RdbBackupMaxSnapshotCount
		result.RdbBackupMaxSnapshotCount = &rdbBackupMaxSnapshotCount
	}

	// Set property "RdbStorageConnectionString":
	if configuration.RdbStorageConnectionString != nil {
		rdbStorageConnectionString := *configuration.RdbStorageConnectionString
		result.RdbStorageConnectionString = &rdbStorageConnectionString
	}

	// Set property "StorageSubscriptionId":
	if configuration.StorageSubscriptionId != nil {
		storageSubscriptionId := *configuration.StorageSubscriptionId
		result.StorageSubscriptionId = &storageSubscriptionId
	}
	return result, nil
}

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

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

	// Set property "AofBackupEnabled":
	if typedInput.AofBackupEnabled != nil {
		aofBackupEnabled := *typedInput.AofBackupEnabled
		configuration.AofBackupEnabled = &aofBackupEnabled
	}

	// Set property "AofStorageConnectionString0":
	if typedInput.AofStorageConnectionString0 != nil {
		aofStorageConnectionString0 := *typedInput.AofStorageConnectionString0
		configuration.AofStorageConnectionString0 = &aofStorageConnectionString0
	}

	// Set property "AofStorageConnectionString1":
	if typedInput.AofStorageConnectionString1 != nil {
		aofStorageConnectionString1 := *typedInput.AofStorageConnectionString1
		configuration.AofStorageConnectionString1 = &aofStorageConnectionString1
	}

	// Set property "Authnotrequired":
	if typedInput.Authnotrequired != nil {
		authnotrequired := *typedInput.Authnotrequired
		configuration.Authnotrequired = &authnotrequired
	}

	// Set property "MaxfragmentationmemoryReserved":
	if typedInput.MaxfragmentationmemoryReserved != nil {
		maxfragmentationmemoryReserved := *typedInput.MaxfragmentationmemoryReserved
		configuration.MaxfragmentationmemoryReserved = &maxfragmentationmemoryReserved
	}

	// Set property "MaxmemoryDelta":
	if typedInput.MaxmemoryDelta != nil {
		maxmemoryDelta := *typedInput.MaxmemoryDelta
		configuration.MaxmemoryDelta = &maxmemoryDelta
	}

	// Set property "MaxmemoryPolicy":
	if typedInput.MaxmemoryPolicy != nil {
		maxmemoryPolicy := *typedInput.MaxmemoryPolicy
		configuration.MaxmemoryPolicy = &maxmemoryPolicy
	}

	// Set property "MaxmemoryReserved":
	if typedInput.MaxmemoryReserved != nil {
		maxmemoryReserved := *typedInput.MaxmemoryReserved
		configuration.MaxmemoryReserved = &maxmemoryReserved
	}

	// Set property "PreferredDataPersistenceAuthMethod":
	if typedInput.PreferredDataPersistenceAuthMethod != nil {
		preferredDataPersistenceAuthMethod := *typedInput.PreferredDataPersistenceAuthMethod
		configuration.PreferredDataPersistenceAuthMethod = &preferredDataPersistenceAuthMethod
	}

	// Set property "RdbBackupEnabled":
	if typedInput.RdbBackupEnabled != nil {
		rdbBackupEnabled := *typedInput.RdbBackupEnabled
		configuration.RdbBackupEnabled = &rdbBackupEnabled
	}

	// Set property "RdbBackupFrequency":
	if typedInput.RdbBackupFrequency != nil {
		rdbBackupFrequency := *typedInput.RdbBackupFrequency
		configuration.RdbBackupFrequency = &rdbBackupFrequency
	}

	// Set property "RdbBackupMaxSnapshotCount":
	if typedInput.RdbBackupMaxSnapshotCount != nil {
		rdbBackupMaxSnapshotCount := *typedInput.RdbBackupMaxSnapshotCount
		configuration.RdbBackupMaxSnapshotCount = &rdbBackupMaxSnapshotCount
	}

	// Set property "RdbStorageConnectionString":
	if typedInput.RdbStorageConnectionString != nil {
		rdbStorageConnectionString := *typedInput.RdbStorageConnectionString
		configuration.RdbStorageConnectionString = &rdbStorageConnectionString
	}

	// Set property "StorageSubscriptionId":
	if typedInput.StorageSubscriptionId != nil {
		storageSubscriptionId := *typedInput.StorageSubscriptionId
		configuration.StorageSubscriptionId = &storageSubscriptionId
	}

	// No error
	return nil
}

// AssignProperties_From_RedisCreateProperties_RedisConfiguration populates our RedisCreateProperties_RedisConfiguration from the provided source RedisCreateProperties_RedisConfiguration
func (configuration *RedisCreateProperties_RedisConfiguration) AssignProperties_From_RedisCreateProperties_RedisConfiguration(source *storage.RedisCreateProperties_RedisConfiguration) error {

	// AofBackupEnabled
	configuration.AofBackupEnabled = genruntime.ClonePointerToString(source.AofBackupEnabled)

	// AofStorageConnectionString0
	configuration.AofStorageConnectionString0 = genruntime.ClonePointerToString(source.AofStorageConnectionString0)

	// AofStorageConnectionString1
	configuration.AofStorageConnectionString1 = genruntime.ClonePointerToString(source.AofStorageConnectionString1)

	// Authnotrequired
	configuration.Authnotrequired = genruntime.ClonePointerToString(source.Authnotrequired)

	// MaxfragmentationmemoryReserved
	configuration.MaxfragmentationmemoryReserved = genruntime.ClonePointerToString(source.MaxfragmentationmemoryReserved)

	// MaxmemoryDelta
	configuration.MaxmemoryDelta = genruntime.ClonePointerToString(source.MaxmemoryDelta)

	// MaxmemoryPolicy
	configuration.MaxmemoryPolicy = genruntime.ClonePointerToString(source.MaxmemoryPolicy)

	// MaxmemoryReserved
	configuration.MaxmemoryReserved = genruntime.ClonePointerToString(source.MaxmemoryReserved)

	// PreferredDataPersistenceAuthMethod
	configuration.PreferredDataPersistenceAuthMethod = genruntime.ClonePointerToString(source.PreferredDataPersistenceAuthMethod)

	// RdbBackupEnabled
	configuration.RdbBackupEnabled = genruntime.ClonePointerToString(source.RdbBackupEnabled)

	// RdbBackupFrequency
	configuration.RdbBackupFrequency = genruntime.ClonePointerToString(source.RdbBackupFrequency)

	// RdbBackupMaxSnapshotCount
	configuration.RdbBackupMaxSnapshotCount = genruntime.ClonePointerToString(source.RdbBackupMaxSnapshotCount)

	// RdbStorageConnectionString
	configuration.RdbStorageConnectionString = genruntime.ClonePointerToString(source.RdbStorageConnectionString)

	// StorageSubscriptionId
	configuration.StorageSubscriptionId = genruntime.ClonePointerToString(source.StorageSubscriptionId)

	// No error
	return nil
}

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

	// AofBackupEnabled
	destination.AofBackupEnabled = genruntime.ClonePointerToString(configuration.AofBackupEnabled)

	// AofStorageConnectionString0
	destination.AofStorageConnectionString0 = genruntime.ClonePointerToString(configuration.AofStorageConnectionString0)

	// AofStorageConnectionString1
	destination.AofStorageConnectionString1 = genruntime.ClonePointerToString(configuration.AofStorageConnectionString1)

	// Authnotrequired
	destination.Authnotrequired = genruntime.ClonePointerToString(configuration.Authnotrequired)

	// MaxfragmentationmemoryReserved
	destination.MaxfragmentationmemoryReserved = genruntime.ClonePointerToString(configuration.MaxfragmentationmemoryReserved)

	// MaxmemoryDelta
	destination.MaxmemoryDelta = genruntime.ClonePointerToString(configuration.MaxmemoryDelta)

	// MaxmemoryPolicy
	destination.MaxmemoryPolicy = genruntime.ClonePointerToString(configuration.MaxmemoryPolicy)

	// MaxmemoryReserved
	destination.MaxmemoryReserved = genruntime.ClonePointerToString(configuration.MaxmemoryReserved)

	// PreferredDataPersistenceAuthMethod
	destination.PreferredDataPersistenceAuthMethod = genruntime.ClonePointerToString(configuration.PreferredDataPersistenceAuthMethod)

	// RdbBackupEnabled
	destination.RdbBackupEnabled = genruntime.ClonePointerToString(configuration.RdbBackupEnabled)

	// RdbBackupFrequency
	destination.RdbBackupFrequency = genruntime.ClonePointerToString(configuration.RdbBackupFrequency)

	// RdbBackupMaxSnapshotCount
	destination.RdbBackupMaxSnapshotCount = genruntime.ClonePointerToString(configuration.RdbBackupMaxSnapshotCount)

	// RdbStorageConnectionString
	destination.RdbStorageConnectionString = genruntime.ClonePointerToString(configuration.RdbStorageConnectionString)

	// StorageSubscriptionId
	destination.StorageSubscriptionId = genruntime.ClonePointerToString(configuration.StorageSubscriptionId)

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

	// No error
	return nil
}

// Details of single instance of redis.
type RedisInstanceDetails_STATUS struct {
	// IsMaster: Specifies whether the instance is a primary node.
	IsMaster *bool `json:"isMaster,omitempty"`

	// IsPrimary: Specifies whether the instance is a primary node.
	IsPrimary *bool `json:"isPrimary,omitempty"`

	// NonSslPort: If enableNonSslPort is true, provides Redis instance Non-SSL port.
	NonSslPort *int `json:"nonSslPort,omitempty"`

	// ShardId: If clustering is enabled, the Shard ID of Redis Instance
	ShardId *int `json:"shardId,omitempty"`

	// SslPort: Redis instance SSL port.
	SslPort *int `json:"sslPort,omitempty"`

	// Zone: If the Cache uses availability zones, specifies availability zone where this instance is located.
	Zone *string `json:"zone,omitempty"`
}

var _ genruntime.FromARMConverter = &RedisInstanceDetails_STATUS{}

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

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

	// Set property "IsMaster":
	if typedInput.IsMaster != nil {
		isMaster := *typedInput.IsMaster
		details.IsMaster = &isMaster
	}

	// Set property "IsPrimary":
	if typedInput.IsPrimary != nil {
		isPrimary := *typedInput.IsPrimary
		details.IsPrimary = &isPrimary
	}

	// Set property "NonSslPort":
	if typedInput.NonSslPort != nil {
		nonSslPort := *typedInput.NonSslPort
		details.NonSslPort = &nonSslPort
	}

	// Set property "ShardId":
	if typedInput.ShardId != nil {
		shardId := *typedInput.ShardId
		details.ShardId = &shardId
	}

	// Set property "SslPort":
	if typedInput.SslPort != nil {
		sslPort := *typedInput.SslPort
		details.SslPort = &sslPort
	}

	// Set property "Zone":
	if typedInput.Zone != nil {
		zone := *typedInput.Zone
		details.Zone = &zone
	}

	// No error
	return nil
}

// AssignProperties_From_RedisInstanceDetails_STATUS populates our RedisInstanceDetails_STATUS from the provided source RedisInstanceDetails_STATUS
func (details *RedisInstanceDetails_STATUS) AssignProperties_From_RedisInstanceDetails_STATUS(source *storage.RedisInstanceDetails_STATUS) error {

	// IsMaster
	if source.IsMaster != nil {
		isMaster := *source.IsMaster
		details.IsMaster = &isMaster
	} else {
		details.IsMaster = nil
	}

	// IsPrimary
	if source.IsPrimary != nil {
		isPrimary := *source.IsPrimary
		details.IsPrimary = &isPrimary
	} else {
		details.IsPrimary = nil
	}

	// NonSslPort
	details.NonSslPort = genruntime.ClonePointerToInt(source.NonSslPort)

	// ShardId
	details.ShardId = genruntime.ClonePointerToInt(source.ShardId)

	// SslPort
	details.SslPort = genruntime.ClonePointerToInt(source.SslPort)

	// Zone
	details.Zone = genruntime.ClonePointerToString(source.Zone)

	// No error
	return nil
}

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

	// IsMaster
	if details.IsMaster != nil {
		isMaster := *details.IsMaster
		destination.IsMaster = &isMaster
	} else {
		destination.IsMaster = nil
	}

	// IsPrimary
	if details.IsPrimary != nil {
		isPrimary := *details.IsPrimary
		destination.IsPrimary = &isPrimary
	} else {
		destination.IsPrimary = nil
	}

	// NonSslPort
	destination.NonSslPort = genruntime.ClonePointerToInt(details.NonSslPort)

	// ShardId
	destination.ShardId = genruntime.ClonePointerToInt(details.ShardId)

	// SslPort
	destination.SslPort = genruntime.ClonePointerToInt(details.SslPort)

	// Zone
	destination.Zone = genruntime.ClonePointerToString(details.Zone)

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

	// No error
	return nil
}

// Linked server Id
type RedisLinkedServer_STATUS struct {
	// Id: Linked server Id.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &RedisLinkedServer_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_RedisLinkedServer_STATUS populates our RedisLinkedServer_STATUS from the provided source RedisLinkedServer_STATUS
func (server *RedisLinkedServer_STATUS) AssignProperties_From_RedisLinkedServer_STATUS(source *storage.RedisLinkedServer_STATUS) error {

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

	// No error
	return nil
}

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

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

	// 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 RedisOperatorSpec 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"`

	// Secrets: configures where to place Azure generated secrets.
	Secrets *RedisOperatorSecrets `json:"secrets,omitempty"`
}

// AssignProperties_From_RedisOperatorSpec populates our RedisOperatorSpec from the provided source RedisOperatorSpec
func (operator *RedisOperatorSpec) AssignProperties_From_RedisOperatorSpec(source *storage.RedisOperatorSpec) 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
	}

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

	// No error
	return nil
}

// AssignProperties_To_RedisOperatorSpec populates the provided destination RedisOperatorSpec from our RedisOperatorSpec
func (operator *RedisOperatorSpec) AssignProperties_To_RedisOperatorSpec(destination *storage.RedisOperatorSpec) 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
	}

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

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

	// No error
	return nil
}

type RedisProperties_MinimumTlsVersion_STATUS string

const (
	RedisProperties_MinimumTlsVersion_STATUS_10 = RedisProperties_MinimumTlsVersion_STATUS("1.0")
	RedisProperties_MinimumTlsVersion_STATUS_11 = RedisProperties_MinimumTlsVersion_STATUS("1.1")
	RedisProperties_MinimumTlsVersion_STATUS_12 = RedisProperties_MinimumTlsVersion_STATUS("1.2")
)

// Mapping from string to RedisProperties_MinimumTlsVersion_STATUS
var redisProperties_MinimumTlsVersion_STATUS_Values = map[string]RedisProperties_MinimumTlsVersion_STATUS{
	"1.0": RedisProperties_MinimumTlsVersion_STATUS_10,
	"1.1": RedisProperties_MinimumTlsVersion_STATUS_11,
	"1.2": RedisProperties_MinimumTlsVersion_STATUS_12,
}

type RedisProperties_ProvisioningState_STATUS string

const (
	RedisProperties_ProvisioningState_STATUS_Creating               = RedisProperties_ProvisioningState_STATUS("Creating")
	RedisProperties_ProvisioningState_STATUS_Deleting               = RedisProperties_ProvisioningState_STATUS("Deleting")
	RedisProperties_ProvisioningState_STATUS_Disabled               = RedisProperties_ProvisioningState_STATUS("Disabled")
	RedisProperties_ProvisioningState_STATUS_Failed                 = RedisProperties_ProvisioningState_STATUS("Failed")
	RedisProperties_ProvisioningState_STATUS_Linking                = RedisProperties_ProvisioningState_STATUS("Linking")
	RedisProperties_ProvisioningState_STATUS_Provisioning           = RedisProperties_ProvisioningState_STATUS("Provisioning")
	RedisProperties_ProvisioningState_STATUS_RecoveringScaleFailure = RedisProperties_ProvisioningState_STATUS("RecoveringScaleFailure")
	RedisProperties_ProvisioningState_STATUS_Scaling                = RedisProperties_ProvisioningState_STATUS("Scaling")
	RedisProperties_ProvisioningState_STATUS_Succeeded              = RedisProperties_ProvisioningState_STATUS("Succeeded")
	RedisProperties_ProvisioningState_STATUS_Unlinking              = RedisProperties_ProvisioningState_STATUS("Unlinking")
	RedisProperties_ProvisioningState_STATUS_Unprovisioning         = RedisProperties_ProvisioningState_STATUS("Unprovisioning")
	RedisProperties_ProvisioningState_STATUS_Updating               = RedisProperties_ProvisioningState_STATUS("Updating")
)

// Mapping from string to RedisProperties_ProvisioningState_STATUS
var redisProperties_ProvisioningState_STATUS_Values = map[string]RedisProperties_ProvisioningState_STATUS{
	"creating":               RedisProperties_ProvisioningState_STATUS_Creating,
	"deleting":               RedisProperties_ProvisioningState_STATUS_Deleting,
	"disabled":               RedisProperties_ProvisioningState_STATUS_Disabled,
	"failed":                 RedisProperties_ProvisioningState_STATUS_Failed,
	"linking":                RedisProperties_ProvisioningState_STATUS_Linking,
	"provisioning":           RedisProperties_ProvisioningState_STATUS_Provisioning,
	"recoveringscalefailure": RedisProperties_ProvisioningState_STATUS_RecoveringScaleFailure,
	"scaling":                RedisProperties_ProvisioningState_STATUS_Scaling,
	"succeeded":              RedisProperties_ProvisioningState_STATUS_Succeeded,
	"unlinking":              RedisProperties_ProvisioningState_STATUS_Unlinking,
	"unprovisioning":         RedisProperties_ProvisioningState_STATUS_Unprovisioning,
	"updating":               RedisProperties_ProvisioningState_STATUS_Updating,
}

type RedisProperties_PublicNetworkAccess_STATUS string

const (
	RedisProperties_PublicNetworkAccess_STATUS_Disabled = RedisProperties_PublicNetworkAccess_STATUS("Disabled")
	RedisProperties_PublicNetworkAccess_STATUS_Enabled  = RedisProperties_PublicNetworkAccess_STATUS("Enabled")
)

// Mapping from string to RedisProperties_PublicNetworkAccess_STATUS
var redisProperties_PublicNetworkAccess_STATUS_Values = map[string]RedisProperties_PublicNetworkAccess_STATUS{
	"disabled": RedisProperties_PublicNetworkAccess_STATUS_Disabled,
	"enabled":  RedisProperties_PublicNetworkAccess_STATUS_Enabled,
}

type RedisProperties_RedisConfiguration_STATUS struct {
	// AofBackupEnabled: Specifies whether the aof backup is enabled
	AofBackupEnabled *string `json:"aof-backup-enabled,omitempty"`

	// AofStorageConnectionString0: First storage account connection string
	AofStorageConnectionString0 *string `json:"aof-storage-connection-string-0,omitempty"`

	// AofStorageConnectionString1: Second storage account connection string
	AofStorageConnectionString1 *string `json:"aof-storage-connection-string-1,omitempty"`

	// Authnotrequired: Specifies whether the authentication is disabled. Setting this property is highly discouraged from
	// security point of view.
	Authnotrequired *string `json:"authnotrequired,omitempty"`

	// Maxclients: The max clients config
	Maxclients *string `json:"maxclients,omitempty"`

	// MaxfragmentationmemoryReserved: Value in megabytes reserved for fragmentation per shard
	MaxfragmentationmemoryReserved *string `json:"maxfragmentationmemory-reserved,omitempty"`

	// MaxmemoryDelta: Value in megabytes reserved for non-cache usage per shard e.g. failover.
	MaxmemoryDelta *string `json:"maxmemory-delta,omitempty"`

	// MaxmemoryPolicy: The eviction strategy used when your data won't fit within its memory limit.
	MaxmemoryPolicy *string `json:"maxmemory-policy,omitempty"`

	// MaxmemoryReserved: Value in megabytes reserved for non-cache usage per shard e.g. failover.
	MaxmemoryReserved *string `json:"maxmemory-reserved,omitempty"`

	// PreferredDataArchiveAuthMethod: Preferred auth method to communicate to storage account used for data archive, specify
	// SAS or ManagedIdentity, default value is SAS
	PreferredDataArchiveAuthMethod *string `json:"preferred-data-archive-auth-method,omitempty"`

	// PreferredDataPersistenceAuthMethod: Preferred auth method to communicate to storage account used for data persistence,
	// specify SAS or ManagedIdentity, default value is SAS
	PreferredDataPersistenceAuthMethod *string `json:"preferred-data-persistence-auth-method,omitempty"`

	// RdbBackupEnabled: Specifies whether the rdb backup is enabled
	RdbBackupEnabled *string `json:"rdb-backup-enabled,omitempty"`

	// RdbBackupFrequency: Specifies the frequency for creating rdb backup in minutes. Valid values: (15, 30, 60, 360, 720,
	// 1440)
	RdbBackupFrequency *string `json:"rdb-backup-frequency,omitempty"`

	// RdbBackupMaxSnapshotCount: Specifies the maximum number of snapshots for rdb backup
	RdbBackupMaxSnapshotCount *string `json:"rdb-backup-max-snapshot-count,omitempty"`

	// RdbStorageConnectionString: The storage account connection string for storing rdb file
	RdbStorageConnectionString *string `json:"rdb-storage-connection-string,omitempty"`

	// StorageSubscriptionId: SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity.
	StorageSubscriptionId *string `json:"storage-subscription-id,omitempty"`

	// ZonalConfiguration: Zonal Configuration
	ZonalConfiguration *string `json:"zonal-configuration,omitempty"`
}

var _ genruntime.FromARMConverter = &RedisProperties_RedisConfiguration_STATUS{}

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

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

	// Set property "AofBackupEnabled":
	if typedInput.AofBackupEnabled != nil {
		aofBackupEnabled := *typedInput.AofBackupEnabled
		configuration.AofBackupEnabled = &aofBackupEnabled
	}

	// Set property "AofStorageConnectionString0":
	if typedInput.AofStorageConnectionString0 != nil {
		aofStorageConnectionString0 := *typedInput.AofStorageConnectionString0
		configuration.AofStorageConnectionString0 = &aofStorageConnectionString0
	}

	// Set property "AofStorageConnectionString1":
	if typedInput.AofStorageConnectionString1 != nil {
		aofStorageConnectionString1 := *typedInput.AofStorageConnectionString1
		configuration.AofStorageConnectionString1 = &aofStorageConnectionString1
	}

	// Set property "Authnotrequired":
	if typedInput.Authnotrequired != nil {
		authnotrequired := *typedInput.Authnotrequired
		configuration.Authnotrequired = &authnotrequired
	}

	// Set property "Maxclients":
	if typedInput.Maxclients != nil {
		maxclients := *typedInput.Maxclients
		configuration.Maxclients = &maxclients
	}

	// Set property "MaxfragmentationmemoryReserved":
	if typedInput.MaxfragmentationmemoryReserved != nil {
		maxfragmentationmemoryReserved := *typedInput.MaxfragmentationmemoryReserved
		configuration.MaxfragmentationmemoryReserved = &maxfragmentationmemoryReserved
	}

	// Set property "MaxmemoryDelta":
	if typedInput.MaxmemoryDelta != nil {
		maxmemoryDelta := *typedInput.MaxmemoryDelta
		configuration.MaxmemoryDelta = &maxmemoryDelta
	}

	// Set property "MaxmemoryPolicy":
	if typedInput.MaxmemoryPolicy != nil {
		maxmemoryPolicy := *typedInput.MaxmemoryPolicy
		configuration.MaxmemoryPolicy = &maxmemoryPolicy
	}

	// Set property "MaxmemoryReserved":
	if typedInput.MaxmemoryReserved != nil {
		maxmemoryReserved := *typedInput.MaxmemoryReserved
		configuration.MaxmemoryReserved = &maxmemoryReserved
	}

	// Set property "PreferredDataArchiveAuthMethod":
	if typedInput.PreferredDataArchiveAuthMethod != nil {
		preferredDataArchiveAuthMethod := *typedInput.PreferredDataArchiveAuthMethod
		configuration.PreferredDataArchiveAuthMethod = &preferredDataArchiveAuthMethod
	}

	// Set property "PreferredDataPersistenceAuthMethod":
	if typedInput.PreferredDataPersistenceAuthMethod != nil {
		preferredDataPersistenceAuthMethod := *typedInput.PreferredDataPersistenceAuthMethod
		configuration.PreferredDataPersistenceAuthMethod = &preferredDataPersistenceAuthMethod
	}

	// Set property "RdbBackupEnabled":
	if typedInput.RdbBackupEnabled != nil {
		rdbBackupEnabled := *typedInput.RdbBackupEnabled
		configuration.RdbBackupEnabled = &rdbBackupEnabled
	}

	// Set property "RdbBackupFrequency":
	if typedInput.RdbBackupFrequency != nil {
		rdbBackupFrequency := *typedInput.RdbBackupFrequency
		configuration.RdbBackupFrequency = &rdbBackupFrequency
	}

	// Set property "RdbBackupMaxSnapshotCount":
	if typedInput.RdbBackupMaxSnapshotCount != nil {
		rdbBackupMaxSnapshotCount := *typedInput.RdbBackupMaxSnapshotCount
		configuration.RdbBackupMaxSnapshotCount = &rdbBackupMaxSnapshotCount
	}

	// Set property "RdbStorageConnectionString":
	if typedInput.RdbStorageConnectionString != nil {
		rdbStorageConnectionString := *typedInput.RdbStorageConnectionString
		configuration.RdbStorageConnectionString = &rdbStorageConnectionString
	}

	// Set property "StorageSubscriptionId":
	if typedInput.StorageSubscriptionId != nil {
		storageSubscriptionId := *typedInput.StorageSubscriptionId
		configuration.StorageSubscriptionId = &storageSubscriptionId
	}

	// Set property "ZonalConfiguration":
	if typedInput.ZonalConfiguration != nil {
		zonalConfiguration := *typedInput.ZonalConfiguration
		configuration.ZonalConfiguration = &zonalConfiguration
	}

	// No error
	return nil
}

// AssignProperties_From_RedisProperties_RedisConfiguration_STATUS populates our RedisProperties_RedisConfiguration_STATUS from the provided source RedisProperties_RedisConfiguration_STATUS
func (configuration *RedisProperties_RedisConfiguration_STATUS) AssignProperties_From_RedisProperties_RedisConfiguration_STATUS(source *storage.RedisProperties_RedisConfiguration_STATUS) error {

	// AofBackupEnabled
	configuration.AofBackupEnabled = genruntime.ClonePointerToString(source.AofBackupEnabled)

	// AofStorageConnectionString0
	configuration.AofStorageConnectionString0 = genruntime.ClonePointerToString(source.AofStorageConnectionString0)

	// AofStorageConnectionString1
	configuration.AofStorageConnectionString1 = genruntime.ClonePointerToString(source.AofStorageConnectionString1)

	// Authnotrequired
	configuration.Authnotrequired = genruntime.ClonePointerToString(source.Authnotrequired)

	// Maxclients
	configuration.Maxclients = genruntime.ClonePointerToString(source.Maxclients)

	// MaxfragmentationmemoryReserved
	configuration.MaxfragmentationmemoryReserved = genruntime.ClonePointerToString(source.MaxfragmentationmemoryReserved)

	// MaxmemoryDelta
	configuration.MaxmemoryDelta = genruntime.ClonePointerToString(source.MaxmemoryDelta)

	// MaxmemoryPolicy
	configuration.MaxmemoryPolicy = genruntime.ClonePointerToString(source.MaxmemoryPolicy)

	// MaxmemoryReserved
	configuration.MaxmemoryReserved = genruntime.ClonePointerToString(source.MaxmemoryReserved)

	// PreferredDataArchiveAuthMethod
	configuration.PreferredDataArchiveAuthMethod = genruntime.ClonePointerToString(source.PreferredDataArchiveAuthMethod)

	// PreferredDataPersistenceAuthMethod
	configuration.PreferredDataPersistenceAuthMethod = genruntime.ClonePointerToString(source.PreferredDataPersistenceAuthMethod)

	// RdbBackupEnabled
	configuration.RdbBackupEnabled = genruntime.ClonePointerToString(source.RdbBackupEnabled)

	// RdbBackupFrequency
	configuration.RdbBackupFrequency = genruntime.ClonePointerToString(source.RdbBackupFrequency)

	// RdbBackupMaxSnapshotCount
	configuration.RdbBackupMaxSnapshotCount = genruntime.ClonePointerToString(source.RdbBackupMaxSnapshotCount)

	// RdbStorageConnectionString
	configuration.RdbStorageConnectionString = genruntime.ClonePointerToString(source.RdbStorageConnectionString)

	// StorageSubscriptionId
	configuration.StorageSubscriptionId = genruntime.ClonePointerToString(source.StorageSubscriptionId)

	// ZonalConfiguration
	configuration.ZonalConfiguration = genruntime.ClonePointerToString(source.ZonalConfiguration)

	// No error
	return nil
}

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

	// AofBackupEnabled
	destination.AofBackupEnabled = genruntime.ClonePointerToString(configuration.AofBackupEnabled)

	// AofStorageConnectionString0
	destination.AofStorageConnectionString0 = genruntime.ClonePointerToString(configuration.AofStorageConnectionString0)

	// AofStorageConnectionString1
	destination.AofStorageConnectionString1 = genruntime.ClonePointerToString(configuration.AofStorageConnectionString1)

	// Authnotrequired
	destination.Authnotrequired = genruntime.ClonePointerToString(configuration.Authnotrequired)

	// Maxclients
	destination.Maxclients = genruntime.ClonePointerToString(configuration.Maxclients)

	// MaxfragmentationmemoryReserved
	destination.MaxfragmentationmemoryReserved = genruntime.ClonePointerToString(configuration.MaxfragmentationmemoryReserved)

	// MaxmemoryDelta
	destination.MaxmemoryDelta = genruntime.ClonePointerToString(configuration.MaxmemoryDelta)

	// MaxmemoryPolicy
	destination.MaxmemoryPolicy = genruntime.ClonePointerToString(configuration.MaxmemoryPolicy)

	// MaxmemoryReserved
	destination.MaxmemoryReserved = genruntime.ClonePointerToString(configuration.MaxmemoryReserved)

	// PreferredDataArchiveAuthMethod
	destination.PreferredDataArchiveAuthMethod = genruntime.ClonePointerToString(configuration.PreferredDataArchiveAuthMethod)

	// PreferredDataPersistenceAuthMethod
	destination.PreferredDataPersistenceAuthMethod = genruntime.ClonePointerToString(configuration.PreferredDataPersistenceAuthMethod)

	// RdbBackupEnabled
	destination.RdbBackupEnabled = genruntime.ClonePointerToString(configuration.RdbBackupEnabled)

	// RdbBackupFrequency
	destination.RdbBackupFrequency = genruntime.ClonePointerToString(configuration.RdbBackupFrequency)

	// RdbBackupMaxSnapshotCount
	destination.RdbBackupMaxSnapshotCount = genruntime.ClonePointerToString(configuration.RdbBackupMaxSnapshotCount)

	// RdbStorageConnectionString
	destination.RdbStorageConnectionString = genruntime.ClonePointerToString(configuration.RdbStorageConnectionString)

	// StorageSubscriptionId
	destination.StorageSubscriptionId = genruntime.ClonePointerToString(configuration.StorageSubscriptionId)

	// ZonalConfiguration
	destination.ZonalConfiguration = genruntime.ClonePointerToString(configuration.ZonalConfiguration)

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

	// No error
	return nil
}

// SKU parameters supplied to the create Redis operation.
type Sku struct {
	// +kubebuilder:validation:Required
	// Capacity: The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for
	// P (Premium) family (1, 2, 3, 4).
	Capacity *int `json:"capacity,omitempty"`

	// +kubebuilder:validation:Required
	// Family: The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = Premium).
	Family *Sku_Family `json:"family,omitempty"`

	// +kubebuilder:validation:Required
	// Name: The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium)
	Name *Sku_Name `json:"name,omitempty"`
}

var _ genruntime.ARMTransformer = &Sku{}

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

	// Set property "Capacity":
	if sku.Capacity != nil {
		capacity := *sku.Capacity
		result.Capacity = &capacity
	}

	// Set property "Family":
	if sku.Family != nil {
		var temp string
		temp = string(*sku.Family)
		family := arm.Sku_Family(temp)
		result.Family = &family
	}

	// Set property "Name":
	if sku.Name != nil {
		var temp string
		temp = string(*sku.Name)
		name := arm.Sku_Name(temp)
		result.Name = &name
	}
	return result, nil
}

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

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

	// Set property "Capacity":
	if typedInput.Capacity != nil {
		capacity := *typedInput.Capacity
		sku.Capacity = &capacity
	}

	// Set property "Family":
	if typedInput.Family != nil {
		var temp string
		temp = string(*typedInput.Family)
		family := Sku_Family(temp)
		sku.Family = &family
	}

	// Set property "Name":
	if typedInput.Name != nil {
		var temp string
		temp = string(*typedInput.Name)
		name := Sku_Name(temp)
		sku.Name = &name
	}

	// No error
	return nil
}

// AssignProperties_From_Sku populates our Sku from the provided source Sku
func (sku *Sku) AssignProperties_From_Sku(source *storage.Sku) error {

	// Capacity
	sku.Capacity = genruntime.ClonePointerToInt(source.Capacity)

	// Family
	if source.Family != nil {
		family := *source.Family
		familyTemp := genruntime.ToEnum(family, sku_Family_Values)
		sku.Family = &familyTemp
	} else {
		sku.Family = nil
	}

	// Name
	if source.Name != nil {
		name := *source.Name
		nameTemp := genruntime.ToEnum(name, sku_Name_Values)
		sku.Name = &nameTemp
	} else {
		sku.Name = nil
	}

	// No error
	return nil
}

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

	// Capacity
	destination.Capacity = genruntime.ClonePointerToInt(sku.Capacity)

	// Family
	if sku.Family != nil {
		family := string(*sku.Family)
		destination.Family = &family
	} else {
		destination.Family = nil
	}

	// Name
	if sku.Name != nil {
		name := string(*sku.Name)
		destination.Name = &name
	} else {
		destination.Name = nil
	}

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

	// No error
	return nil
}

// SKU parameters supplied to the create Redis operation.
type Sku_STATUS struct {
	// Capacity: The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for
	// P (Premium) family (1, 2, 3, 4).
	Capacity *int `json:"capacity,omitempty"`

	// Family: The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = Premium).
	Family *Sku_Family_STATUS `json:"family,omitempty"`

	// Name: The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium)
	Name *Sku_Name_STATUS `json:"name,omitempty"`
}

var _ genruntime.FromARMConverter = &Sku_STATUS{}

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

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

	// Set property "Capacity":
	if typedInput.Capacity != nil {
		capacity := *typedInput.Capacity
		sku.Capacity = &capacity
	}

	// Set property "Family":
	if typedInput.Family != nil {
		var temp string
		temp = string(*typedInput.Family)
		family := Sku_Family_STATUS(temp)
		sku.Family = &family
	}

	// Set property "Name":
	if typedInput.Name != nil {
		var temp string
		temp = string(*typedInput.Name)
		name := Sku_Name_STATUS(temp)
		sku.Name = &name
	}

	// No error
	return nil
}

// AssignProperties_From_Sku_STATUS populates our Sku_STATUS from the provided source Sku_STATUS
func (sku *Sku_STATUS) AssignProperties_From_Sku_STATUS(source *storage.Sku_STATUS) error {

	// Capacity
	sku.Capacity = genruntime.ClonePointerToInt(source.Capacity)

	// Family
	if source.Family != nil {
		family := *source.Family
		familyTemp := genruntime.ToEnum(family, sku_Family_STATUS_Values)
		sku.Family = &familyTemp
	} else {
		sku.Family = nil
	}

	// Name
	if source.Name != nil {
		name := *source.Name
		nameTemp := genruntime.ToEnum(name, sku_Name_STATUS_Values)
		sku.Name = &nameTemp
	} else {
		sku.Name = nil
	}

	// No error
	return nil
}

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

	// Capacity
	destination.Capacity = genruntime.ClonePointerToInt(sku.Capacity)

	// Family
	if sku.Family != nil {
		family := string(*sku.Family)
		destination.Family = &family
	} else {
		destination.Family = nil
	}

	// Name
	if sku.Name != nil {
		name := string(*sku.Name)
		destination.Name = &name
	} else {
		destination.Name = nil
	}

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

	// No error
	return nil
}

// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
// +kubebuilder:validation:Enum={"None","SystemAssigned","SystemAssigned, UserAssigned","UserAssigned"}
type ManagedServiceIdentityType string

const (
	ManagedServiceIdentityType_None                       = ManagedServiceIdentityType("None")
	ManagedServiceIdentityType_SystemAssigned             = ManagedServiceIdentityType("SystemAssigned")
	ManagedServiceIdentityType_SystemAssignedUserAssigned = ManagedServiceIdentityType("SystemAssigned, UserAssigned")
	ManagedServiceIdentityType_UserAssigned               = ManagedServiceIdentityType("UserAssigned")
)

// Mapping from string to ManagedServiceIdentityType
var managedServiceIdentityType_Values = map[string]ManagedServiceIdentityType{
	"none":                         ManagedServiceIdentityType_None,
	"systemassigned":               ManagedServiceIdentityType_SystemAssigned,
	"systemassigned, userassigned": ManagedServiceIdentityType_SystemAssignedUserAssigned,
	"userassigned":                 ManagedServiceIdentityType_UserAssigned,
}

// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
type ManagedServiceIdentityType_STATUS string

const (
	ManagedServiceIdentityType_STATUS_None                       = ManagedServiceIdentityType_STATUS("None")
	ManagedServiceIdentityType_STATUS_SystemAssigned             = ManagedServiceIdentityType_STATUS("SystemAssigned")
	ManagedServiceIdentityType_STATUS_SystemAssignedUserAssigned = ManagedServiceIdentityType_STATUS("SystemAssigned, UserAssigned")
	ManagedServiceIdentityType_STATUS_UserAssigned               = ManagedServiceIdentityType_STATUS("UserAssigned")
)

// Mapping from string to ManagedServiceIdentityType_STATUS
var managedServiceIdentityType_STATUS_Values = map[string]ManagedServiceIdentityType_STATUS{
	"none":                         ManagedServiceIdentityType_STATUS_None,
	"systemassigned":               ManagedServiceIdentityType_STATUS_SystemAssigned,
	"systemassigned, userassigned": ManagedServiceIdentityType_STATUS_SystemAssignedUserAssigned,
	"userassigned":                 ManagedServiceIdentityType_STATUS_UserAssigned,
}

type RedisOperatorSecrets struct {
	// HostName: indicates where the HostName secret should be placed. If omitted, the secret will not be retrieved from Azure.
	HostName *genruntime.SecretDestination `json:"hostName,omitempty"`

	// Port: indicates where the Port secret should be placed. If omitted, the secret will not be retrieved from Azure.
	Port *genruntime.SecretDestination `json:"port,omitempty"`

	// PrimaryKey: indicates where the PrimaryKey secret should be placed. If omitted, the secret will not be retrieved from
	// Azure.
	PrimaryKey *genruntime.SecretDestination `json:"primaryKey,omitempty"`

	// SSLPort: indicates where the SSLPort secret should be placed. If omitted, the secret will not be retrieved from Azure.
	SSLPort *genruntime.SecretDestination `json:"sslPort,omitempty"`

	// SecondaryKey: indicates where the SecondaryKey secret should be placed. If omitted, the secret will not be retrieved
	// from Azure.
	SecondaryKey *genruntime.SecretDestination `json:"secondaryKey,omitempty"`
}

// AssignProperties_From_RedisOperatorSecrets populates our RedisOperatorSecrets from the provided source RedisOperatorSecrets
func (secrets *RedisOperatorSecrets) AssignProperties_From_RedisOperatorSecrets(source *storage.RedisOperatorSecrets) error {

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"C","P"}
type Sku_Family string

const (
	Sku_Family_C = Sku_Family("C")
	Sku_Family_P = Sku_Family("P")
)

// Mapping from string to Sku_Family
var sku_Family_Values = map[string]Sku_Family{
	"c": Sku_Family_C,
	"p": Sku_Family_P,
}

type Sku_Family_STATUS string

const (
	Sku_Family_STATUS_C = Sku_Family_STATUS("C")
	Sku_Family_STATUS_P = Sku_Family_STATUS("P")
)

// Mapping from string to Sku_Family_STATUS
var sku_Family_STATUS_Values = map[string]Sku_Family_STATUS{
	"c": Sku_Family_STATUS_C,
	"p": Sku_Family_STATUS_P,
}

// +kubebuilder:validation:Enum={"Basic","Premium","Standard"}
type Sku_Name string

const (
	Sku_Name_Basic    = Sku_Name("Basic")
	Sku_Name_Premium  = Sku_Name("Premium")
	Sku_Name_Standard = Sku_Name("Standard")
)

// Mapping from string to Sku_Name
var sku_Name_Values = map[string]Sku_Name{
	"basic":    Sku_Name_Basic,
	"premium":  Sku_Name_Premium,
	"standard": Sku_Name_Standard,
}

type Sku_Name_STATUS string

const (
	Sku_Name_STATUS_Basic    = Sku_Name_STATUS("Basic")
	Sku_Name_STATUS_Premium  = Sku_Name_STATUS("Premium")
	Sku_Name_STATUS_Standard = Sku_Name_STATUS("Standard")
)

// Mapping from string to Sku_Name_STATUS
var sku_Name_STATUS_Values = map[string]Sku_Name_STATUS{
	"basic":    Sku_Name_STATUS_Basic,
	"premium":  Sku_Name_STATUS_Premium,
	"standard": Sku_Name_STATUS_Standard,
}

// User assigned identity properties
type UserAssignedIdentity_STATUS struct {
	// ClientId: The client ID of the assigned identity.
	ClientId *string `json:"clientId,omitempty"`

	// PrincipalId: The principal ID of the assigned identity.
	PrincipalId *string `json:"principalId,omitempty"`
}

var _ genruntime.FromARMConverter = &UserAssignedIdentity_STATUS{}

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

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

	// Set property "ClientId":
	if typedInput.ClientId != nil {
		clientId := *typedInput.ClientId
		identity.ClientId = &clientId
	}

	// Set property "PrincipalId":
	if typedInput.PrincipalId != nil {
		principalId := *typedInput.PrincipalId
		identity.PrincipalId = &principalId
	}

	// No error
	return nil
}

// AssignProperties_From_UserAssignedIdentity_STATUS populates our UserAssignedIdentity_STATUS from the provided source UserAssignedIdentity_STATUS
func (identity *UserAssignedIdentity_STATUS) AssignProperties_From_UserAssignedIdentity_STATUS(source *storage.UserAssignedIdentity_STATUS) error {

	// ClientId
	identity.ClientId = genruntime.ClonePointerToString(source.ClientId)

	// PrincipalId
	identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId)

	// No error
	return nil
}

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

	// ClientId
	destination.ClientId = genruntime.ClonePointerToString(identity.ClientId)

	// PrincipalId
	destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId)

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

	// No error
	return nil
}

// Information about the user assigned identity for the resource
type UserAssignedIdentityDetails struct {
	Reference genruntime.ResourceReference `armReference:"Reference" json:"reference,omitempty"`
}

// AssignProperties_From_UserAssignedIdentityDetails populates our UserAssignedIdentityDetails from the provided source UserAssignedIdentityDetails
func (details *UserAssignedIdentityDetails) AssignProperties_From_UserAssignedIdentityDetails(source *storage.UserAssignedIdentityDetails) error {

	// Reference
	details.Reference = source.Reference.Copy()

	// No error
	return nil
}

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

	// Reference
	destination.Reference = details.Reference.Copy()

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&Redis{}, &RedisList{})
}
