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

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

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

var _ conditions.Conditioner = &BastionHost{}

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

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

var _ conversion.Convertible = &BastionHost{}

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

	return host.AssignProperties_From_BastionHost(source)
}

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

	return host.AssignProperties_To_BastionHost(destination)
}

var _ configmaps.Exporter = &BastionHost{}

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

var _ secrets.Exporter = &BastionHost{}

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

var _ genruntime.ImportableResource = &BastionHost{}

// InitializeSpec initializes the spec for this resource from the given status
func (host *BastionHost) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*BastionHost_STATUS); ok {
		return host.Spec.Initialize_From_BastionHost_STATUS(s)
	}

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

var _ genruntime.KubernetesResource = &BastionHost{}

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

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

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

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

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

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

// NewEmptyStatus returns a new empty (blank) status
func (host *BastionHost) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &BastionHost_STATUS{}
}

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

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

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

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

	host.Status = st
	return nil
}

// AssignProperties_From_BastionHost populates our BastionHost from the provided source BastionHost
func (host *BastionHost) AssignProperties_From_BastionHost(source *storage.BastionHost) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_BastionHost populates the provided destination BastionHost from our BastionHost
func (host *BastionHost) AssignProperties_To_BastionHost(destination *storage.BastionHost) error {

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

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

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

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

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

	// DisableCopyPaste: Enable/Disable Copy/Paste feature of the Bastion Host resource.
	DisableCopyPaste *bool `json:"disableCopyPaste,omitempty"`

	// DnsName: FQDN for the endpoint on which bastion host is accessible.
	DnsName *string `json:"dnsName,omitempty"`

	// EnableFileCopy: Enable/Disable File Copy feature of the Bastion Host resource.
	EnableFileCopy *bool `json:"enableFileCopy,omitempty"`

	// EnableIpConnect: Enable/Disable IP Connect feature of the Bastion Host resource.
	EnableIpConnect *bool `json:"enableIpConnect,omitempty"`

	// EnableKerberos: Enable/Disable Kerberos feature of the Bastion Host resource.
	EnableKerberos *bool `json:"enableKerberos,omitempty"`

	// EnableSessionRecording: Enable/Disable Session Recording feature of the Bastion Host resource.
	EnableSessionRecording *bool `json:"enableSessionRecording,omitempty"`

	// EnableShareableLink: Enable/Disable Shareable Link of the Bastion Host resource.
	EnableShareableLink *bool `json:"enableShareableLink,omitempty"`

	// EnableTunneling: Enable/Disable Tunneling feature of the Bastion Host resource.
	EnableTunneling *bool `json:"enableTunneling,omitempty"`

	// IpConfigurations: IP configuration of the Bastion Host resource.
	IpConfigurations []BastionHostIPConfiguration `json:"ipConfigurations,omitempty"`

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

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

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

	// +kubebuilder:validation:Maximum=50
	// +kubebuilder:validation:Minimum=2
	// ScaleUnits: The scale units for the Bastion Host resource.
	ScaleUnits *int `json:"scaleUnits,omitempty"`

	// Sku: The sku of this Bastion Host.
	Sku *Sku `json:"sku,omitempty"`

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

	// VirtualNetwork: Reference to an existing virtual network required for Developer Bastion Host only.
	VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"`

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

var _ genruntime.ARMTransformer = &BastionHost_Spec{}

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

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

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

	// Set property "Properties":
	if host.DisableCopyPaste != nil ||
		host.DnsName != nil ||
		host.EnableFileCopy != nil ||
		host.EnableIpConnect != nil ||
		host.EnableKerberos != nil ||
		host.EnableSessionRecording != nil ||
		host.EnableShareableLink != nil ||
		host.EnableTunneling != nil ||
		host.IpConfigurations != nil ||
		host.NetworkAcls != nil ||
		host.ScaleUnits != nil ||
		host.VirtualNetwork != nil {
		result.Properties = &arm.BastionHostPropertiesFormat{}
	}
	if host.DisableCopyPaste != nil {
		disableCopyPaste := *host.DisableCopyPaste
		result.Properties.DisableCopyPaste = &disableCopyPaste
	}
	if host.DnsName != nil {
		dnsName := *host.DnsName
		result.Properties.DnsName = &dnsName
	}
	if host.EnableFileCopy != nil {
		enableFileCopy := *host.EnableFileCopy
		result.Properties.EnableFileCopy = &enableFileCopy
	}
	if host.EnableIpConnect != nil {
		enableIpConnect := *host.EnableIpConnect
		result.Properties.EnableIpConnect = &enableIpConnect
	}
	if host.EnableKerberos != nil {
		enableKerberos := *host.EnableKerberos
		result.Properties.EnableKerberos = &enableKerberos
	}
	if host.EnableSessionRecording != nil {
		enableSessionRecording := *host.EnableSessionRecording
		result.Properties.EnableSessionRecording = &enableSessionRecording
	}
	if host.EnableShareableLink != nil {
		enableShareableLink := *host.EnableShareableLink
		result.Properties.EnableShareableLink = &enableShareableLink
	}
	if host.EnableTunneling != nil {
		enableTunneling := *host.EnableTunneling
		result.Properties.EnableTunneling = &enableTunneling
	}
	for _, item := range host.IpConfigurations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.IpConfigurations = append(result.Properties.IpConfigurations, *item_ARM.(*arm.BastionHostIPConfiguration))
	}
	if host.NetworkAcls != nil {
		networkAcls_ARM, err := host.NetworkAcls.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		networkAcls := *networkAcls_ARM.(*arm.BastionHostPropertiesFormat_NetworkAcls)
		result.Properties.NetworkAcls = &networkAcls
	}
	if host.ScaleUnits != nil {
		scaleUnits := *host.ScaleUnits
		result.Properties.ScaleUnits = &scaleUnits
	}
	if host.VirtualNetwork != nil {
		virtualNetwork_ARM, err := host.VirtualNetwork.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		virtualNetwork := *virtualNetwork_ARM.(*arm.SubResource)
		result.Properties.VirtualNetwork = &virtualNetwork
	}

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

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

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

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

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

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

	// Set property "DisableCopyPaste":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableCopyPaste != nil {
			disableCopyPaste := *typedInput.Properties.DisableCopyPaste
			host.DisableCopyPaste = &disableCopyPaste
		}
	}

	// Set property "DnsName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DnsName != nil {
			dnsName := *typedInput.Properties.DnsName
			host.DnsName = &dnsName
		}
	}

	// Set property "EnableFileCopy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableFileCopy != nil {
			enableFileCopy := *typedInput.Properties.EnableFileCopy
			host.EnableFileCopy = &enableFileCopy
		}
	}

	// Set property "EnableIpConnect":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableIpConnect != nil {
			enableIpConnect := *typedInput.Properties.EnableIpConnect
			host.EnableIpConnect = &enableIpConnect
		}
	}

	// Set property "EnableKerberos":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableKerberos != nil {
			enableKerberos := *typedInput.Properties.EnableKerberos
			host.EnableKerberos = &enableKerberos
		}
	}

	// Set property "EnableSessionRecording":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableSessionRecording != nil {
			enableSessionRecording := *typedInput.Properties.EnableSessionRecording
			host.EnableSessionRecording = &enableSessionRecording
		}
	}

	// Set property "EnableShareableLink":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableShareableLink != nil {
			enableShareableLink := *typedInput.Properties.EnableShareableLink
			host.EnableShareableLink = &enableShareableLink
		}
	}

	// Set property "EnableTunneling":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableTunneling != nil {
			enableTunneling := *typedInput.Properties.EnableTunneling
			host.EnableTunneling = &enableTunneling
		}
	}

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

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

	// Set property "NetworkAcls":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NetworkAcls != nil {
			var networkAcls1 BastionHostPropertiesFormat_NetworkAcls
			err := networkAcls1.PopulateFromARM(owner, *typedInput.Properties.NetworkAcls)
			if err != nil {
				return err
			}
			networkAcls := networkAcls1
			host.NetworkAcls = &networkAcls
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "ScaleUnits":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ScaleUnits != nil {
			scaleUnits := *typedInput.Properties.ScaleUnits
			host.ScaleUnits = &scaleUnits
		}
	}

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

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

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &BastionHost_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.BastionHost_Spec{}
	err := host.AssignProperties_To_BastionHost_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_BastionHost_Spec populates our BastionHost_Spec from the provided source BastionHost_Spec
func (host *BastionHost_Spec) AssignProperties_From_BastionHost_Spec(source *storage.BastionHost_Spec) error {

	// AzureName
	host.AzureName = source.AzureName

	// DisableCopyPaste
	if source.DisableCopyPaste != nil {
		disableCopyPaste := *source.DisableCopyPaste
		host.DisableCopyPaste = &disableCopyPaste
	} else {
		host.DisableCopyPaste = nil
	}

	// DnsName
	host.DnsName = genruntime.ClonePointerToString(source.DnsName)

	// EnableFileCopy
	if source.EnableFileCopy != nil {
		enableFileCopy := *source.EnableFileCopy
		host.EnableFileCopy = &enableFileCopy
	} else {
		host.EnableFileCopy = nil
	}

	// EnableIpConnect
	if source.EnableIpConnect != nil {
		enableIpConnect := *source.EnableIpConnect
		host.EnableIpConnect = &enableIpConnect
	} else {
		host.EnableIpConnect = nil
	}

	// EnableKerberos
	if source.EnableKerberos != nil {
		enableKerbero := *source.EnableKerberos
		host.EnableKerberos = &enableKerbero
	} else {
		host.EnableKerberos = nil
	}

	// EnableSessionRecording
	if source.EnableSessionRecording != nil {
		enableSessionRecording := *source.EnableSessionRecording
		host.EnableSessionRecording = &enableSessionRecording
	} else {
		host.EnableSessionRecording = nil
	}

	// EnableShareableLink
	if source.EnableShareableLink != nil {
		enableShareableLink := *source.EnableShareableLink
		host.EnableShareableLink = &enableShareableLink
	} else {
		host.EnableShareableLink = nil
	}

	// EnableTunneling
	if source.EnableTunneling != nil {
		enableTunneling := *source.EnableTunneling
		host.EnableTunneling = &enableTunneling
	} else {
		host.EnableTunneling = nil
	}

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

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

	// NetworkAcls
	if source.NetworkAcls != nil {
		var networkAcl BastionHostPropertiesFormat_NetworkAcls
		err := networkAcl.AssignProperties_From_BastionHostPropertiesFormat_NetworkAcls(source.NetworkAcls)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_BastionHostPropertiesFormat_NetworkAcls() to populate field NetworkAcls")
		}
		host.NetworkAcls = &networkAcl
	} else {
		host.NetworkAcls = nil
	}

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

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

	// ScaleUnits
	host.ScaleUnits = genruntime.ClonePointerToInt(source.ScaleUnits)

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

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

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

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

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = host.AzureName

	// DisableCopyPaste
	if host.DisableCopyPaste != nil {
		disableCopyPaste := *host.DisableCopyPaste
		destination.DisableCopyPaste = &disableCopyPaste
	} else {
		destination.DisableCopyPaste = nil
	}

	// DnsName
	destination.DnsName = genruntime.ClonePointerToString(host.DnsName)

	// EnableFileCopy
	if host.EnableFileCopy != nil {
		enableFileCopy := *host.EnableFileCopy
		destination.EnableFileCopy = &enableFileCopy
	} else {
		destination.EnableFileCopy = nil
	}

	// EnableIpConnect
	if host.EnableIpConnect != nil {
		enableIpConnect := *host.EnableIpConnect
		destination.EnableIpConnect = &enableIpConnect
	} else {
		destination.EnableIpConnect = nil
	}

	// EnableKerberos
	if host.EnableKerberos != nil {
		enableKerbero := *host.EnableKerberos
		destination.EnableKerberos = &enableKerbero
	} else {
		destination.EnableKerberos = nil
	}

	// EnableSessionRecording
	if host.EnableSessionRecording != nil {
		enableSessionRecording := *host.EnableSessionRecording
		destination.EnableSessionRecording = &enableSessionRecording
	} else {
		destination.EnableSessionRecording = nil
	}

	// EnableShareableLink
	if host.EnableShareableLink != nil {
		enableShareableLink := *host.EnableShareableLink
		destination.EnableShareableLink = &enableShareableLink
	} else {
		destination.EnableShareableLink = nil
	}

	// EnableTunneling
	if host.EnableTunneling != nil {
		enableTunneling := *host.EnableTunneling
		destination.EnableTunneling = &enableTunneling
	} else {
		destination.EnableTunneling = nil
	}

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

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

	// NetworkAcls
	if host.NetworkAcls != nil {
		var networkAcl storage.BastionHostPropertiesFormat_NetworkAcls
		err := host.NetworkAcls.AssignProperties_To_BastionHostPropertiesFormat_NetworkAcls(&networkAcl)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_BastionHostPropertiesFormat_NetworkAcls() to populate field NetworkAcls")
		}
		destination.NetworkAcls = &networkAcl
	} else {
		destination.NetworkAcls = nil
	}

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

	// OriginalVersion
	destination.OriginalVersion = host.OriginalVersion()

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

	// ScaleUnits
	destination.ScaleUnits = genruntime.ClonePointerToInt(host.ScaleUnits)

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

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

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

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

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

	// No error
	return nil
}

// Initialize_From_BastionHost_STATUS populates our BastionHost_Spec from the provided source BastionHost_STATUS
func (host *BastionHost_Spec) Initialize_From_BastionHost_STATUS(source *BastionHost_STATUS) error {

	// DisableCopyPaste
	if source.DisableCopyPaste != nil {
		disableCopyPaste := *source.DisableCopyPaste
		host.DisableCopyPaste = &disableCopyPaste
	} else {
		host.DisableCopyPaste = nil
	}

	// DnsName
	host.DnsName = genruntime.ClonePointerToString(source.DnsName)

	// EnableFileCopy
	if source.EnableFileCopy != nil {
		enableFileCopy := *source.EnableFileCopy
		host.EnableFileCopy = &enableFileCopy
	} else {
		host.EnableFileCopy = nil
	}

	// EnableIpConnect
	if source.EnableIpConnect != nil {
		enableIpConnect := *source.EnableIpConnect
		host.EnableIpConnect = &enableIpConnect
	} else {
		host.EnableIpConnect = nil
	}

	// EnableKerberos
	if source.EnableKerberos != nil {
		enableKerbero := *source.EnableKerberos
		host.EnableKerberos = &enableKerbero
	} else {
		host.EnableKerberos = nil
	}

	// EnableSessionRecording
	if source.EnableSessionRecording != nil {
		enableSessionRecording := *source.EnableSessionRecording
		host.EnableSessionRecording = &enableSessionRecording
	} else {
		host.EnableSessionRecording = nil
	}

	// EnableShareableLink
	if source.EnableShareableLink != nil {
		enableShareableLink := *source.EnableShareableLink
		host.EnableShareableLink = &enableShareableLink
	} else {
		host.EnableShareableLink = nil
	}

	// EnableTunneling
	if source.EnableTunneling != nil {
		enableTunneling := *source.EnableTunneling
		host.EnableTunneling = &enableTunneling
	} else {
		host.EnableTunneling = nil
	}

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

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

	// NetworkAcls
	if source.NetworkAcls != nil {
		var networkAcl BastionHostPropertiesFormat_NetworkAcls
		err := networkAcl.Initialize_From_BastionHostPropertiesFormat_NetworkAcls_STATUS(source.NetworkAcls)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_BastionHostPropertiesFormat_NetworkAcls_STATUS() to populate field NetworkAcls")
		}
		host.NetworkAcls = &networkAcl
	} else {
		host.NetworkAcls = nil
	}

	// ScaleUnits
	host.ScaleUnits = genruntime.ClonePointerToInt(source.ScaleUnits)

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

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

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

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

	// No error
	return nil
}

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

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

// Bastion Host resource.
type BastionHost_STATUS struct {
	// Conditions: The observed state of the resource
	Conditions []conditions.Condition `json:"conditions,omitempty"`

	// DisableCopyPaste: Enable/Disable Copy/Paste feature of the Bastion Host resource.
	DisableCopyPaste *bool `json:"disableCopyPaste,omitempty"`

	// DnsName: FQDN for the endpoint on which bastion host is accessible.
	DnsName *string `json:"dnsName,omitempty"`

	// EnableFileCopy: Enable/Disable File Copy feature of the Bastion Host resource.
	EnableFileCopy *bool `json:"enableFileCopy,omitempty"`

	// EnableIpConnect: Enable/Disable IP Connect feature of the Bastion Host resource.
	EnableIpConnect *bool `json:"enableIpConnect,omitempty"`

	// EnableKerberos: Enable/Disable Kerberos feature of the Bastion Host resource.
	EnableKerberos *bool `json:"enableKerberos,omitempty"`

	// EnableSessionRecording: Enable/Disable Session Recording feature of the Bastion Host resource.
	EnableSessionRecording *bool `json:"enableSessionRecording,omitempty"`

	// EnableShareableLink: Enable/Disable Shareable Link of the Bastion Host resource.
	EnableShareableLink *bool `json:"enableShareableLink,omitempty"`

	// EnableTunneling: Enable/Disable Tunneling feature of the Bastion Host resource.
	EnableTunneling *bool `json:"enableTunneling,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"`

	// IpConfigurations: IP configuration of the Bastion Host resource.
	IpConfigurations []BastionHostIPConfiguration_STATUS `json:"ipConfigurations,omitempty"`

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

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

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

	// ScaleUnits: The scale units for the Bastion Host resource.
	ScaleUnits *int `json:"scaleUnits,omitempty"`

	// Sku: The sku of this Bastion Host.
	Sku *Sku_STATUS `json:"sku,omitempty"`

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

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

	// VirtualNetwork: Reference to an existing virtual network required for Developer Bastion Host only.
	VirtualNetwork *SubResource_STATUS `json:"virtualNetwork,omitempty"`

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

var _ genruntime.ConvertibleStatus = &BastionHost_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.BastionHost_STATUS{}
	err := host.AssignProperties_To_BastionHost_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 = &BastionHost_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "DisableCopyPaste":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableCopyPaste != nil {
			disableCopyPaste := *typedInput.Properties.DisableCopyPaste
			host.DisableCopyPaste = &disableCopyPaste
		}
	}

	// Set property "DnsName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DnsName != nil {
			dnsName := *typedInput.Properties.DnsName
			host.DnsName = &dnsName
		}
	}

	// Set property "EnableFileCopy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableFileCopy != nil {
			enableFileCopy := *typedInput.Properties.EnableFileCopy
			host.EnableFileCopy = &enableFileCopy
		}
	}

	// Set property "EnableIpConnect":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableIpConnect != nil {
			enableIpConnect := *typedInput.Properties.EnableIpConnect
			host.EnableIpConnect = &enableIpConnect
		}
	}

	// Set property "EnableKerberos":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableKerberos != nil {
			enableKerberos := *typedInput.Properties.EnableKerberos
			host.EnableKerberos = &enableKerberos
		}
	}

	// Set property "EnableSessionRecording":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableSessionRecording != nil {
			enableSessionRecording := *typedInput.Properties.EnableSessionRecording
			host.EnableSessionRecording = &enableSessionRecording
		}
	}

	// Set property "EnableShareableLink":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableShareableLink != nil {
			enableShareableLink := *typedInput.Properties.EnableShareableLink
			host.EnableShareableLink = &enableShareableLink
		}
	}

	// Set property "EnableTunneling":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableTunneling != nil {
			enableTunneling := *typedInput.Properties.EnableTunneling
			host.EnableTunneling = &enableTunneling
		}
	}

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

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

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

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

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

	// Set property "NetworkAcls":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NetworkAcls != nil {
			var networkAcls1 BastionHostPropertiesFormat_NetworkAcls_STATUS
			err := networkAcls1.PopulateFromARM(owner, *typedInput.Properties.NetworkAcls)
			if err != nil {
				return err
			}
			networkAcls := networkAcls1
			host.NetworkAcls = &networkAcls
		}
	}

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

	// Set property "ScaleUnits":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ScaleUnits != nil {
			scaleUnits := *typedInput.Properties.ScaleUnits
			host.ScaleUnits = &scaleUnits
		}
	}

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

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

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

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

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

	// No error
	return nil
}

// AssignProperties_From_BastionHost_STATUS populates our BastionHost_STATUS from the provided source BastionHost_STATUS
func (host *BastionHost_STATUS) AssignProperties_From_BastionHost_STATUS(source *storage.BastionHost_STATUS) error {

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

	// DisableCopyPaste
	if source.DisableCopyPaste != nil {
		disableCopyPaste := *source.DisableCopyPaste
		host.DisableCopyPaste = &disableCopyPaste
	} else {
		host.DisableCopyPaste = nil
	}

	// DnsName
	host.DnsName = genruntime.ClonePointerToString(source.DnsName)

	// EnableFileCopy
	if source.EnableFileCopy != nil {
		enableFileCopy := *source.EnableFileCopy
		host.EnableFileCopy = &enableFileCopy
	} else {
		host.EnableFileCopy = nil
	}

	// EnableIpConnect
	if source.EnableIpConnect != nil {
		enableIpConnect := *source.EnableIpConnect
		host.EnableIpConnect = &enableIpConnect
	} else {
		host.EnableIpConnect = nil
	}

	// EnableKerberos
	if source.EnableKerberos != nil {
		enableKerbero := *source.EnableKerberos
		host.EnableKerberos = &enableKerbero
	} else {
		host.EnableKerberos = nil
	}

	// EnableSessionRecording
	if source.EnableSessionRecording != nil {
		enableSessionRecording := *source.EnableSessionRecording
		host.EnableSessionRecording = &enableSessionRecording
	} else {
		host.EnableSessionRecording = nil
	}

	// EnableShareableLink
	if source.EnableShareableLink != nil {
		enableShareableLink := *source.EnableShareableLink
		host.EnableShareableLink = &enableShareableLink
	} else {
		host.EnableShareableLink = nil
	}

	// EnableTunneling
	if source.EnableTunneling != nil {
		enableTunneling := *source.EnableTunneling
		host.EnableTunneling = &enableTunneling
	} else {
		host.EnableTunneling = nil
	}

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

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

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

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

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

	// NetworkAcls
	if source.NetworkAcls != nil {
		var networkAcl BastionHostPropertiesFormat_NetworkAcls_STATUS
		err := networkAcl.AssignProperties_From_BastionHostPropertiesFormat_NetworkAcls_STATUS(source.NetworkAcls)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_BastionHostPropertiesFormat_NetworkAcls_STATUS() to populate field NetworkAcls")
		}
		host.NetworkAcls = &networkAcl
	} else {
		host.NetworkAcls = nil
	}

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

	// ScaleUnits
	host.ScaleUnits = genruntime.ClonePointerToInt(source.ScaleUnits)

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

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

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

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

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

	// No error
	return nil
}

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

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

	// DisableCopyPaste
	if host.DisableCopyPaste != nil {
		disableCopyPaste := *host.DisableCopyPaste
		destination.DisableCopyPaste = &disableCopyPaste
	} else {
		destination.DisableCopyPaste = nil
	}

	// DnsName
	destination.DnsName = genruntime.ClonePointerToString(host.DnsName)

	// EnableFileCopy
	if host.EnableFileCopy != nil {
		enableFileCopy := *host.EnableFileCopy
		destination.EnableFileCopy = &enableFileCopy
	} else {
		destination.EnableFileCopy = nil
	}

	// EnableIpConnect
	if host.EnableIpConnect != nil {
		enableIpConnect := *host.EnableIpConnect
		destination.EnableIpConnect = &enableIpConnect
	} else {
		destination.EnableIpConnect = nil
	}

	// EnableKerberos
	if host.EnableKerberos != nil {
		enableKerbero := *host.EnableKerberos
		destination.EnableKerberos = &enableKerbero
	} else {
		destination.EnableKerberos = nil
	}

	// EnableSessionRecording
	if host.EnableSessionRecording != nil {
		enableSessionRecording := *host.EnableSessionRecording
		destination.EnableSessionRecording = &enableSessionRecording
	} else {
		destination.EnableSessionRecording = nil
	}

	// EnableShareableLink
	if host.EnableShareableLink != nil {
		enableShareableLink := *host.EnableShareableLink
		destination.EnableShareableLink = &enableShareableLink
	} else {
		destination.EnableShareableLink = nil
	}

	// EnableTunneling
	if host.EnableTunneling != nil {
		enableTunneling := *host.EnableTunneling
		destination.EnableTunneling = &enableTunneling
	} else {
		destination.EnableTunneling = nil
	}

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

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

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

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

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

	// NetworkAcls
	if host.NetworkAcls != nil {
		var networkAcl storage.BastionHostPropertiesFormat_NetworkAcls_STATUS
		err := host.NetworkAcls.AssignProperties_To_BastionHostPropertiesFormat_NetworkAcls_STATUS(&networkAcl)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_BastionHostPropertiesFormat_NetworkAcls_STATUS() to populate field NetworkAcls")
		}
		destination.NetworkAcls = &networkAcl
	} else {
		destination.NetworkAcls = nil
	}

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

	// ScaleUnits
	destination.ScaleUnits = genruntime.ClonePointerToInt(host.ScaleUnits)

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

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

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

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

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

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

	// No error
	return nil
}

// IP configuration of an Bastion Host.
type BastionHostIPConfiguration struct {
	// Name: 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"`

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

	// +kubebuilder:validation:Required
	// PublicIPAddress: Reference of the PublicIP resource.
	PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"`

	// +kubebuilder:validation:Required
	// Subnet: Reference of the subnet resource.
	Subnet *SubResource `json:"subnet,omitempty"`
}

var _ genruntime.ARMTransformer = &BastionHostIPConfiguration{}

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

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

	// Set property "Properties":
	if configuration.PrivateIPAllocationMethod != nil ||
		configuration.PublicIPAddress != nil ||
		configuration.Subnet != nil {
		result.Properties = &arm.BastionHostIPConfigurationPropertiesFormat{}
	}
	if configuration.PrivateIPAllocationMethod != nil {
		var temp string
		temp = string(*configuration.PrivateIPAllocationMethod)
		privateIPAllocationMethod := arm.IPAllocationMethod(temp)
		result.Properties.PrivateIPAllocationMethod = &privateIPAllocationMethod
	}
	if configuration.PublicIPAddress != nil {
		publicIPAddress_ARM, err := configuration.PublicIPAddress.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		publicIPAddress := *publicIPAddress_ARM.(*arm.SubResource)
		result.Properties.PublicIPAddress = &publicIPAddress
	}
	if configuration.Subnet != nil {
		subnet_ARM, err := configuration.Subnet.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		subnet := *subnet_ARM.(*arm.SubResource)
		result.Properties.Subnet = &subnet
	}
	return result, nil
}

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

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

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

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

	// No error
	return nil
}

// Initialize_From_BastionHostIPConfiguration_STATUS populates our BastionHostIPConfiguration from the provided source BastionHostIPConfiguration_STATUS
func (configuration *BastionHostIPConfiguration) Initialize_From_BastionHostIPConfiguration_STATUS(source *BastionHostIPConfiguration_STATUS) error {

	// No error
	return nil
}

// IP configuration of an Bastion Host.
type BastionHostIPConfiguration_STATUS struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &BastionHostIPConfiguration_STATUS{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type BastionHostOperatorSpec 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_BastionHostOperatorSpec populates our BastionHostOperatorSpec from the provided source BastionHostOperatorSpec
func (operator *BastionHostOperatorSpec) AssignProperties_From_BastionHostOperatorSpec(source *storage.BastionHostOperatorSpec) 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_BastionHostOperatorSpec populates the provided destination BastionHostOperatorSpec from our BastionHostOperatorSpec
func (operator *BastionHostOperatorSpec) AssignProperties_To_BastionHostOperatorSpec(destination *storage.BastionHostOperatorSpec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

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

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

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

	// No error
	return nil
}

type BastionHostPropertiesFormat_NetworkAcls struct {
	// IpRules: Sets the IP ACL rules for Developer Bastion Host.
	IpRules []IPRule `json:"ipRules,omitempty"`
}

var _ genruntime.ARMTransformer = &BastionHostPropertiesFormat_NetworkAcls{}

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

	// Set property "IpRules":
	for _, item := range acls.IpRules {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.IpRules = append(result.IpRules, *item_ARM.(*arm.IPRule))
	}
	return result, nil
}

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

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

	// Set property "IpRules":
	for _, item := range typedInput.IpRules {
		var item1 IPRule
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		acls.IpRules = append(acls.IpRules, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_BastionHostPropertiesFormat_NetworkAcls populates our BastionHostPropertiesFormat_NetworkAcls from the provided source BastionHostPropertiesFormat_NetworkAcls
func (acls *BastionHostPropertiesFormat_NetworkAcls) AssignProperties_From_BastionHostPropertiesFormat_NetworkAcls(source *storage.BastionHostPropertiesFormat_NetworkAcls) error {

	// IpRules
	if source.IpRules != nil {
		ipRuleList := make([]IPRule, len(source.IpRules))
		for ipRuleIndex, ipRuleItem := range source.IpRules {
			var ipRule IPRule
			err := ipRule.AssignProperties_From_IPRule(&ipRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_IPRule() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		acls.IpRules = ipRuleList
	} else {
		acls.IpRules = nil
	}

	// No error
	return nil
}

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

	// IpRules
	if acls.IpRules != nil {
		ipRuleList := make([]storage.IPRule, len(acls.IpRules))
		for ipRuleIndex, ipRuleItem := range acls.IpRules {
			var ipRule storage.IPRule
			err := ipRuleItem.AssignProperties_To_IPRule(&ipRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_IPRule() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		destination.IpRules = ipRuleList
	} else {
		destination.IpRules = nil
	}

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

	// No error
	return nil
}

// Initialize_From_BastionHostPropertiesFormat_NetworkAcls_STATUS populates our BastionHostPropertiesFormat_NetworkAcls from the provided source BastionHostPropertiesFormat_NetworkAcls_STATUS
func (acls *BastionHostPropertiesFormat_NetworkAcls) Initialize_From_BastionHostPropertiesFormat_NetworkAcls_STATUS(source *BastionHostPropertiesFormat_NetworkAcls_STATUS) error {

	// IpRules
	if source.IpRules != nil {
		ipRuleList := make([]IPRule, len(source.IpRules))
		for ipRuleIndex, ipRuleItem := range source.IpRules {
			var ipRule IPRule
			err := ipRule.Initialize_From_IPRule_STATUS(&ipRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_IPRule_STATUS() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		acls.IpRules = ipRuleList
	} else {
		acls.IpRules = nil
	}

	// No error
	return nil
}

type BastionHostPropertiesFormat_NetworkAcls_STATUS struct {
	// IpRules: Sets the IP ACL rules for Developer Bastion Host.
	IpRules []IPRule_STATUS `json:"ipRules,omitempty"`
}

var _ genruntime.FromARMConverter = &BastionHostPropertiesFormat_NetworkAcls_STATUS{}

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

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

	// Set property "IpRules":
	for _, item := range typedInput.IpRules {
		var item1 IPRule_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		acls.IpRules = append(acls.IpRules, item1)
	}

	// No error
	return nil
}

// AssignProperties_From_BastionHostPropertiesFormat_NetworkAcls_STATUS populates our BastionHostPropertiesFormat_NetworkAcls_STATUS from the provided source BastionHostPropertiesFormat_NetworkAcls_STATUS
func (acls *BastionHostPropertiesFormat_NetworkAcls_STATUS) AssignProperties_From_BastionHostPropertiesFormat_NetworkAcls_STATUS(source *storage.BastionHostPropertiesFormat_NetworkAcls_STATUS) error {

	// IpRules
	if source.IpRules != nil {
		ipRuleList := make([]IPRule_STATUS, len(source.IpRules))
		for ipRuleIndex, ipRuleItem := range source.IpRules {
			var ipRule IPRule_STATUS
			err := ipRule.AssignProperties_From_IPRule_STATUS(&ipRuleItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_IPRule_STATUS() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		acls.IpRules = ipRuleList
	} else {
		acls.IpRules = nil
	}

	// No error
	return nil
}

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

	// IpRules
	if acls.IpRules != nil {
		ipRuleList := make([]storage.IPRule_STATUS, len(acls.IpRules))
		for ipRuleIndex, ipRuleItem := range acls.IpRules {
			var ipRule storage.IPRule_STATUS
			err := ipRuleItem.AssignProperties_To_IPRule_STATUS(&ipRule)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_IPRule_STATUS() to populate field IpRules")
			}
			ipRuleList[ipRuleIndex] = ipRule
		}
		destination.IpRules = ipRuleList
	} else {
		destination.IpRules = nil
	}

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

	// No error
	return nil
}

// The sku of this Bastion Host.
type Sku struct {
	// Name: The name of the sku of this Bastion Host.
	Name *Sku_Name `json:"name,omitempty"`
}

var _ genruntime.ARMTransformer = &Sku{}

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

	// Set property "Name":
	if sku.Name != nil {
		var temp string
		temp = string(*sku.Name)
		name := arm.Sku_Name(temp)
		result.Name = &name
	}
	return result, nil
}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_Sku populates our Sku from the provided source Sku
func (sku *Sku) AssignProperties_From_Sku(source *storage.Sku) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Initialize_From_Sku_STATUS populates our Sku from the provided source Sku_STATUS
func (sku *Sku) Initialize_From_Sku_STATUS(source *Sku_STATUS) error {

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

	// No error
	return nil
}

// The sku of this Bastion Host.
type Sku_STATUS struct {
	// Name: The name of the sku of this Bastion Host.
	Name *Sku_Name_STATUS `json:"name,omitempty"`
}

var _ genruntime.FromARMConverter = &Sku_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_Sku_STATUS populates our Sku_STATUS from the provided source Sku_STATUS
func (sku *Sku_STATUS) AssignProperties_From_Sku_STATUS(source *storage.Sku_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

type IPRule struct {
	// AddressPrefix: Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed.
	AddressPrefix *string `json:"addressPrefix,omitempty"`
}

var _ genruntime.ARMTransformer = &IPRule{}

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

	// Set property "AddressPrefix":
	if rule.AddressPrefix != nil {
		addressPrefix := *rule.AddressPrefix
		result.AddressPrefix = &addressPrefix
	}
	return result, nil
}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Initialize_From_IPRule_STATUS populates our IPRule from the provided source IPRule_STATUS
func (rule *IPRule) Initialize_From_IPRule_STATUS(source *IPRule_STATUS) error {

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

	// No error
	return nil
}

type IPRule_STATUS struct {
	// AddressPrefix: Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed.
	AddressPrefix *string `json:"addressPrefix,omitempty"`
}

var _ genruntime.FromARMConverter = &IPRule_STATUS{}

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

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

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

	// No error
	return nil
}

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Basic","Developer","Premium","Standard"}
type Sku_Name string

const (
	Sku_Name_Basic     = Sku_Name("Basic")
	Sku_Name_Developer = Sku_Name("Developer")
	Sku_Name_Premium   = Sku_Name("Premium")
	Sku_Name_Standard  = Sku_Name("Standard")
)

// Mapping from string to Sku_Name
var sku_Name_Values = map[string]Sku_Name{
	"basic":     Sku_Name_Basic,
	"developer": Sku_Name_Developer,
	"premium":   Sku_Name_Premium,
	"standard":  Sku_Name_Standard,
}

type Sku_Name_STATUS string

const (
	Sku_Name_STATUS_Basic     = Sku_Name_STATUS("Basic")
	Sku_Name_STATUS_Developer = Sku_Name_STATUS("Developer")
	Sku_Name_STATUS_Premium   = Sku_Name_STATUS("Premium")
	Sku_Name_STATUS_Standard  = Sku_Name_STATUS("Standard")
)

// Mapping from string to Sku_Name_STATUS
var sku_Name_STATUS_Values = map[string]Sku_Name_STATUS{
	"basic":     Sku_Name_STATUS_Basic,
	"developer": Sku_Name_STATUS_Developer,
	"premium":   Sku_Name_STATUS_Premium,
	"standard":  Sku_Name_STATUS_Standard,
}

func init() {
	SchemeBuilder.Register(&BastionHost{}, &BastionHostList{})
}
