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

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

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,network}
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Generator information:
// - Generated from: /dnsresolver/resource-manager/Microsoft.Network/DnsResolver/stable/2022-07-01/dnsresolver.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}
type DnsResolversInboundEndpoint struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              DnsResolversInboundEndpoint_Spec   `json:"spec,omitempty"`
	Status            DnsResolversInboundEndpoint_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &DnsResolversInboundEndpoint{}

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

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

var _ conversion.Convertible = &DnsResolversInboundEndpoint{}

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

	return endpoint.AssignProperties_From_DnsResolversInboundEndpoint(source)
}

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

	return endpoint.AssignProperties_To_DnsResolversInboundEndpoint(destination)
}

var _ configmaps.Exporter = &DnsResolversInboundEndpoint{}

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

var _ secrets.Exporter = &DnsResolversInboundEndpoint{}

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

var _ genruntime.ImportableResource = &DnsResolversInboundEndpoint{}

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

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

var _ genruntime.KubernetesResource = &DnsResolversInboundEndpoint{}

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

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

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

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

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

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

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

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

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

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

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

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

	endpoint.Status = st
	return nil
}

// AssignProperties_From_DnsResolversInboundEndpoint populates our DnsResolversInboundEndpoint from the provided source DnsResolversInboundEndpoint
func (endpoint *DnsResolversInboundEndpoint) AssignProperties_From_DnsResolversInboundEndpoint(source *storage.DnsResolversInboundEndpoint) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_DnsResolversInboundEndpoint populates the provided destination DnsResolversInboundEndpoint from our DnsResolversInboundEndpoint
func (endpoint *DnsResolversInboundEndpoint) AssignProperties_To_DnsResolversInboundEndpoint(destination *storage.DnsResolversInboundEndpoint) error {

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

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

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

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /dnsresolver/resource-manager/Microsoft.Network/DnsResolver/stable/2022-07-01/dnsresolver.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers/{dnsResolverName}/inboundEndpoints/{inboundEndpointName}
type DnsResolversInboundEndpointList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []DnsResolversInboundEndpoint `json:"items"`
}

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

	// +kubebuilder:validation:Required
	// IpConfigurations: IP configurations for the inbound endpoint.
	IpConfigurations []IpConfiguration `json:"ipConfigurations,omitempty"`

	// +kubebuilder:validation:Required
	// Location: The geo-location where the resource lives
	Location *string `json:"location,omitempty"`

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

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

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

var _ genruntime.ARMTransformer = &DnsResolversInboundEndpoint_Spec{}

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

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

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

	// Set property "Properties":
	if endpoint.IpConfigurations != nil {
		result.Properties = &arm.InboundEndpointProperties{}
	}
	for _, item := range endpoint.IpConfigurations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.IpConfigurations = append(result.Properties.IpConfigurations, *item_ARM.(*arm.IpConfiguration))
	}

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

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

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

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

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

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

	// no assignment for property "OperatorSpec"

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

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

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &DnsResolversInboundEndpoint_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.DnsResolversInboundEndpoint_Spec{}
	err := endpoint.AssignProperties_To_DnsResolversInboundEndpoint_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_DnsResolversInboundEndpoint_Spec populates our DnsResolversInboundEndpoint_Spec from the provided source DnsResolversInboundEndpoint_Spec
func (endpoint *DnsResolversInboundEndpoint_Spec) AssignProperties_From_DnsResolversInboundEndpoint_Spec(source *storage.DnsResolversInboundEndpoint_Spec) error {

	// AzureName
	endpoint.AzureName = source.AzureName

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

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

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

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

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

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = endpoint.AzureName

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

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

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

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

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

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

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

	// No error
	return nil
}

// Initialize_From_DnsResolversInboundEndpoint_STATUS populates our DnsResolversInboundEndpoint_Spec from the provided source DnsResolversInboundEndpoint_STATUS
func (endpoint *DnsResolversInboundEndpoint_Spec) Initialize_From_DnsResolversInboundEndpoint_STATUS(source *DnsResolversInboundEndpoint_STATUS) error {

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

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

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

	// No error
	return nil
}

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

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

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

	// Etag: ETag of the inbound endpoint.
	Etag *string `json:"etag,omitempty"`

	// Id: Fully qualified resource ID for the resource. Ex -
	// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	Id *string `json:"id,omitempty"`

	// IpConfigurations: IP configurations for the inbound endpoint.
	IpConfigurations []IpConfiguration_STATUS `json:"ipConfigurations,omitempty"`

	// Location: The geo-location where the resource lives
	Location *string `json:"location,omitempty"`

	// Name: The name of the resource
	Name *string `json:"name,omitempty"`

	// ProvisioningState: The current provisioning state of the inbound endpoint. This is a read-only property and any attempt
	// to set this value will be ignored.
	ProvisioningState *DnsresolverProvisioningState_STATUS `json:"provisioningState,omitempty"`

	// ResourceGuid: The resourceGuid property of the inbound endpoint resource.
	ResourceGuid *string `json:"resourceGuid,omitempty"`

	// SystemData: Metadata pertaining to creation and last modification of the resource.
	SystemData *SystemData_STATUS `json:"systemData,omitempty"`

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

	// Type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &DnsResolversInboundEndpoint_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.DnsResolversInboundEndpoint_STATUS{}
	err := endpoint.AssignProperties_To_DnsResolversInboundEndpoint_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 = &DnsResolversInboundEndpoint_STATUS{}

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

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

	// no assignment for property "Conditions"

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

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

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

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

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

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

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

	// Set property "SystemData":
	if typedInput.SystemData != nil {
		var systemData1 SystemData_STATUS
		err := systemData1.PopulateFromARM(owner, *typedInput.SystemData)
		if err != nil {
			return err
		}
		systemData := systemData1
		endpoint.SystemData = &systemData
	}

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

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

	// No error
	return nil
}

// AssignProperties_From_DnsResolversInboundEndpoint_STATUS populates our DnsResolversInboundEndpoint_STATUS from the provided source DnsResolversInboundEndpoint_STATUS
func (endpoint *DnsResolversInboundEndpoint_STATUS) AssignProperties_From_DnsResolversInboundEndpoint_STATUS(source *storage.DnsResolversInboundEndpoint_STATUS) error {

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

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

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

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

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

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

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

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

	// SystemData
	if source.SystemData != nil {
		var systemDatum SystemData_STATUS
		err := systemDatum.AssignProperties_From_SystemData_STATUS(source.SystemData)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SystemData_STATUS() to populate field SystemData")
		}
		endpoint.SystemData = &systemDatum
	} else {
		endpoint.SystemData = nil
	}

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

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

	// No error
	return nil
}

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

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

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

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

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

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

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

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

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

	// SystemData
	if endpoint.SystemData != nil {
		var systemDatum storage.SystemData_STATUS
		err := endpoint.SystemData.AssignProperties_To_SystemData_STATUS(&systemDatum)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SystemData_STATUS() to populate field SystemData")
		}
		destination.SystemData = &systemDatum
	} else {
		destination.SystemData = nil
	}

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

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

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

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

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

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

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

	// No error
	return nil
}

// IP configuration.
type IpConfiguration struct {
	// PrivateIpAddress: Private IP address of the IP configuration.
	PrivateIpAddress *string `json:"privateIpAddress,omitempty"`

	// PrivateIpAllocationMethod: Private IP address allocation method.
	PrivateIpAllocationMethod *IpConfiguration_PrivateIpAllocationMethod `json:"privateIpAllocationMethod,omitempty"`

	// +kubebuilder:validation:Required
	// Subnet: The reference to the subnet bound to the IP configuration.
	Subnet *SubResource `json:"subnet,omitempty"`
}

var _ genruntime.ARMTransformer = &IpConfiguration{}

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

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

	// Set property "PrivateIpAllocationMethod":
	if configuration.PrivateIpAllocationMethod != nil {
		var temp string
		temp = string(*configuration.PrivateIpAllocationMethod)
		privateIpAllocationMethod := arm.IpConfiguration_PrivateIpAllocationMethod(temp)
		result.PrivateIpAllocationMethod = &privateIpAllocationMethod
	}

	// Set property "Subnet":
	if configuration.Subnet != nil {
		subnet_ARM, err := configuration.Subnet.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		subnet := *subnet_ARM.(*arm.SubResource)
		result.Subnet = &subnet
	}
	return result, nil
}

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

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

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

	// Set property "PrivateIpAllocationMethod":
	if typedInput.PrivateIpAllocationMethod != nil {
		var temp string
		temp = string(*typedInput.PrivateIpAllocationMethod)
		privateIpAllocationMethod := IpConfiguration_PrivateIpAllocationMethod(temp)
		configuration.PrivateIpAllocationMethod = &privateIpAllocationMethod
	}

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

	// No error
	return nil
}

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

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

	// PrivateIpAllocationMethod
	if source.PrivateIpAllocationMethod != nil {
		privateIpAllocationMethod := *source.PrivateIpAllocationMethod
		privateIpAllocationMethodTemp := genruntime.ToEnum(privateIpAllocationMethod, ipConfiguration_PrivateIpAllocationMethod_Values)
		configuration.PrivateIpAllocationMethod = &privateIpAllocationMethodTemp
	} else {
		configuration.PrivateIpAllocationMethod = nil
	}

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

// Initialize_From_IpConfiguration_STATUS populates our IpConfiguration from the provided source IpConfiguration_STATUS
func (configuration *IpConfiguration) Initialize_From_IpConfiguration_STATUS(source *IpConfiguration_STATUS) error {

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

	// PrivateIpAllocationMethod
	if source.PrivateIpAllocationMethod != nil {
		privateIpAllocationMethod := genruntime.ToEnum(string(*source.PrivateIpAllocationMethod), ipConfiguration_PrivateIpAllocationMethod_Values)
		configuration.PrivateIpAllocationMethod = &privateIpAllocationMethod
	} else {
		configuration.PrivateIpAllocationMethod = nil
	}

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

	// No error
	return nil
}

// IP configuration.
type IpConfiguration_STATUS struct {
	// PrivateIpAddress: Private IP address of the IP configuration.
	PrivateIpAddress *string `json:"privateIpAddress,omitempty"`

	// PrivateIpAllocationMethod: Private IP address allocation method.
	PrivateIpAllocationMethod *IpConfiguration_PrivateIpAllocationMethod_STATUS `json:"privateIpAllocationMethod,omitempty"`

	// Subnet: The reference to the subnet bound to the IP configuration.
	Subnet *SubResource_STATUS `json:"subnet,omitempty"`
}

var _ genruntime.FromARMConverter = &IpConfiguration_STATUS{}

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

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

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

	// Set property "PrivateIpAllocationMethod":
	if typedInput.PrivateIpAllocationMethod != nil {
		var temp string
		temp = string(*typedInput.PrivateIpAllocationMethod)
		privateIpAllocationMethod := IpConfiguration_PrivateIpAllocationMethod_STATUS(temp)
		configuration.PrivateIpAllocationMethod = &privateIpAllocationMethod
	}

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

	// No error
	return nil
}

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

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

	// PrivateIpAllocationMethod
	if source.PrivateIpAllocationMethod != nil {
		privateIpAllocationMethod := *source.PrivateIpAllocationMethod
		privateIpAllocationMethodTemp := genruntime.ToEnum(privateIpAllocationMethod, ipConfiguration_PrivateIpAllocationMethod_STATUS_Values)
		configuration.PrivateIpAllocationMethod = &privateIpAllocationMethodTemp
	} else {
		configuration.PrivateIpAllocationMethod = nil
	}

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

	// No error
	return nil
}

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

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

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

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

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"Dynamic","Static"}
type IpConfiguration_PrivateIpAllocationMethod string

const (
	IpConfiguration_PrivateIpAllocationMethod_Dynamic = IpConfiguration_PrivateIpAllocationMethod("Dynamic")
	IpConfiguration_PrivateIpAllocationMethod_Static  = IpConfiguration_PrivateIpAllocationMethod("Static")
)

// Mapping from string to IpConfiguration_PrivateIpAllocationMethod
var ipConfiguration_PrivateIpAllocationMethod_Values = map[string]IpConfiguration_PrivateIpAllocationMethod{
	"dynamic": IpConfiguration_PrivateIpAllocationMethod_Dynamic,
	"static":  IpConfiguration_PrivateIpAllocationMethod_Static,
}

type IpConfiguration_PrivateIpAllocationMethod_STATUS string

const (
	IpConfiguration_PrivateIpAllocationMethod_STATUS_Dynamic = IpConfiguration_PrivateIpAllocationMethod_STATUS("Dynamic")
	IpConfiguration_PrivateIpAllocationMethod_STATUS_Static  = IpConfiguration_PrivateIpAllocationMethod_STATUS("Static")
)

// Mapping from string to IpConfiguration_PrivateIpAllocationMethod_STATUS
var ipConfiguration_PrivateIpAllocationMethod_STATUS_Values = map[string]IpConfiguration_PrivateIpAllocationMethod_STATUS{
	"dynamic": IpConfiguration_PrivateIpAllocationMethod_STATUS_Dynamic,
	"static":  IpConfiguration_PrivateIpAllocationMethod_STATUS_Static,
}

func init() {
	SchemeBuilder.Register(&DnsResolversInboundEndpoint{}, &DnsResolversInboundEndpointList{})
}
