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

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

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,network}
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2024-03-01/loadBalancer.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}
type LoadBalancer struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              LoadBalancer_Spec   `json:"spec,omitempty"`
	Status            LoadBalancer_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &LoadBalancer{}

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

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

var _ conversion.Convertible = &LoadBalancer{}

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

	return balancer.AssignProperties_From_LoadBalancer(source)
}

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

	return balancer.AssignProperties_To_LoadBalancer(destination)
}

var _ configmaps.Exporter = &LoadBalancer{}

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

var _ secrets.Exporter = &LoadBalancer{}

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

var _ genruntime.ImportableResource = &LoadBalancer{}

// InitializeSpec initializes the spec for this resource from the given status
func (balancer *LoadBalancer) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*LoadBalancer_STATUS); ok {
		return balancer.Spec.Initialize_From_LoadBalancer_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &LoadBalancer{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/loadBalancers"
func (balancer *LoadBalancer) GetType() string {
	return "Microsoft.Network/loadBalancers"
}

// NewEmptyStatus returns a new empty (blank) status
func (balancer *LoadBalancer) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &LoadBalancer_STATUS{}
}

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

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

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

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

	balancer.Status = st
	return nil
}

// AssignProperties_From_LoadBalancer populates our LoadBalancer from the provided source LoadBalancer
func (balancer *LoadBalancer) AssignProperties_From_LoadBalancer(source *storage.LoadBalancer) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_LoadBalancer populates the provided destination LoadBalancer from our LoadBalancer
func (balancer *LoadBalancer) AssignProperties_To_LoadBalancer(destination *storage.LoadBalancer) error {

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

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

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

	// No error
	return nil
}

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

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

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

	// BackendAddressPools: Collection of backend address pools used by a load balancer.
	BackendAddressPools []BackendAddressPool_LoadBalancer_SubResourceEmbedded `json:"backendAddressPools,omitempty"`

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

	// FrontendIPConfigurations: Object representing the frontend IPs to be used for the load balancer.
	FrontendIPConfigurations []FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded `json:"frontendIPConfigurations,omitempty"`

	// InboundNatPools: Defines an external port range for inbound NAT to a single backend port on NICs associated with a load
	// balancer. Inbound NAT rules are created automatically for each NIC associated with the Load Balancer using an external
	// port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound NAT
	// rules. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual
	// virtual machines cannot reference an inbound NAT pool. They have to reference individual inbound NAT rules.
	InboundNatPools []InboundNatPool `json:"inboundNatPools,omitempty"`

	// InboundNatRules: Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load
	// balancer is mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are referenced from virtual machine
	// scale sets. NICs that are associated with individual virtual machines cannot reference an Inbound NAT pool. They have to
	// reference individual inbound NAT rules.
	InboundNatRules []InboundNatRule_LoadBalancer_SubResourceEmbedded `json:"inboundNatRules,omitempty"`

	// LoadBalancingRules: Object collection representing the load balancing rules Gets the provisioning.
	LoadBalancingRules []LoadBalancingRule `json:"loadBalancingRules,omitempty"`

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

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

	// OutboundRules: The outbound rules.
	OutboundRules []OutboundRule `json:"outboundRules,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"`

	// Probes: Collection of probe objects used in the load balancer.
	Probes []Probe `json:"probes,omitempty"`

	// Sku: The load balancer SKU.
	Sku *LoadBalancerSku `json:"sku,omitempty"`

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

var _ genruntime.ARMTransformer = &LoadBalancer_Spec{}

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

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

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

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

	// Set property "Properties":
	if balancer.BackendAddressPools != nil ||
		balancer.FrontendIPConfigurations != nil ||
		balancer.InboundNatPools != nil ||
		balancer.InboundNatRules != nil ||
		balancer.LoadBalancingRules != nil ||
		balancer.OutboundRules != nil ||
		balancer.Probes != nil {
		result.Properties = &arm.LoadBalancerPropertiesFormat{}
	}
	for _, item := range balancer.BackendAddressPools {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.BackendAddressPools = append(result.Properties.BackendAddressPools, *item_ARM.(*arm.BackendAddressPool_LoadBalancer_SubResourceEmbedded))
	}
	for _, item := range balancer.FrontendIPConfigurations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.FrontendIPConfigurations = append(result.Properties.FrontendIPConfigurations, *item_ARM.(*arm.FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded))
	}
	for _, item := range balancer.InboundNatPools {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.InboundNatPools = append(result.Properties.InboundNatPools, *item_ARM.(*arm.InboundNatPool))
	}
	for _, item := range balancer.InboundNatRules {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.InboundNatRules = append(result.Properties.InboundNatRules, *item_ARM.(*arm.InboundNatRule_LoadBalancer_SubResourceEmbedded))
	}
	for _, item := range balancer.LoadBalancingRules {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.LoadBalancingRules = append(result.Properties.LoadBalancingRules, *item_ARM.(*arm.LoadBalancingRule))
	}
	for _, item := range balancer.OutboundRules {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.OutboundRules = append(result.Properties.OutboundRules, *item_ARM.(*arm.OutboundRule))
	}
	for _, item := range balancer.Probes {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.Probes = append(result.Properties.Probes, *item_ARM.(*arm.Probe))
	}

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

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

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

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

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

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

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

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

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

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

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

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

	// no assignment for property "OperatorSpec"

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

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

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

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &LoadBalancer_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.LoadBalancer_Spec{}
	err := balancer.AssignProperties_To_LoadBalancer_Spec(dst)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertSpecTo()")
	}

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

	return nil
}

// AssignProperties_From_LoadBalancer_Spec populates our LoadBalancer_Spec from the provided source LoadBalancer_Spec
func (balancer *LoadBalancer_Spec) AssignProperties_From_LoadBalancer_Spec(source *storage.LoadBalancer_Spec) error {

	// AzureName
	balancer.AzureName = source.AzureName

	// BackendAddressPools
	if source.BackendAddressPools != nil {
		backendAddressPoolList := make([]BackendAddressPool_LoadBalancer_SubResourceEmbedded, len(source.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range source.BackendAddressPools {
			var backendAddressPool BackendAddressPool_LoadBalancer_SubResourceEmbedded
			err := backendAddressPool.AssignProperties_From_BackendAddressPool_LoadBalancer_SubResourceEmbedded(&backendAddressPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_BackendAddressPool_LoadBalancer_SubResourceEmbedded() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		balancer.BackendAddressPools = backendAddressPoolList
	} else {
		balancer.BackendAddressPools = nil
	}

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

	// FrontendIPConfigurations
	if source.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded, len(source.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range source.FrontendIPConfigurations {
			var frontendIPConfiguration FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded
			err := frontendIPConfiguration.AssignProperties_From_FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded(&frontendIPConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		balancer.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		balancer.FrontendIPConfigurations = nil
	}

	// InboundNatPools
	if source.InboundNatPools != nil {
		inboundNatPoolList := make([]InboundNatPool, len(source.InboundNatPools))
		for inboundNatPoolIndex, inboundNatPoolItem := range source.InboundNatPools {
			var inboundNatPool InboundNatPool
			err := inboundNatPool.AssignProperties_From_InboundNatPool(&inboundNatPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_InboundNatPool() to populate field InboundNatPools")
			}
			inboundNatPoolList[inboundNatPoolIndex] = inboundNatPool
		}
		balancer.InboundNatPools = inboundNatPoolList
	} else {
		balancer.InboundNatPools = nil
	}

	// InboundNatRules
	if source.InboundNatRules != nil {
		inboundNatRuleList := make([]InboundNatRule_LoadBalancer_SubResourceEmbedded, len(source.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range source.InboundNatRules {
			var inboundNatRule InboundNatRule_LoadBalancer_SubResourceEmbedded
			err := inboundNatRule.AssignProperties_From_InboundNatRule_LoadBalancer_SubResourceEmbedded(&inboundNatRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_InboundNatRule_LoadBalancer_SubResourceEmbedded() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		balancer.InboundNatRules = inboundNatRuleList
	} else {
		balancer.InboundNatRules = nil
	}

	// LoadBalancingRules
	if source.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]LoadBalancingRule, len(source.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range source.LoadBalancingRules {
			var loadBalancingRule LoadBalancingRule
			err := loadBalancingRule.AssignProperties_From_LoadBalancingRule(&loadBalancingRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_LoadBalancingRule() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		balancer.LoadBalancingRules = loadBalancingRuleList
	} else {
		balancer.LoadBalancingRules = nil
	}

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

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

	// OutboundRules
	if source.OutboundRules != nil {
		outboundRuleList := make([]OutboundRule, len(source.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range source.OutboundRules {
			var outboundRule OutboundRule
			err := outboundRule.AssignProperties_From_OutboundRule(&outboundRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_OutboundRule() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		balancer.OutboundRules = outboundRuleList
	} else {
		balancer.OutboundRules = nil
	}

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

	// Probes
	if source.Probes != nil {
		probeList := make([]Probe, len(source.Probes))
		for probeIndex, probeItem := range source.Probes {
			var probe Probe
			err := probe.AssignProperties_From_Probe(&probeItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Probe() to populate field Probes")
			}
			probeList[probeIndex] = probe
		}
		balancer.Probes = probeList
	} else {
		balancer.Probes = nil
	}

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

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

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = balancer.AzureName

	// BackendAddressPools
	if balancer.BackendAddressPools != nil {
		backendAddressPoolList := make([]storage.BackendAddressPool_LoadBalancer_SubResourceEmbedded, len(balancer.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range balancer.BackendAddressPools {
			var backendAddressPool storage.BackendAddressPool_LoadBalancer_SubResourceEmbedded
			err := backendAddressPoolItem.AssignProperties_To_BackendAddressPool_LoadBalancer_SubResourceEmbedded(&backendAddressPool)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_BackendAddressPool_LoadBalancer_SubResourceEmbedded() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		destination.BackendAddressPools = backendAddressPoolList
	} else {
		destination.BackendAddressPools = nil
	}

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

	// FrontendIPConfigurations
	if balancer.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]storage.FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded, len(balancer.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range balancer.FrontendIPConfigurations {
			var frontendIPConfiguration storage.FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded
			err := frontendIPConfigurationItem.AssignProperties_To_FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded(&frontendIPConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		destination.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		destination.FrontendIPConfigurations = nil
	}

	// InboundNatPools
	if balancer.InboundNatPools != nil {
		inboundNatPoolList := make([]storage.InboundNatPool, len(balancer.InboundNatPools))
		for inboundNatPoolIndex, inboundNatPoolItem := range balancer.InboundNatPools {
			var inboundNatPool storage.InboundNatPool
			err := inboundNatPoolItem.AssignProperties_To_InboundNatPool(&inboundNatPool)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_InboundNatPool() to populate field InboundNatPools")
			}
			inboundNatPoolList[inboundNatPoolIndex] = inboundNatPool
		}
		destination.InboundNatPools = inboundNatPoolList
	} else {
		destination.InboundNatPools = nil
	}

	// InboundNatRules
	if balancer.InboundNatRules != nil {
		inboundNatRuleList := make([]storage.InboundNatRule_LoadBalancer_SubResourceEmbedded, len(balancer.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range balancer.InboundNatRules {
			var inboundNatRule storage.InboundNatRule_LoadBalancer_SubResourceEmbedded
			err := inboundNatRuleItem.AssignProperties_To_InboundNatRule_LoadBalancer_SubResourceEmbedded(&inboundNatRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_InboundNatRule_LoadBalancer_SubResourceEmbedded() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		destination.InboundNatRules = inboundNatRuleList
	} else {
		destination.InboundNatRules = nil
	}

	// LoadBalancingRules
	if balancer.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]storage.LoadBalancingRule, len(balancer.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range balancer.LoadBalancingRules {
			var loadBalancingRule storage.LoadBalancingRule
			err := loadBalancingRuleItem.AssignProperties_To_LoadBalancingRule(&loadBalancingRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_LoadBalancingRule() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		destination.LoadBalancingRules = loadBalancingRuleList
	} else {
		destination.LoadBalancingRules = nil
	}

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

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

	// OriginalVersion
	destination.OriginalVersion = balancer.OriginalVersion()

	// OutboundRules
	if balancer.OutboundRules != nil {
		outboundRuleList := make([]storage.OutboundRule, len(balancer.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range balancer.OutboundRules {
			var outboundRule storage.OutboundRule
			err := outboundRuleItem.AssignProperties_To_OutboundRule(&outboundRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_OutboundRule() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		destination.OutboundRules = outboundRuleList
	} else {
		destination.OutboundRules = nil
	}

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

	// Probes
	if balancer.Probes != nil {
		probeList := make([]storage.Probe, len(balancer.Probes))
		for probeIndex, probeItem := range balancer.Probes {
			var probe storage.Probe
			err := probeItem.AssignProperties_To_Probe(&probe)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Probe() to populate field Probes")
			}
			probeList[probeIndex] = probe
		}
		destination.Probes = probeList
	} else {
		destination.Probes = nil
	}

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

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

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

	// No error
	return nil
}

// Initialize_From_LoadBalancer_STATUS populates our LoadBalancer_Spec from the provided source LoadBalancer_STATUS
func (balancer *LoadBalancer_Spec) Initialize_From_LoadBalancer_STATUS(source *LoadBalancer_STATUS) error {

	// BackendAddressPools
	if source.BackendAddressPools != nil {
		backendAddressPoolList := make([]BackendAddressPool_LoadBalancer_SubResourceEmbedded, len(source.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range source.BackendAddressPools {
			var backendAddressPool BackendAddressPool_LoadBalancer_SubResourceEmbedded
			err := backendAddressPool.Initialize_From_BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded(&backendAddressPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		balancer.BackendAddressPools = backendAddressPoolList
	} else {
		balancer.BackendAddressPools = nil
	}

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

	// FrontendIPConfigurations
	if source.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded, len(source.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range source.FrontendIPConfigurations {
			var frontendIPConfiguration FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded
			err := frontendIPConfiguration.Initialize_From_FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(&frontendIPConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		balancer.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		balancer.FrontendIPConfigurations = nil
	}

	// InboundNatPools
	if source.InboundNatPools != nil {
		inboundNatPoolList := make([]InboundNatPool, len(source.InboundNatPools))
		for inboundNatPoolIndex, inboundNatPoolItem := range source.InboundNatPools {
			var inboundNatPool InboundNatPool
			err := inboundNatPool.Initialize_From_InboundNatPool_STATUS(&inboundNatPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_InboundNatPool_STATUS() to populate field InboundNatPools")
			}
			inboundNatPoolList[inboundNatPoolIndex] = inboundNatPool
		}
		balancer.InboundNatPools = inboundNatPoolList
	} else {
		balancer.InboundNatPools = nil
	}

	// InboundNatRules
	if source.InboundNatRules != nil {
		inboundNatRuleList := make([]InboundNatRule_LoadBalancer_SubResourceEmbedded, len(source.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range source.InboundNatRules {
			var inboundNatRule InboundNatRule_LoadBalancer_SubResourceEmbedded
			err := inboundNatRule.Initialize_From_InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded(&inboundNatRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		balancer.InboundNatRules = inboundNatRuleList
	} else {
		balancer.InboundNatRules = nil
	}

	// LoadBalancingRules
	if source.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]LoadBalancingRule, len(source.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range source.LoadBalancingRules {
			var loadBalancingRule LoadBalancingRule
			err := loadBalancingRule.Initialize_From_LoadBalancingRule_STATUS(&loadBalancingRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_LoadBalancingRule_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		balancer.LoadBalancingRules = loadBalancingRuleList
	} else {
		balancer.LoadBalancingRules = nil
	}

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

	// OutboundRules
	if source.OutboundRules != nil {
		outboundRuleList := make([]OutboundRule, len(source.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range source.OutboundRules {
			var outboundRule OutboundRule
			err := outboundRule.Initialize_From_OutboundRule_STATUS(&outboundRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_OutboundRule_STATUS() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		balancer.OutboundRules = outboundRuleList
	} else {
		balancer.OutboundRules = nil
	}

	// Probes
	if source.Probes != nil {
		probeList := make([]Probe, len(source.Probes))
		for probeIndex, probeItem := range source.Probes {
			var probe Probe
			err := probe.Initialize_From_Probe_STATUS(&probeItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_Probe_STATUS() to populate field Probes")
			}
			probeList[probeIndex] = probe
		}
		balancer.Probes = probeList
	} else {
		balancer.Probes = nil
	}

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

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

	// No error
	return nil
}

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

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

// LoadBalancer resource.
type LoadBalancer_STATUS struct {
	// BackendAddressPools: Collection of backend address pools used by a load balancer.
	BackendAddressPools []BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded `json:"backendAddressPools,omitempty"`

	// Conditions: The observed state of the resource
	Conditions []conditions.Condition `json:"conditions,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"`

	// FrontendIPConfigurations: Object representing the frontend IPs to be used for the load balancer.
	FrontendIPConfigurations []FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded `json:"frontendIPConfigurations,omitempty"`

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

	// InboundNatPools: Defines an external port range for inbound NAT to a single backend port on NICs associated with a load
	// balancer. Inbound NAT rules are created automatically for each NIC associated with the Load Balancer using an external
	// port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound NAT
	// rules. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual
	// virtual machines cannot reference an inbound NAT pool. They have to reference individual inbound NAT rules.
	InboundNatPools []InboundNatPool_STATUS `json:"inboundNatPools,omitempty"`

	// InboundNatRules: Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load
	// balancer is mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are referenced from virtual machine
	// scale sets. NICs that are associated with individual virtual machines cannot reference an Inbound NAT pool. They have to
	// reference individual inbound NAT rules.
	InboundNatRules []InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded `json:"inboundNatRules,omitempty"`

	// LoadBalancingRules: Object collection representing the load balancing rules Gets the provisioning.
	LoadBalancingRules []LoadBalancingRule_STATUS `json:"loadBalancingRules,omitempty"`

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

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

	// OutboundRules: The outbound rules.
	OutboundRules []OutboundRule_STATUS `json:"outboundRules,omitempty"`

	// Probes: Collection of probe objects used in the load balancer.
	Probes []Probe_STATUS `json:"probes,omitempty"`

	// ProvisioningState: The provisioning state of the load balancer resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// ResourceGuid: The resource GUID property of the load balancer resource.
	ResourceGuid *string `json:"resourceGuid,omitempty"`

	// Sku: The load balancer SKU.
	Sku *LoadBalancerSku_STATUS `json:"sku,omitempty"`

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

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

var _ genruntime.ConvertibleStatus = &LoadBalancer_STATUS{}

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

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

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

	return nil
}

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

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

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

	return nil
}

var _ genruntime.FromARMConverter = &LoadBalancer_STATUS{}

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

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

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

	// no assignment for property "Conditions"

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

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

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

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

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

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

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

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

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

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

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

	// Set property "ResourceGuid":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ResourceGuid != nil {
			resourceGuid := *typedInput.Properties.ResourceGuid
			balancer.ResourceGuid = &resourceGuid
		}
	}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_LoadBalancer_STATUS populates our LoadBalancer_STATUS from the provided source LoadBalancer_STATUS
func (balancer *LoadBalancer_STATUS) AssignProperties_From_LoadBalancer_STATUS(source *storage.LoadBalancer_STATUS) error {

	// BackendAddressPools
	if source.BackendAddressPools != nil {
		backendAddressPoolList := make([]BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded, len(source.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range source.BackendAddressPools {
			var backendAddressPool BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded
			err := backendAddressPool.AssignProperties_From_BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded(&backendAddressPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		balancer.BackendAddressPools = backendAddressPoolList
	} else {
		balancer.BackendAddressPools = nil
	}

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

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

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

	// FrontendIPConfigurations
	if source.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded, len(source.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range source.FrontendIPConfigurations {
			var frontendIPConfiguration FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
			err := frontendIPConfiguration.AssignProperties_From_FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(&frontendIPConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		balancer.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		balancer.FrontendIPConfigurations = nil
	}

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

	// InboundNatPools
	if source.InboundNatPools != nil {
		inboundNatPoolList := make([]InboundNatPool_STATUS, len(source.InboundNatPools))
		for inboundNatPoolIndex, inboundNatPoolItem := range source.InboundNatPools {
			var inboundNatPool InboundNatPool_STATUS
			err := inboundNatPool.AssignProperties_From_InboundNatPool_STATUS(&inboundNatPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_InboundNatPool_STATUS() to populate field InboundNatPools")
			}
			inboundNatPoolList[inboundNatPoolIndex] = inboundNatPool
		}
		balancer.InboundNatPools = inboundNatPoolList
	} else {
		balancer.InboundNatPools = nil
	}

	// InboundNatRules
	if source.InboundNatRules != nil {
		inboundNatRuleList := make([]InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded, len(source.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range source.InboundNatRules {
			var inboundNatRule InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded
			err := inboundNatRule.AssignProperties_From_InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded(&inboundNatRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		balancer.InboundNatRules = inboundNatRuleList
	} else {
		balancer.InboundNatRules = nil
	}

	// LoadBalancingRules
	if source.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]LoadBalancingRule_STATUS, len(source.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range source.LoadBalancingRules {
			var loadBalancingRule LoadBalancingRule_STATUS
			err := loadBalancingRule.AssignProperties_From_LoadBalancingRule_STATUS(&loadBalancingRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_LoadBalancingRule_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		balancer.LoadBalancingRules = loadBalancingRuleList
	} else {
		balancer.LoadBalancingRules = nil
	}

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

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

	// OutboundRules
	if source.OutboundRules != nil {
		outboundRuleList := make([]OutboundRule_STATUS, len(source.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range source.OutboundRules {
			var outboundRule OutboundRule_STATUS
			err := outboundRule.AssignProperties_From_OutboundRule_STATUS(&outboundRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_OutboundRule_STATUS() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		balancer.OutboundRules = outboundRuleList
	} else {
		balancer.OutboundRules = nil
	}

	// Probes
	if source.Probes != nil {
		probeList := make([]Probe_STATUS, len(source.Probes))
		for probeIndex, probeItem := range source.Probes {
			var probe Probe_STATUS
			err := probe.AssignProperties_From_Probe_STATUS(&probeItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Probe_STATUS() to populate field Probes")
			}
			probeList[probeIndex] = probe
		}
		balancer.Probes = probeList
	} else {
		balancer.Probes = nil
	}

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

	// ResourceGuid
	balancer.ResourceGuid = genruntime.ClonePointerToString(source.ResourceGuid)

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

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

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

	// No error
	return nil
}

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

	// BackendAddressPools
	if balancer.BackendAddressPools != nil {
		backendAddressPoolList := make([]storage.BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded, len(balancer.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range balancer.BackendAddressPools {
			var backendAddressPool storage.BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded
			err := backendAddressPoolItem.AssignProperties_To_BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded(&backendAddressPool)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		destination.BackendAddressPools = backendAddressPoolList
	} else {
		destination.BackendAddressPools = nil
	}

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

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

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

	// FrontendIPConfigurations
	if balancer.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]storage.FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded, len(balancer.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range balancer.FrontendIPConfigurations {
			var frontendIPConfiguration storage.FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
			err := frontendIPConfigurationItem.AssignProperties_To_FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(&frontendIPConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		destination.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		destination.FrontendIPConfigurations = nil
	}

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

	// InboundNatPools
	if balancer.InboundNatPools != nil {
		inboundNatPoolList := make([]storage.InboundNatPool_STATUS, len(balancer.InboundNatPools))
		for inboundNatPoolIndex, inboundNatPoolItem := range balancer.InboundNatPools {
			var inboundNatPool storage.InboundNatPool_STATUS
			err := inboundNatPoolItem.AssignProperties_To_InboundNatPool_STATUS(&inboundNatPool)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_InboundNatPool_STATUS() to populate field InboundNatPools")
			}
			inboundNatPoolList[inboundNatPoolIndex] = inboundNatPool
		}
		destination.InboundNatPools = inboundNatPoolList
	} else {
		destination.InboundNatPools = nil
	}

	// InboundNatRules
	if balancer.InboundNatRules != nil {
		inboundNatRuleList := make([]storage.InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded, len(balancer.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range balancer.InboundNatRules {
			var inboundNatRule storage.InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded
			err := inboundNatRuleItem.AssignProperties_To_InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded(&inboundNatRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		destination.InboundNatRules = inboundNatRuleList
	} else {
		destination.InboundNatRules = nil
	}

	// LoadBalancingRules
	if balancer.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]storage.LoadBalancingRule_STATUS, len(balancer.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range balancer.LoadBalancingRules {
			var loadBalancingRule storage.LoadBalancingRule_STATUS
			err := loadBalancingRuleItem.AssignProperties_To_LoadBalancingRule_STATUS(&loadBalancingRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_LoadBalancingRule_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		destination.LoadBalancingRules = loadBalancingRuleList
	} else {
		destination.LoadBalancingRules = nil
	}

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

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

	// OutboundRules
	if balancer.OutboundRules != nil {
		outboundRuleList := make([]storage.OutboundRule_STATUS, len(balancer.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range balancer.OutboundRules {
			var outboundRule storage.OutboundRule_STATUS
			err := outboundRuleItem.AssignProperties_To_OutboundRule_STATUS(&outboundRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_OutboundRule_STATUS() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		destination.OutboundRules = outboundRuleList
	} else {
		destination.OutboundRules = nil
	}

	// Probes
	if balancer.Probes != nil {
		probeList := make([]storage.Probe_STATUS, len(balancer.Probes))
		for probeIndex, probeItem := range balancer.Probes {
			var probe storage.Probe_STATUS
			err := probeItem.AssignProperties_To_Probe_STATUS(&probe)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Probe_STATUS() to populate field Probes")
			}
			probeList[probeIndex] = probe
		}
		destination.Probes = probeList
	} else {
		destination.Probes = nil
	}

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

	// ResourceGuid
	destination.ResourceGuid = genruntime.ClonePointerToString(balancer.ResourceGuid)

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

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

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

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

	// No error
	return nil
}

// Pool of backend IP addresses.
type BackendAddressPool_LoadBalancer_SubResourceEmbedded struct {
	// DrainPeriodInSeconds: Amount of seconds Load Balancer waits for before sending RESET to client and backend address.
	DrainPeriodInSeconds *int `json:"drainPeriodInSeconds,omitempty"`

	// LoadBalancerBackendAddresses: An array of backend addresses.
	LoadBalancerBackendAddresses []LoadBalancerBackendAddress `json:"loadBalancerBackendAddresses,omitempty"`

	// Location: The location of the backend address pool.
	Location *string `json:"location,omitempty"`

	// Name: The name of the resource that is unique within the set of backend address pools used by the load balancer. This
	// name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// SyncMode: Backend address synchronous mode for the backend pool
	SyncMode *BackendAddressPoolPropertiesFormat_SyncMode `json:"syncMode,omitempty"`

	// TunnelInterfaces: An array of gateway load balancer tunnel interfaces.
	TunnelInterfaces []GatewayLoadBalancerTunnelInterface `json:"tunnelInterfaces,omitempty"`

	// VirtualNetwork: A reference to a virtual network.
	VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"`
}

var _ genruntime.ARMTransformer = &BackendAddressPool_LoadBalancer_SubResourceEmbedded{}

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

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

	// Set property "Properties":
	if embedded.DrainPeriodInSeconds != nil ||
		embedded.LoadBalancerBackendAddresses != nil ||
		embedded.Location != nil ||
		embedded.SyncMode != nil ||
		embedded.TunnelInterfaces != nil ||
		embedded.VirtualNetwork != nil {
		result.Properties = &arm.BackendAddressPoolPropertiesFormat{}
	}
	if embedded.DrainPeriodInSeconds != nil {
		drainPeriodInSeconds := *embedded.DrainPeriodInSeconds
		result.Properties.DrainPeriodInSeconds = &drainPeriodInSeconds
	}
	for _, item := range embedded.LoadBalancerBackendAddresses {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.LoadBalancerBackendAddresses = append(result.Properties.LoadBalancerBackendAddresses, *item_ARM.(*arm.LoadBalancerBackendAddress))
	}
	if embedded.Location != nil {
		location := *embedded.Location
		result.Properties.Location = &location
	}
	if embedded.SyncMode != nil {
		var temp string
		temp = string(*embedded.SyncMode)
		syncMode := arm.BackendAddressPoolPropertiesFormat_SyncMode(temp)
		result.Properties.SyncMode = &syncMode
	}
	for _, item := range embedded.TunnelInterfaces {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.TunnelInterfaces = append(result.Properties.TunnelInterfaces, *item_ARM.(*arm.GatewayLoadBalancerTunnelInterface))
	}
	if embedded.VirtualNetwork != nil {
		virtualNetwork_ARM, err := embedded.VirtualNetwork.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		virtualNetwork := *virtualNetwork_ARM.(*arm.SubResource)
		result.Properties.VirtualNetwork = &virtualNetwork
	}
	return result, nil
}

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

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

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

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

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

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

	// Set property "SyncMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SyncMode != nil {
			var temp string
			temp = string(*typedInput.Properties.SyncMode)
			syncMode := BackendAddressPoolPropertiesFormat_SyncMode(temp)
			embedded.SyncMode = &syncMode
		}
	}

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

	// Set property "VirtualNetwork":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.VirtualNetwork != nil {
			var virtualNetwork1 SubResource
			err := virtualNetwork1.PopulateFromARM(owner, *typedInput.Properties.VirtualNetwork)
			if err != nil {
				return err
			}
			virtualNetwork := virtualNetwork1
			embedded.VirtualNetwork = &virtualNetwork
		}
	}

	// No error
	return nil
}

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

	// DrainPeriodInSeconds
	embedded.DrainPeriodInSeconds = genruntime.ClonePointerToInt(source.DrainPeriodInSeconds)

	// LoadBalancerBackendAddresses
	if source.LoadBalancerBackendAddresses != nil {
		loadBalancerBackendAddressList := make([]LoadBalancerBackendAddress, len(source.LoadBalancerBackendAddresses))
		for loadBalancerBackendAddressIndex, loadBalancerBackendAddressItem := range source.LoadBalancerBackendAddresses {
			var loadBalancerBackendAddress LoadBalancerBackendAddress
			err := loadBalancerBackendAddress.AssignProperties_From_LoadBalancerBackendAddress(&loadBalancerBackendAddressItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_LoadBalancerBackendAddress() to populate field LoadBalancerBackendAddresses")
			}
			loadBalancerBackendAddressList[loadBalancerBackendAddressIndex] = loadBalancerBackendAddress
		}
		embedded.LoadBalancerBackendAddresses = loadBalancerBackendAddressList
	} else {
		embedded.LoadBalancerBackendAddresses = nil
	}

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

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

	// SyncMode
	if source.SyncMode != nil {
		syncMode := *source.SyncMode
		syncModeTemp := genruntime.ToEnum(syncMode, backendAddressPoolPropertiesFormat_SyncMode_Values)
		embedded.SyncMode = &syncModeTemp
	} else {
		embedded.SyncMode = nil
	}

	// TunnelInterfaces
	if source.TunnelInterfaces != nil {
		tunnelInterfaceList := make([]GatewayLoadBalancerTunnelInterface, len(source.TunnelInterfaces))
		for tunnelInterfaceIndex, tunnelInterfaceItem := range source.TunnelInterfaces {
			var tunnelInterface GatewayLoadBalancerTunnelInterface
			err := tunnelInterface.AssignProperties_From_GatewayLoadBalancerTunnelInterface(&tunnelInterfaceItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_GatewayLoadBalancerTunnelInterface() to populate field TunnelInterfaces")
			}
			tunnelInterfaceList[tunnelInterfaceIndex] = tunnelInterface
		}
		embedded.TunnelInterfaces = tunnelInterfaceList
	} else {
		embedded.TunnelInterfaces = nil
	}

	// VirtualNetwork
	if source.VirtualNetwork != nil {
		var virtualNetwork SubResource
		err := virtualNetwork.AssignProperties_From_SubResource(source.VirtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field VirtualNetwork")
		}
		embedded.VirtualNetwork = &virtualNetwork
	} else {
		embedded.VirtualNetwork = nil
	}

	// No error
	return nil
}

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

	// DrainPeriodInSeconds
	destination.DrainPeriodInSeconds = genruntime.ClonePointerToInt(embedded.DrainPeriodInSeconds)

	// LoadBalancerBackendAddresses
	if embedded.LoadBalancerBackendAddresses != nil {
		loadBalancerBackendAddressList := make([]storage.LoadBalancerBackendAddress, len(embedded.LoadBalancerBackendAddresses))
		for loadBalancerBackendAddressIndex, loadBalancerBackendAddressItem := range embedded.LoadBalancerBackendAddresses {
			var loadBalancerBackendAddress storage.LoadBalancerBackendAddress
			err := loadBalancerBackendAddressItem.AssignProperties_To_LoadBalancerBackendAddress(&loadBalancerBackendAddress)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_LoadBalancerBackendAddress() to populate field LoadBalancerBackendAddresses")
			}
			loadBalancerBackendAddressList[loadBalancerBackendAddressIndex] = loadBalancerBackendAddress
		}
		destination.LoadBalancerBackendAddresses = loadBalancerBackendAddressList
	} else {
		destination.LoadBalancerBackendAddresses = nil
	}

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

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

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

	// TunnelInterfaces
	if embedded.TunnelInterfaces != nil {
		tunnelInterfaceList := make([]storage.GatewayLoadBalancerTunnelInterface, len(embedded.TunnelInterfaces))
		for tunnelInterfaceIndex, tunnelInterfaceItem := range embedded.TunnelInterfaces {
			var tunnelInterface storage.GatewayLoadBalancerTunnelInterface
			err := tunnelInterfaceItem.AssignProperties_To_GatewayLoadBalancerTunnelInterface(&tunnelInterface)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_GatewayLoadBalancerTunnelInterface() to populate field TunnelInterfaces")
			}
			tunnelInterfaceList[tunnelInterfaceIndex] = tunnelInterface
		}
		destination.TunnelInterfaces = tunnelInterfaceList
	} else {
		destination.TunnelInterfaces = nil
	}

	// VirtualNetwork
	if embedded.VirtualNetwork != nil {
		var virtualNetwork storage.SubResource
		err := embedded.VirtualNetwork.AssignProperties_To_SubResource(&virtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field VirtualNetwork")
		}
		destination.VirtualNetwork = &virtualNetwork
	} else {
		destination.VirtualNetwork = nil
	}

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

	// No error
	return nil
}

// Initialize_From_BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded populates our BackendAddressPool_LoadBalancer_SubResourceEmbedded from the provided source BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded
func (embedded *BackendAddressPool_LoadBalancer_SubResourceEmbedded) Initialize_From_BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded(source *BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded) error {

	// DrainPeriodInSeconds
	embedded.DrainPeriodInSeconds = genruntime.ClonePointerToInt(source.DrainPeriodInSeconds)

	// LoadBalancerBackendAddresses
	if source.LoadBalancerBackendAddresses != nil {
		loadBalancerBackendAddressList := make([]LoadBalancerBackendAddress, len(source.LoadBalancerBackendAddresses))
		for loadBalancerBackendAddressIndex, loadBalancerBackendAddressItem := range source.LoadBalancerBackendAddresses {
			var loadBalancerBackendAddress LoadBalancerBackendAddress
			err := loadBalancerBackendAddress.Initialize_From_LoadBalancerBackendAddress_STATUS(&loadBalancerBackendAddressItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_LoadBalancerBackendAddress_STATUS() to populate field LoadBalancerBackendAddresses")
			}
			loadBalancerBackendAddressList[loadBalancerBackendAddressIndex] = loadBalancerBackendAddress
		}
		embedded.LoadBalancerBackendAddresses = loadBalancerBackendAddressList
	} else {
		embedded.LoadBalancerBackendAddresses = nil
	}

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

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

	// SyncMode
	if source.SyncMode != nil {
		syncMode := genruntime.ToEnum(string(*source.SyncMode), backendAddressPoolPropertiesFormat_SyncMode_Values)
		embedded.SyncMode = &syncMode
	} else {
		embedded.SyncMode = nil
	}

	// TunnelInterfaces
	if source.TunnelInterfaces != nil {
		tunnelInterfaceList := make([]GatewayLoadBalancerTunnelInterface, len(source.TunnelInterfaces))
		for tunnelInterfaceIndex, tunnelInterfaceItem := range source.TunnelInterfaces {
			var tunnelInterface GatewayLoadBalancerTunnelInterface
			err := tunnelInterface.Initialize_From_GatewayLoadBalancerTunnelInterface_STATUS(&tunnelInterfaceItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_GatewayLoadBalancerTunnelInterface_STATUS() to populate field TunnelInterfaces")
			}
			tunnelInterfaceList[tunnelInterfaceIndex] = tunnelInterface
		}
		embedded.TunnelInterfaces = tunnelInterfaceList
	} else {
		embedded.TunnelInterfaces = nil
	}

	// VirtualNetwork
	if source.VirtualNetwork != nil {
		var virtualNetwork SubResource
		err := virtualNetwork.Initialize_From_SubResource_STATUS(source.VirtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field VirtualNetwork")
		}
		embedded.VirtualNetwork = &virtualNetwork
	} else {
		embedded.VirtualNetwork = nil
	}

	// No error
	return nil
}

// Pool of backend IP addresses.
type BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded struct {
	// BackendIPConfigurations: An array of references to IP addresses defined in network interfaces.
	BackendIPConfigurations []NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded `json:"backendIPConfigurations,omitempty"`

	// DrainPeriodInSeconds: Amount of seconds Load Balancer waits for before sending RESET to client and backend address.
	DrainPeriodInSeconds *int `json:"drainPeriodInSeconds,omitempty"`

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

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

	// InboundNatRules: An array of references to inbound NAT rules that use this backend address pool.
	InboundNatRules []SubResource_STATUS `json:"inboundNatRules,omitempty"`

	// LoadBalancerBackendAddresses: An array of backend addresses.
	LoadBalancerBackendAddresses []LoadBalancerBackendAddress_STATUS `json:"loadBalancerBackendAddresses,omitempty"`

	// LoadBalancingRules: An array of references to load balancing rules that use this backend address pool.
	LoadBalancingRules []SubResource_STATUS `json:"loadBalancingRules,omitempty"`

	// Location: The location of the backend address pool.
	Location *string `json:"location,omitempty"`

	// Name: The name of the resource that is unique within the set of backend address pools used by the load balancer. This
	// name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// OutboundRule: A reference to an outbound rule that uses this backend address pool.
	OutboundRule *SubResource_STATUS `json:"outboundRule,omitempty"`

	// OutboundRules: An array of references to outbound rules that use this backend address pool.
	OutboundRules []SubResource_STATUS `json:"outboundRules,omitempty"`

	// ProvisioningState: The provisioning state of the backend address pool resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// SyncMode: Backend address synchronous mode for the backend pool
	SyncMode *BackendAddressPoolPropertiesFormat_SyncMode_STATUS `json:"syncMode,omitempty"`

	// TunnelInterfaces: An array of gateway load balancer tunnel interfaces.
	TunnelInterfaces []GatewayLoadBalancerTunnelInterface_STATUS `json:"tunnelInterfaces,omitempty"`

	// Type: Type of the resource.
	Type *string `json:"type,omitempty"`

	// VirtualNetwork: A reference to a virtual network.
	VirtualNetwork *SubResource_STATUS `json:"virtualNetwork,omitempty"`
}

var _ genruntime.FromARMConverter = &BackendAddressPool_STATUS_LoadBalancer_SubResourceEmbedded{}

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

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

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

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

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

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

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

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

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

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

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

	// Set property "OutboundRule":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OutboundRule != nil {
			var outboundRule1 SubResource_STATUS
			err := outboundRule1.PopulateFromARM(owner, *typedInput.Properties.OutboundRule)
			if err != nil {
				return err
			}
			outboundRule := outboundRule1
			embedded.OutboundRule = &outboundRule
		}
	}

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

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

	// Set property "SyncMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SyncMode != nil {
			var temp string
			temp = string(*typedInput.Properties.SyncMode)
			syncMode := BackendAddressPoolPropertiesFormat_SyncMode_STATUS(temp)
			embedded.SyncMode = &syncMode
		}
	}

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

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

	// Set property "VirtualNetwork":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.VirtualNetwork != nil {
			var virtualNetwork1 SubResource_STATUS
			err := virtualNetwork1.PopulateFromARM(owner, *typedInput.Properties.VirtualNetwork)
			if err != nil {
				return err
			}
			virtualNetwork := virtualNetwork1
			embedded.VirtualNetwork = &virtualNetwork
		}
	}

	// No error
	return nil
}

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

	// BackendIPConfigurations
	if source.BackendIPConfigurations != nil {
		backendIPConfigurationList := make([]NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded, len(source.BackendIPConfigurations))
		for backendIPConfigurationIndex, backendIPConfigurationItem := range source.BackendIPConfigurations {
			var backendIPConfiguration NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
			err := backendIPConfiguration.AssignProperties_From_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(&backendIPConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded() to populate field BackendIPConfigurations")
			}
			backendIPConfigurationList[backendIPConfigurationIndex] = backendIPConfiguration
		}
		embedded.BackendIPConfigurations = backendIPConfigurationList
	} else {
		embedded.BackendIPConfigurations = nil
	}

	// DrainPeriodInSeconds
	embedded.DrainPeriodInSeconds = genruntime.ClonePointerToInt(source.DrainPeriodInSeconds)

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

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

	// InboundNatRules
	if source.InboundNatRules != nil {
		inboundNatRuleList := make([]SubResource_STATUS, len(source.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range source.InboundNatRules {
			var inboundNatRule SubResource_STATUS
			err := inboundNatRule.AssignProperties_From_SubResource_STATUS(&inboundNatRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		embedded.InboundNatRules = inboundNatRuleList
	} else {
		embedded.InboundNatRules = nil
	}

	// LoadBalancerBackendAddresses
	if source.LoadBalancerBackendAddresses != nil {
		loadBalancerBackendAddressList := make([]LoadBalancerBackendAddress_STATUS, len(source.LoadBalancerBackendAddresses))
		for loadBalancerBackendAddressIndex, loadBalancerBackendAddressItem := range source.LoadBalancerBackendAddresses {
			var loadBalancerBackendAddress LoadBalancerBackendAddress_STATUS
			err := loadBalancerBackendAddress.AssignProperties_From_LoadBalancerBackendAddress_STATUS(&loadBalancerBackendAddressItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_LoadBalancerBackendAddress_STATUS() to populate field LoadBalancerBackendAddresses")
			}
			loadBalancerBackendAddressList[loadBalancerBackendAddressIndex] = loadBalancerBackendAddress
		}
		embedded.LoadBalancerBackendAddresses = loadBalancerBackendAddressList
	} else {
		embedded.LoadBalancerBackendAddresses = nil
	}

	// LoadBalancingRules
	if source.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]SubResource_STATUS, len(source.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range source.LoadBalancingRules {
			var loadBalancingRule SubResource_STATUS
			err := loadBalancingRule.AssignProperties_From_SubResource_STATUS(&loadBalancingRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		embedded.LoadBalancingRules = loadBalancingRuleList
	} else {
		embedded.LoadBalancingRules = nil
	}

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

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

	// OutboundRule
	if source.OutboundRule != nil {
		var outboundRule SubResource_STATUS
		err := outboundRule.AssignProperties_From_SubResource_STATUS(source.OutboundRule)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field OutboundRule")
		}
		embedded.OutboundRule = &outboundRule
	} else {
		embedded.OutboundRule = nil
	}

	// OutboundRules
	if source.OutboundRules != nil {
		outboundRuleList := make([]SubResource_STATUS, len(source.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range source.OutboundRules {
			var outboundRule SubResource_STATUS
			err := outboundRule.AssignProperties_From_SubResource_STATUS(&outboundRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		embedded.OutboundRules = outboundRuleList
	} else {
		embedded.OutboundRules = nil
	}

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

	// SyncMode
	if source.SyncMode != nil {
		syncMode := *source.SyncMode
		syncModeTemp := genruntime.ToEnum(syncMode, backendAddressPoolPropertiesFormat_SyncMode_STATUS_Values)
		embedded.SyncMode = &syncModeTemp
	} else {
		embedded.SyncMode = nil
	}

	// TunnelInterfaces
	if source.TunnelInterfaces != nil {
		tunnelInterfaceList := make([]GatewayLoadBalancerTunnelInterface_STATUS, len(source.TunnelInterfaces))
		for tunnelInterfaceIndex, tunnelInterfaceItem := range source.TunnelInterfaces {
			var tunnelInterface GatewayLoadBalancerTunnelInterface_STATUS
			err := tunnelInterface.AssignProperties_From_GatewayLoadBalancerTunnelInterface_STATUS(&tunnelInterfaceItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_GatewayLoadBalancerTunnelInterface_STATUS() to populate field TunnelInterfaces")
			}
			tunnelInterfaceList[tunnelInterfaceIndex] = tunnelInterface
		}
		embedded.TunnelInterfaces = tunnelInterfaceList
	} else {
		embedded.TunnelInterfaces = nil
	}

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

	// VirtualNetwork
	if source.VirtualNetwork != nil {
		var virtualNetwork SubResource_STATUS
		err := virtualNetwork.AssignProperties_From_SubResource_STATUS(source.VirtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field VirtualNetwork")
		}
		embedded.VirtualNetwork = &virtualNetwork
	} else {
		embedded.VirtualNetwork = nil
	}

	// No error
	return nil
}

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

	// BackendIPConfigurations
	if embedded.BackendIPConfigurations != nil {
		backendIPConfigurationList := make([]storage.NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded, len(embedded.BackendIPConfigurations))
		for backendIPConfigurationIndex, backendIPConfigurationItem := range embedded.BackendIPConfigurations {
			var backendIPConfiguration storage.NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
			err := backendIPConfigurationItem.AssignProperties_To_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(&backendIPConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded() to populate field BackendIPConfigurations")
			}
			backendIPConfigurationList[backendIPConfigurationIndex] = backendIPConfiguration
		}
		destination.BackendIPConfigurations = backendIPConfigurationList
	} else {
		destination.BackendIPConfigurations = nil
	}

	// DrainPeriodInSeconds
	destination.DrainPeriodInSeconds = genruntime.ClonePointerToInt(embedded.DrainPeriodInSeconds)

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

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

	// InboundNatRules
	if embedded.InboundNatRules != nil {
		inboundNatRuleList := make([]storage.SubResource_STATUS, len(embedded.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range embedded.InboundNatRules {
			var inboundNatRule storage.SubResource_STATUS
			err := inboundNatRuleItem.AssignProperties_To_SubResource_STATUS(&inboundNatRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		destination.InboundNatRules = inboundNatRuleList
	} else {
		destination.InboundNatRules = nil
	}

	// LoadBalancerBackendAddresses
	if embedded.LoadBalancerBackendAddresses != nil {
		loadBalancerBackendAddressList := make([]storage.LoadBalancerBackendAddress_STATUS, len(embedded.LoadBalancerBackendAddresses))
		for loadBalancerBackendAddressIndex, loadBalancerBackendAddressItem := range embedded.LoadBalancerBackendAddresses {
			var loadBalancerBackendAddress storage.LoadBalancerBackendAddress_STATUS
			err := loadBalancerBackendAddressItem.AssignProperties_To_LoadBalancerBackendAddress_STATUS(&loadBalancerBackendAddress)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_LoadBalancerBackendAddress_STATUS() to populate field LoadBalancerBackendAddresses")
			}
			loadBalancerBackendAddressList[loadBalancerBackendAddressIndex] = loadBalancerBackendAddress
		}
		destination.LoadBalancerBackendAddresses = loadBalancerBackendAddressList
	} else {
		destination.LoadBalancerBackendAddresses = nil
	}

	// LoadBalancingRules
	if embedded.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]storage.SubResource_STATUS, len(embedded.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range embedded.LoadBalancingRules {
			var loadBalancingRule storage.SubResource_STATUS
			err := loadBalancingRuleItem.AssignProperties_To_SubResource_STATUS(&loadBalancingRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		destination.LoadBalancingRules = loadBalancingRuleList
	} else {
		destination.LoadBalancingRules = nil
	}

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

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

	// OutboundRule
	if embedded.OutboundRule != nil {
		var outboundRule storage.SubResource_STATUS
		err := embedded.OutboundRule.AssignProperties_To_SubResource_STATUS(&outboundRule)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field OutboundRule")
		}
		destination.OutboundRule = &outboundRule
	} else {
		destination.OutboundRule = nil
	}

	// OutboundRules
	if embedded.OutboundRules != nil {
		outboundRuleList := make([]storage.SubResource_STATUS, len(embedded.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range embedded.OutboundRules {
			var outboundRule storage.SubResource_STATUS
			err := outboundRuleItem.AssignProperties_To_SubResource_STATUS(&outboundRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		destination.OutboundRules = outboundRuleList
	} else {
		destination.OutboundRules = nil
	}

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

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

	// TunnelInterfaces
	if embedded.TunnelInterfaces != nil {
		tunnelInterfaceList := make([]storage.GatewayLoadBalancerTunnelInterface_STATUS, len(embedded.TunnelInterfaces))
		for tunnelInterfaceIndex, tunnelInterfaceItem := range embedded.TunnelInterfaces {
			var tunnelInterface storage.GatewayLoadBalancerTunnelInterface_STATUS
			err := tunnelInterfaceItem.AssignProperties_To_GatewayLoadBalancerTunnelInterface_STATUS(&tunnelInterface)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_GatewayLoadBalancerTunnelInterface_STATUS() to populate field TunnelInterfaces")
			}
			tunnelInterfaceList[tunnelInterfaceIndex] = tunnelInterface
		}
		destination.TunnelInterfaces = tunnelInterfaceList
	} else {
		destination.TunnelInterfaces = nil
	}

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

	// VirtualNetwork
	if embedded.VirtualNetwork != nil {
		var virtualNetwork storage.SubResource_STATUS
		err := embedded.VirtualNetwork.AssignProperties_To_SubResource_STATUS(&virtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field VirtualNetwork")
		}
		destination.VirtualNetwork = &virtualNetwork
	} else {
		destination.VirtualNetwork = nil
	}

	// 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 := &arm.ExtendedLocation{}

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

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

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

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

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

	// Set property "Type":
	if typedInput.Type != nil {
		var temp string
		temp = string(*typedInput.Type)
		typeVar := ExtendedLocationType(temp)
		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 *storage.ExtendedLocation) error {

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

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, extendedLocationType_Values)
		location.Type = &typeTemp
	} 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 *storage.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 := genruntime.ToEnum(string(*source.Type), extendedLocationType_Values)
		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 &arm.ExtendedLocation_STATUS{}
}

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

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

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

	// No error
	return nil
}

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

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

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, extendedLocationType_STATUS_Values)
		location.Type = &typeTemp
	} 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 *storage.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
}

// Frontend IP address of the load balancer.
type FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded struct {
	// GatewayLoadBalancer: The reference to gateway load balancer frontend IP.
	GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"`

	// Name: The name of the resource that is unique within the set of frontend IP configurations used by the load balancer.
	// This name can be used to access the resource.
	Name *string `json:"name,omitempty"`

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

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

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

	// PublicIPAddress: The reference to the Public IP resource.
	PublicIPAddress *PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded `json:"publicIPAddress,omitempty"`

	// PublicIPPrefix: The reference to the Public IP Prefix resource.
	PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"`

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

	// Zones: A list of availability zones denoting the IP allocated for the resource needs to come from.
	Zones []string `json:"zones,omitempty"`
}

var _ genruntime.ARMTransformer = &FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded{}

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

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

	// Set property "Properties":
	if embedded.GatewayLoadBalancer != nil ||
		embedded.PrivateIPAddress != nil ||
		embedded.PrivateIPAddressVersion != nil ||
		embedded.PrivateIPAllocationMethod != nil ||
		embedded.PublicIPAddress != nil ||
		embedded.PublicIPPrefix != nil ||
		embedded.Subnet != nil {
		result.Properties = &arm.FrontendIPConfigurationPropertiesFormat{}
	}
	if embedded.GatewayLoadBalancer != nil {
		gatewayLoadBalancer_ARM, err := embedded.GatewayLoadBalancer.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		gatewayLoadBalancer := *gatewayLoadBalancer_ARM.(*arm.SubResource)
		result.Properties.GatewayLoadBalancer = &gatewayLoadBalancer
	}
	if embedded.PrivateIPAddress != nil {
		privateIPAddress := *embedded.PrivateIPAddress
		result.Properties.PrivateIPAddress = &privateIPAddress
	}
	if embedded.PrivateIPAddressVersion != nil {
		var temp string
		temp = string(*embedded.PrivateIPAddressVersion)
		privateIPAddressVersion := arm.IPVersion(temp)
		result.Properties.PrivateIPAddressVersion = &privateIPAddressVersion
	}
	if embedded.PrivateIPAllocationMethod != nil {
		var temp string
		temp = string(*embedded.PrivateIPAllocationMethod)
		privateIPAllocationMethod := arm.IPAllocationMethod(temp)
		result.Properties.PrivateIPAllocationMethod = &privateIPAllocationMethod
	}
	if embedded.PublicIPAddress != nil {
		publicIPAddress_ARM, err := embedded.PublicIPAddress.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		publicIPAddress := *publicIPAddress_ARM.(*arm.PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded)
		result.Properties.PublicIPAddress = &publicIPAddress
	}
	if embedded.PublicIPPrefix != nil {
		publicIPPrefix_ARM, err := embedded.PublicIPPrefix.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		publicIPPrefix := *publicIPPrefix_ARM.(*arm.SubResource)
		result.Properties.PublicIPPrefix = &publicIPPrefix
	}
	if embedded.Subnet != nil {
		subnet_ARM, err := embedded.Subnet.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		subnet := *subnet_ARM.(*arm.Subnet_LoadBalancer_SubResourceEmbedded)
		result.Properties.Subnet = &subnet
	}

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

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

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

	// Set property "GatewayLoadBalancer":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.GatewayLoadBalancer != nil {
			var gatewayLoadBalancer1 SubResource
			err := gatewayLoadBalancer1.PopulateFromARM(owner, *typedInput.Properties.GatewayLoadBalancer)
			if err != nil {
				return err
			}
			gatewayLoadBalancer := gatewayLoadBalancer1
			embedded.GatewayLoadBalancer = &gatewayLoadBalancer
		}
	}

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

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

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

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

	// Set property "PublicIPAddress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicIPAddress != nil {
			var publicIPAddress1 PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded
			err := publicIPAddress1.PopulateFromARM(owner, *typedInput.Properties.PublicIPAddress)
			if err != nil {
				return err
			}
			publicIPAddress := publicIPAddress1
			embedded.PublicIPAddress = &publicIPAddress
		}
	}

	// Set property "PublicIPPrefix":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicIPPrefix != nil {
			var publicIPPrefix1 SubResource
			err := publicIPPrefix1.PopulateFromARM(owner, *typedInput.Properties.PublicIPPrefix)
			if err != nil {
				return err
			}
			publicIPPrefix := publicIPPrefix1
			embedded.PublicIPPrefix = &publicIPPrefix
		}
	}

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

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

	// No error
	return nil
}

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

	// GatewayLoadBalancer
	if source.GatewayLoadBalancer != nil {
		var gatewayLoadBalancer SubResource
		err := gatewayLoadBalancer.AssignProperties_From_SubResource(source.GatewayLoadBalancer)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field GatewayLoadBalancer")
		}
		embedded.GatewayLoadBalancer = &gatewayLoadBalancer
	} else {
		embedded.GatewayLoadBalancer = nil
	}

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

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

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

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

	// PublicIPAddress
	if source.PublicIPAddress != nil {
		var publicIPAddress PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded
		err := publicIPAddress.AssignProperties_From_PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded(source.PublicIPAddress)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded() to populate field PublicIPAddress")
		}
		embedded.PublicIPAddress = &publicIPAddress
	} else {
		embedded.PublicIPAddress = nil
	}

	// PublicIPPrefix
	if source.PublicIPPrefix != nil {
		var publicIPPrefix SubResource
		err := publicIPPrefix.AssignProperties_From_SubResource(source.PublicIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field PublicIPPrefix")
		}
		embedded.PublicIPPrefix = &publicIPPrefix
	} else {
		embedded.PublicIPPrefix = nil
	}

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

	// Zones
	embedded.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

	// GatewayLoadBalancer
	if embedded.GatewayLoadBalancer != nil {
		var gatewayLoadBalancer storage.SubResource
		err := embedded.GatewayLoadBalancer.AssignProperties_To_SubResource(&gatewayLoadBalancer)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field GatewayLoadBalancer")
		}
		destination.GatewayLoadBalancer = &gatewayLoadBalancer
	} else {
		destination.GatewayLoadBalancer = nil
	}

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

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

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

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

	// PublicIPAddress
	if embedded.PublicIPAddress != nil {
		var publicIPAddress storage.PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded
		err := embedded.PublicIPAddress.AssignProperties_To_PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded(&publicIPAddress)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded() to populate field PublicIPAddress")
		}
		destination.PublicIPAddress = &publicIPAddress
	} else {
		destination.PublicIPAddress = nil
	}

	// PublicIPPrefix
	if embedded.PublicIPPrefix != nil {
		var publicIPPrefix storage.SubResource
		err := embedded.PublicIPPrefix.AssignProperties_To_SubResource(&publicIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field PublicIPPrefix")
		}
		destination.PublicIPPrefix = &publicIPPrefix
	} else {
		destination.PublicIPPrefix = nil
	}

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

	// Zones
	destination.Zones = genruntime.CloneSliceOfString(embedded.Zones)

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

	// No error
	return nil
}

// Initialize_From_FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded populates our FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded from the provided source FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
func (embedded *FrontendIPConfiguration_LoadBalancer_SubResourceEmbedded) Initialize_From_FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(source *FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded) error {

	// GatewayLoadBalancer
	if source.GatewayLoadBalancer != nil {
		var gatewayLoadBalancer SubResource
		err := gatewayLoadBalancer.Initialize_From_SubResource_STATUS(source.GatewayLoadBalancer)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field GatewayLoadBalancer")
		}
		embedded.GatewayLoadBalancer = &gatewayLoadBalancer
	} else {
		embedded.GatewayLoadBalancer = nil
	}

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

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

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

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

	// PublicIPAddress
	if source.PublicIPAddress != nil {
		var publicIPAddress PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded
		err := publicIPAddress.Initialize_From_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded(source.PublicIPAddress)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded() to populate field PublicIPAddress")
		}
		embedded.PublicIPAddress = &publicIPAddress
	} else {
		embedded.PublicIPAddress = nil
	}

	// PublicIPPrefix
	if source.PublicIPPrefix != nil {
		var publicIPPrefix SubResource
		err := publicIPPrefix.Initialize_From_SubResource_STATUS(source.PublicIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field PublicIPPrefix")
		}
		embedded.PublicIPPrefix = &publicIPPrefix
	} else {
		embedded.PublicIPPrefix = nil
	}

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

	// Zones
	embedded.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

// Frontend IP address of the load balancer.
type FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded struct {
	// Etag: A unique read-only string that changes whenever the resource is updated.
	Etag *string `json:"etag,omitempty"`

	// GatewayLoadBalancer: The reference to gateway load balancer frontend IP.
	GatewayLoadBalancer *SubResource_STATUS `json:"gatewayLoadBalancer,omitempty"`

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

	// InboundNatPools: An array of references to inbound pools that use this frontend IP.
	InboundNatPools []SubResource_STATUS `json:"inboundNatPools,omitempty"`

	// InboundNatRules: An array of references to inbound rules that use this frontend IP.
	InboundNatRules []SubResource_STATUS `json:"inboundNatRules,omitempty"`

	// LoadBalancingRules: An array of references to load balancing rules that use this frontend IP.
	LoadBalancingRules []SubResource_STATUS `json:"loadBalancingRules,omitempty"`

	// Name: The name of the resource that is unique within the set of frontend IP configurations used by the load balancer.
	// This name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// OutboundRules: An array of references to outbound rules that use this frontend IP.
	OutboundRules []SubResource_STATUS `json:"outboundRules,omitempty"`

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

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

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

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

	// PublicIPAddress: The reference to the Public IP resource.
	PublicIPAddress *PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded `json:"publicIPAddress,omitempty"`

	// PublicIPPrefix: The reference to the Public IP Prefix resource.
	PublicIPPrefix *SubResource_STATUS `json:"publicIPPrefix,omitempty"`

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

	// Type: Type of the resource.
	Type *string `json:"type,omitempty"`

	// Zones: A list of availability zones denoting the IP allocated for the resource needs to come from.
	Zones []string `json:"zones,omitempty"`
}

var _ genruntime.FromARMConverter = &FrontendIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded{}

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

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

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

	// Set property "GatewayLoadBalancer":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.GatewayLoadBalancer != nil {
			var gatewayLoadBalancer1 SubResource_STATUS
			err := gatewayLoadBalancer1.PopulateFromARM(owner, *typedInput.Properties.GatewayLoadBalancer)
			if err != nil {
				return err
			}
			gatewayLoadBalancer := gatewayLoadBalancer1
			embedded.GatewayLoadBalancer = &gatewayLoadBalancer
		}
	}

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

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

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

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

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

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

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

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

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

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

	// Set property "PublicIPAddress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicIPAddress != nil {
			var publicIPAddress1 PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded
			err := publicIPAddress1.PopulateFromARM(owner, *typedInput.Properties.PublicIPAddress)
			if err != nil {
				return err
			}
			publicIPAddress := publicIPAddress1
			embedded.PublicIPAddress = &publicIPAddress
		}
	}

	// Set property "PublicIPPrefix":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicIPPrefix != nil {
			var publicIPPrefix1 SubResource_STATUS
			err := publicIPPrefix1.PopulateFromARM(owner, *typedInput.Properties.PublicIPPrefix)
			if err != nil {
				return err
			}
			publicIPPrefix := publicIPPrefix1
			embedded.PublicIPPrefix = &publicIPPrefix
		}
	}

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

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

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

	// No error
	return nil
}

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

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

	// GatewayLoadBalancer
	if source.GatewayLoadBalancer != nil {
		var gatewayLoadBalancer SubResource_STATUS
		err := gatewayLoadBalancer.AssignProperties_From_SubResource_STATUS(source.GatewayLoadBalancer)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field GatewayLoadBalancer")
		}
		embedded.GatewayLoadBalancer = &gatewayLoadBalancer
	} else {
		embedded.GatewayLoadBalancer = nil
	}

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

	// InboundNatPools
	if source.InboundNatPools != nil {
		inboundNatPoolList := make([]SubResource_STATUS, len(source.InboundNatPools))
		for inboundNatPoolIndex, inboundNatPoolItem := range source.InboundNatPools {
			var inboundNatPool SubResource_STATUS
			err := inboundNatPool.AssignProperties_From_SubResource_STATUS(&inboundNatPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field InboundNatPools")
			}
			inboundNatPoolList[inboundNatPoolIndex] = inboundNatPool
		}
		embedded.InboundNatPools = inboundNatPoolList
	} else {
		embedded.InboundNatPools = nil
	}

	// InboundNatRules
	if source.InboundNatRules != nil {
		inboundNatRuleList := make([]SubResource_STATUS, len(source.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range source.InboundNatRules {
			var inboundNatRule SubResource_STATUS
			err := inboundNatRule.AssignProperties_From_SubResource_STATUS(&inboundNatRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		embedded.InboundNatRules = inboundNatRuleList
	} else {
		embedded.InboundNatRules = nil
	}

	// LoadBalancingRules
	if source.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]SubResource_STATUS, len(source.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range source.LoadBalancingRules {
			var loadBalancingRule SubResource_STATUS
			err := loadBalancingRule.AssignProperties_From_SubResource_STATUS(&loadBalancingRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		embedded.LoadBalancingRules = loadBalancingRuleList
	} else {
		embedded.LoadBalancingRules = nil
	}

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

	// OutboundRules
	if source.OutboundRules != nil {
		outboundRuleList := make([]SubResource_STATUS, len(source.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range source.OutboundRules {
			var outboundRule SubResource_STATUS
			err := outboundRule.AssignProperties_From_SubResource_STATUS(&outboundRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		embedded.OutboundRules = outboundRuleList
	} else {
		embedded.OutboundRules = nil
	}

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

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

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

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

	// PublicIPAddress
	if source.PublicIPAddress != nil {
		var publicIPAddress PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded
		err := publicIPAddress.AssignProperties_From_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded(source.PublicIPAddress)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded() to populate field PublicIPAddress")
		}
		embedded.PublicIPAddress = &publicIPAddress
	} else {
		embedded.PublicIPAddress = nil
	}

	// PublicIPPrefix
	if source.PublicIPPrefix != nil {
		var publicIPPrefix SubResource_STATUS
		err := publicIPPrefix.AssignProperties_From_SubResource_STATUS(source.PublicIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field PublicIPPrefix")
		}
		embedded.PublicIPPrefix = &publicIPPrefix
	} else {
		embedded.PublicIPPrefix = nil
	}

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

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

	// Zones
	embedded.Zones = genruntime.CloneSliceOfString(source.Zones)

	// No error
	return nil
}

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

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

	// GatewayLoadBalancer
	if embedded.GatewayLoadBalancer != nil {
		var gatewayLoadBalancer storage.SubResource_STATUS
		err := embedded.GatewayLoadBalancer.AssignProperties_To_SubResource_STATUS(&gatewayLoadBalancer)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field GatewayLoadBalancer")
		}
		destination.GatewayLoadBalancer = &gatewayLoadBalancer
	} else {
		destination.GatewayLoadBalancer = nil
	}

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

	// InboundNatPools
	if embedded.InboundNatPools != nil {
		inboundNatPoolList := make([]storage.SubResource_STATUS, len(embedded.InboundNatPools))
		for inboundNatPoolIndex, inboundNatPoolItem := range embedded.InboundNatPools {
			var inboundNatPool storage.SubResource_STATUS
			err := inboundNatPoolItem.AssignProperties_To_SubResource_STATUS(&inboundNatPool)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field InboundNatPools")
			}
			inboundNatPoolList[inboundNatPoolIndex] = inboundNatPool
		}
		destination.InboundNatPools = inboundNatPoolList
	} else {
		destination.InboundNatPools = nil
	}

	// InboundNatRules
	if embedded.InboundNatRules != nil {
		inboundNatRuleList := make([]storage.SubResource_STATUS, len(embedded.InboundNatRules))
		for inboundNatRuleIndex, inboundNatRuleItem := range embedded.InboundNatRules {
			var inboundNatRule storage.SubResource_STATUS
			err := inboundNatRuleItem.AssignProperties_To_SubResource_STATUS(&inboundNatRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field InboundNatRules")
			}
			inboundNatRuleList[inboundNatRuleIndex] = inboundNatRule
		}
		destination.InboundNatRules = inboundNatRuleList
	} else {
		destination.InboundNatRules = nil
	}

	// LoadBalancingRules
	if embedded.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]storage.SubResource_STATUS, len(embedded.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range embedded.LoadBalancingRules {
			var loadBalancingRule storage.SubResource_STATUS
			err := loadBalancingRuleItem.AssignProperties_To_SubResource_STATUS(&loadBalancingRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		destination.LoadBalancingRules = loadBalancingRuleList
	} else {
		destination.LoadBalancingRules = nil
	}

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

	// OutboundRules
	if embedded.OutboundRules != nil {
		outboundRuleList := make([]storage.SubResource_STATUS, len(embedded.OutboundRules))
		for outboundRuleIndex, outboundRuleItem := range embedded.OutboundRules {
			var outboundRule storage.SubResource_STATUS
			err := outboundRuleItem.AssignProperties_To_SubResource_STATUS(&outboundRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field OutboundRules")
			}
			outboundRuleList[outboundRuleIndex] = outboundRule
		}
		destination.OutboundRules = outboundRuleList
	} else {
		destination.OutboundRules = nil
	}

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

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

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

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

	// PublicIPAddress
	if embedded.PublicIPAddress != nil {
		var publicIPAddress storage.PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded
		err := embedded.PublicIPAddress.AssignProperties_To_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded(&publicIPAddress)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded() to populate field PublicIPAddress")
		}
		destination.PublicIPAddress = &publicIPAddress
	} else {
		destination.PublicIPAddress = nil
	}

	// PublicIPPrefix
	if embedded.PublicIPPrefix != nil {
		var publicIPPrefix storage.SubResource_STATUS
		err := embedded.PublicIPPrefix.AssignProperties_To_SubResource_STATUS(&publicIPPrefix)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field PublicIPPrefix")
		}
		destination.PublicIPPrefix = &publicIPPrefix
	} else {
		destination.PublicIPPrefix = nil
	}

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

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

	// Zones
	destination.Zones = genruntime.CloneSliceOfString(embedded.Zones)

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

	// No error
	return nil
}

// Inbound NAT pool of the load balancer.
type InboundNatPool struct {
	// +kubebuilder:validation:Required
	// BackendPort: The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535.
	BackendPort *int `json:"backendPort,omitempty"`

	// EnableFloatingIP: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL
	// AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server.
	// This setting can't be changed after you create the endpoint.
	EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"`

	// EnableTcpReset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This
	// element is only used when the protocol is set to TCP.
	EnableTcpReset *bool `json:"enableTcpReset,omitempty"`

	// FrontendIPConfiguration: A reference to frontend IP addresses.
	FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"`

	// +kubebuilder:validation:Required
	// FrontendPortRangeEnd: The last port number in the range of external ports that will be used to provide Inbound Nat to
	// NICs associated with a load balancer. Acceptable values range between 1 and 65535.
	FrontendPortRangeEnd *int `json:"frontendPortRangeEnd,omitempty"`

	// +kubebuilder:validation:Required
	// FrontendPortRangeStart: The first port number in the range of external ports that will be used to provide Inbound Nat to
	// NICs associated with a load balancer. Acceptable values range between 1 and 65534.
	FrontendPortRangeStart *int `json:"frontendPortRangeStart,omitempty"`

	// IdleTimeoutInMinutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The
	// default value is 4 minutes. This element is only used when the protocol is set to TCP.
	IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`

	// Name: The name of the resource that is unique within the set of inbound NAT pools used by the load balancer. This name
	// can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// +kubebuilder:validation:Required
	// Protocol: The reference to the transport protocol used by the inbound NAT pool.
	Protocol *TransportProtocol `json:"protocol,omitempty"`
}

var _ genruntime.ARMTransformer = &InboundNatPool{}

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

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

	// Set property "Properties":
	if pool.BackendPort != nil ||
		pool.EnableFloatingIP != nil ||
		pool.EnableTcpReset != nil ||
		pool.FrontendIPConfiguration != nil ||
		pool.FrontendPortRangeEnd != nil ||
		pool.FrontendPortRangeStart != nil ||
		pool.IdleTimeoutInMinutes != nil ||
		pool.Protocol != nil {
		result.Properties = &arm.InboundNatPoolPropertiesFormat{}
	}
	if pool.BackendPort != nil {
		backendPort := *pool.BackendPort
		result.Properties.BackendPort = &backendPort
	}
	if pool.EnableFloatingIP != nil {
		enableFloatingIP := *pool.EnableFloatingIP
		result.Properties.EnableFloatingIP = &enableFloatingIP
	}
	if pool.EnableTcpReset != nil {
		enableTcpReset := *pool.EnableTcpReset
		result.Properties.EnableTcpReset = &enableTcpReset
	}
	if pool.FrontendIPConfiguration != nil {
		frontendIPConfiguration_ARM, err := pool.FrontendIPConfiguration.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		frontendIPConfiguration := *frontendIPConfiguration_ARM.(*arm.SubResource)
		result.Properties.FrontendIPConfiguration = &frontendIPConfiguration
	}
	if pool.FrontendPortRangeEnd != nil {
		frontendPortRangeEnd := *pool.FrontendPortRangeEnd
		result.Properties.FrontendPortRangeEnd = &frontendPortRangeEnd
	}
	if pool.FrontendPortRangeStart != nil {
		frontendPortRangeStart := *pool.FrontendPortRangeStart
		result.Properties.FrontendPortRangeStart = &frontendPortRangeStart
	}
	if pool.IdleTimeoutInMinutes != nil {
		idleTimeoutInMinutes := *pool.IdleTimeoutInMinutes
		result.Properties.IdleTimeoutInMinutes = &idleTimeoutInMinutes
	}
	if pool.Protocol != nil {
		var temp string
		temp = string(*pool.Protocol)
		protocol := arm.TransportProtocol(temp)
		result.Properties.Protocol = &protocol
	}
	return result, nil
}

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

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

	// Set property "BackendPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendPort != nil {
			backendPort := *typedInput.Properties.BackendPort
			pool.BackendPort = &backendPort
		}
	}

	// Set property "EnableFloatingIP":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableFloatingIP != nil {
			enableFloatingIP := *typedInput.Properties.EnableFloatingIP
			pool.EnableFloatingIP = &enableFloatingIP
		}
	}

	// Set property "EnableTcpReset":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableTcpReset != nil {
			enableTcpReset := *typedInput.Properties.EnableTcpReset
			pool.EnableTcpReset = &enableTcpReset
		}
	}

	// Set property "FrontendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendIPConfiguration != nil {
			var frontendIPConfiguration1 SubResource
			err := frontendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.FrontendIPConfiguration)
			if err != nil {
				return err
			}
			frontendIPConfiguration := frontendIPConfiguration1
			pool.FrontendIPConfiguration = &frontendIPConfiguration
		}
	}

	// Set property "FrontendPortRangeEnd":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendPortRangeEnd != nil {
			frontendPortRangeEnd := *typedInput.Properties.FrontendPortRangeEnd
			pool.FrontendPortRangeEnd = &frontendPortRangeEnd
		}
	}

	// Set property "FrontendPortRangeStart":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendPortRangeStart != nil {
			frontendPortRangeStart := *typedInput.Properties.FrontendPortRangeStart
			pool.FrontendPortRangeStart = &frontendPortRangeStart
		}
	}

	// Set property "IdleTimeoutInMinutes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IdleTimeoutInMinutes != nil {
			idleTimeoutInMinutes := *typedInput.Properties.IdleTimeoutInMinutes
			pool.IdleTimeoutInMinutes = &idleTimeoutInMinutes
		}
	}

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

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := TransportProtocol(temp)
			pool.Protocol = &protocol
		}
	}

	// No error
	return nil
}

// AssignProperties_From_InboundNatPool populates our InboundNatPool from the provided source InboundNatPool
func (pool *InboundNatPool) AssignProperties_From_InboundNatPool(source *storage.InboundNatPool) error {

	// BackendPort
	pool.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		pool.EnableFloatingIP = &enableFloatingIP
	} else {
		pool.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		pool.EnableTcpReset = &enableTcpReset
	} else {
		pool.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource
		err := frontendIPConfiguration.AssignProperties_From_SubResource(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field FrontendIPConfiguration")
		}
		pool.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		pool.FrontendIPConfiguration = nil
	}

	// FrontendPortRangeEnd
	pool.FrontendPortRangeEnd = genruntime.ClonePointerToInt(source.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	pool.FrontendPortRangeStart = genruntime.ClonePointerToInt(source.FrontendPortRangeStart)

	// IdleTimeoutInMinutes
	pool.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, transportProtocol_Values)
		pool.Protocol = &protocolTemp
	} else {
		pool.Protocol = nil
	}

	// No error
	return nil
}

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

	// BackendPort
	destination.BackendPort = genruntime.ClonePointerToInt(pool.BackendPort)

	// EnableFloatingIP
	if pool.EnableFloatingIP != nil {
		enableFloatingIP := *pool.EnableFloatingIP
		destination.EnableFloatingIP = &enableFloatingIP
	} else {
		destination.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if pool.EnableTcpReset != nil {
		enableTcpReset := *pool.EnableTcpReset
		destination.EnableTcpReset = &enableTcpReset
	} else {
		destination.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if pool.FrontendIPConfiguration != nil {
		var frontendIPConfiguration storage.SubResource
		err := pool.FrontendIPConfiguration.AssignProperties_To_SubResource(&frontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field FrontendIPConfiguration")
		}
		destination.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		destination.FrontendIPConfiguration = nil
	}

	// FrontendPortRangeEnd
	destination.FrontendPortRangeEnd = genruntime.ClonePointerToInt(pool.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	destination.FrontendPortRangeStart = genruntime.ClonePointerToInt(pool.FrontendPortRangeStart)

	// IdleTimeoutInMinutes
	destination.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(pool.IdleTimeoutInMinutes)

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

	// Protocol
	if pool.Protocol != nil {
		protocol := string(*pool.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

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

	// No error
	return nil
}

// Initialize_From_InboundNatPool_STATUS populates our InboundNatPool from the provided source InboundNatPool_STATUS
func (pool *InboundNatPool) Initialize_From_InboundNatPool_STATUS(source *InboundNatPool_STATUS) error {

	// BackendPort
	pool.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		pool.EnableFloatingIP = &enableFloatingIP
	} else {
		pool.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		pool.EnableTcpReset = &enableTcpReset
	} else {
		pool.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource
		err := frontendIPConfiguration.Initialize_From_SubResource_STATUS(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		pool.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		pool.FrontendIPConfiguration = nil
	}

	// FrontendPortRangeEnd
	pool.FrontendPortRangeEnd = genruntime.ClonePointerToInt(source.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	pool.FrontendPortRangeStart = genruntime.ClonePointerToInt(source.FrontendPortRangeStart)

	// IdleTimeoutInMinutes
	pool.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := genruntime.ToEnum(string(*source.Protocol), transportProtocol_Values)
		pool.Protocol = &protocol
	} else {
		pool.Protocol = nil
	}

	// No error
	return nil
}

// Inbound NAT pool of the load balancer.
type InboundNatPool_STATUS struct {
	// BackendPort: The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535.
	BackendPort *int `json:"backendPort,omitempty"`

	// EnableFloatingIP: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL
	// AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server.
	// This setting can't be changed after you create the endpoint.
	EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"`

	// EnableTcpReset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This
	// element is only used when the protocol is set to TCP.
	EnableTcpReset *bool `json:"enableTcpReset,omitempty"`

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

	// FrontendIPConfiguration: A reference to frontend IP addresses.
	FrontendIPConfiguration *SubResource_STATUS `json:"frontendIPConfiguration,omitempty"`

	// FrontendPortRangeEnd: The last port number in the range of external ports that will be used to provide Inbound Nat to
	// NICs associated with a load balancer. Acceptable values range between 1 and 65535.
	FrontendPortRangeEnd *int `json:"frontendPortRangeEnd,omitempty"`

	// FrontendPortRangeStart: The first port number in the range of external ports that will be used to provide Inbound Nat to
	// NICs associated with a load balancer. Acceptable values range between 1 and 65534.
	FrontendPortRangeStart *int `json:"frontendPortRangeStart,omitempty"`

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

	// IdleTimeoutInMinutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The
	// default value is 4 minutes. This element is only used when the protocol is set to TCP.
	IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`

	// Name: The name of the resource that is unique within the set of inbound NAT pools used by the load balancer. This name
	// can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// Protocol: The reference to the transport protocol used by the inbound NAT pool.
	Protocol *TransportProtocol_STATUS `json:"protocol,omitempty"`

	// ProvisioningState: The provisioning state of the inbound NAT pool resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

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

var _ genruntime.FromARMConverter = &InboundNatPool_STATUS{}

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

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

	// Set property "BackendPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendPort != nil {
			backendPort := *typedInput.Properties.BackendPort
			pool.BackendPort = &backendPort
		}
	}

	// Set property "EnableFloatingIP":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableFloatingIP != nil {
			enableFloatingIP := *typedInput.Properties.EnableFloatingIP
			pool.EnableFloatingIP = &enableFloatingIP
		}
	}

	// Set property "EnableTcpReset":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableTcpReset != nil {
			enableTcpReset := *typedInput.Properties.EnableTcpReset
			pool.EnableTcpReset = &enableTcpReset
		}
	}

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

	// Set property "FrontendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendIPConfiguration != nil {
			var frontendIPConfiguration1 SubResource_STATUS
			err := frontendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.FrontendIPConfiguration)
			if err != nil {
				return err
			}
			frontendIPConfiguration := frontendIPConfiguration1
			pool.FrontendIPConfiguration = &frontendIPConfiguration
		}
	}

	// Set property "FrontendPortRangeEnd":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendPortRangeEnd != nil {
			frontendPortRangeEnd := *typedInput.Properties.FrontendPortRangeEnd
			pool.FrontendPortRangeEnd = &frontendPortRangeEnd
		}
	}

	// Set property "FrontendPortRangeStart":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendPortRangeStart != nil {
			frontendPortRangeStart := *typedInput.Properties.FrontendPortRangeStart
			pool.FrontendPortRangeStart = &frontendPortRangeStart
		}
	}

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

	// Set property "IdleTimeoutInMinutes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IdleTimeoutInMinutes != nil {
			idleTimeoutInMinutes := *typedInput.Properties.IdleTimeoutInMinutes
			pool.IdleTimeoutInMinutes = &idleTimeoutInMinutes
		}
	}

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

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := TransportProtocol_STATUS(temp)
			pool.Protocol = &protocol
		}
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_InboundNatPool_STATUS populates our InboundNatPool_STATUS from the provided source InboundNatPool_STATUS
func (pool *InboundNatPool_STATUS) AssignProperties_From_InboundNatPool_STATUS(source *storage.InboundNatPool_STATUS) error {

	// BackendPort
	pool.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		pool.EnableFloatingIP = &enableFloatingIP
	} else {
		pool.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		pool.EnableTcpReset = &enableTcpReset
	} else {
		pool.EnableTcpReset = nil
	}

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

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource_STATUS
		err := frontendIPConfiguration.AssignProperties_From_SubResource_STATUS(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		pool.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		pool.FrontendIPConfiguration = nil
	}

	// FrontendPortRangeEnd
	pool.FrontendPortRangeEnd = genruntime.ClonePointerToInt(source.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	pool.FrontendPortRangeStart = genruntime.ClonePointerToInt(source.FrontendPortRangeStart)

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

	// IdleTimeoutInMinutes
	pool.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, transportProtocol_STATUS_Values)
		pool.Protocol = &protocolTemp
	} else {
		pool.Protocol = nil
	}

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

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

	// No error
	return nil
}

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

	// BackendPort
	destination.BackendPort = genruntime.ClonePointerToInt(pool.BackendPort)

	// EnableFloatingIP
	if pool.EnableFloatingIP != nil {
		enableFloatingIP := *pool.EnableFloatingIP
		destination.EnableFloatingIP = &enableFloatingIP
	} else {
		destination.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if pool.EnableTcpReset != nil {
		enableTcpReset := *pool.EnableTcpReset
		destination.EnableTcpReset = &enableTcpReset
	} else {
		destination.EnableTcpReset = nil
	}

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

	// FrontendIPConfiguration
	if pool.FrontendIPConfiguration != nil {
		var frontendIPConfiguration storage.SubResource_STATUS
		err := pool.FrontendIPConfiguration.AssignProperties_To_SubResource_STATUS(&frontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		destination.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		destination.FrontendIPConfiguration = nil
	}

	// FrontendPortRangeEnd
	destination.FrontendPortRangeEnd = genruntime.ClonePointerToInt(pool.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	destination.FrontendPortRangeStart = genruntime.ClonePointerToInt(pool.FrontendPortRangeStart)

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

	// IdleTimeoutInMinutes
	destination.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(pool.IdleTimeoutInMinutes)

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

	// Protocol
	if pool.Protocol != nil {
		protocol := string(*pool.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

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

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

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

	// No error
	return nil
}

// Inbound NAT rule of the load balancer.
type InboundNatRule_LoadBalancer_SubResourceEmbedded struct {
	// BackendAddressPool: A reference to backendAddressPool resource.
	BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"`

	// BackendPort: The port used for the internal endpoint. Acceptable values range from 1 to 65535.
	BackendPort *int `json:"backendPort,omitempty"`

	// EnableFloatingIP: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL
	// AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server.
	// This setting can't be changed after you create the endpoint.
	EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"`

	// EnableTcpReset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This
	// element is only used when the protocol is set to TCP.
	EnableTcpReset *bool `json:"enableTcpReset,omitempty"`

	// FrontendIPConfiguration: A reference to frontend IP addresses.
	FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"`

	// FrontendPort: The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer.
	// Acceptable values range from 1 to 65534.
	FrontendPort *int `json:"frontendPort,omitempty"`

	// FrontendPortRangeEnd: The port range end for the external endpoint. This property is used together with
	// BackendAddressPool and FrontendPortRangeStart. Individual inbound NAT rule port mappings will be created for each
	// backend address from BackendAddressPool. Acceptable values range from 1 to 65534.
	FrontendPortRangeEnd *int `json:"frontendPortRangeEnd,omitempty"`

	// FrontendPortRangeStart: The port range start for the external endpoint. This property is used together with
	// BackendAddressPool and FrontendPortRangeEnd. Individual inbound NAT rule port mappings will be created for each backend
	// address from BackendAddressPool. Acceptable values range from 1 to 65534.
	FrontendPortRangeStart *int `json:"frontendPortRangeStart,omitempty"`

	// IdleTimeoutInMinutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The
	// default value is 4 minutes. This element is only used when the protocol is set to TCP.
	IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`

	// Name: The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name
	// can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// Protocol: The reference to the transport protocol used by the load balancing rule.
	Protocol *TransportProtocol `json:"protocol,omitempty"`
}

var _ genruntime.ARMTransformer = &InboundNatRule_LoadBalancer_SubResourceEmbedded{}

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

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

	// Set property "Properties":
	if embedded.BackendAddressPool != nil ||
		embedded.BackendPort != nil ||
		embedded.EnableFloatingIP != nil ||
		embedded.EnableTcpReset != nil ||
		embedded.FrontendIPConfiguration != nil ||
		embedded.FrontendPort != nil ||
		embedded.FrontendPortRangeEnd != nil ||
		embedded.FrontendPortRangeStart != nil ||
		embedded.IdleTimeoutInMinutes != nil ||
		embedded.Protocol != nil {
		result.Properties = &arm.InboundNatRulePropertiesFormat{}
	}
	if embedded.BackendAddressPool != nil {
		backendAddressPool_ARM, err := embedded.BackendAddressPool.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		backendAddressPool := *backendAddressPool_ARM.(*arm.SubResource)
		result.Properties.BackendAddressPool = &backendAddressPool
	}
	if embedded.BackendPort != nil {
		backendPort := *embedded.BackendPort
		result.Properties.BackendPort = &backendPort
	}
	if embedded.EnableFloatingIP != nil {
		enableFloatingIP := *embedded.EnableFloatingIP
		result.Properties.EnableFloatingIP = &enableFloatingIP
	}
	if embedded.EnableTcpReset != nil {
		enableTcpReset := *embedded.EnableTcpReset
		result.Properties.EnableTcpReset = &enableTcpReset
	}
	if embedded.FrontendIPConfiguration != nil {
		frontendIPConfiguration_ARM, err := embedded.FrontendIPConfiguration.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		frontendIPConfiguration := *frontendIPConfiguration_ARM.(*arm.SubResource)
		result.Properties.FrontendIPConfiguration = &frontendIPConfiguration
	}
	if embedded.FrontendPort != nil {
		frontendPort := *embedded.FrontendPort
		result.Properties.FrontendPort = &frontendPort
	}
	if embedded.FrontendPortRangeEnd != nil {
		frontendPortRangeEnd := *embedded.FrontendPortRangeEnd
		result.Properties.FrontendPortRangeEnd = &frontendPortRangeEnd
	}
	if embedded.FrontendPortRangeStart != nil {
		frontendPortRangeStart := *embedded.FrontendPortRangeStart
		result.Properties.FrontendPortRangeStart = &frontendPortRangeStart
	}
	if embedded.IdleTimeoutInMinutes != nil {
		idleTimeoutInMinutes := *embedded.IdleTimeoutInMinutes
		result.Properties.IdleTimeoutInMinutes = &idleTimeoutInMinutes
	}
	if embedded.Protocol != nil {
		var temp string
		temp = string(*embedded.Protocol)
		protocol := arm.TransportProtocol(temp)
		result.Properties.Protocol = &protocol
	}
	return result, nil
}

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

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

	// Set property "BackendAddressPool":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendAddressPool != nil {
			var backendAddressPool1 SubResource
			err := backendAddressPool1.PopulateFromARM(owner, *typedInput.Properties.BackendAddressPool)
			if err != nil {
				return err
			}
			backendAddressPool := backendAddressPool1
			embedded.BackendAddressPool = &backendAddressPool
		}
	}

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

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

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

	// Set property "FrontendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendIPConfiguration != nil {
			var frontendIPConfiguration1 SubResource
			err := frontendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.FrontendIPConfiguration)
			if err != nil {
				return err
			}
			frontendIPConfiguration := frontendIPConfiguration1
			embedded.FrontendIPConfiguration = &frontendIPConfiguration
		}
	}

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

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

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

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

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

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := TransportProtocol(temp)
			embedded.Protocol = &protocol
		}
	}

	// No error
	return nil
}

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

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource
		err := backendAddressPool.AssignProperties_From_SubResource(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field BackendAddressPool")
		}
		embedded.BackendAddressPool = &backendAddressPool
	} else {
		embedded.BackendAddressPool = nil
	}

	// BackendPort
	embedded.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		embedded.EnableFloatingIP = &enableFloatingIP
	} else {
		embedded.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		embedded.EnableTcpReset = &enableTcpReset
	} else {
		embedded.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource
		err := frontendIPConfiguration.AssignProperties_From_SubResource(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field FrontendIPConfiguration")
		}
		embedded.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		embedded.FrontendIPConfiguration = nil
	}

	// FrontendPort
	embedded.FrontendPort = genruntime.ClonePointerToInt(source.FrontendPort)

	// FrontendPortRangeEnd
	embedded.FrontendPortRangeEnd = genruntime.ClonePointerToInt(source.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	embedded.FrontendPortRangeStart = genruntime.ClonePointerToInt(source.FrontendPortRangeStart)

	// IdleTimeoutInMinutes
	embedded.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, transportProtocol_Values)
		embedded.Protocol = &protocolTemp
	} else {
		embedded.Protocol = nil
	}

	// No error
	return nil
}

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

	// BackendAddressPool
	if embedded.BackendAddressPool != nil {
		var backendAddressPool storage.SubResource
		err := embedded.BackendAddressPool.AssignProperties_To_SubResource(&backendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field BackendAddressPool")
		}
		destination.BackendAddressPool = &backendAddressPool
	} else {
		destination.BackendAddressPool = nil
	}

	// BackendPort
	destination.BackendPort = genruntime.ClonePointerToInt(embedded.BackendPort)

	// EnableFloatingIP
	if embedded.EnableFloatingIP != nil {
		enableFloatingIP := *embedded.EnableFloatingIP
		destination.EnableFloatingIP = &enableFloatingIP
	} else {
		destination.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if embedded.EnableTcpReset != nil {
		enableTcpReset := *embedded.EnableTcpReset
		destination.EnableTcpReset = &enableTcpReset
	} else {
		destination.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if embedded.FrontendIPConfiguration != nil {
		var frontendIPConfiguration storage.SubResource
		err := embedded.FrontendIPConfiguration.AssignProperties_To_SubResource(&frontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field FrontendIPConfiguration")
		}
		destination.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		destination.FrontendIPConfiguration = nil
	}

	// FrontendPort
	destination.FrontendPort = genruntime.ClonePointerToInt(embedded.FrontendPort)

	// FrontendPortRangeEnd
	destination.FrontendPortRangeEnd = genruntime.ClonePointerToInt(embedded.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	destination.FrontendPortRangeStart = genruntime.ClonePointerToInt(embedded.FrontendPortRangeStart)

	// IdleTimeoutInMinutes
	destination.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(embedded.IdleTimeoutInMinutes)

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

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

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

	// No error
	return nil
}

// Initialize_From_InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded populates our InboundNatRule_LoadBalancer_SubResourceEmbedded from the provided source InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded
func (embedded *InboundNatRule_LoadBalancer_SubResourceEmbedded) Initialize_From_InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded(source *InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded) error {

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource
		err := backendAddressPool.Initialize_From_SubResource_STATUS(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field BackendAddressPool")
		}
		embedded.BackendAddressPool = &backendAddressPool
	} else {
		embedded.BackendAddressPool = nil
	}

	// BackendPort
	embedded.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		embedded.EnableFloatingIP = &enableFloatingIP
	} else {
		embedded.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		embedded.EnableTcpReset = &enableTcpReset
	} else {
		embedded.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource
		err := frontendIPConfiguration.Initialize_From_SubResource_STATUS(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		embedded.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		embedded.FrontendIPConfiguration = nil
	}

	// FrontendPort
	embedded.FrontendPort = genruntime.ClonePointerToInt(source.FrontendPort)

	// FrontendPortRangeEnd
	embedded.FrontendPortRangeEnd = genruntime.ClonePointerToInt(source.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	embedded.FrontendPortRangeStart = genruntime.ClonePointerToInt(source.FrontendPortRangeStart)

	// IdleTimeoutInMinutes
	embedded.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := genruntime.ToEnum(string(*source.Protocol), transportProtocol_Values)
		embedded.Protocol = &protocol
	} else {
		embedded.Protocol = nil
	}

	// No error
	return nil
}

// Inbound NAT rule of the load balancer.
type InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded struct {
	// BackendAddressPool: A reference to backendAddressPool resource.
	BackendAddressPool *SubResource_STATUS `json:"backendAddressPool,omitempty"`

	// BackendIPConfiguration: A reference to a private IP address defined on a network interface of a VM. Traffic sent to the
	// frontend port of each of the frontend IP configurations is forwarded to the backend IP.
	BackendIPConfiguration *NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded `json:"backendIPConfiguration,omitempty"`

	// BackendPort: The port used for the internal endpoint. Acceptable values range from 1 to 65535.
	BackendPort *int `json:"backendPort,omitempty"`

	// EnableFloatingIP: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL
	// AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server.
	// This setting can't be changed after you create the endpoint.
	EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"`

	// EnableTcpReset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This
	// element is only used when the protocol is set to TCP.
	EnableTcpReset *bool `json:"enableTcpReset,omitempty"`

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

	// FrontendIPConfiguration: A reference to frontend IP addresses.
	FrontendIPConfiguration *SubResource_STATUS `json:"frontendIPConfiguration,omitempty"`

	// FrontendPort: The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer.
	// Acceptable values range from 1 to 65534.
	FrontendPort *int `json:"frontendPort,omitempty"`

	// FrontendPortRangeEnd: The port range end for the external endpoint. This property is used together with
	// BackendAddressPool and FrontendPortRangeStart. Individual inbound NAT rule port mappings will be created for each
	// backend address from BackendAddressPool. Acceptable values range from 1 to 65534.
	FrontendPortRangeEnd *int `json:"frontendPortRangeEnd,omitempty"`

	// FrontendPortRangeStart: The port range start for the external endpoint. This property is used together with
	// BackendAddressPool and FrontendPortRangeEnd. Individual inbound NAT rule port mappings will be created for each backend
	// address from BackendAddressPool. Acceptable values range from 1 to 65534.
	FrontendPortRangeStart *int `json:"frontendPortRangeStart,omitempty"`

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

	// IdleTimeoutInMinutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The
	// default value is 4 minutes. This element is only used when the protocol is set to TCP.
	IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`

	// Name: The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name
	// can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// Protocol: The reference to the transport protocol used by the load balancing rule.
	Protocol *TransportProtocol_STATUS `json:"protocol,omitempty"`

	// ProvisioningState: The provisioning state of the inbound NAT rule resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

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

var _ genruntime.FromARMConverter = &InboundNatRule_STATUS_LoadBalancer_SubResourceEmbedded{}

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

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

	// Set property "BackendAddressPool":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendAddressPool != nil {
			var backendAddressPool1 SubResource_STATUS
			err := backendAddressPool1.PopulateFromARM(owner, *typedInput.Properties.BackendAddressPool)
			if err != nil {
				return err
			}
			backendAddressPool := backendAddressPool1
			embedded.BackendAddressPool = &backendAddressPool
		}
	}

	// Set property "BackendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendIPConfiguration != nil {
			var backendIPConfiguration1 NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
			err := backendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.BackendIPConfiguration)
			if err != nil {
				return err
			}
			backendIPConfiguration := backendIPConfiguration1
			embedded.BackendIPConfiguration = &backendIPConfiguration
		}
	}

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

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

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

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

	// Set property "FrontendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendIPConfiguration != nil {
			var frontendIPConfiguration1 SubResource_STATUS
			err := frontendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.FrontendIPConfiguration)
			if err != nil {
				return err
			}
			frontendIPConfiguration := frontendIPConfiguration1
			embedded.FrontendIPConfiguration = &frontendIPConfiguration
		}
	}

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

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

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

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

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

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

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := TransportProtocol_STATUS(temp)
			embedded.Protocol = &protocol
		}
	}

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

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

	// No error
	return nil
}

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

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource_STATUS
		err := backendAddressPool.AssignProperties_From_SubResource_STATUS(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field BackendAddressPool")
		}
		embedded.BackendAddressPool = &backendAddressPool
	} else {
		embedded.BackendAddressPool = nil
	}

	// BackendIPConfiguration
	if source.BackendIPConfiguration != nil {
		var backendIPConfiguration NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
		err := backendIPConfiguration.AssignProperties_From_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(source.BackendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded() to populate field BackendIPConfiguration")
		}
		embedded.BackendIPConfiguration = &backendIPConfiguration
	} else {
		embedded.BackendIPConfiguration = nil
	}

	// BackendPort
	embedded.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		embedded.EnableFloatingIP = &enableFloatingIP
	} else {
		embedded.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		embedded.EnableTcpReset = &enableTcpReset
	} else {
		embedded.EnableTcpReset = nil
	}

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

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource_STATUS
		err := frontendIPConfiguration.AssignProperties_From_SubResource_STATUS(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		embedded.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		embedded.FrontendIPConfiguration = nil
	}

	// FrontendPort
	embedded.FrontendPort = genruntime.ClonePointerToInt(source.FrontendPort)

	// FrontendPortRangeEnd
	embedded.FrontendPortRangeEnd = genruntime.ClonePointerToInt(source.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	embedded.FrontendPortRangeStart = genruntime.ClonePointerToInt(source.FrontendPortRangeStart)

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

	// IdleTimeoutInMinutes
	embedded.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, transportProtocol_STATUS_Values)
		embedded.Protocol = &protocolTemp
	} else {
		embedded.Protocol = nil
	}

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

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

	// No error
	return nil
}

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

	// BackendAddressPool
	if embedded.BackendAddressPool != nil {
		var backendAddressPool storage.SubResource_STATUS
		err := embedded.BackendAddressPool.AssignProperties_To_SubResource_STATUS(&backendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field BackendAddressPool")
		}
		destination.BackendAddressPool = &backendAddressPool
	} else {
		destination.BackendAddressPool = nil
	}

	// BackendIPConfiguration
	if embedded.BackendIPConfiguration != nil {
		var backendIPConfiguration storage.NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
		err := embedded.BackendIPConfiguration.AssignProperties_To_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(&backendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded() to populate field BackendIPConfiguration")
		}
		destination.BackendIPConfiguration = &backendIPConfiguration
	} else {
		destination.BackendIPConfiguration = nil
	}

	// BackendPort
	destination.BackendPort = genruntime.ClonePointerToInt(embedded.BackendPort)

	// EnableFloatingIP
	if embedded.EnableFloatingIP != nil {
		enableFloatingIP := *embedded.EnableFloatingIP
		destination.EnableFloatingIP = &enableFloatingIP
	} else {
		destination.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if embedded.EnableTcpReset != nil {
		enableTcpReset := *embedded.EnableTcpReset
		destination.EnableTcpReset = &enableTcpReset
	} else {
		destination.EnableTcpReset = nil
	}

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

	// FrontendIPConfiguration
	if embedded.FrontendIPConfiguration != nil {
		var frontendIPConfiguration storage.SubResource_STATUS
		err := embedded.FrontendIPConfiguration.AssignProperties_To_SubResource_STATUS(&frontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		destination.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		destination.FrontendIPConfiguration = nil
	}

	// FrontendPort
	destination.FrontendPort = genruntime.ClonePointerToInt(embedded.FrontendPort)

	// FrontendPortRangeEnd
	destination.FrontendPortRangeEnd = genruntime.ClonePointerToInt(embedded.FrontendPortRangeEnd)

	// FrontendPortRangeStart
	destination.FrontendPortRangeStart = genruntime.ClonePointerToInt(embedded.FrontendPortRangeStart)

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

	// IdleTimeoutInMinutes
	destination.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(embedded.IdleTimeoutInMinutes)

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

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

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

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

// SKU of a load balancer.
type LoadBalancerSku struct {
	// Name: Name of a load balancer SKU.
	Name *LoadBalancerSku_Name `json:"name,omitempty"`

	// Tier: Tier of a load balancer SKU.
	Tier *LoadBalancerSku_Tier `json:"tier,omitempty"`
}

var _ genruntime.ARMTransformer = &LoadBalancerSku{}

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

	// Set property "Name":
	if balancerSku.Name != nil {
		var temp string
		temp = string(*balancerSku.Name)
		name := arm.LoadBalancerSku_Name(temp)
		result.Name = &name
	}

	// Set property "Tier":
	if balancerSku.Tier != nil {
		var temp string
		temp = string(*balancerSku.Tier)
		tier := arm.LoadBalancerSku_Tier(temp)
		result.Tier = &tier
	}
	return result, nil
}

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

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

	// Set property "Name":
	if typedInput.Name != nil {
		var temp string
		temp = string(*typedInput.Name)
		name := LoadBalancerSku_Name(temp)
		balancerSku.Name = &name
	}

	// Set property "Tier":
	if typedInput.Tier != nil {
		var temp string
		temp = string(*typedInput.Tier)
		tier := LoadBalancerSku_Tier(temp)
		balancerSku.Tier = &tier
	}

	// No error
	return nil
}

// AssignProperties_From_LoadBalancerSku populates our LoadBalancerSku from the provided source LoadBalancerSku
func (balancerSku *LoadBalancerSku) AssignProperties_From_LoadBalancerSku(source *storage.LoadBalancerSku) error {

	// Name
	if source.Name != nil {
		name := *source.Name
		nameTemp := genruntime.ToEnum(name, loadBalancerSku_Name_Values)
		balancerSku.Name = &nameTemp
	} else {
		balancerSku.Name = nil
	}

	// Tier
	if source.Tier != nil {
		tier := *source.Tier
		tierTemp := genruntime.ToEnum(tier, loadBalancerSku_Tier_Values)
		balancerSku.Tier = &tierTemp
	} else {
		balancerSku.Tier = nil
	}

	// No error
	return nil
}

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

	// Name
	if balancerSku.Name != nil {
		name := string(*balancerSku.Name)
		destination.Name = &name
	} else {
		destination.Name = nil
	}

	// Tier
	if balancerSku.Tier != nil {
		tier := string(*balancerSku.Tier)
		destination.Tier = &tier
	} else {
		destination.Tier = nil
	}

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

	// No error
	return nil
}

// Initialize_From_LoadBalancerSku_STATUS populates our LoadBalancerSku from the provided source LoadBalancerSku_STATUS
func (balancerSku *LoadBalancerSku) Initialize_From_LoadBalancerSku_STATUS(source *LoadBalancerSku_STATUS) error {

	// Name
	if source.Name != nil {
		name := genruntime.ToEnum(string(*source.Name), loadBalancerSku_Name_Values)
		balancerSku.Name = &name
	} else {
		balancerSku.Name = nil
	}

	// Tier
	if source.Tier != nil {
		tier := genruntime.ToEnum(string(*source.Tier), loadBalancerSku_Tier_Values)
		balancerSku.Tier = &tier
	} else {
		balancerSku.Tier = nil
	}

	// No error
	return nil
}

// SKU of a load balancer.
type LoadBalancerSku_STATUS struct {
	// Name: Name of a load balancer SKU.
	Name *LoadBalancerSku_Name_STATUS `json:"name,omitempty"`

	// Tier: Tier of a load balancer SKU.
	Tier *LoadBalancerSku_Tier_STATUS `json:"tier,omitempty"`
}

var _ genruntime.FromARMConverter = &LoadBalancerSku_STATUS{}

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

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

	// Set property "Name":
	if typedInput.Name != nil {
		var temp string
		temp = string(*typedInput.Name)
		name := LoadBalancerSku_Name_STATUS(temp)
		balancerSku.Name = &name
	}

	// Set property "Tier":
	if typedInput.Tier != nil {
		var temp string
		temp = string(*typedInput.Tier)
		tier := LoadBalancerSku_Tier_STATUS(temp)
		balancerSku.Tier = &tier
	}

	// No error
	return nil
}

// AssignProperties_From_LoadBalancerSku_STATUS populates our LoadBalancerSku_STATUS from the provided source LoadBalancerSku_STATUS
func (balancerSku *LoadBalancerSku_STATUS) AssignProperties_From_LoadBalancerSku_STATUS(source *storage.LoadBalancerSku_STATUS) error {

	// Name
	if source.Name != nil {
		name := *source.Name
		nameTemp := genruntime.ToEnum(name, loadBalancerSku_Name_STATUS_Values)
		balancerSku.Name = &nameTemp
	} else {
		balancerSku.Name = nil
	}

	// Tier
	if source.Tier != nil {
		tier := *source.Tier
		tierTemp := genruntime.ToEnum(tier, loadBalancerSku_Tier_STATUS_Values)
		balancerSku.Tier = &tierTemp
	} else {
		balancerSku.Tier = nil
	}

	// No error
	return nil
}

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

	// Name
	if balancerSku.Name != nil {
		name := string(*balancerSku.Name)
		destination.Name = &name
	} else {
		destination.Name = nil
	}

	// Tier
	if balancerSku.Tier != nil {
		tier := string(*balancerSku.Tier)
		destination.Tier = &tier
	} else {
		destination.Tier = nil
	}

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

	// No error
	return nil
}

// A load balancing rule for a load balancer.
type LoadBalancingRule struct {
	// BackendAddressPool: A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend
	// IPs.
	BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"`

	// BackendAddressPools: An array of references to pool of DIPs.
	BackendAddressPools []SubResource `json:"backendAddressPools,omitempty"`

	// BackendPort: The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note
	// that value 0 enables "Any Port".
	BackendPort *int `json:"backendPort,omitempty"`

	// DisableOutboundSnat: Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the
	// frontend of the load balancing rule.
	DisableOutboundSnat *bool `json:"disableOutboundSnat,omitempty"`

	// EnableFloatingIP: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL
	// AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server.
	// This setting can't be changed after you create the endpoint.
	EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"`

	// EnableTcpReset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This
	// element is only used when the protocol is set to TCP.
	EnableTcpReset *bool `json:"enableTcpReset,omitempty"`

	// FrontendIPConfiguration: A reference to frontend IP addresses.
	FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"`

	// +kubebuilder:validation:Required
	// FrontendPort: The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer.
	// Acceptable values are between 0 and 65534. Note that value 0 enables "Any Port".
	FrontendPort *int `json:"frontendPort,omitempty"`

	// IdleTimeoutInMinutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The
	// default value is 4 minutes. This element is only used when the protocol is set to TCP.
	IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`

	// LoadDistribution: The load distribution policy for this rule.
	LoadDistribution *LoadBalancingRulePropertiesFormat_LoadDistribution `json:"loadDistribution,omitempty"`

	// Name: The name of the resource that is unique within the set of load balancing rules used by the load balancer. This
	// name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// Probe: The reference to the load balancer probe used by the load balancing rule.
	Probe *SubResource `json:"probe,omitempty"`

	// +kubebuilder:validation:Required
	// Protocol: The reference to the transport protocol used by the load balancing rule.
	Protocol *TransportProtocol `json:"protocol,omitempty"`
}

var _ genruntime.ARMTransformer = &LoadBalancingRule{}

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

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

	// Set property "Properties":
	if rule.BackendAddressPool != nil ||
		rule.BackendAddressPools != nil ||
		rule.BackendPort != nil ||
		rule.DisableOutboundSnat != nil ||
		rule.EnableFloatingIP != nil ||
		rule.EnableTcpReset != nil ||
		rule.FrontendIPConfiguration != nil ||
		rule.FrontendPort != nil ||
		rule.IdleTimeoutInMinutes != nil ||
		rule.LoadDistribution != nil ||
		rule.Probe != nil ||
		rule.Protocol != nil {
		result.Properties = &arm.LoadBalancingRulePropertiesFormat{}
	}
	if rule.BackendAddressPool != nil {
		backendAddressPool_ARM, err := rule.BackendAddressPool.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		backendAddressPool := *backendAddressPool_ARM.(*arm.SubResource)
		result.Properties.BackendAddressPool = &backendAddressPool
	}
	for _, item := range rule.BackendAddressPools {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.BackendAddressPools = append(result.Properties.BackendAddressPools, *item_ARM.(*arm.SubResource))
	}
	if rule.BackendPort != nil {
		backendPort := *rule.BackendPort
		result.Properties.BackendPort = &backendPort
	}
	if rule.DisableOutboundSnat != nil {
		disableOutboundSnat := *rule.DisableOutboundSnat
		result.Properties.DisableOutboundSnat = &disableOutboundSnat
	}
	if rule.EnableFloatingIP != nil {
		enableFloatingIP := *rule.EnableFloatingIP
		result.Properties.EnableFloatingIP = &enableFloatingIP
	}
	if rule.EnableTcpReset != nil {
		enableTcpReset := *rule.EnableTcpReset
		result.Properties.EnableTcpReset = &enableTcpReset
	}
	if rule.FrontendIPConfiguration != nil {
		frontendIPConfiguration_ARM, err := rule.FrontendIPConfiguration.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		frontendIPConfiguration := *frontendIPConfiguration_ARM.(*arm.SubResource)
		result.Properties.FrontendIPConfiguration = &frontendIPConfiguration
	}
	if rule.FrontendPort != nil {
		frontendPort := *rule.FrontendPort
		result.Properties.FrontendPort = &frontendPort
	}
	if rule.IdleTimeoutInMinutes != nil {
		idleTimeoutInMinutes := *rule.IdleTimeoutInMinutes
		result.Properties.IdleTimeoutInMinutes = &idleTimeoutInMinutes
	}
	if rule.LoadDistribution != nil {
		var temp string
		temp = string(*rule.LoadDistribution)
		loadDistribution := arm.LoadBalancingRulePropertiesFormat_LoadDistribution(temp)
		result.Properties.LoadDistribution = &loadDistribution
	}
	if rule.Probe != nil {
		probe_ARM, err := rule.Probe.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		probe := *probe_ARM.(*arm.SubResource)
		result.Properties.Probe = &probe
	}
	if rule.Protocol != nil {
		var temp string
		temp = string(*rule.Protocol)
		protocol := arm.TransportProtocol(temp)
		result.Properties.Protocol = &protocol
	}
	return result, nil
}

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

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

	// Set property "BackendAddressPool":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendAddressPool != nil {
			var backendAddressPool1 SubResource
			err := backendAddressPool1.PopulateFromARM(owner, *typedInput.Properties.BackendAddressPool)
			if err != nil {
				return err
			}
			backendAddressPool := backendAddressPool1
			rule.BackendAddressPool = &backendAddressPool
		}
	}

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

	// Set property "BackendPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendPort != nil {
			backendPort := *typedInput.Properties.BackendPort
			rule.BackendPort = &backendPort
		}
	}

	// Set property "DisableOutboundSnat":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableOutboundSnat != nil {
			disableOutboundSnat := *typedInput.Properties.DisableOutboundSnat
			rule.DisableOutboundSnat = &disableOutboundSnat
		}
	}

	// Set property "EnableFloatingIP":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableFloatingIP != nil {
			enableFloatingIP := *typedInput.Properties.EnableFloatingIP
			rule.EnableFloatingIP = &enableFloatingIP
		}
	}

	// Set property "EnableTcpReset":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableTcpReset != nil {
			enableTcpReset := *typedInput.Properties.EnableTcpReset
			rule.EnableTcpReset = &enableTcpReset
		}
	}

	// Set property "FrontendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendIPConfiguration != nil {
			var frontendIPConfiguration1 SubResource
			err := frontendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.FrontendIPConfiguration)
			if err != nil {
				return err
			}
			frontendIPConfiguration := frontendIPConfiguration1
			rule.FrontendIPConfiguration = &frontendIPConfiguration
		}
	}

	// Set property "FrontendPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendPort != nil {
			frontendPort := *typedInput.Properties.FrontendPort
			rule.FrontendPort = &frontendPort
		}
	}

	// Set property "IdleTimeoutInMinutes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IdleTimeoutInMinutes != nil {
			idleTimeoutInMinutes := *typedInput.Properties.IdleTimeoutInMinutes
			rule.IdleTimeoutInMinutes = &idleTimeoutInMinutes
		}
	}

	// Set property "LoadDistribution":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LoadDistribution != nil {
			var temp string
			temp = string(*typedInput.Properties.LoadDistribution)
			loadDistribution := LoadBalancingRulePropertiesFormat_LoadDistribution(temp)
			rule.LoadDistribution = &loadDistribution
		}
	}

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

	// Set property "Probe":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Probe != nil {
			var probe1 SubResource
			err := probe1.PopulateFromARM(owner, *typedInput.Properties.Probe)
			if err != nil {
				return err
			}
			probe := probe1
			rule.Probe = &probe
		}
	}

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := TransportProtocol(temp)
			rule.Protocol = &protocol
		}
	}

	// No error
	return nil
}

// AssignProperties_From_LoadBalancingRule populates our LoadBalancingRule from the provided source LoadBalancingRule
func (rule *LoadBalancingRule) AssignProperties_From_LoadBalancingRule(source *storage.LoadBalancingRule) error {

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource
		err := backendAddressPool.AssignProperties_From_SubResource(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field BackendAddressPool")
		}
		rule.BackendAddressPool = &backendAddressPool
	} else {
		rule.BackendAddressPool = nil
	}

	// BackendAddressPools
	if source.BackendAddressPools != nil {
		backendAddressPoolList := make([]SubResource, len(source.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range source.BackendAddressPools {
			var backendAddressPool SubResource
			err := backendAddressPool.AssignProperties_From_SubResource(&backendAddressPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		rule.BackendAddressPools = backendAddressPoolList
	} else {
		rule.BackendAddressPools = nil
	}

	// BackendPort
	rule.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// DisableOutboundSnat
	if source.DisableOutboundSnat != nil {
		disableOutboundSnat := *source.DisableOutboundSnat
		rule.DisableOutboundSnat = &disableOutboundSnat
	} else {
		rule.DisableOutboundSnat = nil
	}

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		rule.EnableFloatingIP = &enableFloatingIP
	} else {
		rule.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		rule.EnableTcpReset = &enableTcpReset
	} else {
		rule.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource
		err := frontendIPConfiguration.AssignProperties_From_SubResource(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field FrontendIPConfiguration")
		}
		rule.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		rule.FrontendIPConfiguration = nil
	}

	// FrontendPort
	rule.FrontendPort = genruntime.ClonePointerToInt(source.FrontendPort)

	// IdleTimeoutInMinutes
	rule.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

	// LoadDistribution
	if source.LoadDistribution != nil {
		loadDistribution := *source.LoadDistribution
		loadDistributionTemp := genruntime.ToEnum(loadDistribution, loadBalancingRulePropertiesFormat_LoadDistribution_Values)
		rule.LoadDistribution = &loadDistributionTemp
	} else {
		rule.LoadDistribution = nil
	}

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

	// Probe
	if source.Probe != nil {
		var probe SubResource
		err := probe.AssignProperties_From_SubResource(source.Probe)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field Probe")
		}
		rule.Probe = &probe
	} else {
		rule.Probe = nil
	}

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, transportProtocol_Values)
		rule.Protocol = &protocolTemp
	} else {
		rule.Protocol = nil
	}

	// No error
	return nil
}

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

	// BackendAddressPool
	if rule.BackendAddressPool != nil {
		var backendAddressPool storage.SubResource
		err := rule.BackendAddressPool.AssignProperties_To_SubResource(&backendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field BackendAddressPool")
		}
		destination.BackendAddressPool = &backendAddressPool
	} else {
		destination.BackendAddressPool = nil
	}

	// BackendAddressPools
	if rule.BackendAddressPools != nil {
		backendAddressPoolList := make([]storage.SubResource, len(rule.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range rule.BackendAddressPools {
			var backendAddressPool storage.SubResource
			err := backendAddressPoolItem.AssignProperties_To_SubResource(&backendAddressPool)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		destination.BackendAddressPools = backendAddressPoolList
	} else {
		destination.BackendAddressPools = nil
	}

	// BackendPort
	destination.BackendPort = genruntime.ClonePointerToInt(rule.BackendPort)

	// DisableOutboundSnat
	if rule.DisableOutboundSnat != nil {
		disableOutboundSnat := *rule.DisableOutboundSnat
		destination.DisableOutboundSnat = &disableOutboundSnat
	} else {
		destination.DisableOutboundSnat = nil
	}

	// EnableFloatingIP
	if rule.EnableFloatingIP != nil {
		enableFloatingIP := *rule.EnableFloatingIP
		destination.EnableFloatingIP = &enableFloatingIP
	} else {
		destination.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if rule.EnableTcpReset != nil {
		enableTcpReset := *rule.EnableTcpReset
		destination.EnableTcpReset = &enableTcpReset
	} else {
		destination.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if rule.FrontendIPConfiguration != nil {
		var frontendIPConfiguration storage.SubResource
		err := rule.FrontendIPConfiguration.AssignProperties_To_SubResource(&frontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field FrontendIPConfiguration")
		}
		destination.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		destination.FrontendIPConfiguration = nil
	}

	// FrontendPort
	destination.FrontendPort = genruntime.ClonePointerToInt(rule.FrontendPort)

	// IdleTimeoutInMinutes
	destination.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(rule.IdleTimeoutInMinutes)

	// LoadDistribution
	if rule.LoadDistribution != nil {
		loadDistribution := string(*rule.LoadDistribution)
		destination.LoadDistribution = &loadDistribution
	} else {
		destination.LoadDistribution = nil
	}

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

	// Probe
	if rule.Probe != nil {
		var probe storage.SubResource
		err := rule.Probe.AssignProperties_To_SubResource(&probe)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field Probe")
		}
		destination.Probe = &probe
	} else {
		destination.Probe = nil
	}

	// Protocol
	if rule.Protocol != nil {
		protocol := string(*rule.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

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

	// No error
	return nil
}

// Initialize_From_LoadBalancingRule_STATUS populates our LoadBalancingRule from the provided source LoadBalancingRule_STATUS
func (rule *LoadBalancingRule) Initialize_From_LoadBalancingRule_STATUS(source *LoadBalancingRule_STATUS) error {

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource
		err := backendAddressPool.Initialize_From_SubResource_STATUS(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field BackendAddressPool")
		}
		rule.BackendAddressPool = &backendAddressPool
	} else {
		rule.BackendAddressPool = nil
	}

	// BackendAddressPools
	if source.BackendAddressPools != nil {
		backendAddressPoolList := make([]SubResource, len(source.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range source.BackendAddressPools {
			var backendAddressPool SubResource
			err := backendAddressPool.Initialize_From_SubResource_STATUS(&backendAddressPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		rule.BackendAddressPools = backendAddressPoolList
	} else {
		rule.BackendAddressPools = nil
	}

	// BackendPort
	rule.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// DisableOutboundSnat
	if source.DisableOutboundSnat != nil {
		disableOutboundSnat := *source.DisableOutboundSnat
		rule.DisableOutboundSnat = &disableOutboundSnat
	} else {
		rule.DisableOutboundSnat = nil
	}

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		rule.EnableFloatingIP = &enableFloatingIP
	} else {
		rule.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		rule.EnableTcpReset = &enableTcpReset
	} else {
		rule.EnableTcpReset = nil
	}

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource
		err := frontendIPConfiguration.Initialize_From_SubResource_STATUS(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		rule.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		rule.FrontendIPConfiguration = nil
	}

	// FrontendPort
	rule.FrontendPort = genruntime.ClonePointerToInt(source.FrontendPort)

	// IdleTimeoutInMinutes
	rule.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

	// LoadDistribution
	if source.LoadDistribution != nil {
		loadDistribution := genruntime.ToEnum(string(*source.LoadDistribution), loadBalancingRulePropertiesFormat_LoadDistribution_Values)
		rule.LoadDistribution = &loadDistribution
	} else {
		rule.LoadDistribution = nil
	}

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

	// Probe
	if source.Probe != nil {
		var probe SubResource
		err := probe.Initialize_From_SubResource_STATUS(source.Probe)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field Probe")
		}
		rule.Probe = &probe
	} else {
		rule.Probe = nil
	}

	// Protocol
	if source.Protocol != nil {
		protocol := genruntime.ToEnum(string(*source.Protocol), transportProtocol_Values)
		rule.Protocol = &protocol
	} else {
		rule.Protocol = nil
	}

	// No error
	return nil
}

// A load balancing rule for a load balancer.
type LoadBalancingRule_STATUS struct {
	// BackendAddressPool: A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend
	// IPs.
	BackendAddressPool *SubResource_STATUS `json:"backendAddressPool,omitempty"`

	// BackendAddressPools: An array of references to pool of DIPs.
	BackendAddressPools []SubResource_STATUS `json:"backendAddressPools,omitempty"`

	// BackendPort: The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note
	// that value 0 enables "Any Port".
	BackendPort *int `json:"backendPort,omitempty"`

	// DisableOutboundSnat: Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the
	// frontend of the load balancing rule.
	DisableOutboundSnat *bool `json:"disableOutboundSnat,omitempty"`

	// EnableFloatingIP: Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL
	// AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server.
	// This setting can't be changed after you create the endpoint.
	EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"`

	// EnableTcpReset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This
	// element is only used when the protocol is set to TCP.
	EnableTcpReset *bool `json:"enableTcpReset,omitempty"`

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

	// FrontendIPConfiguration: A reference to frontend IP addresses.
	FrontendIPConfiguration *SubResource_STATUS `json:"frontendIPConfiguration,omitempty"`

	// FrontendPort: The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer.
	// Acceptable values are between 0 and 65534. Note that value 0 enables "Any Port".
	FrontendPort *int `json:"frontendPort,omitempty"`

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

	// IdleTimeoutInMinutes: The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The
	// default value is 4 minutes. This element is only used when the protocol is set to TCP.
	IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`

	// LoadDistribution: The load distribution policy for this rule.
	LoadDistribution *LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS `json:"loadDistribution,omitempty"`

	// Name: The name of the resource that is unique within the set of load balancing rules used by the load balancer. This
	// name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// Probe: The reference to the load balancer probe used by the load balancing rule.
	Probe *SubResource_STATUS `json:"probe,omitempty"`

	// Protocol: The reference to the transport protocol used by the load balancing rule.
	Protocol *TransportProtocol_STATUS `json:"protocol,omitempty"`

	// ProvisioningState: The provisioning state of the load balancing rule resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

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

var _ genruntime.FromARMConverter = &LoadBalancingRule_STATUS{}

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

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

	// Set property "BackendAddressPool":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendAddressPool != nil {
			var backendAddressPool1 SubResource_STATUS
			err := backendAddressPool1.PopulateFromARM(owner, *typedInput.Properties.BackendAddressPool)
			if err != nil {
				return err
			}
			backendAddressPool := backendAddressPool1
			rule.BackendAddressPool = &backendAddressPool
		}
	}

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

	// Set property "BackendPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendPort != nil {
			backendPort := *typedInput.Properties.BackendPort
			rule.BackendPort = &backendPort
		}
	}

	// Set property "DisableOutboundSnat":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableOutboundSnat != nil {
			disableOutboundSnat := *typedInput.Properties.DisableOutboundSnat
			rule.DisableOutboundSnat = &disableOutboundSnat
		}
	}

	// Set property "EnableFloatingIP":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableFloatingIP != nil {
			enableFloatingIP := *typedInput.Properties.EnableFloatingIP
			rule.EnableFloatingIP = &enableFloatingIP
		}
	}

	// Set property "EnableTcpReset":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableTcpReset != nil {
			enableTcpReset := *typedInput.Properties.EnableTcpReset
			rule.EnableTcpReset = &enableTcpReset
		}
	}

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

	// Set property "FrontendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendIPConfiguration != nil {
			var frontendIPConfiguration1 SubResource_STATUS
			err := frontendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.FrontendIPConfiguration)
			if err != nil {
				return err
			}
			frontendIPConfiguration := frontendIPConfiguration1
			rule.FrontendIPConfiguration = &frontendIPConfiguration
		}
	}

	// Set property "FrontendPort":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FrontendPort != nil {
			frontendPort := *typedInput.Properties.FrontendPort
			rule.FrontendPort = &frontendPort
		}
	}

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

	// Set property "IdleTimeoutInMinutes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IdleTimeoutInMinutes != nil {
			idleTimeoutInMinutes := *typedInput.Properties.IdleTimeoutInMinutes
			rule.IdleTimeoutInMinutes = &idleTimeoutInMinutes
		}
	}

	// Set property "LoadDistribution":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LoadDistribution != nil {
			var temp string
			temp = string(*typedInput.Properties.LoadDistribution)
			loadDistribution := LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS(temp)
			rule.LoadDistribution = &loadDistribution
		}
	}

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

	// Set property "Probe":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Probe != nil {
			var probe1 SubResource_STATUS
			err := probe1.PopulateFromARM(owner, *typedInput.Properties.Probe)
			if err != nil {
				return err
			}
			probe := probe1
			rule.Probe = &probe
		}
	}

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := TransportProtocol_STATUS(temp)
			rule.Protocol = &protocol
		}
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_LoadBalancingRule_STATUS populates our LoadBalancingRule_STATUS from the provided source LoadBalancingRule_STATUS
func (rule *LoadBalancingRule_STATUS) AssignProperties_From_LoadBalancingRule_STATUS(source *storage.LoadBalancingRule_STATUS) error {

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource_STATUS
		err := backendAddressPool.AssignProperties_From_SubResource_STATUS(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field BackendAddressPool")
		}
		rule.BackendAddressPool = &backendAddressPool
	} else {
		rule.BackendAddressPool = nil
	}

	// BackendAddressPools
	if source.BackendAddressPools != nil {
		backendAddressPoolList := make([]SubResource_STATUS, len(source.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range source.BackendAddressPools {
			var backendAddressPool SubResource_STATUS
			err := backendAddressPool.AssignProperties_From_SubResource_STATUS(&backendAddressPoolItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		rule.BackendAddressPools = backendAddressPoolList
	} else {
		rule.BackendAddressPools = nil
	}

	// BackendPort
	rule.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// DisableOutboundSnat
	if source.DisableOutboundSnat != nil {
		disableOutboundSnat := *source.DisableOutboundSnat
		rule.DisableOutboundSnat = &disableOutboundSnat
	} else {
		rule.DisableOutboundSnat = nil
	}

	// EnableFloatingIP
	if source.EnableFloatingIP != nil {
		enableFloatingIP := *source.EnableFloatingIP
		rule.EnableFloatingIP = &enableFloatingIP
	} else {
		rule.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		rule.EnableTcpReset = &enableTcpReset
	} else {
		rule.EnableTcpReset = nil
	}

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

	// FrontendIPConfiguration
	if source.FrontendIPConfiguration != nil {
		var frontendIPConfiguration SubResource_STATUS
		err := frontendIPConfiguration.AssignProperties_From_SubResource_STATUS(source.FrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		rule.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		rule.FrontendIPConfiguration = nil
	}

	// FrontendPort
	rule.FrontendPort = genruntime.ClonePointerToInt(source.FrontendPort)

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

	// IdleTimeoutInMinutes
	rule.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

	// LoadDistribution
	if source.LoadDistribution != nil {
		loadDistribution := *source.LoadDistribution
		loadDistributionTemp := genruntime.ToEnum(loadDistribution, loadBalancingRulePropertiesFormat_LoadDistribution_STATUS_Values)
		rule.LoadDistribution = &loadDistributionTemp
	} else {
		rule.LoadDistribution = nil
	}

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

	// Probe
	if source.Probe != nil {
		var probe SubResource_STATUS
		err := probe.AssignProperties_From_SubResource_STATUS(source.Probe)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field Probe")
		}
		rule.Probe = &probe
	} else {
		rule.Probe = nil
	}

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, transportProtocol_STATUS_Values)
		rule.Protocol = &protocolTemp
	} else {
		rule.Protocol = nil
	}

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

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

	// No error
	return nil
}

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

	// BackendAddressPool
	if rule.BackendAddressPool != nil {
		var backendAddressPool storage.SubResource_STATUS
		err := rule.BackendAddressPool.AssignProperties_To_SubResource_STATUS(&backendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field BackendAddressPool")
		}
		destination.BackendAddressPool = &backendAddressPool
	} else {
		destination.BackendAddressPool = nil
	}

	// BackendAddressPools
	if rule.BackendAddressPools != nil {
		backendAddressPoolList := make([]storage.SubResource_STATUS, len(rule.BackendAddressPools))
		for backendAddressPoolIndex, backendAddressPoolItem := range rule.BackendAddressPools {
			var backendAddressPool storage.SubResource_STATUS
			err := backendAddressPoolItem.AssignProperties_To_SubResource_STATUS(&backendAddressPool)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field BackendAddressPools")
			}
			backendAddressPoolList[backendAddressPoolIndex] = backendAddressPool
		}
		destination.BackendAddressPools = backendAddressPoolList
	} else {
		destination.BackendAddressPools = nil
	}

	// BackendPort
	destination.BackendPort = genruntime.ClonePointerToInt(rule.BackendPort)

	// DisableOutboundSnat
	if rule.DisableOutboundSnat != nil {
		disableOutboundSnat := *rule.DisableOutboundSnat
		destination.DisableOutboundSnat = &disableOutboundSnat
	} else {
		destination.DisableOutboundSnat = nil
	}

	// EnableFloatingIP
	if rule.EnableFloatingIP != nil {
		enableFloatingIP := *rule.EnableFloatingIP
		destination.EnableFloatingIP = &enableFloatingIP
	} else {
		destination.EnableFloatingIP = nil
	}

	// EnableTcpReset
	if rule.EnableTcpReset != nil {
		enableTcpReset := *rule.EnableTcpReset
		destination.EnableTcpReset = &enableTcpReset
	} else {
		destination.EnableTcpReset = nil
	}

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

	// FrontendIPConfiguration
	if rule.FrontendIPConfiguration != nil {
		var frontendIPConfiguration storage.SubResource_STATUS
		err := rule.FrontendIPConfiguration.AssignProperties_To_SubResource_STATUS(&frontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field FrontendIPConfiguration")
		}
		destination.FrontendIPConfiguration = &frontendIPConfiguration
	} else {
		destination.FrontendIPConfiguration = nil
	}

	// FrontendPort
	destination.FrontendPort = genruntime.ClonePointerToInt(rule.FrontendPort)

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

	// IdleTimeoutInMinutes
	destination.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(rule.IdleTimeoutInMinutes)

	// LoadDistribution
	if rule.LoadDistribution != nil {
		loadDistribution := string(*rule.LoadDistribution)
		destination.LoadDistribution = &loadDistribution
	} else {
		destination.LoadDistribution = nil
	}

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

	// Probe
	if rule.Probe != nil {
		var probe storage.SubResource_STATUS
		err := rule.Probe.AssignProperties_To_SubResource_STATUS(&probe)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field Probe")
		}
		destination.Probe = &probe
	} else {
		destination.Probe = nil
	}

	// Protocol
	if rule.Protocol != nil {
		protocol := string(*rule.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

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

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

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

	// No error
	return nil
}

// Outbound rule of the load balancer.
type OutboundRule struct {
	// AllocatedOutboundPorts: The number of outbound ports to be used for NAT.
	AllocatedOutboundPorts *int `json:"allocatedOutboundPorts,omitempty"`

	// +kubebuilder:validation:Required
	// BackendAddressPool: A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend
	// IPs.
	BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"`

	// EnableTcpReset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This
	// element is only used when the protocol is set to TCP.
	EnableTcpReset *bool `json:"enableTcpReset,omitempty"`

	// +kubebuilder:validation:Required
	// FrontendIPConfigurations: The Frontend IP addresses of the load balancer.
	FrontendIPConfigurations []SubResource `json:"frontendIPConfigurations,omitempty"`

	// IdleTimeoutInMinutes: The timeout for the TCP idle connection.
	IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`

	// Name: The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can
	// be used to access the resource.
	Name *string `json:"name,omitempty"`

	// +kubebuilder:validation:Required
	// Protocol: The protocol for the outbound rule in load balancer.
	Protocol *OutboundRulePropertiesFormat_Protocol `json:"protocol,omitempty"`
}

var _ genruntime.ARMTransformer = &OutboundRule{}

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

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

	// Set property "Properties":
	if rule.AllocatedOutboundPorts != nil ||
		rule.BackendAddressPool != nil ||
		rule.EnableTcpReset != nil ||
		rule.FrontendIPConfigurations != nil ||
		rule.IdleTimeoutInMinutes != nil ||
		rule.Protocol != nil {
		result.Properties = &arm.OutboundRulePropertiesFormat{}
	}
	if rule.AllocatedOutboundPorts != nil {
		allocatedOutboundPorts := *rule.AllocatedOutboundPorts
		result.Properties.AllocatedOutboundPorts = &allocatedOutboundPorts
	}
	if rule.BackendAddressPool != nil {
		backendAddressPool_ARM, err := rule.BackendAddressPool.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		backendAddressPool := *backendAddressPool_ARM.(*arm.SubResource)
		result.Properties.BackendAddressPool = &backendAddressPool
	}
	if rule.EnableTcpReset != nil {
		enableTcpReset := *rule.EnableTcpReset
		result.Properties.EnableTcpReset = &enableTcpReset
	}
	for _, item := range rule.FrontendIPConfigurations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.FrontendIPConfigurations = append(result.Properties.FrontendIPConfigurations, *item_ARM.(*arm.SubResource))
	}
	if rule.IdleTimeoutInMinutes != nil {
		idleTimeoutInMinutes := *rule.IdleTimeoutInMinutes
		result.Properties.IdleTimeoutInMinutes = &idleTimeoutInMinutes
	}
	if rule.Protocol != nil {
		var temp string
		temp = string(*rule.Protocol)
		protocol := arm.OutboundRulePropertiesFormat_Protocol(temp)
		result.Properties.Protocol = &protocol
	}
	return result, nil
}

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

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

	// Set property "AllocatedOutboundPorts":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AllocatedOutboundPorts != nil {
			allocatedOutboundPorts := *typedInput.Properties.AllocatedOutboundPorts
			rule.AllocatedOutboundPorts = &allocatedOutboundPorts
		}
	}

	// Set property "BackendAddressPool":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendAddressPool != nil {
			var backendAddressPool1 SubResource
			err := backendAddressPool1.PopulateFromARM(owner, *typedInput.Properties.BackendAddressPool)
			if err != nil {
				return err
			}
			backendAddressPool := backendAddressPool1
			rule.BackendAddressPool = &backendAddressPool
		}
	}

	// Set property "EnableTcpReset":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableTcpReset != nil {
			enableTcpReset := *typedInput.Properties.EnableTcpReset
			rule.EnableTcpReset = &enableTcpReset
		}
	}

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

	// Set property "IdleTimeoutInMinutes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IdleTimeoutInMinutes != nil {
			idleTimeoutInMinutes := *typedInput.Properties.IdleTimeoutInMinutes
			rule.IdleTimeoutInMinutes = &idleTimeoutInMinutes
		}
	}

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

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := OutboundRulePropertiesFormat_Protocol(temp)
			rule.Protocol = &protocol
		}
	}

	// No error
	return nil
}

// AssignProperties_From_OutboundRule populates our OutboundRule from the provided source OutboundRule
func (rule *OutboundRule) AssignProperties_From_OutboundRule(source *storage.OutboundRule) error {

	// AllocatedOutboundPorts
	rule.AllocatedOutboundPorts = genruntime.ClonePointerToInt(source.AllocatedOutboundPorts)

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource
		err := backendAddressPool.AssignProperties_From_SubResource(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field BackendAddressPool")
		}
		rule.BackendAddressPool = &backendAddressPool
	} else {
		rule.BackendAddressPool = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		rule.EnableTcpReset = &enableTcpReset
	} else {
		rule.EnableTcpReset = nil
	}

	// FrontendIPConfigurations
	if source.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]SubResource, len(source.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range source.FrontendIPConfigurations {
			var frontendIPConfiguration SubResource
			err := frontendIPConfiguration.AssignProperties_From_SubResource(&frontendIPConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		rule.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		rule.FrontendIPConfigurations = nil
	}

	// IdleTimeoutInMinutes
	rule.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, outboundRulePropertiesFormat_Protocol_Values)
		rule.Protocol = &protocolTemp
	} else {
		rule.Protocol = nil
	}

	// No error
	return nil
}

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

	// AllocatedOutboundPorts
	destination.AllocatedOutboundPorts = genruntime.ClonePointerToInt(rule.AllocatedOutboundPorts)

	// BackendAddressPool
	if rule.BackendAddressPool != nil {
		var backendAddressPool storage.SubResource
		err := rule.BackendAddressPool.AssignProperties_To_SubResource(&backendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field BackendAddressPool")
		}
		destination.BackendAddressPool = &backendAddressPool
	} else {
		destination.BackendAddressPool = nil
	}

	// EnableTcpReset
	if rule.EnableTcpReset != nil {
		enableTcpReset := *rule.EnableTcpReset
		destination.EnableTcpReset = &enableTcpReset
	} else {
		destination.EnableTcpReset = nil
	}

	// FrontendIPConfigurations
	if rule.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]storage.SubResource, len(rule.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range rule.FrontendIPConfigurations {
			var frontendIPConfiguration storage.SubResource
			err := frontendIPConfigurationItem.AssignProperties_To_SubResource(&frontendIPConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		destination.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		destination.FrontendIPConfigurations = nil
	}

	// IdleTimeoutInMinutes
	destination.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(rule.IdleTimeoutInMinutes)

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

	// Protocol
	if rule.Protocol != nil {
		protocol := string(*rule.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

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

	// No error
	return nil
}

// Initialize_From_OutboundRule_STATUS populates our OutboundRule from the provided source OutboundRule_STATUS
func (rule *OutboundRule) Initialize_From_OutboundRule_STATUS(source *OutboundRule_STATUS) error {

	// AllocatedOutboundPorts
	rule.AllocatedOutboundPorts = genruntime.ClonePointerToInt(source.AllocatedOutboundPorts)

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource
		err := backendAddressPool.Initialize_From_SubResource_STATUS(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field BackendAddressPool")
		}
		rule.BackendAddressPool = &backendAddressPool
	} else {
		rule.BackendAddressPool = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		rule.EnableTcpReset = &enableTcpReset
	} else {
		rule.EnableTcpReset = nil
	}

	// FrontendIPConfigurations
	if source.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]SubResource, len(source.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range source.FrontendIPConfigurations {
			var frontendIPConfiguration SubResource
			err := frontendIPConfiguration.Initialize_From_SubResource_STATUS(&frontendIPConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		rule.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		rule.FrontendIPConfigurations = nil
	}

	// IdleTimeoutInMinutes
	rule.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := genruntime.ToEnum(string(*source.Protocol), outboundRulePropertiesFormat_Protocol_Values)
		rule.Protocol = &protocol
	} else {
		rule.Protocol = nil
	}

	// No error
	return nil
}

// Outbound rule of the load balancer.
type OutboundRule_STATUS struct {
	// AllocatedOutboundPorts: The number of outbound ports to be used for NAT.
	AllocatedOutboundPorts *int `json:"allocatedOutboundPorts,omitempty"`

	// BackendAddressPool: A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend
	// IPs.
	BackendAddressPool *SubResource_STATUS `json:"backendAddressPool,omitempty"`

	// EnableTcpReset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This
	// element is only used when the protocol is set to TCP.
	EnableTcpReset *bool `json:"enableTcpReset,omitempty"`

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

	// FrontendIPConfigurations: The Frontend IP addresses of the load balancer.
	FrontendIPConfigurations []SubResource_STATUS `json:"frontendIPConfigurations,omitempty"`

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

	// IdleTimeoutInMinutes: The timeout for the TCP idle connection.
	IdleTimeoutInMinutes *int `json:"idleTimeoutInMinutes,omitempty"`

	// Name: The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can
	// be used to access the resource.
	Name *string `json:"name,omitempty"`

	// Protocol: The protocol for the outbound rule in load balancer.
	Protocol *OutboundRulePropertiesFormat_Protocol_STATUS `json:"protocol,omitempty"`

	// ProvisioningState: The provisioning state of the outbound rule resource.
	ProvisioningState *ProvisioningState_STATUS `json:"provisioningState,omitempty"`

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

var _ genruntime.FromARMConverter = &OutboundRule_STATUS{}

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

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

	// Set property "AllocatedOutboundPorts":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AllocatedOutboundPorts != nil {
			allocatedOutboundPorts := *typedInput.Properties.AllocatedOutboundPorts
			rule.AllocatedOutboundPorts = &allocatedOutboundPorts
		}
	}

	// Set property "BackendAddressPool":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackendAddressPool != nil {
			var backendAddressPool1 SubResource_STATUS
			err := backendAddressPool1.PopulateFromARM(owner, *typedInput.Properties.BackendAddressPool)
			if err != nil {
				return err
			}
			backendAddressPool := backendAddressPool1
			rule.BackendAddressPool = &backendAddressPool
		}
	}

	// Set property "EnableTcpReset":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableTcpReset != nil {
			enableTcpReset := *typedInput.Properties.EnableTcpReset
			rule.EnableTcpReset = &enableTcpReset
		}
	}

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

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

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

	// Set property "IdleTimeoutInMinutes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IdleTimeoutInMinutes != nil {
			idleTimeoutInMinutes := *typedInput.Properties.IdleTimeoutInMinutes
			rule.IdleTimeoutInMinutes = &idleTimeoutInMinutes
		}
	}

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

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := OutboundRulePropertiesFormat_Protocol_STATUS(temp)
			rule.Protocol = &protocol
		}
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_OutboundRule_STATUS populates our OutboundRule_STATUS from the provided source OutboundRule_STATUS
func (rule *OutboundRule_STATUS) AssignProperties_From_OutboundRule_STATUS(source *storage.OutboundRule_STATUS) error {

	// AllocatedOutboundPorts
	rule.AllocatedOutboundPorts = genruntime.ClonePointerToInt(source.AllocatedOutboundPorts)

	// BackendAddressPool
	if source.BackendAddressPool != nil {
		var backendAddressPool SubResource_STATUS
		err := backendAddressPool.AssignProperties_From_SubResource_STATUS(source.BackendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field BackendAddressPool")
		}
		rule.BackendAddressPool = &backendAddressPool
	} else {
		rule.BackendAddressPool = nil
	}

	// EnableTcpReset
	if source.EnableTcpReset != nil {
		enableTcpReset := *source.EnableTcpReset
		rule.EnableTcpReset = &enableTcpReset
	} else {
		rule.EnableTcpReset = nil
	}

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

	// FrontendIPConfigurations
	if source.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]SubResource_STATUS, len(source.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range source.FrontendIPConfigurations {
			var frontendIPConfiguration SubResource_STATUS
			err := frontendIPConfiguration.AssignProperties_From_SubResource_STATUS(&frontendIPConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		rule.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		rule.FrontendIPConfigurations = nil
	}

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

	// IdleTimeoutInMinutes
	rule.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(source.IdleTimeoutInMinutes)

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

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, outboundRulePropertiesFormat_Protocol_STATUS_Values)
		rule.Protocol = &protocolTemp
	} else {
		rule.Protocol = nil
	}

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

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

	// No error
	return nil
}

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

	// AllocatedOutboundPorts
	destination.AllocatedOutboundPorts = genruntime.ClonePointerToInt(rule.AllocatedOutboundPorts)

	// BackendAddressPool
	if rule.BackendAddressPool != nil {
		var backendAddressPool storage.SubResource_STATUS
		err := rule.BackendAddressPool.AssignProperties_To_SubResource_STATUS(&backendAddressPool)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field BackendAddressPool")
		}
		destination.BackendAddressPool = &backendAddressPool
	} else {
		destination.BackendAddressPool = nil
	}

	// EnableTcpReset
	if rule.EnableTcpReset != nil {
		enableTcpReset := *rule.EnableTcpReset
		destination.EnableTcpReset = &enableTcpReset
	} else {
		destination.EnableTcpReset = nil
	}

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

	// FrontendIPConfigurations
	if rule.FrontendIPConfigurations != nil {
		frontendIPConfigurationList := make([]storage.SubResource_STATUS, len(rule.FrontendIPConfigurations))
		for frontendIPConfigurationIndex, frontendIPConfigurationItem := range rule.FrontendIPConfigurations {
			var frontendIPConfiguration storage.SubResource_STATUS
			err := frontendIPConfigurationItem.AssignProperties_To_SubResource_STATUS(&frontendIPConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field FrontendIPConfigurations")
			}
			frontendIPConfigurationList[frontendIPConfigurationIndex] = frontendIPConfiguration
		}
		destination.FrontendIPConfigurations = frontendIPConfigurationList
	} else {
		destination.FrontendIPConfigurations = nil
	}

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

	// IdleTimeoutInMinutes
	destination.IdleTimeoutInMinutes = genruntime.ClonePointerToInt(rule.IdleTimeoutInMinutes)

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

	// Protocol
	if rule.Protocol != nil {
		protocol := string(*rule.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

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

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

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

	// No error
	return nil
}

// A load balancer probe.
type Probe struct {
	// IntervalInSeconds: The interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the
	// interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking
	// the instance out of rotation. The default value is 15, the minimum value is 5.
	IntervalInSeconds *int `json:"intervalInSeconds,omitempty"`

	// Name: The name of the resource that is unique within the set of probes used by the load balancer. This name can be used
	// to access the resource.
	Name *string `json:"name,omitempty"`

	// NoHealthyBackendsBehavior: Determines how new connections are handled by the load balancer when all backend instances
	// are probed down.
	NoHealthyBackendsBehavior *ProbePropertiesFormat_NoHealthyBackendsBehavior `json:"noHealthyBackendsBehavior,omitempty"`

	// NumberOfProbes: The number of probes where if no response, will result in stopping further traffic from being delivered
	// to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used
	// in Azure.
	NumberOfProbes *int `json:"numberOfProbes,omitempty"`

	// +kubebuilder:validation:Required
	// Port: The port for communicating the probe. Possible values range from 1 to 65535, inclusive.
	Port *int `json:"port,omitempty"`

	// ProbeThreshold: The number of consecutive successful or failed probes in order to allow or deny traffic from being
	// delivered to this endpoint. After failing the number of consecutive probes equal to this value, the endpoint will be
	// taken out of rotation and require the same number of successful consecutive probes to be placed back in rotation.
	ProbeThreshold *int `json:"probeThreshold,omitempty"`

	// +kubebuilder:validation:Required
	// Protocol: The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be
	// successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required for the probe to be
	// successful.
	Protocol *ProbePropertiesFormat_Protocol `json:"protocol,omitempty"`

	// RequestPath: The URI used for requesting health status from the VM. Path is required if a protocol is set to http.
	// Otherwise, it is not allowed. There is no default value.
	RequestPath *string `json:"requestPath,omitempty"`
}

var _ genruntime.ARMTransformer = &Probe{}

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

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

	// Set property "Properties":
	if probe.IntervalInSeconds != nil ||
		probe.NoHealthyBackendsBehavior != nil ||
		probe.NumberOfProbes != nil ||
		probe.Port != nil ||
		probe.ProbeThreshold != nil ||
		probe.Protocol != nil ||
		probe.RequestPath != nil {
		result.Properties = &arm.ProbePropertiesFormat{}
	}
	if probe.IntervalInSeconds != nil {
		intervalInSeconds := *probe.IntervalInSeconds
		result.Properties.IntervalInSeconds = &intervalInSeconds
	}
	if probe.NoHealthyBackendsBehavior != nil {
		var temp string
		temp = string(*probe.NoHealthyBackendsBehavior)
		noHealthyBackendsBehavior := arm.ProbePropertiesFormat_NoHealthyBackendsBehavior(temp)
		result.Properties.NoHealthyBackendsBehavior = &noHealthyBackendsBehavior
	}
	if probe.NumberOfProbes != nil {
		numberOfProbes := *probe.NumberOfProbes
		result.Properties.NumberOfProbes = &numberOfProbes
	}
	if probe.Port != nil {
		port := *probe.Port
		result.Properties.Port = &port
	}
	if probe.ProbeThreshold != nil {
		probeThreshold := *probe.ProbeThreshold
		result.Properties.ProbeThreshold = &probeThreshold
	}
	if probe.Protocol != nil {
		var temp string
		temp = string(*probe.Protocol)
		protocol := arm.ProbePropertiesFormat_Protocol(temp)
		result.Properties.Protocol = &protocol
	}
	if probe.RequestPath != nil {
		requestPath := *probe.RequestPath
		result.Properties.RequestPath = &requestPath
	}
	return result, nil
}

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

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

	// Set property "IntervalInSeconds":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IntervalInSeconds != nil {
			intervalInSeconds := *typedInput.Properties.IntervalInSeconds
			probe.IntervalInSeconds = &intervalInSeconds
		}
	}

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

	// Set property "NoHealthyBackendsBehavior":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NoHealthyBackendsBehavior != nil {
			var temp string
			temp = string(*typedInput.Properties.NoHealthyBackendsBehavior)
			noHealthyBackendsBehavior := ProbePropertiesFormat_NoHealthyBackendsBehavior(temp)
			probe.NoHealthyBackendsBehavior = &noHealthyBackendsBehavior
		}
	}

	// Set property "NumberOfProbes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NumberOfProbes != nil {
			numberOfProbes := *typedInput.Properties.NumberOfProbes
			probe.NumberOfProbes = &numberOfProbes
		}
	}

	// Set property "Port":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Port != nil {
			port := *typedInput.Properties.Port
			probe.Port = &port
		}
	}

	// Set property "ProbeThreshold":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProbeThreshold != nil {
			probeThreshold := *typedInput.Properties.ProbeThreshold
			probe.ProbeThreshold = &probeThreshold
		}
	}

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := ProbePropertiesFormat_Protocol(temp)
			probe.Protocol = &protocol
		}
	}

	// Set property "RequestPath":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RequestPath != nil {
			requestPath := *typedInput.Properties.RequestPath
			probe.RequestPath = &requestPath
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Probe populates our Probe from the provided source Probe
func (probe *Probe) AssignProperties_From_Probe(source *storage.Probe) error {

	// IntervalInSeconds
	probe.IntervalInSeconds = genruntime.ClonePointerToInt(source.IntervalInSeconds)

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

	// NoHealthyBackendsBehavior
	if source.NoHealthyBackendsBehavior != nil {
		noHealthyBackendsBehavior := *source.NoHealthyBackendsBehavior
		noHealthyBackendsBehaviorTemp := genruntime.ToEnum(noHealthyBackendsBehavior, probePropertiesFormat_NoHealthyBackendsBehavior_Values)
		probe.NoHealthyBackendsBehavior = &noHealthyBackendsBehaviorTemp
	} else {
		probe.NoHealthyBackendsBehavior = nil
	}

	// NumberOfProbes
	probe.NumberOfProbes = genruntime.ClonePointerToInt(source.NumberOfProbes)

	// Port
	probe.Port = genruntime.ClonePointerToInt(source.Port)

	// ProbeThreshold
	probe.ProbeThreshold = genruntime.ClonePointerToInt(source.ProbeThreshold)

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, probePropertiesFormat_Protocol_Values)
		probe.Protocol = &protocolTemp
	} else {
		probe.Protocol = nil
	}

	// RequestPath
	probe.RequestPath = genruntime.ClonePointerToString(source.RequestPath)

	// No error
	return nil
}

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

	// IntervalInSeconds
	destination.IntervalInSeconds = genruntime.ClonePointerToInt(probe.IntervalInSeconds)

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

	// NoHealthyBackendsBehavior
	if probe.NoHealthyBackendsBehavior != nil {
		noHealthyBackendsBehavior := string(*probe.NoHealthyBackendsBehavior)
		destination.NoHealthyBackendsBehavior = &noHealthyBackendsBehavior
	} else {
		destination.NoHealthyBackendsBehavior = nil
	}

	// NumberOfProbes
	destination.NumberOfProbes = genruntime.ClonePointerToInt(probe.NumberOfProbes)

	// Port
	destination.Port = genruntime.ClonePointerToInt(probe.Port)

	// ProbeThreshold
	destination.ProbeThreshold = genruntime.ClonePointerToInt(probe.ProbeThreshold)

	// Protocol
	if probe.Protocol != nil {
		protocol := string(*probe.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

	// RequestPath
	destination.RequestPath = genruntime.ClonePointerToString(probe.RequestPath)

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

	// No error
	return nil
}

// Initialize_From_Probe_STATUS populates our Probe from the provided source Probe_STATUS
func (probe *Probe) Initialize_From_Probe_STATUS(source *Probe_STATUS) error {

	// IntervalInSeconds
	probe.IntervalInSeconds = genruntime.ClonePointerToInt(source.IntervalInSeconds)

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

	// NoHealthyBackendsBehavior
	if source.NoHealthyBackendsBehavior != nil {
		noHealthyBackendsBehavior := genruntime.ToEnum(string(*source.NoHealthyBackendsBehavior), probePropertiesFormat_NoHealthyBackendsBehavior_Values)
		probe.NoHealthyBackendsBehavior = &noHealthyBackendsBehavior
	} else {
		probe.NoHealthyBackendsBehavior = nil
	}

	// NumberOfProbes
	probe.NumberOfProbes = genruntime.ClonePointerToInt(source.NumberOfProbes)

	// Port
	probe.Port = genruntime.ClonePointerToInt(source.Port)

	// ProbeThreshold
	probe.ProbeThreshold = genruntime.ClonePointerToInt(source.ProbeThreshold)

	// Protocol
	if source.Protocol != nil {
		protocol := genruntime.ToEnum(string(*source.Protocol), probePropertiesFormat_Protocol_Values)
		probe.Protocol = &protocol
	} else {
		probe.Protocol = nil
	}

	// RequestPath
	probe.RequestPath = genruntime.ClonePointerToString(source.RequestPath)

	// No error
	return nil
}

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

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

	// IntervalInSeconds: The interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the
	// interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking
	// the instance out of rotation. The default value is 15, the minimum value is 5.
	IntervalInSeconds *int `json:"intervalInSeconds,omitempty"`

	// LoadBalancingRules: The load balancer rules that use this probe.
	LoadBalancingRules []SubResource_STATUS `json:"loadBalancingRules,omitempty"`

	// Name: The name of the resource that is unique within the set of probes used by the load balancer. This name can be used
	// to access the resource.
	Name *string `json:"name,omitempty"`

	// NoHealthyBackendsBehavior: Determines how new connections are handled by the load balancer when all backend instances
	// are probed down.
	NoHealthyBackendsBehavior *ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS `json:"noHealthyBackendsBehavior,omitempty"`

	// NumberOfProbes: The number of probes where if no response, will result in stopping further traffic from being delivered
	// to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used
	// in Azure.
	NumberOfProbes *int `json:"numberOfProbes,omitempty"`

	// Port: The port for communicating the probe. Possible values range from 1 to 65535, inclusive.
	Port *int `json:"port,omitempty"`

	// ProbeThreshold: The number of consecutive successful or failed probes in order to allow or deny traffic from being
	// delivered to this endpoint. After failing the number of consecutive probes equal to this value, the endpoint will be
	// taken out of rotation and require the same number of successful consecutive probes to be placed back in rotation.
	ProbeThreshold *int `json:"probeThreshold,omitempty"`

	// Protocol: The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be
	// successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required for the probe to be
	// successful.
	Protocol *ProbePropertiesFormat_Protocol_STATUS `json:"protocol,omitempty"`

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

	// RequestPath: The URI used for requesting health status from the VM. Path is required if a protocol is set to http.
	// Otherwise, it is not allowed. There is no default value.
	RequestPath *string `json:"requestPath,omitempty"`

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

var _ genruntime.FromARMConverter = &Probe_STATUS{}

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

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

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

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

	// Set property "IntervalInSeconds":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IntervalInSeconds != nil {
			intervalInSeconds := *typedInput.Properties.IntervalInSeconds
			probe.IntervalInSeconds = &intervalInSeconds
		}
	}

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

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

	// Set property "NoHealthyBackendsBehavior":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NoHealthyBackendsBehavior != nil {
			var temp string
			temp = string(*typedInput.Properties.NoHealthyBackendsBehavior)
			noHealthyBackendsBehavior := ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS(temp)
			probe.NoHealthyBackendsBehavior = &noHealthyBackendsBehavior
		}
	}

	// Set property "NumberOfProbes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NumberOfProbes != nil {
			numberOfProbes := *typedInput.Properties.NumberOfProbes
			probe.NumberOfProbes = &numberOfProbes
		}
	}

	// Set property "Port":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Port != nil {
			port := *typedInput.Properties.Port
			probe.Port = &port
		}
	}

	// Set property "ProbeThreshold":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProbeThreshold != nil {
			probeThreshold := *typedInput.Properties.ProbeThreshold
			probe.ProbeThreshold = &probeThreshold
		}
	}

	// Set property "Protocol":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Protocol != nil {
			var temp string
			temp = string(*typedInput.Properties.Protocol)
			protocol := ProbePropertiesFormat_Protocol_STATUS(temp)
			probe.Protocol = &protocol
		}
	}

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

	// Set property "RequestPath":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RequestPath != nil {
			requestPath := *typedInput.Properties.RequestPath
			probe.RequestPath = &requestPath
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_Probe_STATUS populates our Probe_STATUS from the provided source Probe_STATUS
func (probe *Probe_STATUS) AssignProperties_From_Probe_STATUS(source *storage.Probe_STATUS) error {

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

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

	// IntervalInSeconds
	probe.IntervalInSeconds = genruntime.ClonePointerToInt(source.IntervalInSeconds)

	// LoadBalancingRules
	if source.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]SubResource_STATUS, len(source.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range source.LoadBalancingRules {
			var loadBalancingRule SubResource_STATUS
			err := loadBalancingRule.AssignProperties_From_SubResource_STATUS(&loadBalancingRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		probe.LoadBalancingRules = loadBalancingRuleList
	} else {
		probe.LoadBalancingRules = nil
	}

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

	// NoHealthyBackendsBehavior
	if source.NoHealthyBackendsBehavior != nil {
		noHealthyBackendsBehavior := *source.NoHealthyBackendsBehavior
		noHealthyBackendsBehaviorTemp := genruntime.ToEnum(noHealthyBackendsBehavior, probePropertiesFormat_NoHealthyBackendsBehavior_STATUS_Values)
		probe.NoHealthyBackendsBehavior = &noHealthyBackendsBehaviorTemp
	} else {
		probe.NoHealthyBackendsBehavior = nil
	}

	// NumberOfProbes
	probe.NumberOfProbes = genruntime.ClonePointerToInt(source.NumberOfProbes)

	// Port
	probe.Port = genruntime.ClonePointerToInt(source.Port)

	// ProbeThreshold
	probe.ProbeThreshold = genruntime.ClonePointerToInt(source.ProbeThreshold)

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, probePropertiesFormat_Protocol_STATUS_Values)
		probe.Protocol = &protocolTemp
	} else {
		probe.Protocol = nil
	}

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

	// RequestPath
	probe.RequestPath = genruntime.ClonePointerToString(source.RequestPath)

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

	// No error
	return nil
}

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

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

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

	// IntervalInSeconds
	destination.IntervalInSeconds = genruntime.ClonePointerToInt(probe.IntervalInSeconds)

	// LoadBalancingRules
	if probe.LoadBalancingRules != nil {
		loadBalancingRuleList := make([]storage.SubResource_STATUS, len(probe.LoadBalancingRules))
		for loadBalancingRuleIndex, loadBalancingRuleItem := range probe.LoadBalancingRules {
			var loadBalancingRule storage.SubResource_STATUS
			err := loadBalancingRuleItem.AssignProperties_To_SubResource_STATUS(&loadBalancingRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field LoadBalancingRules")
			}
			loadBalancingRuleList[loadBalancingRuleIndex] = loadBalancingRule
		}
		destination.LoadBalancingRules = loadBalancingRuleList
	} else {
		destination.LoadBalancingRules = nil
	}

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

	// NoHealthyBackendsBehavior
	if probe.NoHealthyBackendsBehavior != nil {
		noHealthyBackendsBehavior := string(*probe.NoHealthyBackendsBehavior)
		destination.NoHealthyBackendsBehavior = &noHealthyBackendsBehavior
	} else {
		destination.NoHealthyBackendsBehavior = nil
	}

	// NumberOfProbes
	destination.NumberOfProbes = genruntime.ClonePointerToInt(probe.NumberOfProbes)

	// Port
	destination.Port = genruntime.ClonePointerToInt(probe.Port)

	// ProbeThreshold
	destination.ProbeThreshold = genruntime.ClonePointerToInt(probe.ProbeThreshold)

	// Protocol
	if probe.Protocol != nil {
		protocol := string(*probe.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

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

	// RequestPath
	destination.RequestPath = genruntime.ClonePointerToString(probe.RequestPath)

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Automatic","Manual"}
type BackendAddressPoolPropertiesFormat_SyncMode string

const (
	BackendAddressPoolPropertiesFormat_SyncMode_Automatic = BackendAddressPoolPropertiesFormat_SyncMode("Automatic")
	BackendAddressPoolPropertiesFormat_SyncMode_Manual    = BackendAddressPoolPropertiesFormat_SyncMode("Manual")
)

// Mapping from string to BackendAddressPoolPropertiesFormat_SyncMode
var backendAddressPoolPropertiesFormat_SyncMode_Values = map[string]BackendAddressPoolPropertiesFormat_SyncMode{
	"automatic": BackendAddressPoolPropertiesFormat_SyncMode_Automatic,
	"manual":    BackendAddressPoolPropertiesFormat_SyncMode_Manual,
}

type BackendAddressPoolPropertiesFormat_SyncMode_STATUS string

const (
	BackendAddressPoolPropertiesFormat_SyncMode_STATUS_Automatic = BackendAddressPoolPropertiesFormat_SyncMode_STATUS("Automatic")
	BackendAddressPoolPropertiesFormat_SyncMode_STATUS_Manual    = BackendAddressPoolPropertiesFormat_SyncMode_STATUS("Manual")
)

// Mapping from string to BackendAddressPoolPropertiesFormat_SyncMode_STATUS
var backendAddressPoolPropertiesFormat_SyncMode_STATUS_Values = map[string]BackendAddressPoolPropertiesFormat_SyncMode_STATUS{
	"automatic": BackendAddressPoolPropertiesFormat_SyncMode_STATUS_Automatic,
	"manual":    BackendAddressPoolPropertiesFormat_SyncMode_STATUS_Manual,
}

// The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network resources.
// +kubebuilder:validation:Enum={"EdgeZone"}
type ExtendedLocationType string

const ExtendedLocationType_EdgeZone = ExtendedLocationType("EdgeZone")

// Mapping from string to ExtendedLocationType
var extendedLocationType_Values = map[string]ExtendedLocationType{
	"edgezone": ExtendedLocationType_EdgeZone,
}

// The supported ExtendedLocation types. Currently only EdgeZone is supported in Microsoft.Network resources.
type ExtendedLocationType_STATUS string

const ExtendedLocationType_STATUS_EdgeZone = ExtendedLocationType_STATUS("EdgeZone")

// Mapping from string to ExtendedLocationType_STATUS
var extendedLocationType_STATUS_Values = map[string]ExtendedLocationType_STATUS{
	"edgezone": ExtendedLocationType_STATUS_EdgeZone,
}

// Gateway load balancer tunnel interface of a load balancer backend address pool.
type GatewayLoadBalancerTunnelInterface struct {
	// Identifier: Identifier of gateway load balancer tunnel interface.
	Identifier *int `json:"identifier,omitempty"`

	// Port: Port of gateway load balancer tunnel interface.
	Port *int `json:"port,omitempty"`

	// Protocol: Protocol of gateway load balancer tunnel interface.
	Protocol *GatewayLoadBalancerTunnelInterface_Protocol `json:"protocol,omitempty"`

	// Type: Traffic type of gateway load balancer tunnel interface.
	Type *GatewayLoadBalancerTunnelInterface_Type `json:"type,omitempty"`
}

var _ genruntime.ARMTransformer = &GatewayLoadBalancerTunnelInterface{}

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

	// Set property "Identifier":
	if tunnelInterface.Identifier != nil {
		identifier := *tunnelInterface.Identifier
		result.Identifier = &identifier
	}

	// Set property "Port":
	if tunnelInterface.Port != nil {
		port := *tunnelInterface.Port
		result.Port = &port
	}

	// Set property "Protocol":
	if tunnelInterface.Protocol != nil {
		var temp string
		temp = string(*tunnelInterface.Protocol)
		protocol := arm.GatewayLoadBalancerTunnelInterface_Protocol(temp)
		result.Protocol = &protocol
	}

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

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

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

	// Set property "Identifier":
	if typedInput.Identifier != nil {
		identifier := *typedInput.Identifier
		tunnelInterface.Identifier = &identifier
	}

	// Set property "Port":
	if typedInput.Port != nil {
		port := *typedInput.Port
		tunnelInterface.Port = &port
	}

	// Set property "Protocol":
	if typedInput.Protocol != nil {
		var temp string
		temp = string(*typedInput.Protocol)
		protocol := GatewayLoadBalancerTunnelInterface_Protocol(temp)
		tunnelInterface.Protocol = &protocol
	}

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

	// No error
	return nil
}

// AssignProperties_From_GatewayLoadBalancerTunnelInterface populates our GatewayLoadBalancerTunnelInterface from the provided source GatewayLoadBalancerTunnelInterface
func (tunnelInterface *GatewayLoadBalancerTunnelInterface) AssignProperties_From_GatewayLoadBalancerTunnelInterface(source *storage.GatewayLoadBalancerTunnelInterface) error {

	// Identifier
	tunnelInterface.Identifier = genruntime.ClonePointerToInt(source.Identifier)

	// Port
	tunnelInterface.Port = genruntime.ClonePointerToInt(source.Port)

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, gatewayLoadBalancerTunnelInterface_Protocol_Values)
		tunnelInterface.Protocol = &protocolTemp
	} else {
		tunnelInterface.Protocol = nil
	}

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

	// No error
	return nil
}

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

	// Identifier
	destination.Identifier = genruntime.ClonePointerToInt(tunnelInterface.Identifier)

	// Port
	destination.Port = genruntime.ClonePointerToInt(tunnelInterface.Port)

	// Protocol
	if tunnelInterface.Protocol != nil {
		protocol := string(*tunnelInterface.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

	// Type
	if tunnelInterface.Type != nil {
		typeVar := string(*tunnelInterface.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_GatewayLoadBalancerTunnelInterface_STATUS populates our GatewayLoadBalancerTunnelInterface from the provided source GatewayLoadBalancerTunnelInterface_STATUS
func (tunnelInterface *GatewayLoadBalancerTunnelInterface) Initialize_From_GatewayLoadBalancerTunnelInterface_STATUS(source *GatewayLoadBalancerTunnelInterface_STATUS) error {

	// Identifier
	tunnelInterface.Identifier = genruntime.ClonePointerToInt(source.Identifier)

	// Port
	tunnelInterface.Port = genruntime.ClonePointerToInt(source.Port)

	// Protocol
	if source.Protocol != nil {
		protocol := genruntime.ToEnum(string(*source.Protocol), gatewayLoadBalancerTunnelInterface_Protocol_Values)
		tunnelInterface.Protocol = &protocol
	} else {
		tunnelInterface.Protocol = nil
	}

	// Type
	if source.Type != nil {
		typeVar := genruntime.ToEnum(string(*source.Type), gatewayLoadBalancerTunnelInterface_Type_Values)
		tunnelInterface.Type = &typeVar
	} else {
		tunnelInterface.Type = nil
	}

	// No error
	return nil
}

// Gateway load balancer tunnel interface of a load balancer backend address pool.
type GatewayLoadBalancerTunnelInterface_STATUS struct {
	// Identifier: Identifier of gateway load balancer tunnel interface.
	Identifier *int `json:"identifier,omitempty"`

	// Port: Port of gateway load balancer tunnel interface.
	Port *int `json:"port,omitempty"`

	// Protocol: Protocol of gateway load balancer tunnel interface.
	Protocol *GatewayLoadBalancerTunnelInterface_Protocol_STATUS `json:"protocol,omitempty"`

	// Type: Traffic type of gateway load balancer tunnel interface.
	Type *GatewayLoadBalancerTunnelInterface_Type_STATUS `json:"type,omitempty"`
}

var _ genruntime.FromARMConverter = &GatewayLoadBalancerTunnelInterface_STATUS{}

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

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

	// Set property "Identifier":
	if typedInput.Identifier != nil {
		identifier := *typedInput.Identifier
		tunnelInterface.Identifier = &identifier
	}

	// Set property "Port":
	if typedInput.Port != nil {
		port := *typedInput.Port
		tunnelInterface.Port = &port
	}

	// Set property "Protocol":
	if typedInput.Protocol != nil {
		var temp string
		temp = string(*typedInput.Protocol)
		protocol := GatewayLoadBalancerTunnelInterface_Protocol_STATUS(temp)
		tunnelInterface.Protocol = &protocol
	}

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

	// No error
	return nil
}

// AssignProperties_From_GatewayLoadBalancerTunnelInterface_STATUS populates our GatewayLoadBalancerTunnelInterface_STATUS from the provided source GatewayLoadBalancerTunnelInterface_STATUS
func (tunnelInterface *GatewayLoadBalancerTunnelInterface_STATUS) AssignProperties_From_GatewayLoadBalancerTunnelInterface_STATUS(source *storage.GatewayLoadBalancerTunnelInterface_STATUS) error {

	// Identifier
	tunnelInterface.Identifier = genruntime.ClonePointerToInt(source.Identifier)

	// Port
	tunnelInterface.Port = genruntime.ClonePointerToInt(source.Port)

	// Protocol
	if source.Protocol != nil {
		protocol := *source.Protocol
		protocolTemp := genruntime.ToEnum(protocol, gatewayLoadBalancerTunnelInterface_Protocol_STATUS_Values)
		tunnelInterface.Protocol = &protocolTemp
	} else {
		tunnelInterface.Protocol = nil
	}

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

	// No error
	return nil
}

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

	// Identifier
	destination.Identifier = genruntime.ClonePointerToInt(tunnelInterface.Identifier)

	// Port
	destination.Port = genruntime.ClonePointerToInt(tunnelInterface.Port)

	// Protocol
	if tunnelInterface.Protocol != nil {
		protocol := string(*tunnelInterface.Protocol)
		destination.Protocol = &protocol
	} else {
		destination.Protocol = nil
	}

	// Type
	if tunnelInterface.Type != nil {
		typeVar := string(*tunnelInterface.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
}

// Load balancer backend addresses.
type LoadBalancerBackendAddress struct {
	// AdminState: A list of administrative states which once set can override health probe so that Load Balancer will always
	// forward new connections to backend, or deny new connections and reset existing connections.
	AdminState *LoadBalancerBackendAddressPropertiesFormat_AdminState `json:"adminState,omitempty"`

	// IpAddress: IP Address belonging to the referenced virtual network.
	IpAddress *string `json:"ipAddress,omitempty"`

	// LoadBalancerFrontendIPConfiguration: Reference to the frontend ip address configuration defined in regional loadbalancer.
	LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIPConfiguration,omitempty"`

	// Name: Name of the backend address.
	Name *string `json:"name,omitempty"`

	// Subnet: Reference to an existing subnet.
	Subnet *SubResource `json:"subnet,omitempty"`

	// VirtualNetwork: Reference to an existing virtual network.
	VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"`
}

var _ genruntime.ARMTransformer = &LoadBalancerBackendAddress{}

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

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

	// Set property "Properties":
	if address.AdminState != nil ||
		address.IpAddress != nil ||
		address.LoadBalancerFrontendIPConfiguration != nil ||
		address.Subnet != nil ||
		address.VirtualNetwork != nil {
		result.Properties = &arm.LoadBalancerBackendAddressPropertiesFormat{}
	}
	if address.AdminState != nil {
		var temp string
		temp = string(*address.AdminState)
		adminState := arm.LoadBalancerBackendAddressPropertiesFormat_AdminState(temp)
		result.Properties.AdminState = &adminState
	}
	if address.IpAddress != nil {
		ipAddress := *address.IpAddress
		result.Properties.IpAddress = &ipAddress
	}
	if address.LoadBalancerFrontendIPConfiguration != nil {
		loadBalancerFrontendIPConfiguration_ARM, err := address.LoadBalancerFrontendIPConfiguration.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		loadBalancerFrontendIPConfiguration := *loadBalancerFrontendIPConfiguration_ARM.(*arm.SubResource)
		result.Properties.LoadBalancerFrontendIPConfiguration = &loadBalancerFrontendIPConfiguration
	}
	if address.Subnet != nil {
		subnet_ARM, err := address.Subnet.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		subnet := *subnet_ARM.(*arm.SubResource)
		result.Properties.Subnet = &subnet
	}
	if address.VirtualNetwork != nil {
		virtualNetwork_ARM, err := address.VirtualNetwork.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		virtualNetwork := *virtualNetwork_ARM.(*arm.SubResource)
		result.Properties.VirtualNetwork = &virtualNetwork
	}
	return result, nil
}

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

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

	// Set property "AdminState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AdminState != nil {
			var temp string
			temp = string(*typedInput.Properties.AdminState)
			adminState := LoadBalancerBackendAddressPropertiesFormat_AdminState(temp)
			address.AdminState = &adminState
		}
	}

	// Set property "IpAddress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IpAddress != nil {
			ipAddress := *typedInput.Properties.IpAddress
			address.IpAddress = &ipAddress
		}
	}

	// Set property "LoadBalancerFrontendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LoadBalancerFrontendIPConfiguration != nil {
			var loadBalancerFrontendIPConfiguration1 SubResource
			err := loadBalancerFrontendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.LoadBalancerFrontendIPConfiguration)
			if err != nil {
				return err
			}
			loadBalancerFrontendIPConfiguration := loadBalancerFrontendIPConfiguration1
			address.LoadBalancerFrontendIPConfiguration = &loadBalancerFrontendIPConfiguration
		}
	}

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

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

	// Set property "VirtualNetwork":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.VirtualNetwork != nil {
			var virtualNetwork1 SubResource
			err := virtualNetwork1.PopulateFromARM(owner, *typedInput.Properties.VirtualNetwork)
			if err != nil {
				return err
			}
			virtualNetwork := virtualNetwork1
			address.VirtualNetwork = &virtualNetwork
		}
	}

	// No error
	return nil
}

// AssignProperties_From_LoadBalancerBackendAddress populates our LoadBalancerBackendAddress from the provided source LoadBalancerBackendAddress
func (address *LoadBalancerBackendAddress) AssignProperties_From_LoadBalancerBackendAddress(source *storage.LoadBalancerBackendAddress) error {

	// AdminState
	if source.AdminState != nil {
		adminState := *source.AdminState
		adminStateTemp := genruntime.ToEnum(adminState, loadBalancerBackendAddressPropertiesFormat_AdminState_Values)
		address.AdminState = &adminStateTemp
	} else {
		address.AdminState = nil
	}

	// IpAddress
	address.IpAddress = genruntime.ClonePointerToString(source.IpAddress)

	// LoadBalancerFrontendIPConfiguration
	if source.LoadBalancerFrontendIPConfiguration != nil {
		var loadBalancerFrontendIPConfiguration SubResource
		err := loadBalancerFrontendIPConfiguration.AssignProperties_From_SubResource(source.LoadBalancerFrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field LoadBalancerFrontendIPConfiguration")
		}
		address.LoadBalancerFrontendIPConfiguration = &loadBalancerFrontendIPConfiguration
	} else {
		address.LoadBalancerFrontendIPConfiguration = nil
	}

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

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

	// VirtualNetwork
	if source.VirtualNetwork != nil {
		var virtualNetwork SubResource
		err := virtualNetwork.AssignProperties_From_SubResource(source.VirtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field VirtualNetwork")
		}
		address.VirtualNetwork = &virtualNetwork
	} else {
		address.VirtualNetwork = nil
	}

	// No error
	return nil
}

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

	// AdminState
	if address.AdminState != nil {
		adminState := string(*address.AdminState)
		destination.AdminState = &adminState
	} else {
		destination.AdminState = nil
	}

	// IpAddress
	destination.IpAddress = genruntime.ClonePointerToString(address.IpAddress)

	// LoadBalancerFrontendIPConfiguration
	if address.LoadBalancerFrontendIPConfiguration != nil {
		var loadBalancerFrontendIPConfiguration storage.SubResource
		err := address.LoadBalancerFrontendIPConfiguration.AssignProperties_To_SubResource(&loadBalancerFrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field LoadBalancerFrontendIPConfiguration")
		}
		destination.LoadBalancerFrontendIPConfiguration = &loadBalancerFrontendIPConfiguration
	} else {
		destination.LoadBalancerFrontendIPConfiguration = nil
	}

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

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

	// VirtualNetwork
	if address.VirtualNetwork != nil {
		var virtualNetwork storage.SubResource
		err := address.VirtualNetwork.AssignProperties_To_SubResource(&virtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field VirtualNetwork")
		}
		destination.VirtualNetwork = &virtualNetwork
	} else {
		destination.VirtualNetwork = nil
	}

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

	// No error
	return nil
}

// Initialize_From_LoadBalancerBackendAddress_STATUS populates our LoadBalancerBackendAddress from the provided source LoadBalancerBackendAddress_STATUS
func (address *LoadBalancerBackendAddress) Initialize_From_LoadBalancerBackendAddress_STATUS(source *LoadBalancerBackendAddress_STATUS) error {

	// AdminState
	if source.AdminState != nil {
		adminState := genruntime.ToEnum(string(*source.AdminState), loadBalancerBackendAddressPropertiesFormat_AdminState_Values)
		address.AdminState = &adminState
	} else {
		address.AdminState = nil
	}

	// IpAddress
	address.IpAddress = genruntime.ClonePointerToString(source.IpAddress)

	// LoadBalancerFrontendIPConfiguration
	if source.LoadBalancerFrontendIPConfiguration != nil {
		var loadBalancerFrontendIPConfiguration SubResource
		err := loadBalancerFrontendIPConfiguration.Initialize_From_SubResource_STATUS(source.LoadBalancerFrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field LoadBalancerFrontendIPConfiguration")
		}
		address.LoadBalancerFrontendIPConfiguration = &loadBalancerFrontendIPConfiguration
	} else {
		address.LoadBalancerFrontendIPConfiguration = nil
	}

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

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

	// VirtualNetwork
	if source.VirtualNetwork != nil {
		var virtualNetwork SubResource
		err := virtualNetwork.Initialize_From_SubResource_STATUS(source.VirtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field VirtualNetwork")
		}
		address.VirtualNetwork = &virtualNetwork
	} else {
		address.VirtualNetwork = nil
	}

	// No error
	return nil
}

// Load balancer backend addresses.
type LoadBalancerBackendAddress_STATUS struct {
	// AdminState: A list of administrative states which once set can override health probe so that Load Balancer will always
	// forward new connections to backend, or deny new connections and reset existing connections.
	AdminState *LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS `json:"adminState,omitempty"`

	// InboundNatRulesPortMapping: Collection of inbound NAT rule port mappings.
	InboundNatRulesPortMapping []NatRulePortMapping_STATUS `json:"inboundNatRulesPortMapping,omitempty"`

	// IpAddress: IP Address belonging to the referenced virtual network.
	IpAddress *string `json:"ipAddress,omitempty"`

	// LoadBalancerFrontendIPConfiguration: Reference to the frontend ip address configuration defined in regional loadbalancer.
	LoadBalancerFrontendIPConfiguration *SubResource_STATUS `json:"loadBalancerFrontendIPConfiguration,omitempty"`

	// Name: Name of the backend address.
	Name *string `json:"name,omitempty"`

	// NetworkInterfaceIPConfiguration: Reference to IP address defined in network interfaces.
	NetworkInterfaceIPConfiguration *SubResource_STATUS `json:"networkInterfaceIPConfiguration,omitempty"`

	// Subnet: Reference to an existing subnet.
	Subnet *SubResource_STATUS `json:"subnet,omitempty"`

	// VirtualNetwork: Reference to an existing virtual network.
	VirtualNetwork *SubResource_STATUS `json:"virtualNetwork,omitempty"`
}

var _ genruntime.FromARMConverter = &LoadBalancerBackendAddress_STATUS{}

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

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

	// Set property "AdminState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AdminState != nil {
			var temp string
			temp = string(*typedInput.Properties.AdminState)
			adminState := LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS(temp)
			address.AdminState = &adminState
		}
	}

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

	// Set property "IpAddress":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IpAddress != nil {
			ipAddress := *typedInput.Properties.IpAddress
			address.IpAddress = &ipAddress
		}
	}

	// Set property "LoadBalancerFrontendIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LoadBalancerFrontendIPConfiguration != nil {
			var loadBalancerFrontendIPConfiguration1 SubResource_STATUS
			err := loadBalancerFrontendIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.LoadBalancerFrontendIPConfiguration)
			if err != nil {
				return err
			}
			loadBalancerFrontendIPConfiguration := loadBalancerFrontendIPConfiguration1
			address.LoadBalancerFrontendIPConfiguration = &loadBalancerFrontendIPConfiguration
		}
	}

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

	// Set property "NetworkInterfaceIPConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NetworkInterfaceIPConfiguration != nil {
			var networkInterfaceIPConfiguration1 SubResource_STATUS
			err := networkInterfaceIPConfiguration1.PopulateFromARM(owner, *typedInput.Properties.NetworkInterfaceIPConfiguration)
			if err != nil {
				return err
			}
			networkInterfaceIPConfiguration := networkInterfaceIPConfiguration1
			address.NetworkInterfaceIPConfiguration = &networkInterfaceIPConfiguration
		}
	}

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

	// Set property "VirtualNetwork":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.VirtualNetwork != nil {
			var virtualNetwork1 SubResource_STATUS
			err := virtualNetwork1.PopulateFromARM(owner, *typedInput.Properties.VirtualNetwork)
			if err != nil {
				return err
			}
			virtualNetwork := virtualNetwork1
			address.VirtualNetwork = &virtualNetwork
		}
	}

	// No error
	return nil
}

// AssignProperties_From_LoadBalancerBackendAddress_STATUS populates our LoadBalancerBackendAddress_STATUS from the provided source LoadBalancerBackendAddress_STATUS
func (address *LoadBalancerBackendAddress_STATUS) AssignProperties_From_LoadBalancerBackendAddress_STATUS(source *storage.LoadBalancerBackendAddress_STATUS) error {

	// AdminState
	if source.AdminState != nil {
		adminState := *source.AdminState
		adminStateTemp := genruntime.ToEnum(adminState, loadBalancerBackendAddressPropertiesFormat_AdminState_STATUS_Values)
		address.AdminState = &adminStateTemp
	} else {
		address.AdminState = nil
	}

	// InboundNatRulesPortMapping
	if source.InboundNatRulesPortMapping != nil {
		inboundNatRulesPortMappingList := make([]NatRulePortMapping_STATUS, len(source.InboundNatRulesPortMapping))
		for inboundNatRulesPortMappingIndex, inboundNatRulesPortMappingItem := range source.InboundNatRulesPortMapping {
			var inboundNatRulesPortMapping NatRulePortMapping_STATUS
			err := inboundNatRulesPortMapping.AssignProperties_From_NatRulePortMapping_STATUS(&inboundNatRulesPortMappingItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_NatRulePortMapping_STATUS() to populate field InboundNatRulesPortMapping")
			}
			inboundNatRulesPortMappingList[inboundNatRulesPortMappingIndex] = inboundNatRulesPortMapping
		}
		address.InboundNatRulesPortMapping = inboundNatRulesPortMappingList
	} else {
		address.InboundNatRulesPortMapping = nil
	}

	// IpAddress
	address.IpAddress = genruntime.ClonePointerToString(source.IpAddress)

	// LoadBalancerFrontendIPConfiguration
	if source.LoadBalancerFrontendIPConfiguration != nil {
		var loadBalancerFrontendIPConfiguration SubResource_STATUS
		err := loadBalancerFrontendIPConfiguration.AssignProperties_From_SubResource_STATUS(source.LoadBalancerFrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field LoadBalancerFrontendIPConfiguration")
		}
		address.LoadBalancerFrontendIPConfiguration = &loadBalancerFrontendIPConfiguration
	} else {
		address.LoadBalancerFrontendIPConfiguration = nil
	}

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

	// NetworkInterfaceIPConfiguration
	if source.NetworkInterfaceIPConfiguration != nil {
		var networkInterfaceIPConfiguration SubResource_STATUS
		err := networkInterfaceIPConfiguration.AssignProperties_From_SubResource_STATUS(source.NetworkInterfaceIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field NetworkInterfaceIPConfiguration")
		}
		address.NetworkInterfaceIPConfiguration = &networkInterfaceIPConfiguration
	} else {
		address.NetworkInterfaceIPConfiguration = nil
	}

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

	// VirtualNetwork
	if source.VirtualNetwork != nil {
		var virtualNetwork SubResource_STATUS
		err := virtualNetwork.AssignProperties_From_SubResource_STATUS(source.VirtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field VirtualNetwork")
		}
		address.VirtualNetwork = &virtualNetwork
	} else {
		address.VirtualNetwork = nil
	}

	// No error
	return nil
}

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

	// AdminState
	if address.AdminState != nil {
		adminState := string(*address.AdminState)
		destination.AdminState = &adminState
	} else {
		destination.AdminState = nil
	}

	// InboundNatRulesPortMapping
	if address.InboundNatRulesPortMapping != nil {
		inboundNatRulesPortMappingList := make([]storage.NatRulePortMapping_STATUS, len(address.InboundNatRulesPortMapping))
		for inboundNatRulesPortMappingIndex, inboundNatRulesPortMappingItem := range address.InboundNatRulesPortMapping {
			var inboundNatRulesPortMapping storage.NatRulePortMapping_STATUS
			err := inboundNatRulesPortMappingItem.AssignProperties_To_NatRulePortMapping_STATUS(&inboundNatRulesPortMapping)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_NatRulePortMapping_STATUS() to populate field InboundNatRulesPortMapping")
			}
			inboundNatRulesPortMappingList[inboundNatRulesPortMappingIndex] = inboundNatRulesPortMapping
		}
		destination.InboundNatRulesPortMapping = inboundNatRulesPortMappingList
	} else {
		destination.InboundNatRulesPortMapping = nil
	}

	// IpAddress
	destination.IpAddress = genruntime.ClonePointerToString(address.IpAddress)

	// LoadBalancerFrontendIPConfiguration
	if address.LoadBalancerFrontendIPConfiguration != nil {
		var loadBalancerFrontendIPConfiguration storage.SubResource_STATUS
		err := address.LoadBalancerFrontendIPConfiguration.AssignProperties_To_SubResource_STATUS(&loadBalancerFrontendIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field LoadBalancerFrontendIPConfiguration")
		}
		destination.LoadBalancerFrontendIPConfiguration = &loadBalancerFrontendIPConfiguration
	} else {
		destination.LoadBalancerFrontendIPConfiguration = nil
	}

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

	// NetworkInterfaceIPConfiguration
	if address.NetworkInterfaceIPConfiguration != nil {
		var networkInterfaceIPConfiguration storage.SubResource_STATUS
		err := address.NetworkInterfaceIPConfiguration.AssignProperties_To_SubResource_STATUS(&networkInterfaceIPConfiguration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field NetworkInterfaceIPConfiguration")
		}
		destination.NetworkInterfaceIPConfiguration = &networkInterfaceIPConfiguration
	} else {
		destination.NetworkInterfaceIPConfiguration = nil
	}

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

	// VirtualNetwork
	if address.VirtualNetwork != nil {
		var virtualNetwork storage.SubResource_STATUS
		err := address.VirtualNetwork.AssignProperties_To_SubResource_STATUS(&virtualNetwork)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field VirtualNetwork")
		}
		destination.VirtualNetwork = &virtualNetwork
	} else {
		destination.VirtualNetwork = nil
	}

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Basic","Gateway","Standard"}
type LoadBalancerSku_Name string

const (
	LoadBalancerSku_Name_Basic    = LoadBalancerSku_Name("Basic")
	LoadBalancerSku_Name_Gateway  = LoadBalancerSku_Name("Gateway")
	LoadBalancerSku_Name_Standard = LoadBalancerSku_Name("Standard")
)

// Mapping from string to LoadBalancerSku_Name
var loadBalancerSku_Name_Values = map[string]LoadBalancerSku_Name{
	"basic":    LoadBalancerSku_Name_Basic,
	"gateway":  LoadBalancerSku_Name_Gateway,
	"standard": LoadBalancerSku_Name_Standard,
}

type LoadBalancerSku_Name_STATUS string

const (
	LoadBalancerSku_Name_STATUS_Basic    = LoadBalancerSku_Name_STATUS("Basic")
	LoadBalancerSku_Name_STATUS_Gateway  = LoadBalancerSku_Name_STATUS("Gateway")
	LoadBalancerSku_Name_STATUS_Standard = LoadBalancerSku_Name_STATUS("Standard")
)

// Mapping from string to LoadBalancerSku_Name_STATUS
var loadBalancerSku_Name_STATUS_Values = map[string]LoadBalancerSku_Name_STATUS{
	"basic":    LoadBalancerSku_Name_STATUS_Basic,
	"gateway":  LoadBalancerSku_Name_STATUS_Gateway,
	"standard": LoadBalancerSku_Name_STATUS_Standard,
}

// +kubebuilder:validation:Enum={"Global","Regional"}
type LoadBalancerSku_Tier string

const (
	LoadBalancerSku_Tier_Global   = LoadBalancerSku_Tier("Global")
	LoadBalancerSku_Tier_Regional = LoadBalancerSku_Tier("Regional")
)

// Mapping from string to LoadBalancerSku_Tier
var loadBalancerSku_Tier_Values = map[string]LoadBalancerSku_Tier{
	"global":   LoadBalancerSku_Tier_Global,
	"regional": LoadBalancerSku_Tier_Regional,
}

type LoadBalancerSku_Tier_STATUS string

const (
	LoadBalancerSku_Tier_STATUS_Global   = LoadBalancerSku_Tier_STATUS("Global")
	LoadBalancerSku_Tier_STATUS_Regional = LoadBalancerSku_Tier_STATUS("Regional")
)

// Mapping from string to LoadBalancerSku_Tier_STATUS
var loadBalancerSku_Tier_STATUS_Values = map[string]LoadBalancerSku_Tier_STATUS{
	"global":   LoadBalancerSku_Tier_STATUS_Global,
	"regional": LoadBalancerSku_Tier_STATUS_Regional,
}

// +kubebuilder:validation:Enum={"Default","SourceIP","SourceIPProtocol"}
type LoadBalancingRulePropertiesFormat_LoadDistribution string

const (
	LoadBalancingRulePropertiesFormat_LoadDistribution_Default          = LoadBalancingRulePropertiesFormat_LoadDistribution("Default")
	LoadBalancingRulePropertiesFormat_LoadDistribution_SourceIP         = LoadBalancingRulePropertiesFormat_LoadDistribution("SourceIP")
	LoadBalancingRulePropertiesFormat_LoadDistribution_SourceIPProtocol = LoadBalancingRulePropertiesFormat_LoadDistribution("SourceIPProtocol")
)

// Mapping from string to LoadBalancingRulePropertiesFormat_LoadDistribution
var loadBalancingRulePropertiesFormat_LoadDistribution_Values = map[string]LoadBalancingRulePropertiesFormat_LoadDistribution{
	"default":          LoadBalancingRulePropertiesFormat_LoadDistribution_Default,
	"sourceip":         LoadBalancingRulePropertiesFormat_LoadDistribution_SourceIP,
	"sourceipprotocol": LoadBalancingRulePropertiesFormat_LoadDistribution_SourceIPProtocol,
}

type LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS string

const (
	LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS_Default          = LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS("Default")
	LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS_SourceIP         = LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS("SourceIP")
	LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS_SourceIPProtocol = LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS("SourceIPProtocol")
)

// Mapping from string to LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS
var loadBalancingRulePropertiesFormat_LoadDistribution_STATUS_Values = map[string]LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS{
	"default":          LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS_Default,
	"sourceip":         LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS_SourceIP,
	"sourceipprotocol": LoadBalancingRulePropertiesFormat_LoadDistribution_STATUS_SourceIPProtocol,
}

// IPConfiguration in a network interface.
type NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded populates the provided destination NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded from our NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded
func (embedded *NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded) AssignProperties_To_NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_SubResourceEmbedded(destination *storage.NetworkInterfaceIPConfiguration_STATUS_LoadBalancer_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
}

// +kubebuilder:validation:Enum={"All","Tcp","Udp"}
type OutboundRulePropertiesFormat_Protocol string

const (
	OutboundRulePropertiesFormat_Protocol_All = OutboundRulePropertiesFormat_Protocol("All")
	OutboundRulePropertiesFormat_Protocol_Tcp = OutboundRulePropertiesFormat_Protocol("Tcp")
	OutboundRulePropertiesFormat_Protocol_Udp = OutboundRulePropertiesFormat_Protocol("Udp")
)

// Mapping from string to OutboundRulePropertiesFormat_Protocol
var outboundRulePropertiesFormat_Protocol_Values = map[string]OutboundRulePropertiesFormat_Protocol{
	"all": OutboundRulePropertiesFormat_Protocol_All,
	"tcp": OutboundRulePropertiesFormat_Protocol_Tcp,
	"udp": OutboundRulePropertiesFormat_Protocol_Udp,
}

type OutboundRulePropertiesFormat_Protocol_STATUS string

const (
	OutboundRulePropertiesFormat_Protocol_STATUS_All = OutboundRulePropertiesFormat_Protocol_STATUS("All")
	OutboundRulePropertiesFormat_Protocol_STATUS_Tcp = OutboundRulePropertiesFormat_Protocol_STATUS("Tcp")
	OutboundRulePropertiesFormat_Protocol_STATUS_Udp = OutboundRulePropertiesFormat_Protocol_STATUS("Udp")
)

// Mapping from string to OutboundRulePropertiesFormat_Protocol_STATUS
var outboundRulePropertiesFormat_Protocol_STATUS_Values = map[string]OutboundRulePropertiesFormat_Protocol_STATUS{
	"all": OutboundRulePropertiesFormat_Protocol_STATUS_All,
	"tcp": OutboundRulePropertiesFormat_Protocol_STATUS_Tcp,
	"udp": OutboundRulePropertiesFormat_Protocol_STATUS_Udp,
}

// +kubebuilder:validation:Enum={"AllProbedDown","AllProbedUp"}
type ProbePropertiesFormat_NoHealthyBackendsBehavior string

const (
	ProbePropertiesFormat_NoHealthyBackendsBehavior_AllProbedDown = ProbePropertiesFormat_NoHealthyBackendsBehavior("AllProbedDown")
	ProbePropertiesFormat_NoHealthyBackendsBehavior_AllProbedUp   = ProbePropertiesFormat_NoHealthyBackendsBehavior("AllProbedUp")
)

// Mapping from string to ProbePropertiesFormat_NoHealthyBackendsBehavior
var probePropertiesFormat_NoHealthyBackendsBehavior_Values = map[string]ProbePropertiesFormat_NoHealthyBackendsBehavior{
	"allprobeddown": ProbePropertiesFormat_NoHealthyBackendsBehavior_AllProbedDown,
	"allprobedup":   ProbePropertiesFormat_NoHealthyBackendsBehavior_AllProbedUp,
}

type ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS string

const (
	ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS_AllProbedDown = ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS("AllProbedDown")
	ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS_AllProbedUp   = ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS("AllProbedUp")
)

// Mapping from string to ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS
var probePropertiesFormat_NoHealthyBackendsBehavior_STATUS_Values = map[string]ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS{
	"allprobeddown": ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS_AllProbedDown,
	"allprobedup":   ProbePropertiesFormat_NoHealthyBackendsBehavior_STATUS_AllProbedUp,
}

// +kubebuilder:validation:Enum={"Http","Https","Tcp"}
type ProbePropertiesFormat_Protocol string

const (
	ProbePropertiesFormat_Protocol_Http  = ProbePropertiesFormat_Protocol("Http")
	ProbePropertiesFormat_Protocol_Https = ProbePropertiesFormat_Protocol("Https")
	ProbePropertiesFormat_Protocol_Tcp   = ProbePropertiesFormat_Protocol("Tcp")
)

// Mapping from string to ProbePropertiesFormat_Protocol
var probePropertiesFormat_Protocol_Values = map[string]ProbePropertiesFormat_Protocol{
	"http":  ProbePropertiesFormat_Protocol_Http,
	"https": ProbePropertiesFormat_Protocol_Https,
	"tcp":   ProbePropertiesFormat_Protocol_Tcp,
}

type ProbePropertiesFormat_Protocol_STATUS string

const (
	ProbePropertiesFormat_Protocol_STATUS_Http  = ProbePropertiesFormat_Protocol_STATUS("Http")
	ProbePropertiesFormat_Protocol_STATUS_Https = ProbePropertiesFormat_Protocol_STATUS("Https")
	ProbePropertiesFormat_Protocol_STATUS_Tcp   = ProbePropertiesFormat_Protocol_STATUS("Tcp")
)

// Mapping from string to ProbePropertiesFormat_Protocol_STATUS
var probePropertiesFormat_Protocol_STATUS_Values = map[string]ProbePropertiesFormat_Protocol_STATUS{
	"http":  ProbePropertiesFormat_Protocol_STATUS_Http,
	"https": ProbePropertiesFormat_Protocol_STATUS_Https,
	"tcp":   ProbePropertiesFormat_Protocol_STATUS_Tcp,
}

// Public IP address resource.
type PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded populates the provided destination PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded from our PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded
func (embedded *PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded) AssignProperties_To_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded(destination *storage.PublicIPAddress_STATUS_LoadBalancer_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
}

// Public IP address resource.
type PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded{}

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

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

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

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

	// no assignment for property "Reference"

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded populates the provided destination PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded from our PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded
func (embedded *PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded) AssignProperties_To_PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded(destination *storage.PublicIPAddressSpec_LoadBalancer_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_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded populates our PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded from the provided source PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded
func (embedded *PublicIPAddressSpec_LoadBalancer_SubResourceEmbedded) Initialize_From_PublicIPAddress_STATUS_LoadBalancer_SubResourceEmbedded(source *PublicIPAddress_STATUS_LoadBalancer_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_LoadBalancer_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &Subnet_LoadBalancer_SubResourceEmbedded{}

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

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

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

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

	// no assignment for property "Reference"

	// No error
	return nil
}

// AssignProperties_From_Subnet_LoadBalancer_SubResourceEmbedded populates our Subnet_LoadBalancer_SubResourceEmbedded from the provided source Subnet_LoadBalancer_SubResourceEmbedded
func (embedded *Subnet_LoadBalancer_SubResourceEmbedded) AssignProperties_From_Subnet_LoadBalancer_SubResourceEmbedded(source *storage.Subnet_LoadBalancer_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_LoadBalancer_SubResourceEmbedded populates the provided destination Subnet_LoadBalancer_SubResourceEmbedded from our Subnet_LoadBalancer_SubResourceEmbedded
func (embedded *Subnet_LoadBalancer_SubResourceEmbedded) AssignProperties_To_Subnet_LoadBalancer_SubResourceEmbedded(destination *storage.Subnet_LoadBalancer_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_LoadBalancer_SubResourceEmbedded populates our Subnet_LoadBalancer_SubResourceEmbedded from the provided source Subnet_STATUS_LoadBalancer_SubResourceEmbedded
func (embedded *Subnet_LoadBalancer_SubResourceEmbedded) Initialize_From_Subnet_STATUS_LoadBalancer_SubResourceEmbedded(source *Subnet_STATUS_LoadBalancer_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_LoadBalancer_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &Subnet_STATUS_LoadBalancer_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_Subnet_STATUS_LoadBalancer_SubResourceEmbedded populates the provided destination Subnet_STATUS_LoadBalancer_SubResourceEmbedded from our Subnet_STATUS_LoadBalancer_SubResourceEmbedded
func (embedded *Subnet_STATUS_LoadBalancer_SubResourceEmbedded) AssignProperties_To_Subnet_STATUS_LoadBalancer_SubResourceEmbedded(destination *storage.Subnet_STATUS_LoadBalancer_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
}

// +kubebuilder:validation:Enum={"Native","None","VXLAN"}
type GatewayLoadBalancerTunnelInterface_Protocol string

const (
	GatewayLoadBalancerTunnelInterface_Protocol_Native = GatewayLoadBalancerTunnelInterface_Protocol("Native")
	GatewayLoadBalancerTunnelInterface_Protocol_None   = GatewayLoadBalancerTunnelInterface_Protocol("None")
	GatewayLoadBalancerTunnelInterface_Protocol_VXLAN  = GatewayLoadBalancerTunnelInterface_Protocol("VXLAN")
)

// Mapping from string to GatewayLoadBalancerTunnelInterface_Protocol
var gatewayLoadBalancerTunnelInterface_Protocol_Values = map[string]GatewayLoadBalancerTunnelInterface_Protocol{
	"native": GatewayLoadBalancerTunnelInterface_Protocol_Native,
	"none":   GatewayLoadBalancerTunnelInterface_Protocol_None,
	"vxlan":  GatewayLoadBalancerTunnelInterface_Protocol_VXLAN,
}

type GatewayLoadBalancerTunnelInterface_Protocol_STATUS string

const (
	GatewayLoadBalancerTunnelInterface_Protocol_STATUS_Native = GatewayLoadBalancerTunnelInterface_Protocol_STATUS("Native")
	GatewayLoadBalancerTunnelInterface_Protocol_STATUS_None   = GatewayLoadBalancerTunnelInterface_Protocol_STATUS("None")
	GatewayLoadBalancerTunnelInterface_Protocol_STATUS_VXLAN  = GatewayLoadBalancerTunnelInterface_Protocol_STATUS("VXLAN")
)

// Mapping from string to GatewayLoadBalancerTunnelInterface_Protocol_STATUS
var gatewayLoadBalancerTunnelInterface_Protocol_STATUS_Values = map[string]GatewayLoadBalancerTunnelInterface_Protocol_STATUS{
	"native": GatewayLoadBalancerTunnelInterface_Protocol_STATUS_Native,
	"none":   GatewayLoadBalancerTunnelInterface_Protocol_STATUS_None,
	"vxlan":  GatewayLoadBalancerTunnelInterface_Protocol_STATUS_VXLAN,
}

// +kubebuilder:validation:Enum={"External","Internal","None"}
type GatewayLoadBalancerTunnelInterface_Type string

const (
	GatewayLoadBalancerTunnelInterface_Type_External = GatewayLoadBalancerTunnelInterface_Type("External")
	GatewayLoadBalancerTunnelInterface_Type_Internal = GatewayLoadBalancerTunnelInterface_Type("Internal")
	GatewayLoadBalancerTunnelInterface_Type_None     = GatewayLoadBalancerTunnelInterface_Type("None")
)

// Mapping from string to GatewayLoadBalancerTunnelInterface_Type
var gatewayLoadBalancerTunnelInterface_Type_Values = map[string]GatewayLoadBalancerTunnelInterface_Type{
	"external": GatewayLoadBalancerTunnelInterface_Type_External,
	"internal": GatewayLoadBalancerTunnelInterface_Type_Internal,
	"none":     GatewayLoadBalancerTunnelInterface_Type_None,
}

type GatewayLoadBalancerTunnelInterface_Type_STATUS string

const (
	GatewayLoadBalancerTunnelInterface_Type_STATUS_External = GatewayLoadBalancerTunnelInterface_Type_STATUS("External")
	GatewayLoadBalancerTunnelInterface_Type_STATUS_Internal = GatewayLoadBalancerTunnelInterface_Type_STATUS("Internal")
	GatewayLoadBalancerTunnelInterface_Type_STATUS_None     = GatewayLoadBalancerTunnelInterface_Type_STATUS("None")
)

// Mapping from string to GatewayLoadBalancerTunnelInterface_Type_STATUS
var gatewayLoadBalancerTunnelInterface_Type_STATUS_Values = map[string]GatewayLoadBalancerTunnelInterface_Type_STATUS{
	"external": GatewayLoadBalancerTunnelInterface_Type_STATUS_External,
	"internal": GatewayLoadBalancerTunnelInterface_Type_STATUS_Internal,
	"none":     GatewayLoadBalancerTunnelInterface_Type_STATUS_None,
}

// +kubebuilder:validation:Enum={"Down","None","Up"}
type LoadBalancerBackendAddressPropertiesFormat_AdminState string

const (
	LoadBalancerBackendAddressPropertiesFormat_AdminState_Down = LoadBalancerBackendAddressPropertiesFormat_AdminState("Down")
	LoadBalancerBackendAddressPropertiesFormat_AdminState_None = LoadBalancerBackendAddressPropertiesFormat_AdminState("None")
	LoadBalancerBackendAddressPropertiesFormat_AdminState_Up   = LoadBalancerBackendAddressPropertiesFormat_AdminState("Up")
)

// Mapping from string to LoadBalancerBackendAddressPropertiesFormat_AdminState
var loadBalancerBackendAddressPropertiesFormat_AdminState_Values = map[string]LoadBalancerBackendAddressPropertiesFormat_AdminState{
	"down": LoadBalancerBackendAddressPropertiesFormat_AdminState_Down,
	"none": LoadBalancerBackendAddressPropertiesFormat_AdminState_None,
	"up":   LoadBalancerBackendAddressPropertiesFormat_AdminState_Up,
}

type LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS string

const (
	LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS_Down = LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS("Down")
	LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS_None = LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS("None")
	LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS_Up   = LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS("Up")
)

// Mapping from string to LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS
var loadBalancerBackendAddressPropertiesFormat_AdminState_STATUS_Values = map[string]LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS{
	"down": LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS_Down,
	"none": LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS_None,
	"up":   LoadBalancerBackendAddressPropertiesFormat_AdminState_STATUS_Up,
}

// Individual port mappings for inbound NAT rule created for backend pool.
type NatRulePortMapping_STATUS struct {
	// BackendPort: Backend port.
	BackendPort *int `json:"backendPort,omitempty"`

	// FrontendPort: Frontend port.
	FrontendPort *int `json:"frontendPort,omitempty"`

	// InboundNatRuleName: Name of inbound NAT rule.
	InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"`
}

var _ genruntime.FromARMConverter = &NatRulePortMapping_STATUS{}

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

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

	// Set property "BackendPort":
	if typedInput.BackendPort != nil {
		backendPort := *typedInput.BackendPort
		mapping.BackendPort = &backendPort
	}

	// Set property "FrontendPort":
	if typedInput.FrontendPort != nil {
		frontendPort := *typedInput.FrontendPort
		mapping.FrontendPort = &frontendPort
	}

	// Set property "InboundNatRuleName":
	if typedInput.InboundNatRuleName != nil {
		inboundNatRuleName := *typedInput.InboundNatRuleName
		mapping.InboundNatRuleName = &inboundNatRuleName
	}

	// No error
	return nil
}

// AssignProperties_From_NatRulePortMapping_STATUS populates our NatRulePortMapping_STATUS from the provided source NatRulePortMapping_STATUS
func (mapping *NatRulePortMapping_STATUS) AssignProperties_From_NatRulePortMapping_STATUS(source *storage.NatRulePortMapping_STATUS) error {

	// BackendPort
	mapping.BackendPort = genruntime.ClonePointerToInt(source.BackendPort)

	// FrontendPort
	mapping.FrontendPort = genruntime.ClonePointerToInt(source.FrontendPort)

	// InboundNatRuleName
	mapping.InboundNatRuleName = genruntime.ClonePointerToString(source.InboundNatRuleName)

	// No error
	return nil
}

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

	// BackendPort
	destination.BackendPort = genruntime.ClonePointerToInt(mapping.BackendPort)

	// FrontendPort
	destination.FrontendPort = genruntime.ClonePointerToInt(mapping.FrontendPort)

	// InboundNatRuleName
	destination.InboundNatRuleName = genruntime.ClonePointerToString(mapping.InboundNatRuleName)

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&LoadBalancer{}, &LoadBalancerList{})
}
