types

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package types provides core data types used throughout the refresh CLI tool. It defines domain models with proper Go idioms and clean separation of concerns.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMIStatus

type AMIStatus int

AMIStatus represents the status of a nodegroup's AMI relative to the latest available.

const (
	// AMILatest indicates the nodegroup is using the latest AMI.
	AMILatest AMIStatus = iota
	// AMIOutdated indicates the nodegroup is using an older AMI.
	AMIOutdated
	// AMIUpdating indicates the nodegroup is currently being updated.
	AMIUpdating
	// AMIUnknown indicates the AMI status could not be determined.
	AMIUnknown
)

func (AMIStatus) NeedsUpdate added in v0.4.1

func (s AMIStatus) NeedsUpdate() bool

NeedsUpdate returns true if the nodegroup should be updated.

func (AMIStatus) PlainString added in v0.4.1

func (s AMIStatus) PlainString() string

PlainString returns a plain string representation without color codes.

func (AMIStatus) String

func (s AMIStatus) String() string

String returns a human-readable, color-coded string representation of the AMI status.

type BatchUpdateResult added in v0.4.1

type BatchUpdateResult struct {
	Results  []UpdateResult
	Started  int
	Finished int
	// contains filtered or unexported fields
}

BatchUpdateResult aggregates results from multiple update operations.

func NewBatchUpdateResult added in v0.4.1

func NewBatchUpdateResult() *BatchUpdateResult

NewBatchUpdateResult creates a new BatchUpdateResult.

func (*BatchUpdateResult) AddResult added in v0.4.1

func (br *BatchUpdateResult) AddResult(result UpdateResult)

AddResult adds an update result in a thread-safe manner.

func (*BatchUpdateResult) GetSummary added in v0.4.1

func (br *BatchUpdateResult) GetSummary() (total, success, failed int)

GetSummary returns a summary of the batch update results.

func (*BatchUpdateResult) IncrementStarted added in v0.4.1

func (br *BatchUpdateResult) IncrementStarted()

IncrementStarted increments the started counter in a thread-safe manner.

type DryRunAction

type DryRunAction int

DryRunAction represents the action that would be taken in dry run mode.

const (
	// ActionUpdate indicates the nodegroup will be updated.
	ActionUpdate DryRunAction = iota
	// ActionSkipUpdating indicates the nodegroup is already updating.
	ActionSkipUpdating
	// ActionSkipLatest indicates the nodegroup is already at the latest AMI.
	ActionSkipLatest
	// ActionForceUpdate indicates the nodegroup will be force-updated.
	ActionForceUpdate
)

func (DryRunAction) PlainString added in v0.4.1

func (a DryRunAction) PlainString() string

PlainString returns a plain string representation without color codes.

func (DryRunAction) Reason added in v0.4.1

func (a DryRunAction) Reason() string

Reason returns a human-readable reason for the action.

func (DryRunAction) String

func (a DryRunAction) String() string

String returns a human-readable, color-coded string representation of the action.

type MonitorConfig

type MonitorConfig struct {
	PollInterval    time.Duration
	MaxRetries      int
	BackoffMultiple float64
	Quiet           bool
	NoWait          bool
	Timeout         time.Duration
}

MonitorConfig contains configuration for the update monitoring process.

func DefaultMonitorConfig added in v0.4.1

func DefaultMonitorConfig() MonitorConfig

DefaultMonitorConfig returns a MonitorConfig with sensible defaults.

type NodegroupInfo

type NodegroupInfo struct {
	Name         string
	Status       string
	InstanceType string
	Desired      int32
	CurrentAmi   string
	AmiStatus    AMIStatus
}

NodegroupInfo contains essential information about an EKS nodegroup.

type ProgressMonitor

type ProgressMonitor struct {
	Updates     []UpdateProgress
	StartTime   time.Time
	Quiet       bool
	NoWait      bool
	Timeout     time.Duration
	LastPrinted int
	// contains filtered or unexported fields
}

ProgressMonitor manages the monitoring of multiple concurrent nodegroup updates. It is thread-safe through the use of sync.RWMutex.

func NewProgressMonitor added in v0.4.1

func NewProgressMonitor(quiet, noWait bool, timeout time.Duration) *ProgressMonitor

NewProgressMonitor creates a new progress monitor with the specified configuration.

func (*ProgressMonitor) AddUpdate added in v0.4.1

func (pm *ProgressMonitor) AddUpdate(update UpdateProgress)

AddUpdate adds a new update to be monitored in a thread-safe manner.

func (*ProgressMonitor) AllComplete added in v0.4.1

func (pm *ProgressMonitor) AllComplete() bool

AllComplete returns true if all updates have finished.

func (*ProgressMonitor) FailureCount added in v0.4.1

func (pm *ProgressMonitor) FailureCount() int

FailureCount returns the number of failed updates.

func (*ProgressMonitor) GetUpdates added in v0.4.1

func (pm *ProgressMonitor) GetUpdates() []UpdateProgress

GetUpdates returns a copy of all updates being monitored.

func (*ProgressMonitor) SuccessCount added in v0.4.1

func (pm *ProgressMonitor) SuccessCount() int

SuccessCount returns the number of successful updates.

func (*ProgressMonitor) UpdateStatus added in v0.4.1

func (pm *ProgressMonitor) UpdateStatus(nodegroupName string, status types.UpdateStatus, errorMsg string)

UpdateStatus updates the status of a specific nodegroup update.

type UpdateProgress

type UpdateProgress struct {
	NodegroupName string
	UpdateID      string
	ClusterName   string
	Status        types.UpdateStatus
	StartTime     time.Time
	LastChecked   time.Time
	ErrorMessage  string
}

UpdateProgress tracks the progress of a nodegroup update operation.

func (UpdateProgress) Duration added in v0.4.1

func (u UpdateProgress) Duration() time.Duration

Duration returns the time elapsed since the update started.

func (UpdateProgress) IsComplete added in v0.4.1

func (u UpdateProgress) IsComplete() bool

IsComplete returns true if the update has finished (success, failure, or cancelled).

func (UpdateProgress) IsSuccessful added in v0.4.1

func (u UpdateProgress) IsSuccessful() bool

IsSuccessful returns true if the update completed successfully.

type UpdateResult added in v0.4.1

type UpdateResult struct {
	NodegroupName string
	Success       bool
	UpdateID      string
	Error         error
	Duration      time.Duration
}

UpdateResult represents the result of an update operation.

type VersionInfo

type VersionInfo struct {
	Version   string `json:"version"`
	Commit    string `json:"commit,omitempty"`
	BuildDate string `json:"build_date,omitempty"`
}

VersionInfo contains version information for the CLI tool.

func (VersionInfo) String added in v0.4.1

func (v VersionInfo) String() string

String returns a formatted version string.

Jump to

Keyboard shortcuts

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