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

import (
	storage "github.com/Azure/azure-service-operator/v2/api/network/v1api20241001/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"
)

// +kubebuilder:rbac:groups=network.azure.com,resources=firewallpolicies,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=network.azure.com,resources={firewallpolicies/status,firewallpolicies/finalizers},verbs=get;update;patch

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,network}
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +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"
// Storage version of v1api20240301.FirewallPolicy
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2024-03-01/firewallPolicy.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}
type FirewallPolicy struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              FirewallPolicy_Spec   `json:"spec,omitempty"`
	Status            FirewallPolicy_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &FirewallPolicy{}

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

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

var _ configmaps.Exporter = &FirewallPolicy{}

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

var _ secrets.Exporter = &FirewallPolicy{}

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

var _ genruntime.KubernetesResource = &FirewallPolicy{}

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

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

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

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

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

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

// NewEmptyStatus returns a new empty (blank) status
func (policy *FirewallPolicy) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &FirewallPolicy_STATUS{}
}

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

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

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

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

	policy.Status = st
	return nil
}

// Hub marks that this FirewallPolicy is the hub type for conversion
func (policy *FirewallPolicy) Hub() {}

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

// +kubebuilder:object:root=true
// Storage version of v1api20240301.FirewallPolicy
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2024-03-01/firewallPolicy.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}
type FirewallPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []FirewallPolicy `json:"items"`
}

// Storage version of v1api20240301.FirewallPolicy_Spec
type FirewallPolicy_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"`
	BasePolicy         *SubResource                      `json:"basePolicy,omitempty"`
	DnsSettings        *DnsSettings                      `json:"dnsSettings,omitempty"`
	ExplicitProxy      *ExplicitProxy                    `json:"explicitProxy,omitempty"`
	Identity           *ManagedServiceIdentity           `json:"identity,omitempty"`
	Insights           *FirewallPolicyInsights           `json:"insights,omitempty"`
	IntrusionDetection *FirewallPolicyIntrusionDetection `json:"intrusionDetection,omitempty"`
	Location           *string                           `json:"location,omitempty"`
	OperatorSpec       *FirewallPolicyOperatorSpec       `json:"operatorSpec,omitempty"`
	OriginalVersion    string                            `json:"originalVersion,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"`
	PropertyBag          genruntime.PropertyBag              `json:"$propertyBag,omitempty"`
	Sku                  *FirewallPolicySku                  `json:"sku,omitempty"`
	Snat                 *FirewallPolicySNAT                 `json:"snat,omitempty"`
	Sql                  *FirewallPolicySQL                  `json:"sql,omitempty"`
	Tags                 map[string]string                   `json:"tags,omitempty"`
	ThreatIntelMode      *string                             `json:"threatIntelMode,omitempty"`
	ThreatIntelWhitelist *FirewallPolicyThreatIntelWhitelist `json:"threatIntelWhitelist,omitempty"`
	TransportSecurity    *FirewallPolicyTransportSecurity    `json:"transportSecurity,omitempty"`
}

var _ genruntime.ConvertibleSpec = &FirewallPolicy_Spec{}

// ConvertSpecFrom populates our FirewallPolicy_Spec from the provided source
func (policy *FirewallPolicy_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	if source == policy {
		return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec")
	}

	return source.ConvertSpecTo(policy)
}

// ConvertSpecTo populates the provided destination from our FirewallPolicy_Spec
func (policy *FirewallPolicy_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	if destination == policy {
		return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec")
	}

	return destination.ConvertSpecFrom(policy)
}

// Storage version of v1api20240301.FirewallPolicy_STATUS
// FirewallPolicy Resource.
type FirewallPolicy_STATUS struct {
	BasePolicy           *SubResource_STATUS                        `json:"basePolicy,omitempty"`
	ChildPolicies        []SubResource_STATUS                       `json:"childPolicies,omitempty"`
	Conditions           []conditions.Condition                     `json:"conditions,omitempty"`
	DnsSettings          *DnsSettings_STATUS                        `json:"dnsSettings,omitempty"`
	Etag                 *string                                    `json:"etag,omitempty"`
	ExplicitProxy        *ExplicitProxy_STATUS                      `json:"explicitProxy,omitempty"`
	Firewalls            []SubResource_STATUS                       `json:"firewalls,omitempty"`
	Id                   *string                                    `json:"id,omitempty"`
	Identity             *ManagedServiceIdentity_STATUS             `json:"identity,omitempty"`
	Insights             *FirewallPolicyInsights_STATUS             `json:"insights,omitempty"`
	IntrusionDetection   *FirewallPolicyIntrusionDetection_STATUS   `json:"intrusionDetection,omitempty"`
	Location             *string                                    `json:"location,omitempty"`
	Name                 *string                                    `json:"name,omitempty"`
	PropertyBag          genruntime.PropertyBag                     `json:"$propertyBag,omitempty"`
	ProvisioningState    *string                                    `json:"provisioningState,omitempty"`
	RuleCollectionGroups []SubResource_STATUS                       `json:"ruleCollectionGroups,omitempty"`
	Size                 *string                                    `json:"size,omitempty"`
	Sku                  *FirewallPolicySku_STATUS                  `json:"sku,omitempty"`
	Snat                 *FirewallPolicySNAT_STATUS                 `json:"snat,omitempty"`
	Sql                  *FirewallPolicySQL_STATUS                  `json:"sql,omitempty"`
	Tags                 map[string]string                          `json:"tags,omitempty"`
	ThreatIntelMode      *string                                    `json:"threatIntelMode,omitempty"`
	ThreatIntelWhitelist *FirewallPolicyThreatIntelWhitelist_STATUS `json:"threatIntelWhitelist,omitempty"`
	TransportSecurity    *FirewallPolicyTransportSecurity_STATUS    `json:"transportSecurity,omitempty"`
	Type                 *string                                    `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &FirewallPolicy_STATUS{}

// ConvertStatusFrom populates our FirewallPolicy_STATUS from the provided source
func (policy *FirewallPolicy_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	if source == policy {
		return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus")
	}

	return source.ConvertStatusTo(policy)
}

// ConvertStatusTo populates the provided destination from our FirewallPolicy_STATUS
func (policy *FirewallPolicy_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	if destination == policy {
		return eris.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus")
	}

	return destination.ConvertStatusFrom(policy)
}

// Storage version of v1api20240301.DnsSettings
// DNS Proxy Settings in Firewall Policy.
type DnsSettings struct {
	EnableProxy                 *bool                  `json:"enableProxy,omitempty"`
	PropertyBag                 genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RequireProxyForNetworkRules *bool                  `json:"requireProxyForNetworkRules,omitempty"`
	Servers                     []string               `json:"servers,omitempty"`
}

// Storage version of v1api20240301.DnsSettings_STATUS
// DNS Proxy Settings in Firewall Policy.
type DnsSettings_STATUS struct {
	EnableProxy                 *bool                  `json:"enableProxy,omitempty"`
	PropertyBag                 genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	RequireProxyForNetworkRules *bool                  `json:"requireProxyForNetworkRules,omitempty"`
	Servers                     []string               `json:"servers,omitempty"`
}

// Storage version of v1api20240301.ExplicitProxy
// Explicit Proxy Settings in Firewall Policy.
type ExplicitProxy struct {
	EnableExplicitProxy *bool                  `json:"enableExplicitProxy,omitempty"`
	EnablePacFile       *bool                  `json:"enablePacFile,omitempty"`
	HttpPort            *int                   `json:"httpPort,omitempty"`
	HttpsPort           *int                   `json:"httpsPort,omitempty"`
	PacFile             *string                `json:"pacFile,omitempty"`
	PacFilePort         *int                   `json:"pacFilePort,omitempty"`
	PropertyBag         genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.ExplicitProxy_STATUS
// Explicit Proxy Settings in Firewall Policy.
type ExplicitProxy_STATUS struct {
	EnableExplicitProxy *bool                  `json:"enableExplicitProxy,omitempty"`
	EnablePacFile       *bool                  `json:"enablePacFile,omitempty"`
	HttpPort            *int                   `json:"httpPort,omitempty"`
	HttpsPort           *int                   `json:"httpsPort,omitempty"`
	PacFile             *string                `json:"pacFile,omitempty"`
	PacFilePort         *int                   `json:"pacFilePort,omitempty"`
	PropertyBag         genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyInsights
// Firewall Policy Insights.
type FirewallPolicyInsights struct {
	IsEnabled             *bool                                `json:"isEnabled,omitempty"`
	LogAnalyticsResources *FirewallPolicyLogAnalyticsResources `json:"logAnalyticsResources,omitempty"`
	PropertyBag           genruntime.PropertyBag               `json:"$propertyBag,omitempty"`
	RetentionDays         *int                                 `json:"retentionDays,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyInsights_STATUS
// Firewall Policy Insights.
type FirewallPolicyInsights_STATUS struct {
	IsEnabled             *bool                                       `json:"isEnabled,omitempty"`
	LogAnalyticsResources *FirewallPolicyLogAnalyticsResources_STATUS `json:"logAnalyticsResources,omitempty"`
	PropertyBag           genruntime.PropertyBag                      `json:"$propertyBag,omitempty"`
	RetentionDays         *int                                        `json:"retentionDays,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyIntrusionDetection
// Configuration for intrusion detection mode and rules.
type FirewallPolicyIntrusionDetection struct {
	Configuration *FirewallPolicyIntrusionDetectionConfiguration `json:"configuration,omitempty"`
	Mode          *string                                        `json:"mode,omitempty"`
	Profile       *string                                        `json:"profile,omitempty"`
	PropertyBag   genruntime.PropertyBag                         `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyIntrusionDetection_STATUS
// Configuration for intrusion detection mode and rules.
type FirewallPolicyIntrusionDetection_STATUS struct {
	Configuration *FirewallPolicyIntrusionDetectionConfiguration_STATUS `json:"configuration,omitempty"`
	Mode          *string                                               `json:"mode,omitempty"`
	Profile       *string                                               `json:"profile,omitempty"`
	PropertyBag   genruntime.PropertyBag                                `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyOperatorSpec
// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type FirewallPolicyOperatorSpec struct {
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`
	PropertyBag          genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	SecretExpressions    []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicySku
// SKU of Firewall policy.
type FirewallPolicySku struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Tier        *string                `json:"tier,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicySku_STATUS
// SKU of Firewall policy.
type FirewallPolicySku_STATUS struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Tier        *string                `json:"tier,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicySNAT
// The private IP addresses/IP ranges to which traffic will not be SNAT.
type FirewallPolicySNAT struct {
	AutoLearnPrivateRanges *string                `json:"autoLearnPrivateRanges,omitempty"`
	PrivateRanges          []string               `json:"privateRanges,omitempty"`
	PropertyBag            genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicySNAT_STATUS
// The private IP addresses/IP ranges to which traffic will not be SNAT.
type FirewallPolicySNAT_STATUS struct {
	AutoLearnPrivateRanges *string                `json:"autoLearnPrivateRanges,omitempty"`
	PrivateRanges          []string               `json:"privateRanges,omitempty"`
	PropertyBag            genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicySQL
// SQL Settings in Firewall Policy.
type FirewallPolicySQL struct {
	AllowSqlRedirect *bool                  `json:"allowSqlRedirect,omitempty"`
	PropertyBag      genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicySQL_STATUS
// SQL Settings in Firewall Policy.
type FirewallPolicySQL_STATUS struct {
	AllowSqlRedirect *bool                  `json:"allowSqlRedirect,omitempty"`
	PropertyBag      genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyThreatIntelWhitelist
// ThreatIntel Whitelist for Firewall Policy.
type FirewallPolicyThreatIntelWhitelist struct {
	Fqdns       []string               `json:"fqdns,omitempty"`
	IpAddresses []string               `json:"ipAddresses,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyThreatIntelWhitelist_STATUS
// ThreatIntel Whitelist for Firewall Policy.
type FirewallPolicyThreatIntelWhitelist_STATUS struct {
	Fqdns       []string               `json:"fqdns,omitempty"`
	IpAddresses []string               `json:"ipAddresses,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyTransportSecurity
// Configuration needed to perform TLS termination & initiation.
type FirewallPolicyTransportSecurity struct {
	CertificateAuthority *FirewallPolicyCertificateAuthority `json:"certificateAuthority,omitempty"`
	PropertyBag          genruntime.PropertyBag              `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyTransportSecurity_STATUS
// Configuration needed to perform TLS termination & initiation.
type FirewallPolicyTransportSecurity_STATUS struct {
	CertificateAuthority *FirewallPolicyCertificateAuthority_STATUS `json:"certificateAuthority,omitempty"`
	PropertyBag          genruntime.PropertyBag                     `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.ManagedServiceIdentity
// Identity for the resource.
type ManagedServiceIdentity struct {
	PropertyBag            genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	Type                   *string                       `json:"type,omitempty"`
	UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"`
}

// AssignProperties_From_ManagedServiceIdentity populates our ManagedServiceIdentity from the provided source ManagedServiceIdentity
func (identity *ManagedServiceIdentity) AssignProperties_From_ManagedServiceIdentity(source *storage.ManagedServiceIdentity) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

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

	// Invoke the augmentConversionForManagedServiceIdentity interface (if implemented) to customize the conversion
	var identityAsAny any = identity
	if augmentedIdentity, ok := identityAsAny.(augmentConversionForManagedServiceIdentity); ok {
		err := augmentedIdentity.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_ManagedServiceIdentity populates the provided destination ManagedServiceIdentity from our ManagedServiceIdentity
func (identity *ManagedServiceIdentity) AssignProperties_To_ManagedServiceIdentity(destination *storage.ManagedServiceIdentity) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(identity.PropertyBag)

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

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

	// Invoke the augmentConversionForManagedServiceIdentity interface (if implemented) to customize the conversion
	var identityAsAny any = identity
	if augmentedIdentity, ok := identityAsAny.(augmentConversionForManagedServiceIdentity); ok {
		err := augmentedIdentity.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20240301.ManagedServiceIdentity_STATUS
// Identity for the resource.
type ManagedServiceIdentity_STATUS struct {
	PrincipalId            *string                                                         `json:"principalId,omitempty"`
	PropertyBag            genruntime.PropertyBag                                          `json:"$propertyBag,omitempty"`
	TenantId               *string                                                         `json:"tenantId,omitempty"`
	Type                   *string                                                         `json:"type,omitempty"`
	UserAssignedIdentities map[string]ManagedServiceIdentity_UserAssignedIdentities_STATUS `json:"userAssignedIdentities,omitempty"`
}

// AssignProperties_From_ManagedServiceIdentity_STATUS populates our ManagedServiceIdentity_STATUS from the provided source ManagedServiceIdentity_STATUS
func (identity *ManagedServiceIdentity_STATUS) AssignProperties_From_ManagedServiceIdentity_STATUS(source *storage.ManagedServiceIdentity_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

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

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

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

	// Invoke the augmentConversionForManagedServiceIdentity_STATUS interface (if implemented) to customize the conversion
	var identityAsAny any = identity
	if augmentedIdentity, ok := identityAsAny.(augmentConversionForManagedServiceIdentity_STATUS); ok {
		err := augmentedIdentity.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_ManagedServiceIdentity_STATUS populates the provided destination ManagedServiceIdentity_STATUS from our ManagedServiceIdentity_STATUS
func (identity *ManagedServiceIdentity_STATUS) AssignProperties_To_ManagedServiceIdentity_STATUS(destination *storage.ManagedServiceIdentity_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(identity.PropertyBag)

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

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

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

	// UserAssignedIdentities
	if identity.UserAssignedIdentities != nil {
		userAssignedIdentityMap := make(map[string]storage.ManagedServiceIdentity_UserAssignedIdentities_STATUS, len(identity.UserAssignedIdentities))
		for userAssignedIdentityKey, userAssignedIdentityValue := range identity.UserAssignedIdentities {
			var userAssignedIdentity storage.ManagedServiceIdentity_UserAssignedIdentities_STATUS
			err := userAssignedIdentityValue.AssignProperties_To_ManagedServiceIdentity_UserAssignedIdentities_STATUS(&userAssignedIdentity)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ManagedServiceIdentity_UserAssignedIdentities_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
	}

	// Invoke the augmentConversionForManagedServiceIdentity_STATUS interface (if implemented) to customize the conversion
	var identityAsAny any = identity
	if augmentedIdentity, ok := identityAsAny.(augmentConversionForManagedServiceIdentity_STATUS); ok {
		err := augmentedIdentity.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForManagedServiceIdentity interface {
	AssignPropertiesFrom(src *storage.ManagedServiceIdentity) error
	AssignPropertiesTo(dst *storage.ManagedServiceIdentity) error
}

type augmentConversionForManagedServiceIdentity_STATUS interface {
	AssignPropertiesFrom(src *storage.ManagedServiceIdentity_STATUS) error
	AssignPropertiesTo(dst *storage.ManagedServiceIdentity_STATUS) error
}

// Storage version of v1api20240301.FirewallPolicyCertificateAuthority
// Trusted Root certificates properties for tls.
type FirewallPolicyCertificateAuthority struct {
	KeyVaultSecretId *string                `json:"keyVaultSecretId,omitempty"`
	Name             *string                `json:"name,omitempty"`
	PropertyBag      genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyCertificateAuthority_STATUS
// Trusted Root certificates properties for tls.
type FirewallPolicyCertificateAuthority_STATUS struct {
	KeyVaultSecretId *string                `json:"keyVaultSecretId,omitempty"`
	Name             *string                `json:"name,omitempty"`
	PropertyBag      genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyIntrusionDetectionConfiguration
// The operation for configuring intrusion detection.
type FirewallPolicyIntrusionDetectionConfiguration struct {
	BypassTrafficSettings []FirewallPolicyIntrusionDetectionBypassTrafficSpecifications `json:"bypassTrafficSettings,omitempty"`
	PrivateRanges         []string                                                      `json:"privateRanges,omitempty"`
	PropertyBag           genruntime.PropertyBag                                        `json:"$propertyBag,omitempty"`
	SignatureOverrides    []FirewallPolicyIntrusionDetectionSignatureSpecification      `json:"signatureOverrides,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyIntrusionDetectionConfiguration_STATUS
// The operation for configuring intrusion detection.
type FirewallPolicyIntrusionDetectionConfiguration_STATUS struct {
	BypassTrafficSettings []FirewallPolicyIntrusionDetectionBypassTrafficSpecifications_STATUS `json:"bypassTrafficSettings,omitempty"`
	PrivateRanges         []string                                                             `json:"privateRanges,omitempty"`
	PropertyBag           genruntime.PropertyBag                                               `json:"$propertyBag,omitempty"`
	SignatureOverrides    []FirewallPolicyIntrusionDetectionSignatureSpecification_STATUS      `json:"signatureOverrides,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyLogAnalyticsResources
// Log Analytics Resources for Firewall Policy Insights.
type FirewallPolicyLogAnalyticsResources struct {
	DefaultWorkspaceId *SubResource                          `json:"defaultWorkspaceId,omitempty"`
	PropertyBag        genruntime.PropertyBag                `json:"$propertyBag,omitempty"`
	Workspaces         []FirewallPolicyLogAnalyticsWorkspace `json:"workspaces,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyLogAnalyticsResources_STATUS
// Log Analytics Resources for Firewall Policy Insights.
type FirewallPolicyLogAnalyticsResources_STATUS struct {
	DefaultWorkspaceId *SubResource_STATUS                          `json:"defaultWorkspaceId,omitempty"`
	PropertyBag        genruntime.PropertyBag                       `json:"$propertyBag,omitempty"`
	Workspaces         []FirewallPolicyLogAnalyticsWorkspace_STATUS `json:"workspaces,omitempty"`
}

// Storage version of v1api20240301.ManagedServiceIdentity_UserAssignedIdentities_STATUS
type ManagedServiceIdentity_UserAssignedIdentities_STATUS struct {
	ClientId    *string                `json:"clientId,omitempty"`
	PrincipalId *string                `json:"principalId,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// AssignProperties_From_ManagedServiceIdentity_UserAssignedIdentities_STATUS populates our ManagedServiceIdentity_UserAssignedIdentities_STATUS from the provided source ManagedServiceIdentity_UserAssignedIdentities_STATUS
func (identities *ManagedServiceIdentity_UserAssignedIdentities_STATUS) AssignProperties_From_ManagedServiceIdentity_UserAssignedIdentities_STATUS(source *storage.ManagedServiceIdentity_UserAssignedIdentities_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

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

	// Invoke the augmentConversionForManagedServiceIdentity_UserAssignedIdentities_STATUS interface (if implemented) to customize the conversion
	var identitiesAsAny any = identities
	if augmentedIdentities, ok := identitiesAsAny.(augmentConversionForManagedServiceIdentity_UserAssignedIdentities_STATUS); ok {
		err := augmentedIdentities.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// No error
	return nil
}

// AssignProperties_To_ManagedServiceIdentity_UserAssignedIdentities_STATUS populates the provided destination ManagedServiceIdentity_UserAssignedIdentities_STATUS from our ManagedServiceIdentity_UserAssignedIdentities_STATUS
func (identities *ManagedServiceIdentity_UserAssignedIdentities_STATUS) AssignProperties_To_ManagedServiceIdentity_UserAssignedIdentities_STATUS(destination *storage.ManagedServiceIdentity_UserAssignedIdentities_STATUS) error {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(identities.PropertyBag)

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

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

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

	// Invoke the augmentConversionForManagedServiceIdentity_UserAssignedIdentities_STATUS interface (if implemented) to customize the conversion
	var identitiesAsAny any = identities
	if augmentedIdentities, ok := identitiesAsAny.(augmentConversionForManagedServiceIdentity_UserAssignedIdentities_STATUS); ok {
		err := augmentedIdentities.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

// Storage version of v1api20240301.UserAssignedIdentityDetails
// Information about the user assigned identity for the resource
type UserAssignedIdentityDetails struct {
	PropertyBag genruntime.PropertyBag       `json:"$propertyBag,omitempty"`
	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 {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(source.PropertyBag)

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

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

	// Invoke the augmentConversionForUserAssignedIdentityDetails interface (if implemented) to customize the conversion
	var detailsAsAny any = details
	if augmentedDetails, ok := detailsAsAny.(augmentConversionForUserAssignedIdentityDetails); ok {
		err := augmentedDetails.AssignPropertiesFrom(source)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesFrom() for conversion")
		}
	}

	// 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 {
	// Clone the existing property bag
	propertyBag := genruntime.NewPropertyBag(details.PropertyBag)

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

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

	// Invoke the augmentConversionForUserAssignedIdentityDetails interface (if implemented) to customize the conversion
	var detailsAsAny any = details
	if augmentedDetails, ok := detailsAsAny.(augmentConversionForUserAssignedIdentityDetails); ok {
		err := augmentedDetails.AssignPropertiesTo(destination)
		if err != nil {
			return eris.Wrap(err, "calling augmented AssignPropertiesTo() for conversion")
		}
	}

	// No error
	return nil
}

type augmentConversionForManagedServiceIdentity_UserAssignedIdentities_STATUS interface {
	AssignPropertiesFrom(src *storage.ManagedServiceIdentity_UserAssignedIdentities_STATUS) error
	AssignPropertiesTo(dst *storage.ManagedServiceIdentity_UserAssignedIdentities_STATUS) error
}

type augmentConversionForUserAssignedIdentityDetails interface {
	AssignPropertiesFrom(src *storage.UserAssignedIdentityDetails) error
	AssignPropertiesTo(dst *storage.UserAssignedIdentityDetails) error
}

// Storage version of v1api20240301.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications
// Intrusion detection bypass traffic specification.
type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications struct {
	Description          *string                `json:"description,omitempty"`
	DestinationAddresses []string               `json:"destinationAddresses,omitempty"`
	DestinationIpGroups  []string               `json:"destinationIpGroups,omitempty"`
	DestinationPorts     []string               `json:"destinationPorts,omitempty"`
	Name                 *string                `json:"name,omitempty"`
	PropertyBag          genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Protocol             *string                `json:"protocol,omitempty"`
	SourceAddresses      []string               `json:"sourceAddresses,omitempty"`
	SourceIpGroups       []string               `json:"sourceIpGroups,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications_STATUS
// Intrusion detection bypass traffic specification.
type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications_STATUS struct {
	Description          *string                `json:"description,omitempty"`
	DestinationAddresses []string               `json:"destinationAddresses,omitempty"`
	DestinationIpGroups  []string               `json:"destinationIpGroups,omitempty"`
	DestinationPorts     []string               `json:"destinationPorts,omitempty"`
	Name                 *string                `json:"name,omitempty"`
	PropertyBag          genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Protocol             *string                `json:"protocol,omitempty"`
	SourceAddresses      []string               `json:"sourceAddresses,omitempty"`
	SourceIpGroups       []string               `json:"sourceIpGroups,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyIntrusionDetectionSignatureSpecification
// Intrusion detection signatures specification states.
type FirewallPolicyIntrusionDetectionSignatureSpecification struct {
	Id          *string                `json:"id,omitempty"`
	Mode        *string                `json:"mode,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyIntrusionDetectionSignatureSpecification_STATUS
// Intrusion detection signatures specification states.
type FirewallPolicyIntrusionDetectionSignatureSpecification_STATUS struct {
	Id          *string                `json:"id,omitempty"`
	Mode        *string                `json:"mode,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyLogAnalyticsWorkspace
// Log Analytics Workspace for Firewall Policy Insights.
type FirewallPolicyLogAnalyticsWorkspace struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Region      *string                `json:"region,omitempty"`
	WorkspaceId *SubResource           `json:"workspaceId,omitempty"`
}

// Storage version of v1api20240301.FirewallPolicyLogAnalyticsWorkspace_STATUS
// Log Analytics Workspace for Firewall Policy Insights.
type FirewallPolicyLogAnalyticsWorkspace_STATUS struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Region      *string                `json:"region,omitempty"`
	WorkspaceId *SubResource_STATUS    `json:"workspaceId,omitempty"`
}

func init() {
	SchemeBuilder.Register(&FirewallPolicy{}, &FirewallPolicyList{})
}
