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

import (
	"context"
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/sql/v1api20211101/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/sql/v1api20211101/storage"
	"github.com/Azure/azure-service-operator/v2/internal/genericarmclient"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/secrets"
	"github.com/go-logr/logr"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/client"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,sql}
// +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: /sql/resource-manager/Microsoft.Sql/stable/2021-11-01/Servers.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}
type Server struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Server_Spec   `json:"spec,omitempty"`
	Status            Server_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Server{}

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

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

var _ conversion.Convertible = &Server{}

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

	return server.AssignProperties_From_Server(source)
}

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

	return server.AssignProperties_To_Server(destination)
}

var _ configmaps.Exporter = &Server{}

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

var _ secrets.Exporter = &Server{}

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

var _ genruntime.ImportableResource = &Server{}

// InitializeSpec initializes the spec for this resource from the given status
func (server *Server) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*Server_STATUS); ok {
		return server.Spec.Initialize_From_Server_STATUS(s)
	}

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

var _ genruntime.KubernetesConfigExporter = &Server{}

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

var _ genruntime.KubernetesResource = &Server{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Sql/servers"
func (server *Server) GetType() string {
	return "Microsoft.Sql/servers"
}

// NewEmptyStatus returns a new empty (blank) status
func (server *Server) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Server_STATUS{}
}

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

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

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

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

	server.Status = st
	return nil
}

// AssignProperties_From_Server populates our Server from the provided source Server
func (server *Server) AssignProperties_From_Server(source *storage.Server) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Server populates the provided destination Server from our Server
func (server *Server) AssignProperties_To_Server(destination *storage.Server) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /sql/resource-manager/Microsoft.Sql/stable/2021-11-01/Servers.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}
type ServerList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Server `json:"items"`
}

// +kubebuilder:validation:Enum={"2021-11-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2021-11-01")

type Server_Spec struct {
	// AdministratorLogin: Administrator username for the server. Once created it cannot be changed.
	AdministratorLogin *string `json:"administratorLogin,omitempty"`

	// AdministratorLoginPassword: The administrator login password (required for server creation).
	AdministratorLoginPassword *genruntime.SecretReference `json:"administratorLoginPassword,omitempty"`

	// Administrators: The Azure Active Directory administrator of the server.
	Administrators *ServerExternalAdministrator `json:"administrators,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"`

	// +kubebuilder:validation:Pattern="^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
	// FederatedClientId: The Client id used for cross tenant CMK scenario
	FederatedClientId *string `json:"federatedClientId,omitempty"`

	// Identity: The Azure Active Directory identity of the server.
	Identity *ResourceIdentity `json:"identity,omitempty"`

	// KeyId: A CMK URI of the key to use for encryption.
	KeyId *string `json:"keyId,omitempty"`

	// +kubebuilder:validation:Required
	// Location: Resource location.
	Location *string `json:"location,omitempty"`

	// MinimalTlsVersion: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'
	MinimalTlsVersion *string `json:"minimalTlsVersion,omitempty"`

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

	// PrimaryUserAssignedIdentityReference: The resource id of a user assigned identity to be used by default.
	PrimaryUserAssignedIdentityReference *genruntime.ResourceReference `armReference:"PrimaryUserAssignedIdentityId" json:"primaryUserAssignedIdentityReference,omitempty"`

	// PublicNetworkAccess: Whether or not public endpoint access is allowed for this server.  Value is optional but if passed
	// in, must be 'Enabled' or 'Disabled'
	PublicNetworkAccess *ServerProperties_PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

	// RestrictOutboundNetworkAccess: Whether or not to restrict outbound network access for this server.  Value is optional
	// but if passed in, must be 'Enabled' or 'Disabled'
	RestrictOutboundNetworkAccess *ServerProperties_RestrictOutboundNetworkAccess `json:"restrictOutboundNetworkAccess,omitempty"`

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

	// Version: The version of the server.
	Version *string `json:"version,omitempty"`
}

var _ genruntime.ARMTransformer = &Server_Spec{}

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

	// Set property "Identity":
	if server.Identity != nil {
		identity_ARM, err := server.Identity.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		identity := *identity_ARM.(*arm.ResourceIdentity)
		result.Identity = &identity
	}

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

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

	// Set property "Properties":
	if server.AdministratorLogin != nil ||
		server.AdministratorLoginPassword != nil ||
		server.Administrators != nil ||
		server.FederatedClientId != nil ||
		server.KeyId != nil ||
		server.MinimalTlsVersion != nil ||
		server.PrimaryUserAssignedIdentityReference != nil ||
		server.PublicNetworkAccess != nil ||
		server.RestrictOutboundNetworkAccess != nil ||
		server.Version != nil {
		result.Properties = &arm.ServerProperties{}
	}
	if server.AdministratorLogin != nil {
		administratorLogin := *server.AdministratorLogin
		result.Properties.AdministratorLogin = &administratorLogin
	}
	if server.AdministratorLoginPassword != nil {
		administratorLoginPasswordSecret, err := resolved.ResolvedSecrets.Lookup(*server.AdministratorLoginPassword)
		if err != nil {
			return nil, eris.Wrap(err, "looking up secret for property AdministratorLoginPassword")
		}
		administratorLoginPassword := administratorLoginPasswordSecret
		result.Properties.AdministratorLoginPassword = &administratorLoginPassword
	}
	if server.Administrators != nil {
		administrators_ARM, err := server.Administrators.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		administrators := *administrators_ARM.(*arm.ServerExternalAdministrator)
		result.Properties.Administrators = &administrators
	}
	if server.FederatedClientId != nil {
		federatedClientId := *server.FederatedClientId
		result.Properties.FederatedClientId = &federatedClientId
	}
	if server.KeyId != nil {
		keyId := *server.KeyId
		result.Properties.KeyId = &keyId
	}
	if server.MinimalTlsVersion != nil {
		minimalTlsVersion := *server.MinimalTlsVersion
		result.Properties.MinimalTlsVersion = &minimalTlsVersion
	}
	if server.PrimaryUserAssignedIdentityReference != nil {
		primaryUserAssignedIdentityIdARMID, err := resolved.ResolvedReferences.Lookup(*server.PrimaryUserAssignedIdentityReference)
		if err != nil {
			return nil, err
		}
		primaryUserAssignedIdentityId := primaryUserAssignedIdentityIdARMID
		result.Properties.PrimaryUserAssignedIdentityId = &primaryUserAssignedIdentityId
	}
	if server.PublicNetworkAccess != nil {
		var temp string
		temp = string(*server.PublicNetworkAccess)
		publicNetworkAccess := arm.ServerProperties_PublicNetworkAccess(temp)
		result.Properties.PublicNetworkAccess = &publicNetworkAccess
	}
	if server.RestrictOutboundNetworkAccess != nil {
		var temp string
		temp = string(*server.RestrictOutboundNetworkAccess)
		restrictOutboundNetworkAccess := arm.ServerProperties_RestrictOutboundNetworkAccess(temp)
		result.Properties.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess
	}
	if server.Version != nil {
		version := *server.Version
		result.Properties.Version = &version
	}

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

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

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

	// Set property "AdministratorLogin":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AdministratorLogin != nil {
			administratorLogin := *typedInput.Properties.AdministratorLogin
			server.AdministratorLogin = &administratorLogin
		}
	}

	// no assignment for property "AdministratorLoginPassword"

	// Set property "Administrators":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Administrators != nil {
			var administrators1 ServerExternalAdministrator
			err := administrators1.PopulateFromARM(owner, *typedInput.Properties.Administrators)
			if err != nil {
				return err
			}
			administrators := administrators1
			server.Administrators = &administrators
		}
	}

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

	// Set property "FederatedClientId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FederatedClientId != nil {
			federatedClientId := *typedInput.Properties.FederatedClientId
			server.FederatedClientId = &federatedClientId
		}
	}

	// Set property "Identity":
	if typedInput.Identity != nil {
		var identity1 ResourceIdentity
		err := identity1.PopulateFromARM(owner, *typedInput.Identity)
		if err != nil {
			return err
		}
		identity := identity1
		server.Identity = &identity
	}

	// Set property "KeyId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KeyId != nil {
			keyId := *typedInput.Properties.KeyId
			server.KeyId = &keyId
		}
	}

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

	// Set property "MinimalTlsVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MinimalTlsVersion != nil {
			minimalTlsVersion := *typedInput.Properties.MinimalTlsVersion
			server.MinimalTlsVersion = &minimalTlsVersion
		}
	}

	// no assignment for property "OperatorSpec"

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

	// no assignment for property "PrimaryUserAssignedIdentityReference"

	// Set property "PublicNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicNetworkAccess)
			publicNetworkAccess := ServerProperties_PublicNetworkAccess(temp)
			server.PublicNetworkAccess = &publicNetworkAccess
		}
	}

	// Set property "RestrictOutboundNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RestrictOutboundNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.RestrictOutboundNetworkAccess)
			restrictOutboundNetworkAccess := ServerProperties_RestrictOutboundNetworkAccess(temp)
			server.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess
		}
	}

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

	// Set property "Version":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Version != nil {
			version := *typedInput.Properties.Version
			server.Version = &version
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Server_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Server_Spec{}
	err := server.AssignProperties_To_Server_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_Server_Spec populates our Server_Spec from the provided source Server_Spec
func (server *Server_Spec) AssignProperties_From_Server_Spec(source *storage.Server_Spec) error {

	// AdministratorLogin
	server.AdministratorLogin = genruntime.ClonePointerToString(source.AdministratorLogin)

	// AdministratorLoginPassword
	if source.AdministratorLoginPassword != nil {
		administratorLoginPassword := source.AdministratorLoginPassword.Copy()
		server.AdministratorLoginPassword = &administratorLoginPassword
	} else {
		server.AdministratorLoginPassword = nil
	}

	// Administrators
	if source.Administrators != nil {
		var administrator ServerExternalAdministrator
		err := administrator.AssignProperties_From_ServerExternalAdministrator(source.Administrators)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ServerExternalAdministrator() to populate field Administrators")
		}
		server.Administrators = &administrator
	} else {
		server.Administrators = nil
	}

	// AzureName
	server.AzureName = source.AzureName

	// FederatedClientId
	server.FederatedClientId = genruntime.ClonePointerToString(source.FederatedClientId)

	// Identity
	if source.Identity != nil {
		var identity ResourceIdentity
		err := identity.AssignProperties_From_ResourceIdentity(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceIdentity() to populate field Identity")
		}
		server.Identity = &identity
	} else {
		server.Identity = nil
	}

	// KeyId
	server.KeyId = genruntime.ClonePointerToString(source.KeyId)

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

	// MinimalTlsVersion
	server.MinimalTlsVersion = genruntime.ClonePointerToString(source.MinimalTlsVersion)

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

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

	// PrimaryUserAssignedIdentityReference
	if source.PrimaryUserAssignedIdentityReference != nil {
		primaryUserAssignedIdentityReference := source.PrimaryUserAssignedIdentityReference.Copy()
		server.PrimaryUserAssignedIdentityReference = &primaryUserAssignedIdentityReference
	} else {
		server.PrimaryUserAssignedIdentityReference = nil
	}

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		publicNetworkAccess := *source.PublicNetworkAccess
		publicNetworkAccessTemp := genruntime.ToEnum(publicNetworkAccess, serverProperties_PublicNetworkAccess_Values)
		server.PublicNetworkAccess = &publicNetworkAccessTemp
	} else {
		server.PublicNetworkAccess = nil
	}

	// RestrictOutboundNetworkAccess
	if source.RestrictOutboundNetworkAccess != nil {
		restrictOutboundNetworkAccess := *source.RestrictOutboundNetworkAccess
		restrictOutboundNetworkAccessTemp := genruntime.ToEnum(restrictOutboundNetworkAccess, serverProperties_RestrictOutboundNetworkAccess_Values)
		server.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccessTemp
	} else {
		server.RestrictOutboundNetworkAccess = nil
	}

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

	// Version
	server.Version = genruntime.ClonePointerToString(source.Version)

	// No error
	return nil
}

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

	// AdministratorLogin
	destination.AdministratorLogin = genruntime.ClonePointerToString(server.AdministratorLogin)

	// AdministratorLoginPassword
	if server.AdministratorLoginPassword != nil {
		administratorLoginPassword := server.AdministratorLoginPassword.Copy()
		destination.AdministratorLoginPassword = &administratorLoginPassword
	} else {
		destination.AdministratorLoginPassword = nil
	}

	// Administrators
	if server.Administrators != nil {
		var administrator storage.ServerExternalAdministrator
		err := server.Administrators.AssignProperties_To_ServerExternalAdministrator(&administrator)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ServerExternalAdministrator() to populate field Administrators")
		}
		destination.Administrators = &administrator
	} else {
		destination.Administrators = nil
	}

	// AzureName
	destination.AzureName = server.AzureName

	// FederatedClientId
	destination.FederatedClientId = genruntime.ClonePointerToString(server.FederatedClientId)

	// Identity
	if server.Identity != nil {
		var identity storage.ResourceIdentity
		err := server.Identity.AssignProperties_To_ResourceIdentity(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceIdentity() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

	// KeyId
	destination.KeyId = genruntime.ClonePointerToString(server.KeyId)

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

	// MinimalTlsVersion
	destination.MinimalTlsVersion = genruntime.ClonePointerToString(server.MinimalTlsVersion)

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

	// OriginalVersion
	destination.OriginalVersion = server.OriginalVersion()

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

	// PrimaryUserAssignedIdentityReference
	if server.PrimaryUserAssignedIdentityReference != nil {
		primaryUserAssignedIdentityReference := server.PrimaryUserAssignedIdentityReference.Copy()
		destination.PrimaryUserAssignedIdentityReference = &primaryUserAssignedIdentityReference
	} else {
		destination.PrimaryUserAssignedIdentityReference = nil
	}

	// PublicNetworkAccess
	if server.PublicNetworkAccess != nil {
		publicNetworkAccess := string(*server.PublicNetworkAccess)
		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// RestrictOutboundNetworkAccess
	if server.RestrictOutboundNetworkAccess != nil {
		restrictOutboundNetworkAccess := string(*server.RestrictOutboundNetworkAccess)
		destination.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess
	} else {
		destination.RestrictOutboundNetworkAccess = nil
	}

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

	// Version
	destination.Version = genruntime.ClonePointerToString(server.Version)

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

	// No error
	return nil
}

// Initialize_From_Server_STATUS populates our Server_Spec from the provided source Server_STATUS
func (server *Server_Spec) Initialize_From_Server_STATUS(source *Server_STATUS) error {

	// AdministratorLogin
	server.AdministratorLogin = genruntime.ClonePointerToString(source.AdministratorLogin)

	// Administrators
	if source.Administrators != nil {
		var administrator ServerExternalAdministrator
		err := administrator.Initialize_From_ServerExternalAdministrator_STATUS(source.Administrators)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ServerExternalAdministrator_STATUS() to populate field Administrators")
		}
		server.Administrators = &administrator
	} else {
		server.Administrators = nil
	}

	// FederatedClientId
	server.FederatedClientId = genruntime.ClonePointerToString(source.FederatedClientId)

	// Identity
	if source.Identity != nil {
		var identity ResourceIdentity
		err := identity.Initialize_From_ResourceIdentity_STATUS(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_ResourceIdentity_STATUS() to populate field Identity")
		}
		server.Identity = &identity
	} else {
		server.Identity = nil
	}

	// KeyId
	server.KeyId = genruntime.ClonePointerToString(source.KeyId)

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

	// MinimalTlsVersion
	server.MinimalTlsVersion = genruntime.ClonePointerToString(source.MinimalTlsVersion)

	// PrimaryUserAssignedIdentityReference
	if source.PrimaryUserAssignedIdentityId != nil {
		primaryUserAssignedIdentityReference := genruntime.CreateResourceReferenceFromARMID(*source.PrimaryUserAssignedIdentityId)
		server.PrimaryUserAssignedIdentityReference = &primaryUserAssignedIdentityReference
	} else {
		server.PrimaryUserAssignedIdentityReference = nil
	}

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		publicNetworkAccess := genruntime.ToEnum(string(*source.PublicNetworkAccess), serverProperties_PublicNetworkAccess_Values)
		server.PublicNetworkAccess = &publicNetworkAccess
	} else {
		server.PublicNetworkAccess = nil
	}

	// RestrictOutboundNetworkAccess
	if source.RestrictOutboundNetworkAccess != nil {
		restrictOutboundNetworkAccess := genruntime.ToEnum(string(*source.RestrictOutboundNetworkAccess), serverProperties_RestrictOutboundNetworkAccess_Values)
		server.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess
	} else {
		server.RestrictOutboundNetworkAccess = nil
	}

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

	// Version
	server.Version = genruntime.ClonePointerToString(source.Version)

	// No error
	return nil
}

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

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

// An Azure SQL Database server.
type Server_STATUS struct {
	// AdministratorLogin: Administrator username for the server. Once created it cannot be changed.
	AdministratorLogin *string `json:"administratorLogin,omitempty"`

	// Administrators: The Azure Active Directory administrator of the server.
	Administrators *ServerExternalAdministrator_STATUS `json:"administrators,omitempty"`

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

	// FederatedClientId: The Client id used for cross tenant CMK scenario
	FederatedClientId *string `json:"federatedClientId,omitempty"`

	// FullyQualifiedDomainName: The fully qualified domain name of the server.
	FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`

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

	// Identity: The Azure Active Directory identity of the server.
	Identity *ResourceIdentity_STATUS `json:"identity,omitempty"`

	// KeyId: A CMK URI of the key to use for encryption.
	KeyId *string `json:"keyId,omitempty"`

	// Kind: Kind of sql server. This is metadata used for the Azure portal experience.
	Kind *string `json:"kind,omitempty"`

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

	// MinimalTlsVersion: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'
	MinimalTlsVersion *string `json:"minimalTlsVersion,omitempty"`

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

	// PrimaryUserAssignedIdentityId: The resource id of a user assigned identity to be used by default.
	PrimaryUserAssignedIdentityId *string `json:"primaryUserAssignedIdentityId,omitempty"`

	// PrivateEndpointConnections: List of private endpoint connections on a server
	PrivateEndpointConnections []ServerPrivateEndpointConnection_STATUS `json:"privateEndpointConnections,omitempty"`

	// PublicNetworkAccess: Whether or not public endpoint access is allowed for this server.  Value is optional but if passed
	// in, must be 'Enabled' or 'Disabled'
	PublicNetworkAccess *ServerProperties_PublicNetworkAccess_STATUS `json:"publicNetworkAccess,omitempty"`

	// RestrictOutboundNetworkAccess: Whether or not to restrict outbound network access for this server.  Value is optional
	// but if passed in, must be 'Enabled' or 'Disabled'
	RestrictOutboundNetworkAccess *ServerProperties_RestrictOutboundNetworkAccess_STATUS `json:"restrictOutboundNetworkAccess,omitempty"`

	// State: The state of the server.
	State *string `json:"state,omitempty"`

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

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

	// Version: The version of the server.
	Version *string `json:"version,omitempty"`

	// WorkspaceFeature: Whether or not existing server has a workspace created and if it allows connection from workspace
	WorkspaceFeature *ServerProperties_WorkspaceFeature_STATUS `json:"workspaceFeature,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Server_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Server_STATUS{}
	err := server.AssignProperties_To_Server_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 = &Server_STATUS{}

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

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

	// Set property "AdministratorLogin":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AdministratorLogin != nil {
			administratorLogin := *typedInput.Properties.AdministratorLogin
			server.AdministratorLogin = &administratorLogin
		}
	}

	// Set property "Administrators":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Administrators != nil {
			var administrators1 ServerExternalAdministrator_STATUS
			err := administrators1.PopulateFromARM(owner, *typedInput.Properties.Administrators)
			if err != nil {
				return err
			}
			administrators := administrators1
			server.Administrators = &administrators
		}
	}

	// no assignment for property "Conditions"

	// Set property "FederatedClientId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FederatedClientId != nil {
			federatedClientId := *typedInput.Properties.FederatedClientId
			server.FederatedClientId = &federatedClientId
		}
	}

	// Set property "FullyQualifiedDomainName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.FullyQualifiedDomainName != nil {
			fullyQualifiedDomainName := *typedInput.Properties.FullyQualifiedDomainName
			server.FullyQualifiedDomainName = &fullyQualifiedDomainName
		}
	}

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

	// Set property "Identity":
	if typedInput.Identity != nil {
		var identity1 ResourceIdentity_STATUS
		err := identity1.PopulateFromARM(owner, *typedInput.Identity)
		if err != nil {
			return err
		}
		identity := identity1
		server.Identity = &identity
	}

	// Set property "KeyId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KeyId != nil {
			keyId := *typedInput.Properties.KeyId
			server.KeyId = &keyId
		}
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		kind := *typedInput.Kind
		server.Kind = &kind
	}

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

	// Set property "MinimalTlsVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MinimalTlsVersion != nil {
			minimalTlsVersion := *typedInput.Properties.MinimalTlsVersion
			server.MinimalTlsVersion = &minimalTlsVersion
		}
	}

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

	// Set property "PrimaryUserAssignedIdentityId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PrimaryUserAssignedIdentityId != nil {
			primaryUserAssignedIdentityId := *typedInput.Properties.PrimaryUserAssignedIdentityId
			server.PrimaryUserAssignedIdentityId = &primaryUserAssignedIdentityId
		}
	}

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

	// Set property "PublicNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicNetworkAccess)
			publicNetworkAccess := ServerProperties_PublicNetworkAccess_STATUS(temp)
			server.PublicNetworkAccess = &publicNetworkAccess
		}
	}

	// Set property "RestrictOutboundNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RestrictOutboundNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.RestrictOutboundNetworkAccess)
			restrictOutboundNetworkAccess := ServerProperties_RestrictOutboundNetworkAccess_STATUS(temp)
			server.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess
		}
	}

	// Set property "State":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.State != nil {
			state := *typedInput.Properties.State
			server.State = &state
		}
	}

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

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

	// Set property "Version":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Version != nil {
			version := *typedInput.Properties.Version
			server.Version = &version
		}
	}

	// Set property "WorkspaceFeature":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.WorkspaceFeature != nil {
			var temp string
			temp = string(*typedInput.Properties.WorkspaceFeature)
			workspaceFeature := ServerProperties_WorkspaceFeature_STATUS(temp)
			server.WorkspaceFeature = &workspaceFeature
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Server_STATUS populates our Server_STATUS from the provided source Server_STATUS
func (server *Server_STATUS) AssignProperties_From_Server_STATUS(source *storage.Server_STATUS) error {

	// AdministratorLogin
	server.AdministratorLogin = genruntime.ClonePointerToString(source.AdministratorLogin)

	// Administrators
	if source.Administrators != nil {
		var administrator ServerExternalAdministrator_STATUS
		err := administrator.AssignProperties_From_ServerExternalAdministrator_STATUS(source.Administrators)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ServerExternalAdministrator_STATUS() to populate field Administrators")
		}
		server.Administrators = &administrator
	} else {
		server.Administrators = nil
	}

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

	// FederatedClientId
	server.FederatedClientId = genruntime.ClonePointerToString(source.FederatedClientId)

	// FullyQualifiedDomainName
	server.FullyQualifiedDomainName = genruntime.ClonePointerToString(source.FullyQualifiedDomainName)

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

	// Identity
	if source.Identity != nil {
		var identity ResourceIdentity_STATUS
		err := identity.AssignProperties_From_ResourceIdentity_STATUS(source.Identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ResourceIdentity_STATUS() to populate field Identity")
		}
		server.Identity = &identity
	} else {
		server.Identity = nil
	}

	// KeyId
	server.KeyId = genruntime.ClonePointerToString(source.KeyId)

	// Kind
	server.Kind = genruntime.ClonePointerToString(source.Kind)

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

	// MinimalTlsVersion
	server.MinimalTlsVersion = genruntime.ClonePointerToString(source.MinimalTlsVersion)

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

	// PrimaryUserAssignedIdentityId
	server.PrimaryUserAssignedIdentityId = genruntime.ClonePointerToString(source.PrimaryUserAssignedIdentityId)

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

	// PublicNetworkAccess
	if source.PublicNetworkAccess != nil {
		publicNetworkAccess := *source.PublicNetworkAccess
		publicNetworkAccessTemp := genruntime.ToEnum(publicNetworkAccess, serverProperties_PublicNetworkAccess_STATUS_Values)
		server.PublicNetworkAccess = &publicNetworkAccessTemp
	} else {
		server.PublicNetworkAccess = nil
	}

	// RestrictOutboundNetworkAccess
	if source.RestrictOutboundNetworkAccess != nil {
		restrictOutboundNetworkAccess := *source.RestrictOutboundNetworkAccess
		restrictOutboundNetworkAccessTemp := genruntime.ToEnum(restrictOutboundNetworkAccess, serverProperties_RestrictOutboundNetworkAccess_STATUS_Values)
		server.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccessTemp
	} else {
		server.RestrictOutboundNetworkAccess = nil
	}

	// State
	server.State = genruntime.ClonePointerToString(source.State)

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

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

	// Version
	server.Version = genruntime.ClonePointerToString(source.Version)

	// WorkspaceFeature
	if source.WorkspaceFeature != nil {
		workspaceFeature := *source.WorkspaceFeature
		workspaceFeatureTemp := genruntime.ToEnum(workspaceFeature, serverProperties_WorkspaceFeature_STATUS_Values)
		server.WorkspaceFeature = &workspaceFeatureTemp
	} else {
		server.WorkspaceFeature = nil
	}

	// No error
	return nil
}

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

	// AdministratorLogin
	destination.AdministratorLogin = genruntime.ClonePointerToString(server.AdministratorLogin)

	// Administrators
	if server.Administrators != nil {
		var administrator storage.ServerExternalAdministrator_STATUS
		err := server.Administrators.AssignProperties_To_ServerExternalAdministrator_STATUS(&administrator)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ServerExternalAdministrator_STATUS() to populate field Administrators")
		}
		destination.Administrators = &administrator
	} else {
		destination.Administrators = nil
	}

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

	// FederatedClientId
	destination.FederatedClientId = genruntime.ClonePointerToString(server.FederatedClientId)

	// FullyQualifiedDomainName
	destination.FullyQualifiedDomainName = genruntime.ClonePointerToString(server.FullyQualifiedDomainName)

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

	// Identity
	if server.Identity != nil {
		var identity storage.ResourceIdentity_STATUS
		err := server.Identity.AssignProperties_To_ResourceIdentity_STATUS(&identity)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_ResourceIdentity_STATUS() to populate field Identity")
		}
		destination.Identity = &identity
	} else {
		destination.Identity = nil
	}

	// KeyId
	destination.KeyId = genruntime.ClonePointerToString(server.KeyId)

	// Kind
	destination.Kind = genruntime.ClonePointerToString(server.Kind)

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

	// MinimalTlsVersion
	destination.MinimalTlsVersion = genruntime.ClonePointerToString(server.MinimalTlsVersion)

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

	// PrimaryUserAssignedIdentityId
	destination.PrimaryUserAssignedIdentityId = genruntime.ClonePointerToString(server.PrimaryUserAssignedIdentityId)

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

	// PublicNetworkAccess
	if server.PublicNetworkAccess != nil {
		publicNetworkAccess := string(*server.PublicNetworkAccess)
		destination.PublicNetworkAccess = &publicNetworkAccess
	} else {
		destination.PublicNetworkAccess = nil
	}

	// RestrictOutboundNetworkAccess
	if server.RestrictOutboundNetworkAccess != nil {
		restrictOutboundNetworkAccess := string(*server.RestrictOutboundNetworkAccess)
		destination.RestrictOutboundNetworkAccess = &restrictOutboundNetworkAccess
	} else {
		destination.RestrictOutboundNetworkAccess = nil
	}

	// State
	destination.State = genruntime.ClonePointerToString(server.State)

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

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

	// Version
	destination.Version = genruntime.ClonePointerToString(server.Version)

	// WorkspaceFeature
	if server.WorkspaceFeature != nil {
		workspaceFeature := string(*server.WorkspaceFeature)
		destination.WorkspaceFeature = &workspaceFeature
	} else {
		destination.WorkspaceFeature = nil
	}

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

	// No error
	return nil
}

// Azure Active Directory identity configuration for a resource.
type ResourceIdentity struct {
	// Type: The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active
	// Directory principal for the resource.
	Type *ResourceIdentity_Type `json:"type,omitempty"`

	// UserAssignedIdentities: The resource ids of the user assigned identities to use
	UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"`
}

var _ genruntime.ARMTransformer = &ResourceIdentity{}

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

	// Set property "Type":
	if identity.Type != nil {
		var temp string
		temp = string(*identity.Type)
		typeVar := arm.ResourceIdentity_Type(temp)
		result.Type = &typeVar
	}

	// Set property "UserAssignedIdentities":
	result.UserAssignedIdentities = make(map[string]arm.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities))
	for _, ident := range identity.UserAssignedIdentities {
		identARMID, err := resolved.ResolvedReferences.Lookup(ident.Reference)
		if err != nil {
			return nil, err
		}
		key := identARMID
		result.UserAssignedIdentities[key] = arm.UserAssignedIdentityDetails{}
	}
	return result, nil
}

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

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

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

	// no assignment for property "UserAssignedIdentities"

	// No error
	return nil
}

// AssignProperties_From_ResourceIdentity populates our ResourceIdentity from the provided source ResourceIdentity
func (identity *ResourceIdentity) AssignProperties_From_ResourceIdentity(source *storage.ResourceIdentity) error {

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, resourceIdentity_Type_Values)
		identity.Type = &typeTemp
	} else {
		identity.Type = nil
	}

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]UserAssignedIdentityDetails, len(source.UserAssignedIdentities))
		for userAssignedIdentityIndex, userAssignedIdentityItem := range source.UserAssignedIdentities {
			var userAssignedIdentity UserAssignedIdentityDetails
			err := userAssignedIdentity.AssignProperties_From_UserAssignedIdentityDetails(&userAssignedIdentityItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UserAssignedIdentityDetails() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity
		}
		identity.UserAssignedIdentities = userAssignedIdentityList
	} else {
		identity.UserAssignedIdentities = nil
	}

	// No error
	return nil
}

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

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

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]storage.UserAssignedIdentityDetails, len(identity.UserAssignedIdentities))
		for userAssignedIdentityIndex, userAssignedIdentityItem := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.UserAssignedIdentityDetails
			err := userAssignedIdentityItem.AssignProperties_To_UserAssignedIdentityDetails(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UserAssignedIdentityDetails() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityList[userAssignedIdentityIndex] = userAssignedIdentity
		}
		destination.UserAssignedIdentities = userAssignedIdentityList
	} else {
		destination.UserAssignedIdentities = nil
	}

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

	// No error
	return nil
}

// Initialize_From_ResourceIdentity_STATUS populates our ResourceIdentity from the provided source ResourceIdentity_STATUS
func (identity *ResourceIdentity) Initialize_From_ResourceIdentity_STATUS(source *ResourceIdentity_STATUS) error {

	// Type
	if source.Type != nil {
		typeVar := genruntime.ToEnum(string(*source.Type), resourceIdentity_Type_Values)
		identity.Type = &typeVar
	} else {
		identity.Type = nil
	}

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityList := make([]UserAssignedIdentityDetails, 0, len(source.UserAssignedIdentities))
		for userAssignedIdentitiesKey := range source.UserAssignedIdentities {
			userAssignedIdentitiesRef := genruntime.CreateResourceReferenceFromARMID(userAssignedIdentitiesKey)
			userAssignedIdentityList = append(userAssignedIdentityList, UserAssignedIdentityDetails{Reference: userAssignedIdentitiesRef})
		}
		identity.UserAssignedIdentities = userAssignedIdentityList
	} else {
		identity.UserAssignedIdentities = nil
	}

	// No error
	return nil
}

// Azure Active Directory identity configuration for a resource.
type ResourceIdentity_STATUS struct {
	// PrincipalId: The Azure Active Directory principal id.
	PrincipalId *string `json:"principalId,omitempty"`

	// TenantId: The Azure Active Directory tenant id.
	TenantId *string `json:"tenantId,omitempty"`

	// Type: The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active
	// Directory principal for the resource.
	Type *ResourceIdentity_Type_STATUS `json:"type,omitempty"`

	// UserAssignedIdentities: The resource ids of the user assigned identities to use
	UserAssignedIdentities map[string]UserIdentity_STATUS `json:"userAssignedIdentities,omitempty"`
}

var _ genruntime.FromARMConverter = &ResourceIdentity_STATUS{}

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

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

	// Set property "PrincipalId":
	if typedInput.PrincipalId != nil {
		principalId := *typedInput.PrincipalId
		identity.PrincipalId = &principalId
	}

	// Set property "TenantId":
	if typedInput.TenantId != nil {
		tenantId := *typedInput.TenantId
		identity.TenantId = &tenantId
	}

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

	// Set property "UserAssignedIdentities":
	if typedInput.UserAssignedIdentities != nil {
		identity.UserAssignedIdentities = make(map[string]UserIdentity_STATUS, len(typedInput.UserAssignedIdentities))
		for key, value := range typedInput.UserAssignedIdentities {
			var value1 UserIdentity_STATUS
			err := value1.PopulateFromARM(owner, value)
			if err != nil {
				return err
			}
			identity.UserAssignedIdentities[key] = value1
		}
	}

	// No error
	return nil
}

// AssignProperties_From_ResourceIdentity_STATUS populates our ResourceIdentity_STATUS from the provided source ResourceIdentity_STATUS
func (identity *ResourceIdentity_STATUS) AssignProperties_From_ResourceIdentity_STATUS(source *storage.ResourceIdentity_STATUS) error {

	// PrincipalId
	identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId)

	// TenantId
	identity.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// Type
	if source.Type != nil {
		typeVar := *source.Type
		typeTemp := genruntime.ToEnum(typeVar, resourceIdentity_Type_STATUS_Values)
		identity.Type = &typeTemp
	} else {
		identity.Type = nil
	}

	// UserAssignedIdentities
	if source.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]UserIdentity_STATUS, len(source.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range source.UserAssignedIdentities {
			var userAssignedIdentity UserIdentity_STATUS
			err := userAssignedIdentity.AssignProperties_From_UserIdentity_STATUS(&userAssignedIdentityValue)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_UserIdentity_STATUS() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity
		}
		identity.UserAssignedIdentities = userAssignedIdentityMap
	} else {
		identity.UserAssignedIdentities = nil
	}

	// No error
	return nil
}

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

	// PrincipalId
	destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId)

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(identity.TenantId)

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

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]storage.UserIdentity_STATUS, len(identity.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.UserIdentity_STATUS
			err := userAssignedIdentityValue.AssignProperties_To_UserIdentity_STATUS(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_UserIdentity_STATUS() to populate field UserAssignedIdentities")
			}
			userAssignedIdentityMap[userAssignedIdentityKey] = userAssignedIdentity
		}
		destination.UserAssignedIdentities = userAssignedIdentityMap
	} else {
		destination.UserAssignedIdentities = nil
	}

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

	// No error
	return nil
}

// Properties of a active directory administrator.
type ServerExternalAdministrator struct {
	// AdministratorType: Type of the sever administrator.
	AdministratorType *ServerExternalAdministrator_AdministratorType `json:"administratorType,omitempty"`

	// AzureADOnlyAuthentication: Azure Active Directory only Authentication enabled.
	AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"`

	// Login: Login name of the server administrator.
	Login *string `json:"login,omitempty"`

	// PrincipalType: Principal Type of the sever administrator.
	PrincipalType *ServerExternalAdministrator_PrincipalType `json:"principalType,omitempty"`

	// +kubebuilder:validation:Pattern="^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
	// Sid: SID (object ID) of the server administrator.
	Sid *string `json:"sid,omitempty"`

	// +kubebuilder:validation:Pattern="^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$"
	// TenantId: Tenant ID of the administrator.
	TenantId *string `json:"tenantId,omitempty"`
}

var _ genruntime.ARMTransformer = &ServerExternalAdministrator{}

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

	// Set property "AdministratorType":
	if administrator.AdministratorType != nil {
		var temp string
		temp = string(*administrator.AdministratorType)
		administratorType := arm.ServerExternalAdministrator_AdministratorType(temp)
		result.AdministratorType = &administratorType
	}

	// Set property "AzureADOnlyAuthentication":
	if administrator.AzureADOnlyAuthentication != nil {
		azureADOnlyAuthentication := *administrator.AzureADOnlyAuthentication
		result.AzureADOnlyAuthentication = &azureADOnlyAuthentication
	}

	// Set property "Login":
	if administrator.Login != nil {
		login := *administrator.Login
		result.Login = &login
	}

	// Set property "PrincipalType":
	if administrator.PrincipalType != nil {
		var temp string
		temp = string(*administrator.PrincipalType)
		principalType := arm.ServerExternalAdministrator_PrincipalType(temp)
		result.PrincipalType = &principalType
	}

	// Set property "Sid":
	if administrator.Sid != nil {
		sid := *administrator.Sid
		result.Sid = &sid
	}

	// Set property "TenantId":
	if administrator.TenantId != nil {
		tenantId := *administrator.TenantId
		result.TenantId = &tenantId
	}
	return result, nil
}

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

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

	// Set property "AdministratorType":
	if typedInput.AdministratorType != nil {
		var temp string
		temp = string(*typedInput.AdministratorType)
		administratorType := ServerExternalAdministrator_AdministratorType(temp)
		administrator.AdministratorType = &administratorType
	}

	// Set property "AzureADOnlyAuthentication":
	if typedInput.AzureADOnlyAuthentication != nil {
		azureADOnlyAuthentication := *typedInput.AzureADOnlyAuthentication
		administrator.AzureADOnlyAuthentication = &azureADOnlyAuthentication
	}

	// Set property "Login":
	if typedInput.Login != nil {
		login := *typedInput.Login
		administrator.Login = &login
	}

	// Set property "PrincipalType":
	if typedInput.PrincipalType != nil {
		var temp string
		temp = string(*typedInput.PrincipalType)
		principalType := ServerExternalAdministrator_PrincipalType(temp)
		administrator.PrincipalType = &principalType
	}

	// Set property "Sid":
	if typedInput.Sid != nil {
		sid := *typedInput.Sid
		administrator.Sid = &sid
	}

	// Set property "TenantId":
	if typedInput.TenantId != nil {
		tenantId := *typedInput.TenantId
		administrator.TenantId = &tenantId
	}

	// No error
	return nil
}

// AssignProperties_From_ServerExternalAdministrator populates our ServerExternalAdministrator from the provided source ServerExternalAdministrator
func (administrator *ServerExternalAdministrator) AssignProperties_From_ServerExternalAdministrator(source *storage.ServerExternalAdministrator) error {

	// AdministratorType
	if source.AdministratorType != nil {
		administratorType := *source.AdministratorType
		administratorTypeTemp := genruntime.ToEnum(administratorType, serverExternalAdministrator_AdministratorType_Values)
		administrator.AdministratorType = &administratorTypeTemp
	} else {
		administrator.AdministratorType = nil
	}

	// AzureADOnlyAuthentication
	if source.AzureADOnlyAuthentication != nil {
		azureADOnlyAuthentication := *source.AzureADOnlyAuthentication
		administrator.AzureADOnlyAuthentication = &azureADOnlyAuthentication
	} else {
		administrator.AzureADOnlyAuthentication = nil
	}

	// Login
	administrator.Login = genruntime.ClonePointerToString(source.Login)

	// PrincipalType
	if source.PrincipalType != nil {
		principalType := *source.PrincipalType
		principalTypeTemp := genruntime.ToEnum(principalType, serverExternalAdministrator_PrincipalType_Values)
		administrator.PrincipalType = &principalTypeTemp
	} else {
		administrator.PrincipalType = nil
	}

	// Sid
	administrator.Sid = genruntime.ClonePointerToString(source.Sid)

	// TenantId
	administrator.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// No error
	return nil
}

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

	// AdministratorType
	if administrator.AdministratorType != nil {
		administratorType := string(*administrator.AdministratorType)
		destination.AdministratorType = &administratorType
	} else {
		destination.AdministratorType = nil
	}

	// AzureADOnlyAuthentication
	if administrator.AzureADOnlyAuthentication != nil {
		azureADOnlyAuthentication := *administrator.AzureADOnlyAuthentication
		destination.AzureADOnlyAuthentication = &azureADOnlyAuthentication
	} else {
		destination.AzureADOnlyAuthentication = nil
	}

	// Login
	destination.Login = genruntime.ClonePointerToString(administrator.Login)

	// PrincipalType
	if administrator.PrincipalType != nil {
		principalType := string(*administrator.PrincipalType)
		destination.PrincipalType = &principalType
	} else {
		destination.PrincipalType = nil
	}

	// Sid
	destination.Sid = genruntime.ClonePointerToString(administrator.Sid)

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(administrator.TenantId)

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

	// No error
	return nil
}

// Initialize_From_ServerExternalAdministrator_STATUS populates our ServerExternalAdministrator from the provided source ServerExternalAdministrator_STATUS
func (administrator *ServerExternalAdministrator) Initialize_From_ServerExternalAdministrator_STATUS(source *ServerExternalAdministrator_STATUS) error {

	// AdministratorType
	if source.AdministratorType != nil {
		administratorType := genruntime.ToEnum(string(*source.AdministratorType), serverExternalAdministrator_AdministratorType_Values)
		administrator.AdministratorType = &administratorType
	} else {
		administrator.AdministratorType = nil
	}

	// AzureADOnlyAuthentication
	if source.AzureADOnlyAuthentication != nil {
		azureADOnlyAuthentication := *source.AzureADOnlyAuthentication
		administrator.AzureADOnlyAuthentication = &azureADOnlyAuthentication
	} else {
		administrator.AzureADOnlyAuthentication = nil
	}

	// Login
	administrator.Login = genruntime.ClonePointerToString(source.Login)

	// PrincipalType
	if source.PrincipalType != nil {
		principalType := genruntime.ToEnum(string(*source.PrincipalType), serverExternalAdministrator_PrincipalType_Values)
		administrator.PrincipalType = &principalType
	} else {
		administrator.PrincipalType = nil
	}

	// Sid
	administrator.Sid = genruntime.ClonePointerToString(source.Sid)

	// TenantId
	administrator.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// No error
	return nil
}

// Properties of a active directory administrator.
type ServerExternalAdministrator_STATUS struct {
	// AdministratorType: Type of the sever administrator.
	AdministratorType *ServerExternalAdministrator_AdministratorType_STATUS `json:"administratorType,omitempty"`

	// AzureADOnlyAuthentication: Azure Active Directory only Authentication enabled.
	AzureADOnlyAuthentication *bool `json:"azureADOnlyAuthentication,omitempty"`

	// Login: Login name of the server administrator.
	Login *string `json:"login,omitempty"`

	// PrincipalType: Principal Type of the sever administrator.
	PrincipalType *ServerExternalAdministrator_PrincipalType_STATUS `json:"principalType,omitempty"`

	// Sid: SID (object ID) of the server administrator.
	Sid *string `json:"sid,omitempty"`

	// TenantId: Tenant ID of the administrator.
	TenantId *string `json:"tenantId,omitempty"`
}

var _ genruntime.FromARMConverter = &ServerExternalAdministrator_STATUS{}

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

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

	// Set property "AdministratorType":
	if typedInput.AdministratorType != nil {
		var temp string
		temp = string(*typedInput.AdministratorType)
		administratorType := ServerExternalAdministrator_AdministratorType_STATUS(temp)
		administrator.AdministratorType = &administratorType
	}

	// Set property "AzureADOnlyAuthentication":
	if typedInput.AzureADOnlyAuthentication != nil {
		azureADOnlyAuthentication := *typedInput.AzureADOnlyAuthentication
		administrator.AzureADOnlyAuthentication = &azureADOnlyAuthentication
	}

	// Set property "Login":
	if typedInput.Login != nil {
		login := *typedInput.Login
		administrator.Login = &login
	}

	// Set property "PrincipalType":
	if typedInput.PrincipalType != nil {
		var temp string
		temp = string(*typedInput.PrincipalType)
		principalType := ServerExternalAdministrator_PrincipalType_STATUS(temp)
		administrator.PrincipalType = &principalType
	}

	// Set property "Sid":
	if typedInput.Sid != nil {
		sid := *typedInput.Sid
		administrator.Sid = &sid
	}

	// Set property "TenantId":
	if typedInput.TenantId != nil {
		tenantId := *typedInput.TenantId
		administrator.TenantId = &tenantId
	}

	// No error
	return nil
}

// AssignProperties_From_ServerExternalAdministrator_STATUS populates our ServerExternalAdministrator_STATUS from the provided source ServerExternalAdministrator_STATUS
func (administrator *ServerExternalAdministrator_STATUS) AssignProperties_From_ServerExternalAdministrator_STATUS(source *storage.ServerExternalAdministrator_STATUS) error {

	// AdministratorType
	if source.AdministratorType != nil {
		administratorType := *source.AdministratorType
		administratorTypeTemp := genruntime.ToEnum(administratorType, serverExternalAdministrator_AdministratorType_STATUS_Values)
		administrator.AdministratorType = &administratorTypeTemp
	} else {
		administrator.AdministratorType = nil
	}

	// AzureADOnlyAuthentication
	if source.AzureADOnlyAuthentication != nil {
		azureADOnlyAuthentication := *source.AzureADOnlyAuthentication
		administrator.AzureADOnlyAuthentication = &azureADOnlyAuthentication
	} else {
		administrator.AzureADOnlyAuthentication = nil
	}

	// Login
	administrator.Login = genruntime.ClonePointerToString(source.Login)

	// PrincipalType
	if source.PrincipalType != nil {
		principalType := *source.PrincipalType
		principalTypeTemp := genruntime.ToEnum(principalType, serverExternalAdministrator_PrincipalType_STATUS_Values)
		administrator.PrincipalType = &principalTypeTemp
	} else {
		administrator.PrincipalType = nil
	}

	// Sid
	administrator.Sid = genruntime.ClonePointerToString(source.Sid)

	// TenantId
	administrator.TenantId = genruntime.ClonePointerToString(source.TenantId)

	// No error
	return nil
}

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

	// AdministratorType
	if administrator.AdministratorType != nil {
		administratorType := string(*administrator.AdministratorType)
		destination.AdministratorType = &administratorType
	} else {
		destination.AdministratorType = nil
	}

	// AzureADOnlyAuthentication
	if administrator.AzureADOnlyAuthentication != nil {
		azureADOnlyAuthentication := *administrator.AzureADOnlyAuthentication
		destination.AzureADOnlyAuthentication = &azureADOnlyAuthentication
	} else {
		destination.AzureADOnlyAuthentication = nil
	}

	// Login
	destination.Login = genruntime.ClonePointerToString(administrator.Login)

	// PrincipalType
	if administrator.PrincipalType != nil {
		principalType := string(*administrator.PrincipalType)
		destination.PrincipalType = &principalType
	} else {
		destination.PrincipalType = nil
	}

	// Sid
	destination.Sid = genruntime.ClonePointerToString(administrator.Sid)

	// TenantId
	destination.TenantId = genruntime.ClonePointerToString(administrator.TenantId)

	// 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 ServerOperatorSpec struct {
	// ConfigMapExpressions: configures where to place operator written dynamic ConfigMaps (created with CEL expressions).
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`

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

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

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

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

	// ConfigMaps
	if source.ConfigMaps != nil {
		var configMap ServerOperatorConfigMaps
		err := configMap.AssignProperties_From_ServerOperatorConfigMaps(source.ConfigMaps)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_ServerOperatorConfigMaps() to populate field ConfigMaps")
		}
		operator.ConfigMaps = &configMap
	} else {
		operator.ConfigMaps = nil
	}

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

// A private endpoint connection under a server
type ServerPrivateEndpointConnection_STATUS struct {
	// Id: Resource ID.
	Id *string `json:"id,omitempty"`

	// Properties: Private endpoint connection properties
	Properties *PrivateEndpointConnectionProperties_STATUS `json:"properties,omitempty"`
}

var _ genruntime.FromARMConverter = &ServerPrivateEndpointConnection_STATUS{}

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

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

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

	// Set property "Properties":
	if typedInput.Properties != nil {
		var properties1 PrivateEndpointConnectionProperties_STATUS
		err := properties1.PopulateFromARM(owner, *typedInput.Properties)
		if err != nil {
			return err
		}
		properties := properties1
		connection.Properties = &properties
	}

	// No error
	return nil
}

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

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

	// Properties
	if source.Properties != nil {
		var property PrivateEndpointConnectionProperties_STATUS
		err := property.AssignProperties_From_PrivateEndpointConnectionProperties_STATUS(source.Properties)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpointConnectionProperties_STATUS() to populate field Properties")
		}
		connection.Properties = &property
	} else {
		connection.Properties = nil
	}

	// No error
	return nil
}

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

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

	// Properties
	if connection.Properties != nil {
		var property storage.PrivateEndpointConnectionProperties_STATUS
		err := connection.Properties.AssignProperties_To_PrivateEndpointConnectionProperties_STATUS(&property)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PrivateEndpointConnectionProperties_STATUS() to populate field Properties")
		}
		destination.Properties = &property
	} else {
		destination.Properties = nil
	}

	// 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 ServerProperties_PublicNetworkAccess string

const (
	ServerProperties_PublicNetworkAccess_Disabled = ServerProperties_PublicNetworkAccess("Disabled")
	ServerProperties_PublicNetworkAccess_Enabled  = ServerProperties_PublicNetworkAccess("Enabled")
)

// Mapping from string to ServerProperties_PublicNetworkAccess
var serverProperties_PublicNetworkAccess_Values = map[string]ServerProperties_PublicNetworkAccess{
	"disabled": ServerProperties_PublicNetworkAccess_Disabled,
	"enabled":  ServerProperties_PublicNetworkAccess_Enabled,
}

type ServerProperties_PublicNetworkAccess_STATUS string

const (
	ServerProperties_PublicNetworkAccess_STATUS_Disabled = ServerProperties_PublicNetworkAccess_STATUS("Disabled")
	ServerProperties_PublicNetworkAccess_STATUS_Enabled  = ServerProperties_PublicNetworkAccess_STATUS("Enabled")
)

// Mapping from string to ServerProperties_PublicNetworkAccess_STATUS
var serverProperties_PublicNetworkAccess_STATUS_Values = map[string]ServerProperties_PublicNetworkAccess_STATUS{
	"disabled": ServerProperties_PublicNetworkAccess_STATUS_Disabled,
	"enabled":  ServerProperties_PublicNetworkAccess_STATUS_Enabled,
}

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

const (
	ServerProperties_RestrictOutboundNetworkAccess_Disabled = ServerProperties_RestrictOutboundNetworkAccess("Disabled")
	ServerProperties_RestrictOutboundNetworkAccess_Enabled  = ServerProperties_RestrictOutboundNetworkAccess("Enabled")
)

// Mapping from string to ServerProperties_RestrictOutboundNetworkAccess
var serverProperties_RestrictOutboundNetworkAccess_Values = map[string]ServerProperties_RestrictOutboundNetworkAccess{
	"disabled": ServerProperties_RestrictOutboundNetworkAccess_Disabled,
	"enabled":  ServerProperties_RestrictOutboundNetworkAccess_Enabled,
}

type ServerProperties_RestrictOutboundNetworkAccess_STATUS string

const (
	ServerProperties_RestrictOutboundNetworkAccess_STATUS_Disabled = ServerProperties_RestrictOutboundNetworkAccess_STATUS("Disabled")
	ServerProperties_RestrictOutboundNetworkAccess_STATUS_Enabled  = ServerProperties_RestrictOutboundNetworkAccess_STATUS("Enabled")
)

// Mapping from string to ServerProperties_RestrictOutboundNetworkAccess_STATUS
var serverProperties_RestrictOutboundNetworkAccess_STATUS_Values = map[string]ServerProperties_RestrictOutboundNetworkAccess_STATUS{
	"disabled": ServerProperties_RestrictOutboundNetworkAccess_STATUS_Disabled,
	"enabled":  ServerProperties_RestrictOutboundNetworkAccess_STATUS_Enabled,
}

type ServerProperties_WorkspaceFeature_STATUS string

const (
	ServerProperties_WorkspaceFeature_STATUS_Connected    = ServerProperties_WorkspaceFeature_STATUS("Connected")
	ServerProperties_WorkspaceFeature_STATUS_Disconnected = ServerProperties_WorkspaceFeature_STATUS("Disconnected")
)

// Mapping from string to ServerProperties_WorkspaceFeature_STATUS
var serverProperties_WorkspaceFeature_STATUS_Values = map[string]ServerProperties_WorkspaceFeature_STATUS{
	"connected":    ServerProperties_WorkspaceFeature_STATUS_Connected,
	"disconnected": ServerProperties_WorkspaceFeature_STATUS_Disconnected,
}

// Properties of a private endpoint connection.
type PrivateEndpointConnectionProperties_STATUS struct {
	// GroupIds: Group IDs.
	GroupIds []string `json:"groupIds,omitempty"`

	// PrivateEndpoint: Private endpoint which the connection belongs to.
	PrivateEndpoint *PrivateEndpointProperty_STATUS `json:"privateEndpoint,omitempty"`

	// PrivateLinkServiceConnectionState: Connection state of the private endpoint connection.
	PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty_STATUS `json:"privateLinkServiceConnectionState,omitempty"`

	// ProvisioningState: State of the private endpoint connection.
	ProvisioningState *PrivateEndpointConnectionProperties_ProvisioningState_STATUS `json:"provisioningState,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateEndpointConnectionProperties_STATUS{}

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

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

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

	// Set property "PrivateEndpoint":
	if typedInput.PrivateEndpoint != nil {
		var privateEndpoint1 PrivateEndpointProperty_STATUS
		err := privateEndpoint1.PopulateFromARM(owner, *typedInput.PrivateEndpoint)
		if err != nil {
			return err
		}
		privateEndpoint := privateEndpoint1
		properties.PrivateEndpoint = &privateEndpoint
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpointConnectionProperties_STATUS populates our PrivateEndpointConnectionProperties_STATUS from the provided source PrivateEndpointConnectionProperties_STATUS
func (properties *PrivateEndpointConnectionProperties_STATUS) AssignProperties_From_PrivateEndpointConnectionProperties_STATUS(source *storage.PrivateEndpointConnectionProperties_STATUS) error {

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

	// PrivateEndpoint
	if source.PrivateEndpoint != nil {
		var privateEndpoint PrivateEndpointProperty_STATUS
		err := privateEndpoint.AssignProperties_From_PrivateEndpointProperty_STATUS(source.PrivateEndpoint)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PrivateEndpointProperty_STATUS() to populate field PrivateEndpoint")
		}
		properties.PrivateEndpoint = &privateEndpoint
	} else {
		properties.PrivateEndpoint = nil
	}

	// PrivateLinkServiceConnectionState
	if source.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState PrivateLinkServiceConnectionStateProperty_STATUS
		err := privateLinkServiceConnectionState.AssignProperties_From_PrivateLinkServiceConnectionStateProperty_STATUS(source.PrivateLinkServiceConnectionState)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_PrivateLinkServiceConnectionStateProperty_STATUS() to populate field PrivateLinkServiceConnectionState")
		}
		properties.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		properties.PrivateLinkServiceConnectionState = nil
	}

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

	// No error
	return nil
}

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

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

	// PrivateEndpoint
	if properties.PrivateEndpoint != nil {
		var privateEndpoint storage.PrivateEndpointProperty_STATUS
		err := properties.PrivateEndpoint.AssignProperties_To_PrivateEndpointProperty_STATUS(&privateEndpoint)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PrivateEndpointProperty_STATUS() to populate field PrivateEndpoint")
		}
		destination.PrivateEndpoint = &privateEndpoint
	} else {
		destination.PrivateEndpoint = nil
	}

	// PrivateLinkServiceConnectionState
	if properties.PrivateLinkServiceConnectionState != nil {
		var privateLinkServiceConnectionState storage.PrivateLinkServiceConnectionStateProperty_STATUS
		err := properties.PrivateLinkServiceConnectionState.AssignProperties_To_PrivateLinkServiceConnectionStateProperty_STATUS(&privateLinkServiceConnectionState)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_PrivateLinkServiceConnectionStateProperty_STATUS() to populate field PrivateLinkServiceConnectionState")
		}
		destination.PrivateLinkServiceConnectionState = &privateLinkServiceConnectionState
	} else {
		destination.PrivateLinkServiceConnectionState = nil
	}

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"None","SystemAssigned","SystemAssigned,UserAssigned","UserAssigned"}
type ResourceIdentity_Type string

const (
	ResourceIdentity_Type_None                       = ResourceIdentity_Type("None")
	ResourceIdentity_Type_SystemAssigned             = ResourceIdentity_Type("SystemAssigned")
	ResourceIdentity_Type_SystemAssignedUserAssigned = ResourceIdentity_Type("SystemAssigned,UserAssigned")
	ResourceIdentity_Type_UserAssigned               = ResourceIdentity_Type("UserAssigned")
)

// Mapping from string to ResourceIdentity_Type
var resourceIdentity_Type_Values = map[string]ResourceIdentity_Type{
	"none":                        ResourceIdentity_Type_None,
	"systemassigned":              ResourceIdentity_Type_SystemAssigned,
	"systemassigned,userassigned": ResourceIdentity_Type_SystemAssignedUserAssigned,
	"userassigned":                ResourceIdentity_Type_UserAssigned,
}

type ResourceIdentity_Type_STATUS string

const (
	ResourceIdentity_Type_STATUS_None                       = ResourceIdentity_Type_STATUS("None")
	ResourceIdentity_Type_STATUS_SystemAssigned             = ResourceIdentity_Type_STATUS("SystemAssigned")
	ResourceIdentity_Type_STATUS_SystemAssignedUserAssigned = ResourceIdentity_Type_STATUS("SystemAssigned,UserAssigned")
	ResourceIdentity_Type_STATUS_UserAssigned               = ResourceIdentity_Type_STATUS("UserAssigned")
)

// Mapping from string to ResourceIdentity_Type_STATUS
var resourceIdentity_Type_STATUS_Values = map[string]ResourceIdentity_Type_STATUS{
	"none":                        ResourceIdentity_Type_STATUS_None,
	"systemassigned":              ResourceIdentity_Type_STATUS_SystemAssigned,
	"systemassigned,userassigned": ResourceIdentity_Type_STATUS_SystemAssignedUserAssigned,
	"userassigned":                ResourceIdentity_Type_STATUS_UserAssigned,
}

// +kubebuilder:validation:Enum={"ActiveDirectory"}
type ServerExternalAdministrator_AdministratorType string

const ServerExternalAdministrator_AdministratorType_ActiveDirectory = ServerExternalAdministrator_AdministratorType("ActiveDirectory")

// Mapping from string to ServerExternalAdministrator_AdministratorType
var serverExternalAdministrator_AdministratorType_Values = map[string]ServerExternalAdministrator_AdministratorType{
	"activedirectory": ServerExternalAdministrator_AdministratorType_ActiveDirectory,
}

type ServerExternalAdministrator_AdministratorType_STATUS string

const ServerExternalAdministrator_AdministratorType_STATUS_ActiveDirectory = ServerExternalAdministrator_AdministratorType_STATUS("ActiveDirectory")

// Mapping from string to ServerExternalAdministrator_AdministratorType_STATUS
var serverExternalAdministrator_AdministratorType_STATUS_Values = map[string]ServerExternalAdministrator_AdministratorType_STATUS{
	"activedirectory": ServerExternalAdministrator_AdministratorType_STATUS_ActiveDirectory,
}

// +kubebuilder:validation:Enum={"Application","Group","User"}
type ServerExternalAdministrator_PrincipalType string

const (
	ServerExternalAdministrator_PrincipalType_Application = ServerExternalAdministrator_PrincipalType("Application")
	ServerExternalAdministrator_PrincipalType_Group       = ServerExternalAdministrator_PrincipalType("Group")
	ServerExternalAdministrator_PrincipalType_User        = ServerExternalAdministrator_PrincipalType("User")
)

// Mapping from string to ServerExternalAdministrator_PrincipalType
var serverExternalAdministrator_PrincipalType_Values = map[string]ServerExternalAdministrator_PrincipalType{
	"application": ServerExternalAdministrator_PrincipalType_Application,
	"group":       ServerExternalAdministrator_PrincipalType_Group,
	"user":        ServerExternalAdministrator_PrincipalType_User,
}

type ServerExternalAdministrator_PrincipalType_STATUS string

const (
	ServerExternalAdministrator_PrincipalType_STATUS_Application = ServerExternalAdministrator_PrincipalType_STATUS("Application")
	ServerExternalAdministrator_PrincipalType_STATUS_Group       = ServerExternalAdministrator_PrincipalType_STATUS("Group")
	ServerExternalAdministrator_PrincipalType_STATUS_User        = ServerExternalAdministrator_PrincipalType_STATUS("User")
)

// Mapping from string to ServerExternalAdministrator_PrincipalType_STATUS
var serverExternalAdministrator_PrincipalType_STATUS_Values = map[string]ServerExternalAdministrator_PrincipalType_STATUS{
	"application": ServerExternalAdministrator_PrincipalType_STATUS_Application,
	"group":       ServerExternalAdministrator_PrincipalType_STATUS_Group,
	"user":        ServerExternalAdministrator_PrincipalType_STATUS_User,
}

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

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

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Information about the user assigned identity for the resource
type UserAssignedIdentityDetails struct {
	Reference genruntime.ResourceReference `armReference:"Reference" json:"reference,omitempty"`
}

// AssignProperties_From_UserAssignedIdentityDetails populates our UserAssignedIdentityDetails from the provided source UserAssignedIdentityDetails
func (details *UserAssignedIdentityDetails) AssignProperties_From_UserAssignedIdentityDetails(source *storage.UserAssignedIdentityDetails) error {

	// Reference
	details.Reference = source.Reference.Copy()

	// No error
	return nil
}

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

	// Reference
	destination.Reference = details.Reference.Copy()

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

	// No error
	return nil
}

// Azure Active Directory identity configuration for a resource.
type UserIdentity_STATUS struct {
	// ClientId: The Azure Active Directory client id.
	ClientId *string `json:"clientId,omitempty"`

	// PrincipalId: The Azure Active Directory principal id.
	PrincipalId *string `json:"principalId,omitempty"`
}

var _ genruntime.FromARMConverter = &UserIdentity_STATUS{}

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

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

	// Set property "ClientId":
	if typedInput.ClientId != nil {
		clientId := *typedInput.ClientId
		identity.ClientId = &clientId
	}

	// Set property "PrincipalId":
	if typedInput.PrincipalId != nil {
		principalId := *typedInput.PrincipalId
		identity.PrincipalId = &principalId
	}

	// No error
	return nil
}

// AssignProperties_From_UserIdentity_STATUS populates our UserIdentity_STATUS from the provided source UserIdentity_STATUS
func (identity *UserIdentity_STATUS) AssignProperties_From_UserIdentity_STATUS(source *storage.UserIdentity_STATUS) error {

	// ClientId
	identity.ClientId = genruntime.ClonePointerToString(source.ClientId)

	// PrincipalId
	identity.PrincipalId = genruntime.ClonePointerToString(source.PrincipalId)

	// No error
	return nil
}

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

	// ClientId
	destination.ClientId = genruntime.ClonePointerToString(identity.ClientId)

	// PrincipalId
	destination.PrincipalId = genruntime.ClonePointerToString(identity.PrincipalId)

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

	// No error
	return nil
}

type PrivateEndpointConnectionProperties_ProvisioningState_STATUS string

const (
	PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Approving = PrivateEndpointConnectionProperties_ProvisioningState_STATUS("Approving")
	PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Dropping  = PrivateEndpointConnectionProperties_ProvisioningState_STATUS("Dropping")
	PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Failed    = PrivateEndpointConnectionProperties_ProvisioningState_STATUS("Failed")
	PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Ready     = PrivateEndpointConnectionProperties_ProvisioningState_STATUS("Ready")
	PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Rejecting = PrivateEndpointConnectionProperties_ProvisioningState_STATUS("Rejecting")
)

// Mapping from string to PrivateEndpointConnectionProperties_ProvisioningState_STATUS
var privateEndpointConnectionProperties_ProvisioningState_STATUS_Values = map[string]PrivateEndpointConnectionProperties_ProvisioningState_STATUS{
	"approving": PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Approving,
	"dropping":  PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Dropping,
	"failed":    PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Failed,
	"ready":     PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Ready,
	"rejecting": PrivateEndpointConnectionProperties_ProvisioningState_STATUS_Rejecting,
}

type PrivateEndpointProperty_STATUS struct {
	// Id: Resource id of the private endpoint.
	Id *string `json:"id,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateEndpointProperty_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_PrivateEndpointProperty_STATUS populates our PrivateEndpointProperty_STATUS from the provided source PrivateEndpointProperty_STATUS
func (property *PrivateEndpointProperty_STATUS) AssignProperties_From_PrivateEndpointProperty_STATUS(source *storage.PrivateEndpointProperty_STATUS) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

type PrivateLinkServiceConnectionStateProperty_STATUS struct {
	// ActionsRequired: The actions required for private link service connection.
	ActionsRequired *PrivateLinkServiceConnectionStateProperty_ActionsRequired_STATUS `json:"actionsRequired,omitempty"`

	// Description: The private link service connection description.
	Description *string `json:"description,omitempty"`

	// Status: The private link service connection status.
	Status *PrivateLinkServiceConnectionStateProperty_Status_STATUS `json:"status,omitempty"`
}

var _ genruntime.FromARMConverter = &PrivateLinkServiceConnectionStateProperty_STATUS{}

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

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

	// Set property "ActionsRequired":
	if typedInput.ActionsRequired != nil {
		var temp string
		temp = string(*typedInput.ActionsRequired)
		actionsRequired := PrivateLinkServiceConnectionStateProperty_ActionsRequired_STATUS(temp)
		property.ActionsRequired = &actionsRequired
	}

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

	// Set property "Status":
	if typedInput.Status != nil {
		var temp string
		temp = string(*typedInput.Status)
		status := PrivateLinkServiceConnectionStateProperty_Status_STATUS(temp)
		property.Status = &status
	}

	// No error
	return nil
}

// AssignProperties_From_PrivateLinkServiceConnectionStateProperty_STATUS populates our PrivateLinkServiceConnectionStateProperty_STATUS from the provided source PrivateLinkServiceConnectionStateProperty_STATUS
func (property *PrivateLinkServiceConnectionStateProperty_STATUS) AssignProperties_From_PrivateLinkServiceConnectionStateProperty_STATUS(source *storage.PrivateLinkServiceConnectionStateProperty_STATUS) error {

	// ActionsRequired
	if source.ActionsRequired != nil {
		actionsRequired := *source.ActionsRequired
		actionsRequiredTemp := genruntime.ToEnum(actionsRequired, privateLinkServiceConnectionStateProperty_ActionsRequired_STATUS_Values)
		property.ActionsRequired = &actionsRequiredTemp
	} else {
		property.ActionsRequired = nil
	}

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

	// Status
	if source.Status != nil {
		status := *source.Status
		statusTemp := genruntime.ToEnum(status, privateLinkServiceConnectionStateProperty_Status_STATUS_Values)
		property.Status = &statusTemp
	} else {
		property.Status = nil
	}

	// No error
	return nil
}

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

	// ActionsRequired
	if property.ActionsRequired != nil {
		actionsRequired := string(*property.ActionsRequired)
		destination.ActionsRequired = &actionsRequired
	} else {
		destination.ActionsRequired = nil
	}

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

	// Status
	if property.Status != nil {
		status := string(*property.Status)
		destination.Status = &status
	} else {
		destination.Status = nil
	}

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

	// No error
	return nil
}

type PrivateLinkServiceConnectionStateProperty_ActionsRequired_STATUS string

const PrivateLinkServiceConnectionStateProperty_ActionsRequired_STATUS_None = PrivateLinkServiceConnectionStateProperty_ActionsRequired_STATUS("None")

// Mapping from string to PrivateLinkServiceConnectionStateProperty_ActionsRequired_STATUS
var privateLinkServiceConnectionStateProperty_ActionsRequired_STATUS_Values = map[string]PrivateLinkServiceConnectionStateProperty_ActionsRequired_STATUS{
	"none": PrivateLinkServiceConnectionStateProperty_ActionsRequired_STATUS_None,
}

type PrivateLinkServiceConnectionStateProperty_Status_STATUS string

const (
	PrivateLinkServiceConnectionStateProperty_Status_STATUS_Approved     = PrivateLinkServiceConnectionStateProperty_Status_STATUS("Approved")
	PrivateLinkServiceConnectionStateProperty_Status_STATUS_Disconnected = PrivateLinkServiceConnectionStateProperty_Status_STATUS("Disconnected")
	PrivateLinkServiceConnectionStateProperty_Status_STATUS_Pending      = PrivateLinkServiceConnectionStateProperty_Status_STATUS("Pending")
	PrivateLinkServiceConnectionStateProperty_Status_STATUS_Rejected     = PrivateLinkServiceConnectionStateProperty_Status_STATUS("Rejected")
)

// Mapping from string to PrivateLinkServiceConnectionStateProperty_Status_STATUS
var privateLinkServiceConnectionStateProperty_Status_STATUS_Values = map[string]PrivateLinkServiceConnectionStateProperty_Status_STATUS{
	"approved":     PrivateLinkServiceConnectionStateProperty_Status_STATUS_Approved,
	"disconnected": PrivateLinkServiceConnectionStateProperty_Status_STATUS_Disconnected,
	"pending":      PrivateLinkServiceConnectionStateProperty_Status_STATUS_Pending,
	"rejected":     PrivateLinkServiceConnectionStateProperty_Status_STATUS_Rejected,
}

func init() {
	SchemeBuilder.Register(&Server{}, &ServerList{})
}
