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

import (
	v20210301s "github.com/Azure/azure-service-operator/v2/api/cache/v1api20210301/storage"
	v20230401s "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"
// Storage version of v1api20201201.Redis
// Generator information:
// - Generated from: /redis/resource-manager/Microsoft.Cache/Redis/stable/2020-12-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 v20230401s.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 v20230401s.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 "2020-12-01"
func (redis Redis) GetAPIVersion() string {
	return "2020-12-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 *v20230401s.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

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

	// No error
	return nil
}

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

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

	// Spec
	var spec v20230401s.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 v20230401s.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

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

	// No error
	return nil
}

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

// +kubebuilder:object:root=true
// Storage version of v1api20201201.Redis
// Generator information:
// - Generated from: /redis/resource-manager/Microsoft.Cache/Redis/stable/2020-12-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"`
}

// Storage version of v1api20201201.APIVersion
// +kubebuilder:validation:Enum={"2020-12-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2020-12-01")

type augmentConversionForRedis interface {
	AssignPropertiesFrom(src *v20230401s.Redis) error
	AssignPropertiesTo(dst *v20230401s.Redis) error
}

// Storage version of v1api20201201.Redis_Spec
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  *bool              `json:"enableNonSslPort,omitempty"`
	Location          *string            `json:"location,omitempty"`
	MinimumTlsVersion *string            `json:"minimumTlsVersion,omitempty"`
	OperatorSpec      *RedisOperatorSpec `json:"operatorSpec,omitempty"`
	OriginalVersion   string             `json:"originalVersion,omitempty"`

	// +kubebuilder:validation:Required
	// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
	// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
	// reference to a resources.azure.com/ResourceGroup resource
	Owner               *genruntime.KnownResourceReference        `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"`
	PropertyBag         genruntime.PropertyBag                    `json:"$propertyBag,omitempty"`
	PublicNetworkAccess *string                                   `json:"publicNetworkAccess,omitempty"`
	RedisConfiguration  *RedisCreateProperties_RedisConfiguration `json:"redisConfiguration,omitempty"`
	RedisVersion        *string                                   `json:"redisVersion,omitempty"`
	ReplicasPerMaster   *int                                      `json:"replicasPerMaster,omitempty"`
	ReplicasPerPrimary  *int                                      `json:"replicasPerPrimary,omitempty"`
	ShardCount          *int                                      `json:"shardCount,omitempty"`
	Sku                 *Sku                                      `json:"sku,omitempty"`
	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            map[string]string             `json:"tags,omitempty"`
	TenantSettings  map[string]string             `json:"tenantSettings,omitempty"`
	Zones           []string                      `json:"zones,omitempty"`
}

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.(*v20230401s.Redis_Spec)
	if ok {
		// Populate our instance from source
		return redis.AssignProperties_From_Redis_Spec(src)
	}

	// Convert to an intermediate form
	src = &v20230401s.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.(*v20230401s.Redis_Spec)
	if ok {
		// Populate destination from our instance
		return redis.AssignProperties_To_Redis_Spec(dst)
	}

	// Convert to an intermediate form
	dst = &v20230401s.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 *v20230401s.Redis_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// 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 {
		propertyBag.Add("Identity", *source.Identity)
	} else {
		propertyBag.Remove("Identity")
	}

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

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

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

	// OriginalVersion
	redis.OriginalVersion = source.OriginalVersion

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

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

	// 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 skuStash v20210301s.Sku
		err := skuStash.AssignProperties_From_Sku(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Sku() to populate field SkuStash from Sku")
		}
		var sku Sku
		err = sku.AssignProperties_From_Sku(&skuStash)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Sku() to populate field Sku from SkuStash")
		}
		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)

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

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

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

	// AzureName
	destination.AzureName = redis.AzureName

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

	// Identity
	if propertyBag.Contains("Identity") {
		var identity v20230401s.ManagedServiceIdentity
		err := propertyBag.Pull("Identity", &identity)
		if err != nil {
			return eris.Wrap(err, "pulling 'Identity' from propertyBag")
		}

		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

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

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

	// OperatorSpec
	if redis.OperatorSpec != nil {
		var operatorSpec v20230401s.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
	destination.PublicNetworkAccess = genruntime.ClonePointerToString(redis.PublicNetworkAccess)

	// RedisConfiguration
	if redis.RedisConfiguration != nil {
		var redisConfiguration v20230401s.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 skuStash v20210301s.Sku
		err := redis.Sku.AssignProperties_To_Sku(&skuStash)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku() to populate field SkuStash from Sku")
		}
		var sku v20230401s.Sku
		err = skuStash.AssignProperties_To_Sku(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku() to populate field Sku from SkuStash")
		}
		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
	}

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

	// No error
	return nil
}

// Storage version of v1api20201201.Redis_STATUS
type Redis_STATUS struct {
	Conditions                 []conditions.Condition                     `json:"conditions,omitempty"`
	EnableNonSslPort           *bool                                      `json:"enableNonSslPort,omitempty"`
	HostName                   *string                                    `json:"hostName,omitempty"`
	Id                         *string                                    `json:"id,omitempty"`
	Instances                  []RedisInstanceDetails_STATUS              `json:"instances,omitempty"`
	LinkedServers              []RedisLinkedServer_STATUS                 `json:"linkedServers,omitempty"`
	Location                   *string                                    `json:"location,omitempty"`
	MinimumTlsVersion          *string                                    `json:"minimumTlsVersion,omitempty"`
	Name                       *string                                    `json:"name,omitempty"`
	Port                       *int                                       `json:"port,omitempty"`
	PrivateEndpointConnections []PrivateEndpointConnection_STATUS         `json:"privateEndpointConnections,omitempty"`
	PropertyBag                genruntime.PropertyBag                     `json:"$propertyBag,omitempty"`
	ProvisioningState          *string                                    `json:"provisioningState,omitempty"`
	PublicNetworkAccess        *string                                    `json:"publicNetworkAccess,omitempty"`
	RedisConfiguration         *RedisProperties_RedisConfiguration_STATUS `json:"redisConfiguration,omitempty"`
	RedisVersion               *string                                    `json:"redisVersion,omitempty"`
	ReplicasPerMaster          *int                                       `json:"replicasPerMaster,omitempty"`
	ReplicasPerPrimary         *int                                       `json:"replicasPerPrimary,omitempty"`
	ShardCount                 *int                                       `json:"shardCount,omitempty"`
	Sku                        *Sku_STATUS                                `json:"sku,omitempty"`
	SslPort                    *int                                       `json:"sslPort,omitempty"`
	StaticIP                   *string                                    `json:"staticIP,omitempty"`
	SubnetId                   *string                                    `json:"subnetId,omitempty"`
	Tags                       map[string]string                          `json:"tags,omitempty"`
	TenantSettings             map[string]string                          `json:"tenantSettings,omitempty"`
	Type                       *string                                    `json:"type,omitempty"`
	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.(*v20230401s.Redis_STATUS)
	if ok {
		// Populate our instance from source
		return redis.AssignProperties_From_Redis_STATUS(src)
	}

	// Convert to an intermediate form
	src = &v20230401s.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.(*v20230401s.Redis_STATUS)
	if ok {
		// Populate destination from our instance
		return redis.AssignProperties_To_Redis_STATUS(dst)
	}

	// Convert to an intermediate form
	dst = &v20230401s.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
}

// AssignProperties_From_Redis_STATUS populates our Redis_STATUS from the provided source Redis_STATUS
func (redis *Redis_STATUS) AssignProperties_From_Redis_STATUS(source *v20230401s.Redis_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// 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 {
		propertyBag.Add("Identity", *source.Identity)
	} else {
		propertyBag.Remove("Identity")
	}

	// 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
	redis.MinimumTlsVersion = genruntime.ClonePointerToString(source.MinimumTlsVersion)

	// 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 privateEndpointConnectionSTATUSStash v20210301s.PrivateEndpointConnection_STATUS
			err := privateEndpointConnectionSTATUSStash.AssignProperties_From_PrivateEndpointConnection_STATUS(&privateEndpointConnectionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpointConnection_STATUS() to populate field PrivateEndpointConnection_STATUSStash from PrivateEndpointConnections")
			}
			var privateEndpointConnection PrivateEndpointConnection_STATUS
			err = privateEndpointConnection.AssignProperties_From_PrivateEndpointConnection_STATUS(&privateEndpointConnectionSTATUSStash)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpointConnection_STATUS() to populate field PrivateEndpointConnections from PrivateEndpointConnection_STATUSStash")
			}
			privateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection
		}
		redis.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		redis.PrivateEndpointConnections = nil
	}

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

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

	// 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 skuSTATUSStash v20210301s.Sku_STATUS
		err := skuSTATUSStash.AssignProperties_From_Sku_STATUS(source.Sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Sku_STATUS() to populate field Sku_STATUSStash from Sku")
		}
		var sku Sku_STATUS
		err = sku.AssignProperties_From_Sku_STATUS(&skuSTATUSStash)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Sku_STATUS() to populate field Sku from Sku_STATUSStash")
		}
		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)

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

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

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

	// 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 propertyBag.Contains("Identity") {
		var identity v20230401s.ManagedServiceIdentity_STATUS
		err := propertyBag.Pull("Identity", &identity)
		if err != nil {
			return eris.Wrap(err, "pulling 'Identity' from propertyBag")
		}

		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

	// Instances
	if redis.Instances != nil {
		instanceList := make([]v20230401s.RedisInstanceDetails_STATUS, len(redis.Instances))
		for instanceIndex, instanceItem := range redis.Instances {
			var instance v20230401s.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([]v20230401s.RedisLinkedServer_STATUS, len(redis.LinkedServers))
		for linkedServerIndex, linkedServerItem := range redis.LinkedServers {
			var linkedServer v20230401s.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
	destination.MinimumTlsVersion = genruntime.ClonePointerToString(redis.MinimumTlsVersion)

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

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

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

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

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

	// RedisConfiguration
	if redis.RedisConfiguration != nil {
		var redisConfiguration v20230401s.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 skuSTATUSStash v20210301s.Sku_STATUS
		err := redis.Sku.AssignProperties_To_Sku_STATUS(&skuSTATUSStash)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku_STATUS() to populate field Sku_STATUSStash from Sku")
		}
		var sku v20230401s.Sku_STATUS
		err = skuSTATUSStash.AssignProperties_To_Sku_STATUS(&sku)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Sku_STATUS() to populate field Sku from Sku_STATUSStash")
		}
		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
	}

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

	// No error
	return nil
}

type augmentConversionForRedis_Spec interface {
	AssignPropertiesFrom(src *v20230401s.Redis_Spec) error
	AssignPropertiesTo(dst *v20230401s.Redis_Spec) error
}

type augmentConversionForRedis_STATUS interface {
	AssignPropertiesFrom(src *v20230401s.Redis_STATUS) error
	AssignPropertiesTo(dst *v20230401s.Redis_STATUS) error
}

// Storage version of v1api20201201.PrivateEndpointConnection_STATUS
// The Private Endpoint Connection resource.
type PrivateEndpointConnection_STATUS struct {
	Id          *string                `json:"id,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_PrivateEndpointConnection_STATUS populates our PrivateEndpointConnection_STATUS from the provided source PrivateEndpointConnection_STATUS
func (connection *PrivateEndpointConnection_STATUS) AssignProperties_From_PrivateEndpointConnection_STATUS(source *v20210301s.PrivateEndpointConnection_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

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

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

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

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

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

	// No error
	return nil
}

// Storage version of v1api20201201.RedisCreateProperties_RedisConfiguration
type RedisCreateProperties_RedisConfiguration struct {
	AdditionalProperties           map[string]string      `json:"additionalProperties,omitempty"`
	AofBackupEnabled               *string                `json:"aof-backup-enabled,omitempty"`
	AofStorageConnectionString0    *string                `json:"aof-storage-connection-string-0,omitempty"`
	AofStorageConnectionString1    *string                `json:"aof-storage-connection-string-1,omitempty"`
	Authnotrequired                *string                `json:"authnotrequired,omitempty"`
	MaxfragmentationmemoryReserved *string                `json:"maxfragmentationmemory-reserved,omitempty"`
	MaxmemoryDelta                 *string                `json:"maxmemory-delta,omitempty"`
	MaxmemoryPolicy                *string                `json:"maxmemory-policy,omitempty"`
	MaxmemoryReserved              *string                `json:"maxmemory-reserved,omitempty"`
	PropertyBag                    genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RdbBackupEnabled               *string                `json:"rdb-backup-enabled,omitempty"`
	RdbBackupFrequency             *string                `json:"rdb-backup-frequency,omitempty"`
	RdbBackupMaxSnapshotCount      *string                `json:"rdb-backup-max-snapshot-count,omitempty"`
	RdbStorageConnectionString     *string                `json:"rdb-storage-connection-string,omitempty"`
}

// AssignProperties_From_RedisCreateProperties_RedisConfiguration populates our RedisCreateProperties_RedisConfiguration from the provided source RedisCreateProperties_RedisConfiguration
func (configuration *RedisCreateProperties_RedisConfiguration) AssignProperties_From_RedisCreateProperties_RedisConfiguration(source *v20230401s.RedisCreateProperties_RedisConfiguration) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AdditionalProperties
	if propertyBag.Contains("AdditionalProperties") {
		var additionalProperty map[string]string
		err := propertyBag.Pull("AdditionalProperties", &additionalProperty)
		if err != nil {
			return eris.Wrap(err, "pulling 'AdditionalProperties' from propertyBag")
		}

		configuration.AdditionalProperties = additionalProperty
	} else {
		configuration.AdditionalProperties = nil
	}

	// 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
	if source.PreferredDataPersistenceAuthMethod != nil {
		propertyBag.Add("PreferredDataPersistenceAuthMethod", *source.PreferredDataPersistenceAuthMethod)
	} else {
		propertyBag.Remove("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
	if source.StorageSubscriptionId != nil {
		propertyBag.Add("StorageSubscriptionId", *source.StorageSubscriptionId)
	} else {
		propertyBag.Remove("StorageSubscriptionId")
	}

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

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

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

	// AdditionalProperties
	if len(configuration.AdditionalProperties) > 0 {
		propertyBag.Add("AdditionalProperties", configuration.AdditionalProperties)
	} else {
		propertyBag.Remove("AdditionalProperties")
	}

	// 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
	if propertyBag.Contains("PreferredDataPersistenceAuthMethod") {
		var preferredDataPersistenceAuthMethod string
		err := propertyBag.Pull("PreferredDataPersistenceAuthMethod", &preferredDataPersistenceAuthMethod)
		if err != nil {
			return eris.Wrap(err, "pulling 'PreferredDataPersistenceAuthMethod' from propertyBag")
		}

		destination.PreferredDataPersistenceAuthMethod = &preferredDataPersistenceAuthMethod
	} else {
		destination.PreferredDataPersistenceAuthMethod = nil
	}

	// 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
	if propertyBag.Contains("StorageSubscriptionId") {
		var storageSubscriptionId string
		err := propertyBag.Pull("StorageSubscriptionId", &storageSubscriptionId)
		if err != nil {
			return eris.Wrap(err, "pulling 'StorageSubscriptionId' from propertyBag")
		}

		destination.StorageSubscriptionId = &storageSubscriptionId
	} else {
		destination.StorageSubscriptionId = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20201201.RedisInstanceDetails_STATUS
// Details of single instance of redis.
type RedisInstanceDetails_STATUS struct {
	IsMaster    *bool                  `json:"isMaster,omitempty"`
	IsPrimary   *bool                  `json:"isPrimary,omitempty"`
	NonSslPort  *int                   `json:"nonSslPort,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	ShardId     *int                   `json:"shardId,omitempty"`
	SslPort     *int                   `json:"sslPort,omitempty"`
	Zone        *string                `json:"zone,omitempty"`
}

// AssignProperties_From_RedisInstanceDetails_STATUS populates our RedisInstanceDetails_STATUS from the provided source RedisInstanceDetails_STATUS
func (details *RedisInstanceDetails_STATUS) AssignProperties_From_RedisInstanceDetails_STATUS(source *v20230401s.RedisInstanceDetails_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

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

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

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

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

	// No error
	return nil
}

// Storage version of v1api20201201.RedisLinkedServer_STATUS
// Linked server Id
type RedisLinkedServer_STATUS struct {
	Id          *string                `json:"id,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_RedisLinkedServer_STATUS populates our RedisLinkedServer_STATUS from the provided source RedisLinkedServer_STATUS
func (server *RedisLinkedServer_STATUS) AssignProperties_From_RedisLinkedServer_STATUS(source *v20230401s.RedisLinkedServer_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

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

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

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

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

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

	// No error
	return nil
}

// Storage version of v1api20201201.RedisOperatorSpec
// 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 []*core.DestinationExpression `json:"configMapExpressions,omitempty"`
	PropertyBag          genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	SecretExpressions    []*core.DestinationExpression `json:"secretExpressions,omitempty"`
	Secrets              *RedisOperatorSecrets         `json:"secrets,omitempty"`
}

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

	// Secrets
	if operator.Secrets != nil {
		var secret v20230401s.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
	}

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

	// No error
	return nil
}

// Storage version of v1api20201201.RedisProperties_RedisConfiguration_STATUS
type RedisProperties_RedisConfiguration_STATUS struct {
	AdditionalProperties           map[string]string      `json:"additionalProperties,omitempty"`
	AofBackupEnabled               *string                `json:"aof-backup-enabled,omitempty"`
	AofStorageConnectionString0    *string                `json:"aof-storage-connection-string-0,omitempty"`
	AofStorageConnectionString1    *string                `json:"aof-storage-connection-string-1,omitempty"`
	Authnotrequired                *string                `json:"authnotrequired,omitempty"`
	Maxclients                     *string                `json:"maxclients,omitempty"`
	MaxfragmentationmemoryReserved *string                `json:"maxfragmentationmemory-reserved,omitempty"`
	MaxmemoryDelta                 *string                `json:"maxmemory-delta,omitempty"`
	MaxmemoryPolicy                *string                `json:"maxmemory-policy,omitempty"`
	MaxmemoryReserved              *string                `json:"maxmemory-reserved,omitempty"`
	PropertyBag                    genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RdbBackupEnabled               *string                `json:"rdb-backup-enabled,omitempty"`
	RdbBackupFrequency             *string                `json:"rdb-backup-frequency,omitempty"`
	RdbBackupMaxSnapshotCount      *string                `json:"rdb-backup-max-snapshot-count,omitempty"`
	RdbStorageConnectionString     *string                `json:"rdb-storage-connection-string,omitempty"`
	ZonalConfiguration             *string                `json:"zonal-configuration,omitempty"`
}

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

	// AdditionalProperties
	if propertyBag.Contains("AdditionalProperties") {
		var additionalProperty map[string]string
		err := propertyBag.Pull("AdditionalProperties", &additionalProperty)
		if err != nil {
			return eris.Wrap(err, "pulling 'AdditionalProperties' from propertyBag")
		}

		configuration.AdditionalProperties = additionalProperty
	} else {
		configuration.AdditionalProperties = nil
	}

	// 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
	if source.PreferredDataArchiveAuthMethod != nil {
		propertyBag.Add("PreferredDataArchiveAuthMethod", *source.PreferredDataArchiveAuthMethod)
	} else {
		propertyBag.Remove("PreferredDataArchiveAuthMethod")
	}

	// PreferredDataPersistenceAuthMethod
	if source.PreferredDataPersistenceAuthMethod != nil {
		propertyBag.Add("PreferredDataPersistenceAuthMethod", *source.PreferredDataPersistenceAuthMethod)
	} else {
		propertyBag.Remove("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
	if source.StorageSubscriptionId != nil {
		propertyBag.Add("StorageSubscriptionId", *source.StorageSubscriptionId)
	} else {
		propertyBag.Remove("StorageSubscriptionId")
	}

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

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

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

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

	// AdditionalProperties
	if len(configuration.AdditionalProperties) > 0 {
		propertyBag.Add("AdditionalProperties", configuration.AdditionalProperties)
	} else {
		propertyBag.Remove("AdditionalProperties")
	}

	// 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
	if propertyBag.Contains("PreferredDataArchiveAuthMethod") {
		var preferredDataArchiveAuthMethod string
		err := propertyBag.Pull("PreferredDataArchiveAuthMethod", &preferredDataArchiveAuthMethod)
		if err != nil {
			return eris.Wrap(err, "pulling 'PreferredDataArchiveAuthMethod' from propertyBag")
		}

		destination.PreferredDataArchiveAuthMethod = &preferredDataArchiveAuthMethod
	} else {
		destination.PreferredDataArchiveAuthMethod = nil
	}

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

		destination.PreferredDataPersistenceAuthMethod = &preferredDataPersistenceAuthMethod
	} else {
		destination.PreferredDataPersistenceAuthMethod = nil
	}

	// 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
	if propertyBag.Contains("StorageSubscriptionId") {
		var storageSubscriptionId string
		err := propertyBag.Pull("StorageSubscriptionId", &storageSubscriptionId)
		if err != nil {
			return eris.Wrap(err, "pulling 'StorageSubscriptionId' from propertyBag")
		}

		destination.StorageSubscriptionId = &storageSubscriptionId
	} else {
		destination.StorageSubscriptionId = nil
	}

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

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

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

	// No error
	return nil
}

// Storage version of v1api20201201.Sku
// SKU parameters supplied to the create Redis operation.
type Sku struct {
	Capacity    *int                   `json:"capacity,omitempty"`
	Family      *string                `json:"family,omitempty"`
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

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

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

		sku.Family = &family
	} else {
		sku.Family = nil
	}

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

	// No error
	return nil
}

// Storage version of v1api20201201.Sku_STATUS
// SKU parameters supplied to the create Redis operation.
type Sku_STATUS struct {
	Capacity    *int                   `json:"capacity,omitempty"`
	Family      *string                `json:"family,omitempty"`
	Name        *string                `json:"name,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

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

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

		sku.Family = &family
	} else {
		sku.Family = nil
	}

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

	// No error
	return nil
}

type augmentConversionForPrivateEndpointConnection_STATUS interface {
	AssignPropertiesFrom(src *v20210301s.PrivateEndpointConnection_STATUS) error
	AssignPropertiesTo(dst *v20210301s.PrivateEndpointConnection_STATUS) error
}

type augmentConversionForRedisCreateProperties_RedisConfiguration interface {
	AssignPropertiesFrom(src *v20230401s.RedisCreateProperties_RedisConfiguration) error
	AssignPropertiesTo(dst *v20230401s.RedisCreateProperties_RedisConfiguration) error
}

type augmentConversionForRedisInstanceDetails_STATUS interface {
	AssignPropertiesFrom(src *v20230401s.RedisInstanceDetails_STATUS) error
	AssignPropertiesTo(dst *v20230401s.RedisInstanceDetails_STATUS) error
}

type augmentConversionForRedisLinkedServer_STATUS interface {
	AssignPropertiesFrom(src *v20230401s.RedisLinkedServer_STATUS) error
	AssignPropertiesTo(dst *v20230401s.RedisLinkedServer_STATUS) error
}

type augmentConversionForRedisOperatorSpec interface {
	AssignPropertiesFrom(src *v20230401s.RedisOperatorSpec) error
	AssignPropertiesTo(dst *v20230401s.RedisOperatorSpec) error
}

type augmentConversionForRedisProperties_RedisConfiguration_STATUS interface {
	AssignPropertiesFrom(src *v20230401s.RedisProperties_RedisConfiguration_STATUS) error
	AssignPropertiesTo(dst *v20230401s.RedisProperties_RedisConfiguration_STATUS) error
}

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

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

// Storage version of v1api20201201.RedisOperatorSecrets
type RedisOperatorSecrets struct {
	HostName     *genruntime.SecretDestination `json:"hostName,omitempty"`
	Port         *genruntime.SecretDestination `json:"port,omitempty"`
	PrimaryKey   *genruntime.SecretDestination `json:"primaryKey,omitempty"`
	PropertyBag  genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	SSLPort      *genruntime.SecretDestination `json:"sslPort,omitempty"`
	SecondaryKey *genruntime.SecretDestination `json:"secondaryKey,omitempty"`
}

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

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

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

type augmentConversionForRedisOperatorSecrets interface {
	AssignPropertiesFrom(src *v20230401s.RedisOperatorSecrets) error
	AssignPropertiesTo(dst *v20230401s.RedisOperatorSecrets) error
}

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