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

import (
	"fmt"
	storage "github.com/Azure/azure-service-operator/v2/api/storage/v1api20230101/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,storage}
// +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 v1api20220901.StorageAccountsBlobService
// Generator information:
// - Generated from: /storage/resource-manager/Microsoft.Storage/stable/2022-09-01/blob.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default
type StorageAccountsBlobService struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              StorageAccountsBlobService_Spec   `json:"spec,omitempty"`
	Status            StorageAccountsBlobService_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &StorageAccountsBlobService{}

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

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

var _ conversion.Convertible = &StorageAccountsBlobService{}

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

	return service.AssignProperties_From_StorageAccountsBlobService(source)
}

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

	return service.AssignProperties_To_StorageAccountsBlobService(destination)
}

var _ configmaps.Exporter = &StorageAccountsBlobService{}

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

var _ secrets.Exporter = &StorageAccountsBlobService{}

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

var _ genruntime.KubernetesResource = &StorageAccountsBlobService{}

// AzureName returns the Azure name of the resource (always "default")
func (service *StorageAccountsBlobService) AzureName() string {
	return "default"
}

// GetAPIVersion returns the ARM API version of the resource. This is always "2022-09-01"
func (service StorageAccountsBlobService) GetAPIVersion() string {
	return "2022-09-01"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Storage/storageAccounts/blobServices"
func (service *StorageAccountsBlobService) GetType() string {
	return "Microsoft.Storage/storageAccounts/blobServices"
}

// NewEmptyStatus returns a new empty (blank) status
func (service *StorageAccountsBlobService) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &StorageAccountsBlobService_STATUS{}
}

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

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

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

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

	service.Status = st
	return nil
}

// AssignProperties_From_StorageAccountsBlobService populates our StorageAccountsBlobService from the provided source StorageAccountsBlobService
func (service *StorageAccountsBlobService) AssignProperties_From_StorageAccountsBlobService(source *storage.StorageAccountsBlobService) error {

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

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

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

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

	// No error
	return nil
}

// AssignProperties_To_StorageAccountsBlobService populates the provided destination StorageAccountsBlobService from our StorageAccountsBlobService
func (service *StorageAccountsBlobService) AssignProperties_To_StorageAccountsBlobService(destination *storage.StorageAccountsBlobService) error {

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

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

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

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

// +kubebuilder:object:root=true
// Storage version of v1api20220901.StorageAccountsBlobService
// Generator information:
// - Generated from: /storage/resource-manager/Microsoft.Storage/stable/2022-09-01/blob.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default
type StorageAccountsBlobServiceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []StorageAccountsBlobService `json:"items"`
}

type augmentConversionForStorageAccountsBlobService interface {
	AssignPropertiesFrom(src *storage.StorageAccountsBlobService) error
	AssignPropertiesTo(dst *storage.StorageAccountsBlobService) error
}

// Storage version of v1api20220901.StorageAccountsBlobService_Spec
type StorageAccountsBlobService_Spec struct {
	AutomaticSnapshotPolicyEnabled *bool                                   `json:"automaticSnapshotPolicyEnabled,omitempty"`
	ChangeFeed                     *ChangeFeed                             `json:"changeFeed,omitempty"`
	ContainerDeleteRetentionPolicy *DeleteRetentionPolicy                  `json:"containerDeleteRetentionPolicy,omitempty"`
	Cors                           *CorsRules                              `json:"cors,omitempty"`
	DefaultServiceVersion          *string                                 `json:"defaultServiceVersion,omitempty"`
	DeleteRetentionPolicy          *DeleteRetentionPolicy                  `json:"deleteRetentionPolicy,omitempty"`
	IsVersioningEnabled            *bool                                   `json:"isVersioningEnabled,omitempty"`
	LastAccessTimeTrackingPolicy   *LastAccessTimeTrackingPolicy           `json:"lastAccessTimeTrackingPolicy,omitempty"`
	OperatorSpec                   *StorageAccountsBlobServiceOperatorSpec `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 storage.azure.com/StorageAccount resource
	Owner         *genruntime.KnownResourceReference `group:"storage.azure.com" json:"owner,omitempty" kind:"StorageAccount"`
	PropertyBag   genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	RestorePolicy *RestorePolicyProperties           `json:"restorePolicy,omitempty"`
}

var _ genruntime.ConvertibleSpec = &StorageAccountsBlobService_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.StorageAccountsBlobService_Spec{}
	err := service.AssignProperties_To_StorageAccountsBlobService_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_StorageAccountsBlobService_Spec populates our StorageAccountsBlobService_Spec from the provided source StorageAccountsBlobService_Spec
func (service *StorageAccountsBlobService_Spec) AssignProperties_From_StorageAccountsBlobService_Spec(source *storage.StorageAccountsBlobService_Spec) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AutomaticSnapshotPolicyEnabled
	if source.AutomaticSnapshotPolicyEnabled != nil {
		automaticSnapshotPolicyEnabled := *source.AutomaticSnapshotPolicyEnabled
		service.AutomaticSnapshotPolicyEnabled = &automaticSnapshotPolicyEnabled
	} else {
		service.AutomaticSnapshotPolicyEnabled = nil
	}

	// ChangeFeed
	if source.ChangeFeed != nil {
		var changeFeed ChangeFeed
		err := changeFeed.AssignProperties_From_ChangeFeed(source.ChangeFeed)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ChangeFeed() to populate field ChangeFeed")
		}
		service.ChangeFeed = &changeFeed
	} else {
		service.ChangeFeed = nil
	}

	// ContainerDeleteRetentionPolicy
	if source.ContainerDeleteRetentionPolicy != nil {
		var containerDeleteRetentionPolicy DeleteRetentionPolicy
		err := containerDeleteRetentionPolicy.AssignProperties_From_DeleteRetentionPolicy(source.ContainerDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DeleteRetentionPolicy() to populate field ContainerDeleteRetentionPolicy")
		}
		service.ContainerDeleteRetentionPolicy = &containerDeleteRetentionPolicy
	} else {
		service.ContainerDeleteRetentionPolicy = nil
	}

	// Cors
	if source.Cors != nil {
		var cor CorsRules
		err := cor.AssignProperties_From_CorsRules(source.Cors)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CorsRules() to populate field Cors")
		}
		service.Cors = &cor
	} else {
		service.Cors = nil
	}

	// DefaultServiceVersion
	service.DefaultServiceVersion = genruntime.ClonePointerToString(source.DefaultServiceVersion)

	// DeleteRetentionPolicy
	if source.DeleteRetentionPolicy != nil {
		var deleteRetentionPolicy DeleteRetentionPolicy
		err := deleteRetentionPolicy.AssignProperties_From_DeleteRetentionPolicy(source.DeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DeleteRetentionPolicy() to populate field DeleteRetentionPolicy")
		}
		service.DeleteRetentionPolicy = &deleteRetentionPolicy
	} else {
		service.DeleteRetentionPolicy = nil
	}

	// IsVersioningEnabled
	if source.IsVersioningEnabled != nil {
		isVersioningEnabled := *source.IsVersioningEnabled
		service.IsVersioningEnabled = &isVersioningEnabled
	} else {
		service.IsVersioningEnabled = nil
	}

	// LastAccessTimeTrackingPolicy
	if source.LastAccessTimeTrackingPolicy != nil {
		var lastAccessTimeTrackingPolicy LastAccessTimeTrackingPolicy
		err := lastAccessTimeTrackingPolicy.AssignProperties_From_LastAccessTimeTrackingPolicy(source.LastAccessTimeTrackingPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_LastAccessTimeTrackingPolicy() to populate field LastAccessTimeTrackingPolicy")
		}
		service.LastAccessTimeTrackingPolicy = &lastAccessTimeTrackingPolicy
	} else {
		service.LastAccessTimeTrackingPolicy = nil
	}

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

	// OriginalVersion
	service.OriginalVersion = source.OriginalVersion

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

	// RestorePolicy
	if source.RestorePolicy != nil {
		var restorePolicy RestorePolicyProperties
		err := restorePolicy.AssignProperties_From_RestorePolicyProperties(source.RestorePolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_RestorePolicyProperties() to populate field RestorePolicy")
		}
		service.RestorePolicy = &restorePolicy
	} else {
		service.RestorePolicy = nil
	}

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

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

	// No error
	return nil
}

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

	// AutomaticSnapshotPolicyEnabled
	if service.AutomaticSnapshotPolicyEnabled != nil {
		automaticSnapshotPolicyEnabled := *service.AutomaticSnapshotPolicyEnabled
		destination.AutomaticSnapshotPolicyEnabled = &automaticSnapshotPolicyEnabled
	} else {
		destination.AutomaticSnapshotPolicyEnabled = nil
	}

	// ChangeFeed
	if service.ChangeFeed != nil {
		var changeFeed storage.ChangeFeed
		err := service.ChangeFeed.AssignProperties_To_ChangeFeed(&changeFeed)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ChangeFeed() to populate field ChangeFeed")
		}
		destination.ChangeFeed = &changeFeed
	} else {
		destination.ChangeFeed = nil
	}

	// ContainerDeleteRetentionPolicy
	if service.ContainerDeleteRetentionPolicy != nil {
		var containerDeleteRetentionPolicy storage.DeleteRetentionPolicy
		err := service.ContainerDeleteRetentionPolicy.AssignProperties_To_DeleteRetentionPolicy(&containerDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DeleteRetentionPolicy() to populate field ContainerDeleteRetentionPolicy")
		}
		destination.ContainerDeleteRetentionPolicy = &containerDeleteRetentionPolicy
	} else {
		destination.ContainerDeleteRetentionPolicy = nil
	}

	// Cors
	if service.Cors != nil {
		var cor storage.CorsRules
		err := service.Cors.AssignProperties_To_CorsRules(&cor)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CorsRules() to populate field Cors")
		}
		destination.Cors = &cor
	} else {
		destination.Cors = nil
	}

	// DefaultServiceVersion
	destination.DefaultServiceVersion = genruntime.ClonePointerToString(service.DefaultServiceVersion)

	// DeleteRetentionPolicy
	if service.DeleteRetentionPolicy != nil {
		var deleteRetentionPolicy storage.DeleteRetentionPolicy
		err := service.DeleteRetentionPolicy.AssignProperties_To_DeleteRetentionPolicy(&deleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DeleteRetentionPolicy() to populate field DeleteRetentionPolicy")
		}
		destination.DeleteRetentionPolicy = &deleteRetentionPolicy
	} else {
		destination.DeleteRetentionPolicy = nil
	}

	// IsVersioningEnabled
	if service.IsVersioningEnabled != nil {
		isVersioningEnabled := *service.IsVersioningEnabled
		destination.IsVersioningEnabled = &isVersioningEnabled
	} else {
		destination.IsVersioningEnabled = nil
	}

	// LastAccessTimeTrackingPolicy
	if service.LastAccessTimeTrackingPolicy != nil {
		var lastAccessTimeTrackingPolicy storage.LastAccessTimeTrackingPolicy
		err := service.LastAccessTimeTrackingPolicy.AssignProperties_To_LastAccessTimeTrackingPolicy(&lastAccessTimeTrackingPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_LastAccessTimeTrackingPolicy() to populate field LastAccessTimeTrackingPolicy")
		}
		destination.LastAccessTimeTrackingPolicy = &lastAccessTimeTrackingPolicy
	} else {
		destination.LastAccessTimeTrackingPolicy = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = service.OriginalVersion

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

	// RestorePolicy
	if service.RestorePolicy != nil {
		var restorePolicy storage.RestorePolicyProperties
		err := service.RestorePolicy.AssignProperties_To_RestorePolicyProperties(&restorePolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_RestorePolicyProperties() to populate field RestorePolicy")
		}
		destination.RestorePolicy = &restorePolicy
	} else {
		destination.RestorePolicy = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.StorageAccountsBlobService_STATUS
type StorageAccountsBlobService_STATUS struct {
	AutomaticSnapshotPolicyEnabled *bool                                `json:"automaticSnapshotPolicyEnabled,omitempty"`
	ChangeFeed                     *ChangeFeed_STATUS                   `json:"changeFeed,omitempty"`
	Conditions                     []conditions.Condition               `json:"conditions,omitempty"`
	ContainerDeleteRetentionPolicy *DeleteRetentionPolicy_STATUS        `json:"containerDeleteRetentionPolicy,omitempty"`
	Cors                           *CorsRules_STATUS                    `json:"cors,omitempty"`
	DefaultServiceVersion          *string                              `json:"defaultServiceVersion,omitempty"`
	DeleteRetentionPolicy          *DeleteRetentionPolicy_STATUS        `json:"deleteRetentionPolicy,omitempty"`
	Id                             *string                              `json:"id,omitempty"`
	IsVersioningEnabled            *bool                                `json:"isVersioningEnabled,omitempty"`
	LastAccessTimeTrackingPolicy   *LastAccessTimeTrackingPolicy_STATUS `json:"lastAccessTimeTrackingPolicy,omitempty"`
	Name                           *string                              `json:"name,omitempty"`
	PropertyBag                    genruntime.PropertyBag               `json:"$propertyBag,omitempty"`
	RestorePolicy                  *RestorePolicyProperties_STATUS      `json:"restorePolicy,omitempty"`
	Sku                            *Sku_STATUS                          `json:"sku,omitempty"`
	Type                           *string                              `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &StorageAccountsBlobService_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.StorageAccountsBlobService_STATUS{}
	err := service.AssignProperties_To_StorageAccountsBlobService_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_StorageAccountsBlobService_STATUS populates our StorageAccountsBlobService_STATUS from the provided source StorageAccountsBlobService_STATUS
func (service *StorageAccountsBlobService_STATUS) AssignProperties_From_StorageAccountsBlobService_STATUS(source *storage.StorageAccountsBlobService_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

	// AutomaticSnapshotPolicyEnabled
	if source.AutomaticSnapshotPolicyEnabled != nil {
		automaticSnapshotPolicyEnabled := *source.AutomaticSnapshotPolicyEnabled
		service.AutomaticSnapshotPolicyEnabled = &automaticSnapshotPolicyEnabled
	} else {
		service.AutomaticSnapshotPolicyEnabled = nil
	}

	// ChangeFeed
	if source.ChangeFeed != nil {
		var changeFeed ChangeFeed_STATUS
		err := changeFeed.AssignProperties_From_ChangeFeed_STATUS(source.ChangeFeed)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ChangeFeed_STATUS() to populate field ChangeFeed")
		}
		service.ChangeFeed = &changeFeed
	} else {
		service.ChangeFeed = nil
	}

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

	// ContainerDeleteRetentionPolicy
	if source.ContainerDeleteRetentionPolicy != nil {
		var containerDeleteRetentionPolicy DeleteRetentionPolicy_STATUS
		err := containerDeleteRetentionPolicy.AssignProperties_From_DeleteRetentionPolicy_STATUS(source.ContainerDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DeleteRetentionPolicy_STATUS() to populate field ContainerDeleteRetentionPolicy")
		}
		service.ContainerDeleteRetentionPolicy = &containerDeleteRetentionPolicy
	} else {
		service.ContainerDeleteRetentionPolicy = nil
	}

	// Cors
	if source.Cors != nil {
		var cor CorsRules_STATUS
		err := cor.AssignProperties_From_CorsRules_STATUS(source.Cors)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CorsRules_STATUS() to populate field Cors")
		}
		service.Cors = &cor
	} else {
		service.Cors = nil
	}

	// DefaultServiceVersion
	service.DefaultServiceVersion = genruntime.ClonePointerToString(source.DefaultServiceVersion)

	// DeleteRetentionPolicy
	if source.DeleteRetentionPolicy != nil {
		var deleteRetentionPolicy DeleteRetentionPolicy_STATUS
		err := deleteRetentionPolicy.AssignProperties_From_DeleteRetentionPolicy_STATUS(source.DeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DeleteRetentionPolicy_STATUS() to populate field DeleteRetentionPolicy")
		}
		service.DeleteRetentionPolicy = &deleteRetentionPolicy
	} else {
		service.DeleteRetentionPolicy = nil
	}

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

	// IsVersioningEnabled
	if source.IsVersioningEnabled != nil {
		isVersioningEnabled := *source.IsVersioningEnabled
		service.IsVersioningEnabled = &isVersioningEnabled
	} else {
		service.IsVersioningEnabled = nil
	}

	// LastAccessTimeTrackingPolicy
	if source.LastAccessTimeTrackingPolicy != nil {
		var lastAccessTimeTrackingPolicy LastAccessTimeTrackingPolicy_STATUS
		err := lastAccessTimeTrackingPolicy.AssignProperties_From_LastAccessTimeTrackingPolicy_STATUS(source.LastAccessTimeTrackingPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_LastAccessTimeTrackingPolicy_STATUS() to populate field LastAccessTimeTrackingPolicy")
		}
		service.LastAccessTimeTrackingPolicy = &lastAccessTimeTrackingPolicy
	} else {
		service.LastAccessTimeTrackingPolicy = nil
	}

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

	// RestorePolicy
	if source.RestorePolicy != nil {
		var restorePolicy RestorePolicyProperties_STATUS
		err := restorePolicy.AssignProperties_From_RestorePolicyProperties_STATUS(source.RestorePolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_RestorePolicyProperties_STATUS() to populate field RestorePolicy")
		}
		service.RestorePolicy = &restorePolicy
	} else {
		service.RestorePolicy = nil
	}

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

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

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

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

	// No error
	return nil
}

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

	// AutomaticSnapshotPolicyEnabled
	if service.AutomaticSnapshotPolicyEnabled != nil {
		automaticSnapshotPolicyEnabled := *service.AutomaticSnapshotPolicyEnabled
		destination.AutomaticSnapshotPolicyEnabled = &automaticSnapshotPolicyEnabled
	} else {
		destination.AutomaticSnapshotPolicyEnabled = nil
	}

	// ChangeFeed
	if service.ChangeFeed != nil {
		var changeFeed storage.ChangeFeed_STATUS
		err := service.ChangeFeed.AssignProperties_To_ChangeFeed_STATUS(&changeFeed)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ChangeFeed_STATUS() to populate field ChangeFeed")
		}
		destination.ChangeFeed = &changeFeed
	} else {
		destination.ChangeFeed = nil
	}

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

	// ContainerDeleteRetentionPolicy
	if service.ContainerDeleteRetentionPolicy != nil {
		var containerDeleteRetentionPolicy storage.DeleteRetentionPolicy_STATUS
		err := service.ContainerDeleteRetentionPolicy.AssignProperties_To_DeleteRetentionPolicy_STATUS(&containerDeleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DeleteRetentionPolicy_STATUS() to populate field ContainerDeleteRetentionPolicy")
		}
		destination.ContainerDeleteRetentionPolicy = &containerDeleteRetentionPolicy
	} else {
		destination.ContainerDeleteRetentionPolicy = nil
	}

	// Cors
	if service.Cors != nil {
		var cor storage.CorsRules_STATUS
		err := service.Cors.AssignProperties_To_CorsRules_STATUS(&cor)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CorsRules_STATUS() to populate field Cors")
		}
		destination.Cors = &cor
	} else {
		destination.Cors = nil
	}

	// DefaultServiceVersion
	destination.DefaultServiceVersion = genruntime.ClonePointerToString(service.DefaultServiceVersion)

	// DeleteRetentionPolicy
	if service.DeleteRetentionPolicy != nil {
		var deleteRetentionPolicy storage.DeleteRetentionPolicy_STATUS
		err := service.DeleteRetentionPolicy.AssignProperties_To_DeleteRetentionPolicy_STATUS(&deleteRetentionPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DeleteRetentionPolicy_STATUS() to populate field DeleteRetentionPolicy")
		}
		destination.DeleteRetentionPolicy = &deleteRetentionPolicy
	} else {
		destination.DeleteRetentionPolicy = nil
	}

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

	// IsVersioningEnabled
	if service.IsVersioningEnabled != nil {
		isVersioningEnabled := *service.IsVersioningEnabled
		destination.IsVersioningEnabled = &isVersioningEnabled
	} else {
		destination.IsVersioningEnabled = nil
	}

	// LastAccessTimeTrackingPolicy
	if service.LastAccessTimeTrackingPolicy != nil {
		var lastAccessTimeTrackingPolicy storage.LastAccessTimeTrackingPolicy_STATUS
		err := service.LastAccessTimeTrackingPolicy.AssignProperties_To_LastAccessTimeTrackingPolicy_STATUS(&lastAccessTimeTrackingPolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_LastAccessTimeTrackingPolicy_STATUS() to populate field LastAccessTimeTrackingPolicy")
		}
		destination.LastAccessTimeTrackingPolicy = &lastAccessTimeTrackingPolicy
	} else {
		destination.LastAccessTimeTrackingPolicy = nil
	}

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

	// RestorePolicy
	if service.RestorePolicy != nil {
		var restorePolicy storage.RestorePolicyProperties_STATUS
		err := service.RestorePolicy.AssignProperties_To_RestorePolicyProperties_STATUS(&restorePolicy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_RestorePolicyProperties_STATUS() to populate field RestorePolicy")
		}
		destination.RestorePolicy = &restorePolicy
	} else {
		destination.RestorePolicy = nil
	}

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

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

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

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

	// No error
	return nil
}

type augmentConversionForStorageAccountsBlobService_Spec interface {
	AssignPropertiesFrom(src *storage.StorageAccountsBlobService_Spec) error
	AssignPropertiesTo(dst *storage.StorageAccountsBlobService_Spec) error
}

type augmentConversionForStorageAccountsBlobService_STATUS interface {
	AssignPropertiesFrom(src *storage.StorageAccountsBlobService_STATUS) error
	AssignPropertiesTo(dst *storage.StorageAccountsBlobService_STATUS) error
}

// Storage version of v1api20220901.ChangeFeed
// The blob service properties for change feed events.
type ChangeFeed struct {
	Enabled         *bool                  `json:"enabled,omitempty"`
	PropertyBag     genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RetentionInDays *int                   `json:"retentionInDays,omitempty"`
}

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

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		feed.Enabled = &enabled
	} else {
		feed.Enabled = nil
	}

	// RetentionInDays
	feed.RetentionInDays = genruntime.ClonePointerToInt(source.RetentionInDays)

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

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

	// No error
	return nil
}

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

	// Enabled
	if feed.Enabled != nil {
		enabled := *feed.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

	// RetentionInDays
	destination.RetentionInDays = genruntime.ClonePointerToInt(feed.RetentionInDays)

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.ChangeFeed_STATUS
// The blob service properties for change feed events.
type ChangeFeed_STATUS struct {
	Enabled         *bool                  `json:"enabled,omitempty"`
	PropertyBag     genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RetentionInDays *int                   `json:"retentionInDays,omitempty"`
}

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

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		feed.Enabled = &enabled
	} else {
		feed.Enabled = nil
	}

	// RetentionInDays
	feed.RetentionInDays = genruntime.ClonePointerToInt(source.RetentionInDays)

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

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

	// No error
	return nil
}

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

	// Enabled
	if feed.Enabled != nil {
		enabled := *feed.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

	// RetentionInDays
	destination.RetentionInDays = genruntime.ClonePointerToInt(feed.RetentionInDays)

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.CorsRules
// Sets the CORS rules. You can include up to five CorsRule elements in the request.
type CorsRules struct {
	CorsRules   []CorsRule             `json:"corsRules,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

	// CorsRules
	if source.CorsRules != nil {
		corsRuleList := make([]CorsRule, len(source.CorsRules))
		for corsRuleIndex, corsRuleItem := range source.CorsRules {
			var corsRule CorsRule
			err := corsRule.AssignProperties_From_CorsRule(&corsRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_CorsRule() to populate field CorsRules")
			}
			corsRuleList[corsRuleIndex] = corsRule
		}
		rules.CorsRules = corsRuleList
	} else {
		rules.CorsRules = nil
	}

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

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

	// No error
	return nil
}

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

	// CorsRules
	if rules.CorsRules != nil {
		corsRuleList := make([]storage.CorsRule, len(rules.CorsRules))
		for corsRuleIndex, corsRuleItem := range rules.CorsRules {
			var corsRule storage.CorsRule
			err := corsRuleItem.AssignProperties_To_CorsRule(&corsRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_CorsRule() to populate field CorsRules")
			}
			corsRuleList[corsRuleIndex] = corsRule
		}
		destination.CorsRules = corsRuleList
	} else {
		destination.CorsRules = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.CorsRules_STATUS
// Sets the CORS rules. You can include up to five CorsRule elements in the request.
type CorsRules_STATUS struct {
	CorsRules   []CorsRule_STATUS      `json:"corsRules,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

	// CorsRules
	if source.CorsRules != nil {
		corsRuleList := make([]CorsRule_STATUS, len(source.CorsRules))
		for corsRuleIndex, corsRuleItem := range source.CorsRules {
			var corsRule CorsRule_STATUS
			err := corsRule.AssignProperties_From_CorsRule_STATUS(&corsRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_CorsRule_STATUS() to populate field CorsRules")
			}
			corsRuleList[corsRuleIndex] = corsRule
		}
		rules.CorsRules = corsRuleList
	} else {
		rules.CorsRules = nil
	}

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

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

	// No error
	return nil
}

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

	// CorsRules
	if rules.CorsRules != nil {
		corsRuleList := make([]storage.CorsRule_STATUS, len(rules.CorsRules))
		for corsRuleIndex, corsRuleItem := range rules.CorsRules {
			var corsRule storage.CorsRule_STATUS
			err := corsRuleItem.AssignProperties_To_CorsRule_STATUS(&corsRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_CorsRule_STATUS() to populate field CorsRules")
			}
			corsRuleList[corsRuleIndex] = corsRule
		}
		destination.CorsRules = corsRuleList
	} else {
		destination.CorsRules = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.DeleteRetentionPolicy
// The service properties for soft delete.
type DeleteRetentionPolicy struct {
	AllowPermanentDelete *bool                  `json:"allowPermanentDelete,omitempty"`
	Days                 *int                   `json:"days,omitempty"`
	Enabled              *bool                  `json:"enabled,omitempty"`
	PropertyBag          genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

	// AllowPermanentDelete
	if source.AllowPermanentDelete != nil {
		allowPermanentDelete := *source.AllowPermanentDelete
		policy.AllowPermanentDelete = &allowPermanentDelete
	} else {
		policy.AllowPermanentDelete = nil
	}

	// Days
	policy.Days = genruntime.ClonePointerToInt(source.Days)

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		policy.Enabled = &enabled
	} else {
		policy.Enabled = nil
	}

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

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

	// No error
	return nil
}

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

	// AllowPermanentDelete
	if policy.AllowPermanentDelete != nil {
		allowPermanentDelete := *policy.AllowPermanentDelete
		destination.AllowPermanentDelete = &allowPermanentDelete
	} else {
		destination.AllowPermanentDelete = nil
	}

	// Days
	destination.Days = genruntime.ClonePointerToInt(policy.Days)

	// Enabled
	if policy.Enabled != nil {
		enabled := *policy.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.DeleteRetentionPolicy_STATUS
// The service properties for soft delete.
type DeleteRetentionPolicy_STATUS struct {
	AllowPermanentDelete *bool                  `json:"allowPermanentDelete,omitempty"`
	Days                 *int                   `json:"days,omitempty"`
	Enabled              *bool                  `json:"enabled,omitempty"`
	PropertyBag          genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

	// AllowPermanentDelete
	if source.AllowPermanentDelete != nil {
		allowPermanentDelete := *source.AllowPermanentDelete
		policy.AllowPermanentDelete = &allowPermanentDelete
	} else {
		policy.AllowPermanentDelete = nil
	}

	// Days
	policy.Days = genruntime.ClonePointerToInt(source.Days)

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		policy.Enabled = &enabled
	} else {
		policy.Enabled = nil
	}

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

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

	// No error
	return nil
}

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

	// AllowPermanentDelete
	if policy.AllowPermanentDelete != nil {
		allowPermanentDelete := *policy.AllowPermanentDelete
		destination.AllowPermanentDelete = &allowPermanentDelete
	} else {
		destination.AllowPermanentDelete = nil
	}

	// Days
	destination.Days = genruntime.ClonePointerToInt(policy.Days)

	// Enabled
	if policy.Enabled != nil {
		enabled := *policy.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.LastAccessTimeTrackingPolicy
// The blob service properties for Last access time based tracking policy.
type LastAccessTimeTrackingPolicy struct {
	BlobType                  []string               `json:"blobType,omitempty"`
	Enable                    *bool                  `json:"enable,omitempty"`
	Name                      *string                `json:"name,omitempty"`
	PropertyBag               genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	TrackingGranularityInDays *int                   `json:"trackingGranularityInDays,omitempty"`
}

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

	// BlobType
	policy.BlobType = genruntime.CloneSliceOfString(source.BlobType)

	// Enable
	if source.Enable != nil {
		enable := *source.Enable
		policy.Enable = &enable
	} else {
		policy.Enable = nil
	}

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

	// TrackingGranularityInDays
	policy.TrackingGranularityInDays = genruntime.ClonePointerToInt(source.TrackingGranularityInDays)

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

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

	// No error
	return nil
}

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

	// BlobType
	destination.BlobType = genruntime.CloneSliceOfString(policy.BlobType)

	// Enable
	if policy.Enable != nil {
		enable := *policy.Enable
		destination.Enable = &enable
	} else {
		destination.Enable = nil
	}

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

	// TrackingGranularityInDays
	destination.TrackingGranularityInDays = genruntime.ClonePointerToInt(policy.TrackingGranularityInDays)

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.LastAccessTimeTrackingPolicy_STATUS
// The blob service properties for Last access time based tracking policy.
type LastAccessTimeTrackingPolicy_STATUS struct {
	BlobType                  []string               `json:"blobType,omitempty"`
	Enable                    *bool                  `json:"enable,omitempty"`
	Name                      *string                `json:"name,omitempty"`
	PropertyBag               genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	TrackingGranularityInDays *int                   `json:"trackingGranularityInDays,omitempty"`
}

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

	// BlobType
	policy.BlobType = genruntime.CloneSliceOfString(source.BlobType)

	// Enable
	if source.Enable != nil {
		enable := *source.Enable
		policy.Enable = &enable
	} else {
		policy.Enable = nil
	}

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

	// TrackingGranularityInDays
	policy.TrackingGranularityInDays = genruntime.ClonePointerToInt(source.TrackingGranularityInDays)

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

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

	// No error
	return nil
}

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

	// BlobType
	destination.BlobType = genruntime.CloneSliceOfString(policy.BlobType)

	// Enable
	if policy.Enable != nil {
		enable := *policy.Enable
		destination.Enable = &enable
	} else {
		destination.Enable = nil
	}

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

	// TrackingGranularityInDays
	destination.TrackingGranularityInDays = genruntime.ClonePointerToInt(policy.TrackingGranularityInDays)

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.RestorePolicyProperties
// The blob service properties for blob restore policy
type RestorePolicyProperties struct {
	Days        *int                   `json:"days,omitempty"`
	Enabled     *bool                  `json:"enabled,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

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

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		properties.Enabled = &enabled
	} else {
		properties.Enabled = nil
	}

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

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

	// No error
	return nil
}

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

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

	// Enabled
	if properties.Enabled != nil {
		enabled := *properties.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.RestorePolicyProperties_STATUS
// The blob service properties for blob restore policy
type RestorePolicyProperties_STATUS struct {
	Days            *int                   `json:"days,omitempty"`
	Enabled         *bool                  `json:"enabled,omitempty"`
	LastEnabledTime *string                `json:"lastEnabledTime,omitempty"`
	MinRestoreTime  *string                `json:"minRestoreTime,omitempty"`
	PropertyBag     genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

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

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		properties.Enabled = &enabled
	} else {
		properties.Enabled = nil
	}

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

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

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

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

	// No error
	return nil
}

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

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

	// Enabled
	if properties.Enabled != nil {
		enabled := *properties.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

type augmentConversionForChangeFeed interface {
	AssignPropertiesFrom(src *storage.ChangeFeed) error
	AssignPropertiesTo(dst *storage.ChangeFeed) error
}

type augmentConversionForChangeFeed_STATUS interface {
	AssignPropertiesFrom(src *storage.ChangeFeed_STATUS) error
	AssignPropertiesTo(dst *storage.ChangeFeed_STATUS) error
}

type augmentConversionForCorsRules interface {
	AssignPropertiesFrom(src *storage.CorsRules) error
	AssignPropertiesTo(dst *storage.CorsRules) error
}

type augmentConversionForCorsRules_STATUS interface {
	AssignPropertiesFrom(src *storage.CorsRules_STATUS) error
	AssignPropertiesTo(dst *storage.CorsRules_STATUS) error
}

type augmentConversionForDeleteRetentionPolicy interface {
	AssignPropertiesFrom(src *storage.DeleteRetentionPolicy) error
	AssignPropertiesTo(dst *storage.DeleteRetentionPolicy) error
}

type augmentConversionForDeleteRetentionPolicy_STATUS interface {
	AssignPropertiesFrom(src *storage.DeleteRetentionPolicy_STATUS) error
	AssignPropertiesTo(dst *storage.DeleteRetentionPolicy_STATUS) error
}

type augmentConversionForLastAccessTimeTrackingPolicy interface {
	AssignPropertiesFrom(src *storage.LastAccessTimeTrackingPolicy) error
	AssignPropertiesTo(dst *storage.LastAccessTimeTrackingPolicy) error
}

type augmentConversionForLastAccessTimeTrackingPolicy_STATUS interface {
	AssignPropertiesFrom(src *storage.LastAccessTimeTrackingPolicy_STATUS) error
	AssignPropertiesTo(dst *storage.LastAccessTimeTrackingPolicy_STATUS) error
}

type augmentConversionForRestorePolicyProperties interface {
	AssignPropertiesFrom(src *storage.RestorePolicyProperties) error
	AssignPropertiesTo(dst *storage.RestorePolicyProperties) error
}

type augmentConversionForRestorePolicyProperties_STATUS interface {
	AssignPropertiesFrom(src *storage.RestorePolicyProperties_STATUS) error
	AssignPropertiesTo(dst *storage.RestorePolicyProperties_STATUS) error
}

type augmentConversionForStorageAccountsBlobServiceOperatorSpec interface {
	AssignPropertiesFrom(src *storage.StorageAccountsBlobServiceOperatorSpec) error
	AssignPropertiesTo(dst *storage.StorageAccountsBlobServiceOperatorSpec) error
}

// Storage version of v1api20220901.CorsRule
// Specifies a CORS rule for the Blob service.
type CorsRule struct {
	AllowedHeaders  []string               `json:"allowedHeaders,omitempty"`
	AllowedMethods  []string               `json:"allowedMethods,omitempty"`
	AllowedOrigins  []string               `json:"allowedOrigins,omitempty"`
	ExposedHeaders  []string               `json:"exposedHeaders,omitempty"`
	MaxAgeInSeconds *int                   `json:"maxAgeInSeconds,omitempty"`
	PropertyBag     genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

	// AllowedHeaders
	rule.AllowedHeaders = genruntime.CloneSliceOfString(source.AllowedHeaders)

	// AllowedMethods
	rule.AllowedMethods = genruntime.CloneSliceOfString(source.AllowedMethods)

	// AllowedOrigins
	rule.AllowedOrigins = genruntime.CloneSliceOfString(source.AllowedOrigins)

	// ExposedHeaders
	rule.ExposedHeaders = genruntime.CloneSliceOfString(source.ExposedHeaders)

	// MaxAgeInSeconds
	rule.MaxAgeInSeconds = genruntime.ClonePointerToInt(source.MaxAgeInSeconds)

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

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

	// No error
	return nil
}

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

	// AllowedHeaders
	destination.AllowedHeaders = genruntime.CloneSliceOfString(rule.AllowedHeaders)

	// AllowedMethods
	destination.AllowedMethods = genruntime.CloneSliceOfString(rule.AllowedMethods)

	// AllowedOrigins
	destination.AllowedOrigins = genruntime.CloneSliceOfString(rule.AllowedOrigins)

	// ExposedHeaders
	destination.ExposedHeaders = genruntime.CloneSliceOfString(rule.ExposedHeaders)

	// MaxAgeInSeconds
	destination.MaxAgeInSeconds = genruntime.ClonePointerToInt(rule.MaxAgeInSeconds)

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

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

	// No error
	return nil
}

// Storage version of v1api20220901.CorsRule_STATUS
// Specifies a CORS rule for the Blob service.
type CorsRule_STATUS struct {
	AllowedHeaders  []string               `json:"allowedHeaders,omitempty"`
	AllowedMethods  []string               `json:"allowedMethods,omitempty"`
	AllowedOrigins  []string               `json:"allowedOrigins,omitempty"`
	ExposedHeaders  []string               `json:"exposedHeaders,omitempty"`
	MaxAgeInSeconds *int                   `json:"maxAgeInSeconds,omitempty"`
	PropertyBag     genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

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

	// AllowedHeaders
	rule.AllowedHeaders = genruntime.CloneSliceOfString(source.AllowedHeaders)

	// AllowedMethods
	rule.AllowedMethods = genruntime.CloneSliceOfString(source.AllowedMethods)

	// AllowedOrigins
	rule.AllowedOrigins = genruntime.CloneSliceOfString(source.AllowedOrigins)

	// ExposedHeaders
	rule.ExposedHeaders = genruntime.CloneSliceOfString(source.ExposedHeaders)

	// MaxAgeInSeconds
	rule.MaxAgeInSeconds = genruntime.ClonePointerToInt(source.MaxAgeInSeconds)

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

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

	// No error
	return nil
}

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

	// AllowedHeaders
	destination.AllowedHeaders = genruntime.CloneSliceOfString(rule.AllowedHeaders)

	// AllowedMethods
	destination.AllowedMethods = genruntime.CloneSliceOfString(rule.AllowedMethods)

	// AllowedOrigins
	destination.AllowedOrigins = genruntime.CloneSliceOfString(rule.AllowedOrigins)

	// ExposedHeaders
	destination.ExposedHeaders = genruntime.CloneSliceOfString(rule.ExposedHeaders)

	// MaxAgeInSeconds
	destination.MaxAgeInSeconds = genruntime.ClonePointerToInt(rule.MaxAgeInSeconds)

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

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

	// No error
	return nil
}

type augmentConversionForCorsRule interface {
	AssignPropertiesFrom(src *storage.CorsRule) error
	AssignPropertiesTo(dst *storage.CorsRule) error
}

type augmentConversionForCorsRule_STATUS interface {
	AssignPropertiesFrom(src *storage.CorsRule_STATUS) error
	AssignPropertiesTo(dst *storage.CorsRule_STATUS) error
}

func init() {
	SchemeBuilder.Register(&StorageAccountsBlobService{}, &StorageAccountsBlobServiceList{})
}
