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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/cdn/v1api20230501/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/cdn/v1api20230501/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,cdn}
// +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: /cdn/resource-manager/Microsoft.Cdn/Cdn/stable/2023-05-01/afdx.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}
type AfdOrigin struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              AfdOrigin_Spec   `json:"spec,omitempty"`
	Status            AfdOrigin_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &AfdOrigin{}

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

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

var _ conversion.Convertible = &AfdOrigin{}

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

	return origin.AssignProperties_From_AfdOrigin(source)
}

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

	return origin.AssignProperties_To_AfdOrigin(destination)
}

var _ configmaps.Exporter = &AfdOrigin{}

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

var _ secrets.Exporter = &AfdOrigin{}

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

var _ genruntime.ImportableResource = &AfdOrigin{}

// InitializeSpec initializes the spec for this resource from the given status
func (origin *AfdOrigin) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*AfdOrigin_STATUS); ok {
		return origin.Spec.Initialize_From_AfdOrigin_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &AfdOrigin{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Cdn/profiles/originGroups/origins"
func (origin *AfdOrigin) GetType() string {
	return "Microsoft.Cdn/profiles/originGroups/origins"
}

// NewEmptyStatus returns a new empty (blank) status
func (origin *AfdOrigin) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &AfdOrigin_STATUS{}
}

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

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

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

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

	origin.Status = st
	return nil
}

// AssignProperties_From_AfdOrigin populates our AfdOrigin from the provided source AfdOrigin
func (origin *AfdOrigin) AssignProperties_From_AfdOrigin(source *storage.AfdOrigin) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_AfdOrigin populates the provided destination AfdOrigin from our AfdOrigin
func (origin *AfdOrigin) AssignProperties_To_AfdOrigin(destination *storage.AfdOrigin) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /cdn/resource-manager/Microsoft.Cdn/Cdn/stable/2023-05-01/afdx.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/originGroups/{originGroupName}/origins/{originName}
type AfdOriginList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []AfdOrigin `json:"items"`
}

type AfdOrigin_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"`

	// AzureOrigin: Resource reference to the Azure origin resource.
	AzureOrigin *ResourceReference `json:"azureOrigin,omitempty"`

	// EnabledState: Whether to enable health probes to be made against backends defined under backendPools. Health probes can
	// only be disabled if there is a single enabled backend in single enabled backend pool.
	EnabledState *AFDOriginProperties_EnabledState `json:"enabledState,omitempty"`

	// EnforceCertificateNameCheck: Whether to enable certificate name check at origin level
	EnforceCertificateNameCheck *bool `json:"enforceCertificateNameCheck,omitempty"`

	// HostName: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be
	// unique across all origins in an endpoint.
	HostName *string `json:"hostName,omitempty" optionalConfigMapPair:"HostName"`

	// HostNameFromConfig: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This
	// should be unique across all origins in an endpoint.
	HostNameFromConfig *genruntime.ConfigMapReference `json:"hostNameFromConfig,omitempty" optionalConfigMapPair:"HostName"`

	// +kubebuilder:validation:Maximum=65535
	// +kubebuilder:validation:Minimum=1
	// HttpPort: The value of the HTTP port. Must be between 1 and 65535.
	HttpPort *int `json:"httpPort,omitempty"`

	// +kubebuilder:validation:Maximum=65535
	// +kubebuilder:validation:Minimum=1
	// HttpsPort: The value of the HTTPS port. Must be between 1 and 65535.
	HttpsPort *int `json:"httpsPort,omitempty"`

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

	// OriginHostHeader: The host header value sent to the origin with each request. If you leave this blank, the request
	// hostname determines this value. Azure Front Door origins, such as Web Apps, Blob Storage, and Cloud Services require
	// this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint
	OriginHostHeader *string `json:"originHostHeader,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 cdn.azure.com/AfdOriginGroup resource
	Owner *genruntime.KnownResourceReference `group:"cdn.azure.com" json:"owner,omitempty" kind:"AfdOriginGroup"`

	// +kubebuilder:validation:Maximum=5
	// +kubebuilder:validation:Minimum=1
	// Priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load
	// balancing if any lower priority origin is healthy.Must be between 1 and 5
	Priority *int `json:"priority,omitempty"`

	// SharedPrivateLinkResource: The properties of the private link resource for private origin.
	SharedPrivateLinkResource *SharedPrivateLinkResourceProperties `json:"sharedPrivateLinkResource,omitempty"`

	// +kubebuilder:validation:Maximum=1000
	// +kubebuilder:validation:Minimum=1
	// Weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000
	Weight *int `json:"weight,omitempty"`
}

var _ genruntime.ARMTransformer = &AfdOrigin_Spec{}

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

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

	// Set property "Properties":
	if origin.AzureOrigin != nil ||
		origin.EnabledState != nil ||
		origin.EnforceCertificateNameCheck != nil ||
		origin.HostName != nil ||
		origin.HostNameFromConfig != nil ||
		origin.HttpPort != nil ||
		origin.HttpsPort != nil ||
		origin.OriginHostHeader != nil ||
		origin.Priority != nil ||
		origin.SharedPrivateLinkResource != nil ||
		origin.Weight != nil {
		result.Properties = &arm.AFDOriginProperties{}
	}
	if origin.AzureOrigin != nil {
		azureOrigin_ARM, err := origin.AzureOrigin.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		azureOrigin := *azureOrigin_ARM.(*arm.ResourceReference)
		result.Properties.AzureOrigin = &azureOrigin
	}
	if origin.EnabledState != nil {
		var temp string
		temp = string(*origin.EnabledState)
		enabledState := arm.AFDOriginProperties_EnabledState(temp)
		result.Properties.EnabledState = &enabledState
	}
	if origin.EnforceCertificateNameCheck != nil {
		enforceCertificateNameCheck := *origin.EnforceCertificateNameCheck
		result.Properties.EnforceCertificateNameCheck = &enforceCertificateNameCheck
	}
	if origin.HostName != nil {
		hostName := *origin.HostName
		result.Properties.HostName = &hostName
	}
	if origin.HostNameFromConfig != nil {
		hostNameValue, err := resolved.ResolvedConfigMaps.Lookup(*origin.HostNameFromConfig)
		if err != nil {
			return nil, eris.Wrap(err, "looking up configmap for property HostName")
		}
		hostName := hostNameValue
		result.Properties.HostName = &hostName
	}
	if origin.HttpPort != nil {
		httpPort := *origin.HttpPort
		result.Properties.HttpPort = &httpPort
	}
	if origin.HttpsPort != nil {
		httpsPort := *origin.HttpsPort
		result.Properties.HttpsPort = &httpsPort
	}
	if origin.OriginHostHeader != nil {
		originHostHeader := *origin.OriginHostHeader
		result.Properties.OriginHostHeader = &originHostHeader
	}
	if origin.Priority != nil {
		priority := *origin.Priority
		result.Properties.Priority = &priority
	}
	if origin.SharedPrivateLinkResource != nil {
		sharedPrivateLinkResource_ARM, err := origin.SharedPrivateLinkResource.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		sharedPrivateLinkResource := *sharedPrivateLinkResource_ARM.(*arm.SharedPrivateLinkResourceProperties)
		result.Properties.SharedPrivateLinkResource = &sharedPrivateLinkResource
	}
	if origin.Weight != nil {
		weight := *origin.Weight
		result.Properties.Weight = &weight
	}
	return result, nil
}

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

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

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

	// Set property "AzureOrigin":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AzureOrigin != nil {
			var azureOrigin1 ResourceReference
			err := azureOrigin1.PopulateFromARM(owner, *typedInput.Properties.AzureOrigin)
			if err != nil {
				return err
			}
			azureOrigin := azureOrigin1
			origin.AzureOrigin = &azureOrigin
		}
	}

	// Set property "EnabledState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnabledState != nil {
			var temp string
			temp = string(*typedInput.Properties.EnabledState)
			enabledState := AFDOriginProperties_EnabledState(temp)
			origin.EnabledState = &enabledState
		}
	}

	// Set property "EnforceCertificateNameCheck":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnforceCertificateNameCheck != nil {
			enforceCertificateNameCheck := *typedInput.Properties.EnforceCertificateNameCheck
			origin.EnforceCertificateNameCheck = &enforceCertificateNameCheck
		}
	}

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

	// no assignment for property "HostNameFromConfig"

	// Set property "HttpPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HttpPort != nil {
			httpPort := *typedInput.Properties.HttpPort
			origin.HttpPort = &httpPort
		}
	}

	// Set property "HttpsPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HttpsPort != nil {
			httpsPort := *typedInput.Properties.HttpsPort
			origin.HttpsPort = &httpsPort
		}
	}

	// no assignment for property "OperatorSpec"

	// Set property "OriginHostHeader":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OriginHostHeader != nil {
			originHostHeader := *typedInput.Properties.OriginHostHeader
			origin.OriginHostHeader = &originHostHeader
		}
	}

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

	// Set property "Priority":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Priority != nil {
			priority := *typedInput.Properties.Priority
			origin.Priority = &priority
		}
	}

	// Set property "SharedPrivateLinkResource":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SharedPrivateLinkResource != nil {
			var sharedPrivateLinkResource1 SharedPrivateLinkResourceProperties
			err := sharedPrivateLinkResource1.PopulateFromARM(owner, *typedInput.Properties.SharedPrivateLinkResource)
			if err != nil {
				return err
			}
			sharedPrivateLinkResource := sharedPrivateLinkResource1
			origin.SharedPrivateLinkResource = &sharedPrivateLinkResource
		}
	}

	// Set property "Weight":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Weight != nil {
			weight := *typedInput.Properties.Weight
			origin.Weight = &weight
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &AfdOrigin_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.AfdOrigin_Spec{}
	err := origin.AssignProperties_To_AfdOrigin_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_AfdOrigin_Spec populates our AfdOrigin_Spec from the provided source AfdOrigin_Spec
func (origin *AfdOrigin_Spec) AssignProperties_From_AfdOrigin_Spec(source *storage.AfdOrigin_Spec) error {

	// AzureName
	origin.AzureName = source.AzureName

	// AzureOrigin
	if source.AzureOrigin != nil {
		var azureOrigin ResourceReference
		err := azureOrigin.AssignProperties_From_ResourceReference(source.AzureOrigin)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference() to populate field AzureOrigin")
		}
		origin.AzureOrigin = &azureOrigin
	} else {
		origin.AzureOrigin = nil
	}

	// EnabledState
	if source.EnabledState != nil {
		enabledState := *source.EnabledState
		enabledStateTemp := genruntime.ToEnum(enabledState, aFDOriginProperties_EnabledState_Values)
		origin.EnabledState = &enabledStateTemp
	} else {
		origin.EnabledState = nil
	}

	// EnforceCertificateNameCheck
	if source.EnforceCertificateNameCheck != nil {
		enforceCertificateNameCheck := *source.EnforceCertificateNameCheck
		origin.EnforceCertificateNameCheck = &enforceCertificateNameCheck
	} else {
		origin.EnforceCertificateNameCheck = nil
	}

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

	// HostNameFromConfig
	if source.HostNameFromConfig != nil {
		hostNameFromConfig := source.HostNameFromConfig.Copy()
		origin.HostNameFromConfig = &hostNameFromConfig
	} else {
		origin.HostNameFromConfig = nil
	}

	// HttpPort
	origin.HttpPort = genruntime.ClonePointerToInt(source.HttpPort)

	// HttpsPort
	origin.HttpsPort = genruntime.ClonePointerToInt(source.HttpsPort)

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

	// OriginHostHeader
	origin.OriginHostHeader = genruntime.ClonePointerToString(source.OriginHostHeader)

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

	// Priority
	origin.Priority = genruntime.ClonePointerToInt(source.Priority)

	// SharedPrivateLinkResource
	if source.SharedPrivateLinkResource != nil {
		var sharedPrivateLinkResource SharedPrivateLinkResourceProperties
		err := sharedPrivateLinkResource.AssignProperties_From_SharedPrivateLinkResourceProperties(source.SharedPrivateLinkResource)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SharedPrivateLinkResourceProperties() to populate field SharedPrivateLinkResource")
		}
		origin.SharedPrivateLinkResource = &sharedPrivateLinkResource
	} else {
		origin.SharedPrivateLinkResource = nil
	}

	// Weight
	origin.Weight = genruntime.ClonePointerToInt(source.Weight)

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = origin.AzureName

	// AzureOrigin
	if origin.AzureOrigin != nil {
		var azureOrigin storage.ResourceReference
		err := origin.AzureOrigin.AssignProperties_To_ResourceReference(&azureOrigin)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference() to populate field AzureOrigin")
		}
		destination.AzureOrigin = &azureOrigin
	} else {
		destination.AzureOrigin = nil
	}

	// EnabledState
	if origin.EnabledState != nil {
		enabledState := string(*origin.EnabledState)
		destination.EnabledState = &enabledState
	} else {
		destination.EnabledState = nil
	}

	// EnforceCertificateNameCheck
	if origin.EnforceCertificateNameCheck != nil {
		enforceCertificateNameCheck := *origin.EnforceCertificateNameCheck
		destination.EnforceCertificateNameCheck = &enforceCertificateNameCheck
	} else {
		destination.EnforceCertificateNameCheck = nil
	}

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

	// HostNameFromConfig
	if origin.HostNameFromConfig != nil {
		hostNameFromConfig := origin.HostNameFromConfig.Copy()
		destination.HostNameFromConfig = &hostNameFromConfig
	} else {
		destination.HostNameFromConfig = nil
	}

	// HttpPort
	destination.HttpPort = genruntime.ClonePointerToInt(origin.HttpPort)

	// HttpsPort
	destination.HttpsPort = genruntime.ClonePointerToInt(origin.HttpsPort)

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

	// OriginHostHeader
	destination.OriginHostHeader = genruntime.ClonePointerToString(origin.OriginHostHeader)

	// OriginalVersion
	destination.OriginalVersion = origin.OriginalVersion()

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

	// Priority
	destination.Priority = genruntime.ClonePointerToInt(origin.Priority)

	// SharedPrivateLinkResource
	if origin.SharedPrivateLinkResource != nil {
		var sharedPrivateLinkResource storage.SharedPrivateLinkResourceProperties
		err := origin.SharedPrivateLinkResource.AssignProperties_To_SharedPrivateLinkResourceProperties(&sharedPrivateLinkResource)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SharedPrivateLinkResourceProperties() to populate field SharedPrivateLinkResource")
		}
		destination.SharedPrivateLinkResource = &sharedPrivateLinkResource
	} else {
		destination.SharedPrivateLinkResource = nil
	}

	// Weight
	destination.Weight = genruntime.ClonePointerToInt(origin.Weight)

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

	// No error
	return nil
}

// Initialize_From_AfdOrigin_STATUS populates our AfdOrigin_Spec from the provided source AfdOrigin_STATUS
func (origin *AfdOrigin_Spec) Initialize_From_AfdOrigin_STATUS(source *AfdOrigin_STATUS) error {

	// AzureOrigin
	if source.AzureOrigin != nil {
		var azureOrigin ResourceReference
		err := azureOrigin.Initialize_From_ResourceReference_STATUS(source.AzureOrigin)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ResourceReference_STATUS() to populate field AzureOrigin")
		}
		origin.AzureOrigin = &azureOrigin
	} else {
		origin.AzureOrigin = nil
	}

	// EnabledState
	if source.EnabledState != nil {
		enabledState := genruntime.ToEnum(string(*source.EnabledState), aFDOriginProperties_EnabledState_Values)
		origin.EnabledState = &enabledState
	} else {
		origin.EnabledState = nil
	}

	// EnforceCertificateNameCheck
	if source.EnforceCertificateNameCheck != nil {
		enforceCertificateNameCheck := *source.EnforceCertificateNameCheck
		origin.EnforceCertificateNameCheck = &enforceCertificateNameCheck
	} else {
		origin.EnforceCertificateNameCheck = nil
	}

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

	// HttpPort
	origin.HttpPort = genruntime.ClonePointerToInt(source.HttpPort)

	// HttpsPort
	origin.HttpsPort = genruntime.ClonePointerToInt(source.HttpsPort)

	// OriginHostHeader
	origin.OriginHostHeader = genruntime.ClonePointerToString(source.OriginHostHeader)

	// Priority
	origin.Priority = genruntime.ClonePointerToInt(source.Priority)

	// SharedPrivateLinkResource
	if source.SharedPrivateLinkResource != nil {
		var sharedPrivateLinkResource SharedPrivateLinkResourceProperties
		err := sharedPrivateLinkResource.Initialize_From_SharedPrivateLinkResourceProperties_STATUS(source.SharedPrivateLinkResource)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SharedPrivateLinkResourceProperties_STATUS() to populate field SharedPrivateLinkResource")
		}
		origin.SharedPrivateLinkResource = &sharedPrivateLinkResource
	} else {
		origin.SharedPrivateLinkResource = nil
	}

	// Weight
	origin.Weight = genruntime.ClonePointerToInt(source.Weight)

	// No error
	return nil
}

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

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

type AfdOrigin_STATUS struct {
	// AzureOrigin: Resource reference to the Azure origin resource.
	AzureOrigin *ResourceReference_STATUS `json:"azureOrigin,omitempty"`

	// Conditions: The observed state of the resource
	Conditions       []conditions.Condition                       `json:"conditions,omitempty"`
	DeploymentStatus *AFDOriginProperties_DeploymentStatus_STATUS `json:"deploymentStatus,omitempty"`

	// EnabledState: Whether to enable health probes to be made against backends defined under backendPools. Health probes can
	// only be disabled if there is a single enabled backend in single enabled backend pool.
	EnabledState *AFDOriginProperties_EnabledState_STATUS `json:"enabledState,omitempty"`

	// EnforceCertificateNameCheck: Whether to enable certificate name check at origin level
	EnforceCertificateNameCheck *bool `json:"enforceCertificateNameCheck,omitempty"`

	// HostName: The address of the origin. Domain names, IPv4 addresses, and IPv6 addresses are supported.This should be
	// unique across all origins in an endpoint.
	HostName *string `json:"hostName,omitempty"`

	// HttpPort: The value of the HTTP port. Must be between 1 and 65535.
	HttpPort *int `json:"httpPort,omitempty"`

	// HttpsPort: The value of the HTTPS port. Must be between 1 and 65535.
	HttpsPort *int `json:"httpsPort,omitempty"`

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

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

	// OriginGroupName: The name of the origin group which contains this origin.
	OriginGroupName *string `json:"originGroupName,omitempty"`

	// OriginHostHeader: The host header value sent to the origin with each request. If you leave this blank, the request
	// hostname determines this value. Azure Front Door origins, such as Web Apps, Blob Storage, and Cloud Services require
	// this host header value to match the origin hostname by default. This overrides the host header defined at Endpoint
	OriginHostHeader *string `json:"originHostHeader,omitempty"`

	// Priority: Priority of origin in given origin group for load balancing. Higher priorities will not be used for load
	// balancing if any lower priority origin is healthy.Must be between 1 and 5
	Priority *int `json:"priority,omitempty"`

	// ProvisioningState: Provisioning status
	ProvisioningState *AFDOriginProperties_ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// SharedPrivateLinkResource: The properties of the private link resource for private origin.
	SharedPrivateLinkResource *SharedPrivateLinkResourceProperties_STATUS `json:"sharedPrivateLinkResource,omitempty"`

	// SystemData: Read only system data
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

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

	// Weight: Weight of the origin in given origin group for load balancing. Must be between 1 and 1000
	Weight *int `json:"weight,omitempty"`
}

var _ genruntime.ConvertibleStatus = &AfdOrigin_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.AfdOrigin_STATUS{}
	err := origin.AssignProperties_To_AfdOrigin_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 = &AfdOrigin_STATUS{}

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

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

	// Set property "AzureOrigin":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AzureOrigin != nil {
			var azureOrigin1 ResourceReference_STATUS
			err := azureOrigin1.PopulateFromARM(owner, *typedInput.Properties.AzureOrigin)
			if err != nil {
				return err
			}
			azureOrigin := azureOrigin1
			origin.AzureOrigin = &azureOrigin
		}
	}

	// no assignment for property "Conditions"

	// Set property "DeploymentStatus":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeploymentStatus != nil {
			var temp string
			temp = string(*typedInput.Properties.DeploymentStatus)
			deploymentStatus := AFDOriginProperties_DeploymentStatus_STATUS(temp)
			origin.DeploymentStatus = &deploymentStatus
		}
	}

	// Set property "EnabledState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnabledState != nil {
			var temp string
			temp = string(*typedInput.Properties.EnabledState)
			enabledState := AFDOriginProperties_EnabledState_STATUS(temp)
			origin.EnabledState = &enabledState
		}
	}

	// Set property "EnforceCertificateNameCheck":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnforceCertificateNameCheck != nil {
			enforceCertificateNameCheck := *typedInput.Properties.EnforceCertificateNameCheck
			origin.EnforceCertificateNameCheck = &enforceCertificateNameCheck
		}
	}

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

	// Set property "HttpPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HttpPort != nil {
			httpPort := *typedInput.Properties.HttpPort
			origin.HttpPort = &httpPort
		}
	}

	// Set property "HttpsPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HttpsPort != nil {
			httpsPort := *typedInput.Properties.HttpsPort
			origin.HttpsPort = &httpsPort
		}
	}

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

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

	// Set property "OriginGroupName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OriginGroupName != nil {
			originGroupName := *typedInput.Properties.OriginGroupName
			origin.OriginGroupName = &originGroupName
		}
	}

	// Set property "OriginHostHeader":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OriginHostHeader != nil {
			originHostHeader := *typedInput.Properties.OriginHostHeader
			origin.OriginHostHeader = &originHostHeader
		}
	}

	// Set property "Priority":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Priority != nil {
			priority := *typedInput.Properties.Priority
			origin.Priority = &priority
		}
	}

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

	// Set property "SharedPrivateLinkResource":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SharedPrivateLinkResource != nil {
			var sharedPrivateLinkResource1 SharedPrivateLinkResourceProperties_STATUS
			err := sharedPrivateLinkResource1.PopulateFromARM(owner, *typedInput.Properties.SharedPrivateLinkResource)
			if err != nil {
				return err
			}
			sharedPrivateLinkResource := sharedPrivateLinkResource1
			origin.SharedPrivateLinkResource = &sharedPrivateLinkResource
		}
	}

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

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

	// Set property "Weight":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Weight != nil {
			weight := *typedInput.Properties.Weight
			origin.Weight = &weight
		}
	}

	// No error
	return nil
}

// AssignProperties_From_AfdOrigin_STATUS populates our AfdOrigin_STATUS from the provided source AfdOrigin_STATUS
func (origin *AfdOrigin_STATUS) AssignProperties_From_AfdOrigin_STATUS(source *storage.AfdOrigin_STATUS) error {

	// AzureOrigin
	if source.AzureOrigin != nil {
		var azureOrigin ResourceReference_STATUS
		err := azureOrigin.AssignProperties_From_ResourceReference_STATUS(source.AzureOrigin)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference_STATUS() to populate field AzureOrigin")
		}
		origin.AzureOrigin = &azureOrigin
	} else {
		origin.AzureOrigin = nil
	}

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

	// DeploymentStatus
	if source.DeploymentStatus != nil {
		deploymentStatus := *source.DeploymentStatus
		deploymentStatusTemp := genruntime.ToEnum(deploymentStatus, aFDOriginProperties_DeploymentStatus_STATUS_Values)
		origin.DeploymentStatus = &deploymentStatusTemp
	} else {
		origin.DeploymentStatus = nil
	}

	// EnabledState
	if source.EnabledState != nil {
		enabledState := *source.EnabledState
		enabledStateTemp := genruntime.ToEnum(enabledState, aFDOriginProperties_EnabledState_STATUS_Values)
		origin.EnabledState = &enabledStateTemp
	} else {
		origin.EnabledState = nil
	}

	// EnforceCertificateNameCheck
	if source.EnforceCertificateNameCheck != nil {
		enforceCertificateNameCheck := *source.EnforceCertificateNameCheck
		origin.EnforceCertificateNameCheck = &enforceCertificateNameCheck
	} else {
		origin.EnforceCertificateNameCheck = nil
	}

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

	// HttpPort
	origin.HttpPort = genruntime.ClonePointerToInt(source.HttpPort)

	// HttpsPort
	origin.HttpsPort = genruntime.ClonePointerToInt(source.HttpsPort)

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

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

	// OriginGroupName
	origin.OriginGroupName = genruntime.ClonePointerToString(source.OriginGroupName)

	// OriginHostHeader
	origin.OriginHostHeader = genruntime.ClonePointerToString(source.OriginHostHeader)

	// Priority
	origin.Priority = genruntime.ClonePointerToInt(source.Priority)

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

	// SharedPrivateLinkResource
	if source.SharedPrivateLinkResource != nil {
		var sharedPrivateLinkResource SharedPrivateLinkResourceProperties_STATUS
		err := sharedPrivateLinkResource.AssignProperties_From_SharedPrivateLinkResourceProperties_STATUS(source.SharedPrivateLinkResource)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SharedPrivateLinkResourceProperties_STATUS() to populate field SharedPrivateLinkResource")
		}
		origin.SharedPrivateLinkResource = &sharedPrivateLinkResource
	} else {
		origin.SharedPrivateLinkResource = nil
	}

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

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

	// Weight
	origin.Weight = genruntime.ClonePointerToInt(source.Weight)

	// No error
	return nil
}

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

	// AzureOrigin
	if origin.AzureOrigin != nil {
		var azureOrigin storage.ResourceReference_STATUS
		err := origin.AzureOrigin.AssignProperties_To_ResourceReference_STATUS(&azureOrigin)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference_STATUS() to populate field AzureOrigin")
		}
		destination.AzureOrigin = &azureOrigin
	} else {
		destination.AzureOrigin = nil
	}

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

	// DeploymentStatus
	if origin.DeploymentStatus != nil {
		deploymentStatus := string(*origin.DeploymentStatus)
		destination.DeploymentStatus = &deploymentStatus
	} else {
		destination.DeploymentStatus = nil
	}

	// EnabledState
	if origin.EnabledState != nil {
		enabledState := string(*origin.EnabledState)
		destination.EnabledState = &enabledState
	} else {
		destination.EnabledState = nil
	}

	// EnforceCertificateNameCheck
	if origin.EnforceCertificateNameCheck != nil {
		enforceCertificateNameCheck := *origin.EnforceCertificateNameCheck
		destination.EnforceCertificateNameCheck = &enforceCertificateNameCheck
	} else {
		destination.EnforceCertificateNameCheck = nil
	}

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

	// HttpPort
	destination.HttpPort = genruntime.ClonePointerToInt(origin.HttpPort)

	// HttpsPort
	destination.HttpsPort = genruntime.ClonePointerToInt(origin.HttpsPort)

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

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

	// OriginGroupName
	destination.OriginGroupName = genruntime.ClonePointerToString(origin.OriginGroupName)

	// OriginHostHeader
	destination.OriginHostHeader = genruntime.ClonePointerToString(origin.OriginHostHeader)

	// Priority
	destination.Priority = genruntime.ClonePointerToInt(origin.Priority)

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

	// SharedPrivateLinkResource
	if origin.SharedPrivateLinkResource != nil {
		var sharedPrivateLinkResource storage.SharedPrivateLinkResourceProperties_STATUS
		err := origin.SharedPrivateLinkResource.AssignProperties_To_SharedPrivateLinkResourceProperties_STATUS(&sharedPrivateLinkResource)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SharedPrivateLinkResourceProperties_STATUS() to populate field SharedPrivateLinkResource")
		}
		destination.SharedPrivateLinkResource = &sharedPrivateLinkResource
	} else {
		destination.SharedPrivateLinkResource = nil
	}

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

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

	// Weight
	destination.Weight = genruntime.ClonePointerToInt(origin.Weight)

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

	// No error
	return nil
}

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

type AFDOriginProperties_DeploymentStatus_STATUS string

const (
	AFDOriginProperties_DeploymentStatus_STATUS_Failed     = AFDOriginProperties_DeploymentStatus_STATUS("Failed")
	AFDOriginProperties_DeploymentStatus_STATUS_InProgress = AFDOriginProperties_DeploymentStatus_STATUS("InProgress")
	AFDOriginProperties_DeploymentStatus_STATUS_NotStarted = AFDOriginProperties_DeploymentStatus_STATUS("NotStarted")
	AFDOriginProperties_DeploymentStatus_STATUS_Succeeded  = AFDOriginProperties_DeploymentStatus_STATUS("Succeeded")
)

// Mapping from string to AFDOriginProperties_DeploymentStatus_STATUS
var aFDOriginProperties_DeploymentStatus_STATUS_Values = map[string]AFDOriginProperties_DeploymentStatus_STATUS{
	"failed":     AFDOriginProperties_DeploymentStatus_STATUS_Failed,
	"inprogress": AFDOriginProperties_DeploymentStatus_STATUS_InProgress,
	"notstarted": AFDOriginProperties_DeploymentStatus_STATUS_NotStarted,
	"succeeded":  AFDOriginProperties_DeploymentStatus_STATUS_Succeeded,
}

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

const (
	AFDOriginProperties_EnabledState_Disabled = AFDOriginProperties_EnabledState("Disabled")
	AFDOriginProperties_EnabledState_Enabled  = AFDOriginProperties_EnabledState("Enabled")
)

// Mapping from string to AFDOriginProperties_EnabledState
var aFDOriginProperties_EnabledState_Values = map[string]AFDOriginProperties_EnabledState{
	"disabled": AFDOriginProperties_EnabledState_Disabled,
	"enabled":  AFDOriginProperties_EnabledState_Enabled,
}

type AFDOriginProperties_EnabledState_STATUS string

const (
	AFDOriginProperties_EnabledState_STATUS_Disabled = AFDOriginProperties_EnabledState_STATUS("Disabled")
	AFDOriginProperties_EnabledState_STATUS_Enabled  = AFDOriginProperties_EnabledState_STATUS("Enabled")
)

// Mapping from string to AFDOriginProperties_EnabledState_STATUS
var aFDOriginProperties_EnabledState_STATUS_Values = map[string]AFDOriginProperties_EnabledState_STATUS{
	"disabled": AFDOriginProperties_EnabledState_STATUS_Disabled,
	"enabled":  AFDOriginProperties_EnabledState_STATUS_Enabled,
}

type AFDOriginProperties_ProvisioningState_STATUS string

const (
	AFDOriginProperties_ProvisioningState_STATUS_Creating  = AFDOriginProperties_ProvisioningState_STATUS("Creating")
	AFDOriginProperties_ProvisioningState_STATUS_Deleting  = AFDOriginProperties_ProvisioningState_STATUS("Deleting")
	AFDOriginProperties_ProvisioningState_STATUS_Failed    = AFDOriginProperties_ProvisioningState_STATUS("Failed")
	AFDOriginProperties_ProvisioningState_STATUS_Succeeded = AFDOriginProperties_ProvisioningState_STATUS("Succeeded")
	AFDOriginProperties_ProvisioningState_STATUS_Updating  = AFDOriginProperties_ProvisioningState_STATUS("Updating")
)

// Mapping from string to AFDOriginProperties_ProvisioningState_STATUS
var aFDOriginProperties_ProvisioningState_STATUS_Values = map[string]AFDOriginProperties_ProvisioningState_STATUS{
	"creating":  AFDOriginProperties_ProvisioningState_STATUS_Creating,
	"deleting":  AFDOriginProperties_ProvisioningState_STATUS_Deleting,
	"failed":    AFDOriginProperties_ProvisioningState_STATUS_Failed,
	"succeeded": AFDOriginProperties_ProvisioningState_STATUS_Succeeded,
	"updating":  AFDOriginProperties_ProvisioningState_STATUS_Updating,
}

// Describes the properties of an existing Shared Private Link Resource to use when connecting to a private origin.
type SharedPrivateLinkResourceProperties struct {
	// GroupId: The group id from the provider of resource the shared private link resource is for.
	GroupId *string `json:"groupId,omitempty"`

	// PrivateLink: The resource id of the resource the shared private link resource is for.
	PrivateLink *ResourceReference `json:"privateLink,omitempty"`

	// PrivateLinkLocation: The location of the shared private link resource
	PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"`

	// RequestMessage: The request message for requesting approval of the shared private link resource.
	RequestMessage *string `json:"requestMessage,omitempty"`

	// Status: Status of the shared private link resource. Can be Pending, Approved, Rejected, Disconnected, or Timeout.
	Status *SharedPrivateLinkResourceProperties_Status `json:"status,omitempty"`
}

var _ genruntime.ARMTransformer = &SharedPrivateLinkResourceProperties{}

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

	// Set property "GroupId":
	if properties.GroupId != nil {
		groupId := *properties.GroupId
		result.GroupId = &groupId
	}

	// Set property "PrivateLink":
	if properties.PrivateLink != nil {
		privateLink_ARM, err := properties.PrivateLink.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		privateLink := *privateLink_ARM.(*arm.ResourceReference)
		result.PrivateLink = &privateLink
	}

	// Set property "PrivateLinkLocation":
	if properties.PrivateLinkLocation != nil {
		privateLinkLocation := *properties.PrivateLinkLocation
		result.PrivateLinkLocation = &privateLinkLocation
	}

	// Set property "RequestMessage":
	if properties.RequestMessage != nil {
		requestMessage := *properties.RequestMessage
		result.RequestMessage = &requestMessage
	}

	// Set property "Status":
	if properties.Status != nil {
		var temp string
		temp = string(*properties.Status)
		status := arm.SharedPrivateLinkResourceProperties_Status(temp)
		result.Status = &status
	}
	return result, nil
}

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

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

	// Set property "GroupId":
	if typedInput.GroupId != nil {
		groupId := *typedInput.GroupId
		properties.GroupId = &groupId
	}

	// Set property "PrivateLink":
	if typedInput.PrivateLink != nil {
		var privateLink1 ResourceReference
		err := privateLink1.PopulateFromARM(owner, *typedInput.PrivateLink)
		if err != nil {
			return err
		}
		privateLink := privateLink1
		properties.PrivateLink = &privateLink
	}

	// Set property "PrivateLinkLocation":
	if typedInput.PrivateLinkLocation != nil {
		privateLinkLocation := *typedInput.PrivateLinkLocation
		properties.PrivateLinkLocation = &privateLinkLocation
	}

	// Set property "RequestMessage":
	if typedInput.RequestMessage != nil {
		requestMessage := *typedInput.RequestMessage
		properties.RequestMessage = &requestMessage
	}

	// Set property "Status":
	if typedInput.Status != nil {
		var temp string
		temp = string(*typedInput.Status)
		status := SharedPrivateLinkResourceProperties_Status(temp)
		properties.Status = &status
	}

	// No error
	return nil
}

// AssignProperties_From_SharedPrivateLinkResourceProperties populates our SharedPrivateLinkResourceProperties from the provided source SharedPrivateLinkResourceProperties
func (properties *SharedPrivateLinkResourceProperties) AssignProperties_From_SharedPrivateLinkResourceProperties(source *storage.SharedPrivateLinkResourceProperties) error {

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

	// PrivateLink
	if source.PrivateLink != nil {
		var privateLink ResourceReference
		err := privateLink.AssignProperties_From_ResourceReference(source.PrivateLink)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference() to populate field PrivateLink")
		}
		properties.PrivateLink = &privateLink
	} else {
		properties.PrivateLink = nil
	}

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

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

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

	// No error
	return nil
}

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

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

	// PrivateLink
	if properties.PrivateLink != nil {
		var privateLink storage.ResourceReference
		err := properties.PrivateLink.AssignProperties_To_ResourceReference(&privateLink)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference() to populate field PrivateLink")
		}
		destination.PrivateLink = &privateLink
	} else {
		destination.PrivateLink = nil
	}

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

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

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

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

	// No error
	return nil
}

// Initialize_From_SharedPrivateLinkResourceProperties_STATUS populates our SharedPrivateLinkResourceProperties from the provided source SharedPrivateLinkResourceProperties_STATUS
func (properties *SharedPrivateLinkResourceProperties) Initialize_From_SharedPrivateLinkResourceProperties_STATUS(source *SharedPrivateLinkResourceProperties_STATUS) error {

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

	// PrivateLink
	if source.PrivateLink != nil {
		var privateLink ResourceReference
		err := privateLink.Initialize_From_ResourceReference_STATUS(source.PrivateLink)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ResourceReference_STATUS() to populate field PrivateLink")
		}
		properties.PrivateLink = &privateLink
	} else {
		properties.PrivateLink = nil
	}

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

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

	// Status
	if source.Status != nil {
		status := genruntime.ToEnum(string(*source.Status), sharedPrivateLinkResourceProperties_Status_Values)
		properties.Status = &status
	} else {
		properties.Status = nil
	}

	// No error
	return nil
}

// Describes the properties of an existing Shared Private Link Resource to use when connecting to a private origin.
type SharedPrivateLinkResourceProperties_STATUS struct {
	// GroupId: The group id from the provider of resource the shared private link resource is for.
	GroupId *string `json:"groupId,omitempty"`

	// PrivateLink: The resource id of the resource the shared private link resource is for.
	PrivateLink *ResourceReference_STATUS `json:"privateLink,omitempty"`

	// PrivateLinkLocation: The location of the shared private link resource
	PrivateLinkLocation *string `json:"privateLinkLocation,omitempty"`

	// RequestMessage: The request message for requesting approval of the shared private link resource.
	RequestMessage *string `json:"requestMessage,omitempty"`

	// Status: Status of the shared private link resource. Can be Pending, Approved, Rejected, Disconnected, or Timeout.
	Status *SharedPrivateLinkResourceProperties_Status_STATUS `json:"status,omitempty"`
}

var _ genruntime.FromARMConverter = &SharedPrivateLinkResourceProperties_STATUS{}

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

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

	// Set property "GroupId":
	if typedInput.GroupId != nil {
		groupId := *typedInput.GroupId
		properties.GroupId = &groupId
	}

	// Set property "PrivateLink":
	if typedInput.PrivateLink != nil {
		var privateLink1 ResourceReference_STATUS
		err := privateLink1.PopulateFromARM(owner, *typedInput.PrivateLink)
		if err != nil {
			return err
		}
		privateLink := privateLink1
		properties.PrivateLink = &privateLink
	}

	// Set property "PrivateLinkLocation":
	if typedInput.PrivateLinkLocation != nil {
		privateLinkLocation := *typedInput.PrivateLinkLocation
		properties.PrivateLinkLocation = &privateLinkLocation
	}

	// Set property "RequestMessage":
	if typedInput.RequestMessage != nil {
		requestMessage := *typedInput.RequestMessage
		properties.RequestMessage = &requestMessage
	}

	// Set property "Status":
	if typedInput.Status != nil {
		var temp string
		temp = string(*typedInput.Status)
		status := SharedPrivateLinkResourceProperties_Status_STATUS(temp)
		properties.Status = &status
	}

	// No error
	return nil
}

// AssignProperties_From_SharedPrivateLinkResourceProperties_STATUS populates our SharedPrivateLinkResourceProperties_STATUS from the provided source SharedPrivateLinkResourceProperties_STATUS
func (properties *SharedPrivateLinkResourceProperties_STATUS) AssignProperties_From_SharedPrivateLinkResourceProperties_STATUS(source *storage.SharedPrivateLinkResourceProperties_STATUS) error {

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

	// PrivateLink
	if source.PrivateLink != nil {
		var privateLink ResourceReference_STATUS
		err := privateLink.AssignProperties_From_ResourceReference_STATUS(source.PrivateLink)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceReference_STATUS() to populate field PrivateLink")
		}
		properties.PrivateLink = &privateLink
	} else {
		properties.PrivateLink = nil
	}

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

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

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

	// No error
	return nil
}

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

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

	// PrivateLink
	if properties.PrivateLink != nil {
		var privateLink storage.ResourceReference_STATUS
		err := properties.PrivateLink.AssignProperties_To_ResourceReference_STATUS(&privateLink)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceReference_STATUS() to populate field PrivateLink")
		}
		destination.PrivateLink = &privateLink
	} else {
		destination.PrivateLink = nil
	}

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

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Approved","Disconnected","Pending","Rejected","Timeout"}
type SharedPrivateLinkResourceProperties_Status string

const (
	SharedPrivateLinkResourceProperties_Status_Approved     = SharedPrivateLinkResourceProperties_Status("Approved")
	SharedPrivateLinkResourceProperties_Status_Disconnected = SharedPrivateLinkResourceProperties_Status("Disconnected")
	SharedPrivateLinkResourceProperties_Status_Pending      = SharedPrivateLinkResourceProperties_Status("Pending")
	SharedPrivateLinkResourceProperties_Status_Rejected     = SharedPrivateLinkResourceProperties_Status("Rejected")
	SharedPrivateLinkResourceProperties_Status_Timeout      = SharedPrivateLinkResourceProperties_Status("Timeout")
)

// Mapping from string to SharedPrivateLinkResourceProperties_Status
var sharedPrivateLinkResourceProperties_Status_Values = map[string]SharedPrivateLinkResourceProperties_Status{
	"approved":     SharedPrivateLinkResourceProperties_Status_Approved,
	"disconnected": SharedPrivateLinkResourceProperties_Status_Disconnected,
	"pending":      SharedPrivateLinkResourceProperties_Status_Pending,
	"rejected":     SharedPrivateLinkResourceProperties_Status_Rejected,
	"timeout":      SharedPrivateLinkResourceProperties_Status_Timeout,
}

type SharedPrivateLinkResourceProperties_Status_STATUS string

const (
	SharedPrivateLinkResourceProperties_Status_STATUS_Approved     = SharedPrivateLinkResourceProperties_Status_STATUS("Approved")
	SharedPrivateLinkResourceProperties_Status_STATUS_Disconnected = SharedPrivateLinkResourceProperties_Status_STATUS("Disconnected")
	SharedPrivateLinkResourceProperties_Status_STATUS_Pending      = SharedPrivateLinkResourceProperties_Status_STATUS("Pending")
	SharedPrivateLinkResourceProperties_Status_STATUS_Rejected     = SharedPrivateLinkResourceProperties_Status_STATUS("Rejected")
	SharedPrivateLinkResourceProperties_Status_STATUS_Timeout      = SharedPrivateLinkResourceProperties_Status_STATUS("Timeout")
)

// Mapping from string to SharedPrivateLinkResourceProperties_Status_STATUS
var sharedPrivateLinkResourceProperties_Status_STATUS_Values = map[string]SharedPrivateLinkResourceProperties_Status_STATUS{
	"approved":     SharedPrivateLinkResourceProperties_Status_STATUS_Approved,
	"disconnected": SharedPrivateLinkResourceProperties_Status_STATUS_Disconnected,
	"pending":      SharedPrivateLinkResourceProperties_Status_STATUS_Pending,
	"rejected":     SharedPrivateLinkResourceProperties_Status_STATUS_Rejected,
	"timeout":      SharedPrivateLinkResourceProperties_Status_STATUS_Timeout,
}

func init() {
	SchemeBuilder.Register(&AfdOrigin{}, &AfdOriginList{})
}
