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

import (
	"context"
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/network/v1api20240301/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/network/v1api20240301/storage"
	"github.com/Azure/azure-service-operator/v2/internal/genericarmclient"
	"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/go-logr/logr"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,network}
// +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: /network/resource-manager/Microsoft.Network/stable/2024-03-01/privateLinkService.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}
type PrivateLinkService struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              PrivateLinkService_Spec   `json:"spec,omitempty"`
	Status            PrivateLinkService_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &PrivateLinkService{}

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

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

var _ conversion.Convertible = &PrivateLinkService{}

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

	return service.AssignProperties_From_PrivateLinkService(source)
}

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

	return service.AssignProperties_To_PrivateLinkService(destination)
}

var _ configmaps.Exporter = &PrivateLinkService{}

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

var _ secrets.Exporter = &PrivateLinkService{}

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

var _ genruntime.ImportableResource = &PrivateLinkService{}

// InitializeSpec initializes the spec for this resource from the given status
func (service *PrivateLinkService) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*PrivateLinkService_STATUS); ok {
		return service.Spec.Initialize_From_PrivateLinkService_STATUS(s)
	}

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

var _ genruntime.KubernetesConfigExporter = &PrivateLinkService{}

// ExportKubernetesConfigMaps defines a resource which can create ConfigMaps in Kubernetes.
func (service *PrivateLinkService) ExportKubernetesConfigMaps(_ context.Context, _ genruntime.MetaObject, _ *genericarmclient.GenericClient, _ logr.Logger) ([]client.Object, error) {
	collector := configmaps.NewCollector(service.Namespace)
	if service.Spec.OperatorSpec != nil && service.Spec.OperatorSpec.ConfigMaps != nil {
		if service.Status.Alias != nil {
			collector.AddValue(service.Spec.OperatorSpec.ConfigMaps.Alias, *service.Status.Alias)
		}
	}
	result, err := collector.Values()
	if err != nil {
		return nil, err
	}
	return configmaps.SliceToClientObjectSlice(result), nil
}

var _ genruntime.KubernetesResource = &PrivateLinkService{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/privateLinkServices"
func (service *PrivateLinkService) GetType() string {
	return "Microsoft.Network/privateLinkServices"
}

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

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

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

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

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

	service.Status = st
	return nil
}

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

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

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

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

	// No error
	return nil
}

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

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2024-03-01/privateLinkService.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}
type PrivateLinkServiceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []PrivateLinkService `json:"items"`
}

type PrivateLinkService_Spec struct {
	// AutoApproval: The auto-approval list of the private link service.
	AutoApproval *ResourceSet `json:"autoApproval,omitempty"`

	// 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"`

	// DestinationIPAddress: The destination IP address of the private link service.
	DestinationIPAddress *string `json:"destinationIPAddress,omitempty"`

	// EnableProxyProtocol: Whether the private link service is enabled for proxy protocol or not.
	EnableProxyProtocol *bool `json:"enableProxyProtocol,omitempty"`

	// ExtendedLocation: The extended location of the load balancer.
	ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"`

	// Fqdns: The list of Fqdn.
	Fqdns []string `json:"fqdns,omitempty"`

	// IpConfigurations: An array of private link service IP configurations.
	IpConfigurations []PrivateLinkServiceIpConfiguration `json:"ipConfigurations,omitempty"`

	// LoadBalancerFrontendIpConfigurations: An array of references to the load balancer IP configurations.
	LoadBalancerFrontendIpConfigurations []FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded `json:"loadBalancerFrontendIpConfigurations,omitempty"`

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

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *PrivateLinkServiceOperatorSpec `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"`

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

	// Visibility: The visibility list of the private link service.
	Visibility *ResourceSet `json:"visibility,omitempty"`
}

var _ genruntime.ARMTransformer = &PrivateLinkService_Spec{}

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

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

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

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

	// Set property "Properties":
	if service.AutoApproval != nil ||
		service.DestinationIPAddress != nil ||
		service.EnableProxyProtocol != nil ||
		service.Fqdns != nil ||
		service.IpConfigurations != nil ||
		service.LoadBalancerFrontendIpConfigurations != nil ||
		service.Visibility != nil {
		result.Properties = &arm.PrivateLinkServiceProperties{}
	}
	if service.AutoApproval != nil {
		autoApproval_ARM, err := service.AutoApproval.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		autoApproval := *autoApproval_ARM.(*arm.ResourceSet)
		result.Properties.AutoApproval = &autoApproval
	}
	if service.DestinationIPAddress != nil {
		destinationIPAddress := *service.DestinationIPAddress
		result.Properties.DestinationIPAddress = &destinationIPAddress
	}
	if service.EnableProxyProtocol != nil {
		enableProxyProtocol := *service.EnableProxyProtocol
		result.Properties.EnableProxyProtocol = &enableProxyProtocol
	}
	for _, item := range service.Fqdns {
		result.Properties.Fqdns = append(result.Properties.Fqdns, item)
	}
	for _, item := range service.IpConfigurations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.IpConfigurations = append(result.Properties.IpConfigurations, *item_ARM.(*arm.PrivateLinkServiceIpConfiguration))
	}
	for _, item := range service.LoadBalancerFrontendIpConfigurations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.LoadBalancerFrontendIpConfigurations = append(result.Properties.LoadBalancerFrontendIpConfigurations, *item_ARM.(*arm.FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded))
	}
	if service.Visibility != nil {
		visibility_ARM, err := service.Visibility.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		visibility := *visibility_ARM.(*arm.ResourceSet)
		result.Properties.Visibility = &visibility
	}

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

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

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

	// Set property "AutoApproval":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AutoApproval != nil {
			var autoApproval1 ResourceSet
			err := autoApproval1.PopulateFromARM(owner, *typedInput.Properties.AutoApproval)
			if err != nil {
				return err
			}
			autoApproval := autoApproval1
			service.AutoApproval = &autoApproval
		}
	}

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

	// Set property "DestinationIPAddress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DestinationIPAddress != nil {
			destinationIPAddress := *typedInput.Properties.DestinationIPAddress
			service.DestinationIPAddress = &destinationIPAddress
		}
	}

	// Set property "EnableProxyProtocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableProxyProtocol != nil {
			enableProxyProtocol := *typedInput.Properties.EnableProxyProtocol
			service.EnableProxyProtocol = &enableProxyProtocol
		}
	}

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

	// Set property "Fqdns":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.Fqdns {
			service.Fqdns = append(service.Fqdns, item)
		}
	}

	// Set property "IpConfigurations":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.IpConfigurations {
			var item1 PrivateLinkServiceIpConfiguration
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.IpConfigurations = append(service.IpConfigurations, item1)
		}
	}

	// Set property "LoadBalancerFrontendIpConfigurations":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.LoadBalancerFrontendIpConfigurations {
			var item1 FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.LoadBalancerFrontendIpConfigurations = append(service.LoadBalancerFrontendIpConfigurations, item1)
		}
	}

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

	// no assignment for property "OperatorSpec"

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

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

	// Set property "Visibility":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Visibility != nil {
			var visibility1 ResourceSet
			err := visibility1.PopulateFromARM(owner, *typedInput.Properties.Visibility)
			if err != nil {
				return err
			}
			visibility := visibility1
			service.Visibility = &visibility
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &PrivateLinkService_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.PrivateLinkService_Spec{}
	err := service.AssignProperties_To_PrivateLinkService_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_PrivateLinkService_Spec populates our PrivateLinkService_Spec from the provided source PrivateLinkService_Spec
func (service *PrivateLinkService_Spec) AssignProperties_From_PrivateLinkService_Spec(source *storage.PrivateLinkService_Spec) error {

	// AutoApproval
	if source.AutoApproval != nil {
		var autoApproval ResourceSet
		err := autoApproval.AssignProperties_From_ResourceSet(source.AutoApproval)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceSet() to populate field AutoApproval")
		}
		service.AutoApproval = &autoApproval
	} else {
		service.AutoApproval = nil
	}

	// AzureName
	service.AzureName = source.AzureName

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

	// EnableProxyProtocol
	if source.EnableProxyProtocol != nil {
		enableProxyProtocol := *source.EnableProxyProtocol
		service.EnableProxyProtocol = &enableProxyProtocol
	} else {
		service.EnableProxyProtocol = 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")
		}
		service.ExtendedLocation = &extendedLocation
	} else {
		service.ExtendedLocation = nil
	}

	// Fqdns
	service.Fqdns = genruntime.CloneSliceOfString(source.Fqdns)

	// IpConfigurations
	if source.IpConfigurations != nil {
		ipConfigurationList := make([]PrivateLinkServiceIpConfiguration, len(source.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range source.IpConfigurations {
			var ipConfiguration PrivateLinkServiceIpConfiguration
			err := ipConfiguration.AssignProperties_From_PrivateLinkServiceIpConfiguration(&ipConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceIpConfiguration() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		service.IpConfigurations = ipConfigurationList
	} else {
		service.IpConfigurations = nil
	}

	// LoadBalancerFrontendIpConfigurations
	if source.LoadBalancerFrontendIpConfigurations != nil {
		loadBalancerFrontendIpConfigurationList := make([]FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded, len(source.LoadBalancerFrontendIpConfigurations))
		for loadBalancerFrontendIpConfigurationIndex, loadBalancerFrontendIpConfigurationItem := range source.LoadBalancerFrontendIpConfigurations {
			var loadBalancerFrontendIpConfiguration FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded
			err := loadBalancerFrontendIpConfiguration.AssignProperties_From_FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded(&loadBalancerFrontendIpConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded() to populate field LoadBalancerFrontendIpConfigurations")
			}
			loadBalancerFrontendIpConfigurationList[loadBalancerFrontendIpConfigurationIndex] = loadBalancerFrontendIpConfiguration
		}
		service.LoadBalancerFrontendIpConfigurations = loadBalancerFrontendIpConfigurationList
	} else {
		service.LoadBalancerFrontendIpConfigurations = nil
	}

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

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

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

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

	// Visibility
	if source.Visibility != nil {
		var visibility ResourceSet
		err := visibility.AssignProperties_From_ResourceSet(source.Visibility)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceSet() to populate field Visibility")
		}
		service.Visibility = &visibility
	} else {
		service.Visibility = nil
	}

	// No error
	return nil
}

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

	// AutoApproval
	if service.AutoApproval != nil {
		var autoApproval storage.ResourceSet
		err := service.AutoApproval.AssignProperties_To_ResourceSet(&autoApproval)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceSet() to populate field AutoApproval")
		}
		destination.AutoApproval = &autoApproval
	} else {
		destination.AutoApproval = nil
	}

	// AzureName
	destination.AzureName = service.AzureName

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

	// EnableProxyProtocol
	if service.EnableProxyProtocol != nil {
		enableProxyProtocol := *service.EnableProxyProtocol
		destination.EnableProxyProtocol = &enableProxyProtocol
	} else {
		destination.EnableProxyProtocol = nil
	}

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

	// Fqdns
	destination.Fqdns = genruntime.CloneSliceOfString(service.Fqdns)

	// IpConfigurations
	if service.IpConfigurations != nil {
		ipConfigurationList := make([]storage.PrivateLinkServiceIpConfiguration, len(service.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range service.IpConfigurations {
			var ipConfiguration storage.PrivateLinkServiceIpConfiguration
			err := ipConfigurationItem.AssignProperties_To_PrivateLinkServiceIpConfiguration(&ipConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceIpConfiguration() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		destination.IpConfigurations = ipConfigurationList
	} else {
		destination.IpConfigurations = nil
	}

	// LoadBalancerFrontendIpConfigurations
	if service.LoadBalancerFrontendIpConfigurations != nil {
		loadBalancerFrontendIpConfigurationList := make([]storage.FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded, len(service.LoadBalancerFrontendIpConfigurations))
		for loadBalancerFrontendIpConfigurationIndex, loadBalancerFrontendIpConfigurationItem := range service.LoadBalancerFrontendIpConfigurations {
			var loadBalancerFrontendIpConfiguration storage.FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded
			err := loadBalancerFrontendIpConfigurationItem.AssignProperties_To_FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded(&loadBalancerFrontendIpConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded() to populate field LoadBalancerFrontendIpConfigurations")
			}
			loadBalancerFrontendIpConfigurationList[loadBalancerFrontendIpConfigurationIndex] = loadBalancerFrontendIpConfiguration
		}
		destination.LoadBalancerFrontendIpConfigurations = loadBalancerFrontendIpConfigurationList
	} else {
		destination.LoadBalancerFrontendIpConfigurations = nil
	}

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

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

	// OriginalVersion
	destination.OriginalVersion = service.OriginalVersion()

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

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

	// Visibility
	if service.Visibility != nil {
		var visibility storage.ResourceSet
		err := service.Visibility.AssignProperties_To_ResourceSet(&visibility)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceSet() to populate field Visibility")
		}
		destination.Visibility = &visibility
	} else {
		destination.Visibility = nil
	}

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

	// No error
	return nil
}

// Initialize_From_PrivateLinkService_STATUS populates our PrivateLinkService_Spec from the provided source PrivateLinkService_STATUS
func (service *PrivateLinkService_Spec) Initialize_From_PrivateLinkService_STATUS(source *PrivateLinkService_STATUS) error {

	// AutoApproval
	if source.AutoApproval != nil {
		var autoApproval ResourceSet
		err := autoApproval.Initialize_From_ResourceSet_STATUS(source.AutoApproval)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ResourceSet_STATUS() to populate field AutoApproval")
		}
		service.AutoApproval = &autoApproval
	} else {
		service.AutoApproval = nil
	}

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

	// EnableProxyProtocol
	if source.EnableProxyProtocol != nil {
		enableProxyProtocol := *source.EnableProxyProtocol
		service.EnableProxyProtocol = &enableProxyProtocol
	} else {
		service.EnableProxyProtocol = 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")
		}
		service.ExtendedLocation = &extendedLocation
	} else {
		service.ExtendedLocation = nil
	}

	// Fqdns
	service.Fqdns = genruntime.CloneSliceOfString(source.Fqdns)

	// IpConfigurations
	if source.IpConfigurations != nil {
		ipConfigurationList := make([]PrivateLinkServiceIpConfiguration, len(source.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range source.IpConfigurations {
			var ipConfiguration PrivateLinkServiceIpConfiguration
			err := ipConfiguration.Initialize_From_PrivateLinkServiceIpConfiguration_STATUS(&ipConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_PrivateLinkServiceIpConfiguration_STATUS() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		service.IpConfigurations = ipConfigurationList
	} else {
		service.IpConfigurations = nil
	}

	// LoadBalancerFrontendIpConfigurations
	if source.LoadBalancerFrontendIpConfigurations != nil {
		loadBalancerFrontendIpConfigurationList := make([]FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded, len(source.LoadBalancerFrontendIpConfigurations))
		for loadBalancerFrontendIpConfigurationIndex, loadBalancerFrontendIpConfigurationItem := range source.LoadBalancerFrontendIpConfigurations {
			var loadBalancerFrontendIpConfiguration FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded
			err := loadBalancerFrontendIpConfiguration.Initialize_From_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded(&loadBalancerFrontendIpConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded() to populate field LoadBalancerFrontendIpConfigurations")
			}
			loadBalancerFrontendIpConfigurationList[loadBalancerFrontendIpConfigurationIndex] = loadBalancerFrontendIpConfiguration
		}
		service.LoadBalancerFrontendIpConfigurations = loadBalancerFrontendIpConfigurationList
	} else {
		service.LoadBalancerFrontendIpConfigurations = nil
	}

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

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

	// Visibility
	if source.Visibility != nil {
		var visibility ResourceSet
		err := visibility.Initialize_From_ResourceSet_STATUS(source.Visibility)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ResourceSet_STATUS() to populate field Visibility")
		}
		service.Visibility = &visibility
	} else {
		service.Visibility = nil
	}

	// No error
	return nil
}

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

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

// Private link service resource.
type PrivateLinkService_STATUS struct {
	// Alias: The alias of the private link service.
	Alias *string `json:"alias,omitempty"`

	// AutoApproval: The auto-approval list of the private link service.
	AutoApproval *ResourceSet_STATUS `json:"autoApproval,omitempty"`

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

	// DestinationIPAddress: The destination IP address of the private link service.
	DestinationIPAddress *string `json:"destinationIPAddress,omitempty"`

	// EnableProxyProtocol: Whether the private link service is enabled for proxy protocol or not.
	EnableProxyProtocol *bool `json:"enableProxyProtocol,omitempty"`

	// Etag: A unique read-only string that changes whenever the resource is updated.
	Etag *string `json:"etag,omitempty"`

	// ExtendedLocation: The extended location of the load balancer.
	ExtendedLocation *ExtendedLocation_STATUS `json:"extendedLocation,omitempty"`

	// Fqdns: The list of Fqdn.
	Fqdns []string `json:"fqdns,omitempty"`

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

	// IpConfigurations: An array of private link service IP configurations.
	IpConfigurations []PrivateLinkServiceIpConfiguration_STATUS `json:"ipConfigurations,omitempty"`

	// LoadBalancerFrontendIpConfigurations: An array of references to the load balancer IP configurations.
	LoadBalancerFrontendIpConfigurations []FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded `json:"loadBalancerFrontendIpConfigurations,omitempty"`

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

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

	// NetworkInterfaces: An array of references to the network interfaces created for this private link service.
	NetworkInterfaces []NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded `json:"networkInterfaces,omitempty"`

	// PrivateEndpointConnections: An array of list about connections to the private endpoint.
	PrivateEndpointConnections []PrivateEndpointConnection_STATUS `json:"privateEndpointConnections,omitempty"`

	// ProvisioningState: The provisioning state of the private link service resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

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

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

	// Visibility: The visibility list of the private link service.
	Visibility *ResourceSet_STATUS `json:"visibility,omitempty"`
}

var _ genruntime.ConvertibleStatus = &PrivateLinkService_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.PrivateLinkService_STATUS{}
	err := service.AssignProperties_To_PrivateLinkService_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 = &PrivateLinkService_STATUS{}

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

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

	// Set property "Alias":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Alias != nil {
			alias := *typedInput.Properties.Alias
			service.Alias = &alias
		}
	}

	// Set property "AutoApproval":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AutoApproval != nil {
			var autoApproval1 ResourceSet_STATUS
			err := autoApproval1.PopulateFromARM(owner, *typedInput.Properties.AutoApproval)
			if err != nil {
				return err
			}
			autoApproval := autoApproval1
			service.AutoApproval = &autoApproval
		}
	}

	// no assignment for property "Conditions"

	// Set property "DestinationIPAddress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DestinationIPAddress != nil {
			destinationIPAddress := *typedInput.Properties.DestinationIPAddress
			service.DestinationIPAddress = &destinationIPAddress
		}
	}

	// Set property "EnableProxyProtocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableProxyProtocol != nil {
			enableProxyProtocol := *typedInput.Properties.EnableProxyProtocol
			service.EnableProxyProtocol = &enableProxyProtocol
		}
	}

	// Set property "Etag":
	if typedInput.Etag != nil {
		etag := *typedInput.Etag
		service.Etag = &etag
	}

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

	// Set property "Fqdns":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.Fqdns {
			service.Fqdns = append(service.Fqdns, item)
		}
	}

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

	// Set property "IpConfigurations":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.IpConfigurations {
			var item1 PrivateLinkServiceIpConfiguration_STATUS
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.IpConfigurations = append(service.IpConfigurations, item1)
		}
	}

	// Set property "LoadBalancerFrontendIpConfigurations":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.LoadBalancerFrontendIpConfigurations {
			var item1 FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.LoadBalancerFrontendIpConfigurations = append(service.LoadBalancerFrontendIpConfigurations, item1)
		}
	}

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

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

	// Set property "NetworkInterfaces":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.NetworkInterfaces {
			var item1 NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.NetworkInterfaces = append(service.NetworkInterfaces, item1)
		}
	}

	// Set property "PrivateEndpointConnections":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.PrivateEndpointConnections {
			var item1 PrivateEndpointConnection_STATUS
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.PrivateEndpointConnections = append(service.PrivateEndpointConnections, item1)
		}
	}

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

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

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

	// Set property "Visibility":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Visibility != nil {
			var visibility1 ResourceSet_STATUS
			err := visibility1.PopulateFromARM(owner, *typedInput.Properties.Visibility)
			if err != nil {
				return err
			}
			visibility := visibility1
			service.Visibility = &visibility
		}
	}

	// No error
	return nil
}

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

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

	// AutoApproval
	if source.AutoApproval != nil {
		var autoApproval ResourceSet_STATUS
		err := autoApproval.AssignProperties_From_ResourceSet_STATUS(source.AutoApproval)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceSet_STATUS() to populate field AutoApproval")
		}
		service.AutoApproval = &autoApproval
	} else {
		service.AutoApproval = nil
	}

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

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

	// EnableProxyProtocol
	if source.EnableProxyProtocol != nil {
		enableProxyProtocol := *source.EnableProxyProtocol
		service.EnableProxyProtocol = &enableProxyProtocol
	} else {
		service.EnableProxyProtocol = nil
	}

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

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

	// Fqdns
	service.Fqdns = genruntime.CloneSliceOfString(source.Fqdns)

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

	// IpConfigurations
	if source.IpConfigurations != nil {
		ipConfigurationList := make([]PrivateLinkServiceIpConfiguration_STATUS, len(source.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range source.IpConfigurations {
			var ipConfiguration PrivateLinkServiceIpConfiguration_STATUS
			err := ipConfiguration.AssignProperties_From_PrivateLinkServiceIpConfiguration_STATUS(&ipConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceIpConfiguration_STATUS() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		service.IpConfigurations = ipConfigurationList
	} else {
		service.IpConfigurations = nil
	}

	// LoadBalancerFrontendIpConfigurations
	if source.LoadBalancerFrontendIpConfigurations != nil {
		loadBalancerFrontendIpConfigurationList := make([]FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded, len(source.LoadBalancerFrontendIpConfigurations))
		for loadBalancerFrontendIpConfigurationIndex, loadBalancerFrontendIpConfigurationItem := range source.LoadBalancerFrontendIpConfigurations {
			var loadBalancerFrontendIpConfiguration FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded
			err := loadBalancerFrontendIpConfiguration.AssignProperties_From_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded(&loadBalancerFrontendIpConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded() to populate field LoadBalancerFrontendIpConfigurations")
			}
			loadBalancerFrontendIpConfigurationList[loadBalancerFrontendIpConfigurationIndex] = loadBalancerFrontendIpConfiguration
		}
		service.LoadBalancerFrontendIpConfigurations = loadBalancerFrontendIpConfigurationList
	} else {
		service.LoadBalancerFrontendIpConfigurations = nil
	}

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

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

	// NetworkInterfaces
	if source.NetworkInterfaces != nil {
		networkInterfaceList := make([]NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded, len(source.NetworkInterfaces))
		for networkInterfaceIndex, networkInterfaceItem := range source.NetworkInterfaces {
			var networkInterface NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded
			err := networkInterface.AssignProperties_From_NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded(&networkInterfaceItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded() to populate field NetworkInterfaces")
			}
			networkInterfaceList[networkInterfaceIndex] = networkInterface
		}
		service.NetworkInterfaces = networkInterfaceList
	} else {
		service.NetworkInterfaces = nil
	}

	// PrivateEndpointConnections
	if source.PrivateEndpointConnections != nil {
		privateEndpointConnectionList := make([]PrivateEndpointConnection_STATUS, len(source.PrivateEndpointConnections))
		for privateEndpointConnectionIndex, privateEndpointConnectionItem := range source.PrivateEndpointConnections {
			var privateEndpointConnection PrivateEndpointConnection_STATUS
			err := privateEndpointConnection.AssignProperties_From_PrivateEndpointConnection_STATUS(&privateEndpointConnectionItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpointConnection_STATUS() to populate field PrivateEndpointConnections")
			}
			privateEndpointConnectionList[privateEndpointConnectionIndex] = privateEndpointConnection
		}
		service.PrivateEndpointConnections = privateEndpointConnectionList
	} else {
		service.PrivateEndpointConnections = nil
	}

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

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

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

	// Visibility
	if source.Visibility != nil {
		var visibility ResourceSet_STATUS
		err := visibility.AssignProperties_From_ResourceSet_STATUS(source.Visibility)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceSet_STATUS() to populate field Visibility")
		}
		service.Visibility = &visibility
	} else {
		service.Visibility = nil
	}

	// No error
	return nil
}

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

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

	// AutoApproval
	if service.AutoApproval != nil {
		var autoApproval storage.ResourceSet_STATUS
		err := service.AutoApproval.AssignProperties_To_ResourceSet_STATUS(&autoApproval)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceSet_STATUS() to populate field AutoApproval")
		}
		destination.AutoApproval = &autoApproval
	} else {
		destination.AutoApproval = nil
	}

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

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

	// EnableProxyProtocol
	if service.EnableProxyProtocol != nil {
		enableProxyProtocol := *service.EnableProxyProtocol
		destination.EnableProxyProtocol = &enableProxyProtocol
	} else {
		destination.EnableProxyProtocol = nil
	}

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

	// ExtendedLocation
	if service.ExtendedLocation != nil {
		var extendedLocation storage.ExtendedLocation_STATUS
		err := service.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
	}

	// Fqdns
	destination.Fqdns = genruntime.CloneSliceOfString(service.Fqdns)

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

	// IpConfigurations
	if service.IpConfigurations != nil {
		ipConfigurationList := make([]storage.PrivateLinkServiceIpConfiguration_STATUS, len(service.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range service.IpConfigurations {
			var ipConfiguration storage.PrivateLinkServiceIpConfiguration_STATUS
			err := ipConfigurationItem.AssignProperties_To_PrivateLinkServiceIpConfiguration_STATUS(&ipConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceIpConfiguration_STATUS() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		destination.IpConfigurations = ipConfigurationList
	} else {
		destination.IpConfigurations = nil
	}

	// LoadBalancerFrontendIpConfigurations
	if service.LoadBalancerFrontendIpConfigurations != nil {
		loadBalancerFrontendIpConfigurationList := make([]storage.FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded, len(service.LoadBalancerFrontendIpConfigurations))
		for loadBalancerFrontendIpConfigurationIndex, loadBalancerFrontendIpConfigurationItem := range service.LoadBalancerFrontendIpConfigurations {
			var loadBalancerFrontendIpConfiguration storage.FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded
			err := loadBalancerFrontendIpConfigurationItem.AssignProperties_To_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded(&loadBalancerFrontendIpConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded() to populate field LoadBalancerFrontendIpConfigurations")
			}
			loadBalancerFrontendIpConfigurationList[loadBalancerFrontendIpConfigurationIndex] = loadBalancerFrontendIpConfiguration
		}
		destination.LoadBalancerFrontendIpConfigurations = loadBalancerFrontendIpConfigurationList
	} else {
		destination.LoadBalancerFrontendIpConfigurations = nil
	}

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

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

	// NetworkInterfaces
	if service.NetworkInterfaces != nil {
		networkInterfaceList := make([]storage.NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded, len(service.NetworkInterfaces))
		for networkInterfaceIndex, networkInterfaceItem := range service.NetworkInterfaces {
			var networkInterface storage.NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded
			err := networkInterfaceItem.AssignProperties_To_NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded(&networkInterface)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded() to populate field NetworkInterfaces")
			}
			networkInterfaceList[networkInterfaceIndex] = networkInterface
		}
		destination.NetworkInterfaces = networkInterfaceList
	} else {
		destination.NetworkInterfaces = nil
	}

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

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

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

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

	// Visibility
	if service.Visibility != nil {
		var visibility storage.ResourceSet_STATUS
		err := service.Visibility.AssignProperties_To_ResourceSet_STATUS(&visibility)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceSet_STATUS() to populate field Visibility")
		}
		destination.Visibility = &visibility
	} else {
		destination.Visibility = nil
	}

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

	// No error
	return nil
}

// Frontend IP address of the load balancer.
type FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded{}

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

	// Set property "Id":
	if embedded.Reference != nil {
		referenceARMID, err := resolved.ResolvedReferences.Lookup(*embedded.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 (embedded *FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded populates our FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded from the provided source FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded
func (embedded *FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded) AssignProperties_From_FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded(source *storage.FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded) error {

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

	// No error
	return nil
}

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

	// Reference
	if embedded.Reference != nil {
		reference := embedded.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_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded populates our FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded from the provided source FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded
func (embedded *FrontendIPConfiguration_PrivateLinkService_SubResourceEmbedded) Initialize_From_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded(source *FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded) error {

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

	// No error
	return nil
}

// Frontend IP address of the load balancer.
type FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded populates our FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded from the provided source FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded
func (embedded *FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded) AssignProperties_From_FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded(source *storage.FrontendIPConfiguration_STATUS_PrivateLinkService_SubResourceEmbedded) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// A network interface in a resource group.
type NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded populates our NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded from the provided source NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded
func (embedded *NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded) AssignProperties_From_NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded(source *storage.NetworkInterface_STATUS_PrivateLinkService_SubResourceEmbedded) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// PrivateEndpointConnection resource.
type PrivateEndpointConnection_STATUS struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateEndpointConnection_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpointConnection_STATUS populates our PrivateEndpointConnection_STATUS from the provided source PrivateEndpointConnection_STATUS
func (connection *PrivateEndpointConnection_STATUS) AssignProperties_From_PrivateEndpointConnection_STATUS(source *storage.PrivateEndpointConnection_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// The private link service ip configuration.
type PrivateLinkServiceIpConfiguration struct {
	// Name: The name of private link service ip configuration.
	Name *string `json:"name,omitempty"`

	// Primary: Whether the ip configuration is primary or not.
	Primary *bool `json:"primary,omitempty"`

	// PrivateIPAddress: The private IP address of the IP configuration.
	PrivateIPAddress *string `json:"privateIPAddress,omitempty"`

	// PrivateIPAddressVersion: Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4.
	PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"`

	// PrivateIPAllocationMethod: The private IP address allocation method.
	PrivateIPAllocationMethod *IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"`

	// Subnet: The reference to the subnet resource.
	Subnet *Subnet_PrivateLinkService_SubResourceEmbedded `json:"subnet,omitempty"`
}

var _ genruntime.ARMTransformer = &PrivateLinkServiceIpConfiguration{}

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

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

	// Set property "Properties":
	if configuration.Primary != nil ||
		configuration.PrivateIPAddress != nil ||
		configuration.PrivateIPAddressVersion != nil ||
		configuration.PrivateIPAllocationMethod != nil ||
		configuration.Subnet != nil {
		result.Properties = &arm.PrivateLinkServiceIpConfigurationProperties{}
	}
	if configuration.Primary != nil {
		primary := *configuration.Primary
		result.Properties.Primary = &primary
	}
	if configuration.PrivateIPAddress != nil {
		privateIPAddress := *configuration.PrivateIPAddress
		result.Properties.PrivateIPAddress = &privateIPAddress
	}
	if configuration.PrivateIPAddressVersion != nil {
		var temp string
		temp = string(*configuration.PrivateIPAddressVersion)
		privateIPAddressVersion := arm.IPVersion(temp)
		result.Properties.PrivateIPAddressVersion = &privateIPAddressVersion
	}
	if configuration.PrivateIPAllocationMethod != nil {
		var temp string
		temp = string(*configuration.PrivateIPAllocationMethod)
		privateIPAllocationMethod := arm.IPAllocationMethod(temp)
		result.Properties.PrivateIPAllocationMethod = &privateIPAllocationMethod
	}
	if configuration.Subnet != nil {
		subnet_ARM, err := configuration.Subnet.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		subnet := *subnet_ARM.(*arm.Subnet_PrivateLinkService_SubResourceEmbedded)
		result.Properties.Subnet = &subnet
	}
	return result, nil
}

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

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

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

	// Set property "Primary":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Primary != nil {
			primary := *typedInput.Properties.Primary
			configuration.Primary = &primary
		}
	}

	// Set property "PrivateIPAddress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateIPAddress != nil {
			privateIPAddress := *typedInput.Properties.PrivateIPAddress
			configuration.PrivateIPAddress = &privateIPAddress
		}
	}

	// Set property "PrivateIPAddressVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateIPAddressVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.PrivateIPAddressVersion)
			privateIPAddressVersion := IPVersion(temp)
			configuration.PrivateIPAddressVersion = &privateIPAddressVersion
		}
	}

	// Set property "PrivateIPAllocationMethod":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateIPAllocationMethod != nil {
			var temp string
			temp = string(*typedInput.Properties.PrivateIPAllocationMethod)
			privateIPAllocationMethod := IPAllocationMethod(temp)
			configuration.PrivateIPAllocationMethod = &privateIPAllocationMethod
		}
	}

	// Set property "Subnet":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Subnet != nil {
			var subnet1 Subnet_PrivateLinkService_SubResourceEmbedded
			err := subnet1.PopulateFromARM(owner, *typedInput.Properties.Subnet)
			if err != nil {
				return err
			}
			subnet := subnet1
			configuration.Subnet = &subnet
		}
	}

	// No error
	return nil
}

// AssignProperties_From_PrivateLinkServiceIpConfiguration populates our PrivateLinkServiceIpConfiguration from the provided source PrivateLinkServiceIpConfiguration
func (configuration *PrivateLinkServiceIpConfiguration) AssignProperties_From_PrivateLinkServiceIpConfiguration(source *storage.PrivateLinkServiceIpConfiguration) error {

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

	// Primary
	if source.Primary != nil {
		primary := *source.Primary
		configuration.Primary = &primary
	} else {
		configuration.Primary = nil
	}

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

	// PrivateIPAddressVersion
	if source.PrivateIPAddressVersion != nil {
		privateIPAddressVersion := *source.PrivateIPAddressVersion
		privateIPAddressVersionTemp := genruntime.ToEnum(privateIPAddressVersion, iPVersion_Values)
		configuration.PrivateIPAddressVersion = &privateIPAddressVersionTemp
	} else {
		configuration.PrivateIPAddressVersion = nil
	}

	// PrivateIPAllocationMethod
	if source.PrivateIPAllocationMethod != nil {
		privateIPAllocationMethod := *source.PrivateIPAllocationMethod
		privateIPAllocationMethodTemp := genruntime.ToEnum(privateIPAllocationMethod, iPAllocationMethod_Values)
		configuration.PrivateIPAllocationMethod = &privateIPAllocationMethodTemp
	} else {
		configuration.PrivateIPAllocationMethod = nil
	}

	// Subnet
	if source.Subnet != nil {
		var subnet Subnet_PrivateLinkService_SubResourceEmbedded
		err := subnet.AssignProperties_From_Subnet_PrivateLinkService_SubResourceEmbedded(source.Subnet)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Subnet_PrivateLinkService_SubResourceEmbedded() to populate field Subnet")
		}
		configuration.Subnet = &subnet
	} else {
		configuration.Subnet = nil
	}

	// No error
	return nil
}

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

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

	// Primary
	if configuration.Primary != nil {
		primary := *configuration.Primary
		destination.Primary = &primary
	} else {
		destination.Primary = nil
	}

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

	// PrivateIPAddressVersion
	if configuration.PrivateIPAddressVersion != nil {
		privateIPAddressVersion := string(*configuration.PrivateIPAddressVersion)
		destination.PrivateIPAddressVersion = &privateIPAddressVersion
	} else {
		destination.PrivateIPAddressVersion = nil
	}

	// PrivateIPAllocationMethod
	if configuration.PrivateIPAllocationMethod != nil {
		privateIPAllocationMethod := string(*configuration.PrivateIPAllocationMethod)
		destination.PrivateIPAllocationMethod = &privateIPAllocationMethod
	} else {
		destination.PrivateIPAllocationMethod = nil
	}

	// Subnet
	if configuration.Subnet != nil {
		var subnet storage.Subnet_PrivateLinkService_SubResourceEmbedded
		err := configuration.Subnet.AssignProperties_To_Subnet_PrivateLinkService_SubResourceEmbedded(&subnet)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Subnet_PrivateLinkService_SubResourceEmbedded() to populate field Subnet")
		}
		destination.Subnet = &subnet
	} else {
		destination.Subnet = nil
	}

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

	// No error
	return nil
}

// Initialize_From_PrivateLinkServiceIpConfiguration_STATUS populates our PrivateLinkServiceIpConfiguration from the provided source PrivateLinkServiceIpConfiguration_STATUS
func (configuration *PrivateLinkServiceIpConfiguration) Initialize_From_PrivateLinkServiceIpConfiguration_STATUS(source *PrivateLinkServiceIpConfiguration_STATUS) error {

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

	// Primary
	if source.Primary != nil {
		primary := *source.Primary
		configuration.Primary = &primary
	} else {
		configuration.Primary = nil
	}

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

	// PrivateIPAddressVersion
	if source.PrivateIPAddressVersion != nil {
		privateIPAddressVersion := genruntime.ToEnum(string(*source.PrivateIPAddressVersion), iPVersion_Values)
		configuration.PrivateIPAddressVersion = &privateIPAddressVersion
	} else {
		configuration.PrivateIPAddressVersion = nil
	}

	// PrivateIPAllocationMethod
	if source.PrivateIPAllocationMethod != nil {
		privateIPAllocationMethod := genruntime.ToEnum(string(*source.PrivateIPAllocationMethod), iPAllocationMethod_Values)
		configuration.PrivateIPAllocationMethod = &privateIPAllocationMethod
	} else {
		configuration.PrivateIPAllocationMethod = nil
	}

	// Subnet
	if source.Subnet != nil {
		var subnet Subnet_PrivateLinkService_SubResourceEmbedded
		err := subnet.Initialize_From_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded(source.Subnet)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded() to populate field Subnet")
		}
		configuration.Subnet = &subnet
	} else {
		configuration.Subnet = nil
	}

	// No error
	return nil
}

// The private link service ip configuration.
type PrivateLinkServiceIpConfiguration_STATUS struct {
	// Etag: A unique read-only string that changes whenever the resource is updated.
	Etag *string `json:"etag,omitempty"`

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

	// Name: The name of private link service ip configuration.
	Name *string `json:"name,omitempty"`

	// Primary: Whether the ip configuration is primary or not.
	Primary *bool `json:"primary,omitempty"`

	// PrivateIPAddress: The private IP address of the IP configuration.
	PrivateIPAddress *string `json:"privateIPAddress,omitempty"`

	// PrivateIPAddressVersion: Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4.
	PrivateIPAddressVersion *IPVersion_STATUS `json:"privateIPAddressVersion,omitempty"`

	// PrivateIPAllocationMethod: The private IP address allocation method.
	PrivateIPAllocationMethod *IPAllocationMethod_STATUS `json:"privateIPAllocationMethod,omitempty"`

	// ProvisioningState: The provisioning state of the private link service IP configuration resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// Subnet: The reference to the subnet resource.
	Subnet *Subnet_STATUS_PrivateLinkService_SubResourceEmbedded `json:"subnet,omitempty"`

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

var _ genruntime.FromARMConverter = &PrivateLinkServiceIpConfiguration_STATUS{}

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

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

	// Set property "Etag":
	if typedInput.Etag != nil {
		etag := *typedInput.Etag
		configuration.Etag = &etag
	}

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

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

	// Set property "Primary":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Primary != nil {
			primary := *typedInput.Properties.Primary
			configuration.Primary = &primary
		}
	}

	// Set property "PrivateIPAddress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateIPAddress != nil {
			privateIPAddress := *typedInput.Properties.PrivateIPAddress
			configuration.PrivateIPAddress = &privateIPAddress
		}
	}

	// Set property "PrivateIPAddressVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateIPAddressVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.PrivateIPAddressVersion)
			privateIPAddressVersion := IPVersion_STATUS(temp)
			configuration.PrivateIPAddressVersion = &privateIPAddressVersion
		}
	}

	// Set property "PrivateIPAllocationMethod":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateIPAllocationMethod != nil {
			var temp string
			temp = string(*typedInput.Properties.PrivateIPAllocationMethod)
			privateIPAllocationMethod := IPAllocationMethod_STATUS(temp)
			configuration.PrivateIPAllocationMethod = &privateIPAllocationMethod
		}
	}

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

	// Set property "Subnet":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Subnet != nil {
			var subnet1 Subnet_STATUS_PrivateLinkService_SubResourceEmbedded
			err := subnet1.PopulateFromARM(owner, *typedInput.Properties.Subnet)
			if err != nil {
				return err
			}
			subnet := subnet1
			configuration.Subnet = &subnet
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_PrivateLinkServiceIpConfiguration_STATUS populates our PrivateLinkServiceIpConfiguration_STATUS from the provided source PrivateLinkServiceIpConfiguration_STATUS
func (configuration *PrivateLinkServiceIpConfiguration_STATUS) AssignProperties_From_PrivateLinkServiceIpConfiguration_STATUS(source *storage.PrivateLinkServiceIpConfiguration_STATUS) error {

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

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

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

	// Primary
	if source.Primary != nil {
		primary := *source.Primary
		configuration.Primary = &primary
	} else {
		configuration.Primary = nil
	}

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

	// PrivateIPAddressVersion
	if source.PrivateIPAddressVersion != nil {
		privateIPAddressVersion := *source.PrivateIPAddressVersion
		privateIPAddressVersionTemp := genruntime.ToEnum(privateIPAddressVersion, iPVersion_STATUS_Values)
		configuration.PrivateIPAddressVersion = &privateIPAddressVersionTemp
	} else {
		configuration.PrivateIPAddressVersion = nil
	}

	// PrivateIPAllocationMethod
	if source.PrivateIPAllocationMethod != nil {
		privateIPAllocationMethod := *source.PrivateIPAllocationMethod
		privateIPAllocationMethodTemp := genruntime.ToEnum(privateIPAllocationMethod, iPAllocationMethod_STATUS_Values)
		configuration.PrivateIPAllocationMethod = &privateIPAllocationMethodTemp
	} else {
		configuration.PrivateIPAllocationMethod = nil
	}

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

	// Subnet
	if source.Subnet != nil {
		var subnet Subnet_STATUS_PrivateLinkService_SubResourceEmbedded
		err := subnet.AssignProperties_From_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded(source.Subnet)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded() to populate field Subnet")
		}
		configuration.Subnet = &subnet
	} else {
		configuration.Subnet = nil
	}

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

	// No error
	return nil
}

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

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

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

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

	// Primary
	if configuration.Primary != nil {
		primary := *configuration.Primary
		destination.Primary = &primary
	} else {
		destination.Primary = nil
	}

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

	// PrivateIPAddressVersion
	if configuration.PrivateIPAddressVersion != nil {
		privateIPAddressVersion := string(*configuration.PrivateIPAddressVersion)
		destination.PrivateIPAddressVersion = &privateIPAddressVersion
	} else {
		destination.PrivateIPAddressVersion = nil
	}

	// PrivateIPAllocationMethod
	if configuration.PrivateIPAllocationMethod != nil {
		privateIPAllocationMethod := string(*configuration.PrivateIPAllocationMethod)
		destination.PrivateIPAllocationMethod = &privateIPAllocationMethod
	} else {
		destination.PrivateIPAllocationMethod = nil
	}

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

	// Subnet
	if configuration.Subnet != nil {
		var subnet storage.Subnet_STATUS_PrivateLinkService_SubResourceEmbedded
		err := configuration.Subnet.AssignProperties_To_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded(&subnet)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded() to populate field Subnet")
		}
		destination.Subnet = &subnet
	} else {
		destination.Subnet = nil
	}

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

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

	// No error
	return nil
}

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

	// ConfigMaps: configures where to place operator written ConfigMaps.
	ConfigMaps *PrivateLinkServiceOperatorConfigMaps `json:"configMaps,omitempty"`

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

// AssignProperties_From_PrivateLinkServiceOperatorSpec populates our PrivateLinkServiceOperatorSpec from the provided source PrivateLinkServiceOperatorSpec
func (operator *PrivateLinkServiceOperatorSpec) AssignProperties_From_PrivateLinkServiceOperatorSpec(source *storage.PrivateLinkServiceOperatorSpec) 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
	}

	// ConfigMaps
	if source.ConfigMaps != nil {
		var configMap PrivateLinkServiceOperatorConfigMaps
		err := configMap.AssignProperties_From_PrivateLinkServiceOperatorConfigMaps(source.ConfigMaps)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceOperatorConfigMaps() to populate field ConfigMaps")
		}
		operator.ConfigMaps = &configMap
	} else {
		operator.ConfigMaps = 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_PrivateLinkServiceOperatorSpec populates the provided destination PrivateLinkServiceOperatorSpec from our PrivateLinkServiceOperatorSpec
func (operator *PrivateLinkServiceOperatorSpec) AssignProperties_To_PrivateLinkServiceOperatorSpec(destination *storage.PrivateLinkServiceOperatorSpec) 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
	}

	// ConfigMaps
	if operator.ConfigMaps != nil {
		var configMap storage.PrivateLinkServiceOperatorConfigMaps
		err := operator.ConfigMaps.AssignProperties_To_PrivateLinkServiceOperatorConfigMaps(&configMap)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceOperatorConfigMaps() to populate field ConfigMaps")
		}
		destination.ConfigMaps = &configMap
	} else {
		destination.ConfigMaps = nil
	}

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

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

	// No error
	return nil
}

// The base resource set for visibility and auto-approval.
type ResourceSet struct {
	// Subscriptions: The list of subscriptions.
	Subscriptions []string `json:"subscriptions,omitempty"`
}

var _ genruntime.ARMTransformer = &ResourceSet{}

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

	// Set property "Subscriptions":
	for _, item := range resourceSet.Subscriptions {
		result.Subscriptions = append(result.Subscriptions, item)
	}
	return result, nil
}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ResourceSet populates our ResourceSet from the provided source ResourceSet
func (resourceSet *ResourceSet) AssignProperties_From_ResourceSet(source *storage.ResourceSet) error {

	// Subscriptions
	resourceSet.Subscriptions = genruntime.CloneSliceOfString(source.Subscriptions)

	// No error
	return nil
}

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

	// Subscriptions
	destination.Subscriptions = genruntime.CloneSliceOfString(resourceSet.Subscriptions)

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

	// No error
	return nil
}

// Initialize_From_ResourceSet_STATUS populates our ResourceSet from the provided source ResourceSet_STATUS
func (resourceSet *ResourceSet) Initialize_From_ResourceSet_STATUS(source *ResourceSet_STATUS) error {

	// Subscriptions
	resourceSet.Subscriptions = genruntime.CloneSliceOfString(source.Subscriptions)

	// No error
	return nil
}

// The base resource set for visibility and auto-approval.
type ResourceSet_STATUS struct {
	// Subscriptions: The list of subscriptions.
	Subscriptions []string `json:"subscriptions,omitempty"`
}

var _ genruntime.FromARMConverter = &ResourceSet_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ResourceSet_STATUS populates our ResourceSet_STATUS from the provided source ResourceSet_STATUS
func (resourceSet *ResourceSet_STATUS) AssignProperties_From_ResourceSet_STATUS(source *storage.ResourceSet_STATUS) error {

	// Subscriptions
	resourceSet.Subscriptions = genruntime.CloneSliceOfString(source.Subscriptions)

	// No error
	return nil
}

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

	// Subscriptions
	destination.Subscriptions = genruntime.CloneSliceOfString(resourceSet.Subscriptions)

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

	// No error
	return nil
}

type PrivateLinkServiceOperatorConfigMaps struct {
	// Alias: indicates where the Alias config map should be placed. If omitted, no config map will be created.
	Alias *genruntime.ConfigMapDestination `json:"alias,omitempty"`
}

// AssignProperties_From_PrivateLinkServiceOperatorConfigMaps populates our PrivateLinkServiceOperatorConfigMaps from the provided source PrivateLinkServiceOperatorConfigMaps
func (maps *PrivateLinkServiceOperatorConfigMaps) AssignProperties_From_PrivateLinkServiceOperatorConfigMaps(source *storage.PrivateLinkServiceOperatorConfigMaps) error {

	// Alias
	if source.Alias != nil {
		alias := source.Alias.Copy()
		maps.Alias = &alias
	} else {
		maps.Alias = nil
	}

	// No error
	return nil
}

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

	// Alias
	if maps.Alias != nil {
		alias := maps.Alias.Copy()
		destination.Alias = &alias
	} else {
		destination.Alias = nil
	}

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

	// No error
	return nil
}

// Subnet in a virtual network resource.
type Subnet_PrivateLinkService_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &Subnet_PrivateLinkService_SubResourceEmbedded{}

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

	// Set property "Id":
	if embedded.Reference != nil {
		referenceARMID, err := resolved.ResolvedReferences.Lookup(*embedded.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 (embedded *Subnet_PrivateLinkService_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.Subnet_PrivateLinkService_SubResourceEmbedded{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_Subnet_PrivateLinkService_SubResourceEmbedded populates our Subnet_PrivateLinkService_SubResourceEmbedded from the provided source Subnet_PrivateLinkService_SubResourceEmbedded
func (embedded *Subnet_PrivateLinkService_SubResourceEmbedded) AssignProperties_From_Subnet_PrivateLinkService_SubResourceEmbedded(source *storage.Subnet_PrivateLinkService_SubResourceEmbedded) error {

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

	// No error
	return nil
}

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

	// Reference
	if embedded.Reference != nil {
		reference := embedded.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_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded populates our Subnet_PrivateLinkService_SubResourceEmbedded from the provided source Subnet_STATUS_PrivateLinkService_SubResourceEmbedded
func (embedded *Subnet_PrivateLinkService_SubResourceEmbedded) Initialize_From_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded(source *Subnet_STATUS_PrivateLinkService_SubResourceEmbedded) error {

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

	// No error
	return nil
}

// Subnet in a virtual network resource.
type Subnet_STATUS_PrivateLinkService_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &Subnet_STATUS_PrivateLinkService_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded populates our Subnet_STATUS_PrivateLinkService_SubResourceEmbedded from the provided source Subnet_STATUS_PrivateLinkService_SubResourceEmbedded
func (embedded *Subnet_STATUS_PrivateLinkService_SubResourceEmbedded) AssignProperties_From_Subnet_STATUS_PrivateLinkService_SubResourceEmbedded(source *storage.Subnet_STATUS_PrivateLinkService_SubResourceEmbedded) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&PrivateLinkService{}, &PrivateLinkServiceList{})
}
