maintenance

package
v0.0.0-...-416b70d Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MaintenanceConfig

type MaintenanceConfig struct {
	Windows           []MaintenanceWindow `json:"notifications"`
	AutoRemoveStarted bool                `json:"autoRemoveStarted"`
}

MaintenanceConfig represents the complete maintenance configuration.

type MaintenanceWindow

type MaintenanceWindow struct {
	ID          string    `json:"id"`
	Title       string    `json:"title"`
	Message     string    `json:"message"`
	Start       time.Time `json:"start"`
	End         time.Time `json:"-"` // Omit from JSON output
	Dismissible bool      `json:"dismissible"`
	Created     time.Time `json:"created"`
}

MaintenanceWindow represents a scheduled maintenance period.

func (*MaintenanceWindow) Duration

func (w *MaintenanceWindow) Duration() time.Duration

Duration returns the duration of the maintenance window.

func (*MaintenanceWindow) IsActive

func (w *MaintenanceWindow) IsActive() bool

IsActive checks if the maintenance window is currently active.

func (*MaintenanceWindow) IsExpired

func (w *MaintenanceWindow) IsExpired() bool

IsExpired checks if the maintenance window has ended.

func (*MaintenanceWindow) IsUpcoming

func (w *MaintenanceWindow) IsUpcoming() bool

IsUpcoming checks if the maintenance window is scheduled in the future.

func (*MaintenanceWindow) TimeUntilEnd

func (w *MaintenanceWindow) TimeUntilEnd() time.Duration

TimeUntilEnd returns the duration until the maintenance ends.

func (*MaintenanceWindow) TimeUntilStart

func (w *MaintenanceWindow) TimeUntilStart() time.Duration

TimeUntilStart returns the duration until the maintenance starts.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles maintenance window operations.

func NewManager

func NewManager() *Manager

NewManager creates a new maintenance manager.

func (*Manager) AddMaintenanceWindow

func (m *Manager) AddMaintenanceWindow(window MaintenanceWindow) error

AddMaintenanceWindow adds a new maintenance window.

func (*Manager) CleanupExpired

func (m *Manager) CleanupExpired() int

CleanupExpired removes all expired maintenance windows.

func (*Manager) ClearMaintenanceWindows

func (m *Manager) ClearMaintenanceWindows()

ClearMaintenanceWindows removes all maintenance windows.

func (*Manager) GetActiveMaintenanceCount

func (m *Manager) GetActiveMaintenanceCount() int

GetActiveMaintenanceCount returns the number of active maintenance windows.

func (*Manager) GetAutoRemoveStarted

func (m *Manager) GetAutoRemoveStarted() bool

GetAutoRemoveStarted returns the auto-remove started notifications setting.

func (*Manager) GetMaintenanceCount

func (m *Manager) GetMaintenanceCount() int

GetMaintenanceCount returns the total number of maintenance windows.

func (*Manager) GetMaintenanceWindow

func (m *Manager) GetMaintenanceWindow(id string) (*MaintenanceWindow, error)

GetMaintenanceWindow retrieves a maintenance window by ID.

func (*Manager) IsInMaintenanceMode

func (m *Manager) IsInMaintenanceMode() bool

IsInMaintenanceMode checks if the system is currently in maintenance mode.

func (*Manager) ListActiveWindows

func (m *Manager) ListActiveWindows() []MaintenanceWindow

ListActiveWindows returns currently active maintenance windows.

func (*Manager) ListMaintenanceWindows

func (m *Manager) ListMaintenanceWindows() []MaintenanceWindow

ListMaintenanceWindows returns all maintenance windows.

func (*Manager) ListUpcomingWindows

func (m *Manager) ListUpcomingWindows() []MaintenanceWindow

ListUpcomingWindows returns upcoming maintenance windows.

func (*Manager) LoadFromJSON

func (m *Manager) LoadFromJSON(data []byte) error

LoadFromJSON loads maintenance config from JSON data.

func (*Manager) RemoveMaintenanceWindow

func (m *Manager) RemoveMaintenanceWindow(id string) error

RemoveMaintenanceWindow removes a maintenance window by ID.

func (*Manager) SetAutoRemoveStarted

func (m *Manager) SetAutoRemoveStarted(autoRemove bool)

SetAutoRemoveStarted sets the auto-remove started notifications flag.

func (*Manager) ToJSON

func (m *Manager) ToJSON() ([]byte, error)

ToJSON serializes maintenance config to JSON.

func (*Manager) UpdateMaintenanceWindow

func (m *Manager) UpdateMaintenanceWindow(id string, updatedWindow MaintenanceWindow) error

UpdateMaintenanceWindow updates an existing maintenance window.

Jump to

Keyboard shortcuts

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