api

package
v0.0.0-...-a3d6d12 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package api is used for user facing API structs.

Index

Constants

View Source
const (
	// SystemNetworkInterfaceRoleManagement represents the "management" role.
	SystemNetworkInterfaceRoleManagement = "management"

	// SystemNetworkInterfaceRoleCluster represents the "cluster" role.
	SystemNetworkInterfaceRoleCluster = "cluster"

	// SystemNetworkInterfaceRoleInstances represents the "instances" role.
	SystemNetworkInterfaceRoleInstances = "instances"

	// SystemNetworkInterfaceRoleStorage represents the "storage" role.
	SystemNetworkInterfaceRoleStorage = "storage"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	State struct {
		Initialized  bool       `json:"initialized"             yaml:"initialized"`
		Version      string     `json:"version"                 yaml:"version"`
		LastRestored *time.Time `json:"last_restored,omitempty" yaml:"last_restored,omitempty"` // In system's timezone.
	} `json:"state" yaml:"state"`

	Config ApplicationConfig `json:"config" yaml:"config"`
}

Application represents the state and configuration of a generic application.

type ApplicationConfig

type ApplicationConfig struct{}

ApplicationConfig represents additional configuration for an application.

type DebugTUI

type DebugTUI struct {
	Level   slog.Level `json:"level"   yaml:"level"`
	Message string     `json:"message" yaml:"message"`
}

DebugTUI defines a struct to hold a message to log along with its severity.

type ServiceCeph

type ServiceCeph struct {
	State ServiceCephState `incusos:"-" json:"state" yaml:"state"`

	Config ServiceCephConfig `json:"config" yaml:"config"`
}

ServiceCeph represents the state and configuration of the Ceph service.

type ServiceCephCluster

type ServiceCephCluster struct {
	FSID         string                        `json:"fsid"          yaml:"fsid"`
	Monitors     []string                      `json:"monitors"      yaml:"monitors"`
	Keyrings     map[string]ServiceCephKeyring `json:"keyrings"      yaml:"keyrings"`
	ClientConfig map[string]string             `json:"client_config" yaml:"client_config"`
}

ServiceCephCluster represents a single Ceph cluster.

type ServiceCephConfig

type ServiceCephConfig struct {
	Enabled  bool                          `json:"enabled"  yaml:"enabled"`
	Clusters map[string]ServiceCephCluster `json:"clusters" yaml:"clusters"`
}

ServiceCephConfig represents additional configuration for the Ceph service.

type ServiceCephKeyring

type ServiceCephKeyring struct {
	Key string `json:"key" yaml:"key"`
}

ServiceCephKeyring represents a single Ceph keyring entry.

type ServiceCephState

type ServiceCephState struct{}

ServiceCephState represents state for the Ceph service.

type ServiceISCSI

type ServiceISCSI struct {
	State ServiceISCSIState `incusos:"-" json:"state" yaml:"state"`

	Config ServiceISCSIConfig `json:"config" yaml:"config"`
}

ServiceISCSI represents the state and configuration of the ISCSI service.

type ServiceISCSIConfig

type ServiceISCSIConfig struct {
	Enabled bool                 `json:"enabled" yaml:"enabled"`
	Targets []ServiceISCSITarget `json:"targets" yaml:"targets"`
}

ServiceISCSIConfig represents additional configuration for the ISCSI service.

type ServiceISCSIState

type ServiceISCSIState struct {
	InitiatorName string `json:"initiator_name" yaml:"initiator_name"`
}

ServiceISCSIState represents the state for the ISCSI service.

type ServiceISCSITarget

type ServiceISCSITarget struct {
	Target  string `json:"target"  yaml:"target"`
	Address string `json:"address" yaml:"address"`
	Port    int    `json:"port"    yaml:"port"`
}

ServiceISCSITarget represents a single ISCSI target.

type ServiceLVM

type ServiceLVM struct {
	State ServiceLVMState `incusos:"-" json:"state" yaml:"state"`

	Config ServiceLVMConfig `json:"config" yaml:"config"`
}

ServiceLVM represents the state and configuration of the LVM service.

type ServiceLVMConfig

type ServiceLVMConfig struct {
	Enabled  bool  `json:"enabled"   yaml:"enabled"`
	SystemID int64 `json:"system_id" yaml:"system_id"`
}

ServiceLVMConfig represents additional configuration for the LVM service.

type ServiceLVMLog

type ServiceLVMLog struct {
	LogSeqNum        int    `json:"log_seq_num"         yaml:"log_seq_num"`
	LogType          string `json:"log_type"            yaml:"log_type"`
	LogContext       string `json:"log_context"         yaml:"log_context"`
	LogObjectType    string `json:"log_object_type"     yaml:"log_object_type"`
	LogObjectName    string `json:"log_object_name"     yaml:"log_object_name"`
	LogObjectID      string `json:"log_object_id"       yaml:"log_object_id"`
	LogObjectGroup   string `json:"log_object_group"    yaml:"log_object_group"`
	LogObjectGroupID string `json:"log_object_group_id" yaml:"log_object_group_id"`
	LogMessage       string `json:"log_message"         yaml:"log_message"`
	LogErrno         int    `json:"log_errno"           yaml:"log_errno"`
	LogRetCode       int    `json:"log_ret_code"        yaml:"log_ret_code"`
}

ServiceLVMLog defines a LVM log entry.

type ServiceLVMPV

type ServiceLVMPV struct {
	PVName string `json:"pv_name" yaml:"pv_name"`
	VGName string `json:"vg_name" yaml:"vg_name"`
	PVFmt  string `json:"pv_fmt"  yaml:"pv_fmt"`
	PVAttr string `json:"pv_attr" yaml:"pv_attr"`
	PVSize string `json:"pv_size" yaml:"pv_size"`
	PVFree string `json:"pv_free" yaml:"pv_free"`
}

ServiceLVMPV defines information about a given physical volume.

type ServiceLVMState

type ServiceLVMState struct {
	PVs []ServiceLVMPV  `json:"pvs,omitempty" yaml:"pvs,omitempty"`
	VGs []ServiceLVMVG  `json:"vgs,omitempty" yaml:"vgs,omitempty"`
	Log []ServiceLVMLog `json:"log,omitempty" yaml:"log,omitempty"`
}

ServiceLVMState represents the state for the LVM service.

type ServiceLVMVG

type ServiceLVMVG struct {
	VGName    string `json:"vg_name"    yaml:"vg_name"`
	PVCount   int    `json:"pv_count"   yaml:"pv_count"`
	LVCount   int    `json:"lv_count"   yaml:"lv_count"`
	SnapCount int    `json:"snap_count" yaml:"snap_count"`
	VGAttr    string `json:"vg_attr"    yaml:"vg_attr"`
	VGSize    string `json:"vg_size"    yaml:"vg_size"`
	VGFree    string `json:"vg_free"    yaml:"vg_free"`
}

ServiceLVMVG defines information about a given volume group.

type ServiceLinstor

type ServiceLinstor struct {
	State ServiceLinstorState `incusos:"-" json:"state" yaml:"state"`

	Config ServiceLinstorConfig `json:"config" yaml:"config"`
}

ServiceLinstor represents the state and configuration of the Linstor service.

type ServiceLinstorConfig

type ServiceLinstorConfig struct {
	Enabled                bool     `json:"enabled"                  yaml:"enabled"`
	ListenAddress          string   `json:"listen_address"           yaml:"listen_address"`
	TLSServerCertificate   string   `json:"tls_server_certificate"   yaml:"tls_server_certificate"`
	TLSServerKey           string   `json:"tls_server_key"           yaml:"tls_server_key"`
	TLSTrustedCertificates []string `json:"tls_trusted_certificates" yaml:"tls_trusted_certificates"`
}

ServiceLinstorConfig represents the Linstor service configuration.

type ServiceLinstorState

type ServiceLinstorState struct{}

ServiceLinstorState represents state for the Linstor service.

type ServiceMultipath

type ServiceMultipath struct {
	State ServiceMultipathState `incusos:"-" json:"state" yaml:"state"`

	Config ServiceMultipathConfig `json:"config" yaml:"config"`
}

ServiceMultipath represents the state and configuration of the Multipath service.

type ServiceMultipathConfig

type ServiceMultipathConfig struct {
	Enabled bool     `json:"enabled" yaml:"enabled"`
	WWNs    []string `json:"wwns"    yaml:"wwns"`
}

ServiceMultipathConfig represents additional configuration for the Multipath service.

type ServiceMultipathDevice

type ServiceMultipathDevice struct {
	Vendor     string                      `json:"vendor"      yaml:"vendor"`
	Size       string                      `json:"size"        yaml:"size"`
	PathGroups []ServiceMultipathPathGroup `json:"path_groups" yaml:"path_groups"`
}

ServiceMultipathDevice represents a single Multipath device.

type ServiceMultipathPath

type ServiceMultipathPath struct {
	ID     string `json:"id"     yaml:"id"`
	Status string `json:"status" yaml:"status"`
}

ServiceMultipathPath represents a single Multipath path.

type ServiceMultipathPathGroup

type ServiceMultipathPathGroup struct {
	Policy   string                 `json:"policy"   yaml:"policy"`
	Priority uint64                 `json:"priority" yaml:"priority"`
	Status   string                 `json:"status"   yaml:"status"`
	Paths    []ServiceMultipathPath `json:"paths"    yaml:"paths"`
}

ServiceMultipathPathGroup represents a single Multipath path group.

type ServiceMultipathState

type ServiceMultipathState struct {
	Devices map[string]ServiceMultipathDevice `json:"devices" yaml:"devices"`
}

ServiceMultipathState represents the state for the Multipath service.

type ServiceNVME

type ServiceNVME struct {
	State ServiceNVMEState `incusos:"-" json:"state" yaml:"state"`

	Config ServiceNVMEConfig `json:"config" yaml:"config"`
}

ServiceNVME represents the state and configuration of the NVME service.

type ServiceNVMEConfig

type ServiceNVMEConfig struct {
	Enabled bool                `json:"enabled" yaml:"enabled"`
	Targets []ServiceNVMETarget `json:"targets" yaml:"targets"`
}

ServiceNVMEConfig represents additional configuration for the NVME service.

type ServiceNVMEState

type ServiceNVMEState struct {
	HostID  string `json:"host_id"  yaml:"host_id"`
	HostNQN string `json:"host_nqn" yaml:"host_nqn"`
}

ServiceNVMEState represents the state for the NVME service.

type ServiceNVMETarget

type ServiceNVMETarget struct {
	Transport string `json:"transport" yaml:"transport"`
	Address   string `json:"address"   yaml:"address"`
	Port      int    `json:"port"      yaml:"port"`
}

ServiceNVMETarget represents a single NVME target.

type ServiceOVN

type ServiceOVN struct {
	State ServiceOVNState `incusos:"-" json:"state" yaml:"state"`

	Config ServiceOVNConfig `json:"config" yaml:"config"`
}

ServiceOVN represents the state and configuration of the OVN service.

type ServiceOVNConfig

type ServiceOVNConfig struct {
	Enabled              bool   `json:"enabled"                yaml:"enabled"`
	ICChassis            bool   `json:"ic_chassis"             yaml:"ic_chassis"`
	Database             string `json:"database"               yaml:"database"`
	TLSClientCertificate string `json:"tls_client_certificate" yaml:"tls_client_certificate"`
	TLSClientKey         string `json:"tls_client_key"         yaml:"tls_client_key"`
	TLSCACertificate     string `json:"tls_ca_certificate"     yaml:"tls_ca_certificate"`
	TunnelAddress        string `json:"tunnel_address"         yaml:"tunnel_address"`
	TunnelProtocol       string `json:"tunnel_protocol"        yaml:"tunnel_protocol"`
}

ServiceOVNConfig represents additional configuration for the OVN service.

type ServiceOVNState

type ServiceOVNState struct{}

ServiceOVNState represents state for the OVN service.

type ServiceTailscale

type ServiceTailscale struct {
	State struct{} `json:"state" yaml:"state"`

	Config struct {
		Enabled          bool     `json:"enabled"           yaml:"enabled"`
		LoginServer      string   `json:"login_server"      yaml:"login_server"`
		AuthKey          string   `json:"auth_key"          yaml:"auth_key"`
		AcceptRoutes     bool     `json:"accept_routes"     yaml:"accept_routes"`
		AdvertisedRoutes []string `json:"advertised_routes" yaml:"advertised_routes"`
		ServeEnabled     bool     `json:"serve_enabled"     yaml:"serve_enabled"`
		ServePort        int16    `json:"serve_port"        yaml:"serve_port"`
	} `json:"config" yaml:"config"`
}

ServiceTailscale represents the state and configuration of the Tailscale service.

type ServiceUSBIP

type ServiceUSBIP struct {
	State ServiceUSBIPState `incusos:"-" json:"state" yaml:"state"`

	Config ServiceUSBIPConfig `json:"config" yaml:"config"`
}

ServiceUSBIP represents the state and configuration of the USBIP service.

type ServiceUSBIPConfig

type ServiceUSBIPConfig struct {
	Targets []ServiceUSBIPTarget `json:"targets" yaml:"targets"`
}

ServiceUSBIPConfig represents additional configuration for the USBIP service.

type ServiceUSBIPState

type ServiceUSBIPState struct{}

ServiceUSBIPState represents state for the USBIP service.

type ServiceUSBIPTarget

type ServiceUSBIPTarget struct {
	Address string `json:"address" yaml:"address"`
	BusID   string `json:"bus_id"  yaml:"bus_id"`
}

ServiceUSBIPTarget represents a single USBIP target.

type SystemLogging

type SystemLogging struct {
	Config SystemLoggingConfig `json:"config" yaml:"config"`
	State  SystemLoggingState  `incusos:"-"   json:"state"  yaml:"state"`
}

SystemLogging defines a struct to hold information about the system's logging configuration.

type SystemLoggingConfig

type SystemLoggingConfig struct {
	Syslog SystemLoggingSyslog `json:"syslog" yaml:"syslog"`
}

SystemLoggingConfig holds the modifiable part of the logging data.

type SystemLoggingState

type SystemLoggingState struct{}

SystemLoggingState represents state for the systme's logging configuration.

type SystemLoggingSyslog

type SystemLoggingSyslog struct {
	Address   string `json:"address"    yaml:"address"`
	Protocol  string `json:"protocol"   yaml:"protocol"`
	LogFormat string `json:"log_format" yaml:"log_format"`
}

SystemLoggingSyslog contains the configuration options for a remote syslog server.

type SystemNetwork

type SystemNetwork struct {
	Config *SystemNetworkConfig `json:"config" yaml:"config"`

	State SystemNetworkState `incusos:"-" json:"state" yaml:"state"`
}

SystemNetwork defines a struct to hold the three types of supported network configuration.

type SystemNetworkBond

type SystemNetworkBond struct {
	Name              string               `json:"name"                          yaml:"name"`
	Mode              string               `json:"mode"                          yaml:"mode"`
	MTU               int                  `json:"mtu,omitempty"                 yaml:"mtu,omitempty"`
	VLANTags          []int                `json:"vlan_tags,omitempty"           yaml:"vlan_tags,omitempty"`
	Addresses         []string             `json:"addresses,omitempty"           yaml:"addresses,omitempty"`
	RequiredForOnline string               `json:"required_for_online,omitempty" yaml:"required_for_online,omitempty"`
	Routes            []SystemNetworkRoute `json:"routes,omitempty"              yaml:"routes,omitempty"`
	Hwaddr            string               `json:"hwaddr,omitempty"              yaml:"hwaddr,omitempty"`
	Members           []string             `json:"members,omitempty"             yaml:"members,omitempty"`
	Roles             []string             `json:"roles,omitempty"               yaml:"roles,omitempty"`
	LLDP              bool                 `json:"lldp"                          yaml:"lldp"`
}

SystemNetworkBond contains information about a network bond.

type SystemNetworkConfig

type SystemNetworkConfig struct {
	DNS   *SystemNetworkDNS   `json:"dns,omitempty"   yaml:"dns,omitempty"`
	Time  *SystemNetworkTime  `json:"time,omitempty"  yaml:"time,omitempty"`
	Proxy *SystemNetworkProxy `json:"proxy,omitempty" yaml:"proxy,omitempty"`

	Interfaces []SystemNetworkInterface `json:"interfaces,omitempty" yaml:"interfaces,omitempty"`
	Bonds      []SystemNetworkBond      `json:"bonds,omitempty"      yaml:"bonds,omitempty"`
	VLANs      []SystemNetworkVLAN      `json:"vlans,omitempty"      yaml:"vlans,omitempty"`
}

SystemNetworkConfig represents the user modifiable network configuration.

type SystemNetworkDNS

type SystemNetworkDNS struct {
	Hostname      string   `json:"hostname"                 yaml:"hostname"`
	Domain        string   `json:"domain"                   yaml:"domain"`
	SearchDomains []string `json:"search_domains,omitempty" yaml:"search_domains,omitempty"`
	Nameservers   []string `json:"nameservers,omitempty"    yaml:"nameservers,omitempty"`
}

SystemNetworkDNS defines DNS configuration options.

type SystemNetworkInterface

type SystemNetworkInterface struct {
	Name              string               `json:"name"                          yaml:"name"`
	MTU               int                  `json:"mtu,omitempty"                 yaml:"mtu,omitempty"`
	VLANTags          []int                `json:"vlan_tags,omitempty"           yaml:"vlan_tags,omitempty"`
	Addresses         []string             `json:"addresses,omitempty"           yaml:"addresses,omitempty"`
	RequiredForOnline string               `json:"required_for_online,omitempty" yaml:"required_for_online,omitempty"`
	Routes            []SystemNetworkRoute `json:"routes,omitempty"              yaml:"routes,omitempty"`
	Hwaddr            string               `json:"hwaddr"                        yaml:"hwaddr"`
	Roles             []string             `json:"roles,omitempty"               yaml:"roles,omitempty"`
	LLDP              bool                 `json:"lldp"                          yaml:"lldp"`
}

SystemNetworkInterface contains information about a network interface.

type SystemNetworkInterfaceState

type SystemNetworkInterfaceState struct {
	Type      string                                 `json:"type,omitempty"      yaml:"type,omitempty"`
	Addresses []string                               `json:"addresses,omitempty" yaml:"addresses,omitempty"`
	Hwaddr    string                                 `json:"hwaddr"              yaml:"hwaddr"`
	Routes    []SystemNetworkRoute                   `json:"routes,omitempty"    yaml:"routes,omitempty"`
	MTU       int                                    `json:"mtu,omitempty"       yaml:"mtu,omitempty"`
	Speed     string                                 `json:"speed,omitempty"     yaml:"speed,omitempty"`
	State     string                                 `json:"state"               yaml:"state"`
	Stats     SystemNetworkInterfaceStats            `json:"stats"               yaml:"stats"`
	LLDP      []SystemNetworkLLDPState               `json:"lldp,omitempty"      yaml:"lldp,omitempty"`
	LACP      *SystemNetworkLACPState                `json:"lacp,omitempty"      yaml:"lacp,omitempty"`
	Members   map[string]SystemNetworkInterfaceState `json:"members,omitempty"   yaml:"members,omitempty"`
	Roles     []string                               `json:"roles,omitempty"     yaml:"roles,omitempty"`
}

SystemNetworkInterfaceState holds state information about a specific network interface.

type SystemNetworkInterfaceStats

type SystemNetworkInterfaceStats struct {
	RXBytes  int `json:"rx_bytes"  yaml:"rx_bytes"`
	TXBytes  int `json:"tx_bytes"  yaml:"tx_bytes"`
	RXErrors int `json:"rx_errors" yaml:"rx_errors"`
	TXErrors int `json:"tx_errors" yaml:"tx_errors"`
}

SystemNetworkInterfaceStats holds RX/TX stats for an interface.

type SystemNetworkLACPState

type SystemNetworkLACPState struct {
	LocalMAC  string `json:"local_mac"  yaml:"local_mac"`
	RemoteMAC string `json:"remote_mac" yaml:"remote_mac"`
}

SystemNetworkLACPState holds information about a bond's LACP state.

type SystemNetworkLLDPState

type SystemNetworkLLDPState struct {
	Name      string `json:"name"           yaml:"name"`
	ChassisID string `json:"chassis_id"     yaml:"chassis_id"`
	PortID    string `json:"port_id"        yaml:"port_id"`
	Port      string `json:"port,omitempty" yaml:"port,omitempty"`
}

SystemNetworkLLDPState holds information about the LLDP state.

type SystemNetworkProxy

type SystemNetworkProxy struct {
	Servers map[string]SystemNetworkProxyServer `json:"servers,omitempty" yaml:"servers,omitempty"`
	Rules   []SystemNetworkProxyRule            `json:"rules,omitempty"   yaml:"rules,omitempty"`
}

SystemNetworkProxy defines proxy configuration.

type SystemNetworkProxyRule

type SystemNetworkProxyRule struct {
	Destination string `json:"destination" yaml:"destination"`
	Target      string `json:"target"      yaml:"target"`
}

SystemNetworkProxyRule defines a proxy rule.

type SystemNetworkProxyServer

type SystemNetworkProxyServer struct {
	Host     string `json:"host"               yaml:"host"`
	UseTLS   bool   `json:"use_tls"            yaml:"use_tls"`
	Auth     string `json:"auth"               yaml:"auth"`
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	Password string `json:"password,omitempty" yaml:"password,omitempty"`
	Realm    string `json:"realm,omitempty"    yaml:"realm,omitempty"`
}

SystemNetworkProxyServer defines a proxy server configuration.

type SystemNetworkRoute

type SystemNetworkRoute struct {
	To  string `json:"to"  yaml:"to"`
	Via string `json:"via" yaml:"via"`
}

SystemNetworkRoute defines a route.

type SystemNetworkState

type SystemNetworkState struct {
	Interfaces map[string]SystemNetworkInterfaceState `json:"interfaces" yaml:"interfaces"`
}

SystemNetworkState holds information about the current network state.

func (*SystemNetworkState) GetInterfaceNamesByRole

func (n *SystemNetworkState) GetInterfaceNamesByRole(role string) []string

GetInterfaceNamesByRole returns a slice of interface names that have the given role applied to them.

type SystemNetworkTime

type SystemNetworkTime struct {
	NTPServers []string `json:"ntp_servers,omitempty" yaml:"ntp_servers,omitempty"`
	Timezone   string   `json:"timezone,omitempty"    yaml:"timezone,omitempty"`
}

SystemNetworkTime defines various time related configuration options (NTP servers, timezone, etc).

type SystemNetworkVLAN

type SystemNetworkVLAN struct {
	Name              string               `json:"name"                          yaml:"name"`
	Parent            string               `json:"parent"                        yaml:"parent"`
	ID                int                  `json:"id"                            yaml:"id"`
	MTU               int                  `json:"mtu,omitempty"                 yaml:"mtu,omitempty"`
	Addresses         []string             `json:"addresses,omitempty"           yaml:"addresses,omitempty"`
	RequiredForOnline string               `json:"required_for_online,omitempty" yaml:"required_for_online,omitempty"`
	Routes            []SystemNetworkRoute `json:"routes,omitempty"              yaml:"routes,omitempty"`
	Roles             []string             `json:"roles,omitempty"               yaml:"roles,omitempty"`
}

SystemNetworkVLAN contains information about a network vlan.

type SystemProvider

type SystemProvider struct {
	Config SystemProviderConfig `json:"config" yaml:"config"`
	State  SystemProviderState  `json:"state"  yaml:"state"`
}

SystemProvider defines a struct to hold information about the system's update and configuration provider.

type SystemProviderConfig

type SystemProviderConfig struct {
	Name   string            `json:"name"   yaml:"name"`
	Config map[string]string `json:"config" yaml:"config"`
}

SystemProviderConfig holds the modifiable part of the provider data.

type SystemProviderState

type SystemProviderState struct {
	Registered bool `json:"registered" yaml:"registered"`
}

SystemProviderState holds information about the current provider state.

type SystemReset

type SystemReset struct {
	AllowTPMResetFailure bool                       `json:"allow_tpm_reset_failure" yaml:"allow_tpm_reset_failure"`
	Seeds                map[string]json.RawMessage `json:"seeds"                   yaml:"seeds"`
	WipeExistingSeeds    bool                       `json:"wipe_existing_seeds"     yaml:"wipe_existing_seeds"`
}

SystemReset defines a struct that takes an optional map of seed data to set as part of the factory reset.

type SystemSecurity

type SystemSecurity struct {
	Config SystemSecurityConfig `json:"config" yaml:"config"`

	State SystemSecurityState `json:"state" yaml:"state"`
}

SystemSecurity defines a struct to hold information about the system's security state.

type SystemSecurityConfig

type SystemSecurityConfig struct {
	EncryptionRecoveryKeys []string `json:"encryption_recovery_keys" yaml:"encryption_recovery_keys"`
}

SystemSecurityConfig holds additional security configuration settings.

type SystemSecurityEncryptedVolume

type SystemSecurityEncryptedVolume struct {
	Volume string `json:"volume" yaml:"volume"`
	State  string `json:"state"  yaml:"state"`
}

SystemSecurityEncryptedVolume defines a struct that holds basic information about an encrypted volume.

type SystemSecuritySecureBootCertificate

type SystemSecuritySecureBootCertificate struct {
	Type        string `json:"type"        yaml:"type"`
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`
	Subject     string `json:"subject"     yaml:"subject"`
	Issuer      string `json:"issuer"      yaml:"issuer"`
}

SystemSecuritySecureBootCertificate defines a struct that holds information about Secure Boot keys present on the host.

type SystemSecurityState

type SystemSecurityState struct {
	EncryptionRecoveryKeysRetrieved bool                                  `json:"encryption_recovery_keys_retrieved" yaml:"encryption_recovery_keys_retrieved"`
	EncryptedVolumes                []SystemSecurityEncryptedVolume       `incusos:"-"                               json:"encrypted_volumes"                  yaml:"encrypted_volumes"`
	SecureBootEnabled               bool                                  `incusos:"-"                               json:"secure_boot_enabled"                yaml:"secure_boot_enabled"`
	SecureBootCertificates          []SystemSecuritySecureBootCertificate `incusos:"-"                               json:"secure_boot_certificates"           yaml:"secure_boot_certificates"`
	TPMStatus                       string                                `incusos:"-"                               json:"tpm_status"                         yaml:"tpm_status"`
	PoolRecoveryKeys                map[string]string                     `incusos:"-"                               json:"pool_recovery_keys"                 yaml:"pool_recovery_keys"`
}

SystemSecurityState holds information about the current security state.

type SystemStorage

type SystemStorage struct {
	Config SystemStorageConfig `json:"config" yaml:"config"`

	State SystemStorageState `incusos:"-" json:"state" yaml:"state"`
}

SystemStorage defines a struct to hold information about the system's local storage.

type SystemStorageConfig

type SystemStorageConfig struct {
	Pools []SystemStoragePool `json:"pools,omitempty" yaml:"pools,omitempty"`
}

SystemStorageConfig represents additional configuration for the system's local storage.

type SystemStorageDrive

type SystemStorageDrive struct {
	ID              string                   `json:"id"                    yaml:"id"`
	ModelFamily     string                   `json:"model_family"          yaml:"model_family"`
	ModelName       string                   `json:"model_name"            yaml:"model_name"`
	SerialNumber    string                   `json:"serial_number"         yaml:"serial_number"`
	Bus             string                   `json:"bus"                   yaml:"bus"`
	CapacityInBytes int                      `json:"capacity_in_bytes"     yaml:"capacity_in_bytes"`
	Boot            bool                     `json:"boot"                  yaml:"boot"`
	Removable       bool                     `json:"removable"             yaml:"removable"`
	Remote          bool                     `json:"remote"                yaml:"remote"`
	WWN             string                   `json:"wwn,omitempty"         yaml:"wwn,omitempty"`
	SMART           *SystemStorageDriveSMART `json:"smart,omitempty"       yaml:"smart,omitempty"`
	MemberPool      string                   `json:"member_pool,omitempty" yaml:"member_pool,omitempty"`
}

SystemStorageDrive defines a struct that holds information about a specific drive.

type SystemStorageDriveSMART

type SystemStorageDriveSMART struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
	Passed  bool `json:"passed"  yaml:"passed"`
}

SystemStorageDriveSMART defines a struct to return basic SMART information about a specific device.

type SystemStoragePool

type SystemStoragePool struct {
	// Name and Type cannot be changed after pool creation.
	Name string `json:"name" yaml:"name"`
	// Supported pool types: zfs-raid0, zfs-raid1, zfs-raid10, zfs-raidz1, zfs-raidz2, zfs-raidz3.
	Type string `json:"type" yaml:"type"`

	// Devices, Cache, and Log can be modified to add/remove/replace devices in the pool.
	Devices []string `json:"devices"         yaml:"devices"`
	Cache   []string `json:"cache,omitempty" yaml:"cache,omitempty"`
	Log     []string `json:"log,omitempty"   yaml:"log,omitempty"`

	// Read-only fields returned from the server with additional pool information.
	State                     string                    `json:"state"                         yaml:"state"`
	EncryptionKeyStatus       string                    `json:"encryption_key_status"         yaml:"encryption_key_status"`
	DevicesDegraded           []string                  `json:"devices_degraded,omitempty"    yaml:"devices_degraded,omitempty"`
	CacheDegraded             []string                  `json:"cache_degraded,omitempty"      yaml:"cache_degraded,omitempty"`
	LogDegraded               []string                  `json:"log_degraded,omitempty"        yaml:"log_degraded,omitempty"`
	RawPoolSizeInBytes        int                       `json:"raw_pool_size_in_bytes"        yaml:"raw_pool_size_in_bytes"`
	UsablePoolSizeInBytes     int                       `json:"usable_pool_size_in_bytes"     yaml:"usable_pool_size_in_bytes"`
	PoolAllocatedSpaceInBytes int                       `json:"pool_allocated_space_in_bytes" yaml:"pool_allocated_space_in_bytes"`
	Volumes                   []SystemStoragePoolVolume `json:"volumes"                       yaml:"volumes"`
}

SystemStoragePool defines a struct that is used to create or update a storage pool and return its current state.

type SystemStoragePoolKey

type SystemStoragePoolKey struct {
	Name          string `json:"name"           yaml:"name"`
	Type          string `json:"type"           yaml:"type"`
	EncryptionKey string `json:"encryption_key" yaml:"encryption_key"`
}

SystemStoragePoolKey defines a struct used to provide an encryption key when importing an existing pool. Currently the only supported type is "zfs".

type SystemStoragePoolVolume

type SystemStoragePoolVolume struct {
	Name         string `json:"name"           yaml:"name"`
	UsageInBytes int    `json:"usage_in_bytes" yaml:"usage_in_bytes"`
	QuotaInBytes int    `json:"quota_in_bytes" yaml:"quota_in_bytes"`
	Use          string `json:"use"            yaml:"use"`
}

SystemStoragePoolVolume represents a single IncusOS-managed volume in a pool.

type SystemStorageState

type SystemStorageState struct {
	Drives []SystemStorageDrive `json:"drives" yaml:"drives"`
	Pools  []SystemStoragePool  `json:"pools"  yaml:"pools"`
}

SystemStorageState represents additional state for the system's local storage.

type SystemStorageWipe

type SystemStorageWipe struct {
	ID string `json:"id" yaml:"id"`
}

SystemStorageWipe defines a struct with information about what drive to wipe.

type SystemUpdate

type SystemUpdate struct {
	Config SystemUpdateConfig `json:"config" yaml:"config"`

	State SystemUpdateState `incusos:"-" json:"state" yaml:"state"`
}

SystemUpdate defines a struct to hold information about the system's update policy.

type SystemUpdateConfig

type SystemUpdateConfig struct {
	AutoReboot         bool                            `json:"auto_reboot"                   yaml:"auto_reboot"`
	Channel            string                          `json:"channel"                       yaml:"channel"`
	CheckFrequency     string                          `json:"check_frequency"               yaml:"check_frequency"`
	MaintenanceWindows []SystemUpdateMaintenanceWindow `json:"maintenance_windows,omitempty" yaml:"maintenance_windows,omitempty"`
}

SystemUpdateConfig defines a struct to hold configuration details for the update checks.

type SystemUpdateMaintenanceWindow

type SystemUpdateMaintenanceWindow struct {
	StartDayOfWeek Weekday `json:"start_day_of_week,omitempty" yaml:"start_day_of_week,omitempty"`
	StartHour      int     `json:"start_hour"                  yaml:"start_hour"`
	StartMinute    int     `json:"start_minute"                yaml:"start_minute"`
	EndDayOfWeek   Weekday `json:"end_day_of_week,omitempty"   yaml:"end_day_of_week,omitempty"`
	EndHour        int     `json:"end_hour"                    yaml:"end_hour"`
	EndMinute      int     `json:"end_minute"                  yaml:"end_minute"`
}

SystemUpdateMaintenanceWindow defines a maintenance window for when it is acceptable to check for and apply updates. StartDayOfWeek and EndDayOfWeek are optional, and if non-zero can be used to limit the migration window to certain day(s).

func (*SystemUpdateMaintenanceWindow) IsActive

IsActive returns true if the maintenance window will be active at the given point in time.

func (*SystemUpdateMaintenanceWindow) IsCurrentlyActive

func (w *SystemUpdateMaintenanceWindow) IsCurrentlyActive() bool

IsCurrentlyActive returns true if the maintenance window is active.

func (*SystemUpdateMaintenanceWindow) TimeUntilActive

func (w *SystemUpdateMaintenanceWindow) TimeUntilActive() time.Duration

TimeUntilActive returns a time.Duration representing the amount of time until the maintenance window becomes active.

func (*SystemUpdateMaintenanceWindow) TimeUntilActiveReference

func (w *SystemUpdateMaintenanceWindow) TimeUntilActiveReference(t time.Time) time.Duration

TimeUntilActiveReference returns a time.Duration representing the amount of time until the maintenance window becomes active compared to the given reference time.

type SystemUpdateState

type SystemUpdateState struct {
	LastCheck   time.Time `json:"last_check"   yaml:"last_check"` // In system's timezone.
	Status      string    `json:"status"       yaml:"status"`
	NeedsReboot bool      `json:"needs_reboot" yaml:"needs_reboot"`
}

SystemUpdateState holds information about the current update state.

type Weekday

type Weekday string

Weekday defines our own type. The time package's Weekday doesn't include any way to indicate an empty value, which we need.

const (
	NONE      Weekday = ""
	Sunday    Weekday = "Sunday"
	Monday    Weekday = "Monday"
	Tuesday   Weekday = "Tuesday"
	Wednesday Weekday = "Wednesday"
	Thursday  Weekday = "Thursday"
	Friday    Weekday = "Friday"
	Saturday  Weekday = "Saturday"
)

Names of each day of the week.

func (Weekday) ToWeekday

func (w Weekday) ToWeekday() time.Weekday

ToWeekday converts our string representation into the time package's int-based Weekeday. It is assumed the value has already been checked to be a valid weekday, as no such error checking is performed here.

Directories

Path Synopsis
Package images contains the API files used for image server artifacts.
Package images contains the API files used for image server artifacts.
Package seed contains the API files used for image seed files.
Package seed contains the API files used for image seed files.

Jump to

Keyboard shortcuts

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