api

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LabelsAnnotation = "libvirt-provider.ironcore.dev/labels"

	AnnotationsAnnotation = "libvirt-provider.ironcore.dev/annotations"
)
View Source
const (
	ManagerLabel = "libvirt-provider.ironcore.dev/manager"
	ClassLabel   = "libvirt-provider.ironcore.dev/class"
)
View Source
const (
	MachineManager = "libvirt-provider"
)

Variables

This section is empty.

Functions

func GetAnnotationsAnnotation

func GetAnnotationsAnnotation(o Metadata) (map[string]string, error)

func GetClassLabel

func GetClassLabel(o Object) (string, bool)

func GetLabelsAnnotation

func GetLabelsAnnotation(o Metadata) (map[string]string, error)

func GetObjectMetadata

func GetObjectMetadata(o Metadata) (*irimeta.ObjectMetadata, error)

func IsManagedBy

func IsManagedBy(o Object, manager string) bool

func SetAnnotationsAnnotation

func SetAnnotationsAnnotation(o Object, annotations map[string]string) error

func SetClassLabel

func SetClassLabel(o Object, class string)

func SetLabelsAnnotation

func SetLabelsAnnotation(o Object, labels map[string]string) error

func SetManagerLabel

func SetManagerLabel(o Object, manager string)

func SetObjectMetadata

func SetObjectMetadata(o Object, metadata *irimeta.ObjectMetadata) error

Types

type EmptyDiskSpec

type EmptyDiskSpec struct {
	Size int64 `json:"size"`
}

type GuestAgent

type GuestAgent string
const (
	GuestAgentNone GuestAgent = "None"
	GuestAgentQemu GuestAgent = "Qemu"
)

type GuestAgentStatus

type GuestAgentStatus struct {
	Addr string `json:"addr,omitempty"`
}

type Machine

type Machine struct {
	Metadata `json:"metadata,omitempty"`

	Spec   MachineSpec   `json:"spec"`
	Status MachineStatus `json:"status"`
}

type MachineSpec

type MachineSpec struct {
	Power PowerState `json:"power"`

	CpuMillis   int64 `json:"cpuMillis"`
	MemoryBytes int64 `json:"memoryBytes"`

	Image    *string `json:"image"`
	Ignition []byte  `json:"ignition"`

	Volumes           []*VolumeSpec           `json:"volumes"`
	NetworkInterfaces []*NetworkInterfaceSpec `json:"networkInterfaces"`

	ShutdownAt time.Time `json:"shutdownAt,omitempty"`

	GuestAgent GuestAgent `json:"guestAgent"`
}

type MachineState

type MachineState string
const (
	MachineStatePending     MachineState = "Pending"
	MachineStateRunning     MachineState = "Running"
	MachineStateSuspended   MachineState = "Suspended"
	MachineStateTerminating MachineState = "Terminating"
	MachineStateTerminated  MachineState = "Terminated"
)

type MachineStatus

type MachineStatus struct {
	VolumeStatus           []VolumeStatus           `json:"volumeStatus"`
	NetworkInterfaceStatus []NetworkInterfaceStatus `json:"networkInterfaceStatus"`
	State                  MachineState             `json:"state"`
	ImageRef               string                   `json:"imageRef"`
	GuestAgentStatus       *GuestAgentStatus        `json:"guestAgentStatus,omitempty"`
}

type Metadata

type Metadata struct {
	ID          string            `json:"id"`
	Annotations map[string]string `json:"annotations"`
	Labels      map[string]string `json:"labels"`

	CreatedAt       time.Time  `json:"createdAt"`
	DeletedAt       *time.Time `json:"deletedAt,omitempty"`
	Generation      int64      `json:"generation"`
	ResourceVersion uint64     `json:"resourceVersion"`

	Finalizers []string `json:"finalizers,omitempty"`
}

func (*Metadata) GetAnnotations

func (m *Metadata) GetAnnotations() map[string]string

func (*Metadata) GetCreatedAt

func (m *Metadata) GetCreatedAt() time.Time

func (*Metadata) GetDeletedAt

func (m *Metadata) GetDeletedAt() *time.Time

func (*Metadata) GetFinalizers

func (m *Metadata) GetFinalizers() []string

func (*Metadata) GetGeneration

func (m *Metadata) GetGeneration() int64

func (*Metadata) GetID

func (m *Metadata) GetID() string

func (*Metadata) GetLabels

func (m *Metadata) GetLabels() map[string]string

func (*Metadata) GetResourceVersion

func (m *Metadata) GetResourceVersion() uint64

func (*Metadata) IncrementResourceVersion

func (m *Metadata) IncrementResourceVersion()

func (*Metadata) SetAnnotations

func (m *Metadata) SetAnnotations(annotations map[string]string)

func (*Metadata) SetCreatedAt

func (m *Metadata) SetCreatedAt(createdAt time.Time)

func (*Metadata) SetDeletedAt

func (m *Metadata) SetDeletedAt(deleted *time.Time)

func (*Metadata) SetFinalizers

func (m *Metadata) SetFinalizers(finalizers []string)

func (*Metadata) SetGeneration

func (m *Metadata) SetGeneration(generation int64)

func (*Metadata) SetID

func (m *Metadata) SetID(id string)

func (*Metadata) SetLabels

func (m *Metadata) SetLabels(labels map[string]string)

type NetworkInterfaceSpec

type NetworkInterfaceSpec struct {
	Name       string            `json:"name"`
	NetworkId  string            `json:"networkId"`
	Ips        []string          `json:"ips"`
	Attributes map[string]string `json:"attributes"`
}

type NetworkInterfaceState

type NetworkInterfaceState string
const (
	NetworkInterfaceStatePending  NetworkInterfaceState = "Pending"
	NetworkInterfaceStateAttached NetworkInterfaceState = "Attached"
)

type NetworkInterfaceStatus

type NetworkInterfaceStatus struct {
	Name   string                `json:"name"`
	Handle string                `json:"handle"`
	State  NetworkInterfaceState `json:"state"`
}

type Object

type Object interface {
	GetID() string
	GetAnnotations() map[string]string
	GetLabels() map[string]string
	GetCreatedAt() time.Time
	GetDeletedAt() *time.Time
	GetGeneration() int64
	GetFinalizers() []string
	GetResourceVersion() uint64

	SetID(id string)
	SetAnnotations(annotations map[string]string)
	SetLabels(labels map[string]string)
	SetCreatedAt(createdAt time.Time)
	SetDeletedAt(deleted *time.Time)
	SetGeneration(generation int64)
	SetFinalizers(finalizers []string)
	IncrementResourceVersion()
}

type PowerState

type PowerState int32
const (
	PowerStatePowerOn  PowerState = 0
	PowerStatePowerOff PowerState = 1
)

type VolumeConnection

type VolumeConnection struct {
	Driver         string            ` json:"driver,omitempty"`
	Handle         string            ` json:"handle,omitempty"`
	Attributes     map[string]string ` json:"attributes,omitempty"`
	SecretData     map[string][]byte ` json:"secret_data,omitempty"`
	EncryptionData map[string][]byte ` json:"encryption_data,omitempty"`
}

type VolumeSpec

type VolumeSpec struct {
	Name       string            `json:"name"`
	Device     string            `json:"device"`
	EmptyDisk  *EmptyDiskSpec    `json:"emptyDisk,omitempty"`
	Connection *VolumeConnection `json:"cephDisk,omitempty"`
}

type VolumeState

type VolumeState string
const (
	VolumeStatePending  VolumeState = "Pending"
	VolumeStateAttached VolumeState = "Attached"
)

type VolumeStatus

type VolumeStatus struct {
	Name   string      `json:"name,omitempty"`
	Handle string      `json:"handle,omitempty"`
	State  VolumeState `json:"state,omitempty"`
	Size   int64       `json:"size,omitempty"`
}

Jump to

Keyboard shortcuts

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