// 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"
	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
)

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

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,containerservice}
// +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 v1api20250301.Fleet
// Generator information:
// - Generated from: /containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/fleets.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}
type Fleet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Fleet_Spec   `json:"spec,omitempty"`
	Status            Fleet_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Fleet{}

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

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

var _ configmaps.Exporter = &Fleet{}

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

var _ secrets.Exporter = &Fleet{}

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

var _ genruntime.KubernetesResource = &Fleet{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.ContainerService/fleets"
func (fleet *Fleet) GetType() string {
	return "Microsoft.ContainerService/fleets"
}

// NewEmptyStatus returns a new empty (blank) status
func (fleet *Fleet) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Fleet_STATUS{}
}

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

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

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

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

	fleet.Status = st
	return nil
}

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

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

// +kubebuilder:object:root=true
// Storage version of v1api20250301.Fleet
// Generator information:
// - Generated from: /containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/fleets.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}
type FleetList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Fleet `json:"items"`
}

// Storage version of v1api20250301.APIVersion
// +kubebuilder:validation:Enum={"2025-03-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2025-03-01")

// Storage version of v1api20250301.Fleet_Spec
type Fleet_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"`
	HubProfile      *FleetHubProfile        `json:"hubProfile,omitempty"`
	Identity        *ManagedServiceIdentity `json:"identity,omitempty"`
	Location        *string                 `json:"location,omitempty"`
	OperatorSpec    *FleetOperatorSpec      `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"`
	Tags        map[string]string                  `json:"tags,omitempty"`
}

var _ genruntime.ConvertibleSpec = &Fleet_Spec{}

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

	return source.ConvertSpecTo(fleet)
}

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

	return destination.ConvertSpecFrom(fleet)
}

// Storage version of v1api20250301.Fleet_STATUS
// The Fleet resource.
type Fleet_STATUS struct {
	Conditions        []conditions.Condition         `json:"conditions,omitempty"`
	ETag              *string                        `json:"eTag,omitempty"`
	HubProfile        *FleetHubProfile_STATUS        `json:"hubProfile,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"`
	Status            *FleetStatus_STATUS            `json:"status,omitempty"`
	SystemData        *SystemData_STATUS             `json:"systemData,omitempty"`
	Tags              map[string]string              `json:"tags,omitempty"`
	Type              *string                        `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Fleet_STATUS{}

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

	return source.ConvertStatusTo(fleet)
}

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

	return destination.ConvertStatusFrom(fleet)
}

// Storage version of v1api20250301.FleetHubProfile
// The FleetHubProfile configures the fleet hub.
type FleetHubProfile struct {
	AgentProfile           *AgentProfile           `json:"agentProfile,omitempty"`
	ApiServerAccessProfile *APIServerAccessProfile `json:"apiServerAccessProfile,omitempty"`
	DnsPrefix              *string                 `json:"dnsPrefix,omitempty"`
	PropertyBag            genruntime.PropertyBag  `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20250301.FleetHubProfile_STATUS
// The FleetHubProfile configures the fleet hub.
type FleetHubProfile_STATUS struct {
	AgentProfile           *AgentProfile_STATUS           `json:"agentProfile,omitempty"`
	ApiServerAccessProfile *APIServerAccessProfile_STATUS `json:"apiServerAccessProfile,omitempty"`
	DnsPrefix              *string                        `json:"dnsPrefix,omitempty"`
	Fqdn                   *string                        `json:"fqdn,omitempty"`
	KubernetesVersion      *string                        `json:"kubernetesVersion,omitempty"`
	PortalFqdn             *string                        `json:"portalFqdn,omitempty"`
	PropertyBag            genruntime.PropertyBag         `json:"$propertyBag,omitempty"`
}

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

// Storage version of v1api20250301.FleetStatus_STATUS
// Status information for the fleet.
type FleetStatus_STATUS struct {
	LastOperationError *ErrorDetail_STATUS    `json:"lastOperationError,omitempty"`
	LastOperationId    *string                `json:"lastOperationId,omitempty"`
	PropertyBag        genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20250301.ManagedServiceIdentity
// Managed service identity (system assigned and/or user assigned identities)
type ManagedServiceIdentity struct {
	PropertyBag            genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	Type                   *string                       `json:"type,omitempty"`
	UserAssignedIdentities []UserAssignedIdentityDetails `json:"userAssignedIdentities,omitempty"`
}

// Storage version of v1api20250301.ManagedServiceIdentity_STATUS
// Managed service identity (system assigned and/or user assigned identities)
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]CommonUserAssignedIdentity_STATUS `json:"userAssignedIdentities,omitempty"`
}

// Storage version of v1api20250301.SystemData_STATUS
// Metadata pertaining to creation and last modification of the resource.
type SystemData_STATUS struct {
	CreatedAt          *string                `json:"createdAt,omitempty"`
	CreatedBy          *string                `json:"createdBy,omitempty"`
	CreatedByType      *string                `json:"createdByType,omitempty"`
	LastModifiedAt     *string                `json:"lastModifiedAt,omitempty"`
	LastModifiedBy     *string                `json:"lastModifiedBy,omitempty"`
	LastModifiedByType *string                `json:"lastModifiedByType,omitempty"`
	PropertyBag        genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20250301.AgentProfile
// Agent profile for the Fleet hub.
type AgentProfile struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`

	// SubnetReference: The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet
	// and subnet will be generated and used.
	SubnetReference *genruntime.ResourceReference `armReference:"SubnetId" json:"subnetReference,omitempty"`
	VmSize          *string                       `json:"vmSize,omitempty"`
}

// Storage version of v1api20250301.AgentProfile_STATUS
// Agent profile for the Fleet hub.
type AgentProfile_STATUS struct {
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	SubnetId    *string                `json:"subnetId,omitempty"`
	VmSize      *string                `json:"vmSize,omitempty"`
}

// Storage version of v1api20250301.APIServerAccessProfile
// Access profile for the Fleet hub API server.
type APIServerAccessProfile struct {
	EnablePrivateCluster  *bool                  `json:"enablePrivateCluster,omitempty"`
	EnableVnetIntegration *bool                  `json:"enableVnetIntegration,omitempty"`
	PropertyBag           genruntime.PropertyBag `json:"$propertyBag,omitempty"`

	// SubnetReference: The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new
	// Fleet with BYO vnet.
	SubnetReference *genruntime.ResourceReference `armReference:"SubnetId" json:"subnetReference,omitempty"`
}

// Storage version of v1api20250301.APIServerAccessProfile_STATUS
// Access profile for the Fleet hub API server.
type APIServerAccessProfile_STATUS struct {
	EnablePrivateCluster  *bool                  `json:"enablePrivateCluster,omitempty"`
	EnableVnetIntegration *bool                  `json:"enableVnetIntegration,omitempty"`
	PropertyBag           genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	SubnetId              *string                `json:"subnetId,omitempty"`
}

// Storage version of v1api20250301.CommonUserAssignedIdentity_STATUS
// User assigned identity properties
type CommonUserAssignedIdentity_STATUS struct {
	ClientId    *string                `json:"clientId,omitempty"`
	PrincipalId *string                `json:"principalId,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20250301.ErrorDetail_STATUS
// The error detail.
type ErrorDetail_STATUS struct {
	AdditionalInfo []ErrorAdditionalInfo_STATUS  `json:"additionalInfo,omitempty"`
	Code           *string                       `json:"code,omitempty"`
	Details        []ErrorDetail_STATUS_Unrolled `json:"details,omitempty"`
	Message        *string                       `json:"message,omitempty"`
	PropertyBag    genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	Target         *string                       `json:"target,omitempty"`
}

// Storage version of v1api20250301.FleetOperatorSecrets
type FleetOperatorSecrets struct {
	PropertyBag     genruntime.PropertyBag        `json:"$propertyBag,omitempty"`
	UserCredentials *genruntime.SecretDestination `json:"userCredentials,omitempty"`
}

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

// Storage version of v1api20250301.ErrorAdditionalInfo_STATUS
// The resource management error additional info.
type ErrorAdditionalInfo_STATUS struct {
	Info        map[string]v1.JSON     `json:"info,omitempty"`
	PropertyBag genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	Type        *string                `json:"type,omitempty"`
}

// Storage version of v1api20250301.ErrorDetail_STATUS_Unrolled
type ErrorDetail_STATUS_Unrolled struct {
	AdditionalInfo []ErrorAdditionalInfo_STATUS `json:"additionalInfo,omitempty"`
	Code           *string                      `json:"code,omitempty"`
	Message        *string                      `json:"message,omitempty"`
	PropertyBag    genruntime.PropertyBag       `json:"$propertyBag,omitempty"`
	Target         *string                      `json:"target,omitempty"`
}

func init() {
	SchemeBuilder.Register(&Fleet{}, &FleetList{})
}
