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

import (
	"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=networkwatchersflowlogs,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=network.azure.com,resources={networkwatchersflowlogs/status,networkwatchersflowlogs/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 v1api20241001.NetworkWatchersFlowLog
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2024-10-01/networkWatcher.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}
type NetworkWatchersFlowLog struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              NetworkWatchersFlowLog_Spec   `json:"spec,omitempty"`
	Status            NetworkWatchersFlowLog_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &NetworkWatchersFlowLog{}

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

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

var _ configmaps.Exporter = &NetworkWatchersFlowLog{}

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

var _ secrets.Exporter = &NetworkWatchersFlowLog{}

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

var _ genruntime.KubernetesResource = &NetworkWatchersFlowLog{}

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

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

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

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

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

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

// NewEmptyStatus returns a new empty (blank) status
func (flowLog *NetworkWatchersFlowLog) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &NetworkWatchersFlowLog_STATUS{}
}

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

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

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

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

	flowLog.Status = st
	return nil
}

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

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

// +kubebuilder:object:root=true
// Storage version of v1api20241001.NetworkWatchersFlowLog
// Generator information:
// - Generated from: /network/resource-manager/Microsoft.Network/stable/2024-10-01/networkWatcher.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}
type NetworkWatchersFlowLogList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []NetworkWatchersFlowLog `json:"items"`
}

// Storage version of v1api20241001.NetworkWatchersFlowLog_Spec
type NetworkWatchersFlowLog_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"`
	Enabled                    *bool                               `json:"enabled,omitempty"`
	EnabledFilteringCriteria   *string                             `json:"enabledFilteringCriteria,omitempty"`
	FlowAnalyticsConfiguration *TrafficAnalyticsProperties         `json:"flowAnalyticsConfiguration,omitempty"`
	Format                     *FlowLogFormatParameters            `json:"format,omitempty"`
	Identity                   *ManagedServiceIdentity             `json:"identity,omitempty"`
	Location                   *string                             `json:"location,omitempty"`
	OperatorSpec               *NetworkWatchersFlowLogOperatorSpec `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 network.azure.com/NetworkWatcher resource
	Owner           *genruntime.KnownResourceReference `group:"network.azure.com" json:"owner,omitempty" kind:"NetworkWatcher"`
	PropertyBag     genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	RetentionPolicy *RetentionPolicyParameters         `json:"retentionPolicy,omitempty"`

	// +kubebuilder:validation:Required
	// StorageReference: ID of the storage account which is used to store the flow log.
	StorageReference *genruntime.ResourceReference `armReference:"StorageId" json:"storageReference,omitempty"`
	Tags             map[string]string             `json:"tags,omitempty"`

	// +kubebuilder:validation:Required
	// TargetResourceReference: ID of network security group to which flow log will be applied.
	TargetResourceReference *genruntime.ResourceReference `armReference:"TargetResourceId" json:"targetResourceReference,omitempty"`
}

var _ genruntime.ConvertibleSpec = &NetworkWatchersFlowLog_Spec{}

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

	return source.ConvertSpecTo(flowLog)
}

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

	return destination.ConvertSpecFrom(flowLog)
}

// Storage version of v1api20241001.NetworkWatchersFlowLog_STATUS
type NetworkWatchersFlowLog_STATUS struct {
	Conditions                 []conditions.Condition             `json:"conditions,omitempty"`
	Enabled                    *bool                              `json:"enabled,omitempty"`
	EnabledFilteringCriteria   *string                            `json:"enabledFilteringCriteria,omitempty"`
	Etag                       *string                            `json:"etag,omitempty"`
	FlowAnalyticsConfiguration *TrafficAnalyticsProperties_STATUS `json:"flowAnalyticsConfiguration,omitempty"`
	Format                     *FlowLogFormatParameters_STATUS    `json:"format,omitempty"`
	Id                         *string                            `json:"id,omitempty"`
	Identity                   *ManagedServiceIdentity_STATUS     `json:"identity,omitempty"`
	Location                   *string                            `json:"location,omitempty"`
	Name                       *string                            `json:"name,omitempty"`
	PropertyBag                genruntime.PropertyBag             `json:"$propertyBag,omitempty"`
	ProvisioningState          *string                            `json:"provisioningState,omitempty"`
	RetentionPolicy            *RetentionPolicyParameters_STATUS  `json:"retentionPolicy,omitempty"`
	StorageId                  *string                            `json:"storageId,omitempty"`
	Tags                       map[string]string                  `json:"tags,omitempty"`
	TargetResourceGuid         *string                            `json:"targetResourceGuid,omitempty"`
	TargetResourceId           *string                            `json:"targetResourceId,omitempty"`
	Type                       *string                            `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &NetworkWatchersFlowLog_STATUS{}

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

	return source.ConvertStatusTo(flowLog)
}

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

	return destination.ConvertStatusFrom(flowLog)
}

// Storage version of v1api20241001.FlowLogFormatParameters
// Parameters that define the flow log format.
type FlowLogFormatParameters struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Type        *string                `json:"type,omitempty"`
	Version     *int                   `json:"version,omitempty"`
}

// Storage version of v1api20241001.FlowLogFormatParameters_STATUS
// Parameters that define the flow log format.
type FlowLogFormatParameters_STATUS struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Type        *string                `json:"type,omitempty"`
	Version     *int                   `json:"version,omitempty"`
}

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

// Storage version of v1api20241001.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"`
}

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

// Storage version of v1api20241001.RetentionPolicyParameters
// Parameters that define the retention policy for flow log.
type RetentionPolicyParameters struct {
	Days        *int                   `json:"days,omitempty"`
	Enabled     *bool                  `json:"enabled,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20241001.RetentionPolicyParameters_STATUS
// Parameters that define the retention policy for flow log.
type RetentionPolicyParameters_STATUS struct {
	Days        *int                   `json:"days,omitempty"`
	Enabled     *bool                  `json:"enabled,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20241001.TrafficAnalyticsProperties
// Parameters that define the configuration of traffic analytics.
type TrafficAnalyticsProperties struct {
	NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties `json:"networkWatcherFlowAnalyticsConfiguration,omitempty"`
	PropertyBag                              genruntime.PropertyBag                   `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20241001.TrafficAnalyticsProperties_STATUS
// Parameters that define the configuration of traffic analytics.
type TrafficAnalyticsProperties_STATUS struct {
	NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties_STATUS `json:"networkWatcherFlowAnalyticsConfiguration,omitempty"`
	PropertyBag                              genruntime.PropertyBag                          `json:"$propertyBag,omitempty"`
}

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

// Storage version of v1api20241001.TrafficAnalyticsConfigurationProperties
// Parameters that define the configuration of traffic analytics.
type TrafficAnalyticsConfigurationProperties struct {
	Enabled                  *bool                  `json:"enabled,omitempty"`
	PropertyBag              genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	TrafficAnalyticsInterval *int                   `json:"trafficAnalyticsInterval,omitempty"`
	WorkspaceRegion          *string                `json:"workspaceRegion,omitempty"`

	// WorkspaceResourceReference: Resource Id of the attached workspace.
	WorkspaceResourceReference *genruntime.ResourceReference `armReference:"WorkspaceResourceId" json:"workspaceResourceReference,omitempty"`
}

// Storage version of v1api20241001.TrafficAnalyticsConfigurationProperties_STATUS
// Parameters that define the configuration of traffic analytics.
type TrafficAnalyticsConfigurationProperties_STATUS struct {
	Enabled                  *bool                  `json:"enabled,omitempty"`
	PropertyBag              genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	TrafficAnalyticsInterval *int                   `json:"trafficAnalyticsInterval,omitempty"`
	WorkspaceId              *string                `json:"workspaceId,omitempty"`
	WorkspaceRegion          *string                `json:"workspaceRegion,omitempty"`
	WorkspaceResourceId      *string                `json:"workspaceResourceId,omitempty"`
}

// Storage version of v1api20241001.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"`
}

func init() {
	SchemeBuilder.Register(&NetworkWatchersFlowLog{}, &NetworkWatchersFlowLogList{})
}
