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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/network/v1api20201101/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/network/v1api20201101/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/2020-11-01/virtualNetwork.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
type VirtualNetworksSubnet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              VirtualNetworksSubnet_Spec   `json:"spec,omitempty"`
	Status            VirtualNetworksSubnet_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &VirtualNetworksSubnet{}

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

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

var _ conversion.Convertible = &VirtualNetworksSubnet{}

// ConvertFrom populates our VirtualNetworksSubnet from the provided hub VirtualNetworksSubnet
func (subnet *VirtualNetworksSubnet) ConvertFrom(hub conversion.Hub) error {
	// intermediate variable for conversion
	var source storage.VirtualNetworksSubnet

	err := source.ConvertFrom(hub)
	if err != nil {
		return eris.Wrap(err, "converting from hub to source")
	}

	err = subnet.AssignProperties_From_VirtualNetworksSubnet(&source)
	if err != nil {
		return eris.Wrap(err, "converting from source to subnet")
	}

	return nil
}

// ConvertTo populates the provided hub VirtualNetworksSubnet from our VirtualNetworksSubnet
func (subnet *VirtualNetworksSubnet) ConvertTo(hub conversion.Hub) error {
	// intermediate variable for conversion
	var destination storage.VirtualNetworksSubnet
	err := subnet.AssignProperties_To_VirtualNetworksSubnet(&destination)
	if err != nil {
		return eris.Wrap(err, "converting to destination from subnet")
	}
	err = destination.ConvertTo(hub)
	if err != nil {
		return eris.Wrap(err, "converting from destination to hub")
	}

	return nil
}

var _ configmaps.Exporter = &VirtualNetworksSubnet{}

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

var _ secrets.Exporter = &VirtualNetworksSubnet{}

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

var _ genruntime.KubernetesResource = &VirtualNetworksSubnet{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2020-11-01"
func (subnet VirtualNetworksSubnet) GetAPIVersion() string {
	return "2020-11-01"
}

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

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

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

// GetSupportedOperations returns the operations supported by the resource
func (subnet *VirtualNetworksSubnet) 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/virtualNetworks/subnets"
func (subnet *VirtualNetworksSubnet) GetType() string {
	return "Microsoft.Network/virtualNetworks/subnets"
}

// NewEmptyStatus returns a new empty (blank) status
func (subnet *VirtualNetworksSubnet) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &VirtualNetworksSubnet_STATUS{}
}

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

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

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

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

	subnet.Status = st
	return nil
}

// AssignProperties_From_VirtualNetworksSubnet populates our VirtualNetworksSubnet from the provided source VirtualNetworksSubnet
func (subnet *VirtualNetworksSubnet) AssignProperties_From_VirtualNetworksSubnet(source *storage.VirtualNetworksSubnet) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_VirtualNetworksSubnet populates the provided destination VirtualNetworksSubnet from our VirtualNetworksSubnet
func (subnet *VirtualNetworksSubnet) AssignProperties_To_VirtualNetworksSubnet(destination *storage.VirtualNetworksSubnet) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2020-11-01/virtualNetwork.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
type VirtualNetworksSubnetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []VirtualNetworksSubnet `json:"items"`
}

type VirtualNetworksSubnet_Spec struct {
	// AddressPrefix: The address prefix for the subnet.
	AddressPrefix *string `json:"addressPrefix,omitempty"`

	// AddressPrefixes: List of address prefixes for the subnet.
	AddressPrefixes []string `json:"addressPrefixes,omitempty"`

	// ApplicationGatewayIpConfigurations: Application gateway IP configurations of virtual network resource.
	ApplicationGatewayIpConfigurations []ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded `json:"applicationGatewayIpConfigurations,omitempty"`

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

	// Delegations: An array of references to the delegations on the subnet.
	Delegations []Delegation `json:"delegations,omitempty"`

	// IpAllocations: Array of IpAllocation which reference this subnet.
	IpAllocations []SubResource `json:"ipAllocations,omitempty"`

	// NatGateway: Nat gateway associated with this subnet.
	NatGateway *SubResource `json:"natGateway,omitempty"`

	// NetworkSecurityGroup: The reference to the NetworkSecurityGroup resource.
	NetworkSecurityGroup *NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded `json:"networkSecurityGroup,omitempty"`

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

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

	// PrivateEndpointNetworkPolicies: Enable or Disable apply network policies on private end point in the subnet.
	PrivateEndpointNetworkPolicies *SubnetPropertiesFormat_PrivateEndpointNetworkPolicies `json:"privateEndpointNetworkPolicies,omitempty"`

	// PrivateLinkServiceNetworkPolicies: Enable or Disable apply network policies on private link service in the subnet.
	PrivateLinkServiceNetworkPolicies *SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies `json:"privateLinkServiceNetworkPolicies,omitempty"`

	// RouteTable: The reference to the RouteTable resource.
	RouteTable *RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded `json:"routeTable,omitempty"`

	// ServiceEndpointPolicies: An array of service endpoint policies.
	ServiceEndpointPolicies []ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded `json:"serviceEndpointPolicies,omitempty"`

	// ServiceEndpoints: An array of service endpoints.
	ServiceEndpoints []ServiceEndpointPropertiesFormat `json:"serviceEndpoints,omitempty"`
}

var _ genruntime.ARMTransformer = &VirtualNetworksSubnet_Spec{}

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

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

	// Set property "Properties":
	if subnet.AddressPrefix != nil ||
		subnet.AddressPrefixes != nil ||
		subnet.ApplicationGatewayIpConfigurations != nil ||
		subnet.Delegations != nil ||
		subnet.IpAllocations != nil ||
		subnet.NatGateway != nil ||
		subnet.NetworkSecurityGroup != nil ||
		subnet.PrivateEndpointNetworkPolicies != nil ||
		subnet.PrivateLinkServiceNetworkPolicies != nil ||
		subnet.RouteTable != nil ||
		subnet.ServiceEndpointPolicies != nil ||
		subnet.ServiceEndpoints != nil {
		result.Properties = &arm.SubnetPropertiesFormat_VirtualNetworks_Subnet_SubResourceEmbedded{}
	}
	if subnet.AddressPrefix != nil {
		addressPrefix := *subnet.AddressPrefix
		result.Properties.AddressPrefix = &addressPrefix
	}
	for _, item := range subnet.AddressPrefixes {
		result.Properties.AddressPrefixes = append(result.Properties.AddressPrefixes, item)
	}
	for _, item := range subnet.ApplicationGatewayIpConfigurations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.ApplicationGatewayIpConfigurations = append(result.Properties.ApplicationGatewayIpConfigurations, *item_ARM.(*arm.ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded))
	}
	for _, item := range subnet.Delegations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.Delegations = append(result.Properties.Delegations, *item_ARM.(*arm.Delegation))
	}
	for _, item := range subnet.IpAllocations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.IpAllocations = append(result.Properties.IpAllocations, *item_ARM.(*arm.SubResource))
	}
	if subnet.NatGateway != nil {
		natGateway_ARM, err := subnet.NatGateway.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		natGateway := *natGateway_ARM.(*arm.SubResource)
		result.Properties.NatGateway = &natGateway
	}
	if subnet.NetworkSecurityGroup != nil {
		networkSecurityGroup_ARM, err := subnet.NetworkSecurityGroup.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		networkSecurityGroup := *networkSecurityGroup_ARM.(*arm.NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded)
		result.Properties.NetworkSecurityGroup = &networkSecurityGroup
	}
	if subnet.PrivateEndpointNetworkPolicies != nil {
		var temp string
		temp = string(*subnet.PrivateEndpointNetworkPolicies)
		privateEndpointNetworkPolicies := arm.SubnetPropertiesFormat_PrivateEndpointNetworkPolicies(temp)
		result.Properties.PrivateEndpointNetworkPolicies = &privateEndpointNetworkPolicies
	}
	if subnet.PrivateLinkServiceNetworkPolicies != nil {
		var temp string
		temp = string(*subnet.PrivateLinkServiceNetworkPolicies)
		privateLinkServiceNetworkPolicies := arm.SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies(temp)
		result.Properties.PrivateLinkServiceNetworkPolicies = &privateLinkServiceNetworkPolicies
	}
	if subnet.RouteTable != nil {
		routeTable_ARM, err := subnet.RouteTable.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		routeTable := *routeTable_ARM.(*arm.RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded)
		result.Properties.RouteTable = &routeTable
	}
	for _, item := range subnet.ServiceEndpointPolicies {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.ServiceEndpointPolicies = append(result.Properties.ServiceEndpointPolicies, *item_ARM.(*arm.ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded))
	}
	for _, item := range subnet.ServiceEndpoints {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.ServiceEndpoints = append(result.Properties.ServiceEndpoints, *item_ARM.(*arm.ServiceEndpointPropertiesFormat))
	}
	return result, nil
}

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

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

	// Set property "AddressPrefix":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AddressPrefix != nil {
			addressPrefix := *typedInput.Properties.AddressPrefix
			subnet.AddressPrefix = &addressPrefix
		}
	}

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

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

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

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

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

	// Set property "NatGateway":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NatGateway != nil {
			var natGateway1 SubResource
			err := natGateway1.PopulateFromARM(owner, *typedInput.Properties.NatGateway)
			if err != nil {
				return err
			}
			natGateway := natGateway1
			subnet.NatGateway = &natGateway
		}
	}

	// Set property "NetworkSecurityGroup":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NetworkSecurityGroup != nil {
			var networkSecurityGroup1 NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded
			err := networkSecurityGroup1.PopulateFromARM(owner, *typedInput.Properties.NetworkSecurityGroup)
			if err != nil {
				return err
			}
			networkSecurityGroup := networkSecurityGroup1
			subnet.NetworkSecurityGroup = &networkSecurityGroup
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "PrivateEndpointNetworkPolicies":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateEndpointNetworkPolicies != nil {
			var temp string
			temp = string(*typedInput.Properties.PrivateEndpointNetworkPolicies)
			privateEndpointNetworkPolicies := SubnetPropertiesFormat_PrivateEndpointNetworkPolicies(temp)
			subnet.PrivateEndpointNetworkPolicies = &privateEndpointNetworkPolicies
		}
	}

	// Set property "PrivateLinkServiceNetworkPolicies":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateLinkServiceNetworkPolicies != nil {
			var temp string
			temp = string(*typedInput.Properties.PrivateLinkServiceNetworkPolicies)
			privateLinkServiceNetworkPolicies := SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies(temp)
			subnet.PrivateLinkServiceNetworkPolicies = &privateLinkServiceNetworkPolicies
		}
	}

	// Set property "RouteTable":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RouteTable != nil {
			var routeTable1 RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded
			err := routeTable1.PopulateFromARM(owner, *typedInput.Properties.RouteTable)
			if err != nil {
				return err
			}
			routeTable := routeTable1
			subnet.RouteTable = &routeTable
		}
	}

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &VirtualNetworksSubnet_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.VirtualNetworksSubnet_Spec{}
	err := subnet.AssignProperties_To_VirtualNetworksSubnet_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_VirtualNetworksSubnet_Spec populates our VirtualNetworksSubnet_Spec from the provided source VirtualNetworksSubnet_Spec
func (subnet *VirtualNetworksSubnet_Spec) AssignProperties_From_VirtualNetworksSubnet_Spec(source *storage.VirtualNetworksSubnet_Spec) error {

	// AddressPrefix
	subnet.AddressPrefix = genruntime.ClonePointerToString(source.AddressPrefix)

	// AddressPrefixes
	subnet.AddressPrefixes = genruntime.CloneSliceOfString(source.AddressPrefixes)

	// ApplicationGatewayIpConfigurations
	if source.ApplicationGatewayIpConfigurations != nil {
		applicationGatewayIpConfigurationList := make([]ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded, len(source.ApplicationGatewayIpConfigurations))
		for applicationGatewayIpConfigurationIndex, applicationGatewayIpConfigurationItem := range source.ApplicationGatewayIpConfigurations {
			var applicationGatewayIpConfiguration ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded
			err := applicationGatewayIpConfiguration.AssignProperties_From_ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded(&applicationGatewayIpConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ApplicationGatewayIpConfigurations")
			}
			applicationGatewayIpConfigurationList[applicationGatewayIpConfigurationIndex] = applicationGatewayIpConfiguration
		}
		subnet.ApplicationGatewayIpConfigurations = applicationGatewayIpConfigurationList
	} else {
		subnet.ApplicationGatewayIpConfigurations = nil
	}

	// AzureName
	subnet.AzureName = source.AzureName

	// Delegations
	if source.Delegations != nil {
		delegationList := make([]Delegation, len(source.Delegations))
		for delegationIndex, delegationItem := range source.Delegations {
			var delegation Delegation
			err := delegation.AssignProperties_From_Delegation(&delegationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Delegation() to populate field Delegations")
			}
			delegationList[delegationIndex] = delegation
		}
		subnet.Delegations = delegationList
	} else {
		subnet.Delegations = nil
	}

	// IpAllocations
	if source.IpAllocations != nil {
		ipAllocationList := make([]SubResource, len(source.IpAllocations))
		for ipAllocationIndex, ipAllocationItem := range source.IpAllocations {
			var ipAllocation SubResource
			err := ipAllocation.AssignProperties_From_SubResource(&ipAllocationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field IpAllocations")
			}
			ipAllocationList[ipAllocationIndex] = ipAllocation
		}
		subnet.IpAllocations = ipAllocationList
	} else {
		subnet.IpAllocations = nil
	}

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

	// NetworkSecurityGroup
	if source.NetworkSecurityGroup != nil {
		var networkSecurityGroup NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded
		err := networkSecurityGroup.AssignProperties_From_NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded(source.NetworkSecurityGroup)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field NetworkSecurityGroup")
		}
		subnet.NetworkSecurityGroup = &networkSecurityGroup
	} else {
		subnet.NetworkSecurityGroup = nil
	}

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

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

	// PrivateEndpointNetworkPolicies
	if source.PrivateEndpointNetworkPolicies != nil {
		privateEndpointNetworkPolicy := *source.PrivateEndpointNetworkPolicies
		privateEndpointNetworkPolicyTemp := genruntime.ToEnum(privateEndpointNetworkPolicy, subnetPropertiesFormat_PrivateEndpointNetworkPolicies_Values)
		subnet.PrivateEndpointNetworkPolicies = &privateEndpointNetworkPolicyTemp
	} else {
		subnet.PrivateEndpointNetworkPolicies = nil
	}

	// PrivateLinkServiceNetworkPolicies
	if source.PrivateLinkServiceNetworkPolicies != nil {
		privateLinkServiceNetworkPolicy := *source.PrivateLinkServiceNetworkPolicies
		privateLinkServiceNetworkPolicyTemp := genruntime.ToEnum(privateLinkServiceNetworkPolicy, subnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_Values)
		subnet.PrivateLinkServiceNetworkPolicies = &privateLinkServiceNetworkPolicyTemp
	} else {
		subnet.PrivateLinkServiceNetworkPolicies = nil
	}

	// RouteTable
	if source.RouteTable != nil {
		var routeTable RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded
		err := routeTable.AssignProperties_From_RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded(source.RouteTable)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field RouteTable")
		}
		subnet.RouteTable = &routeTable
	} else {
		subnet.RouteTable = nil
	}

	// ServiceEndpointPolicies
	if source.ServiceEndpointPolicies != nil {
		serviceEndpointPolicyList := make([]ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded, len(source.ServiceEndpointPolicies))
		for serviceEndpointPolicyIndex, serviceEndpointPolicyItem := range source.ServiceEndpointPolicies {
			var serviceEndpointPolicy ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded
			err := serviceEndpointPolicy.AssignProperties_From_ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded(&serviceEndpointPolicyItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ServiceEndpointPolicies")
			}
			serviceEndpointPolicyList[serviceEndpointPolicyIndex] = serviceEndpointPolicy
		}
		subnet.ServiceEndpointPolicies = serviceEndpointPolicyList
	} else {
		subnet.ServiceEndpointPolicies = nil
	}

	// ServiceEndpoints
	if source.ServiceEndpoints != nil {
		serviceEndpointList := make([]ServiceEndpointPropertiesFormat, len(source.ServiceEndpoints))
		for serviceEndpointIndex, serviceEndpointItem := range source.ServiceEndpoints {
			var serviceEndpoint ServiceEndpointPropertiesFormat
			err := serviceEndpoint.AssignProperties_From_ServiceEndpointPropertiesFormat(&serviceEndpointItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ServiceEndpointPropertiesFormat() to populate field ServiceEndpoints")
			}
			serviceEndpointList[serviceEndpointIndex] = serviceEndpoint
		}
		subnet.ServiceEndpoints = serviceEndpointList
	} else {
		subnet.ServiceEndpoints = nil
	}

	// No error
	return nil
}

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

	// AddressPrefix
	destination.AddressPrefix = genruntime.ClonePointerToString(subnet.AddressPrefix)

	// AddressPrefixes
	destination.AddressPrefixes = genruntime.CloneSliceOfString(subnet.AddressPrefixes)

	// ApplicationGatewayIpConfigurations
	if subnet.ApplicationGatewayIpConfigurations != nil {
		applicationGatewayIpConfigurationList := make([]storage.ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded, len(subnet.ApplicationGatewayIpConfigurations))
		for applicationGatewayIpConfigurationIndex, applicationGatewayIpConfigurationItem := range subnet.ApplicationGatewayIpConfigurations {
			var applicationGatewayIpConfiguration storage.ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded
			err := applicationGatewayIpConfigurationItem.AssignProperties_To_ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded(&applicationGatewayIpConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ApplicationGatewayIpConfigurations")
			}
			applicationGatewayIpConfigurationList[applicationGatewayIpConfigurationIndex] = applicationGatewayIpConfiguration
		}
		destination.ApplicationGatewayIpConfigurations = applicationGatewayIpConfigurationList
	} else {
		destination.ApplicationGatewayIpConfigurations = nil
	}

	// AzureName
	destination.AzureName = subnet.AzureName

	// Delegations
	if subnet.Delegations != nil {
		delegationList := make([]storage.Delegation, len(subnet.Delegations))
		for delegationIndex, delegationItem := range subnet.Delegations {
			var delegation storage.Delegation
			err := delegationItem.AssignProperties_To_Delegation(&delegation)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Delegation() to populate field Delegations")
			}
			delegationList[delegationIndex] = delegation
		}
		destination.Delegations = delegationList
	} else {
		destination.Delegations = nil
	}

	// IpAllocations
	if subnet.IpAllocations != nil {
		ipAllocationList := make([]storage.SubResource, len(subnet.IpAllocations))
		for ipAllocationIndex, ipAllocationItem := range subnet.IpAllocations {
			var ipAllocation storage.SubResource
			err := ipAllocationItem.AssignProperties_To_SubResource(&ipAllocation)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field IpAllocations")
			}
			ipAllocationList[ipAllocationIndex] = ipAllocation
		}
		destination.IpAllocations = ipAllocationList
	} else {
		destination.IpAllocations = nil
	}

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

	// NetworkSecurityGroup
	if subnet.NetworkSecurityGroup != nil {
		var networkSecurityGroup storage.NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded
		err := subnet.NetworkSecurityGroup.AssignProperties_To_NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded(&networkSecurityGroup)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field NetworkSecurityGroup")
		}
		destination.NetworkSecurityGroup = &networkSecurityGroup
	} else {
		destination.NetworkSecurityGroup = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = subnet.OriginalVersion()

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

	// PrivateEndpointNetworkPolicies
	if subnet.PrivateEndpointNetworkPolicies != nil {
		privateEndpointNetworkPolicy := string(*subnet.PrivateEndpointNetworkPolicies)
		destination.PrivateEndpointNetworkPolicies = &privateEndpointNetworkPolicy
	} else {
		destination.PrivateEndpointNetworkPolicies = nil
	}

	// PrivateLinkServiceNetworkPolicies
	if subnet.PrivateLinkServiceNetworkPolicies != nil {
		privateLinkServiceNetworkPolicy := string(*subnet.PrivateLinkServiceNetworkPolicies)
		destination.PrivateLinkServiceNetworkPolicies = &privateLinkServiceNetworkPolicy
	} else {
		destination.PrivateLinkServiceNetworkPolicies = nil
	}

	// RouteTable
	if subnet.RouteTable != nil {
		var routeTable storage.RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded
		err := subnet.RouteTable.AssignProperties_To_RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded(&routeTable)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field RouteTable")
		}
		destination.RouteTable = &routeTable
	} else {
		destination.RouteTable = nil
	}

	// ServiceEndpointPolicies
	if subnet.ServiceEndpointPolicies != nil {
		serviceEndpointPolicyList := make([]storage.ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded, len(subnet.ServiceEndpointPolicies))
		for serviceEndpointPolicyIndex, serviceEndpointPolicyItem := range subnet.ServiceEndpointPolicies {
			var serviceEndpointPolicy storage.ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded
			err := serviceEndpointPolicyItem.AssignProperties_To_ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded(&serviceEndpointPolicy)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ServiceEndpointPolicies")
			}
			serviceEndpointPolicyList[serviceEndpointPolicyIndex] = serviceEndpointPolicy
		}
		destination.ServiceEndpointPolicies = serviceEndpointPolicyList
	} else {
		destination.ServiceEndpointPolicies = nil
	}

	// ServiceEndpoints
	if subnet.ServiceEndpoints != nil {
		serviceEndpointList := make([]storage.ServiceEndpointPropertiesFormat, len(subnet.ServiceEndpoints))
		for serviceEndpointIndex, serviceEndpointItem := range subnet.ServiceEndpoints {
			var serviceEndpoint storage.ServiceEndpointPropertiesFormat
			err := serviceEndpointItem.AssignProperties_To_ServiceEndpointPropertiesFormat(&serviceEndpoint)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ServiceEndpointPropertiesFormat() to populate field ServiceEndpoints")
			}
			serviceEndpointList[serviceEndpointIndex] = serviceEndpoint
		}
		destination.ServiceEndpoints = serviceEndpointList
	} else {
		destination.ServiceEndpoints = nil
	}

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

	// No error
	return nil
}

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

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

type VirtualNetworksSubnet_STATUS struct {
	// AddressPrefix: The address prefix for the subnet.
	AddressPrefix *string `json:"addressPrefix,omitempty"`

	// AddressPrefixes: List of address prefixes for the subnet.
	AddressPrefixes []string `json:"addressPrefixes,omitempty"`

	// ApplicationGatewayIpConfigurations: Application gateway IP configurations of virtual network resource.
	ApplicationGatewayIpConfigurations []ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded `json:"applicationGatewayIpConfigurations,omitempty"`

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

	// Delegations: An array of references to the delegations on the subnet.
	Delegations []Delegation_STATUS `json:"delegations,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"`

	// IpAllocations: Array of IpAllocation which reference this subnet.
	IpAllocations []SubResource_STATUS `json:"ipAllocations,omitempty"`

	// IpConfigurationProfiles: Array of IP configuration profiles which reference this subnet.
	IpConfigurationProfiles []IPConfigurationProfile_STATUS `json:"ipConfigurationProfiles,omitempty"`

	// IpConfigurations: An array of references to the network interface IP configurations using subnet. This field is not
	// included if there are more than 2000 entries.
	IpConfigurations []IPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded `json:"ipConfigurations,omitempty"`

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

	// NatGateway: Nat gateway associated with this subnet.
	NatGateway *SubResource_STATUS `json:"natGateway,omitempty"`

	// NetworkSecurityGroup: The reference to the NetworkSecurityGroup resource.
	NetworkSecurityGroup *NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded `json:"networkSecurityGroup,omitempty"`

	// PrivateEndpointNetworkPolicies: Enable or Disable apply network policies on private end point in the subnet.
	PrivateEndpointNetworkPolicies *SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS `json:"privateEndpointNetworkPolicies,omitempty"`

	// PrivateEndpoints: An array of references to private endpoints.
	PrivateEndpoints []PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded `json:"privateEndpoints,omitempty"`

	// PrivateLinkServiceNetworkPolicies: Enable or Disable apply network policies on private link service in the subnet.
	PrivateLinkServiceNetworkPolicies *SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS `json:"privateLinkServiceNetworkPolicies,omitempty"`

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

	// Purpose: A read-only string identifying the intention of use for this subnet based on delegations and other user-defined
	// properties.
	Purpose *string `json:"purpose,omitempty"`

	// ResourceNavigationLinks: An array of references to the external resources using subnet.
	ResourceNavigationLinks []ResourceNavigationLink_STATUS `json:"resourceNavigationLinks,omitempty"`

	// RouteTable: The reference to the RouteTable resource.
	RouteTable *RouteTable_STATUS_SubResourceEmbedded `json:"routeTable,omitempty"`

	// ServiceAssociationLinks: An array of references to services injecting into this subnet.
	ServiceAssociationLinks []ServiceAssociationLink_STATUS `json:"serviceAssociationLinks,omitempty"`

	// ServiceEndpointPolicies: An array of service endpoint policies.
	ServiceEndpointPolicies []ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded `json:"serviceEndpointPolicies,omitempty"`

	// ServiceEndpoints: An array of service endpoints.
	ServiceEndpoints []ServiceEndpointPropertiesFormat_STATUS `json:"serviceEndpoints,omitempty"`

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

var _ genruntime.ConvertibleStatus = &VirtualNetworksSubnet_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.VirtualNetworksSubnet_STATUS{}
	err := subnet.AssignProperties_To_VirtualNetworksSubnet_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 = &VirtualNetworksSubnet_STATUS{}

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

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

	// Set property "AddressPrefix":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AddressPrefix != nil {
			addressPrefix := *typedInput.Properties.AddressPrefix
			subnet.AddressPrefix = &addressPrefix
		}
	}

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

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

	// no assignment for property "Conditions"

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

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

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

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

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

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

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

	// Set property "NatGateway":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NatGateway != nil {
			var natGateway1 SubResource_STATUS
			err := natGateway1.PopulateFromARM(owner, *typedInput.Properties.NatGateway)
			if err != nil {
				return err
			}
			natGateway := natGateway1
			subnet.NatGateway = &natGateway
		}
	}

	// Set property "NetworkSecurityGroup":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NetworkSecurityGroup != nil {
			var networkSecurityGroup1 NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
			err := networkSecurityGroup1.PopulateFromARM(owner, *typedInput.Properties.NetworkSecurityGroup)
			if err != nil {
				return err
			}
			networkSecurityGroup := networkSecurityGroup1
			subnet.NetworkSecurityGroup = &networkSecurityGroup
		}
	}

	// Set property "PrivateEndpointNetworkPolicies":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateEndpointNetworkPolicies != nil {
			var temp string
			temp = string(*typedInput.Properties.PrivateEndpointNetworkPolicies)
			privateEndpointNetworkPolicies := SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS(temp)
			subnet.PrivateEndpointNetworkPolicies = &privateEndpointNetworkPolicies
		}
	}

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

	// Set property "PrivateLinkServiceNetworkPolicies":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrivateLinkServiceNetworkPolicies != nil {
			var temp string
			temp = string(*typedInput.Properties.PrivateLinkServiceNetworkPolicies)
			privateLinkServiceNetworkPolicies := SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS(temp)
			subnet.PrivateLinkServiceNetworkPolicies = &privateLinkServiceNetworkPolicies
		}
	}

	// 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)
			subnet.ProvisioningState = &provisioningState
		}
	}

	// Set property "Purpose":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Purpose != nil {
			purpose := *typedInput.Properties.Purpose
			subnet.Purpose = &purpose
		}
	}

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

	// Set property "RouteTable":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RouteTable != nil {
			var routeTable1 RouteTable_STATUS_SubResourceEmbedded
			err := routeTable1.PopulateFromARM(owner, *typedInput.Properties.RouteTable)
			if err != nil {
				return err
			}
			routeTable := routeTable1
			subnet.RouteTable = &routeTable
		}
	}

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_VirtualNetworksSubnet_STATUS populates our VirtualNetworksSubnet_STATUS from the provided source VirtualNetworksSubnet_STATUS
func (subnet *VirtualNetworksSubnet_STATUS) AssignProperties_From_VirtualNetworksSubnet_STATUS(source *storage.VirtualNetworksSubnet_STATUS) error {

	// AddressPrefix
	subnet.AddressPrefix = genruntime.ClonePointerToString(source.AddressPrefix)

	// AddressPrefixes
	subnet.AddressPrefixes = genruntime.CloneSliceOfString(source.AddressPrefixes)

	// ApplicationGatewayIpConfigurations
	if source.ApplicationGatewayIpConfigurations != nil {
		applicationGatewayIpConfigurationList := make([]ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded, len(source.ApplicationGatewayIpConfigurations))
		for applicationGatewayIpConfigurationIndex, applicationGatewayIpConfigurationItem := range source.ApplicationGatewayIpConfigurations {
			var applicationGatewayIpConfiguration ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
			err := applicationGatewayIpConfiguration.AssignProperties_From_ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(&applicationGatewayIpConfigurationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ApplicationGatewayIpConfigurations")
			}
			applicationGatewayIpConfigurationList[applicationGatewayIpConfigurationIndex] = applicationGatewayIpConfiguration
		}
		subnet.ApplicationGatewayIpConfigurations = applicationGatewayIpConfigurationList
	} else {
		subnet.ApplicationGatewayIpConfigurations = nil
	}

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

	// Delegations
	if source.Delegations != nil {
		delegationList := make([]Delegation_STATUS, len(source.Delegations))
		for delegationIndex, delegationItem := range source.Delegations {
			var delegation Delegation_STATUS
			err := delegation.AssignProperties_From_Delegation_STATUS(&delegationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_Delegation_STATUS() to populate field Delegations")
			}
			delegationList[delegationIndex] = delegation
		}
		subnet.Delegations = delegationList
	} else {
		subnet.Delegations = nil
	}

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

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

	// IpAllocations
	if source.IpAllocations != nil {
		ipAllocationList := make([]SubResource_STATUS, len(source.IpAllocations))
		for ipAllocationIndex, ipAllocationItem := range source.IpAllocations {
			var ipAllocation SubResource_STATUS
			err := ipAllocation.AssignProperties_From_SubResource_STATUS(&ipAllocationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field IpAllocations")
			}
			ipAllocationList[ipAllocationIndex] = ipAllocation
		}
		subnet.IpAllocations = ipAllocationList
	} else {
		subnet.IpAllocations = nil
	}

	// IpConfigurationProfiles
	if source.IpConfigurationProfiles != nil {
		ipConfigurationProfileList := make([]IPConfigurationProfile_STATUS, len(source.IpConfigurationProfiles))
		for ipConfigurationProfileIndex, ipConfigurationProfileItem := range source.IpConfigurationProfiles {
			var ipConfigurationProfile IPConfigurationProfile_STATUS
			err := ipConfigurationProfile.AssignProperties_From_IPConfigurationProfile_STATUS(&ipConfigurationProfileItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_IPConfigurationProfile_STATUS() to populate field IpConfigurationProfiles")
			}
			ipConfigurationProfileList[ipConfigurationProfileIndex] = ipConfigurationProfile
		}
		subnet.IpConfigurationProfiles = ipConfigurationProfileList
	} else {
		subnet.IpConfigurationProfiles = nil
	}

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

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

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

	// NetworkSecurityGroup
	if source.NetworkSecurityGroup != nil {
		var networkSecurityGroup NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
		err := networkSecurityGroup.AssignProperties_From_NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(source.NetworkSecurityGroup)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field NetworkSecurityGroup")
		}
		subnet.NetworkSecurityGroup = &networkSecurityGroup
	} else {
		subnet.NetworkSecurityGroup = nil
	}

	// PrivateEndpointNetworkPolicies
	if source.PrivateEndpointNetworkPolicies != nil {
		privateEndpointNetworkPolicy := *source.PrivateEndpointNetworkPolicies
		privateEndpointNetworkPolicyTemp := genruntime.ToEnum(privateEndpointNetworkPolicy, subnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS_Values)
		subnet.PrivateEndpointNetworkPolicies = &privateEndpointNetworkPolicyTemp
	} else {
		subnet.PrivateEndpointNetworkPolicies = nil
	}

	// PrivateEndpoints
	if source.PrivateEndpoints != nil {
		privateEndpointList := make([]PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded, len(source.PrivateEndpoints))
		for privateEndpointIndex, privateEndpointItem := range source.PrivateEndpoints {
			var privateEndpoint PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
			err := privateEndpoint.AssignProperties_From_PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(&privateEndpointItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field PrivateEndpoints")
			}
			privateEndpointList[privateEndpointIndex] = privateEndpoint
		}
		subnet.PrivateEndpoints = privateEndpointList
	} else {
		subnet.PrivateEndpoints = nil
	}

	// PrivateLinkServiceNetworkPolicies
	if source.PrivateLinkServiceNetworkPolicies != nil {
		privateLinkServiceNetworkPolicy := *source.PrivateLinkServiceNetworkPolicies
		privateLinkServiceNetworkPolicyTemp := genruntime.ToEnum(privateLinkServiceNetworkPolicy, subnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS_Values)
		subnet.PrivateLinkServiceNetworkPolicies = &privateLinkServiceNetworkPolicyTemp
	} else {
		subnet.PrivateLinkServiceNetworkPolicies = nil
	}

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

	// Purpose
	subnet.Purpose = genruntime.ClonePointerToString(source.Purpose)

	// ResourceNavigationLinks
	if source.ResourceNavigationLinks != nil {
		resourceNavigationLinkList := make([]ResourceNavigationLink_STATUS, len(source.ResourceNavigationLinks))
		for resourceNavigationLinkIndex, resourceNavigationLinkItem := range source.ResourceNavigationLinks {
			var resourceNavigationLink ResourceNavigationLink_STATUS
			err := resourceNavigationLink.AssignProperties_From_ResourceNavigationLink_STATUS(&resourceNavigationLinkItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ResourceNavigationLink_STATUS() to populate field ResourceNavigationLinks")
			}
			resourceNavigationLinkList[resourceNavigationLinkIndex] = resourceNavigationLink
		}
		subnet.ResourceNavigationLinks = resourceNavigationLinkList
	} else {
		subnet.ResourceNavigationLinks = nil
	}

	// RouteTable
	if source.RouteTable != nil {
		var routeTable RouteTable_STATUS_SubResourceEmbedded
		err := routeTable.AssignProperties_From_RouteTable_STATUS_SubResourceEmbedded(source.RouteTable)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_RouteTable_STATUS_SubResourceEmbedded() to populate field RouteTable")
		}
		subnet.RouteTable = &routeTable
	} else {
		subnet.RouteTable = nil
	}

	// ServiceAssociationLinks
	if source.ServiceAssociationLinks != nil {
		serviceAssociationLinkList := make([]ServiceAssociationLink_STATUS, len(source.ServiceAssociationLinks))
		for serviceAssociationLinkIndex, serviceAssociationLinkItem := range source.ServiceAssociationLinks {
			var serviceAssociationLink ServiceAssociationLink_STATUS
			err := serviceAssociationLink.AssignProperties_From_ServiceAssociationLink_STATUS(&serviceAssociationLinkItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ServiceAssociationLink_STATUS() to populate field ServiceAssociationLinks")
			}
			serviceAssociationLinkList[serviceAssociationLinkIndex] = serviceAssociationLink
		}
		subnet.ServiceAssociationLinks = serviceAssociationLinkList
	} else {
		subnet.ServiceAssociationLinks = nil
	}

	// ServiceEndpointPolicies
	if source.ServiceEndpointPolicies != nil {
		serviceEndpointPolicyList := make([]ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded, len(source.ServiceEndpointPolicies))
		for serviceEndpointPolicyIndex, serviceEndpointPolicyItem := range source.ServiceEndpointPolicies {
			var serviceEndpointPolicy ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
			err := serviceEndpointPolicy.AssignProperties_From_ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(&serviceEndpointPolicyItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ServiceEndpointPolicies")
			}
			serviceEndpointPolicyList[serviceEndpointPolicyIndex] = serviceEndpointPolicy
		}
		subnet.ServiceEndpointPolicies = serviceEndpointPolicyList
	} else {
		subnet.ServiceEndpointPolicies = nil
	}

	// ServiceEndpoints
	if source.ServiceEndpoints != nil {
		serviceEndpointList := make([]ServiceEndpointPropertiesFormat_STATUS, len(source.ServiceEndpoints))
		for serviceEndpointIndex, serviceEndpointItem := range source.ServiceEndpoints {
			var serviceEndpoint ServiceEndpointPropertiesFormat_STATUS
			err := serviceEndpoint.AssignProperties_From_ServiceEndpointPropertiesFormat_STATUS(&serviceEndpointItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ServiceEndpointPropertiesFormat_STATUS() to populate field ServiceEndpoints")
			}
			serviceEndpointList[serviceEndpointIndex] = serviceEndpoint
		}
		subnet.ServiceEndpoints = serviceEndpointList
	} else {
		subnet.ServiceEndpoints = nil
	}

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

	// No error
	return nil
}

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

	// AddressPrefix
	destination.AddressPrefix = genruntime.ClonePointerToString(subnet.AddressPrefix)

	// AddressPrefixes
	destination.AddressPrefixes = genruntime.CloneSliceOfString(subnet.AddressPrefixes)

	// ApplicationGatewayIpConfigurations
	if subnet.ApplicationGatewayIpConfigurations != nil {
		applicationGatewayIpConfigurationList := make([]storage.ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded, len(subnet.ApplicationGatewayIpConfigurations))
		for applicationGatewayIpConfigurationIndex, applicationGatewayIpConfigurationItem := range subnet.ApplicationGatewayIpConfigurations {
			var applicationGatewayIpConfiguration storage.ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
			err := applicationGatewayIpConfigurationItem.AssignProperties_To_ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(&applicationGatewayIpConfiguration)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ApplicationGatewayIpConfigurations")
			}
			applicationGatewayIpConfigurationList[applicationGatewayIpConfigurationIndex] = applicationGatewayIpConfiguration
		}
		destination.ApplicationGatewayIpConfigurations = applicationGatewayIpConfigurationList
	} else {
		destination.ApplicationGatewayIpConfigurations = nil
	}

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

	// Delegations
	if subnet.Delegations != nil {
		delegationList := make([]storage.Delegation_STATUS, len(subnet.Delegations))
		for delegationIndex, delegationItem := range subnet.Delegations {
			var delegation storage.Delegation_STATUS
			err := delegationItem.AssignProperties_To_Delegation_STATUS(&delegation)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_Delegation_STATUS() to populate field Delegations")
			}
			delegationList[delegationIndex] = delegation
		}
		destination.Delegations = delegationList
	} else {
		destination.Delegations = nil
	}

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

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

	// IpAllocations
	if subnet.IpAllocations != nil {
		ipAllocationList := make([]storage.SubResource_STATUS, len(subnet.IpAllocations))
		for ipAllocationIndex, ipAllocationItem := range subnet.IpAllocations {
			var ipAllocation storage.SubResource_STATUS
			err := ipAllocationItem.AssignProperties_To_SubResource_STATUS(&ipAllocation)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field IpAllocations")
			}
			ipAllocationList[ipAllocationIndex] = ipAllocation
		}
		destination.IpAllocations = ipAllocationList
	} else {
		destination.IpAllocations = nil
	}

	// IpConfigurationProfiles
	if subnet.IpConfigurationProfiles != nil {
		ipConfigurationProfileList := make([]storage.IPConfigurationProfile_STATUS, len(subnet.IpConfigurationProfiles))
		for ipConfigurationProfileIndex, ipConfigurationProfileItem := range subnet.IpConfigurationProfiles {
			var ipConfigurationProfile storage.IPConfigurationProfile_STATUS
			err := ipConfigurationProfileItem.AssignProperties_To_IPConfigurationProfile_STATUS(&ipConfigurationProfile)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_IPConfigurationProfile_STATUS() to populate field IpConfigurationProfiles")
			}
			ipConfigurationProfileList[ipConfigurationProfileIndex] = ipConfigurationProfile
		}
		destination.IpConfigurationProfiles = ipConfigurationProfileList
	} else {
		destination.IpConfigurationProfiles = nil
	}

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

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

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

	// NetworkSecurityGroup
	if subnet.NetworkSecurityGroup != nil {
		var networkSecurityGroup storage.NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
		err := subnet.NetworkSecurityGroup.AssignProperties_To_NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(&networkSecurityGroup)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field NetworkSecurityGroup")
		}
		destination.NetworkSecurityGroup = &networkSecurityGroup
	} else {
		destination.NetworkSecurityGroup = nil
	}

	// PrivateEndpointNetworkPolicies
	if subnet.PrivateEndpointNetworkPolicies != nil {
		privateEndpointNetworkPolicy := string(*subnet.PrivateEndpointNetworkPolicies)
		destination.PrivateEndpointNetworkPolicies = &privateEndpointNetworkPolicy
	} else {
		destination.PrivateEndpointNetworkPolicies = nil
	}

	// PrivateEndpoints
	if subnet.PrivateEndpoints != nil {
		privateEndpointList := make([]storage.PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded, len(subnet.PrivateEndpoints))
		for privateEndpointIndex, privateEndpointItem := range subnet.PrivateEndpoints {
			var privateEndpoint storage.PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
			err := privateEndpointItem.AssignProperties_To_PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(&privateEndpoint)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field PrivateEndpoints")
			}
			privateEndpointList[privateEndpointIndex] = privateEndpoint
		}
		destination.PrivateEndpoints = privateEndpointList
	} else {
		destination.PrivateEndpoints = nil
	}

	// PrivateLinkServiceNetworkPolicies
	if subnet.PrivateLinkServiceNetworkPolicies != nil {
		privateLinkServiceNetworkPolicy := string(*subnet.PrivateLinkServiceNetworkPolicies)
		destination.PrivateLinkServiceNetworkPolicies = &privateLinkServiceNetworkPolicy
	} else {
		destination.PrivateLinkServiceNetworkPolicies = nil
	}

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

	// Purpose
	destination.Purpose = genruntime.ClonePointerToString(subnet.Purpose)

	// ResourceNavigationLinks
	if subnet.ResourceNavigationLinks != nil {
		resourceNavigationLinkList := make([]storage.ResourceNavigationLink_STATUS, len(subnet.ResourceNavigationLinks))
		for resourceNavigationLinkIndex, resourceNavigationLinkItem := range subnet.ResourceNavigationLinks {
			var resourceNavigationLink storage.ResourceNavigationLink_STATUS
			err := resourceNavigationLinkItem.AssignProperties_To_ResourceNavigationLink_STATUS(&resourceNavigationLink)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ResourceNavigationLink_STATUS() to populate field ResourceNavigationLinks")
			}
			resourceNavigationLinkList[resourceNavigationLinkIndex] = resourceNavigationLink
		}
		destination.ResourceNavigationLinks = resourceNavigationLinkList
	} else {
		destination.ResourceNavigationLinks = nil
	}

	// RouteTable
	if subnet.RouteTable != nil {
		var routeTable storage.RouteTable_STATUS_SubResourceEmbedded
		err := subnet.RouteTable.AssignProperties_To_RouteTable_STATUS_SubResourceEmbedded(&routeTable)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_RouteTable_STATUS_SubResourceEmbedded() to populate field RouteTable")
		}
		destination.RouteTable = &routeTable
	} else {
		destination.RouteTable = nil
	}

	// ServiceAssociationLinks
	if subnet.ServiceAssociationLinks != nil {
		serviceAssociationLinkList := make([]storage.ServiceAssociationLink_STATUS, len(subnet.ServiceAssociationLinks))
		for serviceAssociationLinkIndex, serviceAssociationLinkItem := range subnet.ServiceAssociationLinks {
			var serviceAssociationLink storage.ServiceAssociationLink_STATUS
			err := serviceAssociationLinkItem.AssignProperties_To_ServiceAssociationLink_STATUS(&serviceAssociationLink)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ServiceAssociationLink_STATUS() to populate field ServiceAssociationLinks")
			}
			serviceAssociationLinkList[serviceAssociationLinkIndex] = serviceAssociationLink
		}
		destination.ServiceAssociationLinks = serviceAssociationLinkList
	} else {
		destination.ServiceAssociationLinks = nil
	}

	// ServiceEndpointPolicies
	if subnet.ServiceEndpointPolicies != nil {
		serviceEndpointPolicyList := make([]storage.ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded, len(subnet.ServiceEndpointPolicies))
		for serviceEndpointPolicyIndex, serviceEndpointPolicyItem := range subnet.ServiceEndpointPolicies {
			var serviceEndpointPolicy storage.ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
			err := serviceEndpointPolicyItem.AssignProperties_To_ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(&serviceEndpointPolicy)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded() to populate field ServiceEndpointPolicies")
			}
			serviceEndpointPolicyList[serviceEndpointPolicyIndex] = serviceEndpointPolicy
		}
		destination.ServiceEndpointPolicies = serviceEndpointPolicyList
	} else {
		destination.ServiceEndpointPolicies = nil
	}

	// ServiceEndpoints
	if subnet.ServiceEndpoints != nil {
		serviceEndpointList := make([]storage.ServiceEndpointPropertiesFormat_STATUS, len(subnet.ServiceEndpoints))
		for serviceEndpointIndex, serviceEndpointItem := range subnet.ServiceEndpoints {
			var serviceEndpoint storage.ServiceEndpointPropertiesFormat_STATUS
			err := serviceEndpointItem.AssignProperties_To_ServiceEndpointPropertiesFormat_STATUS(&serviceEndpoint)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ServiceEndpointPropertiesFormat_STATUS() to populate field ServiceEndpoints")
			}
			serviceEndpointList[serviceEndpointIndex] = serviceEndpoint
		}
		destination.ServiceEndpoints = serviceEndpointList
	} else {
		destination.ServiceEndpoints = nil
	}

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

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

	// No error
	return nil
}

// IP configuration of an application gateway. Currently 1 public and 1 private IP configuration is allowed.
type ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded from our ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.ApplicationGatewayIPConfiguration_STATUS_VirtualNetworks_Subnet_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
}

// IP configuration of an application gateway. Currently 1 public and 1 private IP configuration is allowed.
type ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (embedded *ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if embedded == nil {
		return nil, nil
	}
	result := &arm.ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_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 *ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded from our ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.ApplicationGatewayIPConfiguration_VirtualNetworks_Subnet_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
}

// Details the service to which the subnet is delegated.
type Delegation struct {
	// Name: The name of the resource that is unique within a subnet. This name can be used to access the resource.
	Name *string `json:"name,omitempty"`

	// ServiceName: The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers).
	ServiceName *string `json:"serviceName,omitempty"`
}

var _ genruntime.ARMTransformer = &Delegation{}

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

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

	// Set property "Properties":
	if delegation.ServiceName != nil {
		result.Properties = &arm.ServiceDelegationPropertiesFormat{}
	}
	if delegation.ServiceName != nil {
		serviceName := *delegation.ServiceName
		result.Properties.ServiceName = &serviceName
	}
	return result, nil
}

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

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

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

	// Set property "ServiceName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ServiceName != nil {
			serviceName := *typedInput.Properties.ServiceName
			delegation.ServiceName = &serviceName
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Delegation populates our Delegation from the provided source Delegation
func (delegation *Delegation) AssignProperties_From_Delegation(source *storage.Delegation) error {

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

	// ServiceName
	delegation.ServiceName = genruntime.ClonePointerToString(source.ServiceName)

	// No error
	return nil
}

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

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

	// ServiceName
	destination.ServiceName = genruntime.ClonePointerToString(delegation.ServiceName)

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

	// No error
	return nil
}

// Details the service to which the subnet is delegated.
type Delegation_STATUS struct {
	// Actions: The actions permitted to the service upon delegation.
	Actions []string `json:"actions,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"`

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

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

	// ServiceName: The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers).
	ServiceName *string `json:"serviceName,omitempty"`

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

var _ genruntime.FromARMConverter = &Delegation_STATUS{}

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

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

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

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

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

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

	// 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)
			delegation.ProvisioningState = &provisioningState
		}
	}

	// Set property "ServiceName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ServiceName != nil {
			serviceName := *typedInput.Properties.ServiceName
			delegation.ServiceName = &serviceName
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_Delegation_STATUS populates our Delegation_STATUS from the provided source Delegation_STATUS
func (delegation *Delegation_STATUS) AssignProperties_From_Delegation_STATUS(source *storage.Delegation_STATUS) error {

	// Actions
	delegation.Actions = genruntime.CloneSliceOfString(source.Actions)

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

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

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

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

	// ServiceName
	delegation.ServiceName = genruntime.ClonePointerToString(source.ServiceName)

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

	// No error
	return nil
}

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

	// Actions
	destination.Actions = genruntime.CloneSliceOfString(delegation.Actions)

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

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

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

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

	// ServiceName
	destination.ServiceName = genruntime.ClonePointerToString(delegation.ServiceName)

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

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

	// No error
	return nil
}

// IP configuration.
type IPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &IPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_IPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination IPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded from our IPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *IPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_IPConfiguration_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.IPConfiguration_STATUS_VirtualNetworks_Subnet_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
}

// IP configuration profile child resource.
type IPConfigurationProfile_STATUS struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &IPConfigurationProfile_STATUS{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

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

var _ genruntime.FromARMConverter = &NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded from our NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.NetworkSecurityGroup_STATUS_VirtualNetworks_Subnet_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
}

// NetworkSecurityGroup resource.
type NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (embedded *NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if embedded == nil {
		return nil, nil
	}
	result := &arm.NetworkSecurityGroupSpec_VirtualNetworks_Subnet_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 *NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded from our NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_NetworkSecurityGroupSpec_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.NetworkSecurityGroupSpec_VirtualNetworks_Subnet_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
}

// Private endpoint resource.
type PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded from our PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_PrivateEndpoint_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.PrivateEndpoint_STATUS_VirtualNetworks_Subnet_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
}

// ResourceNavigationLink resource.
type ResourceNavigationLink_STATUS struct {
	// Id: Resource navigation link identifier.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &ResourceNavigationLink_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ResourceNavigationLink_STATUS populates our ResourceNavigationLink_STATUS from the provided source ResourceNavigationLink_STATUS
func (link *ResourceNavigationLink_STATUS) AssignProperties_From_ResourceNavigationLink_STATUS(source *storage.ResourceNavigationLink_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Route table resource.
type RouteTable_STATUS_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &RouteTable_STATUS_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_RouteTable_STATUS_SubResourceEmbedded populates the provided destination RouteTable_STATUS_SubResourceEmbedded from our RouteTable_STATUS_SubResourceEmbedded
func (embedded *RouteTable_STATUS_SubResourceEmbedded) AssignProperties_To_RouteTable_STATUS_SubResourceEmbedded(destination *storage.RouteTable_STATUS_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
}

// Route table resource.
type RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (embedded *RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if embedded == nil {
		return nil, nil
	}
	result := &arm.RouteTableSpec_VirtualNetworks_Subnet_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 *RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded from our RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_RouteTableSpec_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.RouteTableSpec_VirtualNetworks_Subnet_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
}

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

var _ genruntime.FromARMConverter = &ServiceAssociationLink_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ServiceAssociationLink_STATUS populates our ServiceAssociationLink_STATUS from the provided source ServiceAssociationLink_STATUS
func (link *ServiceAssociationLink_STATUS) AssignProperties_From_ServiceAssociationLink_STATUS(source *storage.ServiceAssociationLink_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Service End point policy resource.
type ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded from our ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.ServiceEndpointPolicy_STATUS_VirtualNetworks_Subnet_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
}

// Service End point policy resource.
type ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded struct {
	// Reference: Resource ID.
	Reference *genruntime.ResourceReference `armReference:"Id" json:"reference,omitempty"`
}

var _ genruntime.ARMTransformer = &ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (embedded *ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if embedded == nil {
		return nil, nil
	}
	result := &arm.ServiceEndpointPolicySpec_VirtualNetworks_Subnet_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 *ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded{}
}

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

	// no assignment for property "Reference"

	// No error
	return nil
}

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

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

	// No error
	return nil
}

// AssignProperties_To_ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded populates the provided destination ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded from our ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded
func (embedded *ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded) AssignProperties_To_ServiceEndpointPolicySpec_VirtualNetworks_Subnet_SubResourceEmbedded(destination *storage.ServiceEndpointPolicySpec_VirtualNetworks_Subnet_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
}

// The service endpoint properties.
type ServiceEndpointPropertiesFormat struct {
	// Locations: A list of locations.
	Locations []string `json:"locations,omitempty"`

	// Service: The type of the endpoint service.
	Service *string `json:"service,omitempty"`
}

var _ genruntime.ARMTransformer = &ServiceEndpointPropertiesFormat{}

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

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

	// Set property "Service":
	if format.Service != nil {
		service := *format.Service
		result.Service = &service
	}
	return result, nil
}

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ServiceEndpointPropertiesFormat populates our ServiceEndpointPropertiesFormat from the provided source ServiceEndpointPropertiesFormat
func (format *ServiceEndpointPropertiesFormat) AssignProperties_From_ServiceEndpointPropertiesFormat(source *storage.ServiceEndpointPropertiesFormat) error {

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

// The service endpoint properties.
type ServiceEndpointPropertiesFormat_STATUS struct {
	// Locations: A list of locations.
	Locations []string `json:"locations,omitempty"`

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

	// Service: The type of the endpoint service.
	Service *string `json:"service,omitempty"`
}

var _ genruntime.FromARMConverter = &ServiceEndpointPropertiesFormat_STATUS{}

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_ServiceEndpointPropertiesFormat_STATUS populates our ServiceEndpointPropertiesFormat_STATUS from the provided source ServiceEndpointPropertiesFormat_STATUS
func (format *ServiceEndpointPropertiesFormat_STATUS) AssignProperties_From_ServiceEndpointPropertiesFormat_STATUS(source *storage.ServiceEndpointPropertiesFormat_STATUS) error {

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

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

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

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

const (
	SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_Disabled = SubnetPropertiesFormat_PrivateEndpointNetworkPolicies("Disabled")
	SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_Enabled  = SubnetPropertiesFormat_PrivateEndpointNetworkPolicies("Enabled")
)

// Mapping from string to SubnetPropertiesFormat_PrivateEndpointNetworkPolicies
var subnetPropertiesFormat_PrivateEndpointNetworkPolicies_Values = map[string]SubnetPropertiesFormat_PrivateEndpointNetworkPolicies{
	"disabled": SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_Disabled,
	"enabled":  SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_Enabled,
}

type SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS string

const (
	SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS_Disabled = SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS("Disabled")
	SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS_Enabled  = SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS("Enabled")
)

// Mapping from string to SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS
var subnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS_Values = map[string]SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS{
	"disabled": SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS_Disabled,
	"enabled":  SubnetPropertiesFormat_PrivateEndpointNetworkPolicies_STATUS_Enabled,
}

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

const (
	SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_Disabled = SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies("Disabled")
	SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_Enabled  = SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies("Enabled")
)

// Mapping from string to SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies
var subnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_Values = map[string]SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies{
	"disabled": SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_Disabled,
	"enabled":  SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_Enabled,
}

type SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS string

const (
	SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS_Disabled = SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS("Disabled")
	SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS_Enabled  = SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS("Enabled")
)

// Mapping from string to SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS
var subnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS_Values = map[string]SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS{
	"disabled": SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS_Disabled,
	"enabled":  SubnetPropertiesFormat_PrivateLinkServiceNetworkPolicies_STATUS_Enabled,
}

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

func init() {
	SchemeBuilder.Register(&VirtualNetworksSubnet{}, &VirtualNetworksSubnetList{})
}
