api

package
v0.0.0-...-725261d Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// AuthenticationMethodTLS is the default authentication method for interacting with Incus remotely.
	AuthenticationMethodTLS = "tls"

	// AuthenticationMethodOIDC is a token based authentication method.
	AuthenticationMethodOIDC = "oidc"
)
View Source
const (
	APIVersion string = "1.0"
	APIStatus  string = "devel"
)

Variables

View Source
var ClusterStatuses = map[ClusterStatus]struct{}{
	ClusterStatusUnknown: {},
	ClusterStatusPending: {},
	ClusterStatusReady:   {},
}
View Source
var StatusCodeNames = map[StatusCode]string{
	Success: "Success",
	Failure: "Failure",
}

StatusCodeNames associates a status code to its name.

Functions

func StatusErrorCheck

func StatusErrorCheck(err error, matchStatusCodes ...int) bool

StatusErrorCheck returns whether or not err was caused by a StatusError and if it matches one of the optional status codes.

func StatusErrorMatch

func StatusErrorMatch(err error, matchStatusCodes ...int) (int, bool)

StatusErrorMatch checks if err was caused by StatusError. Can optionally also check whether the StatusError's status code matches one of the supplied status codes in matchStatus. Returns the matched StatusError status code and true if match criteria are met, otherwise false.

Types

type Architecture

type Architecture string
const (
	ArchitectureUndefined              Architecture = ""
	Architecture64BitIntelX86          Architecture = "x86_64"
	Architecture64BitARMV8LittleEndian Architecture = "aarch64"
)

func (Architecture) IsValid

func (u Architecture) IsValid() bool

func (Architecture) MarshalText

func (u Architecture) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Architecture) Scan

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

Scan implements the sql.Scanner interface.

func (Architecture) String

func (u Architecture) String() string

func (*Architecture) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Architecture) Value

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

Value implements the sql driver.Valuer interface.

type Cluster

type Cluster struct {
	// A human-friendly name for this cluster.
	// Example: MyCluster
	Name string `json:"name" yaml:"name"`

	// URL, hostname or IP address of the cluster endpoint.
	// This is only user facing, e.g. the address of a load balancer infront of
	// the cluster and not used by Operations Center for direct communication
	// Operations Center relies on the connection URL of the cluster members.
	// Example: https://incus.local:6443
	ConnectionURL string `json:"connection_url" yaml:"connection_url"`

	// Status contains the status the cluster is currently in from the point of view of Operations Center.
	// Possible values for status are: pending, ready
	// Example: pending
	Status ClusterStatus `json:"status" yaml:"status"`

	// LastUpdated is the time, when this information has been updated for the last time in RFC3339 format.
	// Example: 2024-11-12T16:15:00Z
	LastUpdated time.Time `json:"last_updated" yaml:"last_updated"`
}

Cluster defines a cluster of servers running Hypervisor OS.

swagger:model

type ClusterCertificatePut

type ClusterCertificatePut struct {
	// The new certificate (X509 PEM encoded) for the cluster.
	// Example: X509 PEM certificate
	ClusterCertificate string `json:"cluster_certificate" yaml:"cluster_certificate"`

	// The new certificate key (X509 PEM encoded) for the cluster.
	// Example: X509 PEM certificate key
	ClusterCertificateKey string `json:"cluster_certificate_key" yaml:"cluster_certificate_key"`
}

ClusterCertificatePut represents the certificate and key pair for all cluster members.

swagger:model

type ClusterPost

type ClusterPost struct {
	Cluster `yaml:",inline"`

	// Names of the servers beloning to the cluster.
	// Example: [ "server1", "server2" ]
	ServerNames []string `json:"server_names" yaml:"server_names"`

	// ServerType is the expected type of servers to be clustered.
	// Clustering will fail, if not all the servers are of the same type.
	ServerType ServerType `json:"server_type" yaml:"server_type"`

	// ServicesConfig contains the configuration for each service, which should be configured on Hypervisor OS.
	// Operations Center is simply passing forward the settings to Hypervisor OS.
	// For details about the configuration settings available refer to the service
	// API definitions in https://github.com/lxc/incus-os/tree/main/incus-osd/api.
	ServicesConfig map[string]any `json:"services_config" yaml:"services_config"`

	// ApplicationSeedConfig contains the seed configuration for the application, which is
	// applied during post clustering. This configuration is application specific.
	ApplicationSeedConfig map[string]any `json:"application_seed_config" yaml:"application_seed_config"`
}

ClusterPost represents the fields available for a new cluster of servers running Hypervisor OS.

swagger:model

type ClusterStatus

type ClusterStatus string
const (
	ClusterStatusUnknown ClusterStatus = "unknown"
	ClusterStatusPending ClusterStatus = "pending"
	ClusterStatusReady   ClusterStatus = "ready"
)

func (ClusterStatus) MarshalText

func (s ClusterStatus) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*ClusterStatus) Scan

func (s *ClusterStatus) Scan(value any) error

Scan implements the sql.Scanner interface.

func (ClusterStatus) String

func (s ClusterStatus) String() string

func (*ClusterStatus) UnmarshalText

func (s *ClusterStatus) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (ClusterStatus) Value

func (s ClusterStatus) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

type ClusterTemplate

type ClusterTemplate struct {
	ClusterTemplatePost `yaml:",inline"`

	// LastUpdated is the time, when this information has been updated for the last time in RFC3339 format.
	// Example: 2024-11-12T16:15:00Z
	LastUpdated time.Time `json:"last_updated" yaml:"last_updated"`
}

ClusterTemplate defines a template, which can be used to form a cluster of servers running Hypervisor OS.

swagger:model

type ClusterTemplatePost

type ClusterTemplatePost struct {
	ClusterTemplatePut `yaml:",inline"`

	// A human-friendly name for this cluster config template.
	// Example: MyTemplate
	Name string `json:"name" yaml:"name"`
}

ClusterTemplatePost defines a template, which can be used to form a cluster of servers running Hypervisor OS.

swagger:model

type ClusterTemplatePut

type ClusterTemplatePut struct {
	// Description of the cluster config template.
	// Example: Cluster configuration for production clusters.
	Description string `json:"description" yaml:"description"`

	// ServiceConfigTemplate represents a template the service config for cluster
	// creation.
	// It contains contains the configuration for each service, which should be
	// configured on Hypervisor OS.
	// Operations Center is simply passing forward the settings to Hypervisor OS.
	// For details about the configuration settings available refer to the service
	// API definitions in https://github.com/lxc/incus-os/tree/main/incus-osd/api.
	ServiceConfigTemplate string `json:"service_config_template" yaml:"service_config_template"`

	// ApplicationConfigTemplate represents a template for the application config
	// for cluster creation.
	// It contains the seed configuration for the application, which is
	// applied during post clustering. This configuration is application specific.
	ApplicationConfigTemplate string `json:"application_config_template" yaml:"application_config_template"`

	// Variables is a map of variable names to variable definitions.
	Variables ClusterTemplateVariables `json:"variables" yaml:"variables"`
}

ClusterTemplatePut represents the fields available for update.

swagger:model

type ClusterTemplateVariable

type ClusterTemplateVariable struct {
	// Description describes a cluster config template variable.
	// Example: Long name for the cluster.
	Description string `json:"description" yaml:"description"`

	// DefaultValue is the default value applied for a cluster config variable
	// if no value is provided for the variable.
	// Example: Incus cluster
	DefaultValue string `json:"default" yaml:"default"`
}

ClusterTemplateVariable defines the properties of a variable, that can be used in a cluster config template.

type ClusterTemplateVariables

type ClusterTemplateVariables map[string]ClusterTemplateVariable

ClusterTemplateVariables defines the variables, that can be used in a cluster config template.

func (*ClusterTemplateVariables) Scan

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

Scan implements the sql.Scanner interface.

func (ClusterTemplateVariables) Value

Value implements the sql driver.Valuer interface.

type HardwareData

type HardwareData struct {
	incusapi.Resources
}

func (*HardwareData) Scan

func (h *HardwareData) Scan(value any) error

Scan implements the sql.Scanner interface.

func (HardwareData) Value

func (h HardwareData) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

type Image

type Image struct {
	UUID        uuid.UUID      `json:"uuid" yaml:"uuid"`
	Cluster     string         `json:"cluster" yaml:"cluster"`
	ProjectName string         `json:"project_name" yaml:"project_name"`
	Name        string         `json:"name" yaml:"name"`
	Object      incusapi.Image `json:"object" yaml:"object"`
	LastUpdated time.Time      `json:"last_updated" yaml:"last_updated"`
}

type ImageType

type ImageType string
const (
	ImageTypeISO ImageType = "iso"
	ImageTypeRaw ImageType = "raw"
)

func (ImageType) FileExt

func (i ImageType) FileExt() string

func (ImageType) IsValid

func (i ImageType) IsValid() bool

func (ImageType) MarshalText

func (i ImageType) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (ImageType) String

func (i ImageType) String() string

func (*ImageType) UnmarshalText

func (i *ImageType) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (ImageType) UpdateFileType

func (i ImageType) UpdateFileType() UpdateFileType

type Instance

type Instance struct {
	UUID        uuid.UUID             `json:"uuid" yaml:"uuid"`
	Cluster     string                `json:"cluster" yaml:"cluster"`
	Server      string                `json:"server" yaml:"server"`
	ProjectName string                `json:"project_name" yaml:"project_name"`
	Name        string                `json:"name" yaml:"name"`
	Object      incusapi.InstanceFull `json:"object" yaml:"object"`
	LastUpdated time.Time             `json:"last_updated" yaml:"last_updated"`
}

type InventoryAggregate

type InventoryAggregate struct {
	Cluster              string                `json:"cluster" yaml:"cluster"`
	Servers              []string              `json:"servers" yaml:"servers"`
	Images               []Image               `json:"images" yaml:"images"`
	Instances            []Instance            `json:"instances" yaml:"instances"`
	Networks             []Network             `json:"networks" yaml:"networks"`
	NetworkACLs          []NetworkACL          `json:"network_acls" yaml:"network_acls"`
	NetworkForwards      []NetworkForward      `json:"network_forwards" yaml:"network_forwards"`
	NetworkIntegrations  []NetworkIntegration  `json:"network_integrations" yaml:"network_integrations"`
	NetworkLoadBalancers []NetworkLoadBalancer `json:"network_load_balancers" yaml:"network_load_balancers"`
	NetworkPeers         []NetworkPeer         `json:"network_peers" yaml:"network_peers"`
	NetworkZones         []NetworkZone         `json:"network_zones" yaml:"network_zones"`
	Profiles             []Profile             `json:"profiles" yaml:"profiles"`
	Projects             []Project             `json:"projects" yaml:"projects"`
	StorageBuckets       []StorageBucket       `json:"storage_buckets" yaml:"storage_buckets"`
	StoragePools         []StoragePool         `json:"storage_pools" yaml:"storage_pools"`
	StorageVolumes       []StorageVolume       `json:"storage_volumes" yaml:"storage_volumes"`
}

type Network

type Network struct {
	UUID        uuid.UUID        `json:"uuid" yaml:"uuid"`
	Cluster     string           `json:"cluster" yaml:"cluster"`
	ProjectName string           `json:"project_name" yaml:"project_name"`
	Name        string           `json:"name" yaml:"name"`
	Object      incusapi.Network `json:"object" yaml:"object"`
	LastUpdated time.Time        `json:"last_updated" yaml:"last_updated"`
}

type NetworkACL

type NetworkACL struct {
	UUID        uuid.UUID           `json:"uuid" yaml:"uuid"`
	Cluster     string              `json:"cluster" yaml:"cluster"`
	ProjectName string              `json:"project_name" yaml:"project_name"`
	Name        string              `json:"name" yaml:"name"`
	Object      incusapi.NetworkACL `json:"object" yaml:"object"`
	LastUpdated time.Time           `json:"last_updated" yaml:"last_updated"`
}

type NetworkAddressSet

type NetworkAddressSet struct {
	UUID        uuid.UUID                  `json:"uuid" yaml:"uuid"`
	Cluster     string                     `json:"cluster" yaml:"cluster"`
	ProjectName string                     `json:"project_name" yaml:"project_name"`
	Name        string                     `json:"name" yaml:"name"`
	Object      incusapi.NetworkAddressSet `json:"object" yaml:"object"`
	LastUpdated time.Time                  `json:"last_updated" yaml:"last_updated"`
}

type NetworkForward

type NetworkForward struct {
	UUID        uuid.UUID               `json:"uuid" yaml:"uuid"`
	Cluster     string                  `json:"cluster" yaml:"cluster"`
	NetworkName string                  `json:"parent_name" yaml:"parent_name"`
	Name        string                  `json:"name" yaml:"name"`
	Object      incusapi.NetworkForward `json:"object" yaml:"object"`
	LastUpdated time.Time               `json:"last_updated" yaml:"last_updated"`
}

type NetworkIntegration

type NetworkIntegration struct {
	UUID        uuid.UUID                   `json:"uuid" yaml:"uuid"`
	Cluster     string                      `json:"cluster" yaml:"cluster"`
	Name        string                      `json:"name" yaml:"name"`
	Object      incusapi.NetworkIntegration `json:"object" yaml:"object"`
	LastUpdated time.Time                   `json:"last_updated" yaml:"last_updated"`
}

type NetworkLoadBalancer

type NetworkLoadBalancer struct {
	UUID        uuid.UUID                    `json:"uuid" yaml:"uuid"`
	Cluster     string                       `json:"cluster" yaml:"cluster"`
	NetworkName string                       `json:"parent_name" yaml:"parent_name"`
	Name        string                       `json:"name" yaml:"name"`
	Object      incusapi.NetworkLoadBalancer `json:"object" yaml:"object"`
	LastUpdated time.Time                    `json:"last_updated" yaml:"last_updated"`
}

type NetworkPeer

type NetworkPeer struct {
	UUID        uuid.UUID            `json:"uuid" yaml:"uuid"`
	Cluster     string               `json:"cluster" yaml:"cluster"`
	NetworkName string               `json:"parent_name" yaml:"parent_name"`
	Name        string               `json:"name" yaml:"name"`
	Object      incusapi.NetworkPeer `json:"object" yaml:"object"`
	LastUpdated time.Time            `json:"last_updated" yaml:"last_updated"`
}

type NetworkZone

type NetworkZone struct {
	UUID        uuid.UUID            `json:"uuid" yaml:"uuid"`
	Cluster     string               `json:"cluster" yaml:"cluster"`
	ProjectName string               `json:"project_name" yaml:"project_name"`
	Name        string               `json:"name" yaml:"name"`
	Object      incusapi.NetworkZone `json:"object" yaml:"object"`
	LastUpdated time.Time            `json:"last_updated" yaml:"last_updated"`
}

type OSData

type OSData struct {
	// Network contains the network data of the server OS, in the same form as presented by Incus OS in the network API.
	Network incusosapi.SystemNetwork `json:"network" yaml:"network"`

	// Security contains the security data of the server OS, in the same form as presented by Incus OS in the security API.
	Security incusosapi.SystemSecurity `json:"security" yaml:"security"`
}

func (*OSData) Scan

func (h *OSData) Scan(value any) error

Scan implements the sql.Scanner interface.

func (OSData) Value

func (h OSData) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

type Profile

type Profile struct {
	UUID        uuid.UUID        `json:"uuid" yaml:"uuid"`
	Cluster     string           `json:"cluster" yaml:"cluster"`
	ProjectName string           `json:"project_name" yaml:"project_name"`
	Name        string           `json:"name" yaml:"name"`
	Object      incusapi.Profile `json:"object" yaml:"object"`
	LastUpdated time.Time        `json:"last_updated" yaml:"last_updated"`
}

type Project

type Project struct {
	UUID        uuid.UUID        `json:"uuid" yaml:"uuid"`
	Cluster     string           `json:"cluster" yaml:"cluster"`
	Name        string           `json:"name" yaml:"name"`
	Object      incusapi.Project `json:"object" yaml:"object"`
	LastUpdated time.Time        `json:"last_updated" yaml:"last_updated"`
}

type Response

type Response struct {
	Type ResponseType `json:"type" yaml:"type"`

	// Valid only for Sync responses
	Status     string `json:"status" yaml:"status"`
	StatusCode int    `json:"status_code" yaml:"status_code"`

	// Valid only for Async responses
	Operation string `json:"operation" yaml:"operation"`

	// Valid only for Error responses
	Code  int    `json:"error_code" yaml:"error_code"`
	Error string `json:"error" yaml:"error"`

	// Valid for Sync and Error responses
	Metadata json.RawMessage `json:"metadata" yaml:"metadata"`
}

Response represents an operation.

func (*Response) MetadataAsMap

func (r *Response) MetadataAsMap() (map[string]any, error)

MetadataAsMap parses the Response metadata into a map.

func (*Response) MetadataAsStringSlice

func (r *Response) MetadataAsStringSlice() ([]string, error)

MetadataAsStringSlice parses the Response metadata into a slice of string.

func (*Response) MetadataAsStruct

func (r *Response) MetadataAsStruct(target any) error

MetadataAsStruct parses the Response metadata into a provided struct.

type ResponseRaw

type ResponseRaw struct {
	Type ResponseType `json:"type" yaml:"type"`

	// Valid only for Sync responses
	Status     string `json:"status" yaml:"status"`
	StatusCode int    `json:"status_code" yaml:"status_code"`

	// Valid only for Async responses
	Operation string `json:"operation" yaml:"operation"`

	// Valid only for Error responses
	Code  int    `json:"error_code" yaml:"error_code"`
	Error string `json:"error" yaml:"error"`

	// Valid for Sync and Error responses
	Metadata any `json:"metadata" yaml:"metadata"`
}

ResponseRaw represents an operation in its original form.

type ResponseType

type ResponseType string

ResponseType represents a valid response type.

const (
	SyncResponse  ResponseType = "sync"
	AsyncResponse ResponseType = "async"
	ErrorResponse ResponseType = "error"
)

Response types.

type Server

type Server struct {
	ServerPost `yaml:",inline"`

	// The cluster the server is part of.
	// Example: one
	Cluster string `json:"cluster" yaml:"cluster"`

	// Type defines the type of the server, which is normally one of "incus", "migration-manager", "operations-center".
	// Example: incus
	Type ServerType `json:"server_type" yaml:"server_type"`

	// HardwareData contains the hardware data of the server, in the same form as presented by Incus in the resource API.
	HardwareData HardwareData `json:"hardware_data" yaml:"hardware_data"`

	// OSData contains the configuration data of the operating system, e.g. incus-os.
	OSData OSData `json:"os_data" yaml:"os_data"`

	// VersionData contains information about the servers version.
	// Example: ...
	VersionData json.RawMessage `json:"version_data" yaml:"version_data"` // FIXME: it is not yet clear, how the structure of the version information will actually look like.

	// Status contains the status the server is currently in from the point of view of Operations Center.
	// Possible values for status are: pending, ready
	// Example: pending
	Status ServerStatus `json:"server_status" yaml:"server_status"`

	// LastUpdated is the time, when this information has been updated for the last time in RFC3339 format.
	// Example: 2024-11-12T16:15:00Z
	LastUpdated time.Time `json:"last_updated" yaml:"last_updated"`

	// LastSeen is the time, when this server has been seen for the last time
	// by any sort of connection between the server and operations center
	// in RFC3339 format.
	// Example: 2024-11-12T16:15:00Z
	LastSeen time.Time `json:"last_seen" yaml:"last_seen"`
}

Server defines a server running Hypervisor OS.

swagger:model

type ServerPost

type ServerPost struct {
	ServerPut `yaml:",inline"`

	// Name or name of the server.
	// Example: incus.local
	Name string `json:"name" yaml:"name"`

	// URL, hostname or IP address of the server endpoint used by Operations
	// Center for its communication.
	// Example: https://incus.local:6443
	ConnectionURL string `json:"connection_url" yaml:"connection_url"`
}

ServerPost defines a new server running Hypervisor OS.

swagger:model

type ServerPut

type ServerPut struct {
	// Public URL, hostname or IP address of the server endpoint for user facing
	// communication with the server. Only required, if it differs from
	// connection_url, e.g. because the server is behind a reverse proxy.
	// Example: https://incus.local:6443
	PublicConnectionURL string `json:"public_connection_url" yaml:"public_connection_url"`
}

ServerPut defines the updateable part of a server running Hypervisor OS.

swagger:model

type ServerRegistrationResponse

type ServerRegistrationResponse struct {
	// ClientCertificate is the certificate in PEM format used by Operations Center
	// when connecting to servers or clusters.
	ClientCertificate string `json:"certificate" yaml:"certificate"`
}

ServerRegistrationResponse defines the response to a successful server registration.

type ServerSelfUpdate

type ServerSelfUpdate struct {
	// URL, hostname or IP address of the server endpoint.
	// Example: https://incus.local:6443
	ConnectionURL string `json:"connection_url" yaml:"connection_url"`
}

ServerSelfUpdate defines a self update request of a server.

swagger:model

type ServerStatus

type ServerStatus string
const (
	ServerStatusUnknown ServerStatus = "unknown"
	ServerStatusPending ServerStatus = "pending"
	ServerStatusReady   ServerStatus = "ready"
)

func (ServerStatus) MarshalText

func (s ServerStatus) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*ServerStatus) Scan

func (s *ServerStatus) Scan(value any) error

Scan implements the sql.Scanner interface.

func (ServerStatus) String

func (s ServerStatus) String() string

func (*ServerStatus) UnmarshalText

func (s *ServerStatus) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (ServerStatus) Value

func (s ServerStatus) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

type ServerSystemNetwork

type ServerSystemNetwork = incusosapi.SystemNetwork

ServerSystemNetwork is a type alias to hold the system network configuration from Incus OS.

type ServerType

type ServerType string
const (
	ServerTypeUnknown          ServerType = "unknown"
	ServerTypeIncus            ServerType = "incus"
	ServerTypeMigrationManager ServerType = "migration-manager"
	ServerTypeOperationsCenter ServerType = "operations-center"
)

func (ServerType) MarshalText

func (s ServerType) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*ServerType) Scan

func (s *ServerType) Scan(value any) error

Scan implements the sql.Scanner interface.

func (ServerType) String

func (s ServerType) String() string

func (*ServerType) UnmarshalText

func (s *ServerType) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (ServerType) Value

func (s ServerType) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

type ServerUntrusted

type ServerUntrusted struct {
	// Support status of the current API (one of "devel", "stable" or "deprecated")
	// Read only: true
	// Example: stable
	APIStatus string `json:"api_status" yaml:"api_status"`

	// API version number
	// Read only: true
	// Example: 1.0
	APIVersion string `json:"api_version" yaml:"api_version"`

	// Whether the client is trusted (one of "trusted" or "untrusted")
	// Read only: true
	// Example: untrusted
	Auth string `json:"auth" yaml:"auth"`

	// List of supported authentication methods
	// Read only: true
	// Example: ["tls"]
	//
	// API extension: macaroon_authentication
	AuthMethods []string `json:"auth_methods" yaml:"auth_methods"`
}

ServerUntrusted represents a server configuration for an untrusted client

swagger:model

type StatusCode

type StatusCode int

StatusCode represents a valid operation and container status.

const (
	Success StatusCode = 200

	Failure StatusCode = 400
)

Status codes.

func (StatusCode) String

func (o StatusCode) String() string

String returns a suitable string representation for the status code.

type StatusError

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

StatusError error type that contains an HTTP status code and message.

func StatusErrorf

func StatusErrorf(status int, format string, a ...any) StatusError

StatusErrorf returns a new StatusError containing the specified status and message.

func (StatusError) Error

func (e StatusError) Error() string

Error returns the error message or the http.StatusText() of the status code if message is empty.

func (StatusError) Status

func (e StatusError) Status() int

Status returns the HTTP status code.

type StorageBucket

type StorageBucket struct {
	UUID            uuid.UUID              `json:"uuid" yaml:"uuid"`
	Cluster         string                 `json:"cluster" yaml:"cluster"`
	Server          string                 `json:"server" yaml:"server"`
	ProjectName     string                 `json:"project_name" yaml:"project_name"`
	StoragePoolName string                 `json:"parent_name" yaml:"parent_name"`
	Name            string                 `json:"name" yaml:"name"`
	Object          incusapi.StorageBucket `json:"object" yaml:"object"`
	LastUpdated     time.Time              `json:"last_updated" yaml:"last_updated"`
}

type StoragePool

type StoragePool struct {
	UUID        uuid.UUID            `json:"uuid" yaml:"uuid"`
	Cluster     string               `json:"cluster" yaml:"cluster"`
	Name        string               `json:"name" yaml:"name"`
	Object      incusapi.StoragePool `json:"object" yaml:"object"`
	LastUpdated time.Time            `json:"last_updated" yaml:"last_updated"`
}

type StorageVolume

type StorageVolume struct {
	UUID            uuid.UUID              `json:"uuid" yaml:"uuid"`
	Cluster         string                 `json:"cluster" yaml:"cluster"`
	Server          string                 `json:"server" yaml:"server"`
	ProjectName     string                 `json:"project_name" yaml:"project_name"`
	StoragePoolName string                 `json:"parent_name" yaml:"parent_name"`
	Name            string                 `json:"name" yaml:"name"`
	Type            string                 `json:"type" yaml:"type"`
	Object          incusapi.StorageVolume `json:"object" yaml:"object"`
	LastUpdated     time.Time              `json:"last_updated" yaml:"last_updated"`
}

type SystemCertificatePost

type SystemCertificatePost struct {
	// The new certificate (X509 PEM encoded) for the system (server certificate).
	// Example: X509 PEM certificate
	Certificate string `json:"certificate" yaml:"certificate"`

	// The new certificate key (X509 PEM encoded) for the system (server key).
	// Example: X509 PEM certificate key
	Key string `json:"key" yaml:"key"`
}

SystemCertificatePost represents the fields available for an update of the system certificate (server certificate) and key.

swagger:model

type SystemNetwork

type SystemNetwork struct {
	SystemNetworkPut `yaml:",inline"`
}

SystemNetwork represents the system's network configuration.

swagger:model

type SystemNetworkPut

type SystemNetworkPut struct {
	// Address of Operations Center which is used by managed servers to connect.
	OperationsCenterAddress string `json:"address" yaml:"address"`

	// Address and port to bind the REST API to.
	RestServerAddress string `json:"rest_server_address" yaml:"rest_server_address"`
}

SystemNetworkPut represents the fields available for an update of the system's network configuration.

swagger:model

type SystemSecurity

type SystemSecurity struct {
	SystemSecurityPut `yaml:",inline"`
}

SystemSecurity represents the system's security configuration.

swagger:model

type SystemSecurityOIDC

type SystemSecurityOIDC struct {
	// OIDC Issuer.
	Issuer string `json:"issuer" yaml:"issuer"`

	// CLient ID used for communication with the OIDC issuer.
	ClientID string `json:"client_id" yaml:"client_id"`

	// Scopes to be requested.
	Scope string `json:"scopes" yaml:"scopes"`

	// Audience the OIDC tokens should be verified against.
	Audience string `json:"audience" yaml:"audience"`

	// Claim which should be used to identify the user or subject.
	Claim string `json:"claim" yaml:"claim"`
}

SystemSecurityOIDC is the OIDC related part of the system's security configuration.

type SystemSecurityOpenFGA

type SystemSecurityOpenFGA struct {
	// API token used for communication with the OpenFGA system.
	APIToken string `json:"api_token" yaml:"api_token"`

	// URL of the OpenFGA API.
	APIURL string `json:"api_url" yaml:"api_url"`

	// ID of the OpenFGA store.
	StoreID string `json:"store_id" yaml:"store_id"`
}

SystemSecurityOpenFGA is the OpenFGA related part of the system's security configuration.

type SystemSecurityPut

type SystemSecurityPut struct {
	OIDC    SystemSecurityOIDC    `json:"oidc" yaml:"oidc"`
	OpenFGA SystemSecurityOpenFGA `json:"openfga" yaml:"openfga"`

	// An array of SHA256 certificate fingerprints that belong to trusted TLS clients.
	TrustedTLSClientCertFingerprints []string `json:"trusted_tls_client_cert_fingerprints" yaml:"trusted_tls_client_cert_fingerprints"`
}

SystemSecurityPut represents the fields available for an update of the system's security configuration.

swagger:model

type SystemUpdates

type SystemUpdates struct {
	SystemUpdatesPut `yaml:",inline"`
}

SystemUpdates represents the system's updates configuration.

swagger:model

type SystemUpdatesPut

type SystemUpdatesPut struct {
	// Source is the URL of the origin, the updates should be fetched from.
	Source string `json:"source" yaml:"source"`

	// Root CA certificate used to verify the signature of index.sjson.
	// Example: -----BEGIN CERTIFICATE-----\nMII...\n-----END CERTIFICATE-----
	SignatureVerificationRootCA string `json:"signature_verification_root_ca" yaml:"signature_verification_root_ca"`

	// Filter expression for updates using https://expr-lang.org/ on struct
	// provisioning.Update.
	// If a filter is defined, the filter needs to evaluate to true for the update
	// being fetched by Operations Center.
	// Empty filter expression does not filter at all.
	// Example: 'stable' in Channels
	FilterExpression string `json:"filter_expression" yaml:"filter_expression"`

	// Filter expression for update files using https://expr-lang.org/ on struct
	// provisioning.UpdateFile.
	// If a filter is defined, the filter needs to evaluate to true for the file
	// being fetched by Operations Center.
	// Empty filter expression does not filter at all.
	// Example: 'x86_64' == string(Architecture)
	FileFilterExpression string `json:"file_filter_expression" yaml:"file_filter_expression"`
}

SystemUpdatesPut represents the fields available for an update of the system's updates configuration.

swagger:model

type Token

type Token struct {
	TokenPut `yaml:",inline"`

	// UUID of the token, which serves as the the token.
	// Example: b32d0079-c48b-4957-b1cb-bef54125c861
	UUID uuid.UUID `json:"uuid" yaml:"uuid"`
}

Token defines a registration token for use during registration.

swagger:model

type TokenImagePost

type TokenImagePost struct {
	// Type contains the type of image to be generated.
	// Possible values for status are: iso, raw
	// Example: iso
	Type ImageType `json:"type" yaml:"type"`

	// Architecture contains the CPU architecture the image should be generated
	// for.
	Architecture Architecture `json:"architecture" yaml:"architecture"`

	// Seeds represents the seed configuration for e.g. applications.yaml,
	// install.yaml and network.yaml.
	Seeds TokenSeedConfigs `json:"seeds" yaml:"seeds"`
}

TokenImagePost defines the configuration to generate a pre-seeded ISO or raw image for a given Token.

Operations Center just passes through the provided configuration for applications.yaml, install.yaml and network.yaml as is without any validation of the provided configuration besides of ensuring it to be valid yaml.

swagger:model

type TokenPut

type TokenPut struct {
	// Value indicating, how many times the token might be used for registration.
	// Example: 10
	UsesRemaining int `json:"uses_remaining" yaml:"uses_remaining"`

	// The time at which the token expires in RFC3339 format with seconds precision.
	// Example: "2025-02-04T07:25:47Z"
	ExpireAt time.Time `json:"expire_at" yaml:"expire_at"`

	// Description of this token.
	// Example: "Test Environment"
	Description string `json:"description" yaml:"description"`
}

TokenPut defines the configurable properties of Token.

swagger:model

type TokenSeed

type TokenSeed struct {
	TokenSeedPost `yaml:",inline"`

	// UUID of the token.
	// Example: b32d0079-c48b-4957-b1cb-bef54125c861
	Token uuid.UUID

	// LastUpdated is the time, when this information has been updated for the last time in RFC3339 format.
	// Example: 2024-11-12T16:15:00Z
	LastUpdated time.Time `json:"last_updated" yaml:"last_updated"`
}

TokenSeed defines a named token seed configuration, for which a pre-seeded ISO or raw image can be fetched later.

Operations Center just passes through the provided configuration for application.yaml, install.yaml and network.yaml as is without any validation of the provided configuration besides of ensuring it to be valid yaml.

swagger:model

type TokenSeedConfigs

type TokenSeedConfigs struct {
	// Applications represents the applications configuration (applications.yaml) to be included in the pre-seeded image.
	Applications map[string]any `json:"applications" yaml:"applications"`

	// Network represents the network configuration (network.yaml) to be included in the pre-seeded image.
	Network map[string]any `json:"network" yaml:"network"`

	// Install represents the install configuration (install.yaml) to be included in the pre-seeded image.
	Install map[string]any `json:"install" yaml:"install"`
}

type TokenSeedPost

type TokenSeedPost struct {
	// Name contains the name of the token seed configuration.
	// Example: MyConfig
	Name string `json:"name" yaml:"name"`

	TokenSeedPut `yaml:",inline"`
}

TokenSeedPost defines a named token seed configuration, for which a pre-seeded ISO or raw image can be fetched later.

Operations Center just passes through the provided configuration for application.yaml, install.yaml and network.yaml as is without any validation of the provided configuration besides of ensuring it to be valid yaml.

swagger:model

type TokenSeedPut

type TokenSeedPut struct {
	// Description contains the description of the token seed configuration.
	// Example: Configuration for lab servers.
	Description string `json:"description" yaml:"description"`

	// Public defines, if images generated based on the given token seed
	// configuration can be retrieved without authentication. If public is set to
	// `true`, no authentication is necessary, otherwise authentication is
	// required.
	// Example: true
	Public bool `json:"public" yaml:"public"`

	// Seeds represents the seed configuration for e.g. application.yaml,
	// install.yaml and network.yaml.
	Seeds TokenSeedConfigs `json:"seeds" yaml:"seeds"`
}

TokenSeedPut defines the updateable part of a named token seed configuration, for which a pre-seeded ISO or raw image can be fetched later.

Operations Center just passes through the provided configuration for application.yaml, install.yaml and network.yaml as is without any validation of the provided configuration besides of ensuring it to be valid yaml.

swagger:model

type Update

type Update struct {
	// UUID of the update.
	UUID uuid.UUID `json:"uuid" yaml:"uuid"`

	// Version of the Update as opaque string.
	// Example: 202501311418
	Version string `json:"version" yaml:"version"`

	// PublishedAt is the date, when the Update has been published in RFC3339 format.
	// Example: 2025-02-12T09:59:00Z
	PublishedAt time.Time `json:"published_at" yaml:"published_at"`

	// Severity of the Update. Allowed values: none, low, medium, high, critical
	// Example: none
	Severity UpdateSeverity `json:"severity" yaml:"severity"`

	// Origin of the Update.
	// Example: linuxcontainers.org
	Origin string `json:"origin" yaml:"origin"`

	// // URL of the File.
	// // Example: releases/download/202501311418/
	URL string `json:"url" yaml:"url"`

	// Channels the update is part of.
	// Example: stable
	Channels []string `json:"channels" yaml:"channels"`

	// Changelog of the Update as plain text.
	Changelog string `json:"changelog" yaml:"changelog"`

	// Status contains the status the update is currently in.
	// Possible values for status are: pending, ready
	// Example: ready
	Status UpdateStatus `json:"update_status" yaml:"update_status"`
}

Update defines an update for a given server type.

swagger:model

type UpdateFile

type UpdateFile struct {
	// Filename of the File.
	// Example: IncusOS_202501311418.efi.gz
	Filename string `json:"filename" yaml:"filename"`

	// Size of the File in bytes.
	// Example: 54300000
	Size int `json:"size" yaml:"size"`

	// Sha256 checksum of the file in hex encoding (64 ascii characters in the alphabet [0-9A-Fa-f])
	// Example: 11465a836ce54a8f293ac9234aa51050094cfbb8906c1a10ab9487dd92088643
	Sha256 string `json:"sha256"`

	// Component the file provides. One of: os, incus, debug
	// Example: os
	Component images.UpdateFileComponent `json:"component" yaml:"component"`

	// Type of the file. One of: image-raw, image-iso, image-manifest, update-efi, update-usr, update-usr-verity, update-usr-verity-signature
	// Example: image-raw
	Type UpdateFileType `json:"type" yaml:"type"`

	// Architecture of the file. E.g. x86_64, aarch64
	// Example: x86_64
	Architecture Architecture `json:"architecture" yaml:"architecture"`
}

UpdateFile defines an update file.

swagger:model

type UpdateFileType

type UpdateFileType string
const (
	UpdateFileTypeUndefined                UpdateFileType = ""
	UpdateFileTypeImageRaw                 UpdateFileType = "image-raw"
	UpdateFileTypeImageISO                 UpdateFileType = "image-iso"
	UpdateFileTypeImageManifest            UpdateFileType = "image-manifest"
	UpdateFileTypeUpdateEFI                UpdateFileType = "update-efi"
	UpdateFileTypeUpdateUsr                UpdateFileType = "update-usr"
	UpdateFileTypeUpdateUsrVerity          UpdateFileType = "update-usr-verity"
	UpdateFileTypeUpdateUsrVeritySignature UpdateFileType = "update-usr-verity-signature"
	UpdateFileTypeApplication              UpdateFileType = "application"
)

func (UpdateFileType) MarshalText

func (u UpdateFileType) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*UpdateFileType) Scan

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

Scan implements the sql.Scanner interface.

func (UpdateFileType) String

func (u UpdateFileType) String() string

func (*UpdateFileType) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (UpdateFileType) Value

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

Value implements the sql driver.Valuer interface.

type UpdateSeverity

type UpdateSeverity string
const (
	UpdateSeverityNone     UpdateSeverity = "none"
	UpdateSeverityLow      UpdateSeverity = "low"
	UpdateSeverityMedium   UpdateSeverity = "medium"
	UpdateSeverityHigh     UpdateSeverity = "high"
	UpdateSeverityCritical UpdateSeverity = "critical"
)

func (UpdateSeverity) MarshalText

func (u UpdateSeverity) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*UpdateSeverity) Scan

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

Scan implements the sql.Scanner interface.

func (UpdateSeverity) String

func (u UpdateSeverity) String() string

func (*UpdateSeverity) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (UpdateSeverity) Value

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

Value implements the sql driver.Valuer interface.

type UpdateStatus

type UpdateStatus string
const (
	UpdateStatusUnknown UpdateStatus = "unknown"
	UpdateStatusPending UpdateStatus = "pending"
	UpdateStatusReady   UpdateStatus = "ready"
)

func (UpdateStatus) MarshalText

func (s UpdateStatus) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*UpdateStatus) Scan

func (s *UpdateStatus) Scan(value any) error

Scan implements the sql.Scanner interface.

func (UpdateStatus) String

func (s UpdateStatus) String() string

func (*UpdateStatus) UnmarshalText

func (s *UpdateStatus) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (UpdateStatus) Value

func (s UpdateStatus) Value() (driver.Value, error)

Value implements the sql driver.Valuer interface.

Jump to

Keyboard shortcuts

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