operations

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractRuleID added in v1.3.1

func ExtractRuleID(info json.RawMessage) *uuid.UUID

ExtractRuleID peeks at the "rule_id" field in a serialized operation info JSON blob. Returns nil if absent, empty, or unparseable.

Types

type BringUpTaskInfo

type BringUpTaskInfo struct {
	RuleID string `json:"rule_id,omitempty"`
	OpCode string `json:"op_code,omitempty"`
}

func (*BringUpTaskInfo) CodeString

func (t *BringUpTaskInfo) CodeString() string

func (*BringUpTaskInfo) Description

func (t *BringUpTaskInfo) Description() string

func (*BringUpTaskInfo) Marshal

func (t *BringUpTaskInfo) Marshal() (json.RawMessage, error)

func (*BringUpTaskInfo) Type

func (*BringUpTaskInfo) Unmarshal

func (t *BringUpTaskInfo) Unmarshal(
	data json.RawMessage,
) error

func (*BringUpTaskInfo) Validate

func (t *BringUpTaskInfo) Validate() error

type FirmwareControlTaskInfo

type FirmwareControlTaskInfo struct {
	Operation     FirmwareOperation `json:"operation"`
	TargetVersion string            `json:"target_version,omitempty"`
	StartTime     int64             `json:"start_time,omitempty"` // Unix timestamp
	EndTime       int64             `json:"end_time,omitempty"`   // Unix timestamp
	RuleID        string            `json:"rule_id,omitempty"`
}

func (*FirmwareControlTaskInfo) CodeString

func (t *FirmwareControlTaskInfo) CodeString() string

func (*FirmwareControlTaskInfo) Description

func (t *FirmwareControlTaskInfo) Description() string

func (*FirmwareControlTaskInfo) Marshal

func (t *FirmwareControlTaskInfo) Marshal() (json.RawMessage, error)

func (*FirmwareControlTaskInfo) Type

func (*FirmwareControlTaskInfo) Unmarshal

func (t *FirmwareControlTaskInfo) Unmarshal(data json.RawMessage) error

func (*FirmwareControlTaskInfo) Validate

func (t *FirmwareControlTaskInfo) Validate() error

type FirmwareOperation

type FirmwareOperation int
const (
	FirmwareOperationUnknown FirmwareOperation = iota
	FirmwareOperationUpgrade
	FirmwareOperationDowngrade
	FirmwareOperationRollback
	FirmwareOperationVersion
)

func (FirmwareOperation) CodeString

func (o FirmwareOperation) CodeString() string

CodeString returns the operation code string for a FirmwareOperation

func (FirmwareOperation) String

func (o FirmwareOperation) String() string

type FirmwareUpdateState

type FirmwareUpdateState int

FirmwareUpdateState represents the state of a firmware update operation.

const (
	FirmwareUpdateStateUnknown   FirmwareUpdateState = 0
	FirmwareUpdateStateQueued    FirmwareUpdateState = 1
	FirmwareUpdateStateVerifying FirmwareUpdateState = 2
	FirmwareUpdateStateCompleted FirmwareUpdateState = 3
	FirmwareUpdateStateFailed    FirmwareUpdateState = 4
)

func (FirmwareUpdateState) IsTerminal

func (s FirmwareUpdateState) IsTerminal() bool

IsTerminal returns true if this state is a terminal state (completed or failed).

func (FirmwareUpdateState) String

func (s FirmwareUpdateState) String() string

type FirmwareUpdateStatus

type FirmwareUpdateStatus struct {
	ComponentID string
	State       FirmwareUpdateState
	Error       string
}

FirmwareUpdateStatus contains the status of a firmware update operation.

type InjectExpectationTaskInfo

type InjectExpectationTaskInfo struct {
	Info json.RawMessage `json:"info"`
}

func (*InjectExpectationTaskInfo) CodeString

func (t *InjectExpectationTaskInfo) CodeString() string

func (*InjectExpectationTaskInfo) Description

func (t *InjectExpectationTaskInfo) Description() string

func (*InjectExpectationTaskInfo) Marshal

func (*InjectExpectationTaskInfo) Type

func (*InjectExpectationTaskInfo) Unmarshal

func (t *InjectExpectationTaskInfo) Unmarshal(data json.RawMessage) error

func (*InjectExpectationTaskInfo) Validate

func (t *InjectExpectationTaskInfo) Validate() error

type MachineBringUpState

type MachineBringUpState int

MachineBringUpState represents the bring-up state of a machine in relation to the power-on gate.

const (
	MachineBringUpStateNotDiscovered MachineBringUpState = iota
	MachineBringUpStateWaitingForIngestion
	MachineBringUpStateMachineNotCreated
	MachineBringUpStateMachineCreated
)

func (MachineBringUpState) IsBroughtUp

func (s MachineBringUpState) IsBroughtUp() bool

IsBroughtUp returns true if the machine has passed the gate and been ingested.

func (MachineBringUpState) String

func (s MachineBringUpState) String() string

type Operation

type Operation interface {
	Validate() error
	Marshal() (json.RawMessage, error)
	Unmarshal(data json.RawMessage) error
	Type() taskcommon.TaskType
	Description() string
	CodeString() string // Returns operation code string (e.g., "power_on", "upgrade")
}

func New

type OperationOptions

type OperationOptions struct {
	Timeout time.Duration
}

func GetOperationOptions

func GetOperationOptions(typ taskcommon.TaskType) OperationOptions

type PowerControlTaskInfo

type PowerControlTaskInfo struct {
	Operation PowerOperation `json:"operation"`
	Forced    bool           `json:"forced"`
	RuleID    string         `json:"rule_id,omitempty"`
}

func (*PowerControlTaskInfo) CodeString

func (t *PowerControlTaskInfo) CodeString() string

func (*PowerControlTaskInfo) Description

func (t *PowerControlTaskInfo) Description() string

func (*PowerControlTaskInfo) Marshal

func (t *PowerControlTaskInfo) Marshal() (json.RawMessage, error)

func (*PowerControlTaskInfo) Type

func (*PowerControlTaskInfo) Unmarshal

func (t *PowerControlTaskInfo) Unmarshal(data json.RawMessage) error

func (*PowerControlTaskInfo) Validate

func (t *PowerControlTaskInfo) Validate() error

type PowerOperation

type PowerOperation int
const (
	PowerOperationUnknown PowerOperation = iota
	// Power On
	PowerOperationPowerOn
	PowerOperationForcePowerOn
	// Power Off
	PowerOperationPowerOff
	PowerOperationForcePowerOff
	// Restart (OS level)
	PowerOperationRestart
	PowerOperationForceRestart
	// Reset (hardware level)
	PowerOperationWarmReset
	PowerOperationColdReset
)

func PowerOperationFromString

func PowerOperationFromString(code string) PowerOperation

PowerOperationFromString returns the PowerOperation for a given operation code string (e.g. "power_on", "force_power_off"). Returns PowerOperationUnknown if the code is not recognized.

func (PowerOperation) CodeString

func (o PowerOperation) CodeString() string

CodeString returns the operation code string for a PowerOperation

func (PowerOperation) String

func (o PowerOperation) String() string

type PowerStatus

type PowerStatus string
const (
	PowerStatusUnknown   PowerStatus = "Unknown"
	PowerStatusOn        PowerStatus = "On"
	PowerStatusOff       PowerStatus = "Off"
	PowerStatusRebooting PowerStatus = "Rebooting"
)

type SetFirmwareUpdateTimeWindowRequest

type SetFirmwareUpdateTimeWindowRequest struct {
	ComponentIDs []string
	StartTime    time.Time
	EndTime      time.Time
}

SetFirmwareUpdateTimeWindowRequest is the request for setting firmware update time window. ComponentIDs are external IDs that identify the components.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL