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

import (
	"fmt"
	v20220701s "github.com/Azure/azure-service-operator/v2/api/network/v1api20220701storage"
	"github.com/Azure/azure-service-operator/v2/internal/reflecthelpers"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/pkg/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
	"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
)

// +kubebuilder:object:root=true
// +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/2022-07-01/privateEndpoint.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}
type PrivateEndpoint struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              PrivateEndpoint_Spec                                       `json:"spec,omitempty"`
	Status            PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded `json:"status,omitempty"`
}

var _ conditions.Conditioner = &PrivateEndpoint{}

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

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

var _ conversion.Convertible = &PrivateEndpoint{}

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

	return endpoint.AssignProperties_From_PrivateEndpoint(source)
}

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

	return endpoint.AssignProperties_To_PrivateEndpoint(destination)
}

// +kubebuilder:webhook:path=/mutate-network-azure-com-v1api20220701-privateendpoint,mutating=true,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=network.azure.com,resources=privateendpoints,verbs=create;update,versions=v1api20220701,name=default.v1api20220701.privateendpoints.network.azure.com,admissionReviewVersions=v1

var _ admission.Defaulter = &PrivateEndpoint{}

// Default applies defaults to the PrivateEndpoint resource
func (endpoint *PrivateEndpoint) Default() {
	endpoint.defaultImpl()
	var temp any = endpoint
	if runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {
		runtimeDefaulter.CustomDefault()
	}
}

// defaultAzureName defaults the Azure name of the resource to the Kubernetes name
func (endpoint *PrivateEndpoint) defaultAzureName() {
	if endpoint.Spec.AzureName == "" {
		endpoint.Spec.AzureName = endpoint.Name
	}
}

// defaultImpl applies the code generated defaults to the PrivateEndpoint resource
func (endpoint *PrivateEndpoint) defaultImpl() { endpoint.defaultAzureName() }

var _ genruntime.ImportableResource = &PrivateEndpoint{}

// InitializeSpec initializes the spec for this resource from the given status
func (endpoint *PrivateEndpoint) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded); ok {
		return endpoint.Spec.Initialize_From_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded(s)
	}

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

var _ genruntime.KubernetesResource = &PrivateEndpoint{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2022-07-01"
func (endpoint PrivateEndpoint) GetAPIVersion() string {
	return string(APIVersion_Value)
}

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/privateEndpoints"
func (endpoint *PrivateEndpoint) GetType() string {
	return "Microsoft.Network/privateEndpoints"
}

// NewEmptyStatus returns a new empty (blank) status
func (endpoint *PrivateEndpoint) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded{}
}

// Owner returns the ResourceReference of the owner
func (endpoint *PrivateEndpoint) Owner() *genruntime.ResourceReference {
	group, kind := genruntime.LookupOwnerGroupKind(endpoint.Spec)
	return endpoint.Spec.Owner.AsResourceReference(group, kind)
}

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

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

	endpoint.Status = st
	return nil
}

// +kubebuilder:webhook:path=/validate-network-azure-com-v1api20220701-privateendpoint,mutating=false,sideEffects=None,matchPolicy=Exact,failurePolicy=fail,groups=network.azure.com,resources=privateendpoints,verbs=create;update,versions=v1api20220701,name=validate.v1api20220701.privateendpoints.network.azure.com,admissionReviewVersions=v1

var _ admission.Validator = &PrivateEndpoint{}

// ValidateCreate validates the creation of the resource
func (endpoint *PrivateEndpoint) ValidateCreate() (admission.Warnings, error) {
	validations := endpoint.createValidations()
	var temp any = endpoint
	if runtimeValidator, ok := temp.(genruntime.Validator); ok {
		validations = append(validations, runtimeValidator.CreateValidations()...)
	}
	return genruntime.ValidateCreate(validations)
}

// ValidateDelete validates the deletion of the resource
func (endpoint *PrivateEndpoint) ValidateDelete() (admission.Warnings, error) {
	validations := endpoint.deleteValidations()
	var temp any = endpoint
	if runtimeValidator, ok := temp.(genruntime.Validator); ok {
		validations = append(validations, runtimeValidator.DeleteValidations()...)
	}
	return genruntime.ValidateDelete(validations)
}

// ValidateUpdate validates an update of the resource
func (endpoint *PrivateEndpoint) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
	validations := endpoint.updateValidations()
	var temp any = endpoint
	if runtimeValidator, ok := temp.(genruntime.Validator); ok {
		validations = append(validations, runtimeValidator.UpdateValidations()...)
	}
	return genruntime.ValidateUpdate(old, validations)
}

// createValidations validates the creation of the resource
func (endpoint *PrivateEndpoint) createValidations() []func() (admission.Warnings, error) {
	return []func() (admission.Warnings, error){endpoint.validateResourceReferences, endpoint.validateOwnerReference}
}

// deleteValidations validates the deletion of the resource
func (endpoint *PrivateEndpoint) deleteValidations() []func() (admission.Warnings, error) {
	return nil
}

// updateValidations validates the update of the resource
func (endpoint *PrivateEndpoint) updateValidations() []func(old runtime.Object) (admission.Warnings, error) {
	return []func(old runtime.Object) (admission.Warnings, error){
		func(old runtime.Object) (admission.Warnings, error) {
			return endpoint.validateResourceReferences()
		},
		endpoint.validateWriteOnceProperties,
		func(old runtime.Object) (admission.Warnings, error) {
			return endpoint.validateOwnerReference()
		},
	}
}

// validateOwnerReference validates the owner field
func (endpoint *PrivateEndpoint) validateOwnerReference() (admission.Warnings, error) {
	return genruntime.ValidateOwner(endpoint)
}

// validateResourceReferences validates all resource references
func (endpoint *PrivateEndpoint) validateResourceReferences() (admission.Warnings, error) {
	refs, err := reflecthelpers.FindResourceReferences(&endpoint.Spec)
	if err != nil {
		return nil, err
	}
	return genruntime.ValidateResourceReferences(refs)
}

// validateWriteOnceProperties validates all WriteOnce properties
func (endpoint *PrivateEndpoint) validateWriteOnceProperties(old runtime.Object) (admission.Warnings, error) {
	oldObj, ok := old.(*PrivateEndpoint)
	if !ok {
		return nil, nil
	}

	return genruntime.ValidateWriteOnceProperties(oldObj, endpoint)
}

// AssignProperties_From_PrivateEndpoint populates our PrivateEndpoint from the provided source PrivateEndpoint
func (endpoint *PrivateEndpoint) AssignProperties_From_PrivateEndpoint(source *v20220701s.PrivateEndpoint) error {

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

	// Spec
	var spec PrivateEndpoint_Spec
	err := spec.AssignProperties_From_PrivateEndpoint_Spec(&source.Spec)
	if err != nil {
		return errors.Wrap(err, "calling AssignProperties_From_PrivateEndpoint_Spec() to populate field Spec")
	}
	endpoint.Spec = spec

	// Status
	var status PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded
	err = status.AssignProperties_From_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded(&source.Status)
	if err != nil {
		return errors.Wrap(err, "calling AssignProperties_From_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field Status")
	}
	endpoint.Status = status

	// No error
	return nil
}

// AssignProperties_To_PrivateEndpoint populates the provided destination PrivateEndpoint from our PrivateEndpoint
func (endpoint *PrivateEndpoint) AssignProperties_To_PrivateEndpoint(destination *v20220701s.PrivateEndpoint) error {

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

	// Spec
	var spec v20220701s.PrivateEndpoint_Spec
	err := endpoint.Spec.AssignProperties_To_PrivateEndpoint_Spec(&spec)
	if err != nil {
		return errors.Wrap(err, "calling AssignProperties_To_PrivateEndpoint_Spec() to populate field Spec")
	}
	destination.Spec = spec

	// Status
	var status v20220701s.PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded
	err = endpoint.Status.AssignProperties_To_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded(&status)
	if err != nil {
		return errors.Wrap(err, "calling AssignProperties_To_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded() 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 (endpoint *PrivateEndpoint) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: endpoint.Spec.OriginalVersion(),
		Kind:    "PrivateEndpoint",
	}
}

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2022-07-01/privateEndpoint.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}
type PrivateEndpointList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []PrivateEndpoint `json:"items"`
}

type PrivateEndpoint_Spec struct {
	// ApplicationSecurityGroups: Application security groups in which the private endpoint IP configuration is included.
	ApplicationSecurityGroups []ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded `json:"applicationSecurityGroups,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"`

	// CustomNetworkInterfaceName: The custom name of the network interface attached to the private endpoint.
	CustomNetworkInterfaceName *string `json:"customNetworkInterfaceName,omitempty"`

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

	// IpConfigurations: A list of IP configurations of the private endpoint. This will be used to map to the First Party
	// Service's endpoints.
	IpConfigurations []PrivateEndpointIPConfiguration `json:"ipConfigurations,omitempty"`

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

	// ManualPrivateLinkServiceConnections: A grouping of information about the connection to the remote resource. Used when
	// the network admin does not have access to approve connections to the remote resource.
	ManualPrivateLinkServiceConnections []PrivateLinkServiceConnection `json:"manualPrivateLinkServiceConnections,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"`

	// PrivateLinkServiceConnections: A grouping of information about the connection to the remote resource.
	PrivateLinkServiceConnections []PrivateLinkServiceConnection `json:"privateLinkServiceConnections,omitempty"`

	// Subnet: The ID of the subnet from which the private IP will be allocated.
	Subnet *Subnet_PrivateEndpoint_SubResourceEmbedded `json:"subnet,omitempty"`

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

var _ genruntime.ARMTransformer = &PrivateEndpoint_Spec{}

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

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

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

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

	// Set property "Properties":
	if endpoint.ApplicationSecurityGroups != nil ||
		endpoint.CustomNetworkInterfaceName != nil ||
		endpoint.IpConfigurations != nil ||
		endpoint.ManualPrivateLinkServiceConnections != nil ||
		endpoint.PrivateLinkServiceConnections != nil ||
		endpoint.Subnet != nil {
		result.Properties = &PrivateEndpointProperties_ARM{}
	}
	for _, item := range endpoint.ApplicationSecurityGroups {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.ApplicationSecurityGroups = append(result.Properties.ApplicationSecurityGroups, *item_ARM.(*ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded_ARM))
	}
	if endpoint.CustomNetworkInterfaceName != nil {
		customNetworkInterfaceName := *endpoint.CustomNetworkInterfaceName
		result.Properties.CustomNetworkInterfaceName = &customNetworkInterfaceName
	}
	for _, item := range endpoint.IpConfigurations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.IpConfigurations = append(result.Properties.IpConfigurations, *item_ARM.(*PrivateEndpointIPConfiguration_ARM))
	}
	for _, item := range endpoint.ManualPrivateLinkServiceConnections {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.ManualPrivateLinkServiceConnections = append(result.Properties.ManualPrivateLinkServiceConnections, *item_ARM.(*PrivateLinkServiceConnection_ARM))
	}
	for _, item := range endpoint.PrivateLinkServiceConnections {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.PrivateLinkServiceConnections = append(result.Properties.PrivateLinkServiceConnections, *item_ARM.(*PrivateLinkServiceConnection_ARM))
	}
	if endpoint.Subnet != nil {
		subnet_ARM, err := (*endpoint.Subnet).ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		subnet := *subnet_ARM.(*Subnet_PrivateEndpoint_SubResourceEmbedded_ARM)
		result.Properties.Subnet = &subnet
	}

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

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (endpoint *PrivateEndpoint_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &PrivateEndpoint_Spec_ARM{}
}

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

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

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

	// Set property "CustomNetworkInterfaceName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CustomNetworkInterfaceName != nil {
			customNetworkInterfaceName := *typedInput.Properties.CustomNetworkInterfaceName
			endpoint.CustomNetworkInterfaceName = &customNetworkInterfaceName
		}
	}

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

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

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

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

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

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

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &PrivateEndpoint_Spec{}

// ConvertSpecFrom populates our PrivateEndpoint_Spec from the provided source
func (endpoint *PrivateEndpoint_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	src, ok := source.(*v20220701s.PrivateEndpoint_Spec)
	if ok {
		// Populate our instance from source
		return endpoint.AssignProperties_From_PrivateEndpoint_Spec(src)
	}

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

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

	return nil
}

// ConvertSpecTo populates the provided destination from our PrivateEndpoint_Spec
func (endpoint *PrivateEndpoint_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	dst, ok := destination.(*v20220701s.PrivateEndpoint_Spec)
	if ok {
		// Populate destination from our instance
		return endpoint.AssignProperties_To_PrivateEndpoint_Spec(dst)
	}

	// Convert to an intermediate form
	dst = &v20220701s.PrivateEndpoint_Spec{}
	err := endpoint.AssignProperties_To_PrivateEndpoint_Spec(dst)
	if err != nil {
		return errors.Wrap(err, "initial step of conversion in ConvertSpecTo()")
	}

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

	return nil
}

// AssignProperties_From_PrivateEndpoint_Spec populates our PrivateEndpoint_Spec from the provided source PrivateEndpoint_Spec
func (endpoint *PrivateEndpoint_Spec) AssignProperties_From_PrivateEndpoint_Spec(source *v20220701s.PrivateEndpoint_Spec) error {

	// ApplicationSecurityGroups
	if source.ApplicationSecurityGroups != nil {
		applicationSecurityGroupList := make([]ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded, len(source.ApplicationSecurityGroups))
		for applicationSecurityGroupIndex, applicationSecurityGroupItem := range source.ApplicationSecurityGroups {
			// Shadow the loop variable to avoid aliasing
			applicationSecurityGroupItem := applicationSecurityGroupItem
			var applicationSecurityGroup ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded
			err := applicationSecurityGroup.AssignProperties_From_ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded(&applicationSecurityGroupItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded() to populate field ApplicationSecurityGroups")
			}
			applicationSecurityGroupList[applicationSecurityGroupIndex] = applicationSecurityGroup
		}
		endpoint.ApplicationSecurityGroups = applicationSecurityGroupList
	} else {
		endpoint.ApplicationSecurityGroups = nil
	}

	// AzureName
	endpoint.AzureName = source.AzureName

	// CustomNetworkInterfaceName
	endpoint.CustomNetworkInterfaceName = genruntime.ClonePointerToString(source.CustomNetworkInterfaceName)

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

	// IpConfigurations
	if source.IpConfigurations != nil {
		ipConfigurationList := make([]PrivateEndpointIPConfiguration, len(source.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range source.IpConfigurations {
			// Shadow the loop variable to avoid aliasing
			ipConfigurationItem := ipConfigurationItem
			var ipConfiguration PrivateEndpointIPConfiguration
			err := ipConfiguration.AssignProperties_From_PrivateEndpointIPConfiguration(&ipConfigurationItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_PrivateEndpointIPConfiguration() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		endpoint.IpConfigurations = ipConfigurationList
	} else {
		endpoint.IpConfigurations = nil
	}

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

	// ManualPrivateLinkServiceConnections
	if source.ManualPrivateLinkServiceConnections != nil {
		manualPrivateLinkServiceConnectionList := make([]PrivateLinkServiceConnection, len(source.ManualPrivateLinkServiceConnections))
		for manualPrivateLinkServiceConnectionIndex, manualPrivateLinkServiceConnectionItem := range source.ManualPrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			manualPrivateLinkServiceConnectionItem := manualPrivateLinkServiceConnectionItem
			var manualPrivateLinkServiceConnection PrivateLinkServiceConnection
			err := manualPrivateLinkServiceConnection.AssignProperties_From_PrivateLinkServiceConnection(&manualPrivateLinkServiceConnectionItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceConnection() to populate field ManualPrivateLinkServiceConnections")
			}
			manualPrivateLinkServiceConnectionList[manualPrivateLinkServiceConnectionIndex] = manualPrivateLinkServiceConnection
		}
		endpoint.ManualPrivateLinkServiceConnections = manualPrivateLinkServiceConnectionList
	} else {
		endpoint.ManualPrivateLinkServiceConnections = nil
	}

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

	// PrivateLinkServiceConnections
	if source.PrivateLinkServiceConnections != nil {
		privateLinkServiceConnectionList := make([]PrivateLinkServiceConnection, len(source.PrivateLinkServiceConnections))
		for privateLinkServiceConnectionIndex, privateLinkServiceConnectionItem := range source.PrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			privateLinkServiceConnectionItem := privateLinkServiceConnectionItem
			var privateLinkServiceConnection PrivateLinkServiceConnection
			err := privateLinkServiceConnection.AssignProperties_From_PrivateLinkServiceConnection(&privateLinkServiceConnectionItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceConnection() to populate field PrivateLinkServiceConnections")
			}
			privateLinkServiceConnectionList[privateLinkServiceConnectionIndex] = privateLinkServiceConnection
		}
		endpoint.PrivateLinkServiceConnections = privateLinkServiceConnectionList
	} else {
		endpoint.PrivateLinkServiceConnections = nil
	}

	// Subnet
	if source.Subnet != nil {
		var subnet Subnet_PrivateEndpoint_SubResourceEmbedded
		err := subnet.AssignProperties_From_Subnet_PrivateEndpoint_SubResourceEmbedded(source.Subnet)
		if err != nil {
			return errors.Wrap(err, "calling AssignProperties_From_Subnet_PrivateEndpoint_SubResourceEmbedded() to populate field Subnet")
		}
		endpoint.Subnet = &subnet
	} else {
		endpoint.Subnet = nil
	}

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

	// No error
	return nil
}

// AssignProperties_To_PrivateEndpoint_Spec populates the provided destination PrivateEndpoint_Spec from our PrivateEndpoint_Spec
func (endpoint *PrivateEndpoint_Spec) AssignProperties_To_PrivateEndpoint_Spec(destination *v20220701s.PrivateEndpoint_Spec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// ApplicationSecurityGroups
	if endpoint.ApplicationSecurityGroups != nil {
		applicationSecurityGroupList := make([]v20220701s.ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded, len(endpoint.ApplicationSecurityGroups))
		for applicationSecurityGroupIndex, applicationSecurityGroupItem := range endpoint.ApplicationSecurityGroups {
			// Shadow the loop variable to avoid aliasing
			applicationSecurityGroupItem := applicationSecurityGroupItem
			var applicationSecurityGroup v20220701s.ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded
			err := applicationSecurityGroupItem.AssignProperties_To_ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded(&applicationSecurityGroup)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded() to populate field ApplicationSecurityGroups")
			}
			applicationSecurityGroupList[applicationSecurityGroupIndex] = applicationSecurityGroup
		}
		destination.ApplicationSecurityGroups = applicationSecurityGroupList
	} else {
		destination.ApplicationSecurityGroups = nil
	}

	// AzureName
	destination.AzureName = endpoint.AzureName

	// CustomNetworkInterfaceName
	destination.CustomNetworkInterfaceName = genruntime.ClonePointerToString(endpoint.CustomNetworkInterfaceName)

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

	// IpConfigurations
	if endpoint.IpConfigurations != nil {
		ipConfigurationList := make([]v20220701s.PrivateEndpointIPConfiguration, len(endpoint.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range endpoint.IpConfigurations {
			// Shadow the loop variable to avoid aliasing
			ipConfigurationItem := ipConfigurationItem
			var ipConfiguration v20220701s.PrivateEndpointIPConfiguration
			err := ipConfigurationItem.AssignProperties_To_PrivateEndpointIPConfiguration(&ipConfiguration)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_PrivateEndpointIPConfiguration() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		destination.IpConfigurations = ipConfigurationList
	} else {
		destination.IpConfigurations = nil
	}

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

	// ManualPrivateLinkServiceConnections
	if endpoint.ManualPrivateLinkServiceConnections != nil {
		manualPrivateLinkServiceConnectionList := make([]v20220701s.PrivateLinkServiceConnection, len(endpoint.ManualPrivateLinkServiceConnections))
		for manualPrivateLinkServiceConnectionIndex, manualPrivateLinkServiceConnectionItem := range endpoint.ManualPrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			manualPrivateLinkServiceConnectionItem := manualPrivateLinkServiceConnectionItem
			var manualPrivateLinkServiceConnection v20220701s.PrivateLinkServiceConnection
			err := manualPrivateLinkServiceConnectionItem.AssignProperties_To_PrivateLinkServiceConnection(&manualPrivateLinkServiceConnection)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceConnection() to populate field ManualPrivateLinkServiceConnections")
			}
			manualPrivateLinkServiceConnectionList[manualPrivateLinkServiceConnectionIndex] = manualPrivateLinkServiceConnection
		}
		destination.ManualPrivateLinkServiceConnections = manualPrivateLinkServiceConnectionList
	} else {
		destination.ManualPrivateLinkServiceConnections = nil
	}

	// OriginalVersion
	destination.OriginalVersion = endpoint.OriginalVersion()

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

	// PrivateLinkServiceConnections
	if endpoint.PrivateLinkServiceConnections != nil {
		privateLinkServiceConnectionList := make([]v20220701s.PrivateLinkServiceConnection, len(endpoint.PrivateLinkServiceConnections))
		for privateLinkServiceConnectionIndex, privateLinkServiceConnectionItem := range endpoint.PrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			privateLinkServiceConnectionItem := privateLinkServiceConnectionItem
			var privateLinkServiceConnection v20220701s.PrivateLinkServiceConnection
			err := privateLinkServiceConnectionItem.AssignProperties_To_PrivateLinkServiceConnection(&privateLinkServiceConnection)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceConnection() to populate field PrivateLinkServiceConnections")
			}
			privateLinkServiceConnectionList[privateLinkServiceConnectionIndex] = privateLinkServiceConnection
		}
		destination.PrivateLinkServiceConnections = privateLinkServiceConnectionList
	} else {
		destination.PrivateLinkServiceConnections = nil
	}

	// Subnet
	if endpoint.Subnet != nil {
		var subnet v20220701s.Subnet_PrivateEndpoint_SubResourceEmbedded
		err := endpoint.Subnet.AssignProperties_To_Subnet_PrivateEndpoint_SubResourceEmbedded(&subnet)
		if err != nil {
			return errors.Wrap(err, "calling AssignProperties_To_Subnet_PrivateEndpoint_SubResourceEmbedded() to populate field Subnet")
		}
		destination.Subnet = &subnet
	} else {
		destination.Subnet = nil
	}

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

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

	// No error
	return nil
}

// Initialize_From_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded populates our PrivateEndpoint_Spec from the provided source PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded
func (endpoint *PrivateEndpoint_Spec) Initialize_From_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded(source *PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded) error {

	// ApplicationSecurityGroups
	if source.ApplicationSecurityGroups != nil {
		applicationSecurityGroupList := make([]ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded, len(source.ApplicationSecurityGroups))
		for applicationSecurityGroupIndex, applicationSecurityGroupItem := range source.ApplicationSecurityGroups {
			// Shadow the loop variable to avoid aliasing
			applicationSecurityGroupItem := applicationSecurityGroupItem
			var applicationSecurityGroup ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded
			err := applicationSecurityGroup.Initialize_From_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded(&applicationSecurityGroupItem)
			if err != nil {
				return errors.Wrap(err, "calling Initialize_From_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field ApplicationSecurityGroups")
			}
			applicationSecurityGroupList[applicationSecurityGroupIndex] = applicationSecurityGroup
		}
		endpoint.ApplicationSecurityGroups = applicationSecurityGroupList
	} else {
		endpoint.ApplicationSecurityGroups = nil
	}

	// CustomNetworkInterfaceName
	endpoint.CustomNetworkInterfaceName = genruntime.ClonePointerToString(source.CustomNetworkInterfaceName)

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

	// IpConfigurations
	if source.IpConfigurations != nil {
		ipConfigurationList := make([]PrivateEndpointIPConfiguration, len(source.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range source.IpConfigurations {
			// Shadow the loop variable to avoid aliasing
			ipConfigurationItem := ipConfigurationItem
			var ipConfiguration PrivateEndpointIPConfiguration
			err := ipConfiguration.Initialize_From_PrivateEndpointIPConfiguration_STATUS(&ipConfigurationItem)
			if err != nil {
				return errors.Wrap(err, "calling Initialize_From_PrivateEndpointIPConfiguration_STATUS() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		endpoint.IpConfigurations = ipConfigurationList
	} else {
		endpoint.IpConfigurations = nil
	}

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

	// ManualPrivateLinkServiceConnections
	if source.ManualPrivateLinkServiceConnections != nil {
		manualPrivateLinkServiceConnectionList := make([]PrivateLinkServiceConnection, len(source.ManualPrivateLinkServiceConnections))
		for manualPrivateLinkServiceConnectionIndex, manualPrivateLinkServiceConnectionItem := range source.ManualPrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			manualPrivateLinkServiceConnectionItem := manualPrivateLinkServiceConnectionItem
			var manualPrivateLinkServiceConnection PrivateLinkServiceConnection
			err := manualPrivateLinkServiceConnection.Initialize_From_PrivateLinkServiceConnection_STATUS(&manualPrivateLinkServiceConnectionItem)
			if err != nil {
				return errors.Wrap(err, "calling Initialize_From_PrivateLinkServiceConnection_STATUS() to populate field ManualPrivateLinkServiceConnections")
			}
			manualPrivateLinkServiceConnectionList[manualPrivateLinkServiceConnectionIndex] = manualPrivateLinkServiceConnection
		}
		endpoint.ManualPrivateLinkServiceConnections = manualPrivateLinkServiceConnectionList
	} else {
		endpoint.ManualPrivateLinkServiceConnections = nil
	}

	// PrivateLinkServiceConnections
	if source.PrivateLinkServiceConnections != nil {
		privateLinkServiceConnectionList := make([]PrivateLinkServiceConnection, len(source.PrivateLinkServiceConnections))
		for privateLinkServiceConnectionIndex, privateLinkServiceConnectionItem := range source.PrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			privateLinkServiceConnectionItem := privateLinkServiceConnectionItem
			var privateLinkServiceConnection PrivateLinkServiceConnection
			err := privateLinkServiceConnection.Initialize_From_PrivateLinkServiceConnection_STATUS(&privateLinkServiceConnectionItem)
			if err != nil {
				return errors.Wrap(err, "calling Initialize_From_PrivateLinkServiceConnection_STATUS() to populate field PrivateLinkServiceConnections")
			}
			privateLinkServiceConnectionList[privateLinkServiceConnectionIndex] = privateLinkServiceConnection
		}
		endpoint.PrivateLinkServiceConnections = privateLinkServiceConnectionList
	} else {
		endpoint.PrivateLinkServiceConnections = nil
	}

	// Subnet
	if source.Subnet != nil {
		var subnet Subnet_PrivateEndpoint_SubResourceEmbedded
		err := subnet.Initialize_From_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded(source.Subnet)
		if err != nil {
			return errors.Wrap(err, "calling Initialize_From_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field Subnet")
		}
		endpoint.Subnet = &subnet
	} else {
		endpoint.Subnet = nil
	}

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

	// No error
	return nil
}

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

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

// Private endpoint resource.
type PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded struct {
	// ApplicationSecurityGroups: Application security groups in which the private endpoint IP configuration is included.
	ApplicationSecurityGroups []ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded `json:"applicationSecurityGroups,omitempty"`

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

	// CustomDnsConfigs: An array of custom dns configurations.
	CustomDnsConfigs []CustomDnsConfigPropertiesFormat_STATUS `json:"customDnsConfigs,omitempty"`

	// CustomNetworkInterfaceName: The custom name of the network interface attached to the private endpoint.
	CustomNetworkInterfaceName *string `json:"customNetworkInterfaceName,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"`

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

	// IpConfigurations: A list of IP configurations of the private endpoint. This will be used to map to the First Party
	// Service's endpoints.
	IpConfigurations []PrivateEndpointIPConfiguration_STATUS `json:"ipConfigurations,omitempty"`

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

	// ManualPrivateLinkServiceConnections: A grouping of information about the connection to the remote resource. Used when
	// the network admin does not have access to approve connections to the remote resource.
	ManualPrivateLinkServiceConnections []PrivateLinkServiceConnection_STATUS `json:"manualPrivateLinkServiceConnections,omitempty"`

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

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

	// PrivateLinkServiceConnections: A grouping of information about the connection to the remote resource.
	PrivateLinkServiceConnections []PrivateLinkServiceConnection_STATUS `json:"privateLinkServiceConnections,omitempty"`

	// ProvisioningState: The provisioning state of the private endpoint resource.
	ProvisioningState *ApplicationGatewayProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// Subnet: The ID of the subnet from which the private IP will be allocated.
	Subnet *Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded `json:"subnet,omitempty"`

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

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

var _ genruntime.ConvertibleStatus = &PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded{}

// ConvertStatusFrom populates our PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded from the provided source
func (embedded *PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	src, ok := source.(*v20220701s.PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded)
	if ok {
		// Populate our instance from source
		return embedded.AssignProperties_From_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded(src)
	}

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

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

	return nil
}

// ConvertStatusTo populates the provided destination from our PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	dst, ok := destination.(*v20220701s.PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded)
	if ok {
		// Populate destination from our instance
		return embedded.AssignProperties_To_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded(dst)
	}

	// Convert to an intermediate form
	dst = &v20220701s.PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded{}
	err := embedded.AssignProperties_To_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded(dst)
	if err != nil {
		return errors.Wrap(err, "initial step of conversion in ConvertStatusTo()")
	}

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

	return nil
}

var _ genruntime.FromARMConverter = &PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded{}

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

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

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

	// no assignment for property "Conditions"

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

	// Set property "CustomNetworkInterfaceName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CustomNetworkInterfaceName != nil {
			customNetworkInterfaceName := *typedInput.Properties.CustomNetworkInterfaceName
			embedded.CustomNetworkInterfaceName = &customNetworkInterfaceName
		}
	}

	// Set property "Etag":
	if typedInput.Etag != nil {
		etag := *typedInput.Etag
		embedded.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
		embedded.ExtendedLocation = &extendedLocation
	}

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

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

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

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

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

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

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

	// Set property "ProvisioningState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProvisioningState != nil {
			provisioningState := *typedInput.Properties.ProvisioningState
			embedded.ProvisioningState = &provisioningState
		}
	}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded populates our PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded from the provided source PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded) AssignProperties_From_PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded(source *v20220701s.PrivateEndpoint_STATUS_PrivateEndpoint_SubResourceEmbedded) error {

	// ApplicationSecurityGroups
	if source.ApplicationSecurityGroups != nil {
		applicationSecurityGroupList := make([]ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded, len(source.ApplicationSecurityGroups))
		for applicationSecurityGroupIndex, applicationSecurityGroupItem := range source.ApplicationSecurityGroups {
			// Shadow the loop variable to avoid aliasing
			applicationSecurityGroupItem := applicationSecurityGroupItem
			var applicationSecurityGroup ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded
			err := applicationSecurityGroup.AssignProperties_From_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded(&applicationSecurityGroupItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field ApplicationSecurityGroups")
			}
			applicationSecurityGroupList[applicationSecurityGroupIndex] = applicationSecurityGroup
		}
		embedded.ApplicationSecurityGroups = applicationSecurityGroupList
	} else {
		embedded.ApplicationSecurityGroups = nil
	}

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

	// CustomDnsConfigs
	if source.CustomDnsConfigs != nil {
		customDnsConfigList := make([]CustomDnsConfigPropertiesFormat_STATUS, len(source.CustomDnsConfigs))
		for customDnsConfigIndex, customDnsConfigItem := range source.CustomDnsConfigs {
			// Shadow the loop variable to avoid aliasing
			customDnsConfigItem := customDnsConfigItem
			var customDnsConfig CustomDnsConfigPropertiesFormat_STATUS
			err := customDnsConfig.AssignProperties_From_CustomDnsConfigPropertiesFormat_STATUS(&customDnsConfigItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_CustomDnsConfigPropertiesFormat_STATUS() to populate field CustomDnsConfigs")
			}
			customDnsConfigList[customDnsConfigIndex] = customDnsConfig
		}
		embedded.CustomDnsConfigs = customDnsConfigList
	} else {
		embedded.CustomDnsConfigs = nil
	}

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

	// Etag
	embedded.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 errors.Wrap(err, "calling AssignProperties_From_ExtendedLocation_STATUS() to populate field ExtendedLocation")
		}
		embedded.ExtendedLocation = &extendedLocation
	} else {
		embedded.ExtendedLocation = nil
	}

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

	// IpConfigurations
	if source.IpConfigurations != nil {
		ipConfigurationList := make([]PrivateEndpointIPConfiguration_STATUS, len(source.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range source.IpConfigurations {
			// Shadow the loop variable to avoid aliasing
			ipConfigurationItem := ipConfigurationItem
			var ipConfiguration PrivateEndpointIPConfiguration_STATUS
			err := ipConfiguration.AssignProperties_From_PrivateEndpointIPConfiguration_STATUS(&ipConfigurationItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_PrivateEndpointIPConfiguration_STATUS() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		embedded.IpConfigurations = ipConfigurationList
	} else {
		embedded.IpConfigurations = nil
	}

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

	// ManualPrivateLinkServiceConnections
	if source.ManualPrivateLinkServiceConnections != nil {
		manualPrivateLinkServiceConnectionList := make([]PrivateLinkServiceConnection_STATUS, len(source.ManualPrivateLinkServiceConnections))
		for manualPrivateLinkServiceConnectionIndex, manualPrivateLinkServiceConnectionItem := range source.ManualPrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			manualPrivateLinkServiceConnectionItem := manualPrivateLinkServiceConnectionItem
			var manualPrivateLinkServiceConnection PrivateLinkServiceConnection_STATUS
			err := manualPrivateLinkServiceConnection.AssignProperties_From_PrivateLinkServiceConnection_STATUS(&manualPrivateLinkServiceConnectionItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceConnection_STATUS() to populate field ManualPrivateLinkServiceConnections")
			}
			manualPrivateLinkServiceConnectionList[manualPrivateLinkServiceConnectionIndex] = manualPrivateLinkServiceConnection
		}
		embedded.ManualPrivateLinkServiceConnections = manualPrivateLinkServiceConnectionList
	} else {
		embedded.ManualPrivateLinkServiceConnections = nil
	}

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

	// NetworkInterfaces
	if source.NetworkInterfaces != nil {
		networkInterfaceList := make([]NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded, len(source.NetworkInterfaces))
		for networkInterfaceIndex, networkInterfaceItem := range source.NetworkInterfaces {
			// Shadow the loop variable to avoid aliasing
			networkInterfaceItem := networkInterfaceItem
			var networkInterface NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded
			err := networkInterface.AssignProperties_From_NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded(&networkInterfaceItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field NetworkInterfaces")
			}
			networkInterfaceList[networkInterfaceIndex] = networkInterface
		}
		embedded.NetworkInterfaces = networkInterfaceList
	} else {
		embedded.NetworkInterfaces = nil
	}

	// PrivateLinkServiceConnections
	if source.PrivateLinkServiceConnections != nil {
		privateLinkServiceConnectionList := make([]PrivateLinkServiceConnection_STATUS, len(source.PrivateLinkServiceConnections))
		for privateLinkServiceConnectionIndex, privateLinkServiceConnectionItem := range source.PrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			privateLinkServiceConnectionItem := privateLinkServiceConnectionItem
			var privateLinkServiceConnection PrivateLinkServiceConnection_STATUS
			err := privateLinkServiceConnection.AssignProperties_From_PrivateLinkServiceConnection_STATUS(&privateLinkServiceConnectionItem)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceConnection_STATUS() to populate field PrivateLinkServiceConnections")
			}
			privateLinkServiceConnectionList[privateLinkServiceConnectionIndex] = privateLinkServiceConnection
		}
		embedded.PrivateLinkServiceConnections = privateLinkServiceConnectionList
	} else {
		embedded.PrivateLinkServiceConnections = nil
	}

	// ProvisioningState
	if source.ProvisioningState != nil {
		provisioningState := ApplicationGatewayProvisioningState_STATUS(*source.ProvisioningState)
		embedded.ProvisioningState = &provisioningState
	} else {
		embedded.ProvisioningState = nil
	}

	// Subnet
	if source.Subnet != nil {
		var subnet Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded
		err := subnet.AssignProperties_From_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded(source.Subnet)
		if err != nil {
			return errors.Wrap(err, "calling AssignProperties_From_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field Subnet")
		}
		embedded.Subnet = &subnet
	} else {
		embedded.Subnet = nil
	}

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

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

	// No error
	return nil
}

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

	// ApplicationSecurityGroups
	if embedded.ApplicationSecurityGroups != nil {
		applicationSecurityGroupList := make([]v20220701s.ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded, len(embedded.ApplicationSecurityGroups))
		for applicationSecurityGroupIndex, applicationSecurityGroupItem := range embedded.ApplicationSecurityGroups {
			// Shadow the loop variable to avoid aliasing
			applicationSecurityGroupItem := applicationSecurityGroupItem
			var applicationSecurityGroup v20220701s.ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded
			err := applicationSecurityGroupItem.AssignProperties_To_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded(&applicationSecurityGroup)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field ApplicationSecurityGroups")
			}
			applicationSecurityGroupList[applicationSecurityGroupIndex] = applicationSecurityGroup
		}
		destination.ApplicationSecurityGroups = applicationSecurityGroupList
	} else {
		destination.ApplicationSecurityGroups = nil
	}

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

	// CustomDnsConfigs
	if embedded.CustomDnsConfigs != nil {
		customDnsConfigList := make([]v20220701s.CustomDnsConfigPropertiesFormat_STATUS, len(embedded.CustomDnsConfigs))
		for customDnsConfigIndex, customDnsConfigItem := range embedded.CustomDnsConfigs {
			// Shadow the loop variable to avoid aliasing
			customDnsConfigItem := customDnsConfigItem
			var customDnsConfig v20220701s.CustomDnsConfigPropertiesFormat_STATUS
			err := customDnsConfigItem.AssignProperties_To_CustomDnsConfigPropertiesFormat_STATUS(&customDnsConfig)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_CustomDnsConfigPropertiesFormat_STATUS() to populate field CustomDnsConfigs")
			}
			customDnsConfigList[customDnsConfigIndex] = customDnsConfig
		}
		destination.CustomDnsConfigs = customDnsConfigList
	} else {
		destination.CustomDnsConfigs = nil
	}

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

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

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

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

	// IpConfigurations
	if embedded.IpConfigurations != nil {
		ipConfigurationList := make([]v20220701s.PrivateEndpointIPConfiguration_STATUS, len(embedded.IpConfigurations))
		for ipConfigurationIndex, ipConfigurationItem := range embedded.IpConfigurations {
			// Shadow the loop variable to avoid aliasing
			ipConfigurationItem := ipConfigurationItem
			var ipConfiguration v20220701s.PrivateEndpointIPConfiguration_STATUS
			err := ipConfigurationItem.AssignProperties_To_PrivateEndpointIPConfiguration_STATUS(&ipConfiguration)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_PrivateEndpointIPConfiguration_STATUS() to populate field IpConfigurations")
			}
			ipConfigurationList[ipConfigurationIndex] = ipConfiguration
		}
		destination.IpConfigurations = ipConfigurationList
	} else {
		destination.IpConfigurations = nil
	}

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

	// ManualPrivateLinkServiceConnections
	if embedded.ManualPrivateLinkServiceConnections != nil {
		manualPrivateLinkServiceConnectionList := make([]v20220701s.PrivateLinkServiceConnection_STATUS, len(embedded.ManualPrivateLinkServiceConnections))
		for manualPrivateLinkServiceConnectionIndex, manualPrivateLinkServiceConnectionItem := range embedded.ManualPrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			manualPrivateLinkServiceConnectionItem := manualPrivateLinkServiceConnectionItem
			var manualPrivateLinkServiceConnection v20220701s.PrivateLinkServiceConnection_STATUS
			err := manualPrivateLinkServiceConnectionItem.AssignProperties_To_PrivateLinkServiceConnection_STATUS(&manualPrivateLinkServiceConnection)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceConnection_STATUS() to populate field ManualPrivateLinkServiceConnections")
			}
			manualPrivateLinkServiceConnectionList[manualPrivateLinkServiceConnectionIndex] = manualPrivateLinkServiceConnection
		}
		destination.ManualPrivateLinkServiceConnections = manualPrivateLinkServiceConnectionList
	} else {
		destination.ManualPrivateLinkServiceConnections = nil
	}

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

	// NetworkInterfaces
	if embedded.NetworkInterfaces != nil {
		networkInterfaceList := make([]v20220701s.NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded, len(embedded.NetworkInterfaces))
		for networkInterfaceIndex, networkInterfaceItem := range embedded.NetworkInterfaces {
			// Shadow the loop variable to avoid aliasing
			networkInterfaceItem := networkInterfaceItem
			var networkInterface v20220701s.NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded
			err := networkInterfaceItem.AssignProperties_To_NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded(&networkInterface)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field NetworkInterfaces")
			}
			networkInterfaceList[networkInterfaceIndex] = networkInterface
		}
		destination.NetworkInterfaces = networkInterfaceList
	} else {
		destination.NetworkInterfaces = nil
	}

	// PrivateLinkServiceConnections
	if embedded.PrivateLinkServiceConnections != nil {
		privateLinkServiceConnectionList := make([]v20220701s.PrivateLinkServiceConnection_STATUS, len(embedded.PrivateLinkServiceConnections))
		for privateLinkServiceConnectionIndex, privateLinkServiceConnectionItem := range embedded.PrivateLinkServiceConnections {
			// Shadow the loop variable to avoid aliasing
			privateLinkServiceConnectionItem := privateLinkServiceConnectionItem
			var privateLinkServiceConnection v20220701s.PrivateLinkServiceConnection_STATUS
			err := privateLinkServiceConnectionItem.AssignProperties_To_PrivateLinkServiceConnection_STATUS(&privateLinkServiceConnection)
			if err != nil {
				return errors.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceConnection_STATUS() to populate field PrivateLinkServiceConnections")
			}
			privateLinkServiceConnectionList[privateLinkServiceConnectionIndex] = privateLinkServiceConnection
		}
		destination.PrivateLinkServiceConnections = privateLinkServiceConnectionList
	} else {
		destination.PrivateLinkServiceConnections = nil
	}

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

	// Subnet
	if embedded.Subnet != nil {
		var subnet v20220701s.Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded
		err := embedded.Subnet.AssignProperties_To_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded(&subnet)
		if err != nil {
			return errors.Wrap(err, "calling AssignProperties_To_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded() to populate field Subnet")
		}
		destination.Subnet = &subnet
	} else {
		destination.Subnet = nil
	}

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

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

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

	// No error
	return nil
}

// An application security group in a resource group.
type ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded populates our ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded from the provided source ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded) AssignProperties_From_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded(source *v20220701s.ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded) error {

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

	// No error
	return nil
}

// AssignProperties_To_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded populates the provided destination ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded from our ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded) AssignProperties_To_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded(destination *v20220701s.ApplicationSecurityGroup_STATUS_PrivateEndpoint_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
}

// An application security group in a resource group.
type ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded{}

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

	// 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 *ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded_ARM{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded populates our ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded from the provided source ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded
func (embedded *ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded) AssignProperties_From_ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded(source *v20220701s.ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded) error {

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

	// No error
	return nil
}

// AssignProperties_To_ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded populates the provided destination ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded from our ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded
func (embedded *ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded) AssignProperties_To_ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded(destination *v20220701s.ApplicationSecurityGroupSpec_PrivateEndpoint_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_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded populates our ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded from the provided source ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *ApplicationSecurityGroupSpec_PrivateEndpoint_SubResourceEmbedded) Initialize_From_ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded(source *ApplicationSecurityGroup_STATUS_PrivateEndpoint_SubResourceEmbedded) error {

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

	// No error
	return nil
}

// Contains custom Dns resolution configuration from customer.
type CustomDnsConfigPropertiesFormat_STATUS struct {
	// Fqdn: Fqdn that resolves to private endpoint ip address.
	Fqdn *string `json:"fqdn,omitempty"`

	// IpAddresses: A list of private ip addresses of the private endpoint.
	IpAddresses []string `json:"ipAddresses,omitempty"`
}

var _ genruntime.FromARMConverter = &CustomDnsConfigPropertiesFormat_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (format *CustomDnsConfigPropertiesFormat_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &CustomDnsConfigPropertiesFormat_STATUS_ARM{}
}

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

	// Set property "Fqdn":
	if typedInput.Fqdn != nil {
		fqdn := *typedInput.Fqdn
		format.Fqdn = &fqdn
	}

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

	// No error
	return nil
}

// AssignProperties_From_CustomDnsConfigPropertiesFormat_STATUS populates our CustomDnsConfigPropertiesFormat_STATUS from the provided source CustomDnsConfigPropertiesFormat_STATUS
func (format *CustomDnsConfigPropertiesFormat_STATUS) AssignProperties_From_CustomDnsConfigPropertiesFormat_STATUS(source *v20220701s.CustomDnsConfigPropertiesFormat_STATUS) error {

	// Fqdn
	format.Fqdn = genruntime.ClonePointerToString(source.Fqdn)

	// IpAddresses
	format.IpAddresses = genruntime.CloneSliceOfString(source.IpAddresses)

	// No error
	return nil
}

// AssignProperties_To_CustomDnsConfigPropertiesFormat_STATUS populates the provided destination CustomDnsConfigPropertiesFormat_STATUS from our CustomDnsConfigPropertiesFormat_STATUS
func (format *CustomDnsConfigPropertiesFormat_STATUS) AssignProperties_To_CustomDnsConfigPropertiesFormat_STATUS(destination *v20220701s.CustomDnsConfigPropertiesFormat_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// Fqdn
	destination.Fqdn = genruntime.ClonePointerToString(format.Fqdn)

	// IpAddresses
	destination.IpAddresses = genruntime.CloneSliceOfString(format.IpAddresses)

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

	// No error
	return nil
}

// ExtendedLocation complex type.
type ExtendedLocation struct {
	// Name: The name of the extended location.
	Name *string `json:"name,omitempty"`

	// Type: The type of the extended location.
	Type *ExtendedLocationType `json:"type,omitempty"`
}

var _ genruntime.ARMTransformer = &ExtendedLocation{}

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

	// Type
	if source.Type != nil {
		typeVar := ExtendedLocationType(*source.Type)
		location.Type = &typeVar
	} else {
		location.Type = nil
	}

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

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

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

	// Type
	if source.Type != nil {
		typeVar := ExtendedLocationType(*source.Type)
		location.Type = &typeVar
	} else {
		location.Type = nil
	}

	// No error
	return nil
}

// ExtendedLocation complex type.
type ExtendedLocation_STATUS struct {
	// Name: The name of the extended location.
	Name *string `json:"name,omitempty"`

	// Type: The type of the extended location.
	Type *ExtendedLocationType_STATUS `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &ExtendedLocation_STATUS{}

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

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

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

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

	// No error
	return nil
}

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

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

	// Type
	if source.Type != nil {
		typeVar := ExtendedLocationType_STATUS(*source.Type)
		location.Type = &typeVar
	} else {
		location.Type = nil
	}

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

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

var _ genruntime.FromARMConverter = &NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded populates our NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded from the provided source NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded) AssignProperties_From_NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded(source *v20220701s.NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded) error {

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

	// No error
	return nil
}

// AssignProperties_To_NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded populates the provided destination NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded from our NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded) AssignProperties_To_NetworkInterface_STATUS_PrivateEndpoint_SubResourceEmbedded(destination *v20220701s.NetworkInterface_STATUS_PrivateEndpoint_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
}

// An IP Configuration of the private endpoint.
type PrivateEndpointIPConfiguration struct {
	// GroupId: The ID of a group obtained from the remote resource that this private endpoint should connect to.
	GroupId *string `json:"groupId,omitempty"`

	// MemberName: The member name of a group obtained from the remote resource that this private endpoint should connect to.
	MemberName *string `json:"memberName,omitempty"`

	// Name: The name of the resource that is unique within a resource group.
	Name *string `json:"name,omitempty"`

	// PrivateIPAddress: A private ip address obtained from the private endpoint's subnet.
	PrivateIPAddress *string `json:"privateIPAddress,omitempty"`
}

var _ genruntime.ARMTransformer = &PrivateEndpointIPConfiguration{}

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

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

	// Set property "Properties":
	if configuration.GroupId != nil ||
		configuration.MemberName != nil ||
		configuration.PrivateIPAddress != nil {
		result.Properties = &PrivateEndpointIPConfigurationProperties_ARM{}
	}
	if configuration.GroupId != nil {
		groupId := *configuration.GroupId
		result.Properties.GroupId = &groupId
	}
	if configuration.MemberName != nil {
		memberName := *configuration.MemberName
		result.Properties.MemberName = &memberName
	}
	if configuration.PrivateIPAddress != nil {
		privateIPAddress := *configuration.PrivateIPAddress
		result.Properties.PrivateIPAddress = &privateIPAddress
	}
	return result, nil
}

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

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpointIPConfiguration populates our PrivateEndpointIPConfiguration from the provided source PrivateEndpointIPConfiguration
func (configuration *PrivateEndpointIPConfiguration) AssignProperties_From_PrivateEndpointIPConfiguration(source *v20220701s.PrivateEndpointIPConfiguration) error {

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

	// No error
	return nil
}

// Initialize_From_PrivateEndpointIPConfiguration_STATUS populates our PrivateEndpointIPConfiguration from the provided source PrivateEndpointIPConfiguration_STATUS
func (configuration *PrivateEndpointIPConfiguration) Initialize_From_PrivateEndpointIPConfiguration_STATUS(source *PrivateEndpointIPConfiguration_STATUS) error {

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

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

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

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

	// No error
	return nil
}

// An IP Configuration of the private endpoint.
type PrivateEndpointIPConfiguration_STATUS struct {
	// Etag: A unique read-only string that changes whenever the resource is updated.
	Etag *string `json:"etag,omitempty"`

	// GroupId: The ID of a group obtained from the remote resource that this private endpoint should connect to.
	GroupId *string `json:"groupId,omitempty"`

	// MemberName: The member name of a group obtained from the remote resource that this private endpoint should connect to.
	MemberName *string `json:"memberName,omitempty"`

	// Name: The name of the resource that is unique within a resource group.
	Name *string `json:"name,omitempty"`

	// PrivateIPAddress: A private ip address obtained from the private endpoint's subnet.
	PrivateIPAddress *string `json:"privateIPAddress,omitempty"`

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

var _ genruntime.FromARMConverter = &PrivateEndpointIPConfiguration_STATUS{}

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

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

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

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpointIPConfiguration_STATUS populates our PrivateEndpointIPConfiguration_STATUS from the provided source PrivateEndpointIPConfiguration_STATUS
func (configuration *PrivateEndpointIPConfiguration_STATUS) AssignProperties_From_PrivateEndpointIPConfiguration_STATUS(source *v20220701s.PrivateEndpointIPConfiguration_STATUS) error {

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

	// 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
}

// PrivateLinkServiceConnection resource.
type PrivateLinkServiceConnection struct {
	// GroupIds: The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to.
	GroupIds []string `json:"groupIds,omitempty"`

	// Name: The name of the resource that is unique within a resource group. This name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// PrivateLinkServiceConnectionState: A collection of read-only information about the state of the connection to the remote
	// resource.
	PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"`

	// PrivateLinkServiceReference: The resource id of private link service.
	PrivateLinkServiceReference *genruntime.ResourceReference `armReference:"PrivateLinkServiceId" json:"privateLinkServiceReference,omitempty"`

	// RequestMessage: A message passed to the owner of the remote resource with this connection request. Restricted to 140
	// chars.
	RequestMessage *string `json:"requestMessage,omitempty"`
}

var _ genruntime.ARMTransformer = &PrivateLinkServiceConnection{}

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

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

	// Set property "Properties":
	if connection.GroupIds != nil ||
		connection.PrivateLinkServiceConnectionState != nil ||
		connection.PrivateLinkServiceReference != nil ||
		connection.RequestMessage != nil {
		result.Properties = &PrivateLinkServiceConnectionProperties_ARM{}
	}
	for _, item := range connection.GroupIds {
		result.Properties.GroupIds = append(result.Properties.GroupIds, item)
	}
	if connection.PrivateLinkServiceConnectionState != nil {
		privateLinkServiceConnectionState_ARM, err := (*connection.PrivateLinkServiceConnectionState).ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		privateLinkServiceConnectionState := *privateLinkServiceConnectionState_ARM.(*PrivateLinkServiceConnectionState_ARM)
		result.Properties.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	}
	if connection.PrivateLinkServiceReference != nil {
		privateLinkServiceIdARMID, err := resolved.ResolvedReferences.Lookup(*connection.PrivateLinkServiceReference)
		if err != nil {
			return nil, err
		}
		privateLinkServiceId := privateLinkServiceIdARMID
		result.Properties.PrivateLinkServiceId = &privateLinkServiceId
	}
	if connection.RequestMessage != nil {
		requestMessage := *connection.RequestMessage
		result.Properties.RequestMessage = &requestMessage
	}
	return result, nil
}

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

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

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

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

	// Set property "PrivateLinkServiceConnectionState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateLinkServiceConnectionState != nil {
			var privateLinkServiceConnectionState1 PrivateLinkServiceConnectionState
			err := privateLinkServiceConnectionState1.PopulateFromARM(owner, *typedInput.Properties.PrivateLinkServiceConnectionState)
			if err != nil {
				return err
			}
			privateLinkServiceConnectionState := privateLinkServiceConnectionState1
			connection.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
		}
	}

	// no assignment for property "PrivateLinkServiceReference"

	// Set property "RequestMessage":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RequestMessage != nil {
			requestMessage := *typedInput.Properties.RequestMessage
			connection.RequestMessage = &requestMessage
		}
	}

	// No error
	return nil
}

// AssignProperties_From_PrivateLinkServiceConnection populates our PrivateLinkServiceConnection from the provided source PrivateLinkServiceConnection
func (connection *PrivateLinkServiceConnection) AssignProperties_From_PrivateLinkServiceConnection(source *v20220701s.PrivateLinkServiceConnection) error {

	// GroupIds
	connection.GroupIds = genruntime.CloneSliceOfString(source.GroupIds)

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

	// PrivateLinkServiceConnectionState
	if source.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState PrivateLinkServiceConnectionState
		err := privateLinkServiceConnectionState.AssignProperties_From_PrivateLinkServiceConnectionState(source.PrivateLinkServiceConnectionState)
		if err != nil {
			return errors.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceConnectionState() to populate field PrivateLinkServiceConnectionState")
		}
		connection.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		connection.PrivateLinkServiceConnectionState = nil
	}

	// PrivateLinkServiceReference
	if source.PrivateLinkServiceReference != nil {
		privateLinkServiceReference := source.PrivateLinkServiceReference.Copy()
		connection.PrivateLinkServiceReference = &privateLinkServiceReference
	} else {
		connection.PrivateLinkServiceReference = nil
	}

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

	// No error
	return nil
}

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

	// GroupIds
	destination.GroupIds = genruntime.CloneSliceOfString(connection.GroupIds)

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

	// PrivateLinkServiceConnectionState
	if connection.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState v20220701s.PrivateLinkServiceConnectionState
		err := connection.PrivateLinkServiceConnectionState.AssignProperties_To_PrivateLinkServiceConnectionState(&privateLinkServiceConnectionState)
		if err != nil {
			return errors.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceConnectionState() to populate field PrivateLinkServiceConnectionState")
		}
		destination.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		destination.PrivateLinkServiceConnectionState = nil
	}

	// PrivateLinkServiceReference
	if connection.PrivateLinkServiceReference != nil {
		privateLinkServiceReference := connection.PrivateLinkServiceReference.Copy()
		destination.PrivateLinkServiceReference = &privateLinkServiceReference
	} else {
		destination.PrivateLinkServiceReference = nil
	}

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

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

	// No error
	return nil
}

// Initialize_From_PrivateLinkServiceConnection_STATUS populates our PrivateLinkServiceConnection from the provided source PrivateLinkServiceConnection_STATUS
func (connection *PrivateLinkServiceConnection) Initialize_From_PrivateLinkServiceConnection_STATUS(source *PrivateLinkServiceConnection_STATUS) error {

	// GroupIds
	connection.GroupIds = genruntime.CloneSliceOfString(source.GroupIds)

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

	// PrivateLinkServiceConnectionState
	if source.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState PrivateLinkServiceConnectionState
		err := privateLinkServiceConnectionState.Initialize_From_PrivateLinkServiceConnectionState_STATUS(source.PrivateLinkServiceConnectionState)
		if err != nil {
			return errors.Wrap(err, "calling Initialize_From_PrivateLinkServiceConnectionState_STATUS() to populate field PrivateLinkServiceConnectionState")
		}
		connection.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		connection.PrivateLinkServiceConnectionState = nil
	}

	// PrivateLinkServiceReference
	if source.PrivateLinkServiceId != nil {
		privateLinkServiceReference := genruntime.CreateResourceReferenceFromARMID(*source.PrivateLinkServiceId)
		connection.PrivateLinkServiceReference = &privateLinkServiceReference
	} else {
		connection.PrivateLinkServiceReference = nil
	}

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

	// No error
	return nil
}

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

	// GroupIds: The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to.
	GroupIds []string `json:"groupIds,omitempty"`

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

	// Name: The name of the resource that is unique within a resource group. This name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// PrivateLinkServiceConnectionState: A collection of read-only information about the state of the connection to the remote
	// resource.
	PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState_STATUS `json:"privateLinkServiceConnectionState,omitempty"`

	// PrivateLinkServiceId: The resource id of private link service.
	PrivateLinkServiceId *string `json:"privateLinkServiceId,omitempty"`

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

	// RequestMessage: A message passed to the owner of the remote resource with this connection request. Restricted to 140
	// chars.
	RequestMessage *string `json:"requestMessage,omitempty"`

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

var _ genruntime.FromARMConverter = &PrivateLinkServiceConnection_STATUS{}

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

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

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

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

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

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

	// Set property "PrivateLinkServiceConnectionState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateLinkServiceConnectionState != nil {
			var privateLinkServiceConnectionState1 PrivateLinkServiceConnectionState_STATUS
			err := privateLinkServiceConnectionState1.PopulateFromARM(owner, *typedInput.Properties.PrivateLinkServiceConnectionState)
			if err != nil {
				return err
			}
			privateLinkServiceConnectionState := privateLinkServiceConnectionState1
			connection.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
		}
	}

	// Set property "PrivateLinkServiceId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateLinkServiceId != nil {
			privateLinkServiceId := *typedInput.Properties.PrivateLinkServiceId
			connection.PrivateLinkServiceId = &privateLinkServiceId
		}
	}

	// Set property "ProvisioningState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProvisioningState != nil {
			provisioningState := *typedInput.Properties.ProvisioningState
			connection.ProvisioningState = &provisioningState
		}
	}

	// Set property "RequestMessage":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RequestMessage != nil {
			requestMessage := *typedInput.Properties.RequestMessage
			connection.RequestMessage = &requestMessage
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_PrivateLinkServiceConnection_STATUS populates our PrivateLinkServiceConnection_STATUS from the provided source PrivateLinkServiceConnection_STATUS
func (connection *PrivateLinkServiceConnection_STATUS) AssignProperties_From_PrivateLinkServiceConnection_STATUS(source *v20220701s.PrivateLinkServiceConnection_STATUS) error {

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

	// GroupIds
	connection.GroupIds = genruntime.CloneSliceOfString(source.GroupIds)

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

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

	// PrivateLinkServiceConnectionState
	if source.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState PrivateLinkServiceConnectionState_STATUS
		err := privateLinkServiceConnectionState.AssignProperties_From_PrivateLinkServiceConnectionState_STATUS(source.PrivateLinkServiceConnectionState)
		if err != nil {
			return errors.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceConnectionState_STATUS() to populate field PrivateLinkServiceConnectionState")
		}
		connection.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		connection.PrivateLinkServiceConnectionState = nil
	}

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

	// ProvisioningState
	if source.ProvisioningState != nil {
		provisioningState := ApplicationGatewayProvisioningState_STATUS(*source.ProvisioningState)
		connection.ProvisioningState = &provisioningState
	} else {
		connection.ProvisioningState = nil
	}

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

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

	// No error
	return nil
}

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

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

	// GroupIds
	destination.GroupIds = genruntime.CloneSliceOfString(connection.GroupIds)

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

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

	// PrivateLinkServiceConnectionState
	if connection.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState v20220701s.PrivateLinkServiceConnectionState_STATUS
		err := connection.PrivateLinkServiceConnectionState.AssignProperties_To_PrivateLinkServiceConnectionState_STATUS(&privateLinkServiceConnectionState)
		if err != nil {
			return errors.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceConnectionState_STATUS() to populate field PrivateLinkServiceConnectionState")
		}
		destination.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		destination.PrivateLinkServiceConnectionState = nil
	}

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

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

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

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

	// 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_PrivateEndpoint_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &Subnet_PrivateEndpoint_SubResourceEmbedded{}

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

	// 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_PrivateEndpoint_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &Subnet_PrivateEndpoint_SubResourceEmbedded_ARM{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_Subnet_PrivateEndpoint_SubResourceEmbedded populates our Subnet_PrivateEndpoint_SubResourceEmbedded from the provided source Subnet_PrivateEndpoint_SubResourceEmbedded
func (embedded *Subnet_PrivateEndpoint_SubResourceEmbedded) AssignProperties_From_Subnet_PrivateEndpoint_SubResourceEmbedded(source *v20220701s.Subnet_PrivateEndpoint_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_PrivateEndpoint_SubResourceEmbedded populates the provided destination Subnet_PrivateEndpoint_SubResourceEmbedded from our Subnet_PrivateEndpoint_SubResourceEmbedded
func (embedded *Subnet_PrivateEndpoint_SubResourceEmbedded) AssignProperties_To_Subnet_PrivateEndpoint_SubResourceEmbedded(destination *v20220701s.Subnet_PrivateEndpoint_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_PrivateEndpoint_SubResourceEmbedded populates our Subnet_PrivateEndpoint_SubResourceEmbedded from the provided source Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *Subnet_PrivateEndpoint_SubResourceEmbedded) Initialize_From_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded(source *Subnet_STATUS_PrivateEndpoint_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_PrivateEndpoint_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded populates our Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded from the provided source Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded) AssignProperties_From_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded(source *v20220701s.Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded) error {

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

	// No error
	return nil
}

// AssignProperties_To_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded populates the provided destination Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded from our Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded
func (embedded *Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded) AssignProperties_To_Subnet_STATUS_PrivateEndpoint_SubResourceEmbedded(destination *v20220701s.Subnet_STATUS_PrivateEndpoint_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 collection of information about the state of the connection between service consumer and provider.
type PrivateLinkServiceConnectionState struct {
	// ActionsRequired: A message indicating if changes on the service provider require any updates on the consumer.
	ActionsRequired *string `json:"actionsRequired,omitempty"`

	// Description: The reason for approval/rejection of the connection.
	Description *string `json:"description,omitempty"`

	// Status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.
	Status *string `json:"status,omitempty"`
}

var _ genruntime.ARMTransformer = &PrivateLinkServiceConnectionState{}

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

	// Set property "ActionsRequired":
	if state.ActionsRequired != nil {
		actionsRequired := *state.ActionsRequired
		result.ActionsRequired = &actionsRequired
	}

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

	// Set property "Status":
	if state.Status != nil {
		status := *state.Status
		result.Status = &status
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (state *PrivateLinkServiceConnectionState) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &PrivateLinkServiceConnectionState_ARM{}
}

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

	// Set property "ActionsRequired":
	if typedInput.ActionsRequired != nil {
		actionsRequired := *typedInput.ActionsRequired
		state.ActionsRequired = &actionsRequired
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateLinkServiceConnectionState populates our PrivateLinkServiceConnectionState from the provided source PrivateLinkServiceConnectionState
func (state *PrivateLinkServiceConnectionState) AssignProperties_From_PrivateLinkServiceConnectionState(source *v20220701s.PrivateLinkServiceConnectionState) error {

	// ActionsRequired
	state.ActionsRequired = genruntime.ClonePointerToString(source.ActionsRequired)

	// Description
	state.Description = genruntime.ClonePointerToString(source.Description)

	// Status
	state.Status = genruntime.ClonePointerToString(source.Status)

	// No error
	return nil
}

// AssignProperties_To_PrivateLinkServiceConnectionState populates the provided destination PrivateLinkServiceConnectionState from our PrivateLinkServiceConnectionState
func (state *PrivateLinkServiceConnectionState) AssignProperties_To_PrivateLinkServiceConnectionState(destination *v20220701s.PrivateLinkServiceConnectionState) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// ActionsRequired
	destination.ActionsRequired = genruntime.ClonePointerToString(state.ActionsRequired)

	// Description
	destination.Description = genruntime.ClonePointerToString(state.Description)

	// Status
	destination.Status = genruntime.ClonePointerToString(state.Status)

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

	// No error
	return nil
}

// Initialize_From_PrivateLinkServiceConnectionState_STATUS populates our PrivateLinkServiceConnectionState from the provided source PrivateLinkServiceConnectionState_STATUS
func (state *PrivateLinkServiceConnectionState) Initialize_From_PrivateLinkServiceConnectionState_STATUS(source *PrivateLinkServiceConnectionState_STATUS) error {

	// ActionsRequired
	state.ActionsRequired = genruntime.ClonePointerToString(source.ActionsRequired)

	// Description
	state.Description = genruntime.ClonePointerToString(source.Description)

	// Status
	state.Status = genruntime.ClonePointerToString(source.Status)

	// No error
	return nil
}

// A collection of information about the state of the connection between service consumer and provider.
type PrivateLinkServiceConnectionState_STATUS struct {
	// ActionsRequired: A message indicating if changes on the service provider require any updates on the consumer.
	ActionsRequired *string `json:"actionsRequired,omitempty"`

	// Description: The reason for approval/rejection of the connection.
	Description *string `json:"description,omitempty"`

	// Status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.
	Status *string `json:"status,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateLinkServiceConnectionState_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (state *PrivateLinkServiceConnectionState_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &PrivateLinkServiceConnectionState_STATUS_ARM{}
}

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

	// Set property "ActionsRequired":
	if typedInput.ActionsRequired != nil {
		actionsRequired := *typedInput.ActionsRequired
		state.ActionsRequired = &actionsRequired
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateLinkServiceConnectionState_STATUS populates our PrivateLinkServiceConnectionState_STATUS from the provided source PrivateLinkServiceConnectionState_STATUS
func (state *PrivateLinkServiceConnectionState_STATUS) AssignProperties_From_PrivateLinkServiceConnectionState_STATUS(source *v20220701s.PrivateLinkServiceConnectionState_STATUS) error {

	// ActionsRequired
	state.ActionsRequired = genruntime.ClonePointerToString(source.ActionsRequired)

	// Description
	state.Description = genruntime.ClonePointerToString(source.Description)

	// Status
	state.Status = genruntime.ClonePointerToString(source.Status)

	// No error
	return nil
}

// AssignProperties_To_PrivateLinkServiceConnectionState_STATUS populates the provided destination PrivateLinkServiceConnectionState_STATUS from our PrivateLinkServiceConnectionState_STATUS
func (state *PrivateLinkServiceConnectionState_STATUS) AssignProperties_To_PrivateLinkServiceConnectionState_STATUS(destination *v20220701s.PrivateLinkServiceConnectionState_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// ActionsRequired
	destination.ActionsRequired = genruntime.ClonePointerToString(state.ActionsRequired)

	// Description
	destination.Description = genruntime.ClonePointerToString(state.Description)

	// Status
	destination.Status = genruntime.ClonePointerToString(state.Status)

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&PrivateEndpoint{}, &PrivateEndpointList{})
}
