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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/containerservice/v1api20230315preview/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/containerservice/v1api20230315preview/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"
	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
	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,containerservice}
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Generator information:
// - Generated from: /containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/fleets.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}
type FleetsUpdateRun struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              FleetsUpdateRun_Spec   `json:"spec,omitempty"`
	Status            FleetsUpdateRun_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &FleetsUpdateRun{}

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

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

var _ conversion.Convertible = &FleetsUpdateRun{}

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

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

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

	return nil
}

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

	return nil
}

var _ configmaps.Exporter = &FleetsUpdateRun{}

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

var _ secrets.Exporter = &FleetsUpdateRun{}

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

var _ genruntime.KubernetesResource = &FleetsUpdateRun{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2023-03-15-preview"
func (updateRun FleetsUpdateRun) GetAPIVersion() string {
	return "2023-03-15-preview"
}

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.ContainerService/fleets/updateRuns"
func (updateRun *FleetsUpdateRun) GetType() string {
	return "Microsoft.ContainerService/fleets/updateRuns"
}

// NewEmptyStatus returns a new empty (blank) status
func (updateRun *FleetsUpdateRun) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &FleetsUpdateRun_STATUS{}
}

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

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

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

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

	updateRun.Status = st
	return nil
}

// AssignProperties_From_FleetsUpdateRun populates our FleetsUpdateRun from the provided source FleetsUpdateRun
func (updateRun *FleetsUpdateRun) AssignProperties_From_FleetsUpdateRun(source *storage.FleetsUpdateRun) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_FleetsUpdateRun populates the provided destination FleetsUpdateRun from our FleetsUpdateRun
func (updateRun *FleetsUpdateRun) AssignProperties_To_FleetsUpdateRun(destination *storage.FleetsUpdateRun) error {

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

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

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

	// No error
	return nil
}

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/fleets.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}
type FleetsUpdateRunList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []FleetsUpdateRun `json:"items"`
}

type FleetsUpdateRun_Spec struct {
	// +kubebuilder:validation:MaxLength=50
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
	// 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"`

	// +kubebuilder:validation:Required
	// ManagedClusterUpdate: The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be
	// modified until the run is started.
	ManagedClusterUpdate *ManagedClusterUpdate `json:"managedClusterUpdate,omitempty"`

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *FleetsUpdateRunOperatorSpec `json:"operatorSpec,omitempty"`

	// +kubebuilder:validation:Required
	// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
	// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
	// reference to a containerservice.azure.com/Fleet resource
	Owner *genruntime.KnownResourceReference `group:"containerservice.azure.com" json:"owner,omitempty" kind:"Fleet"`

	// Strategy: The strategy defines the order in which the clusters will be updated.
	// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single
	// UpdateGroup targeting all members.
	// The strategy of the UpdateRun can be modified until the run is started.
	Strategy *UpdateRunStrategy `json:"strategy,omitempty"`
}

var _ genruntime.ARMTransformer = &FleetsUpdateRun_Spec{}

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

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

	// Set property "Properties":
	if updateRun.ManagedClusterUpdate != nil || updateRun.Strategy != nil {
		result.Properties = &arm.UpdateRunProperties{}
	}
	if updateRun.ManagedClusterUpdate != nil {
		managedClusterUpdate_ARM, err := updateRun.ManagedClusterUpdate.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		managedClusterUpdate := *managedClusterUpdate_ARM.(*arm.ManagedClusterUpdate)
		result.Properties.ManagedClusterUpdate = &managedClusterUpdate
	}
	if updateRun.Strategy != nil {
		strategy_ARM, err := updateRun.Strategy.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		strategy := *strategy_ARM.(*arm.UpdateRunStrategy)
		result.Properties.Strategy = &strategy
	}
	return result, nil
}

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

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

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

	// Set property "ManagedClusterUpdate":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ManagedClusterUpdate != nil {
			var managedClusterUpdate1 ManagedClusterUpdate
			err := managedClusterUpdate1.PopulateFromARM(owner, *typedInput.Properties.ManagedClusterUpdate)
			if err != nil {
				return err
			}
			managedClusterUpdate := managedClusterUpdate1
			updateRun.ManagedClusterUpdate = &managedClusterUpdate
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "Strategy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Strategy != nil {
			var strategy1 UpdateRunStrategy
			err := strategy1.PopulateFromARM(owner, *typedInput.Properties.Strategy)
			if err != nil {
				return err
			}
			strategy := strategy1
			updateRun.Strategy = &strategy
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &FleetsUpdateRun_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.FleetsUpdateRun_Spec{}
	err := updateRun.AssignProperties_To_FleetsUpdateRun_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_FleetsUpdateRun_Spec populates our FleetsUpdateRun_Spec from the provided source FleetsUpdateRun_Spec
func (updateRun *FleetsUpdateRun_Spec) AssignProperties_From_FleetsUpdateRun_Spec(source *storage.FleetsUpdateRun_Spec) error {

	// AzureName
	updateRun.AzureName = source.AzureName

	// ManagedClusterUpdate
	if source.ManagedClusterUpdate != nil {
		var managedClusterUpdate ManagedClusterUpdate
		err := managedClusterUpdate.AssignProperties_From_ManagedClusterUpdate(source.ManagedClusterUpdate)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ManagedClusterUpdate() to populate field ManagedClusterUpdate")
		}
		updateRun.ManagedClusterUpdate = &managedClusterUpdate
	} else {
		updateRun.ManagedClusterUpdate = nil
	}

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

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

	// Strategy
	if source.Strategy != nil {
		var strategy UpdateRunStrategy
		err := strategy.AssignProperties_From_UpdateRunStrategy(source.Strategy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UpdateRunStrategy() to populate field Strategy")
		}
		updateRun.Strategy = &strategy
	} else {
		updateRun.Strategy = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = updateRun.AzureName

	// ManagedClusterUpdate
	if updateRun.ManagedClusterUpdate != nil {
		var managedClusterUpdate storage.ManagedClusterUpdate
		err := updateRun.ManagedClusterUpdate.AssignProperties_To_ManagedClusterUpdate(&managedClusterUpdate)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterUpdate() to populate field ManagedClusterUpdate")
		}
		destination.ManagedClusterUpdate = &managedClusterUpdate
	} else {
		destination.ManagedClusterUpdate = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = updateRun.OriginalVersion()

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

	// Strategy
	if updateRun.Strategy != nil {
		var strategy storage.UpdateRunStrategy
		err := updateRun.Strategy.AssignProperties_To_UpdateRunStrategy(&strategy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UpdateRunStrategy() to populate field Strategy")
		}
		destination.Strategy = &strategy
	} else {
		destination.Strategy = nil
	}

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

	// No error
	return nil
}

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

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

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

	// ETag: If eTag is provided in the response body, it may also be provided as a header per the normal etag convention.
	// Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in
	// the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header
	// fields.
	ETag *string `json:"eTag,omitempty"`

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

	// ManagedClusterUpdate: The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be
	// modified until the run is started.
	ManagedClusterUpdate *ManagedClusterUpdate_STATUS `json:"managedClusterUpdate,omitempty"`

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

	// ProvisioningState: The provisioning state of the UpdateRun resource.
	ProvisioningState *UpdateRunProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// Status: The status of the UpdateRun.
	Status *UpdateRunStatus_STATUS `json:"status,omitempty"`

	// Strategy: The strategy defines the order in which the clusters will be updated.
	// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single
	// UpdateGroup targeting all members.
	// The strategy of the UpdateRun can be modified until the run is started.
	Strategy *UpdateRunStrategy_STATUS `json:"strategy,omitempty"`

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

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

var _ genruntime.ConvertibleStatus = &FleetsUpdateRun_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.FleetsUpdateRun_STATUS{}
	err := updateRun.AssignProperties_To_FleetsUpdateRun_STATUS(dst)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertStatusTo()")
	}

	// Update dst from our instance
	err = dst.ConvertStatusTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusTo()")
	}

	return nil
}

var _ genruntime.FromARMConverter = &FleetsUpdateRun_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "ETag":
	if typedInput.ETag != nil {
		eTag := *typedInput.ETag
		updateRun.ETag = &eTag
	}

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

	// Set property "ManagedClusterUpdate":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ManagedClusterUpdate != nil {
			var managedClusterUpdate1 ManagedClusterUpdate_STATUS
			err := managedClusterUpdate1.PopulateFromARM(owner, *typedInput.Properties.ManagedClusterUpdate)
			if err != nil {
				return err
			}
			managedClusterUpdate := managedClusterUpdate1
			updateRun.ManagedClusterUpdate = &managedClusterUpdate
		}
	}

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

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

	// Set property "Status":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Status != nil {
			var status1 UpdateRunStatus_STATUS
			err := status1.PopulateFromARM(owner, *typedInput.Properties.Status)
			if err != nil {
				return err
			}
			status := status1
			updateRun.Status = &status
		}
	}

	// Set property "Strategy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Strategy != nil {
			var strategy1 UpdateRunStrategy_STATUS
			err := strategy1.PopulateFromARM(owner, *typedInput.Properties.Strategy)
			if err != nil {
				return err
			}
			strategy := strategy1
			updateRun.Strategy = &strategy
		}
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_FleetsUpdateRun_STATUS populates our FleetsUpdateRun_STATUS from the provided source FleetsUpdateRun_STATUS
func (updateRun *FleetsUpdateRun_STATUS) AssignProperties_From_FleetsUpdateRun_STATUS(source *storage.FleetsUpdateRun_STATUS) error {

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

	// ETag
	updateRun.ETag = genruntime.ClonePointerToString(source.ETag)

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

	// ManagedClusterUpdate
	if source.ManagedClusterUpdate != nil {
		var managedClusterUpdate ManagedClusterUpdate_STATUS
		err := managedClusterUpdate.AssignProperties_From_ManagedClusterUpdate_STATUS(source.ManagedClusterUpdate)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ManagedClusterUpdate_STATUS() to populate field ManagedClusterUpdate")
		}
		updateRun.ManagedClusterUpdate = &managedClusterUpdate
	} else {
		updateRun.ManagedClusterUpdate = nil
	}

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

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

	// Status
	if source.Status != nil {
		var status UpdateRunStatus_STATUS
		err := status.AssignProperties_From_UpdateRunStatus_STATUS(source.Status)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UpdateRunStatus_STATUS() to populate field Status")
		}
		updateRun.Status = &status
	} else {
		updateRun.Status = nil
	}

	// Strategy
	if source.Strategy != nil {
		var strategy UpdateRunStrategy_STATUS
		err := strategy.AssignProperties_From_UpdateRunStrategy_STATUS(source.Strategy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UpdateRunStrategy_STATUS() to populate field Strategy")
		}
		updateRun.Strategy = &strategy
	} else {
		updateRun.Strategy = nil
	}

	// SystemData
	if source.SystemData != nil {
		var systemDatum SystemData_STATUS
		err := systemDatum.AssignProperties_From_SystemData_STATUS(source.SystemData)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData")
		}
		updateRun.SystemData = &systemDatum
	} else {
		updateRun.SystemData = nil
	}

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

	// No error
	return nil
}

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

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

	// ETag
	destination.ETag = genruntime.ClonePointerToString(updateRun.ETag)

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

	// ManagedClusterUpdate
	if updateRun.ManagedClusterUpdate != nil {
		var managedClusterUpdate storage.ManagedClusterUpdate_STATUS
		err := updateRun.ManagedClusterUpdate.AssignProperties_To_ManagedClusterUpdate_STATUS(&managedClusterUpdate)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterUpdate_STATUS() to populate field ManagedClusterUpdate")
		}
		destination.ManagedClusterUpdate = &managedClusterUpdate
	} else {
		destination.ManagedClusterUpdate = nil
	}

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

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

	// Status
	if updateRun.Status != nil {
		var status storage.UpdateRunStatus_STATUS
		err := updateRun.Status.AssignProperties_To_UpdateRunStatus_STATUS(&status)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UpdateRunStatus_STATUS() to populate field Status")
		}
		destination.Status = &status
	} else {
		destination.Status = nil
	}

	// Strategy
	if updateRun.Strategy != nil {
		var strategy storage.UpdateRunStrategy_STATUS
		err := updateRun.Strategy.AssignProperties_To_UpdateRunStrategy_STATUS(&strategy)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UpdateRunStrategy_STATUS() to populate field Strategy")
		}
		destination.Strategy = &strategy
	} else {
		destination.Strategy = nil
	}

	// SystemData
	if updateRun.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := updateRun.SystemData.AssignProperties_To_SystemData_STATUS(&systemDatum)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SystemData_STATUS() to populate field SystemData")
		}
		destination.SystemData = &systemDatum
	} else {
		destination.SystemData = nil
	}

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

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

// The update to be applied to the ManagedClusters.
type ManagedClusterUpdate struct {
	// +kubebuilder:validation:Required
	// Upgrade: The upgrade to apply to the ManagedClusters.
	Upgrade *ManagedClusterUpgradeSpec `json:"upgrade,omitempty"`
}

var _ genruntime.ARMTransformer = &ManagedClusterUpdate{}

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

	// Set property "Upgrade":
	if update.Upgrade != nil {
		upgrade_ARM, err := update.Upgrade.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		upgrade := *upgrade_ARM.(*arm.ManagedClusterUpgradeSpec)
		result.Upgrade = &upgrade
	}
	return result, nil
}

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

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

	// Set property "Upgrade":
	if typedInput.Upgrade != nil {
		var upgrade1 ManagedClusterUpgradeSpec
		err := upgrade1.PopulateFromARM(owner, *typedInput.Upgrade)
		if err != nil {
			return err
		}
		upgrade := upgrade1
		update.Upgrade = &upgrade
	}

	// No error
	return nil
}

// AssignProperties_From_ManagedClusterUpdate populates our ManagedClusterUpdate from the provided source ManagedClusterUpdate
func (update *ManagedClusterUpdate) AssignProperties_From_ManagedClusterUpdate(source *storage.ManagedClusterUpdate) error {

	// Upgrade
	if source.Upgrade != nil {
		var upgrade ManagedClusterUpgradeSpec
		err := upgrade.AssignProperties_From_ManagedClusterUpgradeSpec(source.Upgrade)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ManagedClusterUpgradeSpec() to populate field Upgrade")
		}
		update.Upgrade = &upgrade
	} else {
		update.Upgrade = nil
	}

	// No error
	return nil
}

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

	// Upgrade
	if update.Upgrade != nil {
		var upgrade storage.ManagedClusterUpgradeSpec
		err := update.Upgrade.AssignProperties_To_ManagedClusterUpgradeSpec(&upgrade)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterUpgradeSpec() to populate field Upgrade")
		}
		destination.Upgrade = &upgrade
	} else {
		destination.Upgrade = nil
	}

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

	// No error
	return nil
}

// The update to be applied to the ManagedClusters.
type ManagedClusterUpdate_STATUS struct {
	// Upgrade: The upgrade to apply to the ManagedClusters.
	Upgrade *ManagedClusterUpgradeSpec_STATUS `json:"upgrade,omitempty"`
}

var _ genruntime.FromARMConverter = &ManagedClusterUpdate_STATUS{}

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

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

	// Set property "Upgrade":
	if typedInput.Upgrade != nil {
		var upgrade1 ManagedClusterUpgradeSpec_STATUS
		err := upgrade1.PopulateFromARM(owner, *typedInput.Upgrade)
		if err != nil {
			return err
		}
		upgrade := upgrade1
		update.Upgrade = &upgrade
	}

	// No error
	return nil
}

// AssignProperties_From_ManagedClusterUpdate_STATUS populates our ManagedClusterUpdate_STATUS from the provided source ManagedClusterUpdate_STATUS
func (update *ManagedClusterUpdate_STATUS) AssignProperties_From_ManagedClusterUpdate_STATUS(source *storage.ManagedClusterUpdate_STATUS) error {

	// Upgrade
	if source.Upgrade != nil {
		var upgrade ManagedClusterUpgradeSpec_STATUS
		err := upgrade.AssignProperties_From_ManagedClusterUpgradeSpec_STATUS(source.Upgrade)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ManagedClusterUpgradeSpec_STATUS() to populate field Upgrade")
		}
		update.Upgrade = &upgrade
	} else {
		update.Upgrade = nil
	}

	// No error
	return nil
}

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

	// Upgrade
	if update.Upgrade != nil {
		var upgrade storage.ManagedClusterUpgradeSpec_STATUS
		err := update.Upgrade.AssignProperties_To_ManagedClusterUpgradeSpec_STATUS(&upgrade)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ManagedClusterUpgradeSpec_STATUS() to populate field Upgrade")
		}
		destination.Upgrade = &upgrade
	} else {
		destination.Upgrade = nil
	}

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

	// No error
	return nil
}

// The provisioning state of the UpdateRun resource.
type UpdateRunProvisioningState_STATUS string

const (
	UpdateRunProvisioningState_STATUS_Canceled  = UpdateRunProvisioningState_STATUS("Canceled")
	UpdateRunProvisioningState_STATUS_Failed    = UpdateRunProvisioningState_STATUS("Failed")
	UpdateRunProvisioningState_STATUS_Succeeded = UpdateRunProvisioningState_STATUS("Succeeded")
)

// Mapping from string to UpdateRunProvisioningState_STATUS
var updateRunProvisioningState_STATUS_Values = map[string]UpdateRunProvisioningState_STATUS{
	"canceled":  UpdateRunProvisioningState_STATUS_Canceled,
	"failed":    UpdateRunProvisioningState_STATUS_Failed,
	"succeeded": UpdateRunProvisioningState_STATUS_Succeeded,
}

// The status of a UpdateRun.
type UpdateRunStatus_STATUS struct {
	// Stages: The stages composing an update run. Stages are run sequentially withing an UpdateRun.
	Stages []UpdateStageStatus_STATUS `json:"stages,omitempty"`

	// Status: The status of the UpdateRun.
	Status *UpdateStatus_STATUS `json:"status,omitempty"`
}

var _ genruntime.FromARMConverter = &UpdateRunStatus_STATUS{}

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

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

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

	// Set property "Status":
	if typedInput.Status != nil {
		var status2 UpdateStatus_STATUS
		err := status2.PopulateFromARM(owner, *typedInput.Status)
		if err != nil {
			return err
		}
		status1 := status2
		status.Status = &status1
	}

	// No error
	return nil
}

// AssignProperties_From_UpdateRunStatus_STATUS populates our UpdateRunStatus_STATUS from the provided source UpdateRunStatus_STATUS
func (status *UpdateRunStatus_STATUS) AssignProperties_From_UpdateRunStatus_STATUS(source *storage.UpdateRunStatus_STATUS) error {

	// Stages
	if source.Stages != nil {
		stageList := make([]UpdateStageStatus_STATUS, len(source.Stages))
		for stageIndex, stageItem := range source.Stages {
			var stage UpdateStageStatus_STATUS
			err := stage.AssignProperties_From_UpdateStageStatus_STATUS(&stageItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UpdateStageStatus_STATUS() to populate field Stages")
			}
			stageList[stageIndex] = stage
		}
		status.Stages = stageList
	} else {
		status.Stages = nil
	}

	// Status
	if source.Status != nil {
		var statusLocal UpdateStatus_STATUS
		err := statusLocal.AssignProperties_From_UpdateStatus_STATUS(source.Status)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UpdateStatus_STATUS() to populate field Status")
		}
		status.Status = &statusLocal
	} else {
		status.Status = nil
	}

	// No error
	return nil
}

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

	// Stages
	if status.Stages != nil {
		stageList := make([]storage.UpdateStageStatus_STATUS, len(status.Stages))
		for stageIndex, stageItem := range status.Stages {
			var stage storage.UpdateStageStatus_STATUS
			err := stageItem.AssignProperties_To_UpdateStageStatus_STATUS(&stage)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UpdateStageStatus_STATUS() to populate field Stages")
			}
			stageList[stageIndex] = stage
		}
		destination.Stages = stageList
	} else {
		destination.Stages = nil
	}

	// Status
	if status.Status != nil {
		var statusLocal storage.UpdateStatus_STATUS
		err := status.Status.AssignProperties_To_UpdateStatus_STATUS(&statusLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UpdateStatus_STATUS() to populate field Status")
		}
		destination.Status = &statusLocal
	} else {
		destination.Status = nil
	}

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

	// No error
	return nil
}

// Defines the update sequence of the clusters via stages and groups.
// Stages within a run are executed sequentially one
// after another.
// Groups within a stage are executed in parallel.
// Member clusters within a group are updated sequentially
// one after another.
// A valid strategy contains no duplicate groups within or across stages.
type UpdateRunStrategy struct {
	// +kubebuilder:validation:Required
	// Stages: The list of stages that compose this update run. Min size: 1.
	Stages []UpdateStage `json:"stages,omitempty"`
}

var _ genruntime.ARMTransformer = &UpdateRunStrategy{}

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_UpdateRunStrategy populates our UpdateRunStrategy from the provided source UpdateRunStrategy
func (strategy *UpdateRunStrategy) AssignProperties_From_UpdateRunStrategy(source *storage.UpdateRunStrategy) error {

	// Stages
	if source.Stages != nil {
		stageList := make([]UpdateStage, len(source.Stages))
		for stageIndex, stageItem := range source.Stages {
			var stage UpdateStage
			err := stage.AssignProperties_From_UpdateStage(&stageItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UpdateStage() to populate field Stages")
			}
			stageList[stageIndex] = stage
		}
		strategy.Stages = stageList
	} else {
		strategy.Stages = nil
	}

	// No error
	return nil
}

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

	// Stages
	if strategy.Stages != nil {
		stageList := make([]storage.UpdateStage, len(strategy.Stages))
		for stageIndex, stageItem := range strategy.Stages {
			var stage storage.UpdateStage
			err := stageItem.AssignProperties_To_UpdateStage(&stage)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UpdateStage() to populate field Stages")
			}
			stageList[stageIndex] = stage
		}
		destination.Stages = stageList
	} else {
		destination.Stages = nil
	}

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

	// No error
	return nil
}

// Defines the update sequence of the clusters via stages and groups.
// Stages within a run are executed sequentially one
// after another.
// Groups within a stage are executed in parallel.
// Member clusters within a group are updated sequentially
// one after another.
// A valid strategy contains no duplicate groups within or across stages.
type UpdateRunStrategy_STATUS struct {
	// Stages: The list of stages that compose this update run. Min size: 1.
	Stages []UpdateStage_STATUS `json:"stages,omitempty"`
}

var _ genruntime.FromARMConverter = &UpdateRunStrategy_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_UpdateRunStrategy_STATUS populates our UpdateRunStrategy_STATUS from the provided source UpdateRunStrategy_STATUS
func (strategy *UpdateRunStrategy_STATUS) AssignProperties_From_UpdateRunStrategy_STATUS(source *storage.UpdateRunStrategy_STATUS) error {

	// Stages
	if source.Stages != nil {
		stageList := make([]UpdateStage_STATUS, len(source.Stages))
		for stageIndex, stageItem := range source.Stages {
			var stage UpdateStage_STATUS
			err := stage.AssignProperties_From_UpdateStage_STATUS(&stageItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UpdateStage_STATUS() to populate field Stages")
			}
			stageList[stageIndex] = stage
		}
		strategy.Stages = stageList
	} else {
		strategy.Stages = nil
	}

	// No error
	return nil
}

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

	// Stages
	if strategy.Stages != nil {
		stageList := make([]storage.UpdateStage_STATUS, len(strategy.Stages))
		for stageIndex, stageItem := range strategy.Stages {
			var stage storage.UpdateStage_STATUS
			err := stageItem.AssignProperties_To_UpdateStage_STATUS(&stage)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UpdateStage_STATUS() to populate field Stages")
			}
			stageList[stageIndex] = stage
		}
		destination.Stages = stageList
	} else {
		destination.Stages = nil
	}

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

	// No error
	return nil
}

// The upgrade to apply to a ManagedCluster.
type ManagedClusterUpgradeSpec struct {
	// KubernetesVersion: The Kubernetes version to upgrade the member clusters to.
	KubernetesVersion *string `json:"kubernetesVersion,omitempty"`

	// +kubebuilder:validation:Required
	// Type: ManagedClusterUpgradeType is the type of upgrade to be applied.
	Type *ManagedClusterUpgradeType `json:"type,omitempty"`
}

var _ genruntime.ARMTransformer = &ManagedClusterUpgradeSpec{}

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

	// Set property "KubernetesVersion":
	if upgrade.KubernetesVersion != nil {
		kubernetesVersion := *upgrade.KubernetesVersion
		result.KubernetesVersion = &kubernetesVersion
	}

	// Set property "Type":
	if upgrade.Type != nil {
		var temp string
		temp = string(*upgrade.Type)
		typeVar := arm.ManagedClusterUpgradeType(temp)
		result.Type = &typeVar
	}
	return result, nil
}

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

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

	// Set property "KubernetesVersion":
	if typedInput.KubernetesVersion != nil {
		kubernetesVersion := *typedInput.KubernetesVersion
		upgrade.KubernetesVersion = &kubernetesVersion
	}

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

	// No error
	return nil
}

// AssignProperties_From_ManagedClusterUpgradeSpec populates our ManagedClusterUpgradeSpec from the provided source ManagedClusterUpgradeSpec
func (upgrade *ManagedClusterUpgradeSpec) AssignProperties_From_ManagedClusterUpgradeSpec(source *storage.ManagedClusterUpgradeSpec) error {

	// KubernetesVersion
	upgrade.KubernetesVersion = genruntime.ClonePointerToString(source.KubernetesVersion)

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

	// No error
	return nil
}

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

	// KubernetesVersion
	destination.KubernetesVersion = genruntime.ClonePointerToString(upgrade.KubernetesVersion)

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

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

	// No error
	return nil
}

// The upgrade to apply to a ManagedCluster.
type ManagedClusterUpgradeSpec_STATUS struct {
	// KubernetesVersion: The Kubernetes version to upgrade the member clusters to.
	KubernetesVersion *string `json:"kubernetesVersion,omitempty"`

	// Type: ManagedClusterUpgradeType is the type of upgrade to be applied.
	Type *ManagedClusterUpgradeType_STATUS `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &ManagedClusterUpgradeSpec_STATUS{}

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

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

	// Set property "KubernetesVersion":
	if typedInput.KubernetesVersion != nil {
		kubernetesVersion := *typedInput.KubernetesVersion
		upgrade.KubernetesVersion = &kubernetesVersion
	}

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

	// No error
	return nil
}

// AssignProperties_From_ManagedClusterUpgradeSpec_STATUS populates our ManagedClusterUpgradeSpec_STATUS from the provided source ManagedClusterUpgradeSpec_STATUS
func (upgrade *ManagedClusterUpgradeSpec_STATUS) AssignProperties_From_ManagedClusterUpgradeSpec_STATUS(source *storage.ManagedClusterUpgradeSpec_STATUS) error {

	// KubernetesVersion
	upgrade.KubernetesVersion = genruntime.ClonePointerToString(source.KubernetesVersion)

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

	// No error
	return nil
}

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

	// KubernetesVersion
	destination.KubernetesVersion = genruntime.ClonePointerToString(upgrade.KubernetesVersion)

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

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

	// No error
	return nil
}

// Defines a stage which contains the groups to update and the steps to take (e.g., wait for a time period) before starting
// the next stage.
type UpdateStage struct {
	// AfterStageWaitInSeconds: The time in seconds to wait at the end of this stage before starting the next one. Defaults to
	// 0 seconds if unspecified.
	AfterStageWaitInSeconds *int `json:"afterStageWaitInSeconds,omitempty"`

	// Groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1.
	Groups []UpdateGroup `json:"groups,omitempty"`

	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=50
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
	// Name: The name of the stage. Must be unique within the UpdateRun.
	Name *string `json:"name,omitempty"`
}

var _ genruntime.ARMTransformer = &UpdateStage{}

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

	// Set property "AfterStageWaitInSeconds":
	if stage.AfterStageWaitInSeconds != nil {
		afterStageWaitInSeconds := *stage.AfterStageWaitInSeconds
		result.AfterStageWaitInSeconds = &afterStageWaitInSeconds
	}

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

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

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

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

	// Set property "AfterStageWaitInSeconds":
	if typedInput.AfterStageWaitInSeconds != nil {
		afterStageWaitInSeconds := *typedInput.AfterStageWaitInSeconds
		stage.AfterStageWaitInSeconds = &afterStageWaitInSeconds
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_UpdateStage populates our UpdateStage from the provided source UpdateStage
func (stage *UpdateStage) AssignProperties_From_UpdateStage(source *storage.UpdateStage) error {

	// AfterStageWaitInSeconds
	stage.AfterStageWaitInSeconds = genruntime.ClonePointerToInt(source.AfterStageWaitInSeconds)

	// Groups
	if source.Groups != nil {
		groupList := make([]UpdateGroup, len(source.Groups))
		for groupIndex, groupItem := range source.Groups {
			var group UpdateGroup
			err := group.AssignProperties_From_UpdateGroup(&groupItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UpdateGroup() to populate field Groups")
			}
			groupList[groupIndex] = group
		}
		stage.Groups = groupList
	} else {
		stage.Groups = nil
	}

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

	// No error
	return nil
}

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

	// AfterStageWaitInSeconds
	destination.AfterStageWaitInSeconds = genruntime.ClonePointerToInt(stage.AfterStageWaitInSeconds)

	// Groups
	if stage.Groups != nil {
		groupList := make([]storage.UpdateGroup, len(stage.Groups))
		for groupIndex, groupItem := range stage.Groups {
			var group storage.UpdateGroup
			err := groupItem.AssignProperties_To_UpdateGroup(&group)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UpdateGroup() to populate field Groups")
			}
			groupList[groupIndex] = group
		}
		destination.Groups = groupList
	} else {
		destination.Groups = nil
	}

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

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

	// No error
	return nil
}

// Defines a stage which contains the groups to update and the steps to take (e.g., wait for a time period) before starting
// the next stage.
type UpdateStage_STATUS struct {
	// AfterStageWaitInSeconds: The time in seconds to wait at the end of this stage before starting the next one. Defaults to
	// 0 seconds if unspecified.
	AfterStageWaitInSeconds *int `json:"afterStageWaitInSeconds,omitempty"`

	// Groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1.
	Groups []UpdateGroup_STATUS `json:"groups,omitempty"`

	// Name: The name of the stage. Must be unique within the UpdateRun.
	Name *string `json:"name,omitempty"`
}

var _ genruntime.FromARMConverter = &UpdateStage_STATUS{}

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

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

	// Set property "AfterStageWaitInSeconds":
	if typedInput.AfterStageWaitInSeconds != nil {
		afterStageWaitInSeconds := *typedInput.AfterStageWaitInSeconds
		stage.AfterStageWaitInSeconds = &afterStageWaitInSeconds
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_UpdateStage_STATUS populates our UpdateStage_STATUS from the provided source UpdateStage_STATUS
func (stage *UpdateStage_STATUS) AssignProperties_From_UpdateStage_STATUS(source *storage.UpdateStage_STATUS) error {

	// AfterStageWaitInSeconds
	stage.AfterStageWaitInSeconds = genruntime.ClonePointerToInt(source.AfterStageWaitInSeconds)

	// Groups
	if source.Groups != nil {
		groupList := make([]UpdateGroup_STATUS, len(source.Groups))
		for groupIndex, groupItem := range source.Groups {
			var group UpdateGroup_STATUS
			err := group.AssignProperties_From_UpdateGroup_STATUS(&groupItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UpdateGroup_STATUS() to populate field Groups")
			}
			groupList[groupIndex] = group
		}
		stage.Groups = groupList
	} else {
		stage.Groups = nil
	}

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

	// No error
	return nil
}

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

	// AfterStageWaitInSeconds
	destination.AfterStageWaitInSeconds = genruntime.ClonePointerToInt(stage.AfterStageWaitInSeconds)

	// Groups
	if stage.Groups != nil {
		groupList := make([]storage.UpdateGroup_STATUS, len(stage.Groups))
		for groupIndex, groupItem := range stage.Groups {
			var group storage.UpdateGroup_STATUS
			err := groupItem.AssignProperties_To_UpdateGroup_STATUS(&group)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UpdateGroup_STATUS() to populate field Groups")
			}
			groupList[groupIndex] = group
		}
		destination.Groups = groupList
	} else {
		destination.Groups = nil
	}

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

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

	// No error
	return nil
}

// The status of a UpdateStage.
type UpdateStageStatus_STATUS struct {
	// AfterStageWaitStatus: The status of the wait period configured on the UpdateStage.
	AfterStageWaitStatus *WaitStatus_STATUS `json:"afterStageWaitStatus,omitempty"`

	// Groups: The list of groups to be updated as part of this UpdateStage.
	Groups []UpdateGroupStatus_STATUS `json:"groups,omitempty"`

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

	// Status: The status of the UpdateStage.
	Status *UpdateStatus_STATUS `json:"status,omitempty"`
}

var _ genruntime.FromARMConverter = &UpdateStageStatus_STATUS{}

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

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

	// Set property "AfterStageWaitStatus":
	if typedInput.AfterStageWaitStatus != nil {
		var afterStageWaitStatus1 WaitStatus_STATUS
		err := afterStageWaitStatus1.PopulateFromARM(owner, *typedInput.AfterStageWaitStatus)
		if err != nil {
			return err
		}
		afterStageWaitStatus := afterStageWaitStatus1
		status.AfterStageWaitStatus = &afterStageWaitStatus
	}

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

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

	// Set property "Status":
	if typedInput.Status != nil {
		var status2 UpdateStatus_STATUS
		err := status2.PopulateFromARM(owner, *typedInput.Status)
		if err != nil {
			return err
		}
		status1 := status2
		status.Status = &status1
	}

	// No error
	return nil
}

// AssignProperties_From_UpdateStageStatus_STATUS populates our UpdateStageStatus_STATUS from the provided source UpdateStageStatus_STATUS
func (status *UpdateStageStatus_STATUS) AssignProperties_From_UpdateStageStatus_STATUS(source *storage.UpdateStageStatus_STATUS) error {

	// AfterStageWaitStatus
	if source.AfterStageWaitStatus != nil {
		var afterStageWaitStatus WaitStatus_STATUS
		err := afterStageWaitStatus.AssignProperties_From_WaitStatus_STATUS(source.AfterStageWaitStatus)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WaitStatus_STATUS() to populate field AfterStageWaitStatus")
		}
		status.AfterStageWaitStatus = &afterStageWaitStatus
	} else {
		status.AfterStageWaitStatus = nil
	}

	// Groups
	if source.Groups != nil {
		groupList := make([]UpdateGroupStatus_STATUS, len(source.Groups))
		for groupIndex, groupItem := range source.Groups {
			var group UpdateGroupStatus_STATUS
			err := group.AssignProperties_From_UpdateGroupStatus_STATUS(&groupItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UpdateGroupStatus_STATUS() to populate field Groups")
			}
			groupList[groupIndex] = group
		}
		status.Groups = groupList
	} else {
		status.Groups = nil
	}

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

	// Status
	if source.Status != nil {
		var statusLocal UpdateStatus_STATUS
		err := statusLocal.AssignProperties_From_UpdateStatus_STATUS(source.Status)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UpdateStatus_STATUS() to populate field Status")
		}
		status.Status = &statusLocal
	} else {
		status.Status = nil
	}

	// No error
	return nil
}

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

	// AfterStageWaitStatus
	if status.AfterStageWaitStatus != nil {
		var afterStageWaitStatus storage.WaitStatus_STATUS
		err := status.AfterStageWaitStatus.AssignProperties_To_WaitStatus_STATUS(&afterStageWaitStatus)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WaitStatus_STATUS() to populate field AfterStageWaitStatus")
		}
		destination.AfterStageWaitStatus = &afterStageWaitStatus
	} else {
		destination.AfterStageWaitStatus = nil
	}

	// Groups
	if status.Groups != nil {
		groupList := make([]storage.UpdateGroupStatus_STATUS, len(status.Groups))
		for groupIndex, groupItem := range status.Groups {
			var group storage.UpdateGroupStatus_STATUS
			err := groupItem.AssignProperties_To_UpdateGroupStatus_STATUS(&group)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UpdateGroupStatus_STATUS() to populate field Groups")
			}
			groupList[groupIndex] = group
		}
		destination.Groups = groupList
	} else {
		destination.Groups = nil
	}

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

	// Status
	if status.Status != nil {
		var statusLocal storage.UpdateStatus_STATUS
		err := status.Status.AssignProperties_To_UpdateStatus_STATUS(&statusLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UpdateStatus_STATUS() to populate field Status")
		}
		destination.Status = &statusLocal
	} else {
		destination.Status = nil
	}

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

	// No error
	return nil
}

// The status for an operation or group of operations.
type UpdateStatus_STATUS struct {
	// CompletedTime: The time the operation or group was completed.
	CompletedTime *string `json:"completedTime,omitempty"`

	// Error: The error details when a failure is encountered.
	Error *ErrorDetail_STATUS `json:"error,omitempty"`

	// StartTime: The time the operation or group was started.
	StartTime *string `json:"startTime,omitempty"`

	// State: The State of the operation or group.
	State *UpdateState_STATUS `json:"state,omitempty"`
}

var _ genruntime.FromARMConverter = &UpdateStatus_STATUS{}

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

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

	// Set property "CompletedTime":
	if typedInput.CompletedTime != nil {
		completedTime := *typedInput.CompletedTime
		status.CompletedTime = &completedTime
	}

	// Set property "Error":
	if typedInput.Error != nil {
		var error1 ErrorDetail_STATUS
		err := error1.PopulateFromARM(owner, *typedInput.Error)
		if err != nil {
			return err
		}
		error := error1
		status.Error = &error
	}

	// Set property "StartTime":
	if typedInput.StartTime != nil {
		startTime := *typedInput.StartTime
		status.StartTime = &startTime
	}

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

	// No error
	return nil
}

// AssignProperties_From_UpdateStatus_STATUS populates our UpdateStatus_STATUS from the provided source UpdateStatus_STATUS
func (status *UpdateStatus_STATUS) AssignProperties_From_UpdateStatus_STATUS(source *storage.UpdateStatus_STATUS) error {

	// CompletedTime
	status.CompletedTime = genruntime.ClonePointerToString(source.CompletedTime)

	// Error
	if source.Error != nil {
		var error ErrorDetail_STATUS
		err := error.AssignProperties_From_ErrorDetail_STATUS(source.Error)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ErrorDetail_STATUS() to populate field Error")
		}
		status.Error = &error
	} else {
		status.Error = nil
	}

	// StartTime
	status.StartTime = genruntime.ClonePointerToString(source.StartTime)

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

	// No error
	return nil
}

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

	// CompletedTime
	destination.CompletedTime = genruntime.ClonePointerToString(status.CompletedTime)

	// Error
	if status.Error != nil {
		var error storage.ErrorDetail_STATUS
		err := status.Error.AssignProperties_To_ErrorDetail_STATUS(&error)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ErrorDetail_STATUS() to populate field Error")
		}
		destination.Error = &error
	} else {
		destination.Error = nil
	}

	// StartTime
	destination.StartTime = genruntime.ClonePointerToString(status.StartTime)

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

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

	// No error
	return nil
}

// The error detail.
type ErrorDetail_STATUS struct {
	// AdditionalInfo: The error additional info.
	AdditionalInfo []ErrorAdditionalInfo_STATUS `json:"additionalInfo,omitempty"`

	// Code: The error code.
	Code *string `json:"code,omitempty"`

	// Details: The error details.
	Details []ErrorDetail_STATUS_Unrolled `json:"details,omitempty"`

	// Message: The error message.
	Message *string `json:"message,omitempty"`

	// Target: The error target.
	Target *string `json:"target,omitempty"`
}

var _ genruntime.FromARMConverter = &ErrorDetail_STATUS{}

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

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

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

	// Set property "Code":
	if typedInput.Code != nil {
		code := *typedInput.Code
		detail.Code = &code
	}

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

	// Set property "Message":
	if typedInput.Message != nil {
		message := *typedInput.Message
		detail.Message = &message
	}

	// Set property "Target":
	if typedInput.Target != nil {
		target := *typedInput.Target
		detail.Target = &target
	}

	// No error
	return nil
}

// AssignProperties_From_ErrorDetail_STATUS populates our ErrorDetail_STATUS from the provided source ErrorDetail_STATUS
func (detail *ErrorDetail_STATUS) AssignProperties_From_ErrorDetail_STATUS(source *storage.ErrorDetail_STATUS) error {

	// AdditionalInfo
	if source.AdditionalInfo != nil {
		additionalInfoList := make([]ErrorAdditionalInfo_STATUS, len(source.AdditionalInfo))
		for additionalInfoIndex, additionalInfoItem := range source.AdditionalInfo {
			var additionalInfo ErrorAdditionalInfo_STATUS
			err := additionalInfo.AssignProperties_From_ErrorAdditionalInfo_STATUS(&additionalInfoItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ErrorAdditionalInfo_STATUS() to populate field AdditionalInfo")
			}
			additionalInfoList[additionalInfoIndex] = additionalInfo
		}
		detail.AdditionalInfo = additionalInfoList
	} else {
		detail.AdditionalInfo = nil
	}

	// Code
	detail.Code = genruntime.ClonePointerToString(source.Code)

	// Details
	if source.Details != nil {
		detailList := make([]ErrorDetail_STATUS_Unrolled, len(source.Details))
		for detailIndex, detailItem := range source.Details {
			var detailLocal ErrorDetail_STATUS_Unrolled
			err := detailLocal.AssignProperties_From_ErrorDetail_STATUS_Unrolled(&detailItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ErrorDetail_STATUS_Unrolled() to populate field Details")
			}
			detailList[detailIndex] = detailLocal
		}
		detail.Details = detailList
	} else {
		detail.Details = nil
	}

	// Message
	detail.Message = genruntime.ClonePointerToString(source.Message)

	// Target
	detail.Target = genruntime.ClonePointerToString(source.Target)

	// No error
	return nil
}

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

	// AdditionalInfo
	if detail.AdditionalInfo != nil {
		additionalInfoList := make([]storage.ErrorAdditionalInfo_STATUS, len(detail.AdditionalInfo))
		for additionalInfoIndex, additionalInfoItem := range detail.AdditionalInfo {
			var additionalInfo storage.ErrorAdditionalInfo_STATUS
			err := additionalInfoItem.AssignProperties_To_ErrorAdditionalInfo_STATUS(&additionalInfo)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ErrorAdditionalInfo_STATUS() to populate field AdditionalInfo")
			}
			additionalInfoList[additionalInfoIndex] = additionalInfo
		}
		destination.AdditionalInfo = additionalInfoList
	} else {
		destination.AdditionalInfo = nil
	}

	// Code
	destination.Code = genruntime.ClonePointerToString(detail.Code)

	// Details
	if detail.Details != nil {
		detailList := make([]storage.ErrorDetail_STATUS_Unrolled, len(detail.Details))
		for detailIndex, detailItem := range detail.Details {
			var detailLocal storage.ErrorDetail_STATUS_Unrolled
			err := detailItem.AssignProperties_To_ErrorDetail_STATUS_Unrolled(&detailLocal)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ErrorDetail_STATUS_Unrolled() to populate field Details")
			}
			detailList[detailIndex] = detailLocal
		}
		destination.Details = detailList
	} else {
		destination.Details = nil
	}

	// Message
	destination.Message = genruntime.ClonePointerToString(detail.Message)

	// Target
	destination.Target = genruntime.ClonePointerToString(detail.Target)

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

	// No error
	return nil
}

// The type of upgrade to perform when targeting ManagedClusters.
// +kubebuilder:validation:Enum={"Full","NodeImageOnly"}
type ManagedClusterUpgradeType string

const (
	ManagedClusterUpgradeType_Full          = ManagedClusterUpgradeType("Full")
	ManagedClusterUpgradeType_NodeImageOnly = ManagedClusterUpgradeType("NodeImageOnly")
)

// Mapping from string to ManagedClusterUpgradeType
var managedClusterUpgradeType_Values = map[string]ManagedClusterUpgradeType{
	"full":          ManagedClusterUpgradeType_Full,
	"nodeimageonly": ManagedClusterUpgradeType_NodeImageOnly,
}

// The type of upgrade to perform when targeting ManagedClusters.
type ManagedClusterUpgradeType_STATUS string

const (
	ManagedClusterUpgradeType_STATUS_Full          = ManagedClusterUpgradeType_STATUS("Full")
	ManagedClusterUpgradeType_STATUS_NodeImageOnly = ManagedClusterUpgradeType_STATUS("NodeImageOnly")
)

// Mapping from string to ManagedClusterUpgradeType_STATUS
var managedClusterUpgradeType_STATUS_Values = map[string]ManagedClusterUpgradeType_STATUS{
	"full":          ManagedClusterUpgradeType_STATUS_Full,
	"nodeimageonly": ManagedClusterUpgradeType_STATUS_NodeImageOnly,
}

// A group to be updated.
type UpdateGroup struct {
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxLength=50
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:Pattern="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
	// Name: Name of the group.
	// It must match a group name of an existing fleet member.
	Name *string `json:"name,omitempty"`
}

var _ genruntime.ARMTransformer = &UpdateGroup{}

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_UpdateGroup populates our UpdateGroup from the provided source UpdateGroup
func (group *UpdateGroup) AssignProperties_From_UpdateGroup(source *storage.UpdateGroup) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// A group to be updated.
type UpdateGroup_STATUS struct {
	// Name: Name of the group.
	// It must match a group name of an existing fleet member.
	Name *string `json:"name,omitempty"`
}

var _ genruntime.FromARMConverter = &UpdateGroup_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_UpdateGroup_STATUS populates our UpdateGroup_STATUS from the provided source UpdateGroup_STATUS
func (group *UpdateGroup_STATUS) AssignProperties_From_UpdateGroup_STATUS(source *storage.UpdateGroup_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// The status of a UpdateGroup.
type UpdateGroupStatus_STATUS struct {
	// Members: The list of member this UpdateGroup updates.
	Members []MemberUpdateStatus_STATUS `json:"members,omitempty"`

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

	// Status: The status of the UpdateGroup.
	Status *UpdateStatus_STATUS `json:"status,omitempty"`
}

var _ genruntime.FromARMConverter = &UpdateGroupStatus_STATUS{}

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

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

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

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

	// Set property "Status":
	if typedInput.Status != nil {
		var status2 UpdateStatus_STATUS
		err := status2.PopulateFromARM(owner, *typedInput.Status)
		if err != nil {
			return err
		}
		status1 := status2
		status.Status = &status1
	}

	// No error
	return nil
}

// AssignProperties_From_UpdateGroupStatus_STATUS populates our UpdateGroupStatus_STATUS from the provided source UpdateGroupStatus_STATUS
func (status *UpdateGroupStatus_STATUS) AssignProperties_From_UpdateGroupStatus_STATUS(source *storage.UpdateGroupStatus_STATUS) error {

	// Members
	if source.Members != nil {
		memberList := make([]MemberUpdateStatus_STATUS, len(source.Members))
		for memberIndex, memberItem := range source.Members {
			var member MemberUpdateStatus_STATUS
			err := member.AssignProperties_From_MemberUpdateStatus_STATUS(&memberItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_MemberUpdateStatus_STATUS() to populate field Members")
			}
			memberList[memberIndex] = member
		}
		status.Members = memberList
	} else {
		status.Members = nil
	}

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

	// Status
	if source.Status != nil {
		var statusLocal UpdateStatus_STATUS
		err := statusLocal.AssignProperties_From_UpdateStatus_STATUS(source.Status)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UpdateStatus_STATUS() to populate field Status")
		}
		status.Status = &statusLocal
	} else {
		status.Status = nil
	}

	// No error
	return nil
}

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

	// Members
	if status.Members != nil {
		memberList := make([]storage.MemberUpdateStatus_STATUS, len(status.Members))
		for memberIndex, memberItem := range status.Members {
			var member storage.MemberUpdateStatus_STATUS
			err := memberItem.AssignProperties_To_MemberUpdateStatus_STATUS(&member)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_MemberUpdateStatus_STATUS() to populate field Members")
			}
			memberList[memberIndex] = member
		}
		destination.Members = memberList
	} else {
		destination.Members = nil
	}

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

	// Status
	if status.Status != nil {
		var statusLocal storage.UpdateStatus_STATUS
		err := status.Status.AssignProperties_To_UpdateStatus_STATUS(&statusLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UpdateStatus_STATUS() to populate field Status")
		}
		destination.Status = &statusLocal
	} else {
		destination.Status = nil
	}

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

	// No error
	return nil
}

// The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.
type UpdateState_STATUS string

const (
	UpdateState_STATUS_Completed  = UpdateState_STATUS("Completed")
	UpdateState_STATUS_Failed     = UpdateState_STATUS("Failed")
	UpdateState_STATUS_NotStarted = UpdateState_STATUS("NotStarted")
	UpdateState_STATUS_Pending    = UpdateState_STATUS("Pending")
	UpdateState_STATUS_Running    = UpdateState_STATUS("Running")
	UpdateState_STATUS_Stopped    = UpdateState_STATUS("Stopped")
	UpdateState_STATUS_Stopping   = UpdateState_STATUS("Stopping")
)

// Mapping from string to UpdateState_STATUS
var updateState_STATUS_Values = map[string]UpdateState_STATUS{
	"completed":  UpdateState_STATUS_Completed,
	"failed":     UpdateState_STATUS_Failed,
	"notstarted": UpdateState_STATUS_NotStarted,
	"pending":    UpdateState_STATUS_Pending,
	"running":    UpdateState_STATUS_Running,
	"stopped":    UpdateState_STATUS_Stopped,
	"stopping":   UpdateState_STATUS_Stopping,
}

// The status of the wait duration.
type WaitStatus_STATUS struct {
	// Status: The status of the wait duration.
	Status *UpdateStatus_STATUS `json:"status,omitempty"`

	// WaitDurationInSeconds: The wait duration configured in seconds.
	WaitDurationInSeconds *int `json:"waitDurationInSeconds,omitempty"`
}

var _ genruntime.FromARMConverter = &WaitStatus_STATUS{}

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

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

	// Set property "Status":
	if typedInput.Status != nil {
		var status2 UpdateStatus_STATUS
		err := status2.PopulateFromARM(owner, *typedInput.Status)
		if err != nil {
			return err
		}
		status1 := status2
		status.Status = &status1
	}

	// Set property "WaitDurationInSeconds":
	if typedInput.WaitDurationInSeconds != nil {
		waitDurationInSeconds := *typedInput.WaitDurationInSeconds
		status.WaitDurationInSeconds = &waitDurationInSeconds
	}

	// No error
	return nil
}

// AssignProperties_From_WaitStatus_STATUS populates our WaitStatus_STATUS from the provided source WaitStatus_STATUS
func (status *WaitStatus_STATUS) AssignProperties_From_WaitStatus_STATUS(source *storage.WaitStatus_STATUS) error {

	// Status
	if source.Status != nil {
		var statusLocal UpdateStatus_STATUS
		err := statusLocal.AssignProperties_From_UpdateStatus_STATUS(source.Status)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UpdateStatus_STATUS() to populate field Status")
		}
		status.Status = &statusLocal
	} else {
		status.Status = nil
	}

	// WaitDurationInSeconds
	status.WaitDurationInSeconds = genruntime.ClonePointerToInt(source.WaitDurationInSeconds)

	// No error
	return nil
}

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

	// Status
	if status.Status != nil {
		var statusLocal storage.UpdateStatus_STATUS
		err := status.Status.AssignProperties_To_UpdateStatus_STATUS(&statusLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UpdateStatus_STATUS() to populate field Status")
		}
		destination.Status = &statusLocal
	} else {
		destination.Status = nil
	}

	// WaitDurationInSeconds
	destination.WaitDurationInSeconds = genruntime.ClonePointerToInt(status.WaitDurationInSeconds)

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

	// No error
	return nil
}

// The resource management error additional info.
type ErrorAdditionalInfo_STATUS struct {
	// Info: The additional info.
	Info map[string]v1.JSON `json:"info,omitempty"`

	// Type: The additional info type.
	Type *string `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &ErrorAdditionalInfo_STATUS{}

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

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

	// Set property "Info":
	if typedInput.Info != nil {
		info.Info = make(map[string]v1.JSON, len(typedInput.Info))
		for key, value := range typedInput.Info {
			info.Info[key] = *value.DeepCopy()
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_ErrorAdditionalInfo_STATUS populates our ErrorAdditionalInfo_STATUS from the provided source ErrorAdditionalInfo_STATUS
func (info *ErrorAdditionalInfo_STATUS) AssignProperties_From_ErrorAdditionalInfo_STATUS(source *storage.ErrorAdditionalInfo_STATUS) error {

	// Info
	if source.Info != nil {
		infoMap := make(map[string]v1.JSON, len(source.Info))
		for infoKey, infoValue := range source.Info {
			infoMap[infoKey] = *infoValue.DeepCopy()
		}
		info.Info = infoMap
	} else {
		info.Info = nil
	}

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

	// No error
	return nil
}

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

	// Info
	if info.Info != nil {
		infoMap := make(map[string]v1.JSON, len(info.Info))
		for infoKey, infoValue := range info.Info {
			infoMap[infoKey] = *infoValue.DeepCopy()
		}
		destination.Info = infoMap
	} else {
		destination.Info = nil
	}

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

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

	// No error
	return nil
}

type ErrorDetail_STATUS_Unrolled struct {
	// AdditionalInfo: The error additional info.
	AdditionalInfo []ErrorAdditionalInfo_STATUS `json:"additionalInfo,omitempty"`

	// Code: The error code.
	Code *string `json:"code,omitempty"`

	// Message: The error message.
	Message *string `json:"message,omitempty"`

	// Target: The error target.
	Target *string `json:"target,omitempty"`
}

var _ genruntime.FromARMConverter = &ErrorDetail_STATUS_Unrolled{}

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

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

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

	// Set property "Code":
	if typedInput.Code != nil {
		code := *typedInput.Code
		unrolled.Code = &code
	}

	// Set property "Message":
	if typedInput.Message != nil {
		message := *typedInput.Message
		unrolled.Message = &message
	}

	// Set property "Target":
	if typedInput.Target != nil {
		target := *typedInput.Target
		unrolled.Target = &target
	}

	// No error
	return nil
}

// AssignProperties_From_ErrorDetail_STATUS_Unrolled populates our ErrorDetail_STATUS_Unrolled from the provided source ErrorDetail_STATUS_Unrolled
func (unrolled *ErrorDetail_STATUS_Unrolled) AssignProperties_From_ErrorDetail_STATUS_Unrolled(source *storage.ErrorDetail_STATUS_Unrolled) error {

	// AdditionalInfo
	if source.AdditionalInfo != nil {
		additionalInfoList := make([]ErrorAdditionalInfo_STATUS, len(source.AdditionalInfo))
		for additionalInfoIndex, additionalInfoItem := range source.AdditionalInfo {
			var additionalInfo ErrorAdditionalInfo_STATUS
			err := additionalInfo.AssignProperties_From_ErrorAdditionalInfo_STATUS(&additionalInfoItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ErrorAdditionalInfo_STATUS() to populate field AdditionalInfo")
			}
			additionalInfoList[additionalInfoIndex] = additionalInfo
		}
		unrolled.AdditionalInfo = additionalInfoList
	} else {
		unrolled.AdditionalInfo = nil
	}

	// Code
	unrolled.Code = genruntime.ClonePointerToString(source.Code)

	// Message
	unrolled.Message = genruntime.ClonePointerToString(source.Message)

	// Target
	unrolled.Target = genruntime.ClonePointerToString(source.Target)

	// No error
	return nil
}

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

	// AdditionalInfo
	if unrolled.AdditionalInfo != nil {
		additionalInfoList := make([]storage.ErrorAdditionalInfo_STATUS, len(unrolled.AdditionalInfo))
		for additionalInfoIndex, additionalInfoItem := range unrolled.AdditionalInfo {
			var additionalInfo storage.ErrorAdditionalInfo_STATUS
			err := additionalInfoItem.AssignProperties_To_ErrorAdditionalInfo_STATUS(&additionalInfo)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ErrorAdditionalInfo_STATUS() to populate field AdditionalInfo")
			}
			additionalInfoList[additionalInfoIndex] = additionalInfo
		}
		destination.AdditionalInfo = additionalInfoList
	} else {
		destination.AdditionalInfo = nil
	}

	// Code
	destination.Code = genruntime.ClonePointerToString(unrolled.Code)

	// Message
	destination.Message = genruntime.ClonePointerToString(unrolled.Message)

	// Target
	destination.Target = genruntime.ClonePointerToString(unrolled.Target)

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

	// No error
	return nil
}

// The status of a member update operation.
type MemberUpdateStatus_STATUS struct {
	// ClusterResourceId: The Azure resource id of the target Kubernetes cluster.
	ClusterResourceId *string `json:"clusterResourceId,omitempty"`

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

	// OperationId: The operation resource id of the latest attempt to perform the operation.
	OperationId *string `json:"operationId,omitempty"`

	// Status: The status of the MemberUpdate operation.
	Status *UpdateStatus_STATUS `json:"status,omitempty"`
}

var _ genruntime.FromARMConverter = &MemberUpdateStatus_STATUS{}

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

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

	// Set property "ClusterResourceId":
	if typedInput.ClusterResourceId != nil {
		clusterResourceId := *typedInput.ClusterResourceId
		status.ClusterResourceId = &clusterResourceId
	}

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

	// Set property "OperationId":
	if typedInput.OperationId != nil {
		operationId := *typedInput.OperationId
		status.OperationId = &operationId
	}

	// Set property "Status":
	if typedInput.Status != nil {
		var status2 UpdateStatus_STATUS
		err := status2.PopulateFromARM(owner, *typedInput.Status)
		if err != nil {
			return err
		}
		status1 := status2
		status.Status = &status1
	}

	// No error
	return nil
}

// AssignProperties_From_MemberUpdateStatus_STATUS populates our MemberUpdateStatus_STATUS from the provided source MemberUpdateStatus_STATUS
func (status *MemberUpdateStatus_STATUS) AssignProperties_From_MemberUpdateStatus_STATUS(source *storage.MemberUpdateStatus_STATUS) error {

	// ClusterResourceId
	status.ClusterResourceId = genruntime.ClonePointerToString(source.ClusterResourceId)

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

	// OperationId
	status.OperationId = genruntime.ClonePointerToString(source.OperationId)

	// Status
	if source.Status != nil {
		var statusLocal UpdateStatus_STATUS
		err := statusLocal.AssignProperties_From_UpdateStatus_STATUS(source.Status)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_UpdateStatus_STATUS() to populate field Status")
		}
		status.Status = &statusLocal
	} else {
		status.Status = nil
	}

	// No error
	return nil
}

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

	// ClusterResourceId
	destination.ClusterResourceId = genruntime.ClonePointerToString(status.ClusterResourceId)

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

	// OperationId
	destination.OperationId = genruntime.ClonePointerToString(status.OperationId)

	// Status
	if status.Status != nil {
		var statusLocal storage.UpdateStatus_STATUS
		err := status.Status.AssignProperties_To_UpdateStatus_STATUS(&statusLocal)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_UpdateStatus_STATUS() to populate field Status")
		}
		destination.Status = &statusLocal
	} else {
		destination.Status = nil
	}

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&FleetsUpdateRun{}, &FleetsUpdateRunList{})
}
