api

package
v0.0.0-pre.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	APIVersion string = "1.0"
	APIStatus  string = "devel"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	// A human-friendly name for this batch
	// Example: MyBatch
	Name string `json:"name" yaml:"name"`

	// An opaque integer identifier for the batch
	// Example: 123
	DatabaseID int `json:"database_id" yaml:"database_id"`

	// The destination target name to be used by all instances in this batch
	// Example: Mytarget
	Target string `json:"target" yaml:"target"`

	// The target project to use
	// Example: default
	TargetProject string `json:"target_project" yaml:"target_project"`

	// The status of this batch
	// Example: BATCHSTATUS_DEFINED
	Status BatchStatusType `json:"status" yaml:"status"`

	// A free-form string to provide additional information about the status
	// Example: "4 of 5 instances migrated"
	StatusString string `json:"status_string" yaml:"status_string"`

	// The Incus storage pool that this batch should use for creating VMs and mounting ISO images
	// Example: local
	StoragePool string `json:"storage_pool" yaml:"storage_pool"`

	// A Expression used to select instances to add to this batch
	// Language reference: https://expr-lang.org/docs/language-definition
	// Example: GetInventoryPath() matches "^foobar/.*"
	IncludeExpression string `json:"include_expression" yaml:"include_expression"`

	// If specified, don't start the migration before this time
	MigrationWindowStart time.Time `json:"migration_window_start" yaml:"migration_window_start"`

	// If specified, don't start the migration after this time
	MigrationWindowEnd time.Time `json:"migration_window_end" yaml:"migration_window_end"`
}

Batch defines a collection of Instances to be migrated, possibly during a specific window of time.

swagger:model

type BatchStatusType

type BatchStatusType int
const (
	BATCHSTATUS_UNKNOWN BatchStatusType = iota
	BATCHSTATUS_DEFINED
	BATCHSTATUS_READY
	BATCHSTATUS_QUEUED
	BATCHSTATUS_RUNNING
	BATCHSTATUS_STOPPED
	BATCHSTATUS_FINISHED
	BATCHSTATUS_ERROR
)

func (BatchStatusType) String

func (b BatchStatusType) String() string

Implement the stringer interface.

type IncusProperties

type IncusProperties struct {
	// Hostname or IP address of the target endpoint
	// Example: https://incus.local:6443
	Endpoint string `json:"endpoint" yaml:"endpoint"`

	// base64-encoded TLS client key for authentication
	TLSClientKey string `json:"tls_client_key" yaml:"tls_client_key"`

	// base64-encoded TLS client certificate for authentication
	TLSClientCert string `json:"tls_client_cert" yaml:"tls_client_cert"`

	// OpenID Connect tokens
	OIDCTokens *oidc.Tokens[*oidc.IDTokenClaims] `json:"oidc_tokens" yaml:"oidc_tokens"`

	// If true, disable TLS certificate validation
	// Example: false
	Insecure bool `json:"insecure" yaml:"insecure"`
}

IncusProperties defines the set of Incus specific properties of a target that the migration manager can connect to.

swagger:model

type Instance

type Instance struct {
	// UUID for this instance; populated from the source and used across all migration manager operations
	// Example: 26fa4eb7-8d4f-4bf8-9a6a-dd95d166dfad
	UUID uuid.UUID `json:"uuid" yaml:"uuid"`

	// Internal path to the instance
	// Example: /SHF/vm/Migration Tests/DebianTest
	InventoryPath string `json:"inventory_path" yaml:"inventory_path"`

	// Description of this instance
	// Example: "Oracle Database"
	Annotation string `json:"annotation" yaml:"annotation"`

	// The migration status of this instance
	// Example: MIGRATIONSTATUS_RUNNING
	MigrationStatus MigrationStatusType `json:"migration_status" yaml:"migration_status"`

	// A free-form string to provide additional information about the migration status
	// Example: "Migration 25% complete"
	MigrationStatusString string `json:"migration_status_string" yaml:"migration_status_string"`

	// The last time this instance was updated from its source
	// Example: 2024-11-12 16:15:00 +0000 UTC
	LastUpdateFromSource time.Time `json:"last_update_from_source" yaml:"last_update_from_source"`

	// The originating source name for this instance
	// Example: MySource
	Source string `json:"source" yaml:"source"`

	// The batch ID for this instance
	// Example: 1
	BatchID *int `json:"batch_id,omitempty" yaml:"batch_id,omitempty"`

	// Guest tools version, if known
	// Example: 12352
	GuestToolsVersion int `json:"guest_tools_version" yaml:"guest_tools_version"`

	// The architecture of this instance
	// Example: x86_64
	Architecture string `json:"architecture" yaml:"architecture"`

	// The hardware version of the instance
	// Example: vmx-21
	HardwareVersion string `json:"hardware_version" yaml:"hardware_version"`

	// The name of the operating system
	// Example: Ubuntu
	OS string `json:"os" yaml:"os"`

	// The version of the operating system
	// Example: 24.04
	OSVersion string `json:"os_version" yaml:"os_version"`

	// Generic devices for this instance
	Devices []InstanceDeviceInfo `json:"devices" yaml:"devices"`

	// Disk(s) for this instance
	Disks []InstanceDiskInfo `json:"disks" yaml:"disks"`

	// NIC(s) for this instance
	NICs []InstanceNICInfo `json:"nics" yaml:"nics"`

	// Snapshot(s) for this instance
	Snapshots []InstanceSnapshotInfo `json:"snapshots" yaml:"snapshots"`

	// vCPUs configuration for this instance
	CPU InstanceCPUInfo `json:"cpu" yaml:"cpu"`

	// Memory configuration for this instance
	Memory InstanceMemoryInfo `json:"memory" yaml:"memory"`

	// Does this instance boot with legacy BIOS rather than UEFI
	// Example: false
	UseLegacyBios bool `json:"use_legacy_bios" yaml:"use_legacy_bios"`

	// Is Secure Boot enabled for this instance
	// Example: false
	SecureBootEnabled bool `json:"secure_boot_enabled" yaml:"secure_boot_enabled"`

	// Is a TPM device present for this instance
	// Example: false
	TPMPresent bool `json:"tpm_present" yaml:"tpm_present"`

	// Overrides, if any, for this instance
	// Example: {..., NumberCPUs: 16, ...}
	Overrides InstanceOverride `json:"overrides" yaml:"overrides"`
}

Instance defines a VM instance to be migrated.

swagger:model

func (*Instance) GetName

func (i *Instance) GetName() string

Returns the name of the instance, which may not be unique among all instances for a given source. If a unique, human-readable identifier is needed, use the InventoryPath property.

type InstanceCPUInfo

type InstanceCPUInfo struct {
	// The number of vCPUs for this instance
	// Example: 4
	NumberCPUs int `json:"number_cpus" yaml:"number_cpus"`

	// List of nodes (if any), that limit what CPU(s) may be used by the instance
	// Example: [0,1,2,3]
	CPUAffinity []int32 `json:"cpu_affinity" yaml:"cpu_affinity"`

	// Number of cores per socket
	// Example: 4
	NumberOfCoresPerSocket int `json:"number_of_cores_per_socket" yaml:"number_of_cores_per_socket"`
}

InstanceCPUInfo defines CPU information for an Instance.

swagger:model

type InstanceDeviceInfo

type InstanceDeviceInfo struct {
	// The type of device
	// Example: PS2
	Type string `json:"type" yaml:"type"`

	// Device display label
	// Example: Keyboard
	Label string `json:"label" yaml:"label"`

	// Device summary description
	// Example: Keyboard
	Summary string `json:"summary" yaml:"summary"`
}

InstanceDeviceInfo defines generic device information for an Instance. Disks and NICs have specific structs tailored to their needs.

swagger:model

type InstanceDiskInfo

type InstanceDiskInfo struct {
	// The name of this disk
	// Example: sda
	Name string `json:"name" yaml:"name"`

	// The type of this disk (HDD or CDROM)
	// Example: HDD
	Type string `json:"type" yaml:"type"`

	// The virtualized controller model
	// Example: SCSI
	ControllerModel string `json:"controller_model" yaml:"controller_model"`

	// Flag that indicates if differential sync is supported
	// For VMware sources, this requires setting a VM's `ctkEnabled` and `scsix:x.ctkEnabled` options
	// Example: true
	DifferentialSyncSupported bool `json:"differential_sync_supported" yaml:"differential_sync_supported"`

	// The size of this disk, in bytes
	// Example: 1073741824
	SizeInBytes int64 `json:"size_in_bytes" yaml:"size_in_bytes"`

	// Is this disk shared with multiple VMs
	// Example: false
	IsShared bool `json:"is_shared" yaml:"is_shared"`
}

InstanceDiskInfo defines disk information for an Instance.

swagger:model

type InstanceMemoryInfo

type InstanceMemoryInfo struct {
	// The amount of memory for this instance, in bytes
	// Example: 4294967296
	MemoryInBytes int64 `json:"memory_in_bytes" yaml:"memory_in_bytes"`

	// Memory reservation, in bytes
	// Example: 4294967296
	MemoryReservationInBytes int64 `json:"memory_reservation_in_bytes" yaml:"memory_reservation_in_bytes"`
}

InstanceMemoryInfo defines memory information for an Instance.

swagger:model

type InstanceNICInfo

type InstanceNICInfo struct {
	// The network for this NIC
	// Example: default
	Network string `json:"network" yaml:"network"`

	// The virtualized adapter model
	// Example: E1000e
	AdapterModel string `json:"adapter_model" yaml:"adapter_model"`

	// The MAC address for this NIC
	// Example: 00:16:3e:05:6c:38
	Hwaddr string `json:"hwaddr" yaml:"hwaddr"`
}

InstancNICInfo defines network information for an Instance.

swagger:model

type InstanceOverride

type InstanceOverride struct {
	// UUID corresponding to the overridden instance
	// Example: 26fa4eb7-8d4f-4bf8-9a6a-dd95d166dfad
	UUID uuid.UUID `json:"uuid" yaml:"uuid"`

	// The last time this instance override was updated
	// Example: 2024-11-12 16:15:00 +0000 UTC
	LastUpdate time.Time `json:"last_update" yaml:"last_update"`

	// An optional comment about the override
	// Example: "Manually tweak number of CPUs"
	Comment string `json:"comment" yaml:"comment"`

	// The overridden number of vCPUs for this instance; a value of 0 indicates no override
	// Example: 4
	NumberCPUs int `json:"number_cpus" yaml:"number_cpus"`

	// The overridden amount of memory for this instance, in bytes; a value of 0 indicates no override
	// Example: 4294967296
	MemoryInBytes int64 `json:"memory_in_bytes" yaml:"memory_in_bytes"`

	// If true, migration of this instance will be disabled.
	// Example: true
	DisableMigration bool `json:"disable_migration" yaml:"disable_migration"`
}

InstanceOverride defines a limited set of instance values that can be overridden as part of the migration process.

swagger:model

type InstanceSnapshotInfo

type InstanceSnapshotInfo struct {
	// The name of this snapshot
	// Example: snapshot1
	Name string `json:"name" yaml:"name"`

	// Description of this snapshot
	// Example: "First snapshot"
	Description string `json:"description" yaml:"description"`

	// Creation time of this snapshot
	// Example: 2024-11-12 16:15:00 +0000 UTC
	CreationTime time.Time `json:"creation_time" yaml:"creation_time"`

	// Unique identifier of this snapshot
	// Example: 123
	ID int `json:"id" yaml:"id"`
}

InstancSnapshotInfo defines snapshot information for an Instance.

swagger:model

type MigrationStatusType

type MigrationStatusType int
const (
	MIGRATIONSTATUS_UNKNOWN MigrationStatusType = iota
	MIGRATIONSTATUS_NOT_ASSIGNED_BATCH
	MIGRATIONSTATUS_ASSIGNED_BATCH
	MIGRATIONSTATUS_CREATING
	MIGRATIONSTATUS_BACKGROUND_IMPORT
	MIGRATIONSTATUS_IDLE
	MIGRATIONSTATUS_FINAL_IMPORT
	MIGRATIONSTATUS_IMPORT_COMPLETE
	MIGRATIONSTATUS_FINISHED
	MIGRATIONSTATUS_ERROR
	MIGRATIONSTATUS_USER_DISABLED_MIGRATION
)

func (MigrationStatusType) String

func (m MigrationStatusType) String() string

Implement the stringer interface.

type Network

type Network struct {
	// The name of the network
	// Example: network-23
	Name string `json:"name" yaml:"name"`

	// An opaque integer identifier for the network
	// Example: 123
	DatabaseID int `json:"database_id" yaml:"database_id"`

	// Any network-specific config options
	// Example: {"network": "vmware", "ipv6.address": "none"}
	Config map[string]string `json:"config" yaml:"config"`
}

Network defines the network config for use by the migration manager.

swagger:model

type OSType

type OSType int
const (
	OSTYPE_WINDOWS OSType = iota
	OSTYPE_LINUX
)

func (OSType) String

func (o OSType) String() string

Implement the stringer interface.

type QueueEntry

type QueueEntry struct {
	// UUID for the instance; populated from the source and used across all migration manager operations
	// Example: 26fa4eb7-8d4f-4bf8-9a6a-dd95d166dfad
	InstanceUUID uuid.UUID `json:"instance_uuid" yaml:"instance_uuid"`

	// The name of the instance
	// Example: UbuntuServer
	InstanceName string `json:"instance_name" yaml:"instance_name"`

	// The migration status of the instance
	// Example: MIGRATIONSTATUS_RUNNING
	MigrationStatus MigrationStatusType `json:"migration_status" yaml:"migration_status"`

	// A free-form string to provide additional information about the migration status
	// Example: "Migration 25% complete"
	MigrationStatusString string `json:"migration_status_string" yaml:"migration_status_string"`

	// An opaque integer identifier for the batch
	// Example: 123
	BatchID int `json:"batch_id" yaml:"batch_id"`

	// A human-friendly name for the batch
	// Example: MyBatch
	BatchName string `json:"batch_name" yaml:"batch_name"`
}

QueueEntry provides a high-level status for an instance that is in a migration stage.

swagger:model

type ServerPut

type ServerPut struct {
	// Server configuration map (refer to doc/server.md)
	// Example: {"core.https_address": ":6443"}
	Config map[string]string `json:"config" yaml:"config"`
}

ServerPut represents the modifiable fields of a server configuration

swagger:model

type ServerUntrusted

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

	// 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 Source

type Source struct {
	// A human-friendly name for this source
	// Example: MySource
	Name string `json:"name" yaml:"name"`

	// An opaque integer identifier for the source
	// Example: 123
	DatabaseID int `json:"database_id" yaml:"database_id"`

	// SourceType defines the type of the source
	SourceType SourceType `json:"source_type" yaml:"source_type"`

	// Properties contains source type specific properties
	Properties json.RawMessage `json:"properties" yaml:"properties"`
}

Source defines properties common to all sources.

swagger:model

type SourceType

type SourceType int
const (
	SOURCETYPE_UNKNOWN SourceType = iota
	SOURCETYPE_COMMON
	SOURCETYPE_VMWARE
)

func (SourceType) String

func (s SourceType) String() string

Implement the stringer interface.

type Target

type Target struct {
	// A human-friendly name for this target
	// Example: MyTarget
	Name string `json:"name" yaml:"name"`

	// An opaque integer identifier for the target
	// Example: 123
	DatabaseID int `json:"database_id" yaml:"database_id"`

	// TargetType defines the type of the target
	TargetType TargetType `json:"target_type" yaml:"target_type"`

	// Properties contains target type specific properties
	Properties json.RawMessage `json:"properties" yaml:"properties"`
}

Target defines properties common to all targets.

swagger:model

type TargetType

type TargetType int
const (
	TARGETTYPE_UNKNOWN TargetType = iota
	TARGETTYPE_INCUS
)

func (TargetType) String

func (t TargetType) String() string

Implement the stringer interface.

type VMwareProperties

type VMwareProperties struct {
	// Hostname or IP address of the source endpoint
	// Example: vsphere.local
	Endpoint string `json:"endpoint" yaml:"endpoint"`

	// If true, disable TLS certificate validation
	// Example: false
	Insecure bool `json:"insecure" yaml:"insecure"`

	// Username to authenticate against the endpoint
	// Example: admin
	Username string `json:"username" yaml:"username"`

	// Password to authenticate against the endpoint
	// Example: password
	Password string `json:"password" yaml:"password"`
}

VMwareProperties defines the set of VMware specific properties of an endpoint that the migration manager can connect to.

swagger:model

type WorkerCommand

type WorkerCommand struct {
	// The command for the worker to execute
	// Example: WORKERCOMMAND_IMPORT_DISKS
	Command WorkerCommandType `json:"command" yaml:"command"`

	// Internal path to the instance
	// Example: /SHF/vm/Migration Tests/DebianTest
	InventoryPath string `json:"inventory_path" yaml:"inventory_path"`

	// SourceType declares the type of the worker and is used as a hint to
	// correctly process the details provided in Source.
	SourceType SourceType `json:"sourceType" yaml:"sourceType"`

	// Source for the worker to fetch VM metadata and/or disk from.
	Source json.RawMessage `json:"source" yaml:"source"`

	// The name of the operating system
	// Example: Ubuntu
	OS string `json:"os" yaml:"os"`

	// The version of the operating system
	// Example: 24.04
	OSVersion string `json:"os_version" yaml:"os_version"`
}

WorkerCommand defines a command sent from the migration manager to a worker.

swagger:model

type WorkerCommandType

type WorkerCommandType int
const (
	WORKERCOMMAND_UNKNOWN WorkerCommandType = iota
	WORKERCOMMAND_IDLE
	WORKERCOMMAND_IMPORT_DISKS
	WORKERCOMMAND_FINALIZE_IMPORT
)

type WorkerResponse

type WorkerResponse struct {
	// The status of the command the work is/was executing.
	// Example: WORKERRESPONSE_RUNNING
	Status WorkerResponseType `json:"status" yaml:"status"`

	// A free-form string to provide additional information about the command status
	// Example: "Migration 25% complete"
	StatusString string `json:"status_string" yaml:"status_string"`
}

WorkerResponse defines a response received from a worker.

swagger:model

type WorkerResponseType

type WorkerResponseType int
const (
	WORKERRESPONSE_UNKNOWN WorkerResponseType = iota
	WORKERRESPONSE_RUNNING
	WORKERRESPONSE_SUCCESS
	WORKERRESPONSE_FAILED
)

Jump to

Keyboard shortcuts

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