provisioning

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterArtifactArchiveTypeExtZip = "zip"
)
View Source
const UsesRemainingInfinity = math.MaxInt

Variables

View Source
var ClusterArtifactArchiveTypes = map[string]ClusterArtifactArchiveType{
	ClusterArtifactArchiveTypeExtZip: {
		Ext:        ClusterArtifactArchiveTypeExtZip,
		MimeType:   "application/zip",
		Compressed: true,
	},
}
View Source
var ErrSelfUpdateNotification = errors.New("self update notification")

ErrSelfUpdateNotification is used as cause when the context is cancelled while waiting for the update of the network config to complete.

View Source
var ExpireAtInfinity = time.Date(9999, 12, 31, 23, 59, 59, 999999999, time.UTC)

Functions

func NewChannelService added in v0.3.0

func NewChannelService(repo ChannelRepo, updateSvc UpdateService) *channelService

func NewClusterService

func NewClusterService(
	repo ClusterRepo,
	localartifact ClusterArtifactRepo,
	client ClusterClientPort,
	serverSvc ServerService,
	tokenSvc TokenService,
	inventorySyncers map[domain.ResourceType]InventorySyncer,
	provisioner ClusterProvisioningPort,
	opts ...ClusterServiceOption,
) *clusterService

func NewClusterTemplateService

func NewClusterTemplateService(
	repo ClusterTemplateRepo,
) *clusterTemplateService

func NewServerService

func NewServerService(
	repo ServerRepo,
	client ServerClientPort,
	tokenSvc TokenService,
	clusterSvc ClusterService,
	channelSvc ChannelService,
	updateSvc UpdateService,
	serverCertificate tls.Certificate,
	opts ...ServerServiceOption,
) *serverService

func NewTokenService

func NewTokenService(repo TokenRepo, updateSvc UpdateService, channelSvc ChannelService, flasher FlasherPort, opts ...TokenServiceOption) *tokenService

func NewUpdateService

func NewUpdateService(repo UpdateRepo, filesRepo UpdateFilesRepo, source UpdateSourcePort, opts ...UpdateServiceOption) *updateService

Types

type CancelFunc

type CancelFunc func() error

type Channel added in v0.3.0

type Channel struct {
	ID          int64     `json:"-"`
	Name        string    `json:"name" db:"primary=yes"`
	Description string    `json:"description"`
	LastUpdated time.Time `json:"-" expr:"last_updated" db:"update_timestamp"`
}

func (Channel) Validate added in v0.3.0

func (u Channel) Validate() error

type ChannelFilter added in v0.3.0

type ChannelFilter struct {
	ID   *int
	Name *string
}

type ChannelRepo added in v0.3.0

type ChannelRepo interface {
	Create(ctx context.Context, newChannel Channel) (int64, error)
	GetAll(ctx context.Context) (Channels, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*Channel, error)
	Update(ctx context.Context, newChannel Channel) error
	DeleteByName(ctx context.Context, name string) error
}

type ChannelService added in v0.3.0

type ChannelService interface {
	SetServerService(serverSvc ServerService)

	Create(ctx context.Context, newChannel Channel) (Channel, error)
	GetAll(ctx context.Context) (Channels, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*Channel, error)
	Update(ctx context.Context, newChannel Channel) error
	DeleteByName(ctx context.Context, name string) error
}

type ChannelUpdate added in v0.3.0

type ChannelUpdate struct {
	ChannelID int `db:"primary=yes"`
	UpdateID  int `db:"primary=yes"`
}

type ChannelUpdateFilter added in v0.3.0

type ChannelUpdateFilter struct {
	ChannelID *int
	UpdateID  *int
}

type Channels added in v0.3.0

type Channels []Channel

type Cluster

type Cluster struct {
	ID                    int64             `json:"-"`
	Name                  string            `json:"name"                    db:"primary=yes"`
	ConnectionURL         string            `json:"connection_url"`
	Certificate           *string           `json:"certificate"`
	Fingerprint           string            `json:"fingerprint"             db:"ignore"`
	Status                api.ClusterStatus `json:"status"`
	ServerNames           []string          `json:"server_names"            db:"ignore"`
	ServerType            api.ServerType    `json:"server_type"             db:"ignore"`
	ServicesConfig        map[string]any    `json:"services_config"         db:"ignore"`
	ApplicationSeedConfig map[string]any    `json:"application_seed_config" db:"ignore"`
	Channel               string            `json:"channel"                 db:"join=channels.name"`
	LastUpdated           time.Time         `json:"last_updated"            db:"update_timestamp"`
}

func (Cluster) Validate

func (c Cluster) Validate() error

func (Cluster) ValidateCreate

func (c Cluster) ValidateCreate() error

type ClusterArtifact

type ClusterArtifact struct {
	ID          int64
	Cluster     string `db:"primary=yes&join=clusters.name"`
	Name        string `db:"primary=yes"`
	Description string
	Properties  api.ConfigMap
	Files       ClusterArtifactFiles
	LastUpdated time.Time `db:"update_timestamp"`
}

type ClusterArtifactArchiveType

type ClusterArtifactArchiveType struct {
	Ext        string
	MimeType   string
	Compressed bool
}

type ClusterArtifactFile

type ClusterArtifactFile struct {
	Name     string
	MimeType string
	Size     int64
	Open     func() (io.ReadCloser, error) `db:"ignore"`
}

type ClusterArtifactFiles

type ClusterArtifactFiles []ClusterArtifactFile

func (*ClusterArtifactFiles) Scan

func (c *ClusterArtifactFiles) Scan(value any) error

Scan implements the sql.Scanner interface.

func (ClusterArtifactFiles) Value

func (c ClusterArtifactFiles) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

type ClusterArtifactRepo

type ClusterArtifactRepo interface {
	CreateClusterArtifactFromPath(ctx context.Context, artifact ClusterArtifact, path string, ignoredFiles []string) (int64, error)
	GetClusterArtifactAll(ctx context.Context, clusterName string) (ClusterArtifacts, error)
	GetClusterArtifactAllNames(ctx context.Context, clusterName string) ([]string, error)
	GetClusterArtifactByName(ctx context.Context, clusterName string, artifactName string) (*ClusterArtifact, error)
	GetClusterArtifactArchiveByName(ctx context.Context, clusterName string, artifactName string, archiveType ClusterArtifactArchiveType) (_ io.ReadCloser, size int, _ error)
}

type ClusterArtifacts

type ClusterArtifacts []ClusterArtifact

type ClusterClientPort

type ClusterClientPort interface {
	Ping(ctx context.Context, endpoint Endpoint) error
	EnableOSService(ctx context.Context, server Server, name string, config map[string]any) error
	SetServerConfig(ctx context.Context, endpoint Endpoint, config map[string]string) error
	EnableCluster(ctx context.Context, server Server) (clusterCertificate string, _ error)
	GetClusterNodeNames(ctx context.Context, endpoint Endpoint) (nodeNames []string, _ error)
	GetClusterJoinToken(ctx context.Context, endpoint Endpoint, memberName string) (joinToken string, _ error)
	JoinCluster(ctx context.Context, server Server, joinToken string, endpoint Endpoint) error
	GetOSData(ctx context.Context, endpoint Endpoint) (api.OSData, error)
	UpdateClusterCertificate(ctx context.Context, endpoint Endpoint, certificatePEM string, keyPEM string) error
	SystemFactoryReset(ctx context.Context, endpoint Endpoint, allowTPMResetFailure bool, seeds TokenImageSeedConfigs, providerConfig api.TokenProviderConfig) error
	SubscribeLifecycleEvents(ctx context.Context, endpoint Endpoint) (chan domain.LifecycleEvent, chan error, error)
	UpdateUpdateConfig(ctx context.Context, server Server, updateConfig ServerSystemUpdate) error

	GetRemoteCertificate(ctx context.Context, endpoint Endpoint) (*x509.Certificate, error)
}

type ClusterEndpoint

type ClusterEndpoint []Server

func (ClusterEndpoint) GetCertificate

func (c ClusterEndpoint) GetCertificate() string

func (ClusterEndpoint) GetConnectionURL

func (c ClusterEndpoint) GetConnectionURL() string

func (ClusterEndpoint) GetEndpoints

func (c ClusterEndpoint) GetEndpoints() iter.Seq[Endpoint]

func (ClusterEndpoint) GetServerName

func (c ClusterEndpoint) GetServerName() (string, error)

type ClusterFilter

type ClusterFilter struct {
	Name       *string
	Expression *string `db:"ignore"`
}

func (ClusterFilter) AppendToURLValues

func (f ClusterFilter) AppendToURLValues(query url.Values) url.Values

func (ClusterFilter) String

func (f ClusterFilter) String() string

type ClusterProvisioningConfig

type ClusterProvisioningConfig struct {
	ClusterEndpoint ClusterEndpoint
	Servers         []Server

	Cluster Cluster
}

type ClusterProvisioningPort

type ClusterProvisioningPort interface {
	Init(ctx context.Context, clusterName string, config ClusterProvisioningConfig) (temporaryPath string, cleanup func() error, _ error)
	SeedCertificate(ctx context.Context, clusterName string, certificate string) error
	Apply(ctx context.Context, cluster Cluster) error
}

type ClusterRepo

type ClusterRepo interface {
	Create(ctx context.Context, cluster Cluster) (int64, error)
	GetAll(ctx context.Context) (Clusters, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*Cluster, error)
	ExistsByName(ctx context.Context, name string) (bool, error)
	Update(ctx context.Context, cluster Cluster) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
}

type ClusterService

type ClusterService interface {
	Create(ctx context.Context, cluster Cluster) (Cluster, error)
	GetAll(ctx context.Context) (Clusters, error)
	GetAllWithFilter(ctx context.Context, filter ClusterFilter) (Clusters, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetAllNamesWithFilter(ctx context.Context, filter ClusterFilter) ([]string, error)
	GetByName(ctx context.Context, name string) (*Cluster, error)
	Update(ctx context.Context, cluster Cluster) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string, force bool) error
	DeleteAndFactoryResetByName(ctx context.Context, name string, tokenID *uuid.UUID, tokenSeedName *string) error
	ResyncInventory(ctx context.Context) error
	ResyncInventoryByName(ctx context.Context, name string) error
	StartLifecycleEventsMonitor(ctx context.Context) error
	UpdateCertificate(ctx context.Context, name string, certificatePEM string, keyPEM string) error
	GetEndpoint(ctx context.Context, name string) (Endpoint, error)
	GetClusterArtifactAll(ctx context.Context, clusterName string) (ClusterArtifacts, error)
	GetClusterArtifactAllNames(ctx context.Context, clusterName string) ([]string, error)
	GetClusterArtifactByName(ctx context.Context, clusterName string, artifactName string) (*ClusterArtifact, error)
	GetClusterArtifactArchiveByName(ctx context.Context, clusterName string, artifactName string, archiveType ClusterArtifactArchiveType) (_ io.ReadCloser, size int, _ error)
	GetClusterArtifactFileByName(ctx context.Context, clusterName string, artifactName string, filename string) (*ClusterArtifactFile, error)
	SetInventorySyncers(inventorySyncers map[domain.ResourceType]InventorySyncer)
}

type ClusterServiceOption

type ClusterServiceOption func(s *clusterService)

func WithClusterServiceCreateClusterRetryTimeout added in v0.2.0

func WithClusterServiceCreateClusterRetryTimeout(timeout time.Duration) ClusterServiceOption

func WithClusterServiceUpdateSignal added in v0.2.0

func WithClusterServiceUpdateSignal(updateSignal signals.Signal[ClusterUpdateMessage]) ClusterServiceOption

type ClusterTemplate

type ClusterTemplate struct {
	ID                        int64
	Name                      string `db:"primary=yes"`
	Description               string
	ServiceConfigTemplate     string
	ApplicationConfigTemplate string
	Variables                 api.ClusterTemplateVariables
	LastUpdated               time.Time `db:"update_timestamp"`
}

func (ClusterTemplate) Validate

func (c ClusterTemplate) Validate() error

type ClusterTemplateRepo

type ClusterTemplateRepo interface {
	Create(ctx context.Context, clusterTemplate ClusterTemplate) (int64, error)
	GetAll(ctx context.Context) (ClusterTemplates, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*ClusterTemplate, error)
	Update(ctx context.Context, clusterTemplate ClusterTemplate) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
}

type ClusterTemplateService

type ClusterTemplateService interface {
	Create(ctx context.Context, clusterTemplate ClusterTemplate) (ClusterTemplate, error)
	GetAll(ctx context.Context) (ClusterTemplates, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*ClusterTemplate, error)
	Update(ctx context.Context, clusterTemplate ClusterTemplate) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
	Apply(ctx context.Context, name string, templateVariables api.ConfigMap) (servicesConfig map[string]any, applicationSeedConfig map[string]any, _ error)
}

type ClusterTemplates

type ClusterTemplates []ClusterTemplate

type ClusterUpdateMessage

type ClusterUpdateMessage struct {
	Operation ClusterUpdateOperation
	Name      string
	OldName   string
}

type ClusterUpdateOperation

type ClusterUpdateOperation string
const (
	ClusterUpdateOperationCreate ClusterUpdateOperation = "create"
	ClusterUpdateOperationDelete ClusterUpdateOperation = "delete"
	ClusterUpdateOperationRename ClusterUpdateOperation = "rename"
)

type Clusters

type Clusters []Cluster

type CommitFunc

type CommitFunc func() error

type Endpoint

type Endpoint interface {
	GetConnectionURL() string
	GetCertificate() string
	GetServerName() (string, error)
}

type Endpoints

type Endpoints interface {
	GetEndpoints() iter.Seq[Endpoint]
}

type ExprApiApplicationVersionData added in v0.2.2

type ExprApiApplicationVersionData struct {
	Name             string  `json:"name" yaml:"name" expr:"name"`
	Version          string  `json:"version" yaml:"version" expr:"version"`
	AvailableVersion *string `json:"available_version,omitempty" yaml:"available_version,omitempty" expr:"available_version"`
	NeedsUpdate      *bool   `json:"needs_update,omitempty" yaml:"needs_update,omitempty" expr:"needs_update"`
	InMaintenance    bool    `json:"in_maintenance" yaml:"in_maintenance" expr:"in_maintenance"`
}

func ToExprApiApplicationVersionData added in v0.2.2

func ToExprApiApplicationVersionData(a api.ApplicationVersionData) ExprApiApplicationVersionData

type ExprApiOSData

type ExprApiOSData struct {
	Network  ExprOsapiSystemNetwork  `json:"network" yaml:"network" expr:"network"`
	Security ExprOsapiSystemSecurity `json:"security" yaml:"security" expr:"security"`
	Storage  ExprOsapiSystemStorage  `json:"storage" yaml:"storage" expr:"storage"`
}

func ToExprApiOSData

func ToExprApiOSData(o api.OSData) ExprApiOSData

type ExprApiOSVersionData added in v0.2.2

type ExprApiOSVersionData struct {
	Name             string  `json:"name" yaml:"name" expr:"name"`
	Version          string  `json:"version" yaml:"version" expr:"version"`
	VersionNext      string  `json:"version_next" yaml:"version_next" expr:"version_next"`
	AvailableVersion *string `json:"available_version,omitempty" yaml:"available_version,omitempty" expr:"available_version"`
	NeedsReboot      bool    `json:"needs_reboot" yaml:"needs_reboot" expr:"needs_reboot"`
	NeedsUpdate      *bool   `json:"needs_update,omitempty" yaml:"needs_update,omitempty" expr:"needs_update"`
}

func ToExprApiOSVersionData added in v0.2.2

func ToExprApiOSVersionData(o api.OSVersionData) ExprApiOSVersionData

type ExprApiServerVersionData added in v0.2.2

type ExprApiServerVersionData struct {
	OS            ExprApiOSVersionData            `json:"os" yaml:"os" expr:"os"`
	Applications  []ExprApiApplicationVersionData `json:"applications" yaml:"applications" expr:"applications"`
	UpdateChannel string                          `json:"update_channel" yaml:"update_channel" expr:"update_channel"`
	NeedsUpdate   *bool                           `json:"needs_update,omitempty" yaml:"needs_update" expr:"needs_update"`
	NeedsReboot   *bool                           `json:"needs_reboot,omitempty" yaml:"needs_reboot" expr:"needs_reboot"`
	InMaintenance *bool                           `json:"in_maintenance,omitempty" yaml:"in_maintenance" expr:"in_maintenance"`
}

func ToExprApiServerVersionData added in v0.2.2

func ToExprApiServerVersionData(s api.ServerVersionData) ExprApiServerVersionData

type ExprChannel added in v0.3.0

type ExprChannel struct {
	ID          int64     `json:"-" expr:"-"`
	Name        string    `json:"name" db:"primary=yes" expr:"name"`
	Description string    `json:"description" expr:"description"`
	LastUpdated time.Time `json:"-" expr:"last_updated" db:"update_timestamp"`
}

func ToExprChannel added in v0.3.0

func ToExprChannel(c Channel) ExprChannel

type ExprCluster

type ExprCluster struct {
	ID                    int64             `json:"-" expr:"-"`
	Name                  string            `json:"name"                    db:"primary=yes" expr:"name"`
	ConnectionURL         string            `json:"connection_url" expr:"connection_url"`
	Certificate           *string           `json:"certificate" expr:"certificate"`
	Fingerprint           string            `json:"fingerprint"             db:"ignore" expr:"fingerprint"`
	Status                api.ClusterStatus `json:"status" expr:"status"`
	ServerNames           []string          `json:"server_names"            db:"ignore" expr:"server_names"`
	ServerType            api.ServerType    `json:"server_type"             db:"ignore" expr:"server_type"`
	ServicesConfig        map[string]any    `json:"services_config"         db:"ignore" expr:"services_config"`
	ApplicationSeedConfig map[string]any    `json:"application_seed_config" db:"ignore" expr:"application_seed_config"`
	Channel               string            `json:"channel"                 db:"join=channels.name" expr:"channel"`
	LastUpdated           time.Time         `json:"last_updated"            db:"update_timestamp" expr:"last_updated"`
}

func ToExprCluster

func ToExprCluster(c Cluster) ExprCluster

type ExprOsapiSystemNetwork

type ExprOsapiSystemNetwork struct {
	Config *ExprOsapiSystemNetworkConfig `json:"config" yaml:"config" expr:"config"`
	State  ExprOsapiSystemNetworkState   `incusos:"-" json:"state" yaml:"state" expr:"state"`
}

func ToExprOsapiSystemNetwork

func ToExprOsapiSystemNetwork(s osapi.SystemNetwork) ExprOsapiSystemNetwork

type ExprOsapiSystemNetworkBond

type ExprOsapiSystemNetworkBond struct {
	Addresses         []string                             `json:"addresses,omitempty"           yaml:"addresses,omitempty" expr:"addresses"`
	Ethernet          *ExprOsapiSystemNetworkEthernet      `json:"ethernet,omitempty"            yaml:"ethernet,omitempty" expr:"ethernet"`
	FirewallRules     []ExprOsapiSystemNetworkFirewallRule `json:"firewall_rules,omitempty"      yaml:"firewall_rules,omitempty" expr:"firewall_rules"`
	Hwaddr            string                               `json:"hwaddr,omitempty"              yaml:"hwaddr,omitempty" expr:"hwaddr"`
	LLDP              bool                                 `json:"lldp,omitempty"                yaml:"lldp,omitempty" expr:"lldp"`
	Members           []string                             `json:"members,omitempty"             yaml:"members,omitempty" expr:"members"`
	Mode              string                               `json:"mode"                          yaml:"mode" expr:"mode"`
	MTU               int                                  `json:"mtu,omitempty"                 yaml:"mtu,omitempty" expr:"mtu"`
	Name              string                               `json:"name"                          yaml:"name" expr:"name"`
	RequiredForOnline string                               `json:"required_for_online,omitempty" yaml:"required_for_online,omitempty" expr:"required_for_online"`
	Roles             []string                             `json:"roles,omitempty"               yaml:"roles,omitempty" expr:"roles"`
	Routes            []ExprOsapiSystemNetworkRoute        `json:"routes,omitempty"              yaml:"routes,omitempty" expr:"routes"`
	VLANTags          []int                                `json:"vlan_tags,omitempty"           yaml:"vlan_tags,omitempty" expr:"vlan_tags"`
}

type ExprOsapiSystemNetworkConfig

type ExprOsapiSystemNetworkConfig struct {
	DNS        *ExprOsapiSystemNetworkDNS        `json:"dns,omitempty"   yaml:"dns,omitempty" expr:"dns"`
	Time       *ExprOsapiSystemNetworkTime       `json:"time,omitempty"  yaml:"time,omitempty" expr:"time"`
	Proxy      *ExprOsapiSystemNetworkProxy      `json:"proxy,omitempty" yaml:"proxy,omitempty" expr:"proxy"`
	Interfaces []ExprOsapiSystemNetworkInterface `json:"interfaces,omitempty" yaml:"interfaces,omitempty" expr:"interfaces"`
	Bonds      []ExprOsapiSystemNetworkBond      `json:"bonds,omitempty"      yaml:"bonds,omitempty" expr:"bonds"`
	VLANs      []ExprOsapiSystemNetworkVLAN      `json:"vlans,omitempty"      yaml:"vlans,omitempty" expr:"vlans"`
	Wireguard  []ExprOsapiSystemNetworkWireguard `json:"wireguard,omitempty"  yaml:"wireguard,omitempty" expr:"wireguard"`
}

type ExprOsapiSystemNetworkDNS

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

type ExprOsapiSystemNetworkEthernet added in v0.2.0

type ExprOsapiSystemNetworkEthernet struct {
	DisableEnergyEfficient bool     `json:"disable_energy_efficient,omitempty" yaml:"disable_energy_efficient,omitempty" expr:"disable_energy_efficient"`
	DisableGRO             bool     `json:"disable_gro,omitempty"              yaml:"disable_gro,omitempty" expr:"disable_gro"`
	DisableGSO             bool     `json:"disable_gso,omitempty"              yaml:"disable_gso,omitempty" expr:"disable_gso"`
	DisableIPv4TSO         bool     `json:"disable_ipv4_tso,omitempty"         yaml:"disable_ipv4_tso,omitempty" expr:"disable_ipv4_tso"`
	DisableIPv6TSO         bool     `json:"disable_ipv6_tso,omitempty"         yaml:"disable_ipv6_tso,omitempty" expr:"disable_ipv6_tso"`
	WakeOnLAN              bool     `json:"wakeonlan,omitempty"                yaml:"wakeonlan,omitempty" expr:"wakeonlan"`
	WakeOnLANModes         []string `json:"wakeonlan_modes,omitempty"          yaml:"wakeonlan_modes,omitempty" expr:"wakeonlan_modes"`
	WakeOnLANPassword      string   `json:"wakeonlan_password,omitempty"       yaml:"wakeonlan_password,omitempty" expr:"wakeonlan_password"`
}

func ToExprOsapiSystemNetworkEthernet added in v0.2.0

func ToExprOsapiSystemNetworkEthernet(s osapi.SystemNetworkEthernet) ExprOsapiSystemNetworkEthernet

type ExprOsapiSystemNetworkFirewallRule added in v0.1.1

type ExprOsapiSystemNetworkFirewallRule struct {
	Action   string `json:"action"             yaml:"action" expr:"action"`
	Source   string `json:"source,omitempty"   yaml:"source,omitempty" expr:"source"`
	Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty" expr:"protocol"`
	Port     int    `json:"port,omitempty"     yaml:"port,omitempty" expr:"port"`
}

func ToExprOsapiSystemNetworkFirewallRule added in v0.1.1

func ToExprOsapiSystemNetworkFirewallRule(s osapi.SystemNetworkFirewallRule) ExprOsapiSystemNetworkFirewallRule

type ExprOsapiSystemNetworkInterface

type ExprOsapiSystemNetworkInterface struct {
	Addresses         []string                             `json:"addresses,omitempty"           yaml:"addresses,omitempty" expr:"addresses"`
	Ethernet          *ExprOsapiSystemNetworkEthernet      `json:"ethernet,omitempty"            yaml:"ethernet,omitempty" expr:"ethernet"`
	FirewallRules     []ExprOsapiSystemNetworkFirewallRule `json:"firewall_rules,omitempty"      yaml:"firewall_rules,omitempty" expr:"firewall_rules"`
	Hwaddr            string                               `json:"hwaddr"                        yaml:"hwaddr" expr:"hwaddr"`
	LLDP              bool                                 `json:"lldp,omitempty"                yaml:"lldp,omitempty" expr:"lldp"`
	MTU               int                                  `json:"mtu,omitempty"                 yaml:"mtu,omitempty" expr:"mtu"`
	Name              string                               `json:"name"                          yaml:"name" expr:"name"`
	RequiredForOnline string                               `json:"required_for_online,omitempty" yaml:"required_for_online,omitempty" expr:"required_for_online"`
	Roles             []string                             `json:"roles,omitempty"               yaml:"roles,omitempty" expr:"roles"`
	Routes            []ExprOsapiSystemNetworkRoute        `json:"routes,omitempty"              yaml:"routes,omitempty" expr:"routes"`
	StrictHwaddr      bool                                 `json:"strict_hwaddr,omitempty"       yaml:"strict_hwaddr,omitempty" expr:"strict_hwaddr"`
	VLANTags          []int                                `json:"vlan_tags,omitempty"           yaml:"vlan_tags,omitempty" expr:"vlan_tags"`
}

type ExprOsapiSystemNetworkInterfaceState

type ExprOsapiSystemNetworkInterfaceState struct {
	Addresses []string                                        `json:"addresses,omitempty" yaml:"addresses,omitempty" expr:"addresses"`
	Hwaddr    string                                          `json:"hwaddr,omitempty"    yaml:"hwaddr,omitempty" expr:"hwaddr"`
	LACP      *ExprOsapiSystemNetworkLACPState                `json:"lacp,omitempty"      yaml:"lacp,omitempty" expr:"lacp"`
	LLDP      []ExprOsapiSystemNetworkLLDPState               `json:"lldp,omitempty"      yaml:"lldp,omitempty" expr:"lldp"`
	Members   map[string]ExprOsapiSystemNetworkInterfaceState `json:"members,omitempty"   yaml:"members,omitempty" expr:"members"`
	MTU       int                                             `json:"mtu,omitempty"       yaml:"mtu,omitempty" expr:"mtu"`
	Roles     []string                                        `json:"roles,omitempty"     yaml:"roles,omitempty" expr:"roles"`
	Routes    []ExprOsapiSystemNetworkRoute                   `json:"routes,omitempty"    yaml:"routes,omitempty" expr:"routes"`
	Speed     string                                          `json:"speed,omitempty"     yaml:"speed,omitempty" expr:"speed"`
	State     string                                          `json:"state"               yaml:"state" expr:"state"`
	Stats     ExprOsapiSystemNetworkInterfaceStats            `json:"stats"               yaml:"stats" expr:"stats"`
	Type      string                                          `json:"type,omitempty"      yaml:"type,omitempty" expr:"type"`
	Wireguard *ExprOsapiSystemNetworkWireguardState           `json:"wireguard,omitempty" yaml:"wireguard,omitempty" expr:"wireguard"`
}

type ExprOsapiSystemNetworkInterfaceStats

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

type ExprOsapiSystemNetworkLACPState

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

type ExprOsapiSystemNetworkLLDPState

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

type ExprOsapiSystemNetworkProxy

type ExprOsapiSystemNetworkProxy struct {
	Rules   []ExprOsapiSystemNetworkProxyRule            `json:"rules,omitempty"   yaml:"rules,omitempty" expr:"rules"`
	Servers map[string]ExprOsapiSystemNetworkProxyServer `json:"servers,omitempty" yaml:"servers,omitempty" expr:"servers"`
}

type ExprOsapiSystemNetworkProxyRule

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

type ExprOsapiSystemNetworkProxyServer

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

type ExprOsapiSystemNetworkRoute

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

type ExprOsapiSystemNetworkState

type ExprOsapiSystemNetworkState struct {
	Interfaces map[string]ExprOsapiSystemNetworkInterfaceState `json:"interfaces" yaml:"interfaces" expr:"interfaces"`
}

type ExprOsapiSystemNetworkTime

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

type ExprOsapiSystemNetworkVLAN

type ExprOsapiSystemNetworkVLAN struct {
	Addresses         []string                             `json:"addresses,omitempty"           yaml:"addresses,omitempty" expr:"addresses"`
	FirewallRules     []ExprOsapiSystemNetworkFirewallRule `json:"firewall_rules,omitempty"      yaml:"firewall_rules,omitempty" expr:"firewall_rules"`
	ID                int                                  `json:"id"                            yaml:"id" expr:"id"`
	MTU               int                                  `json:"mtu,omitempty"                 yaml:"mtu,omitempty" expr:"mtu"`
	Name              string                               `json:"name"                          yaml:"name" expr:"name"`
	Parent            string                               `json:"parent"                        yaml:"parent" expr:"parent"`
	RequiredForOnline string                               `json:"required_for_online,omitempty" yaml:"required_for_online,omitempty" expr:"required_for_online"`
	Roles             []string                             `json:"roles,omitempty"               yaml:"roles,omitempty" expr:"roles"`
	Routes            []ExprOsapiSystemNetworkRoute        `json:"routes,omitempty"              yaml:"routes,omitempty" expr:"routes"`
}

type ExprOsapiSystemNetworkWireguard added in v0.2.0

type ExprOsapiSystemNetworkWireguard struct {
	Addresses         []string                              `json:"addresses,omitempty"           yaml:"addresses,omitempty" expr:"addresses"`
	FirewallRules     []ExprOsapiSystemNetworkFirewallRule  `json:"firewall_rules,omitempty"      yaml:"firewall_rules,omitempty" expr:"firewall_rules"`
	MTU               int                                   `json:"mtu,omitempty"                 yaml:"mtu,omitempty" expr:"mtu"`
	Name              string                                `json:"name"                          yaml:"name" expr:"name"`
	Peers             []ExprOsapiSystemNetworkWireguardPeer `json:"peers,omitempty"               yaml:"peers,omitempty" expr:"peers"`
	Port              int                                   `json:"port,omitempty"                yaml:"port,omitempty" expr:"port"`
	PrivateKey        string                                `json:"private_key,omitempty"         yaml:"private_key,omitempty" expr:"private_key"`
	RequiredForOnline string                                `json:"required_for_online,omitempty" yaml:"required_for_online,omitempty" expr:"required_for_online"`
	Roles             []string                              `json:"roles,omitempty"               yaml:"roles,omitempty" expr:"roles"`
	Routes            []ExprOsapiSystemNetworkRoute         `json:"routes,omitempty"              yaml:"routes,omitempty" expr:"routes"`
}

func ToExprOsapiSystemNetworkWireguard added in v0.2.0

func ToExprOsapiSystemNetworkWireguard(s osapi.SystemNetworkWireguard) ExprOsapiSystemNetworkWireguard

type ExprOsapiSystemNetworkWireguardPeer added in v0.2.0

type ExprOsapiSystemNetworkWireguardPeer struct {
	AllowedIPs          []string `json:"allowed_ips"                    yaml:"allowed_ips" expr:"allowed_ips"`
	Endpoint            string   `json:"endpoint,omitempty"             yaml:"endpoint,omitempty" expr:"endpoint"`
	PersistentKeepalive int      `json:"persistent_keepalive,omitempty" yaml:"persistent_keepalive,omitempty" expr:"persistent_keepalive"`
	PresharedKey        string   `json:"preshared_key,omitempty"        yaml:"preshared_key,omitempty" expr:"preshared_key"`
	PublicKey           string   `json:"public_key"                     yaml:"public_key" expr:"public_key"`
}

func ToExprOsapiSystemNetworkWireguardPeer added in v0.2.0

func ToExprOsapiSystemNetworkWireguardPeer(s osapi.SystemNetworkWireguardPeer) ExprOsapiSystemNetworkWireguardPeer

type ExprOsapiSystemNetworkWireguardPeerState added in v0.2.0

type ExprOsapiSystemNetworkWireguardPeerState struct {
	AllowedIPs          []string                             `json:"allowed_ips"                    yaml:"allowed_ips" expr:"allowed_ips"`
	EndPoint            string                               `json:"endpoint"                       yaml:"endpoint" expr:"endpoint"`
	LatestHandshake     string                               `json:"latest_handshake,omitempty"     yaml:"latest_handshake,omitempty" expr:"latest_handshake"`
	PersistentKeepalive string                               `json:"persistent_keepalive,omitempty" yaml:"persistent_keepalive,omitempty" expr:"persistent_keepalive"`
	PublicKey           string                               `json:"public_key"                     yaml:"public_key" expr:"public_key"`
	Stats               ExprOsapiSystemNetworkInterfaceStats `json:"stats"                          yaml:"stats" expr:"stats"`
}

type ExprOsapiSystemNetworkWireguardState added in v0.2.0

type ExprOsapiSystemNetworkWireguardState struct {
	ListeningPort int                                        `json:"listening_port,omitempty" yaml:"listening_port,omitempty" expr:"listening_port"`
	Peers         []ExprOsapiSystemNetworkWireguardPeerState `json:"peers,omitempty"          yaml:"peers,omitempty" expr:"peers"`
	PublicKey     string                                     `json:"public_key"               yaml:"public_key" expr:"public_key"`
}

func ToExprOsapiSystemNetworkWireguardState added in v0.2.0

func ToExprOsapiSystemNetworkWireguardState(s osapi.SystemNetworkWireguardState) ExprOsapiSystemNetworkWireguardState

type ExprOsapiSystemSecurity

type ExprOsapiSystemSecurity struct {
	Config ExprOsapiSystemSecurityConfig `json:"config" yaml:"config" expr:"config"`
	State  ExprOsapiSystemSecurityState  `json:"state" yaml:"state" expr:"state"`
}

type ExprOsapiSystemSecurityConfig

type ExprOsapiSystemSecurityConfig struct {
	CustomCACerts          []string `json:"custom_ca_certs,omitempty" yaml:"custom_ca_certs,omitempty" expr:"custom_ca_certs"`
	EncryptionRecoveryKeys []string `json:"encryption_recovery_keys"  yaml:"encryption_recovery_keys" expr:"encryption_recovery_keys"`
}

type ExprOsapiSystemSecurityEncryptedVolume

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

type ExprOsapiSystemSecuritySecureBootCertificate

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

type ExprOsapiSystemSecurityState

type ExprOsapiSystemSecurityState struct {
	EncryptedVolumes                []ExprOsapiSystemSecurityEncryptedVolume       `` /* 133-byte string literal not displayed */
	EncryptionRecoveryKeysRetrieved bool                                           `json:"encryption_recovery_keys_retrieved" yaml:"encryption_recovery_keys_retrieved" expr:"encryption_recovery_keys_retrieved"`
	DriveRecoveryKeys               map[string]string                              `` /* 137-byte string literal not displayed */
	PoolRecoveryKeys                map[string]string                              `` /* 135-byte string literal not displayed */
	SecureBootCertificates          []ExprOsapiSystemSecuritySecureBootCertificate `` /* 147-byte string literal not displayed */
	SecureBootEnabled               bool                                           `` /* 137-byte string literal not displayed */
	SystemStateIsTrusted            bool                                           `` /* 145-byte string literal not displayed */
	TPMStatus                       string                                         `incusos:"-"                               json:"tpm_status"                         yaml:"tpm_status" expr:"tpm_status"`
}

type ExprOsapiSystemStorage

type ExprOsapiSystemStorage struct {
	Config ExprOsapiSystemStorageConfig `json:"config" yaml:"config" expr:"config"`
	State  ExprOsapiSystemStorageState  `incusos:"-" json:"state" yaml:"state" expr:"state"`
}

func ToExprOsapiSystemStorage

func ToExprOsapiSystemStorage(s osapi.SystemStorage) ExprOsapiSystemStorage

type ExprOsapiSystemStorageConfig

type ExprOsapiSystemStorageConfig struct {
	ScrubSchedule string                       `json:"scrub_schedule" yaml:"scrub_schedule" expr:"scrub_schedule"`
	Pools         []ExprOsapiSystemStoragePool `incusos:"-"           json:"pools,omitempty" yaml:"pools,omitempty" expr:"pools"`
}

type ExprOsapiSystemStorageDrive

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

type ExprOsapiSystemStorageDriveSMART

type ExprOsapiSystemStorageDriveSMART struct {
	Enabled            bool   `json:"enabled"         yaml:"enabled" expr:"enabled"`
	Passed             bool   `json:"passed"          yaml:"passed" expr:"passed"`
	Error              string `json:"error,omitempty" yaml:"error,omitempty" expr:"error"`
	PowerOnHours       int    `json:"power_on_hours,omitempty"      yaml:"power_on_hours,omitempty" expr:"power_on_hours"`
	DataUnitsRead      int    `json:"data_units_read,omitempty"     yaml:"data_units_read,omitempty" expr:"data_units_read"`
	DataUnitsWritten   int    `json:"data_units_written,omitempty"  yaml:"data_units_written,omitempty" expr:"data_units_written"`
	AvailableSpare     int    `json:"available_spare,omitempty"     yaml:"available_spare,omitempty" expr:"available_spare"`
	PercentageUsed     int    `json:"percentage_used,omitempty"     yaml:"percentage_used,omitempty" expr:"percentage_used"`
	RawReadErrorRate   int    `json:"raw_read_error_rate,omitempty" yaml:"raw_read_error_rate,omitempty" expr:"raw_read_error_rate"`
	SeekErrorRate      int    `json:"seek_error_rate,omitempty"     yaml:"seek_error_rate,omitempty" expr:"seek_error_rate"`
	ReallocatedSectors int    `json:"reallocated_sectors,omitempty" yaml:"reallocated_sectors,omitempty" expr:"reallocated_sectors"`
}

type ExprOsapiSystemStoragePool

type ExprOsapiSystemStoragePool struct {
	Name                      string                                 `json:"name" yaml:"name" expr:"name"`
	Type                      string                                 `json:"type" yaml:"type" expr:"type"`
	Devices                   []string                               `json:"devices"         yaml:"devices" expr:"devices"`
	Cache                     []string                               `json:"cache,omitempty" yaml:"cache,omitempty" expr:"cache"`
	Log                       []string                               `json:"log,omitempty"   yaml:"log,omitempty" expr:"log"`
	State                     string                                 `json:"state"                         yaml:"state" expr:"state"`
	LastScrub                 *ExprOsapiSystemStoragePoolScrubStatus `json:"last_scrub,omitempty"          yaml:"last_scrub,omitempty,omitempty" expr:"last_scrub"`
	EncryptionKeyStatus       string                                 `json:"encryption_key_status"         yaml:"encryption_key_status" expr:"encryption_key_status"`
	DevicesDegraded           []string                               `json:"devices_degraded,omitempty"    yaml:"devices_degraded,omitempty" expr:"devices_degraded"`
	CacheDegraded             []string                               `json:"cache_degraded,omitempty"      yaml:"cache_degraded,omitempty" expr:"cache_degraded"`
	LogDegraded               []string                               `json:"log_degraded,omitempty"        yaml:"log_degraded,omitempty" expr:"log_degraded"`
	RawPoolSizeInBytes        int                                    `json:"raw_pool_size_in_bytes"        yaml:"raw_pool_size_in_bytes" expr:"raw_pool_size_in_bytes"`
	UsablePoolSizeInBytes     int                                    `json:"usable_pool_size_in_bytes"     yaml:"usable_pool_size_in_bytes" expr:"usable_pool_size_in_bytes"`
	PoolAllocatedSpaceInBytes int                                    `json:"pool_allocated_space_in_bytes" yaml:"pool_allocated_space_in_bytes" expr:"pool_allocated_space_in_bytes"`
	Volumes                   []ExprOsapiSystemStoragePoolVolume     `json:"volumes"                       yaml:"volumes" expr:"volumes"`
}

type ExprOsapiSystemStoragePoolScrubStatus added in v0.2.0

type ExprOsapiSystemStoragePoolScrubStatus struct {
	State     osapi.SystemStoragePoolScrubState `json:"state" expr:"state"`
	StartTime time.Time                         `json:"start_time" expr:"start_time"`
	EndTime   time.Time                         `json:"end_time" expr:"end_time"`
	Progress  string                            `json:"progress" expr:"progress"`
	Errors    int                               `json:"errors" expr:"errors"`
}

func ToExprOsapiSystemStoragePoolScrubStatus added in v0.2.0

func ToExprOsapiSystemStoragePoolScrubStatus(s osapi.SystemStoragePoolScrubStatus) ExprOsapiSystemStoragePoolScrubStatus

type ExprOsapiSystemStoragePoolVolume

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

type ExprOsapiSystemStorageState

type ExprOsapiSystemStorageState struct {
	Drives []ExprOsapiSystemStorageDrive `json:"drives" yaml:"drives" expr:"drives"`
	Pools  []ExprOsapiSystemStoragePool  `json:"pools"  yaml:"pools" expr:"pools"`
}

type ExprServer

type ExprServer struct {
	ID                   int64                    `json:"-" expr:"-"`
	Cluster              *string                  `json:"cluster"                db:"leftjoin=clusters.name" expr:"cluster"`
	Name                 string                   `json:"name"                   db:"primary=yes" expr:"name"`
	Type                 api.ServerType           `json:"type" expr:"type"`
	ConnectionURL        string                   `json:"connection_url" expr:"connection_url"`
	PublicConnectionURL  string                   `json:"public_connection_url" expr:"public_connection_url"`
	Certificate          string                   `json:"certificate" expr:"certificate"`
	Fingerprint          string                   `json:"fingerprint"            db:"ignore" expr:"fingerprint"`
	ClusterCertificate   *string                  `json:"cluster_certificate"    db:"omit=create,update&leftjoin=clusters.certificate" expr:"cluster_certificate"`
	ClusterConnectionURL *string                  `json:"cluster_connection_url" db:"omit=create,update&leftjoin=clusters.connection_url" expr:"cluster_connection_url"`
	HardwareData         api.HardwareData         `json:"hardware_data" expr:"hardware_data"`
	OSData               ExprApiOSData            `json:"os_data" expr:"os_data"`
	VersionData          ExprApiServerVersionData `json:"version_data" expr:"version_data"`
	Channel              string                   `json:"channel"                db:"join=channels.name" expr:"channel"`
	Status               api.ServerStatus         `json:"status" expr:"status"`
	LastUpdated          time.Time                `json:"last_updated"           db:"update_timestamp" expr:"last_updated"`
	LastSeen             time.Time                `json:"last_seen" expr:"last_seen"`
}

func ToExprServer

func ToExprServer(s Server) ExprServer

type ExprUpdate

type ExprUpdate struct {
	ID               int                    `json:"-" expr:"-"`
	UUID             uuid.UUID              `json:"-" expr:"uuid" db:"primary=yes"`
	Format           string                 `json:"format" db:"ignore" expr:"format"`
	Origin           string                 `json:"origin" expr:"origin"`
	Version          string                 `json:"version" expr:"version"`
	PublishedAt      time.Time              `json:"published_at" expr:"published_at"`
	Severity         images.UpdateSeverity  `json:"severity" expr:"severity"`
	Channels         []string               `json:"channels" db:"ignore" expr:"channels"`
	UpstreamChannels UpdateUpstreamChannels `json:"upstream_channels" expr:"upstream_channels"`
	Changelog        string                 `json:"-" expr:"change_log"`
	Files            UpdateFiles            `json:"files" expr:"files"`
	URL              string                 `json:"url" expr:"url"`
	Status           api.UpdateStatus       `json:"-" expr:"status"`
	LastUpdated      time.Time              `json:"-" expr:"last_updated" db:"update_timestamp"`
}

func ToExprUpdate

func ToExprUpdate(u Update) ExprUpdate

type FlasherPort

type FlasherPort interface {
	GetProviderConfig(ctx context.Context, tokenID uuid.UUID) (*api.TokenProviderConfig, error)
	GenerateSeededImage(ctx context.Context, id uuid.UUID, seedConfig TokenImageSeedConfigs, rc io.ReadCloser) (io.ReadCloser, error)
}

type InventorySyncer

type InventorySyncer interface {
	SyncCluster(ctx context.Context, clusterName string) error
	ResyncByName(ctx context.Context, clusterName string, sourceDetails domain.LifecycleEvent) error
}

type Server

type Server struct {
	ID                   int64                 `json:"-"`
	Cluster              *string               `json:"cluster"                db:"leftjoin=clusters.name"`
	Name                 string                `json:"name"                   db:"primary=yes"`
	Type                 api.ServerType        `json:"type"`
	ConnectionURL        string                `json:"connection_url"`
	PublicConnectionURL  string                `json:"public_connection_url"`
	Certificate          string                `json:"certificate"`
	Fingerprint          string                `json:"fingerprint"            db:"ignore"`
	ClusterCertificate   *string               `json:"cluster_certificate"    db:"omit=create,update&leftjoin=clusters.certificate"`
	ClusterConnectionURL *string               `json:"cluster_connection_url" db:"omit=create,update&leftjoin=clusters.connection_url"`
	HardwareData         api.HardwareData      `json:"hardware_data"`
	OSData               api.OSData            `json:"os_data"`
	VersionData          api.ServerVersionData `json:"version_data"`
	Channel              string                `json:"channel"                db:"join=channels.name"`
	Status               api.ServerStatus      `json:"status"`
	LastUpdated          time.Time             `json:"last_updated"           db:"update_timestamp"`
	LastSeen             time.Time             `json:"last_seen"`
}

func (Server) GetCertificate

func (s Server) GetCertificate() string

func (Server) GetConnectionURL

func (s Server) GetConnectionURL() string

func (Server) GetServerName

func (s Server) GetServerName() (string, error)

func (Server) Validate

func (s Server) Validate() error

type ServerClientPort

type ServerClientPort interface {
	Ping(ctx context.Context, endpoint Endpoint) error
	GetResources(ctx context.Context, endpoint Endpoint) (api.HardwareData, error)
	GetOSData(ctx context.Context, endpoint Endpoint) (api.OSData, error)
	GetVersionData(ctx context.Context, server Server) (api.ServerVersionData, error)
	GetServerType(ctx context.Context, endpoint Endpoint) (api.ServerType, error)
	UpdateNetworkConfig(ctx context.Context, server Server) error
	UpdateStorageConfig(ctx context.Context, server Server) error
	GetProviderConfig(ctx context.Context, server Server) (ServerSystemProvider, error)
	UpdateProviderConfig(ctx context.Context, server Server, providerConfig ServerSystemProvider) error
	GetUpdateConfig(ctx context.Context, server Server) (ServerSystemUpdate, error)
	UpdateUpdateConfig(ctx context.Context, server Server, providerConfig ServerSystemUpdate) error
	Evacuate(ctx context.Context, server Server) error
	Poweroff(ctx context.Context, server Server) error
	Reboot(ctx context.Context, server Server) error
	Restore(ctx context.Context, server Server) error
	UpdateOS(ctx context.Context, server Server) error
}

type ServerFilter

type ServerFilter struct {
	ID          *int
	Name        *string
	Cluster     *string
	Status      *api.ServerStatus
	Certificate *string
	Type        *api.ServerType
	Expression  *string `db:"ignore"`
}

func (ServerFilter) AppendToURLValues

func (f ServerFilter) AppendToURLValues(query url.Values) url.Values

func (ServerFilter) String

func (f ServerFilter) String() string

type ServerRepo

type ServerRepo interface {
	Create(ctx context.Context, server Server) (int64, error)
	GetAll(ctx context.Context) (Servers, error)
	GetAllWithFilter(ctx context.Context, filter ServerFilter) (Servers, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetAllNamesWithFilter(ctx context.Context, filter ServerFilter) ([]string, error)
	GetByName(ctx context.Context, name string) (*Server, error)
	GetByCertificate(ctx context.Context, certificatePEM string) (*Server, error)
	Update(ctx context.Context, server Server) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
}

type ServerSelfUpdate

type ServerSelfUpdate struct {
	ConnectionURL             string
	AuthenticationCertificate *x509.Certificate

	// Self is set to true, if the self update API has been called through
	// unix socket. This is the case, when IncusOS is serving Operations Center
	// and triggers a self update on its self.
	Self bool
}

type ServerService

type ServerService interface {
	SetClusterService(clusterSvc ClusterService)
	Create(ctx context.Context, token uuid.UUID, server Server) (Server, error)
	GetAll(ctx context.Context) (Servers, error)
	GetAllWithFilter(ctx context.Context, filter ServerFilter) (Servers, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetAllNamesWithFilter(ctx context.Context, filter ServerFilter) ([]string, error)
	GetByName(ctx context.Context, name string) (*Server, error)
	Update(ctx context.Context, server Server, force bool, updateSystem bool) error
	UpdateSystemNetwork(ctx context.Context, name string, networkConfig ServerSystemNetwork) error
	UpdateSystemStorage(ctx context.Context, name string, networkConfig ServerSystemStorage) error
	GetSystemProvider(ctx context.Context, name string) (ServerSystemProvider, error)
	UpdateSystemProvider(ctx context.Context, name string, providerConfig ServerSystemProvider) error
	GetSystemUpdate(ctx context.Context, name string) (ServerSystemUpdate, error)
	UpdateSystemUpdate(ctx context.Context, name string, updateConfig ServerSystemUpdate) error
	SelfUpdate(ctx context.Context, serverUpdate ServerSelfUpdate) error
	SelfRegisterOperationsCenter(ctx context.Context) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
	ResyncByName(ctx context.Context, clusterName string, event domain.LifecycleEvent) error
	SyncCluster(ctx context.Context, clusterName string) error

	PollServers(ctx context.Context, serverStatus api.ServerStatus, updateServerConfiguration bool) error
	PollServer(ctx context.Context, server Server, updateServerConfiguration bool) error

	EvacuateSystemByName(ctx context.Context, name string) error
	PoweroffSystemByName(ctx context.Context, name string) error
	RebootSystemByName(ctx context.Context, name string) error
	RestoreSystemByName(ctx context.Context, name string) error
	UpdateSystemByName(ctx context.Context, name string, updateRequest api.ServerUpdatePost) error
}

type ServerServiceOption

type ServerServiceOption func(s *serverService)

func ServerServiceWithInitialConnectionDelay

func ServerServiceWithInitialConnectionDelay(delay time.Duration) ServerServiceOption

func ServerServiceWithNow

func ServerServiceWithNow(nowFunc func() time.Time) ServerServiceOption

type ServerSystemNetwork

type ServerSystemNetwork = api.ServerSystemNetwork

type ServerSystemProvider

type ServerSystemProvider = api.ServerSystemProvider

type ServerSystemStorage added in v0.2.0

type ServerSystemStorage = api.ServerSystemStorage

type ServerSystemUpdate added in v0.3.0

type ServerSystemUpdate = api.ServerSystemUpdate

type Servers

type Servers []Server

type Token

type Token struct {
	ID            int64
	UUID          uuid.UUID `db:"primary=yes"`
	UsesRemaining int
	ExpireAt      time.Time
	Description   string
	Channel       string `db:"join=channels.name"`
	AutoRemove    bool
}

func (Token) Validate

func (t Token) Validate() error

type TokenImageSeedConfigs

type TokenImageSeedConfigs struct {
	Applications     map[string]any `json:"applications"`
	Incus            map[string]any `json:"incus"`
	Install          map[string]any `json:"install"`
	MigrationManager map[string]any `json:"migration_manager"`
	Network          map[string]any `json:"network"`
	OperationsCenter map[string]any `json:"operations_center"`
	Update           map[string]any `json:"update"`
}

func (*TokenImageSeedConfigs) Scan

func (t *TokenImageSeedConfigs) Scan(value any) error

Scan implements the sql.Scanner interface.

func (TokenImageSeedConfigs) Value

func (t TokenImageSeedConfigs) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

type TokenRepo

type TokenRepo interface {
	Create(ctx context.Context, token Token) (int64, error)
	GetAll(ctx context.Context) (Tokens, error)
	GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Token, error)
	Update(ctx context.Context, token Token) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
	CreateTokenSeed(ctx context.Context, seedConfig TokenSeed) (int64, error)
	GetTokenSeedAll(ctx context.Context, id uuid.UUID) (TokenSeeds, error)
	GetTokenSeedAllNames(ctx context.Context, id uuid.UUID) ([]string, error)
	GetTokenSeedByName(ctx context.Context, id uuid.UUID, name string) (*TokenSeed, error)
	UpdateTokenSeed(ctx context.Context, tokenSeedConfig TokenSeed) error
	DeleteTokenSeedByName(ctx context.Context, id uuid.UUID, name string) error
}

type TokenSeed

type TokenSeed struct {
	ID          int64
	Token       uuid.UUID `db:"primary=yes&join=tokens.uuid"`
	Name        string    `db:"primary=yes"`
	Description string
	Public      bool
	Seeds       TokenImageSeedConfigs
	LastUpdated time.Time `db:"update_timestamp"`
}

func (TokenSeed) Validate

func (t TokenSeed) Validate() error

type TokenSeeds

type TokenSeeds []TokenSeed

type TokenService

type TokenService interface {
	Create(ctx context.Context, token Token) (Token, error)
	GetAll(ctx context.Context) (Tokens, error)
	GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Token, error)
	Update(ctx context.Context, token Token) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
	Consume(ctx context.Context, id uuid.UUID) (channel string, _ error)
	PreparePreSeededImage(ctx context.Context, id uuid.UUID, imageType api.ImageType, architecture images.UpdateFileArchitecture, seedConfig TokenImageSeedConfigs) (uuid.UUID, error)
	GetPreSeededImage(ctx context.Context, id uuid.UUID, imageUUID uuid.UUID) (_ io.ReadCloser, filename string, _ error)
	GetTokenProviderConfig(ctx context.Context, id uuid.UUID) (*api.TokenProviderConfig, error)
	CreateTokenSeed(ctx context.Context, tokenSeedConfig TokenSeed) (TokenSeed, error)
	GetTokenSeedAll(ctx context.Context, id uuid.UUID) (TokenSeeds, error)
	GetTokenSeedAllNames(ctx context.Context, id uuid.UUID) ([]string, error)
	GetTokenSeedByName(ctx context.Context, id uuid.UUID, name string) (*TokenSeed, error)
	UpdateTokenSeed(ctx context.Context, tokenSeed TokenSeed) error
	DeleteTokenSeedByName(ctx context.Context, id uuid.UUID, name string) error
	GetTokenImageFromTokenSeed(ctx context.Context, id uuid.UUID, name string, imageType api.ImageType, architecture images.UpdateFileArchitecture, channel string) (io.ReadCloser, error)
}

type TokenServiceOption

type TokenServiceOption func(s *tokenService)

type Tokens

type Tokens []Token

type Update

type Update struct {
	ID               int                    `json:"-"`
	UUID             uuid.UUID              `json:"-" expr:"uuid" db:"primary=yes"`
	Format           string                 `json:"format" db:"ignore"`
	Origin           string                 `json:"origin"`
	Version          string                 `json:"version"`
	PublishedAt      time.Time              `json:"published_at"`
	Severity         images.UpdateSeverity  `json:"severity"`
	Channels         []string               `json:"channels" db:"ignore"`
	UpstreamChannels UpdateUpstreamChannels `json:"upstream_channels"`
	Changelog        string                 `json:"-" expr:"change_log"`
	Files            UpdateFiles            `json:"files"`
	URL              string                 `json:"url"`
	Status           api.UpdateStatus       `json:"-" expr:"status"`
	LastUpdated      time.Time              `json:"-" expr:"last_updated" db:"update_timestamp"`
}

func (Update) Components added in v0.3.0

func (u Update) Components() []images.UpdateFileComponent

func (Update) Validate

func (u Update) Validate() error

type UpdateFile

type UpdateFile struct {
	Filename     string                        `json:"filename"`
	Size         int                           `json:"size"`
	Sha256       string                        `json:"sha256"`
	Component    images.UpdateFileComponent    `json:"component"`
	Type         images.UpdateFileType         `json:"type"`
	Architecture images.UpdateFileArchitecture `json:"architecture"`
}

type UpdateFileExprEnv

type UpdateFileExprEnv struct {
	Filename     string `expr:"file_name"`
	Size         int    `expr:"size"`
	Sha256       string `expr:"sha256"`
	Component    string `expr:"component"`
	Type         string `expr:"type"`
	Architecture string `expr:"architecture"`
}

func UpdateFileExprEnvFrom

func UpdateFileExprEnvFrom(u UpdateFile) UpdateFileExprEnv

func (UpdateFileExprEnv) ExprCompileOptions

func (u UpdateFileExprEnv) ExprCompileOptions() []expr.Option

type UpdateFiles

type UpdateFiles []UpdateFile

func (*UpdateFiles) Scan

func (u *UpdateFiles) Scan(value any) error

Scan implements the sql.Scanner interface.

func (*UpdateFiles) UnmarshalJSON

func (u *UpdateFiles) UnmarshalJSON(data []byte) error

func (*UpdateFiles) UnmarshalText

func (u *UpdateFiles) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (UpdateFiles) Value

func (u UpdateFiles) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

type UpdateFilesRepo

type UpdateFilesRepo interface {
	Get(ctx context.Context, update Update, filename string) (_ io.ReadCloser, size int, _ error)
	Put(ctx context.Context, update Update, filename string, content io.ReadCloser) (CommitFunc, CancelFunc, error)
	Delete(ctx context.Context, update Update) error
	UsageInformation(ctx context.Context) (UsageInformation, error)
	CleanupAll(ctx context.Context) error
	CreateFromArchive(ctx context.Context, tarReader *tar.Reader) (*Update, error)
}

type UpdateFilter

type UpdateFilter struct {
	ID              *int
	UUID            *uuid.UUID
	Channel         *string `db:"ignore"`
	UpstreamChannel *string `db:"ignore"`
	Origin          *string
	Status          *api.UpdateStatus
}

func (UpdateFilter) AppendToURLValues

func (f UpdateFilter) AppendToURLValues(query url.Values) url.Values

func (UpdateFilter) String

func (f UpdateFilter) String() string

type UpdateRepo

type UpdateRepo interface {
	Upsert(ctx context.Context, update Update) error
	GetAll(ctx context.Context) (Updates, error)
	GetAllWithFilter(ctx context.Context, filter UpdateFilter) (Updates, error)
	GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)
	GetAllUUIDsWithFilter(ctx context.Context, filter UpdateFilter) ([]uuid.UUID, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Update, error)
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
	GetUpdatesByAssignedChannelName(ctx context.Context, name string, filter ...UpdateFilter) (Updates, error)
	AssignChannels(ctx context.Context, id uuid.UUID, channelNames []string) error
}

type UpdateService

type UpdateService interface {
	GetAll(ctx context.Context) (Updates, error)
	GetAllWithFilter(ctx context.Context, filter UpdateFilter) (Updates, error)
	GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)
	GetAllUUIDsWithFilter(ctx context.Context, filter UpdateFilter) ([]uuid.UUID, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Update, error)
	GetUpdatesByAssignedChannelName(ctx context.Context, channelName string) (Updates, error)
	Update(ctx context.Context, update Update) error

	// Files
	GetUpdateAllFiles(ctx context.Context, id uuid.UUID) (UpdateFiles, error)
	GetUpdateFileByFilename(ctx context.Context, id uuid.UUID, filename string) (io.ReadCloser, int, error)

	CreateFromArchive(ctx context.Context, tarReader *tar.Reader) (uuid.UUID, error)
	CleanupAll(ctx context.Context) error
	Prune(ctx context.Context) error
	Refresh(ctx context.Context) error
}

type UpdateServiceOption

type UpdateServiceOption func(service *updateService)

func UpdateServiceWithLatestLimit

func UpdateServiceWithLatestLimit(limit int) UpdateServiceOption

func UpdateServiceWithPendingGracePeriod

func UpdateServiceWithPendingGracePeriod(pendingGracePeriod time.Duration) UpdateServiceOption

type UpdateSourcePort

type UpdateSourcePort interface {
	GetLatest(ctx context.Context, limit int) (Updates, error)
	GetUpdateFileByFilenameUnverified(ctx context.Context, update Update, filename string) (io.ReadCloser, int, error)
}

A UpdateSourcePort is a source for updates (e.g. IncusOS or HypervisorOS).

type UpdateUpstreamChannels added in v0.3.0

type UpdateUpstreamChannels []string

func (*UpdateUpstreamChannels) Scan added in v0.3.0

func (c *UpdateUpstreamChannels) Scan(value any) error

Scan implements the sql.Scanner interface.

func (UpdateUpstreamChannels) Value added in v0.3.0

Value implements the sql driver.Valuer interface.

type Updates

type Updates []Update

func (Updates) Len

func (u Updates) Len() int

func (Updates) Less

func (u Updates) Less(i, j int) bool

func (Updates) Swap

func (u Updates) Swap(i, j int)

type UsageInformation

type UsageInformation struct {
	TotalSpaceBytes     uint64
	AvailableSpaceBytes uint64
	UsedSpaceBytes      uint64
}

Jump to

Keyboard shortcuts

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