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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/web/v1api20220301/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/web/v1api20220301/storage"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/secrets"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,web}
// +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: /web/resource-manager/Microsoft.Web/stable/2022-03-01/AppServicePlans.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}
type ServerFarm struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              ServerFarm_Spec   `json:"spec,omitempty"`
	Status            ServerFarm_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &ServerFarm{}

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

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

var _ conversion.Convertible = &ServerFarm{}

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

	return farm.AssignProperties_From_ServerFarm(source)
}

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

	return farm.AssignProperties_To_ServerFarm(destination)
}

var _ configmaps.Exporter = &ServerFarm{}

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

var _ secrets.Exporter = &ServerFarm{}

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

var _ genruntime.ImportableResource = &ServerFarm{}

// InitializeSpec initializes the spec for this resource from the given status
func (farm *ServerFarm) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*ServerFarm_STATUS); ok {
		return farm.Spec.Initialize_From_ServerFarm_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &ServerFarm{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Web/serverfarms"
func (farm *ServerFarm) GetType() string {
	return "Microsoft.Web/serverfarms"
}

// NewEmptyStatus returns a new empty (blank) status
func (farm *ServerFarm) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &ServerFarm_STATUS{}
}

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

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

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

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

	farm.Status = st
	return nil
}

// AssignProperties_From_ServerFarm populates our ServerFarm from the provided source ServerFarm
func (farm *ServerFarm) AssignProperties_From_ServerFarm(source *storage.ServerFarm) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_ServerFarm populates the provided destination ServerFarm from our ServerFarm
func (farm *ServerFarm) AssignProperties_To_ServerFarm(destination *storage.ServerFarm) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /web/resource-manager/Microsoft.Web/stable/2022-03-01/AppServicePlans.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}
type ServerFarmList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ServerFarm `json:"items"`
}

// +kubebuilder:validation:Enum={"2022-03-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2022-03-01")

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

	// ElasticScaleEnabled: ServerFarm supports ElasticScale. Apps in this plan will scale as if the ServerFarm was
	// ElasticPremium sku
	ElasticScaleEnabled *bool `json:"elasticScaleEnabled,omitempty"`

	// ExtendedLocation: Extended Location.
	ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"`

	// FreeOfferExpirationTime: The time when the server farm free offer expires.
	FreeOfferExpirationTime *string `json:"freeOfferExpirationTime,omitempty"`

	// HostingEnvironmentProfile: Specification for the App Service Environment to use for the App Service plan.
	HostingEnvironmentProfile *HostingEnvironmentProfile `json:"hostingEnvironmentProfile,omitempty"`

	// HyperV: If Hyper-V container app service plan <code>true</code>, <code>false</code> otherwise.
	HyperV *bool `json:"hyperV,omitempty"`

	// IsSpot: If <code>true</code>, this App Service Plan owns spot instances.
	IsSpot *bool `json:"isSpot,omitempty"`

	// IsXenon: Obsolete: If Hyper-V container app service plan <code>true</code>, <code>false</code> otherwise.
	IsXenon *bool `json:"isXenon,omitempty"`

	// Kind: Kind of resource.
	Kind *string `json:"kind,omitempty"`

	// KubeEnvironmentProfile: Specification for the Kubernetes Environment to use for the App Service plan.
	KubeEnvironmentProfile *KubeEnvironmentProfile `json:"kubeEnvironmentProfile,omitempty"`

	// +kubebuilder:validation:Required
	// Location: Resource Location.
	Location *string `json:"location,omitempty"`

	// MaximumElasticWorkerCount: Maximum number of total workers allowed for this ElasticScaleEnabled App Service Plan
	MaximumElasticWorkerCount *int `json:"maximumElasticWorkerCount,omitempty"`

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

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

	// PerSiteScaling: If <code>true</code>, apps assigned to this App Service plan can be scaled independently.
	// If <code>false</code>, apps assigned to this App Service plan will scale to all instances of the plan.
	PerSiteScaling *bool `json:"perSiteScaling,omitempty"`

	// Reserved: If Linux app service plan <code>true</code>, <code>false</code> otherwise.
	Reserved *bool `json:"reserved,omitempty"`

	// Sku: Description of a SKU for a scalable resource.
	Sku *SkuDescription `json:"sku,omitempty"`

	// SpotExpirationTime: The time when the server farm expires. Valid only if it is a spot server farm.
	SpotExpirationTime *string `json:"spotExpirationTime,omitempty"`

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

	// TargetWorkerCount: Scaling worker count.
	TargetWorkerCount *int `json:"targetWorkerCount,omitempty"`

	// TargetWorkerSizeId: Scaling worker size ID.
	TargetWorkerSizeId *int `json:"targetWorkerSizeId,omitempty"`

	// WorkerTierName: Target worker tier assigned to the App Service plan.
	WorkerTierName *string `json:"workerTierName,omitempty"`

	// ZoneRedundant: If <code>true</code>, this App Service Plan will perform availability zone balancing.
	// If <code>false</code>, this App Service Plan will not perform availability zone balancing.
	ZoneRedundant *bool `json:"zoneRedundant,omitempty"`
}

var _ genruntime.ARMTransformer = &ServerFarm_Spec{}

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

	// Set property "ExtendedLocation":
	if farm.ExtendedLocation != nil {
		extendedLocation_ARM, err := farm.ExtendedLocation.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		extendedLocation := *extendedLocation_ARM.(*arm.ExtendedLocation)
		result.ExtendedLocation = &extendedLocation
	}

	// Set property "Kind":
	if farm.Kind != nil {
		kind := *farm.Kind
		result.Kind = &kind
	}

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

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

	// Set property "Properties":
	if farm.ElasticScaleEnabled != nil ||
		farm.FreeOfferExpirationTime != nil ||
		farm.HostingEnvironmentProfile != nil ||
		farm.HyperV != nil ||
		farm.IsSpot != nil ||
		farm.IsXenon != nil ||
		farm.KubeEnvironmentProfile != nil ||
		farm.MaximumElasticWorkerCount != nil ||
		farm.PerSiteScaling != nil ||
		farm.Reserved != nil ||
		farm.SpotExpirationTime != nil ||
		farm.TargetWorkerCount != nil ||
		farm.TargetWorkerSizeId != nil ||
		farm.WorkerTierName != nil ||
		farm.ZoneRedundant != nil {
		result.Properties = &arm.Serverfarm_Properties_Spec{}
	}
	if farm.ElasticScaleEnabled != nil {
		elasticScaleEnabled := *farm.ElasticScaleEnabled
		result.Properties.ElasticScaleEnabled = &elasticScaleEnabled
	}
	if farm.FreeOfferExpirationTime != nil {
		freeOfferExpirationTime := *farm.FreeOfferExpirationTime
		result.Properties.FreeOfferExpirationTime = &freeOfferExpirationTime
	}
	if farm.HostingEnvironmentProfile != nil {
		hostingEnvironmentProfile_ARM, err := farm.HostingEnvironmentProfile.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		hostingEnvironmentProfile := *hostingEnvironmentProfile_ARM.(*arm.HostingEnvironmentProfile)
		result.Properties.HostingEnvironmentProfile = &hostingEnvironmentProfile
	}
	if farm.HyperV != nil {
		hyperV := *farm.HyperV
		result.Properties.HyperV = &hyperV
	}
	if farm.IsSpot != nil {
		isSpot := *farm.IsSpot
		result.Properties.IsSpot = &isSpot
	}
	if farm.IsXenon != nil {
		isXenon := *farm.IsXenon
		result.Properties.IsXenon = &isXenon
	}
	if farm.KubeEnvironmentProfile != nil {
		kubeEnvironmentProfile_ARM, err := farm.KubeEnvironmentProfile.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		kubeEnvironmentProfile := *kubeEnvironmentProfile_ARM.(*arm.KubeEnvironmentProfile)
		result.Properties.KubeEnvironmentProfile = &kubeEnvironmentProfile
	}
	if farm.MaximumElasticWorkerCount != nil {
		maximumElasticWorkerCount := *farm.MaximumElasticWorkerCount
		result.Properties.MaximumElasticWorkerCount = &maximumElasticWorkerCount
	}
	if farm.PerSiteScaling != nil {
		perSiteScaling := *farm.PerSiteScaling
		result.Properties.PerSiteScaling = &perSiteScaling
	}
	if farm.Reserved != nil {
		reserved := *farm.Reserved
		result.Properties.Reserved = &reserved
	}
	if farm.SpotExpirationTime != nil {
		spotExpirationTime := *farm.SpotExpirationTime
		result.Properties.SpotExpirationTime = &spotExpirationTime
	}
	if farm.TargetWorkerCount != nil {
		targetWorkerCount := *farm.TargetWorkerCount
		result.Properties.TargetWorkerCount = &targetWorkerCount
	}
	if farm.TargetWorkerSizeId != nil {
		targetWorkerSizeId := *farm.TargetWorkerSizeId
		result.Properties.TargetWorkerSizeId = &targetWorkerSizeId
	}
	if farm.WorkerTierName != nil {
		workerTierName := *farm.WorkerTierName
		result.Properties.WorkerTierName = &workerTierName
	}
	if farm.ZoneRedundant != nil {
		zoneRedundant := *farm.ZoneRedundant
		result.Properties.ZoneRedundant = &zoneRedundant
	}

	// Set property "Sku":
	if farm.Sku != nil {
		sku_ARM, err := farm.Sku.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		sku := *sku_ARM.(*arm.SkuDescription)
		result.Sku = &sku
	}

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

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

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

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

	// Set property "ElasticScaleEnabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ElasticScaleEnabled != nil {
			elasticScaleEnabled := *typedInput.Properties.ElasticScaleEnabled
			farm.ElasticScaleEnabled = &elasticScaleEnabled
		}
	}

	// Set property "ExtendedLocation":
	if typedInput.ExtendedLocation != nil {
		var extendedLocation1 ExtendedLocation
		err := extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation)
		if err != nil {
			return err
		}
		extendedLocation := extendedLocation1
		farm.ExtendedLocation = &extendedLocation
	}

	// Set property "FreeOfferExpirationTime":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FreeOfferExpirationTime != nil {
			freeOfferExpirationTime := *typedInput.Properties.FreeOfferExpirationTime
			farm.FreeOfferExpirationTime = &freeOfferExpirationTime
		}
	}

	// Set property "HostingEnvironmentProfile":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HostingEnvironmentProfile != nil {
			var hostingEnvironmentProfile1 HostingEnvironmentProfile
			err := hostingEnvironmentProfile1.PopulateFromARM(owner, *typedInput.Properties.HostingEnvironmentProfile)
			if err != nil {
				return err
			}
			hostingEnvironmentProfile := hostingEnvironmentProfile1
			farm.HostingEnvironmentProfile = &hostingEnvironmentProfile
		}
	}

	// Set property "HyperV":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HyperV != nil {
			hyperV := *typedInput.Properties.HyperV
			farm.HyperV = &hyperV
		}
	}

	// Set property "IsSpot":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsSpot != nil {
			isSpot := *typedInput.Properties.IsSpot
			farm.IsSpot = &isSpot
		}
	}

	// Set property "IsXenon":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsXenon != nil {
			isXenon := *typedInput.Properties.IsXenon
			farm.IsXenon = &isXenon
		}
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		kind := *typedInput.Kind
		farm.Kind = &kind
	}

	// Set property "KubeEnvironmentProfile":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KubeEnvironmentProfile != nil {
			var kubeEnvironmentProfile1 KubeEnvironmentProfile
			err := kubeEnvironmentProfile1.PopulateFromARM(owner, *typedInput.Properties.KubeEnvironmentProfile)
			if err != nil {
				return err
			}
			kubeEnvironmentProfile := kubeEnvironmentProfile1
			farm.KubeEnvironmentProfile = &kubeEnvironmentProfile
		}
	}

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

	// Set property "MaximumElasticWorkerCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaximumElasticWorkerCount != nil {
			maximumElasticWorkerCount := *typedInput.Properties.MaximumElasticWorkerCount
			farm.MaximumElasticWorkerCount = &maximumElasticWorkerCount
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "PerSiteScaling":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PerSiteScaling != nil {
			perSiteScaling := *typedInput.Properties.PerSiteScaling
			farm.PerSiteScaling = &perSiteScaling
		}
	}

	// Set property "Reserved":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Reserved != nil {
			reserved := *typedInput.Properties.Reserved
			farm.Reserved = &reserved
		}
	}

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

	// Set property "SpotExpirationTime":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SpotExpirationTime != nil {
			spotExpirationTime := *typedInput.Properties.SpotExpirationTime
			farm.SpotExpirationTime = &spotExpirationTime
		}
	}

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

	// Set property "TargetWorkerCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TargetWorkerCount != nil {
			targetWorkerCount := *typedInput.Properties.TargetWorkerCount
			farm.TargetWorkerCount = &targetWorkerCount
		}
	}

	// Set property "TargetWorkerSizeId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TargetWorkerSizeId != nil {
			targetWorkerSizeId := *typedInput.Properties.TargetWorkerSizeId
			farm.TargetWorkerSizeId = &targetWorkerSizeId
		}
	}

	// Set property "WorkerTierName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.WorkerTierName != nil {
			workerTierName := *typedInput.Properties.WorkerTierName
			farm.WorkerTierName = &workerTierName
		}
	}

	// Set property "ZoneRedundant":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ZoneRedundant != nil {
			zoneRedundant := *typedInput.Properties.ZoneRedundant
			farm.ZoneRedundant = &zoneRedundant
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &ServerFarm_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.ServerFarm_Spec{}
	err := farm.AssignProperties_To_ServerFarm_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_ServerFarm_Spec populates our ServerFarm_Spec from the provided source ServerFarm_Spec
func (farm *ServerFarm_Spec) AssignProperties_From_ServerFarm_Spec(source *storage.ServerFarm_Spec) error {

	// AzureName
	farm.AzureName = source.AzureName

	// ElasticScaleEnabled
	if source.ElasticScaleEnabled != nil {
		elasticScaleEnabled := *source.ElasticScaleEnabled
		farm.ElasticScaleEnabled = &elasticScaleEnabled
	} else {
		farm.ElasticScaleEnabled = nil
	}

	// ExtendedLocation
	if source.ExtendedLocation != nil {
		var extendedLocation ExtendedLocation
		err := extendedLocation.AssignProperties_From_ExtendedLocation(source.ExtendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation() to populate field ExtendedLocation")
		}
		farm.ExtendedLocation = &extendedLocation
	} else {
		farm.ExtendedLocation = nil
	}

	// FreeOfferExpirationTime
	farm.FreeOfferExpirationTime = genruntime.ClonePointerToString(source.FreeOfferExpirationTime)

	// HostingEnvironmentProfile
	if source.HostingEnvironmentProfile != nil {
		var hostingEnvironmentProfile HostingEnvironmentProfile
		err := hostingEnvironmentProfile.AssignProperties_From_HostingEnvironmentProfile(source.HostingEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_HostingEnvironmentProfile() to populate field HostingEnvironmentProfile")
		}
		farm.HostingEnvironmentProfile = &hostingEnvironmentProfile
	} else {
		farm.HostingEnvironmentProfile = nil
	}

	// HyperV
	if source.HyperV != nil {
		hyperV := *source.HyperV
		farm.HyperV = &hyperV
	} else {
		farm.HyperV = nil
	}

	// IsSpot
	if source.IsSpot != nil {
		isSpot := *source.IsSpot
		farm.IsSpot = &isSpot
	} else {
		farm.IsSpot = nil
	}

	// IsXenon
	if source.IsXenon != nil {
		isXenon := *source.IsXenon
		farm.IsXenon = &isXenon
	} else {
		farm.IsXenon = nil
	}

	// Kind
	farm.Kind = genruntime.ClonePointerToString(source.Kind)

	// KubeEnvironmentProfile
	if source.KubeEnvironmentProfile != nil {
		var kubeEnvironmentProfile KubeEnvironmentProfile
		err := kubeEnvironmentProfile.AssignProperties_From_KubeEnvironmentProfile(source.KubeEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_KubeEnvironmentProfile() to populate field KubeEnvironmentProfile")
		}
		farm.KubeEnvironmentProfile = &kubeEnvironmentProfile
	} else {
		farm.KubeEnvironmentProfile = nil
	}

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

	// MaximumElasticWorkerCount
	farm.MaximumElasticWorkerCount = genruntime.ClonePointerToInt(source.MaximumElasticWorkerCount)

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

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

	// PerSiteScaling
	if source.PerSiteScaling != nil {
		perSiteScaling := *source.PerSiteScaling
		farm.PerSiteScaling = &perSiteScaling
	} else {
		farm.PerSiteScaling = nil
	}

	// Reserved
	if source.Reserved != nil {
		reserved := *source.Reserved
		farm.Reserved = &reserved
	} else {
		farm.Reserved = nil
	}

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

	// SpotExpirationTime
	farm.SpotExpirationTime = genruntime.ClonePointerToString(source.SpotExpirationTime)

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

	// TargetWorkerCount
	farm.TargetWorkerCount = genruntime.ClonePointerToInt(source.TargetWorkerCount)

	// TargetWorkerSizeId
	farm.TargetWorkerSizeId = genruntime.ClonePointerToInt(source.TargetWorkerSizeId)

	// WorkerTierName
	farm.WorkerTierName = genruntime.ClonePointerToString(source.WorkerTierName)

	// ZoneRedundant
	if source.ZoneRedundant != nil {
		zoneRedundant := *source.ZoneRedundant
		farm.ZoneRedundant = &zoneRedundant
	} else {
		farm.ZoneRedundant = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = farm.AzureName

	// ElasticScaleEnabled
	if farm.ElasticScaleEnabled != nil {
		elasticScaleEnabled := *farm.ElasticScaleEnabled
		destination.ElasticScaleEnabled = &elasticScaleEnabled
	} else {
		destination.ElasticScaleEnabled = nil
	}

	// ExtendedLocation
	if farm.ExtendedLocation != nil {
		var extendedLocation storage.ExtendedLocation
		err := farm.ExtendedLocation.AssignProperties_To_ExtendedLocation(&extendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation() to populate field ExtendedLocation")
		}
		destination.ExtendedLocation = &extendedLocation
	} else {
		destination.ExtendedLocation = nil
	}

	// FreeOfferExpirationTime
	destination.FreeOfferExpirationTime = genruntime.ClonePointerToString(farm.FreeOfferExpirationTime)

	// HostingEnvironmentProfile
	if farm.HostingEnvironmentProfile != nil {
		var hostingEnvironmentProfile storage.HostingEnvironmentProfile
		err := farm.HostingEnvironmentProfile.AssignProperties_To_HostingEnvironmentProfile(&hostingEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_HostingEnvironmentProfile() to populate field HostingEnvironmentProfile")
		}
		destination.HostingEnvironmentProfile = &hostingEnvironmentProfile
	} else {
		destination.HostingEnvironmentProfile = nil
	}

	// HyperV
	if farm.HyperV != nil {
		hyperV := *farm.HyperV
		destination.HyperV = &hyperV
	} else {
		destination.HyperV = nil
	}

	// IsSpot
	if farm.IsSpot != nil {
		isSpot := *farm.IsSpot
		destination.IsSpot = &isSpot
	} else {
		destination.IsSpot = nil
	}

	// IsXenon
	if farm.IsXenon != nil {
		isXenon := *farm.IsXenon
		destination.IsXenon = &isXenon
	} else {
		destination.IsXenon = nil
	}

	// Kind
	destination.Kind = genruntime.ClonePointerToString(farm.Kind)

	// KubeEnvironmentProfile
	if farm.KubeEnvironmentProfile != nil {
		var kubeEnvironmentProfile storage.KubeEnvironmentProfile
		err := farm.KubeEnvironmentProfile.AssignProperties_To_KubeEnvironmentProfile(&kubeEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_KubeEnvironmentProfile() to populate field KubeEnvironmentProfile")
		}
		destination.KubeEnvironmentProfile = &kubeEnvironmentProfile
	} else {
		destination.KubeEnvironmentProfile = nil
	}

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

	// MaximumElasticWorkerCount
	destination.MaximumElasticWorkerCount = genruntime.ClonePointerToInt(farm.MaximumElasticWorkerCount)

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

	// OriginalVersion
	destination.OriginalVersion = farm.OriginalVersion()

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

	// PerSiteScaling
	if farm.PerSiteScaling != nil {
		perSiteScaling := *farm.PerSiteScaling
		destination.PerSiteScaling = &perSiteScaling
	} else {
		destination.PerSiteScaling = nil
	}

	// Reserved
	if farm.Reserved != nil {
		reserved := *farm.Reserved
		destination.Reserved = &reserved
	} else {
		destination.Reserved = nil
	}

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

	// SpotExpirationTime
	destination.SpotExpirationTime = genruntime.ClonePointerToString(farm.SpotExpirationTime)

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

	// TargetWorkerCount
	destination.TargetWorkerCount = genruntime.ClonePointerToInt(farm.TargetWorkerCount)

	// TargetWorkerSizeId
	destination.TargetWorkerSizeId = genruntime.ClonePointerToInt(farm.TargetWorkerSizeId)

	// WorkerTierName
	destination.WorkerTierName = genruntime.ClonePointerToString(farm.WorkerTierName)

	// ZoneRedundant
	if farm.ZoneRedundant != nil {
		zoneRedundant := *farm.ZoneRedundant
		destination.ZoneRedundant = &zoneRedundant
	} else {
		destination.ZoneRedundant = nil
	}

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

	// No error
	return nil
}

// Initialize_From_ServerFarm_STATUS populates our ServerFarm_Spec from the provided source ServerFarm_STATUS
func (farm *ServerFarm_Spec) Initialize_From_ServerFarm_STATUS(source *ServerFarm_STATUS) error {

	// ElasticScaleEnabled
	if source.ElasticScaleEnabled != nil {
		elasticScaleEnabled := *source.ElasticScaleEnabled
		farm.ElasticScaleEnabled = &elasticScaleEnabled
	} else {
		farm.ElasticScaleEnabled = nil
	}

	// ExtendedLocation
	if source.ExtendedLocation != nil {
		var extendedLocation ExtendedLocation
		err := extendedLocation.Initialize_From_ExtendedLocation_STATUS(source.ExtendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ExtendedLocation_STATUS() to populate field ExtendedLocation")
		}
		farm.ExtendedLocation = &extendedLocation
	} else {
		farm.ExtendedLocation = nil
	}

	// FreeOfferExpirationTime
	farm.FreeOfferExpirationTime = genruntime.ClonePointerToString(source.FreeOfferExpirationTime)

	// HostingEnvironmentProfile
	if source.HostingEnvironmentProfile != nil {
		var hostingEnvironmentProfile HostingEnvironmentProfile
		err := hostingEnvironmentProfile.Initialize_From_HostingEnvironmentProfile_STATUS(source.HostingEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_HostingEnvironmentProfile_STATUS() to populate field HostingEnvironmentProfile")
		}
		farm.HostingEnvironmentProfile = &hostingEnvironmentProfile
	} else {
		farm.HostingEnvironmentProfile = nil
	}

	// HyperV
	if source.HyperV != nil {
		hyperV := *source.HyperV
		farm.HyperV = &hyperV
	} else {
		farm.HyperV = nil
	}

	// IsSpot
	if source.IsSpot != nil {
		isSpot := *source.IsSpot
		farm.IsSpot = &isSpot
	} else {
		farm.IsSpot = nil
	}

	// IsXenon
	if source.IsXenon != nil {
		isXenon := *source.IsXenon
		farm.IsXenon = &isXenon
	} else {
		farm.IsXenon = nil
	}

	// Kind
	farm.Kind = genruntime.ClonePointerToString(source.Kind)

	// KubeEnvironmentProfile
	if source.KubeEnvironmentProfile != nil {
		var kubeEnvironmentProfile KubeEnvironmentProfile
		err := kubeEnvironmentProfile.Initialize_From_KubeEnvironmentProfile_STATUS(source.KubeEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_KubeEnvironmentProfile_STATUS() to populate field KubeEnvironmentProfile")
		}
		farm.KubeEnvironmentProfile = &kubeEnvironmentProfile
	} else {
		farm.KubeEnvironmentProfile = nil
	}

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

	// MaximumElasticWorkerCount
	farm.MaximumElasticWorkerCount = genruntime.ClonePointerToInt(source.MaximumElasticWorkerCount)

	// PerSiteScaling
	if source.PerSiteScaling != nil {
		perSiteScaling := *source.PerSiteScaling
		farm.PerSiteScaling = &perSiteScaling
	} else {
		farm.PerSiteScaling = nil
	}

	// Reserved
	if source.Reserved != nil {
		reserved := *source.Reserved
		farm.Reserved = &reserved
	} else {
		farm.Reserved = nil
	}

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

	// SpotExpirationTime
	farm.SpotExpirationTime = genruntime.ClonePointerToString(source.SpotExpirationTime)

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

	// TargetWorkerCount
	farm.TargetWorkerCount = genruntime.ClonePointerToInt(source.TargetWorkerCount)

	// TargetWorkerSizeId
	farm.TargetWorkerSizeId = genruntime.ClonePointerToInt(source.TargetWorkerSizeId)

	// WorkerTierName
	farm.WorkerTierName = genruntime.ClonePointerToString(source.WorkerTierName)

	// ZoneRedundant
	if source.ZoneRedundant != nil {
		zoneRedundant := *source.ZoneRedundant
		farm.ZoneRedundant = &zoneRedundant
	} else {
		farm.ZoneRedundant = nil
	}

	// No error
	return nil
}

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

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

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

	// ElasticScaleEnabled: ServerFarm supports ElasticScale. Apps in this plan will scale as if the ServerFarm was
	// ElasticPremium sku
	ElasticScaleEnabled *bool `json:"elasticScaleEnabled,omitempty"`

	// ExtendedLocation: Extended Location.
	ExtendedLocation *ExtendedLocation_STATUS `json:"extendedLocation,omitempty"`

	// FreeOfferExpirationTime: The time when the server farm free offer expires.
	FreeOfferExpirationTime *string `json:"freeOfferExpirationTime,omitempty"`

	// GeoRegion: Geographical location for the App Service plan.
	GeoRegion *string `json:"geoRegion,omitempty"`

	// HostingEnvironmentProfile: Specification for the App Service Environment to use for the App Service plan.
	HostingEnvironmentProfile *HostingEnvironmentProfile_STATUS `json:"hostingEnvironmentProfile,omitempty"`

	// HyperV: If Hyper-V container app service plan <code>true</code>, <code>false</code> otherwise.
	HyperV *bool `json:"hyperV,omitempty"`

	// Id: Resource Id.
	Id *string `json:"id,omitempty"`

	// IsSpot: If <code>true</code>, this App Service Plan owns spot instances.
	IsSpot *bool `json:"isSpot,omitempty"`

	// IsXenon: Obsolete: If Hyper-V container app service plan <code>true</code>, <code>false</code> otherwise.
	IsXenon *bool `json:"isXenon,omitempty"`

	// Kind: Kind of resource.
	Kind *string `json:"kind,omitempty"`

	// KubeEnvironmentProfile: Specification for the Kubernetes Environment to use for the App Service plan.
	KubeEnvironmentProfile *KubeEnvironmentProfile_STATUS `json:"kubeEnvironmentProfile,omitempty"`

	// Location: Resource Location.
	Location *string `json:"location,omitempty"`

	// MaximumElasticWorkerCount: Maximum number of total workers allowed for this ElasticScaleEnabled App Service Plan
	MaximumElasticWorkerCount *int `json:"maximumElasticWorkerCount,omitempty"`

	// MaximumNumberOfWorkers: Maximum number of instances that can be assigned to this App Service plan.
	MaximumNumberOfWorkers *int `json:"maximumNumberOfWorkers,omitempty"`

	// Name: Resource Name.
	Name *string `json:"name,omitempty"`

	// NumberOfSites: Number of apps assigned to this App Service plan.
	NumberOfSites *int `json:"numberOfSites,omitempty"`

	// NumberOfWorkers: The number of instances that are assigned to this App Service plan.
	NumberOfWorkers *int `json:"numberOfWorkers,omitempty"`

	// PerSiteScaling: If <code>true</code>, apps assigned to this App Service plan can be scaled independently.
	// If <code>false</code>, apps assigned to this App Service plan will scale to all instances of the plan.
	PerSiteScaling *bool `json:"perSiteScaling,omitempty"`

	// ProvisioningState: Provisioning state of the App Service Plan.
	ProvisioningState *Serverfarm_Properties_ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// Reserved: If Linux app service plan <code>true</code>, <code>false</code> otherwise.
	Reserved *bool `json:"reserved,omitempty"`

	// ResourceGroup: Resource group of the App Service plan.
	ResourceGroup *string `json:"resourceGroup,omitempty"`

	// Sku: Description of a SKU for a scalable resource.
	Sku *SkuDescription_STATUS `json:"sku,omitempty"`

	// SpotExpirationTime: The time when the server farm expires. Valid only if it is a spot server farm.
	SpotExpirationTime *string `json:"spotExpirationTime,omitempty"`

	// Status: App Service plan status.
	Status *Serverfarm_Properties_Status_STATUS `json:"status,omitempty"`

	// Subscription: App Service plan subscription.
	Subscription *string `json:"subscription,omitempty"`

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

	// TargetWorkerCount: Scaling worker count.
	TargetWorkerCount *int `json:"targetWorkerCount,omitempty"`

	// TargetWorkerSizeId: Scaling worker size ID.
	TargetWorkerSizeId *int `json:"targetWorkerSizeId,omitempty"`

	// Type: Resource type.
	Type *string `json:"type,omitempty"`

	// WorkerTierName: Target worker tier assigned to the App Service plan.
	WorkerTierName *string `json:"workerTierName,omitempty"`

	// ZoneRedundant: If <code>true</code>, this App Service Plan will perform availability zone balancing.
	// If <code>false</code>, this App Service Plan will not perform availability zone balancing.
	ZoneRedundant *bool `json:"zoneRedundant,omitempty"`
}

var _ genruntime.ConvertibleStatus = &ServerFarm_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.ServerFarm_STATUS{}
	err := farm.AssignProperties_To_ServerFarm_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 = &ServerFarm_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "ElasticScaleEnabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ElasticScaleEnabled != nil {
			elasticScaleEnabled := *typedInput.Properties.ElasticScaleEnabled
			farm.ElasticScaleEnabled = &elasticScaleEnabled
		}
	}

	// Set property "ExtendedLocation":
	if typedInput.ExtendedLocation != nil {
		var extendedLocation1 ExtendedLocation_STATUS
		err := extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation)
		if err != nil {
			return err
		}
		extendedLocation := extendedLocation1
		farm.ExtendedLocation = &extendedLocation
	}

	// Set property "FreeOfferExpirationTime":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FreeOfferExpirationTime != nil {
			freeOfferExpirationTime := *typedInput.Properties.FreeOfferExpirationTime
			farm.FreeOfferExpirationTime = &freeOfferExpirationTime
		}
	}

	// Set property "GeoRegion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.GeoRegion != nil {
			geoRegion := *typedInput.Properties.GeoRegion
			farm.GeoRegion = &geoRegion
		}
	}

	// Set property "HostingEnvironmentProfile":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HostingEnvironmentProfile != nil {
			var hostingEnvironmentProfile1 HostingEnvironmentProfile_STATUS
			err := hostingEnvironmentProfile1.PopulateFromARM(owner, *typedInput.Properties.HostingEnvironmentProfile)
			if err != nil {
				return err
			}
			hostingEnvironmentProfile := hostingEnvironmentProfile1
			farm.HostingEnvironmentProfile = &hostingEnvironmentProfile
		}
	}

	// Set property "HyperV":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HyperV != nil {
			hyperV := *typedInput.Properties.HyperV
			farm.HyperV = &hyperV
		}
	}

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

	// Set property "IsSpot":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsSpot != nil {
			isSpot := *typedInput.Properties.IsSpot
			farm.IsSpot = &isSpot
		}
	}

	// Set property "IsXenon":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsXenon != nil {
			isXenon := *typedInput.Properties.IsXenon
			farm.IsXenon = &isXenon
		}
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		kind := *typedInput.Kind
		farm.Kind = &kind
	}

	// Set property "KubeEnvironmentProfile":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KubeEnvironmentProfile != nil {
			var kubeEnvironmentProfile1 KubeEnvironmentProfile_STATUS
			err := kubeEnvironmentProfile1.PopulateFromARM(owner, *typedInput.Properties.KubeEnvironmentProfile)
			if err != nil {
				return err
			}
			kubeEnvironmentProfile := kubeEnvironmentProfile1
			farm.KubeEnvironmentProfile = &kubeEnvironmentProfile
		}
	}

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

	// Set property "MaximumElasticWorkerCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaximumElasticWorkerCount != nil {
			maximumElasticWorkerCount := *typedInput.Properties.MaximumElasticWorkerCount
			farm.MaximumElasticWorkerCount = &maximumElasticWorkerCount
		}
	}

	// Set property "MaximumNumberOfWorkers":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaximumNumberOfWorkers != nil {
			maximumNumberOfWorkers := *typedInput.Properties.MaximumNumberOfWorkers
			farm.MaximumNumberOfWorkers = &maximumNumberOfWorkers
		}
	}

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

	// Set property "NumberOfSites":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NumberOfSites != nil {
			numberOfSites := *typedInput.Properties.NumberOfSites
			farm.NumberOfSites = &numberOfSites
		}
	}

	// Set property "NumberOfWorkers":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NumberOfWorkers != nil {
			numberOfWorkers := *typedInput.Properties.NumberOfWorkers
			farm.NumberOfWorkers = &numberOfWorkers
		}
	}

	// Set property "PerSiteScaling":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PerSiteScaling != nil {
			perSiteScaling := *typedInput.Properties.PerSiteScaling
			farm.PerSiteScaling = &perSiteScaling
		}
	}

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

	// Set property "Reserved":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Reserved != nil {
			reserved := *typedInput.Properties.Reserved
			farm.Reserved = &reserved
		}
	}

	// Set property "ResourceGroup":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ResourceGroup != nil {
			resourceGroup := *typedInput.Properties.ResourceGroup
			farm.ResourceGroup = &resourceGroup
		}
	}

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

	// Set property "SpotExpirationTime":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SpotExpirationTime != nil {
			spotExpirationTime := *typedInput.Properties.SpotExpirationTime
			farm.SpotExpirationTime = &spotExpirationTime
		}
	}

	// Set property "Status":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Status != nil {
			var temp string
			temp = string(*typedInput.Properties.Status)
			status := Serverfarm_Properties_Status_STATUS(temp)
			farm.Status = &status
		}
	}

	// Set property "Subscription":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Subscription != nil {
			subscription := *typedInput.Properties.Subscription
			farm.Subscription = &subscription
		}
	}

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

	// Set property "TargetWorkerCount":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TargetWorkerCount != nil {
			targetWorkerCount := *typedInput.Properties.TargetWorkerCount
			farm.TargetWorkerCount = &targetWorkerCount
		}
	}

	// Set property "TargetWorkerSizeId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TargetWorkerSizeId != nil {
			targetWorkerSizeId := *typedInput.Properties.TargetWorkerSizeId
			farm.TargetWorkerSizeId = &targetWorkerSizeId
		}
	}

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

	// Set property "WorkerTierName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.WorkerTierName != nil {
			workerTierName := *typedInput.Properties.WorkerTierName
			farm.WorkerTierName = &workerTierName
		}
	}

	// Set property "ZoneRedundant":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ZoneRedundant != nil {
			zoneRedundant := *typedInput.Properties.ZoneRedundant
			farm.ZoneRedundant = &zoneRedundant
		}
	}

	// No error
	return nil
}

// AssignProperties_From_ServerFarm_STATUS populates our ServerFarm_STATUS from the provided source ServerFarm_STATUS
func (farm *ServerFarm_STATUS) AssignProperties_From_ServerFarm_STATUS(source *storage.ServerFarm_STATUS) error {

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

	// ElasticScaleEnabled
	if source.ElasticScaleEnabled != nil {
		elasticScaleEnabled := *source.ElasticScaleEnabled
		farm.ElasticScaleEnabled = &elasticScaleEnabled
	} else {
		farm.ElasticScaleEnabled = nil
	}

	// ExtendedLocation
	if source.ExtendedLocation != nil {
		var extendedLocation ExtendedLocation_STATUS
		err := extendedLocation.AssignProperties_From_ExtendedLocation_STATUS(source.ExtendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ExtendedLocation_STATUS() to populate field ExtendedLocation")
		}
		farm.ExtendedLocation = &extendedLocation
	} else {
		farm.ExtendedLocation = nil
	}

	// FreeOfferExpirationTime
	farm.FreeOfferExpirationTime = genruntime.ClonePointerToString(source.FreeOfferExpirationTime)

	// GeoRegion
	farm.GeoRegion = genruntime.ClonePointerToString(source.GeoRegion)

	// HostingEnvironmentProfile
	if source.HostingEnvironmentProfile != nil {
		var hostingEnvironmentProfile HostingEnvironmentProfile_STATUS
		err := hostingEnvironmentProfile.AssignProperties_From_HostingEnvironmentProfile_STATUS(source.HostingEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_HostingEnvironmentProfile_STATUS() to populate field HostingEnvironmentProfile")
		}
		farm.HostingEnvironmentProfile = &hostingEnvironmentProfile
	} else {
		farm.HostingEnvironmentProfile = nil
	}

	// HyperV
	if source.HyperV != nil {
		hyperV := *source.HyperV
		farm.HyperV = &hyperV
	} else {
		farm.HyperV = nil
	}

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

	// IsSpot
	if source.IsSpot != nil {
		isSpot := *source.IsSpot
		farm.IsSpot = &isSpot
	} else {
		farm.IsSpot = nil
	}

	// IsXenon
	if source.IsXenon != nil {
		isXenon := *source.IsXenon
		farm.IsXenon = &isXenon
	} else {
		farm.IsXenon = nil
	}

	// Kind
	farm.Kind = genruntime.ClonePointerToString(source.Kind)

	// KubeEnvironmentProfile
	if source.KubeEnvironmentProfile != nil {
		var kubeEnvironmentProfile KubeEnvironmentProfile_STATUS
		err := kubeEnvironmentProfile.AssignProperties_From_KubeEnvironmentProfile_STATUS(source.KubeEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_KubeEnvironmentProfile_STATUS() to populate field KubeEnvironmentProfile")
		}
		farm.KubeEnvironmentProfile = &kubeEnvironmentProfile
	} else {
		farm.KubeEnvironmentProfile = nil
	}

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

	// MaximumElasticWorkerCount
	farm.MaximumElasticWorkerCount = genruntime.ClonePointerToInt(source.MaximumElasticWorkerCount)

	// MaximumNumberOfWorkers
	farm.MaximumNumberOfWorkers = genruntime.ClonePointerToInt(source.MaximumNumberOfWorkers)

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

	// NumberOfSites
	farm.NumberOfSites = genruntime.ClonePointerToInt(source.NumberOfSites)

	// NumberOfWorkers
	farm.NumberOfWorkers = genruntime.ClonePointerToInt(source.NumberOfWorkers)

	// PerSiteScaling
	if source.PerSiteScaling != nil {
		perSiteScaling := *source.PerSiteScaling
		farm.PerSiteScaling = &perSiteScaling
	} else {
		farm.PerSiteScaling = nil
	}

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

	// Reserved
	if source.Reserved != nil {
		reserved := *source.Reserved
		farm.Reserved = &reserved
	} else {
		farm.Reserved = nil
	}

	// ResourceGroup
	farm.ResourceGroup = genruntime.ClonePointerToString(source.ResourceGroup)

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

	// SpotExpirationTime
	farm.SpotExpirationTime = genruntime.ClonePointerToString(source.SpotExpirationTime)

	// Status
	if source.Status != nil {
		status := *source.Status
		statusTemp := genruntime.ToEnum(status, serverfarm_Properties_Status_STATUS_Values)
		farm.Status = &statusTemp
	} else {
		farm.Status = nil
	}

	// Subscription
	farm.Subscription = genruntime.ClonePointerToString(source.Subscription)

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

	// TargetWorkerCount
	farm.TargetWorkerCount = genruntime.ClonePointerToInt(source.TargetWorkerCount)

	// TargetWorkerSizeId
	farm.TargetWorkerSizeId = genruntime.ClonePointerToInt(source.TargetWorkerSizeId)

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

	// WorkerTierName
	farm.WorkerTierName = genruntime.ClonePointerToString(source.WorkerTierName)

	// ZoneRedundant
	if source.ZoneRedundant != nil {
		zoneRedundant := *source.ZoneRedundant
		farm.ZoneRedundant = &zoneRedundant
	} else {
		farm.ZoneRedundant = nil
	}

	// No error
	return nil
}

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

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

	// ElasticScaleEnabled
	if farm.ElasticScaleEnabled != nil {
		elasticScaleEnabled := *farm.ElasticScaleEnabled
		destination.ElasticScaleEnabled = &elasticScaleEnabled
	} else {
		destination.ElasticScaleEnabled = nil
	}

	// ExtendedLocation
	if farm.ExtendedLocation != nil {
		var extendedLocation storage.ExtendedLocation_STATUS
		err := farm.ExtendedLocation.AssignProperties_To_ExtendedLocation_STATUS(&extendedLocation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ExtendedLocation_STATUS() to populate field ExtendedLocation")
		}
		destination.ExtendedLocation = &extendedLocation
	} else {
		destination.ExtendedLocation = nil
	}

	// FreeOfferExpirationTime
	destination.FreeOfferExpirationTime = genruntime.ClonePointerToString(farm.FreeOfferExpirationTime)

	// GeoRegion
	destination.GeoRegion = genruntime.ClonePointerToString(farm.GeoRegion)

	// HostingEnvironmentProfile
	if farm.HostingEnvironmentProfile != nil {
		var hostingEnvironmentProfile storage.HostingEnvironmentProfile_STATUS
		err := farm.HostingEnvironmentProfile.AssignProperties_To_HostingEnvironmentProfile_STATUS(&hostingEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_HostingEnvironmentProfile_STATUS() to populate field HostingEnvironmentProfile")
		}
		destination.HostingEnvironmentProfile = &hostingEnvironmentProfile
	} else {
		destination.HostingEnvironmentProfile = nil
	}

	// HyperV
	if farm.HyperV != nil {
		hyperV := *farm.HyperV
		destination.HyperV = &hyperV
	} else {
		destination.HyperV = nil
	}

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

	// IsSpot
	if farm.IsSpot != nil {
		isSpot := *farm.IsSpot
		destination.IsSpot = &isSpot
	} else {
		destination.IsSpot = nil
	}

	// IsXenon
	if farm.IsXenon != nil {
		isXenon := *farm.IsXenon
		destination.IsXenon = &isXenon
	} else {
		destination.IsXenon = nil
	}

	// Kind
	destination.Kind = genruntime.ClonePointerToString(farm.Kind)

	// KubeEnvironmentProfile
	if farm.KubeEnvironmentProfile != nil {
		var kubeEnvironmentProfile storage.KubeEnvironmentProfile_STATUS
		err := farm.KubeEnvironmentProfile.AssignProperties_To_KubeEnvironmentProfile_STATUS(&kubeEnvironmentProfile)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_KubeEnvironmentProfile_STATUS() to populate field KubeEnvironmentProfile")
		}
		destination.KubeEnvironmentProfile = &kubeEnvironmentProfile
	} else {
		destination.KubeEnvironmentProfile = nil
	}

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

	// MaximumElasticWorkerCount
	destination.MaximumElasticWorkerCount = genruntime.ClonePointerToInt(farm.MaximumElasticWorkerCount)

	// MaximumNumberOfWorkers
	destination.MaximumNumberOfWorkers = genruntime.ClonePointerToInt(farm.MaximumNumberOfWorkers)

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

	// NumberOfSites
	destination.NumberOfSites = genruntime.ClonePointerToInt(farm.NumberOfSites)

	// NumberOfWorkers
	destination.NumberOfWorkers = genruntime.ClonePointerToInt(farm.NumberOfWorkers)

	// PerSiteScaling
	if farm.PerSiteScaling != nil {
		perSiteScaling := *farm.PerSiteScaling
		destination.PerSiteScaling = &perSiteScaling
	} else {
		destination.PerSiteScaling = nil
	}

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

	// Reserved
	if farm.Reserved != nil {
		reserved := *farm.Reserved
		destination.Reserved = &reserved
	} else {
		destination.Reserved = nil
	}

	// ResourceGroup
	destination.ResourceGroup = genruntime.ClonePointerToString(farm.ResourceGroup)

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

	// SpotExpirationTime
	destination.SpotExpirationTime = genruntime.ClonePointerToString(farm.SpotExpirationTime)

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

	// Subscription
	destination.Subscription = genruntime.ClonePointerToString(farm.Subscription)

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

	// TargetWorkerCount
	destination.TargetWorkerCount = genruntime.ClonePointerToInt(farm.TargetWorkerCount)

	// TargetWorkerSizeId
	destination.TargetWorkerSizeId = genruntime.ClonePointerToInt(farm.TargetWorkerSizeId)

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

	// WorkerTierName
	destination.WorkerTierName = genruntime.ClonePointerToString(farm.WorkerTierName)

	// ZoneRedundant
	if farm.ZoneRedundant != nil {
		zoneRedundant := *farm.ZoneRedundant
		destination.ZoneRedundant = &zoneRedundant
	} else {
		destination.ZoneRedundant = nil
	}

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

	// No error
	return nil
}

// Extended Location.
type ExtendedLocation struct {
	// Name: Name of extended location.
	Name *string `json:"name,omitempty"`
}

var _ genruntime.ARMTransformer = &ExtendedLocation{}

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ExtendedLocation populates our ExtendedLocation from the provided source ExtendedLocation
func (location *ExtendedLocation) AssignProperties_From_ExtendedLocation(source *storage.ExtendedLocation) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Initialize_From_ExtendedLocation_STATUS populates our ExtendedLocation from the provided source ExtendedLocation_STATUS
func (location *ExtendedLocation) Initialize_From_ExtendedLocation_STATUS(source *ExtendedLocation_STATUS) error {

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

	// No error
	return nil
}

// Extended Location.
type ExtendedLocation_STATUS struct {
	// Name: Name of extended location.
	Name *string `json:"name,omitempty"`

	// Type: Type of extended location.
	Type *string `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &ExtendedLocation_STATUS{}

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ExtendedLocation_STATUS populates our ExtendedLocation_STATUS from the provided source ExtendedLocation_STATUS
func (location *ExtendedLocation_STATUS) AssignProperties_From_ExtendedLocation_STATUS(source *storage.ExtendedLocation_STATUS) error {

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

// Specification for an App Service Environment to use for this resource.
type HostingEnvironmentProfile struct {
	// Reference: Resource ID of the App Service Environment.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &HostingEnvironmentProfile{}

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

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

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

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_HostingEnvironmentProfile populates our HostingEnvironmentProfile from the provided source HostingEnvironmentProfile
func (profile *HostingEnvironmentProfile) AssignProperties_From_HostingEnvironmentProfile(source *storage.HostingEnvironmentProfile) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Initialize_From_HostingEnvironmentProfile_STATUS populates our HostingEnvironmentProfile from the provided source HostingEnvironmentProfile_STATUS
func (profile *HostingEnvironmentProfile) Initialize_From_HostingEnvironmentProfile_STATUS(source *HostingEnvironmentProfile_STATUS) error {

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

	// No error
	return nil
}

// Specification for an App Service Environment to use for this resource.
type HostingEnvironmentProfile_STATUS struct {
	// Id: Resource ID of the App Service Environment.
	Id *string `json:"id,omitempty"`

	// Name: Name of the App Service Environment.
	Name *string `json:"name,omitempty"`

	// Type: Resource type of the App Service Environment.
	Type *string `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &HostingEnvironmentProfile_STATUS{}

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_HostingEnvironmentProfile_STATUS populates our HostingEnvironmentProfile_STATUS from the provided source HostingEnvironmentProfile_STATUS
func (profile *HostingEnvironmentProfile_STATUS) AssignProperties_From_HostingEnvironmentProfile_STATUS(source *storage.HostingEnvironmentProfile_STATUS) error {

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

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

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

// Specification for a Kubernetes Environment to use for this resource.
type KubeEnvironmentProfile struct {
	// Reference: Resource ID of the Kubernetes Environment.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &KubeEnvironmentProfile{}

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

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

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

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_KubeEnvironmentProfile populates our KubeEnvironmentProfile from the provided source KubeEnvironmentProfile
func (profile *KubeEnvironmentProfile) AssignProperties_From_KubeEnvironmentProfile(source *storage.KubeEnvironmentProfile) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Initialize_From_KubeEnvironmentProfile_STATUS populates our KubeEnvironmentProfile from the provided source KubeEnvironmentProfile_STATUS
func (profile *KubeEnvironmentProfile) Initialize_From_KubeEnvironmentProfile_STATUS(source *KubeEnvironmentProfile_STATUS) error {

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

	// No error
	return nil
}

// Specification for a Kubernetes Environment to use for this resource.
type KubeEnvironmentProfile_STATUS struct {
	// Id: Resource ID of the Kubernetes Environment.
	Id *string `json:"id,omitempty"`

	// Name: Name of the Kubernetes Environment.
	Name *string `json:"name,omitempty"`

	// Type: Resource type of the Kubernetes Environment.
	Type *string `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &KubeEnvironmentProfile_STATUS{}

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_KubeEnvironmentProfile_STATUS populates our KubeEnvironmentProfile_STATUS from the provided source KubeEnvironmentProfile_STATUS
func (profile *KubeEnvironmentProfile_STATUS) AssignProperties_From_KubeEnvironmentProfile_STATUS(source *storage.KubeEnvironmentProfile_STATUS) error {

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

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

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

type Serverfarm_Properties_ProvisioningState_STATUS string

const (
	Serverfarm_Properties_ProvisioningState_STATUS_Canceled   = Serverfarm_Properties_ProvisioningState_STATUS("Canceled")
	Serverfarm_Properties_ProvisioningState_STATUS_Deleting   = Serverfarm_Properties_ProvisioningState_STATUS("Deleting")
	Serverfarm_Properties_ProvisioningState_STATUS_Failed     = Serverfarm_Properties_ProvisioningState_STATUS("Failed")
	Serverfarm_Properties_ProvisioningState_STATUS_InProgress = Serverfarm_Properties_ProvisioningState_STATUS("InProgress")
	Serverfarm_Properties_ProvisioningState_STATUS_Succeeded  = Serverfarm_Properties_ProvisioningState_STATUS("Succeeded")
)

// Mapping from string to Serverfarm_Properties_ProvisioningState_STATUS
var serverfarm_Properties_ProvisioningState_STATUS_Values = map[string]Serverfarm_Properties_ProvisioningState_STATUS{
	"canceled":   Serverfarm_Properties_ProvisioningState_STATUS_Canceled,
	"deleting":   Serverfarm_Properties_ProvisioningState_STATUS_Deleting,
	"failed":     Serverfarm_Properties_ProvisioningState_STATUS_Failed,
	"inprogress": Serverfarm_Properties_ProvisioningState_STATUS_InProgress,
	"succeeded":  Serverfarm_Properties_ProvisioningState_STATUS_Succeeded,
}

type Serverfarm_Properties_Status_STATUS string

const (
	Serverfarm_Properties_Status_STATUS_Creating = Serverfarm_Properties_Status_STATUS("Creating")
	Serverfarm_Properties_Status_STATUS_Pending  = Serverfarm_Properties_Status_STATUS("Pending")
	Serverfarm_Properties_Status_STATUS_Ready    = Serverfarm_Properties_Status_STATUS("Ready")
)

// Mapping from string to Serverfarm_Properties_Status_STATUS
var serverfarm_Properties_Status_STATUS_Values = map[string]Serverfarm_Properties_Status_STATUS{
	"creating": Serverfarm_Properties_Status_STATUS_Creating,
	"pending":  Serverfarm_Properties_Status_STATUS_Pending,
	"ready":    Serverfarm_Properties_Status_STATUS_Ready,
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type ServerFarmOperatorSpec 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_ServerFarmOperatorSpec populates our ServerFarmOperatorSpec from the provided source ServerFarmOperatorSpec
func (operator *ServerFarmOperatorSpec) AssignProperties_From_ServerFarmOperatorSpec(source *storage.ServerFarmOperatorSpec) 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_ServerFarmOperatorSpec populates the provided destination ServerFarmOperatorSpec from our ServerFarmOperatorSpec
func (operator *ServerFarmOperatorSpec) AssignProperties_To_ServerFarmOperatorSpec(destination *storage.ServerFarmOperatorSpec) 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
}

// Description of a SKU for a scalable resource.
type SkuDescription struct {
	// Capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?
	Capabilities []Capability `json:"capabilities,omitempty"`

	// Capacity: Current number of instances assigned to the resource.
	Capacity *int `json:"capacity,omitempty"`

	// Family: Family code of the resource SKU.
	Family *string `json:"family,omitempty"`

	// Locations: Locations of the SKU.
	Locations []string `json:"locations,omitempty"`

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

	// Size: Size specifier of the resource SKU.
	Size *string `json:"size,omitempty"`

	// SkuCapacity: Min, max, and default scale values of the SKU.
	SkuCapacity *SkuCapacity `json:"skuCapacity,omitempty"`

	// Tier: Service tier of the resource SKU.
	Tier *string `json:"tier,omitempty"`
}

var _ genruntime.ARMTransformer = &SkuDescription{}

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

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

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

	// Set property "Family":
	if description.Family != nil {
		family := *description.Family
		result.Family = &family
	}

	// Set property "Locations":
	for _, item := range description.Locations {
		result.Locations = append(result.Locations, item)
	}

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

	// Set property "Size":
	if description.Size != nil {
		size := *description.Size
		result.Size = &size
	}

	// Set property "SkuCapacity":
	if description.SkuCapacity != nil {
		skuCapacity_ARM, err := description.SkuCapacity.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		skuCapacity := *skuCapacity_ARM.(*arm.SkuCapacity)
		result.SkuCapacity = &skuCapacity
	}

	// Set property "Tier":
	if description.Tier != nil {
		tier := *description.Tier
		result.Tier = &tier
	}
	return result, nil
}

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

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

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

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

	// Set property "Family":
	if typedInput.Family != nil {
		family := *typedInput.Family
		description.Family = &family
	}

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

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

	// Set property "Size":
	if typedInput.Size != nil {
		size := *typedInput.Size
		description.Size = &size
	}

	// Set property "SkuCapacity":
	if typedInput.SkuCapacity != nil {
		var skuCapacity1 SkuCapacity
		err := skuCapacity1.PopulateFromARM(owner, *typedInput.SkuCapacity)
		if err != nil {
			return err
		}
		skuCapacity := skuCapacity1
		description.SkuCapacity = &skuCapacity
	}

	// Set property "Tier":
	if typedInput.Tier != nil {
		tier := *typedInput.Tier
		description.Tier = &tier
	}

	// No error
	return nil
}

// AssignProperties_From_SkuDescription populates our SkuDescription from the provided source SkuDescription
func (description *SkuDescription) AssignProperties_From_SkuDescription(source *storage.SkuDescription) error {

	// Capabilities
	if source.Capabilities != nil {
		capabilityList := make([]Capability, len(source.Capabilities))
		for capabilityIndex, capabilityItem := range source.Capabilities {
			var capability Capability
			err := capability.AssignProperties_From_Capability(&capabilityItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Capability() to populate field Capabilities")
			}
			capabilityList[capabilityIndex] = capability
		}
		description.Capabilities = capabilityList
	} else {
		description.Capabilities = nil
	}

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

	// Family
	description.Family = genruntime.ClonePointerToString(source.Family)

	// Locations
	description.Locations = genruntime.CloneSliceOfString(source.Locations)

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

	// Size
	description.Size = genruntime.ClonePointerToString(source.Size)

	// SkuCapacity
	if source.SkuCapacity != nil {
		var skuCapacity SkuCapacity
		err := skuCapacity.AssignProperties_From_SkuCapacity(source.SkuCapacity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SkuCapacity() to populate field SkuCapacity")
		}
		description.SkuCapacity = &skuCapacity
	} else {
		description.SkuCapacity = nil
	}

	// Tier
	description.Tier = genruntime.ClonePointerToString(source.Tier)

	// No error
	return nil
}

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

	// Capabilities
	if description.Capabilities != nil {
		capabilityList := make([]storage.Capability, len(description.Capabilities))
		for capabilityIndex, capabilityItem := range description.Capabilities {
			var capability storage.Capability
			err := capabilityItem.AssignProperties_To_Capability(&capability)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Capability() to populate field Capabilities")
			}
			capabilityList[capabilityIndex] = capability
		}
		destination.Capabilities = capabilityList
	} else {
		destination.Capabilities = nil
	}

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

	// Family
	destination.Family = genruntime.ClonePointerToString(description.Family)

	// Locations
	destination.Locations = genruntime.CloneSliceOfString(description.Locations)

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

	// Size
	destination.Size = genruntime.ClonePointerToString(description.Size)

	// SkuCapacity
	if description.SkuCapacity != nil {
		var skuCapacity storage.SkuCapacity
		err := description.SkuCapacity.AssignProperties_To_SkuCapacity(&skuCapacity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SkuCapacity() to populate field SkuCapacity")
		}
		destination.SkuCapacity = &skuCapacity
	} else {
		destination.SkuCapacity = nil
	}

	// Tier
	destination.Tier = genruntime.ClonePointerToString(description.Tier)

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

	// No error
	return nil
}

// Initialize_From_SkuDescription_STATUS populates our SkuDescription from the provided source SkuDescription_STATUS
func (description *SkuDescription) Initialize_From_SkuDescription_STATUS(source *SkuDescription_STATUS) error {

	// Capabilities
	if source.Capabilities != nil {
		capabilityList := make([]Capability, len(source.Capabilities))
		for capabilityIndex, capabilityItem := range source.Capabilities {
			var capability Capability
			err := capability.Initialize_From_Capability_STATUS(&capabilityItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_Capability_STATUS() to populate field Capabilities")
			}
			capabilityList[capabilityIndex] = capability
		}
		description.Capabilities = capabilityList
	} else {
		description.Capabilities = nil
	}

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

	// Family
	description.Family = genruntime.ClonePointerToString(source.Family)

	// Locations
	description.Locations = genruntime.CloneSliceOfString(source.Locations)

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

	// Size
	description.Size = genruntime.ClonePointerToString(source.Size)

	// SkuCapacity
	if source.SkuCapacity != nil {
		var skuCapacity SkuCapacity
		err := skuCapacity.Initialize_From_SkuCapacity_STATUS(source.SkuCapacity)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SkuCapacity_STATUS() to populate field SkuCapacity")
		}
		description.SkuCapacity = &skuCapacity
	} else {
		description.SkuCapacity = nil
	}

	// Tier
	description.Tier = genruntime.ClonePointerToString(source.Tier)

	// No error
	return nil
}

// Description of a SKU for a scalable resource.
type SkuDescription_STATUS struct {
	// Capabilities: Capabilities of the SKU, e.g., is traffic manager enabled?
	Capabilities []Capability_STATUS `json:"capabilities,omitempty"`

	// Capacity: Current number of instances assigned to the resource.
	Capacity *int `json:"capacity,omitempty"`

	// Family: Family code of the resource SKU.
	Family *string `json:"family,omitempty"`

	// Locations: Locations of the SKU.
	Locations []string `json:"locations,omitempty"`

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

	// Size: Size specifier of the resource SKU.
	Size *string `json:"size,omitempty"`

	// SkuCapacity: Min, max, and default scale values of the SKU.
	SkuCapacity *SkuCapacity_STATUS `json:"skuCapacity,omitempty"`

	// Tier: Service tier of the resource SKU.
	Tier *string `json:"tier,omitempty"`
}

var _ genruntime.FromARMConverter = &SkuDescription_STATUS{}

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

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

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

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

	// Set property "Family":
	if typedInput.Family != nil {
		family := *typedInput.Family
		description.Family = &family
	}

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

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

	// Set property "Size":
	if typedInput.Size != nil {
		size := *typedInput.Size
		description.Size = &size
	}

	// Set property "SkuCapacity":
	if typedInput.SkuCapacity != nil {
		var skuCapacity1 SkuCapacity_STATUS
		err := skuCapacity1.PopulateFromARM(owner, *typedInput.SkuCapacity)
		if err != nil {
			return err
		}
		skuCapacity := skuCapacity1
		description.SkuCapacity = &skuCapacity
	}

	// Set property "Tier":
	if typedInput.Tier != nil {
		tier := *typedInput.Tier
		description.Tier = &tier
	}

	// No error
	return nil
}

// AssignProperties_From_SkuDescription_STATUS populates our SkuDescription_STATUS from the provided source SkuDescription_STATUS
func (description *SkuDescription_STATUS) AssignProperties_From_SkuDescription_STATUS(source *storage.SkuDescription_STATUS) error {

	// Capabilities
	if source.Capabilities != nil {
		capabilityList := make([]Capability_STATUS, len(source.Capabilities))
		for capabilityIndex, capabilityItem := range source.Capabilities {
			var capability Capability_STATUS
			err := capability.AssignProperties_From_Capability_STATUS(&capabilityItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Capability_STATUS() to populate field Capabilities")
			}
			capabilityList[capabilityIndex] = capability
		}
		description.Capabilities = capabilityList
	} else {
		description.Capabilities = nil
	}

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

	// Family
	description.Family = genruntime.ClonePointerToString(source.Family)

	// Locations
	description.Locations = genruntime.CloneSliceOfString(source.Locations)

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

	// Size
	description.Size = genruntime.ClonePointerToString(source.Size)

	// SkuCapacity
	if source.SkuCapacity != nil {
		var skuCapacity SkuCapacity_STATUS
		err := skuCapacity.AssignProperties_From_SkuCapacity_STATUS(source.SkuCapacity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SkuCapacity_STATUS() to populate field SkuCapacity")
		}
		description.SkuCapacity = &skuCapacity
	} else {
		description.SkuCapacity = nil
	}

	// Tier
	description.Tier = genruntime.ClonePointerToString(source.Tier)

	// No error
	return nil
}

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

	// Capabilities
	if description.Capabilities != nil {
		capabilityList := make([]storage.Capability_STATUS, len(description.Capabilities))
		for capabilityIndex, capabilityItem := range description.Capabilities {
			var capability storage.Capability_STATUS
			err := capabilityItem.AssignProperties_To_Capability_STATUS(&capability)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Capability_STATUS() to populate field Capabilities")
			}
			capabilityList[capabilityIndex] = capability
		}
		destination.Capabilities = capabilityList
	} else {
		destination.Capabilities = nil
	}

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

	// Family
	destination.Family = genruntime.ClonePointerToString(description.Family)

	// Locations
	destination.Locations = genruntime.CloneSliceOfString(description.Locations)

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

	// Size
	destination.Size = genruntime.ClonePointerToString(description.Size)

	// SkuCapacity
	if description.SkuCapacity != nil {
		var skuCapacity storage.SkuCapacity_STATUS
		err := description.SkuCapacity.AssignProperties_To_SkuCapacity_STATUS(&skuCapacity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SkuCapacity_STATUS() to populate field SkuCapacity")
		}
		destination.SkuCapacity = &skuCapacity
	} else {
		destination.SkuCapacity = nil
	}

	// Tier
	destination.Tier = genruntime.ClonePointerToString(description.Tier)

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

	// No error
	return nil
}

// Describes the capabilities/features allowed for a specific SKU.
type Capability struct {
	// Name: Name of the SKU capability.
	Name *string `json:"name,omitempty"`

	// Reason: Reason of the SKU capability.
	Reason *string `json:"reason,omitempty"`

	// Value: Value of the SKU capability.
	Value *string `json:"value,omitempty"`
}

var _ genruntime.ARMTransformer = &Capability{}

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

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

	// Set property "Reason":
	if capability.Reason != nil {
		reason := *capability.Reason
		result.Reason = &reason
	}

	// Set property "Value":
	if capability.Value != nil {
		value := *capability.Value
		result.Value = &value
	}
	return result, nil
}

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

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

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

	// Set property "Reason":
	if typedInput.Reason != nil {
		reason := *typedInput.Reason
		capability.Reason = &reason
	}

	// Set property "Value":
	if typedInput.Value != nil {
		value := *typedInput.Value
		capability.Value = &value
	}

	// No error
	return nil
}

// AssignProperties_From_Capability populates our Capability from the provided source Capability
func (capability *Capability) AssignProperties_From_Capability(source *storage.Capability) error {

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

	// Reason
	capability.Reason = genruntime.ClonePointerToString(source.Reason)

	// Value
	capability.Value = genruntime.ClonePointerToString(source.Value)

	// No error
	return nil
}

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

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

	// Reason
	destination.Reason = genruntime.ClonePointerToString(capability.Reason)

	// Value
	destination.Value = genruntime.ClonePointerToString(capability.Value)

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

	// No error
	return nil
}

// Initialize_From_Capability_STATUS populates our Capability from the provided source Capability_STATUS
func (capability *Capability) Initialize_From_Capability_STATUS(source *Capability_STATUS) error {

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

	// Reason
	capability.Reason = genruntime.ClonePointerToString(source.Reason)

	// Value
	capability.Value = genruntime.ClonePointerToString(source.Value)

	// No error
	return nil
}

// Describes the capabilities/features allowed for a specific SKU.
type Capability_STATUS struct {
	// Name: Name of the SKU capability.
	Name *string `json:"name,omitempty"`

	// Reason: Reason of the SKU capability.
	Reason *string `json:"reason,omitempty"`

	// Value: Value of the SKU capability.
	Value *string `json:"value,omitempty"`
}

var _ genruntime.FromARMConverter = &Capability_STATUS{}

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

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

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

	// Set property "Reason":
	if typedInput.Reason != nil {
		reason := *typedInput.Reason
		capability.Reason = &reason
	}

	// Set property "Value":
	if typedInput.Value != nil {
		value := *typedInput.Value
		capability.Value = &value
	}

	// No error
	return nil
}

// AssignProperties_From_Capability_STATUS populates our Capability_STATUS from the provided source Capability_STATUS
func (capability *Capability_STATUS) AssignProperties_From_Capability_STATUS(source *storage.Capability_STATUS) error {

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

	// Reason
	capability.Reason = genruntime.ClonePointerToString(source.Reason)

	// Value
	capability.Value = genruntime.ClonePointerToString(source.Value)

	// No error
	return nil
}

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

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

	// Reason
	destination.Reason = genruntime.ClonePointerToString(capability.Reason)

	// Value
	destination.Value = genruntime.ClonePointerToString(capability.Value)

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

	// No error
	return nil
}

// Description of the App Service plan scale options.
type SkuCapacity struct {
	// Default: Default number of workers for this App Service plan SKU.
	Default *int `json:"default,omitempty"`

	// ElasticMaximum: Maximum number of Elastic workers for this App Service plan SKU.
	ElasticMaximum *int `json:"elasticMaximum,omitempty"`

	// Maximum: Maximum number of workers for this App Service plan SKU.
	Maximum *int `json:"maximum,omitempty"`

	// Minimum: Minimum number of workers for this App Service plan SKU.
	Minimum *int `json:"minimum,omitempty"`

	// ScaleType: Available scale configurations for an App Service plan.
	ScaleType *string `json:"scaleType,omitempty"`
}

var _ genruntime.ARMTransformer = &SkuCapacity{}

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

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

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

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

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

	// Set property "ScaleType":
	if capacity.ScaleType != nil {
		scaleType := *capacity.ScaleType
		result.ScaleType = &scaleType
	}
	return result, nil
}

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

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

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_SkuCapacity populates our SkuCapacity from the provided source SkuCapacity
func (capacity *SkuCapacity) AssignProperties_From_SkuCapacity(source *storage.SkuCapacity) error {

	// Default
	capacity.Default = genruntime.ClonePointerToInt(source.Default)

	// ElasticMaximum
	capacity.ElasticMaximum = genruntime.ClonePointerToInt(source.ElasticMaximum)

	// Maximum
	capacity.Maximum = genruntime.ClonePointerToInt(source.Maximum)

	// Minimum
	capacity.Minimum = genruntime.ClonePointerToInt(source.Minimum)

	// ScaleType
	capacity.ScaleType = genruntime.ClonePointerToString(source.ScaleType)

	// No error
	return nil
}

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

	// Default
	destination.Default = genruntime.ClonePointerToInt(capacity.Default)

	// ElasticMaximum
	destination.ElasticMaximum = genruntime.ClonePointerToInt(capacity.ElasticMaximum)

	// Maximum
	destination.Maximum = genruntime.ClonePointerToInt(capacity.Maximum)

	// Minimum
	destination.Minimum = genruntime.ClonePointerToInt(capacity.Minimum)

	// ScaleType
	destination.ScaleType = genruntime.ClonePointerToString(capacity.ScaleType)

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

	// No error
	return nil
}

// Initialize_From_SkuCapacity_STATUS populates our SkuCapacity from the provided source SkuCapacity_STATUS
func (capacity *SkuCapacity) Initialize_From_SkuCapacity_STATUS(source *SkuCapacity_STATUS) error {

	// Default
	capacity.Default = genruntime.ClonePointerToInt(source.Default)

	// ElasticMaximum
	capacity.ElasticMaximum = genruntime.ClonePointerToInt(source.ElasticMaximum)

	// Maximum
	capacity.Maximum = genruntime.ClonePointerToInt(source.Maximum)

	// Minimum
	capacity.Minimum = genruntime.ClonePointerToInt(source.Minimum)

	// ScaleType
	capacity.ScaleType = genruntime.ClonePointerToString(source.ScaleType)

	// No error
	return nil
}

// Description of the App Service plan scale options.
type SkuCapacity_STATUS struct {
	// Default: Default number of workers for this App Service plan SKU.
	Default *int `json:"default,omitempty"`

	// ElasticMaximum: Maximum number of Elastic workers for this App Service plan SKU.
	ElasticMaximum *int `json:"elasticMaximum,omitempty"`

	// Maximum: Maximum number of workers for this App Service plan SKU.
	Maximum *int `json:"maximum,omitempty"`

	// Minimum: Minimum number of workers for this App Service plan SKU.
	Minimum *int `json:"minimum,omitempty"`

	// ScaleType: Available scale configurations for an App Service plan.
	ScaleType *string `json:"scaleType,omitempty"`
}

var _ genruntime.FromARMConverter = &SkuCapacity_STATUS{}

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

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

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_SkuCapacity_STATUS populates our SkuCapacity_STATUS from the provided source SkuCapacity_STATUS
func (capacity *SkuCapacity_STATUS) AssignProperties_From_SkuCapacity_STATUS(source *storage.SkuCapacity_STATUS) error {

	// Default
	capacity.Default = genruntime.ClonePointerToInt(source.Default)

	// ElasticMaximum
	capacity.ElasticMaximum = genruntime.ClonePointerToInt(source.ElasticMaximum)

	// Maximum
	capacity.Maximum = genruntime.ClonePointerToInt(source.Maximum)

	// Minimum
	capacity.Minimum = genruntime.ClonePointerToInt(source.Minimum)

	// ScaleType
	capacity.ScaleType = genruntime.ClonePointerToString(source.ScaleType)

	// No error
	return nil
}

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

	// Default
	destination.Default = genruntime.ClonePointerToInt(capacity.Default)

	// ElasticMaximum
	destination.ElasticMaximum = genruntime.ClonePointerToInt(capacity.ElasticMaximum)

	// Maximum
	destination.Maximum = genruntime.ClonePointerToInt(capacity.Maximum)

	// Minimum
	destination.Minimum = genruntime.ClonePointerToInt(capacity.Minimum)

	// ScaleType
	destination.ScaleType = genruntime.ClonePointerToString(capacity.ScaleType)

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&ServerFarm{}, &ServerFarmList{})
}
