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

import "github.com/Azure/azure-service-operator/v2/pkg/genruntime"

type FleetsUpdateRun_Spec struct {
	Name string `json:"name,omitempty"`

	// Properties: The resource-specific properties for this resource.
	Properties *UpdateRunProperties `json:"properties,omitempty"`
}

var _ genruntime.ARMResourceSpec = &FleetsUpdateRun_Spec{}

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

// GetName returns the Name of the resource
func (updateRun *FleetsUpdateRun_Spec) GetName() string {
	return updateRun.Name
}

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

// The properties of the UpdateRun.
type UpdateRunProperties struct {
	// ManagedClusterUpdate: The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be
	// modified until the run is started.
	ManagedClusterUpdate *ManagedClusterUpdate `json:"managedClusterUpdate,omitempty"`

	// Strategy: The strategy defines the order in which the clusters will be updated.
	// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single
	// UpdateGroup targeting all members.
	// The strategy of the UpdateRun can be modified until the run is started.
	Strategy *UpdateRunStrategy `json:"strategy,omitempty"`

	// UpdateStrategyId: The resource id of the FleetUpdateStrategy resource to reference.
	// When creating a new run, there are three ways to define a strategy for the run:
	// 1. Define a new strategy in place: Set the "strategy" field.
	// 2. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview)
	// 3. Use the default strategy to update all the members one by one: Leave both "updateStrategyId" and "strategy" unset.
	// (since 2023-08-15-preview)
	// Setting both "updateStrategyId" and "strategy" is invalid.
	// UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of creation and store it in
	// the "strategy" field.
	// Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate.
	// UpdateRunStrategy changes can be made directly on the "strategy" field before launching the UpdateRun.
	UpdateStrategyId *string `json:"updateStrategyId,omitempty"`
}

// The update to be applied to the ManagedClusters.
type ManagedClusterUpdate struct {
	// NodeImageSelection: The node image upgrade to be applied to the target nodes in update run.
	NodeImageSelection *NodeImageSelection `json:"nodeImageSelection,omitempty"`

	// Upgrade: The upgrade to apply to the ManagedClusters.
	Upgrade *ManagedClusterUpgradeSpec `json:"upgrade,omitempty"`
}

// Defines the update sequence of the clusters via stages and groups.
// Stages within a run are executed sequentially one
// after another.
// Groups within a stage are executed in parallel.
// Member clusters within a group are updated sequentially
// one after another.
// A valid strategy contains no duplicate groups within or across stages.
type UpdateRunStrategy struct {
	// Stages: The list of stages that compose this update run. Min size: 1.
	Stages []UpdateStage `json:"stages"`
}

// The upgrade to apply to a ManagedCluster.
type ManagedClusterUpgradeSpec struct {
	// KubernetesVersion: The Kubernetes version to upgrade the member clusters to.
	KubernetesVersion *string `json:"kubernetesVersion,omitempty"`

	// Type: ManagedClusterUpgradeType is the type of upgrade to be applied.
	Type *ManagedClusterUpgradeType `json:"type,omitempty"`
}

// The node image upgrade to be applied to the target nodes in update run.
type NodeImageSelection struct {
	// Type: The node image upgrade type.
	Type *NodeImageSelectionType `json:"type,omitempty"`
}

// Defines a stage which contains the groups to update and the steps to take (e.g., wait for a time period) before starting
// the next stage.
type UpdateStage struct {
	// AfterStageWaitInSeconds: The time in seconds to wait at the end of this stage before starting the next one. Defaults to
	// 0 seconds if unspecified.
	AfterStageWaitInSeconds *int `json:"afterStageWaitInSeconds,omitempty"`

	// Groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1.
	Groups []UpdateGroup `json:"groups"`

	// Name: The name of the stage. Must be unique within the UpdateRun.
	Name *string `json:"name,omitempty"`
}

// The type of upgrade to perform when targeting ManagedClusters.
// +kubebuilder:validation:Enum={"ControlPlaneOnly","Full","NodeImageOnly"}
type ManagedClusterUpgradeType string

const (
	ManagedClusterUpgradeType_ControlPlaneOnly = ManagedClusterUpgradeType("ControlPlaneOnly")
	ManagedClusterUpgradeType_Full             = ManagedClusterUpgradeType("Full")
	ManagedClusterUpgradeType_NodeImageOnly    = ManagedClusterUpgradeType("NodeImageOnly")
)

// Mapping from string to ManagedClusterUpgradeType
var managedClusterUpgradeType_Values = map[string]ManagedClusterUpgradeType{
	"controlplaneonly": ManagedClusterUpgradeType_ControlPlaneOnly,
	"full":             ManagedClusterUpgradeType_Full,
	"nodeimageonly":    ManagedClusterUpgradeType_NodeImageOnly,
}

// The node image upgrade type.
// +kubebuilder:validation:Enum={"Consistent","Custom","Latest"}
type NodeImageSelectionType string

const (
	NodeImageSelectionType_Consistent = NodeImageSelectionType("Consistent")
	NodeImageSelectionType_Custom     = NodeImageSelectionType("Custom")
	NodeImageSelectionType_Latest     = NodeImageSelectionType("Latest")
)

// Mapping from string to NodeImageSelectionType
var nodeImageSelectionType_Values = map[string]NodeImageSelectionType{
	"consistent": NodeImageSelectionType_Consistent,
	"custom":     NodeImageSelectionType_Custom,
	"latest":     NodeImageSelectionType_Latest,
}

// A group to be updated.
type UpdateGroup struct {
	// Name: Name of the group.
	// It must match a group name of an existing fleet member.
	Name *string `json:"name,omitempty"`
}
