bios

package
v0.0.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("bios operation not implemented")

ErrNotImplemented is returned when a BIOS operation is not yet implemented.

Functions

func RegisterManager

func RegisterManager(vendor system.Vendor, factory func(*slog.Logger) Manager)

RegisterManager registers a vendor-specific manager factory. It is safe for concurrent use and is typically called from init().

Types

type BaseManager

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

BaseManager provides a generic BIOS Manager implementation backed by a static critical-settings map. Vendors only need to supply their vendor constant and their recommended settings; all Manager interface methods are handled here.

func NewBaseManager

func NewBaseManager(vendor system.Vendor, log *slog.Logger, settings map[string]string) *BaseManager

NewBaseManager creates a BaseManager for the given vendor and settings.

func (*BaseManager) Apply

func (m *BaseManager) Apply(_ context.Context, changes []SettingChange) ([]string, error)

Apply logs each change and returns all names as requiring reboot.

func (*BaseManager) Capture

func (m *BaseManager) Capture(_ context.Context) (*State, error)

Capture returns a State snapshot populated from the critical settings map.

func (*BaseManager) Reset

func (m *BaseManager) Reset(_ context.Context) error

Reset is not implemented for the generic base manager.

func (*BaseManager) Vendor

func (m *BaseManager) Vendor() system.Vendor

Vendor returns the server vendor this manager handles.

type Baseline

type Baseline struct {
	Vendor   system.Vendor     `json:"vendor"`
	Model    string            `json:"model,omitempty"`
	Settings map[string]string `json:"settings"`
}

Baseline is a golden BIOS configuration for comparison.

type Diff

type Diff struct {
	Matches bool        `json:"matches"`
	Changes []DiffEntry `json:"changes,omitempty"`
}

Diff holds the result of comparing a baseline to a live state.

func Compare

func Compare(baseline *Baseline, state *State) *Diff

Compare compares a baseline against a live BIOS state.

type DiffEntry

type DiffEntry struct {
	Name     string `json:"name"`
	Expected string `json:"expected"`
	Actual   string `json:"actual"`
}

DiffEntry is a single BIOS setting difference.

type Manager

type Manager interface {
	// Vendor returns the server vendor this manager handles.
	Vendor() system.Vendor

	// Capture reads all BIOS settings and returns a snapshot.
	Capture(ctx context.Context) (*State, error)

	// Apply sets BIOS attributes. Returns attributes requiring reboot.
	Apply(ctx context.Context, changes []SettingChange) (rebootRequired []string, err error)

	// Reset restores BIOS to factory defaults.
	Reset(ctx context.Context) error
}

Manager provides vendor-specific BIOS operations.

func NewManager

func NewManager(vendor system.Vendor, log *slog.Logger) (Manager, error)

NewManager returns a Manager for the given vendor, or an error if unsupported.

type Setting

type Setting struct {
	Name          string   `json:"name"`
	CurrentValue  string   `json:"currentValue"`
	DefaultValue  string   `json:"defaultValue,omitempty"`
	PendingValue  string   `json:"pendingValue,omitempty"`
	Type          string   `json:"type"`
	AllowedValues []string `json:"allowedValues,omitempty"`
	ReadOnly      bool     `json:"readOnly,omitempty"`
}

Setting represents a single BIOS attribute.

type SettingChange

type SettingChange struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

SettingChange requests a BIOS attribute modification.

type State

type State struct {
	Vendor   system.Vendor      `json:"vendor"`
	Model    string             `json:"model"`
	Version  string             `json:"biosVersion"`
	Settings map[string]Setting `json:"settings"`
	OEMData  map[string]string  `json:"oemData,omitempty"`
}

State represents the full BIOS configuration snapshot.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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